Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions
nsHTMLTableColElement.cpp File Reference
#include "nsIDOMHTMLTableColElement.h"
#include "nsIDOMEventReceiver.h"
#include "nsMappedAttributes.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
#include "nsStyleConsts.h"
#include "nsPresContext.h"
#include "nsRuleData.h"

Go to the source code of this file.

Classes

class  nsHTMLTableColElement

Defines

#define MAX_COLSPAN   1000

Functions

 NS_HTML_CONTENT_INTERFACE_MAP_BEGIN (nsHTMLTableColElement, nsGenericHTMLElement) NS_HTML_CONTENT_INTERFACE_MAP_END PRBool nsHTMLTableColElement
static void MapAttributesIntoRule (const nsMappedAttributes *aAttributes, nsRuleData *aData)
static void ColMapAttributesIntoRule (const nsMappedAttributes *aAttributes, nsRuleData *aData)

Define Documentation

#define MAX_COLSPAN   1000

Definition at line 48 of file nsHTMLTableColElement.cpp.


Function Documentation

static void ColMapAttributesIntoRule ( const nsMappedAttributes aAttributes,
nsRuleData aData 
) [static]

Definition at line 189 of file nsHTMLTableColElement.cpp.

{
  if (aData->mSID == eStyleStruct_Table && 
      aData->mTableData->mSpan.GetUnit() == eCSSUnit_Null) {
    // span: int
    const nsAttrValue* value = aAttributes->GetAttr(nsHTMLAtoms::span);
    if (value && value->Type() == nsAttrValue::eInteger)
      aData->mTableData->mSpan.SetIntValue(value->GetIntegerValue(),
                                           eCSSUnit_Integer);
  }

  MapAttributesIntoRule(aAttributes, aData);
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void MapAttributesIntoRule ( const nsMappedAttributes aAttributes,
nsRuleData aData 
) [static]

Definition at line 143 of file nsHTMLTableColElement.cpp.

{
  if (aData->mSID == eStyleStruct_Position &&
      aData->mPositionData->mWidth.GetUnit() == eCSSUnit_Null) {
    // width
    const nsAttrValue* value = aAttributes->GetAttr(nsHTMLAtoms::width);
    if (value) {
      switch (value->Type()) {
      case nsAttrValue::ePercent: {
        aData->mPositionData->mWidth.SetPercentValue(value->GetPercentValue());
        break;
      }
      case nsAttrValue::eInteger: {
        aData->mPositionData->mWidth.SetFloatValue((float)value->GetIntegerValue(), eCSSUnit_Pixel);
        break;
      }
      case nsAttrValue::eProportional: {
        aData->mPositionData->mWidth.SetFloatValue((float)value->GetProportionalValue(), eCSSUnit_Proportional);
        break;
      }
      default:
        break;
      }
    }
  }
  else if (aData->mSID == eStyleStruct_Text) {
    if (aData->mTextData->mTextAlign.GetUnit() == eCSSUnit_Null) {
      // align: enum
      const nsAttrValue* value = aAttributes->GetAttr(nsHTMLAtoms::align);
      if (value && value->Type() == nsAttrValue::eEnum)
        aData->mTextData->mTextAlign.SetIntValue(value->GetEnumValue(), eCSSUnit_Enumerated);
    }
  }
  else if (aData->mSID == eStyleStruct_TextReset) {
    if (aData->mTextData->mVerticalAlign.GetUnit() == eCSSUnit_Null) {
      // valign: enum
      const nsAttrValue* value = aAttributes->GetAttr(nsHTMLAtoms::valign);
      if (value && value->Type() == nsAttrValue::eEnum)
        aData->mTextData->mVerticalAlign.SetIntValue(value->GetEnumValue(), eCSSUnit_Enumerated);
    }
  }

  nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 98 of file nsHTMLTableColElement.cpp.

{
  /* ignore these attributes, stored simply as strings ch */
  if (aAttribute == nsHTMLAtoms::charoff) {
    return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_FALSE);
  }
  if (aAttribute == nsHTMLAtoms::span) {
    /* protection from unrealistic large colspan values */
    return aResult.ParseIntWithBounds(aValue, 1, MAX_COLSPAN);
  }
  if (aAttribute == nsHTMLAtoms::width) {
    return aResult.ParseSpecialIntValue(aValue, PR_TRUE, PR_TRUE);
  }
  if (aAttribute == nsHTMLAtoms::align) {
    return ParseTableCellHAlignValue(aValue, aResult);
  }
  if (aAttribute == nsHTMLAtoms::valign) {
    return ParseTableVAlignValue(aValue, aResult);
  }

  return nsGenericHTMLElement::ParseAttribute(aAttribute, aValue, aResult);
}

Here is the call graph for this function: