зеркало из https://github.com/mozilla/pjs.git
update to new value class api
This commit is contained in:
Родитель
1cbc581d30
Коммит
28e3d1856a
|
@ -74,7 +74,7 @@ nscoord nsCSSLayout::VerticallyAlignChildren(nsIPresContext* aCX,
|
|||
nscoord kidYTop = 0;
|
||||
|
||||
switch (verticalAlignUnit) {
|
||||
case eStyleUnit_Twips:
|
||||
case eStyleUnit_Coord:
|
||||
kidYTop = aMaxAscent + textStyle->mVerticalAlign.GetCoordValue();
|
||||
break;
|
||||
|
||||
|
@ -164,7 +164,7 @@ nscoord nsCSSLayout::VerticallyAlignChildren(nsIPresContext* aCX,
|
|||
|
||||
if (eStyleUnit_Percent == verticalAlignUnit) {
|
||||
nscoord kidYTop = aMaxAscent +
|
||||
nscoord(textStyle->mVerticalAlign.GetFloatValue() * lineHeight);
|
||||
nscoord(textStyle->mVerticalAlign.GetPercentValue() * lineHeight);
|
||||
kid->GetRect(kidRect);
|
||||
kid->MoveTo(kidRect.x, aY0 + kidYTop);
|
||||
if (--pass2Kids == 0) {
|
||||
|
@ -252,9 +252,9 @@ void nsCSSLayout::RelativePositionChildren(nsIPresContext* aCX,
|
|||
kidSC->GetData(kStylePositionSID);
|
||||
if (NS_STYLE_POSITION_RELATIVE == kidPosition->mPosition) {
|
||||
kid->GetOrigin(origin);
|
||||
// XXX Check the flags: could be auto or percent (not just length)
|
||||
nscoord dx = kidPosition->mLeftOffset;
|
||||
nscoord dy = kidPosition->mTopOffset;
|
||||
// XXX Check the unit: could be auto or percent (not just length)
|
||||
nscoord dx = kidPosition->mLeftOffset.GetCoordValue();
|
||||
nscoord dy = kidPosition->mTopOffset.GetCoordValue();
|
||||
kid->MoveTo(origin.x + dx, origin.y + dy);
|
||||
}
|
||||
kid->GetNextSibling(kid);
|
||||
|
|
|
@ -977,20 +977,29 @@ PRBool CSSParserImpl::ParseDeclaration(PRInt32* aErrorCode, nsICSSDeclaration* a
|
|||
}
|
||||
|
||||
// Flags for ParseVariant method
|
||||
#define VARIANT_KEYWORD 0x01
|
||||
#define VARIANT_LENGTH 0x02
|
||||
#define VARIANT_PERCENT 0x04
|
||||
#define VARIANT_COLOR 0x08
|
||||
#define VARIANT_URL 0x10
|
||||
#define VARIANT_NUMBER 0x20
|
||||
#define VARIANT_INTEGER 0x40
|
||||
#define VARIANT_KEYWORD 0x0001
|
||||
#define VARIANT_LENGTH 0x0002
|
||||
#define VARIANT_PERCENT 0x0004
|
||||
#define VARIANT_COLOR 0x0008
|
||||
#define VARIANT_URL 0x0010
|
||||
#define VARIANT_NUMBER 0x0020
|
||||
#define VARIANT_INTEGER 0x0040
|
||||
#define VARIANT_AUTO 0x0100
|
||||
#define VARIANT_INHERIT 0x0200
|
||||
#define VARIANT_NONE 0x0400
|
||||
#define VARIANT_NORMAL 0x0800
|
||||
|
||||
// Common combinations of variants
|
||||
#define VARIANT_KL (VARIANT_KEYWORD | VARIANT_LENGTH)
|
||||
#define VARIANT_KLP (VARIANT_KEYWORD | VARIANT_LENGTH | VARIANT_PERCENT)
|
||||
#define VARIANT_KLPN (VARIANT_KLP | VARIANT_NUMBER)
|
||||
#define VARIANT_KP (VARIANT_KEYWORD | VARIANT_PERCENT)
|
||||
#define VARIANT_KI (VARIANT_KEYWORD | VARIANT_INTEGER)
|
||||
#define VARIANT_AHLP (VARIANT_AUTO | VARIANT_INHERIT | VARIANT_LP)
|
||||
#define VARIANT_AHI (VARIANT_AUTO | VARIANT_INHERIT | VARIANT_INTEGER)
|
||||
#define VARIANT_AHK (VARIANT_AUTO | VARIANT_INHERIT | VARIANT_KEYWORD)
|
||||
#define VARIANT_HLP (VARIANT_INHERIT | VARIANT_LP)
|
||||
#define VARIANT_HL (VARIANT_INHERIT | VARIANT_LENGTH)
|
||||
#define VARIANT_AL (VARIANT_AUTO | VARIANT_LENGTH)
|
||||
#define VARIANT_LP (VARIANT_LENGTH | VARIANT_PERCENT)
|
||||
#define VARIANT_CK (VARIANT_COLOR | VARIANT_KEYWORD)
|
||||
#define VARIANT_C VARIANT_COLOR
|
||||
|
@ -1008,11 +1017,6 @@ static PRInt32 kBackgroundColorKTable[] = {
|
|||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kBackgroundImageKTable[] = {
|
||||
KEYWORD_NONE, NS_STYLE_BG_IMAGE_NONE,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kBackgroundRepeatKTable[] = {
|
||||
KEYWORD_NO_REPEAT, NS_STYLE_BG_REPEAT_OFF,
|
||||
KEYWORD_REPEAT, NS_STYLE_BG_REPEAT_XY,
|
||||
|
@ -1049,13 +1053,7 @@ static PRInt32 kClearKTable[] = {
|
|||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kClipKTable[] = {
|
||||
KEYWORD_AUTO, NS_STYLE_CLIP_AUTO,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kCursorKTable[] = {
|
||||
KEYWORD_INHERIT, NS_STYLE_CURSOR_INHERIT,
|
||||
KEYWORD_IBEAM, NS_STYLE_CURSOR_IBEAM,
|
||||
KEYWORD_ARROW, NS_STYLE_CURSOR_DEFAULT,
|
||||
KEYWORD_HAND, NS_STYLE_CURSOR_HAND,
|
||||
|
@ -1110,16 +1108,6 @@ static PRInt32 kFontVariantKTable[] = {
|
|||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kLeftKTable[] = {
|
||||
KEYWORD_AUTO, NS_STYLE_POSITION_VALUE_AUTO,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kHeightKTable[] = {
|
||||
KEYWORD_AUTO, NS_STYLE_POSITION_VALUE_AUTO,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kLineHeightKTable[] = {
|
||||
KEYWORD_NORMAL, NS_STYLE_LINE_HEIGHT_NORMAL,
|
||||
-1
|
||||
|
@ -1154,11 +1142,6 @@ static PRInt32 kMarginSizeKTable[] = {
|
|||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kSpacingKTable[] = {
|
||||
KEYWORD_NORMAL, NS_STYLE_SPACING_NORMAL,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kOverflowKTable[] = {
|
||||
KEYWORD_VISIBLE, NS_STYLE_OVERFLOW_VISIBLE,
|
||||
KEYWORD_HIDDEN, NS_STYLE_OVERFLOW_HIDDEN,
|
||||
|
@ -1190,11 +1173,6 @@ static PRInt32 kTextTransformKTable[] = {
|
|||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kTopKTable[] = {
|
||||
KEYWORD_AUTO, NS_STYLE_POSITION_VALUE_AUTO,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kVerticalAlignKTable[] = {
|
||||
KEYWORD_BASELINE, NS_STYLE_VERTICAL_ALIGN_BASELINE,
|
||||
KEYWORD_SUB, NS_STYLE_VERTICAL_ALIGN_SUB,
|
||||
|
@ -1221,16 +1199,6 @@ static PRInt32 kWhitespaceKTable[] = {
|
|||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kWidthKTable[] = {
|
||||
KEYWORD_AUTO, NS_STYLE_POSITION_VALUE_AUTO,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kZIndexKTable[] = {
|
||||
KEYWORD_AUTO, NS_STYLE_POSITION_VALUE_AUTO,
|
||||
-1
|
||||
};
|
||||
|
||||
static const char* kBorderTopNames[] = {
|
||||
"border-top-width",
|
||||
"border-top-style",
|
||||
|
@ -1331,16 +1299,42 @@ PRBool CSSParserImpl::ParseVariant(PRInt32* aErrorCode,
|
|||
if (!GetToken(aErrorCode, PR_TRUE)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (((aVariants & VARIANT_KEYWORD) != 0) &&
|
||||
if (((aVariants & (VARIANT_AHK | VARIANT_NORMAL | VARIANT_NONE)) != 0) &&
|
||||
(eCSSToken_Ident == tk->mType)) {
|
||||
char cbuf[50];
|
||||
tk->mIdent.ToCString(cbuf, sizeof(cbuf));
|
||||
PRInt32 sid = nsCSSKeywords::LookupName(cbuf);
|
||||
if (sid >= 0) {
|
||||
PRInt32 ix = SearchKeywordTable(sid, aTable);
|
||||
if (ix >= 0) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(aTable[ix+1], eCSSUnit_Enumerated));
|
||||
return PR_TRUE;
|
||||
if (sid >= 0) { // known keyword
|
||||
if ((aVariants & VARIANT_AUTO) != 0) {
|
||||
if (sid == KEYWORD_AUTO) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(eCSSUnit_Auto));
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
if ((aVariants & VARIANT_INHERIT) != 0) {
|
||||
if (sid == KEYWORD_INHERIT) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(eCSSUnit_Inherit));
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
if ((aVariants & VARIANT_NONE) != 0) {
|
||||
if (sid == KEYWORD_NONE) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(eCSSUnit_None));
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
if ((aVariants & VARIANT_NORMAL) != 0) {
|
||||
if (sid == KEYWORD_NORMAL) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(eCSSUnit_Normal));
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
if ((aVariants & VARIANT_KEYWORD) != 0) {
|
||||
PRInt32 ix = SearchKeywordTable(sid, aTable);
|
||||
if (ix >= 0) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(aTable[ix+1], eCSSUnit_Enumerated));
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1359,7 +1353,7 @@ PRBool CSSParserImpl::ParseVariant(PRInt32* aErrorCode,
|
|||
}
|
||||
if (((aVariants & VARIANT_INTEGER) != 0) &&
|
||||
(eCSSToken_Number == tk->mType) && tk->mIntegerValid) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(tk->mInteger, eCSSUnit_Absolute));
|
||||
aDeclaration->AddValue(aName, nsCSSValue(tk->mInteger, eCSSUnit_Integer));
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (((aVariants & VARIANT_URL) != 0) &&
|
||||
|
@ -1493,8 +1487,8 @@ PRBool CSSParserImpl::ParseProperty(PRInt32* aErrorCode,
|
|||
case PROP_BACKGROUND_FILTER:
|
||||
return ParseBackgroundFilter(aErrorCode, aDeclaration, aName);
|
||||
case PROP_BACKGROUND_IMAGE:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_UK,
|
||||
kBackgroundImageKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_URL | VARIANT_NONE,
|
||||
nsnull);
|
||||
case PROP_BACKGROUND_POSITION:
|
||||
return ParseBackgroundPosition(aErrorCode, aDeclaration, aName);
|
||||
case PROP_BACKGROUND_REPEAT:
|
||||
|
@ -1538,7 +1532,7 @@ PRBool CSSParserImpl::ParseProperty(PRInt32* aErrorCode,
|
|||
case PROP_COLOR:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_COLOR, nsnull);
|
||||
case PROP_CURSOR:
|
||||
return ParseEnum(aErrorCode, aDeclaration, aName, kCursorKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_AHK, kCursorKTable);
|
||||
case PROP_DIRECTION:
|
||||
return ParseEnum(aErrorCode, aDeclaration, aName, kDirectionKTable);
|
||||
case PROP_DISPLAY:
|
||||
|
@ -1561,9 +1555,9 @@ PRBool CSSParserImpl::ParseProperty(PRInt32* aErrorCode,
|
|||
case PROP_FONT_WEIGHT:
|
||||
return ParseFontWeight(aErrorCode, aDeclaration, aName);
|
||||
case PROP_HEIGHT:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KLP, kHeightKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_AHLP, nsnull);
|
||||
case PROP_LEFT:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KLP, kLeftKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_AHLP, nsnull);
|
||||
case PROP_LINE_HEIGHT:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KLPN,
|
||||
kLineHeightKTable);
|
||||
|
@ -1604,7 +1598,7 @@ PRBool CSSParserImpl::ParseProperty(PRInt32* aErrorCode,
|
|||
case PROP_TEXT_TRANSFORM:
|
||||
return ParseEnum(aErrorCode, aDeclaration, aName, kTextTransformKTable);
|
||||
case PROP_TOP:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KLP, kTopKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_AHLP, nsnull);
|
||||
case PROP_VERTICAL_ALIGN:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KP,
|
||||
kVerticalAlignKTable);
|
||||
|
@ -1613,12 +1607,12 @@ PRBool CSSParserImpl::ParseProperty(PRInt32* aErrorCode,
|
|||
case PROP_WHITE_SPACE:
|
||||
return ParseEnum(aErrorCode, aDeclaration, aName, kWhitespaceKTable);
|
||||
case PROP_WIDTH:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KLP, kWidthKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_AHLP, nsnull);
|
||||
case PROP_LETTER_SPACING:
|
||||
case PROP_WORD_SPACING:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KL, kSpacingKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_HL | VARIANT_NORMAL, nsnull);
|
||||
case PROP_Z_INDEX:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KI, kZIndexKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_AHI, nsnull);
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -1910,8 +1904,7 @@ PRBool CSSParserImpl::ParseClip(PRInt32* aErrorCode, nsICSSDeclaration* aDeclara
|
|||
}
|
||||
if (ident->EqualsIgnoreCase("auto")) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
aDeclaration->AddValue(kClipNames[i],
|
||||
nsCSSValue(NS_STYLE_CLIP_AUTO, eCSSUnit_Enumerated));
|
||||
aDeclaration->AddValue(kClipNames[i], nsCSSValue(eCSSUnit_Auto));
|
||||
}
|
||||
return PR_TRUE;
|
||||
} else if (ident->EqualsIgnoreCase("rect")) {
|
||||
|
@ -1919,8 +1912,7 @@ PRBool CSSParserImpl::ParseClip(PRInt32* aErrorCode, nsICSSDeclaration* aDeclara
|
|||
return PR_FALSE;
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (!ParseVariant(aErrorCode, aDeclaration, kClipNames[i], VARIANT_KL,
|
||||
kClipKTable)) {
|
||||
if (!ParseVariant(aErrorCode, aDeclaration, kClipNames[i], VARIANT_AL, nsnull)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (3 != i) {
|
||||
|
@ -2078,7 +2070,7 @@ PRBool CSSParserImpl::ParseFontWeight(PRInt32* aErrorCode, nsICSSDeclaration* aD
|
|||
if (v < 100) v = 100;
|
||||
else if (v > 900) v = 900;
|
||||
v = v - (v % 100);
|
||||
aDeclaration->AddValue(aName, nsCSSValue(v, eCSSUnit_Absolute));
|
||||
aDeclaration->AddValue(aName, nsCSSValue(v, eCSSUnit_Integer));
|
||||
} else {
|
||||
UngetToken();
|
||||
return PR_FALSE;
|
||||
|
@ -2204,6 +2196,6 @@ PRBool CSSParserImpl::ParseTextDecoration(PRInt32* aErrorCode,
|
|||
if (0 == decoration) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
aDeclaration->AddValue(aName, nsCSSValue(decoration, eCSSUnit_Absolute));
|
||||
aDeclaration->AddValue(aName, nsCSSValue(decoration, eCSSUnit_Integer));
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
|
|
@ -163,6 +163,9 @@ public:
|
|||
|
||||
virtual nscoord CalcLength(const nsCSSValue& aValue, nsStyleFont* aFont,
|
||||
nsIPresContext* aPresContext);
|
||||
virtual void SetCoord(const nsCSSValue& aValue, nsStyleCoord& aCoord,
|
||||
PRInt32 aMask, nsStyleFont* aFont,
|
||||
nsIPresContext* aPresContext);
|
||||
virtual void MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext);
|
||||
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
@ -437,6 +440,56 @@ nscoord CSSStyleRuleImpl::CalcLength(const nsCSSValue& aValue,
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define SETCOORD_LENGTH 0x01
|
||||
#define SETCOORD_PERCENT 0x02
|
||||
#define SETCOORD_INTEGER 0x04
|
||||
#define SETCOORD_ENUMERATED 0x08
|
||||
#define SETCOORD_AUTO 0x10
|
||||
#define SETCOORD_INHERIT 0x20
|
||||
#define SETCOORD_NORMAL 0x80
|
||||
|
||||
#define SETCOORD_LP (SETCOORD_LENGTH | SETCOORD_PERCENT)
|
||||
#define SETCOORD_LH (SETCOORD_LENGTH | SETCOORD_INHERIT)
|
||||
#define SETCOORD_AH (SETCOORD_AUTO | SETCOORD_INHERIT)
|
||||
#define SETCOORD_LPH (SETCOORD_LP | SETCOORD_INHERIT)
|
||||
#define SETCOORD_LPAH (SETCOORD_LP | SETCOORD_AH)
|
||||
#define SETCOORD_LPEH (SETCOORD_LP | SETCOORD_ENUMERATED | SETCOORD_INHERIT)
|
||||
#define SETCOORD_IAH (SETCOORD_INTEGER | SETCOORD_AH)
|
||||
|
||||
void CSSStyleRuleImpl::SetCoord(const nsCSSValue& aValue, nsStyleCoord& aCoord,
|
||||
PRInt32 aMask, nsStyleFont* aFont,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
if (((aMask & SETCOORD_LENGTH) != 0) &&
|
||||
aValue.IsLengthUnit()) {
|
||||
aCoord.SetCoordValue(CalcLength(aValue, aFont, aPresContext));
|
||||
}
|
||||
else if (((aMask & SETCOORD_PERCENT) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Percent)) {
|
||||
aCoord.SetPercentValue(aValue.GetPercentValue());
|
||||
}
|
||||
else if (((aMask & SETCOORD_INTEGER) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Integer)) {
|
||||
aCoord.SetIntValue(aValue.GetIntValue(), eStyleUnit_Integer);
|
||||
}
|
||||
else if (((aMask & SETCOORD_ENUMERATED) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Enumerated)) {
|
||||
aCoord.SetIntValue(aValue.GetIntValue(), eStyleUnit_Enumerated);
|
||||
}
|
||||
else if (((aMask & SETCOORD_AUTO) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Auto)) {
|
||||
aCoord.SetAutoValue();
|
||||
}
|
||||
else if (((aMask & SETCOORD_INHERIT) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Inherit)) {
|
||||
aCoord.SetInheritValue();
|
||||
}
|
||||
else if (((aMask & SETCOORD_NORMAL) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Normal)) {
|
||||
aCoord.SetNormalValue();
|
||||
}
|
||||
}
|
||||
|
||||
void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext)
|
||||
{
|
||||
if (nsnull != mDeclaration) {
|
||||
|
@ -483,7 +536,7 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
}
|
||||
|
||||
// font-weight: abs, enum
|
||||
if (ourFont->mWeight.GetUnit() == eCSSUnit_Absolute) {
|
||||
if (ourFont->mWeight.GetUnit() == eCSSUnit_Integer) {
|
||||
font->mFont.style = ourFont->mWeight.GetIntValue();
|
||||
}
|
||||
else if (ourFont->mWeight.GetUnit() == eCSSUnit_Enumerated) {
|
||||
|
@ -539,7 +592,7 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
font->mFont.size = CalcLength(ourFont->mSize, parentFont, aPresContext);
|
||||
}
|
||||
else if (ourFont->mSize.GetUnit() == eCSSUnit_Percent) {
|
||||
font->mFont.size = (nscoord)((float)(parentFont->mFont.size) * ourFont->mSize.GetFloatValue());
|
||||
font->mFont.size = (nscoord)((float)(parentFont->mFont.size) * ourFont->mSize.GetPercentValue());
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(parentContext);
|
||||
|
@ -553,25 +606,11 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
nsStyleText* text = (nsStyleText*) aContext->GetData(kStyleTextSID);
|
||||
|
||||
// letter-spacing
|
||||
if (ourText->mLetterSpacing.IsLengthUnit()) {
|
||||
text->mLetterSpacing.Set(CalcLength(ourText->mLetterSpacing,
|
||||
font, aPresContext));
|
||||
}
|
||||
else if (ourText->mLetterSpacing.GetUnit() == eCSSUnit_Enumerated) {
|
||||
text->mLetterSpacing.SetAuto();
|
||||
}
|
||||
SetCoord(ourText->mLetterSpacing, text->mLetterSpacing, SETCOORD_LH | SETCOORD_NORMAL,
|
||||
font, aPresContext);
|
||||
|
||||
// line-height
|
||||
if (ourText->mLineHeight.IsLengthUnit()) {
|
||||
text->mLineHeight.Set(CalcLength(ourText->mLineHeight,
|
||||
font, aPresContext));
|
||||
}
|
||||
else if (ourText->mLineHeight.GetUnit() == eCSSUnit_Enumerated) {
|
||||
text->mLineHeight.SetAuto();
|
||||
}
|
||||
else if (ourText->mLineHeight.GetUnit() == eCSSUnit_Percent) {
|
||||
text->mLineHeight.Set(ourText->mLineHeight.GetFloatValue());
|
||||
}
|
||||
SetCoord(ourText->mLineHeight, text->mLineHeight, SETCOORD_LPAH, font, aPresContext);
|
||||
|
||||
// text-align
|
||||
if (ourText->mTextAlign.GetUnit() == eCSSUnit_Enumerated) {
|
||||
|
@ -579,17 +618,11 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
}
|
||||
|
||||
// text-indent
|
||||
if (ourText->mTextIndent.IsLengthUnit()) {
|
||||
text->mTextIndent.Set(CalcLength(ourText->mTextIndent,
|
||||
font, aPresContext));
|
||||
}
|
||||
else if (ourText->mTextIndent.GetUnit() == eCSSUnit_Percent) {
|
||||
text->mTextIndent.Set(ourText->mTextIndent.GetFloatValue());
|
||||
}
|
||||
SetCoord(ourText->mTextIndent, text->mTextIndent, SETCOORD_LPH, font, aPresContext);
|
||||
|
||||
// text-decoration: enum, absolute (bit field)
|
||||
// text-decoration: enum, int (bit field)
|
||||
if ((ourText->mDecoration.GetUnit() == eCSSUnit_Enumerated) ||
|
||||
(ourText->mDecoration.GetUnit() == eCSSUnit_Absolute)) {
|
||||
(ourText->mDecoration.GetUnit() == eCSSUnit_Integer)) {
|
||||
PRInt32 td = ourText->mDecoration.GetIntValue();
|
||||
font->mFont.decorations = td;
|
||||
text->mTextDecoration = td;
|
||||
|
@ -601,16 +634,8 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
}
|
||||
|
||||
// vertical-align
|
||||
if (ourText->mVerticalAlign.IsLengthUnit()) {
|
||||
text->mVerticalAlign.Set(CalcLength(ourText->mVerticalAlign,
|
||||
font, aPresContext));
|
||||
}
|
||||
else if (ourText->mVerticalAlign.GetUnit() == eCSSUnit_Enumerated) {
|
||||
text->mVerticalAlign.Set(ourText->mVerticalAlign.GetIntValue(), eStyleUnit_Enumerated);
|
||||
}
|
||||
else if (ourText->mVerticalAlign.GetUnit() == eCSSUnit_Percent) {
|
||||
text->mVerticalAlign.Set(ourText->mVerticalAlign.GetFloatValue());
|
||||
}
|
||||
SetCoord(ourText->mVerticalAlign, text->mVerticalAlign, SETCOORD_LPEH,
|
||||
font, aPresContext);
|
||||
|
||||
// white-space
|
||||
if (ourText->mWhiteSpace.GetUnit() == eCSSUnit_Enumerated) {
|
||||
|
@ -618,13 +643,8 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
}
|
||||
|
||||
// word-spacing
|
||||
if (ourText->mWordSpacing.IsLengthUnit()) {
|
||||
text->mWordSpacing.Set(CalcLength(ourText->mWordSpacing,
|
||||
font, aPresContext));
|
||||
}
|
||||
else if (ourText->mWordSpacing.GetUnit() == eCSSUnit_Enumerated) {
|
||||
text->mWordSpacing.SetAuto();
|
||||
}
|
||||
SetCoord(ourText->mWordSpacing, text->mWordSpacing, SETCOORD_LH | SETCOORD_NORMAL,
|
||||
font, aPresContext);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -636,13 +656,11 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
aContext->GetData(kStyleDisplaySID);
|
||||
|
||||
// display
|
||||
display->mDisplay = NS_STYLE_DISPLAY_INLINE;
|
||||
if (ourDisplay->mDisplay.GetUnit() == eCSSUnit_Enumerated) {
|
||||
display->mDisplay = ourDisplay->mDisplay.GetIntValue();
|
||||
}
|
||||
|
||||
// direction: enum
|
||||
display->mDirection = NS_STYLE_DIRECTION_LTR;
|
||||
if (ourDisplay->mDirection.GetUnit() == eCSSUnit_Enumerated) {
|
||||
display->mDirection = ourDisplay->mDirection.GetIntValue();
|
||||
}
|
||||
|
@ -670,10 +688,16 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
color->mColor = ourColor->mColor.GetColorValue();
|
||||
}
|
||||
|
||||
// cursor: enum
|
||||
// cursor: enum, auto, inherit
|
||||
if (ourColor->mCursor.GetUnit() == eCSSUnit_Enumerated) {
|
||||
color->mCursor = ourColor->mCursor.GetIntValue();
|
||||
}
|
||||
else if (ourColor->mCursor.GetUnit() == eCSSUnit_Auto) {
|
||||
color->mCursor = NS_STYLE_CURSOR_AUTO;
|
||||
}
|
||||
else if (ourColor->mCursor.GetUnit() == eCSSUnit_Inherit) {
|
||||
color->mCursor = NS_STYLE_CURSOR_INHERIT;
|
||||
}
|
||||
|
||||
// cursor-image: string
|
||||
if (ourColor->mCursorImage.GetUnit() == eCSSUnit_String) {
|
||||
|
@ -689,12 +713,13 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
color->mBackgroundFlags |= NS_STYLE_BG_COLOR_TRANSPARENT;
|
||||
}
|
||||
|
||||
// background-image: string, enum (flags)
|
||||
// background-image: string (url), none
|
||||
if (ourColor->mBackImage.GetUnit() == eCSSUnit_String) {
|
||||
ourColor->mBackImage.GetStringValue(color->mBackgroundImage);
|
||||
color->mBackgroundFlags &= ~NS_STYLE_BG_IMAGE_NONE;
|
||||
}
|
||||
else if (ourColor->mBackImage.GetUnit() == eCSSUnit_Enumerated) {
|
||||
else if (ourColor->mBackImage.GetUnit() == eCSSUnit_None) {
|
||||
color->mBackgroundImage.Truncate();
|
||||
color->mBackgroundFlags |= NS_STYLE_BG_IMAGE_NONE;
|
||||
}
|
||||
|
||||
|
@ -710,7 +735,7 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
|
||||
// background-position: length, percent (flags)
|
||||
if (ourColor->mBackPositionX.GetUnit() == eCSSUnit_Percent) {
|
||||
color->mBackgroundXPosition = (nscoord)(TWIPS_CONST_FLOAT * ourColor->mBackPositionX.GetFloatValue());
|
||||
color->mBackgroundXPosition = (nscoord)(100.0f * ourColor->mBackPositionX.GetPercentValue());
|
||||
color->mBackgroundFlags |= NS_STYLE_BG_X_POSITION_PERCENT;
|
||||
color->mBackgroundFlags &= ~NS_STYLE_BG_X_POSITION_LENGTH;
|
||||
}
|
||||
|
@ -721,7 +746,7 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
color->mBackgroundFlags &= ~NS_STYLE_BG_X_POSITION_PERCENT;
|
||||
}
|
||||
if (ourColor->mBackPositionY.GetUnit() == eCSSUnit_Percent) {
|
||||
color->mBackgroundYPosition = (nscoord)(TWIPS_CONST_FLOAT * ourColor->mBackPositionY.GetFloatValue());
|
||||
color->mBackgroundYPosition = (nscoord)(100.0f * ourColor->mBackPositionY.GetPercentValue());
|
||||
color->mBackgroundFlags |= NS_STYLE_BG_Y_POSITION_PERCENT;
|
||||
color->mBackgroundFlags &= ~NS_STYLE_BG_Y_POSITION_LENGTH;
|
||||
}
|
||||
|
@ -750,25 +775,25 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
spacing->mMargin.left = CalcLength(ourMargin->mMargin->mLeft, font, aPresContext);
|
||||
} else if (ourMargin->mMargin->mLeft.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mMargin.left = (nscoord)ourMargin->mMargin->mLeft.GetFloatValue();
|
||||
spacing->mMargin.left = (nscoord)ourMargin->mMargin->mLeft.GetPercentValue();
|
||||
}
|
||||
if (ourMargin->mMargin->mTop.IsLengthUnit()) {
|
||||
spacing->mMargin.top = CalcLength(ourMargin->mMargin->mTop, font, aPresContext);
|
||||
} else if (ourMargin->mMargin->mTop.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mMargin.top = (nscoord)ourMargin->mMargin->mTop.GetFloatValue();
|
||||
spacing->mMargin.top = (nscoord)ourMargin->mMargin->mTop.GetPercentValue();
|
||||
}
|
||||
if (ourMargin->mMargin->mRight.IsLengthUnit()) {
|
||||
spacing->mMargin.right = CalcLength(ourMargin->mMargin->mRight, font, aPresContext);
|
||||
} else if (ourMargin->mMargin->mRight.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mMargin.right = (nscoord)ourMargin->mMargin->mRight.GetFloatValue();
|
||||
spacing->mMargin.right = (nscoord)ourMargin->mMargin->mRight.GetPercentValue();
|
||||
}
|
||||
if (ourMargin->mMargin->mBottom.IsLengthUnit()) {
|
||||
spacing->mMargin.bottom = CalcLength(ourMargin->mMargin->mBottom, font, aPresContext);
|
||||
} else if (ourMargin->mMargin->mBottom.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mMargin.bottom = (nscoord)ourMargin->mMargin->mBottom.GetFloatValue();
|
||||
spacing->mMargin.bottom = (nscoord)ourMargin->mMargin->mBottom.GetPercentValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -778,25 +803,25 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
spacing->mPadding.left = CalcLength(ourMargin->mPadding->mLeft, font, aPresContext);
|
||||
} else if (ourMargin->mPadding->mLeft.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mPadding.left = (nscoord)ourMargin->mPadding->mLeft.GetFloatValue();
|
||||
spacing->mPadding.left = (nscoord)ourMargin->mPadding->mLeft.GetPercentValue();
|
||||
}
|
||||
if (ourMargin->mPadding->mTop.IsLengthUnit()) {
|
||||
spacing->mPadding.top = CalcLength(ourMargin->mPadding->mTop, font, aPresContext);
|
||||
} else if (ourMargin->mPadding->mTop.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mPadding.top = (nscoord)ourMargin->mPadding->mTop.GetFloatValue();
|
||||
spacing->mPadding.top = (nscoord)ourMargin->mPadding->mTop.GetPercentValue();
|
||||
}
|
||||
if (ourMargin->mPadding->mRight.IsLengthUnit()) {
|
||||
spacing->mPadding.right = CalcLength(ourMargin->mPadding->mRight, font, aPresContext);
|
||||
} else if (ourMargin->mPadding->mRight.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mPadding.right = (nscoord)ourMargin->mPadding->mRight.GetFloatValue();
|
||||
spacing->mPadding.right = (nscoord)ourMargin->mPadding->mRight.GetPercentValue();
|
||||
}
|
||||
if (ourMargin->mPadding->mBottom.IsLengthUnit()) {
|
||||
spacing->mPadding.bottom = CalcLength(ourMargin->mPadding->mBottom, font, aPresContext);
|
||||
} else if (ourMargin->mPadding->mBottom.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mPadding.bottom = (nscoord)ourMargin->mPadding->mBottom.GetFloatValue();
|
||||
spacing->mPadding.bottom = (nscoord)ourMargin->mPadding->mBottom.GetPercentValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -808,25 +833,25 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
border->mSize.left = CalcLength(ourBorder->mLeft, font, aPresContext);
|
||||
} else if (ourBorder->mLeft.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
border->mSize.left = (nscoord)ourBorder->mLeft.GetFloatValue();
|
||||
border->mSize.left = (nscoord)ourBorder->mLeft.GetPercentValue();
|
||||
}
|
||||
if (ourBorder->mTop.IsLengthUnit()) {
|
||||
border->mSize.top = CalcLength(ourBorder->mTop, font, aPresContext);
|
||||
} else if (ourBorder->mTop.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
border->mSize.top = (nscoord)ourBorder->mTop.GetFloatValue();
|
||||
border->mSize.top = (nscoord)ourBorder->mTop.GetPercentValue();
|
||||
}
|
||||
if (ourBorder->mRight.IsLengthUnit()) {
|
||||
border->mSize.right = CalcLength(ourBorder->mRight, font, aPresContext);
|
||||
} else if (ourBorder->mRight.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
border->mSize.right = (nscoord)ourBorder->mRight.GetFloatValue();
|
||||
border->mSize.right = (nscoord)ourBorder->mRight.GetPercentValue();
|
||||
}
|
||||
if (ourBorder->mBottom.IsLengthUnit()) {
|
||||
border->mSize.bottom = CalcLength(ourBorder->mBottom, font, aPresContext);
|
||||
} else if (ourBorder->mBottom.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
border->mSize.bottom = (nscoord)ourBorder->mBottom.GetFloatValue();
|
||||
border->mSize.bottom = (nscoord)ourBorder->mBottom.GetPercentValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -882,64 +907,36 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
position->mOverflow = ourPosition->mOverflow.GetIntValue();
|
||||
}
|
||||
|
||||
// box offsets. note: default value is auto so we don't check for it here
|
||||
if (ourPosition->mLeft.IsLengthUnit()) {
|
||||
position->mLeftOffset = CalcLength(ourPosition->mLeft, font, aPresContext);
|
||||
position->mLeftOffsetFlags = NS_STYLE_POSITION_VALUE_LENGTH;
|
||||
} else if (ourPosition->mHeight.GetUnit() == eCSSUnit_Percent) {
|
||||
position->mLeftOffset = (nscoord)(100 * ourPosition->mLeft.GetFloatValue());
|
||||
position->mLeftOffsetFlags = NS_STYLE_POSITION_VALUE_PERCENT;
|
||||
}
|
||||
if (ourPosition->mTop.IsLengthUnit()) {
|
||||
position->mTopOffset = CalcLength(ourPosition->mTop, font, aPresContext);
|
||||
position->mTopOffsetFlags = NS_STYLE_POSITION_VALUE_LENGTH;
|
||||
} else if (ourPosition->mHeight.GetUnit() == eCSSUnit_Percent) {
|
||||
position->mTopOffset = (nscoord)(100 * ourPosition->mTop.GetFloatValue());
|
||||
position->mTopOffsetFlags = NS_STYLE_POSITION_VALUE_PERCENT;
|
||||
}
|
||||
if (ourPosition->mWidth.IsLengthUnit()) {
|
||||
position->mWidth = CalcLength(ourPosition->mWidth, font, aPresContext);
|
||||
position->mWidthFlags = NS_STYLE_POSITION_VALUE_LENGTH;
|
||||
} else if (ourPosition->mWidth.GetUnit() == eCSSUnit_Percent) {
|
||||
position->mWidth = (nscoord)(100 * ourPosition->mWidth.GetFloatValue());
|
||||
position->mWidthFlags = NS_STYLE_POSITION_VALUE_PERCENT;
|
||||
}
|
||||
if (ourPosition->mHeight.IsLengthUnit()) {
|
||||
position->mHeight = CalcLength(ourPosition->mHeight, font, aPresContext);
|
||||
position->mHeightFlags = NS_STYLE_POSITION_VALUE_LENGTH;
|
||||
} else if (ourPosition->mHeight.GetUnit() == eCSSUnit_Percent) {
|
||||
position->mHeight = (nscoord)(100 * ourPosition->mHeight.GetFloatValue());
|
||||
position->mHeightFlags = NS_STYLE_POSITION_VALUE_PERCENT;
|
||||
}
|
||||
// box offsets: length, percent, auto, inherit
|
||||
SetCoord(ourPosition->mLeft, position->mLeftOffset, SETCOORD_LPAH, font, aPresContext);
|
||||
SetCoord(ourPosition->mTop, position->mTopOffset, SETCOORD_LPAH, font, aPresContext);
|
||||
SetCoord(ourPosition->mWidth, position->mWidth, SETCOORD_LPAH, font, aPresContext);
|
||||
SetCoord(ourPosition->mHeight, position->mHeight, SETCOORD_LPAH, font, aPresContext);
|
||||
|
||||
// z-index
|
||||
if (ourPosition->mZIndex.GetUnit() == eCSSUnit_Enumerated) {
|
||||
position->mPosition = ourPosition->mPosition.GetIntValue();
|
||||
} else if (ourPosition->mZIndex.GetUnit() == eCSSUnit_Absolute) {
|
||||
position->mZIndex = ourPosition->mZIndex.GetIntValue();
|
||||
}
|
||||
SetCoord(ourPosition->mZIndex, position->mZIndex, SETCOORD_IAH, nsnull, nsnull);
|
||||
|
||||
// clip property
|
||||
// clip property: length, auto
|
||||
if (nsnull != ourPosition->mClip) {
|
||||
position->mClipFlags = NS_STYLE_CLIP_RECT;
|
||||
|
||||
if (ourPosition->mClip->mTop.GetUnit() == eCSSUnit_Enumerated) {
|
||||
position->mClip.top = ourPosition->mClip->mTop.GetIntValue();
|
||||
if (ourPosition->mClip->mTop.GetUnit() == eCSSUnit_Auto) {
|
||||
// XXX position->mClip.top = ourPosition->mClip->mTop.GetIntValue();
|
||||
} else if (ourPosition->mClip->mTop.IsLengthUnit()) {
|
||||
position->mClip.top = CalcLength(ourPosition->mClip->mTop, font, aPresContext);
|
||||
}
|
||||
if (ourPosition->mClip->mRight.GetUnit() == eCSSUnit_Enumerated) {
|
||||
position->mClip.right = ourPosition->mClip->mRight.GetIntValue();
|
||||
if (ourPosition->mClip->mRight.GetUnit() == eCSSUnit_Auto) {
|
||||
// XXX position->mClip.right = ourPosition->mClip->mRight.GetIntValue();
|
||||
} else if (ourPosition->mClip->mRight.IsLengthUnit()) {
|
||||
position->mClip.right = CalcLength(ourPosition->mClip->mRight, font, aPresContext);
|
||||
}
|
||||
if (ourPosition->mClip->mBottom.GetUnit() == eCSSUnit_Enumerated) {
|
||||
position->mClip.bottom = ourPosition->mClip->mBottom.GetIntValue();
|
||||
if (ourPosition->mClip->mBottom.GetUnit() == eCSSUnit_Auto) {
|
||||
// XXX position->mClip.bottom = ourPosition->mClip->mBottom.GetIntValue();
|
||||
} else if (ourPosition->mClip->mBottom.IsLengthUnit()) {
|
||||
position->mClip.bottom = CalcLength(ourPosition->mClip->mBottom, font, aPresContext);
|
||||
}
|
||||
if (ourPosition->mClip->mLeft.GetUnit() == eCSSUnit_Enumerated) {
|
||||
position->mClip.left = ourPosition->mClip->mLeft.GetIntValue();
|
||||
if (ourPosition->mClip->mLeft.GetUnit() == eCSSUnit_Auto) {
|
||||
// XXX position->mClip.left = ourPosition->mClip->mLeft.GetIntValue();
|
||||
} else if (ourPosition->mClip->mLeft.IsLengthUnit()) {
|
||||
position->mClip.left = CalcLength(ourPosition->mClip->mLeft, font, aPresContext);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ struct HTMLAttribute {
|
|||
}
|
||||
}
|
||||
else {
|
||||
aBuffer.SetLength(0);
|
||||
aBuffer.Truncate();
|
||||
aBuffer.Append("null");
|
||||
}
|
||||
}
|
||||
|
@ -303,13 +303,13 @@ PRInt32 HTMLAttributesImpl::SetAttribute(nsIAtom* aAttribute, const nsString& aV
|
|||
{
|
||||
if (nsHTMLAtoms::id == aAttribute) {
|
||||
nsIAtom* id = NS_NewAtom(aValue);
|
||||
PRInt32 result = SetID (id);
|
||||
PRInt32 result = SetID(id);
|
||||
NS_RELEASE(id);
|
||||
return result;
|
||||
}
|
||||
if (nsHTMLAtoms::kClass == aAttribute) {
|
||||
nsIAtom* classA = NS_NewAtom(aValue);
|
||||
PRInt32 result = SetClass (classA);
|
||||
PRInt32 result = SetClass(classA);
|
||||
NS_RELEASE(classA);
|
||||
return result;
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ PRInt32 HTMLAttributesImpl::SetAttribute(nsIAtom* aAttribute, const nsString& aV
|
|||
|
||||
while (nsnull != attr) {
|
||||
if (attr->mAttribute == aAttribute) {
|
||||
attr->mValue.Set (aValue);
|
||||
attr->mValue.SetStringValue(aValue);
|
||||
return mCount;
|
||||
}
|
||||
last = attr;
|
||||
|
@ -341,14 +341,14 @@ PRInt32 HTMLAttributesImpl::SetAttribute(nsIAtom* aAttribute, const nsHTMLValue&
|
|||
if (nsHTMLAtoms::id == aAttribute) {
|
||||
nsAutoString buffer;
|
||||
nsIAtom* id = NS_NewAtom(aValue.GetStringValue(buffer));
|
||||
PRInt32 result = SetID (id);
|
||||
PRInt32 result = SetID(id);
|
||||
NS_RELEASE(id);
|
||||
return result;
|
||||
}
|
||||
if (nsHTMLAtoms::kClass == aAttribute) {
|
||||
nsAutoString buffer;
|
||||
nsIAtom* classA = NS_NewAtom(aValue.GetStringValue(buffer));
|
||||
PRInt32 result = SetClass (classA);
|
||||
PRInt32 result = SetClass(classA);
|
||||
NS_RELEASE(classA);
|
||||
return result;
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ nsContentAttr HTMLAttributesImpl::GetAttribute(nsIAtom* aAttribute,
|
|||
if (nsnull != id) {
|
||||
nsAutoString buffer;
|
||||
id->ToString(buffer);
|
||||
aValue.Set(buffer);
|
||||
aValue.SetStringValue(buffer);
|
||||
NS_RELEASE(id);
|
||||
return eContentAttr_HasValue;
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ nsContentAttr HTMLAttributesImpl::GetAttribute(nsIAtom* aAttribute,
|
|||
if (nsnull != classA) {
|
||||
nsAutoString buffer;
|
||||
classA->ToString(buffer);
|
||||
aValue.Set(buffer);
|
||||
aValue.SetStringValue(buffer);
|
||||
NS_RELEASE(classA);
|
||||
return eContentAttr_HasValue;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ nscoord nsCSSLayout::VerticallyAlignChildren(nsIPresContext* aCX,
|
|||
nscoord kidYTop = 0;
|
||||
|
||||
switch (verticalAlignUnit) {
|
||||
case eStyleUnit_Twips:
|
||||
case eStyleUnit_Coord:
|
||||
kidYTop = aMaxAscent + textStyle->mVerticalAlign.GetCoordValue();
|
||||
break;
|
||||
|
||||
|
@ -164,7 +164,7 @@ nscoord nsCSSLayout::VerticallyAlignChildren(nsIPresContext* aCX,
|
|||
|
||||
if (eStyleUnit_Percent == verticalAlignUnit) {
|
||||
nscoord kidYTop = aMaxAscent +
|
||||
nscoord(textStyle->mVerticalAlign.GetFloatValue() * lineHeight);
|
||||
nscoord(textStyle->mVerticalAlign.GetPercentValue() * lineHeight);
|
||||
kid->GetRect(kidRect);
|
||||
kid->MoveTo(kidRect.x, aY0 + kidYTop);
|
||||
if (--pass2Kids == 0) {
|
||||
|
@ -252,9 +252,9 @@ void nsCSSLayout::RelativePositionChildren(nsIPresContext* aCX,
|
|||
kidSC->GetData(kStylePositionSID);
|
||||
if (NS_STYLE_POSITION_RELATIVE == kidPosition->mPosition) {
|
||||
kid->GetOrigin(origin);
|
||||
// XXX Check the flags: could be auto or percent (not just length)
|
||||
nscoord dx = kidPosition->mLeftOffset;
|
||||
nscoord dy = kidPosition->mTopOffset;
|
||||
// XXX Check the unit: could be auto or percent (not just length)
|
||||
nscoord dx = kidPosition->mLeftOffset.GetCoordValue();
|
||||
nscoord dy = kidPosition->mTopOffset.GetCoordValue();
|
||||
kid->MoveTo(origin.x + dx, origin.y + dy);
|
||||
}
|
||||
kid->GetNextSibling(kid);
|
||||
|
|
|
@ -977,20 +977,29 @@ PRBool CSSParserImpl::ParseDeclaration(PRInt32* aErrorCode, nsICSSDeclaration* a
|
|||
}
|
||||
|
||||
// Flags for ParseVariant method
|
||||
#define VARIANT_KEYWORD 0x01
|
||||
#define VARIANT_LENGTH 0x02
|
||||
#define VARIANT_PERCENT 0x04
|
||||
#define VARIANT_COLOR 0x08
|
||||
#define VARIANT_URL 0x10
|
||||
#define VARIANT_NUMBER 0x20
|
||||
#define VARIANT_INTEGER 0x40
|
||||
#define VARIANT_KEYWORD 0x0001
|
||||
#define VARIANT_LENGTH 0x0002
|
||||
#define VARIANT_PERCENT 0x0004
|
||||
#define VARIANT_COLOR 0x0008
|
||||
#define VARIANT_URL 0x0010
|
||||
#define VARIANT_NUMBER 0x0020
|
||||
#define VARIANT_INTEGER 0x0040
|
||||
#define VARIANT_AUTO 0x0100
|
||||
#define VARIANT_INHERIT 0x0200
|
||||
#define VARIANT_NONE 0x0400
|
||||
#define VARIANT_NORMAL 0x0800
|
||||
|
||||
// Common combinations of variants
|
||||
#define VARIANT_KL (VARIANT_KEYWORD | VARIANT_LENGTH)
|
||||
#define VARIANT_KLP (VARIANT_KEYWORD | VARIANT_LENGTH | VARIANT_PERCENT)
|
||||
#define VARIANT_KLPN (VARIANT_KLP | VARIANT_NUMBER)
|
||||
#define VARIANT_KP (VARIANT_KEYWORD | VARIANT_PERCENT)
|
||||
#define VARIANT_KI (VARIANT_KEYWORD | VARIANT_INTEGER)
|
||||
#define VARIANT_AHLP (VARIANT_AUTO | VARIANT_INHERIT | VARIANT_LP)
|
||||
#define VARIANT_AHI (VARIANT_AUTO | VARIANT_INHERIT | VARIANT_INTEGER)
|
||||
#define VARIANT_AHK (VARIANT_AUTO | VARIANT_INHERIT | VARIANT_KEYWORD)
|
||||
#define VARIANT_HLP (VARIANT_INHERIT | VARIANT_LP)
|
||||
#define VARIANT_HL (VARIANT_INHERIT | VARIANT_LENGTH)
|
||||
#define VARIANT_AL (VARIANT_AUTO | VARIANT_LENGTH)
|
||||
#define VARIANT_LP (VARIANT_LENGTH | VARIANT_PERCENT)
|
||||
#define VARIANT_CK (VARIANT_COLOR | VARIANT_KEYWORD)
|
||||
#define VARIANT_C VARIANT_COLOR
|
||||
|
@ -1008,11 +1017,6 @@ static PRInt32 kBackgroundColorKTable[] = {
|
|||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kBackgroundImageKTable[] = {
|
||||
KEYWORD_NONE, NS_STYLE_BG_IMAGE_NONE,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kBackgroundRepeatKTable[] = {
|
||||
KEYWORD_NO_REPEAT, NS_STYLE_BG_REPEAT_OFF,
|
||||
KEYWORD_REPEAT, NS_STYLE_BG_REPEAT_XY,
|
||||
|
@ -1049,13 +1053,7 @@ static PRInt32 kClearKTable[] = {
|
|||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kClipKTable[] = {
|
||||
KEYWORD_AUTO, NS_STYLE_CLIP_AUTO,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kCursorKTable[] = {
|
||||
KEYWORD_INHERIT, NS_STYLE_CURSOR_INHERIT,
|
||||
KEYWORD_IBEAM, NS_STYLE_CURSOR_IBEAM,
|
||||
KEYWORD_ARROW, NS_STYLE_CURSOR_DEFAULT,
|
||||
KEYWORD_HAND, NS_STYLE_CURSOR_HAND,
|
||||
|
@ -1110,16 +1108,6 @@ static PRInt32 kFontVariantKTable[] = {
|
|||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kLeftKTable[] = {
|
||||
KEYWORD_AUTO, NS_STYLE_POSITION_VALUE_AUTO,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kHeightKTable[] = {
|
||||
KEYWORD_AUTO, NS_STYLE_POSITION_VALUE_AUTO,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kLineHeightKTable[] = {
|
||||
KEYWORD_NORMAL, NS_STYLE_LINE_HEIGHT_NORMAL,
|
||||
-1
|
||||
|
@ -1154,11 +1142,6 @@ static PRInt32 kMarginSizeKTable[] = {
|
|||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kSpacingKTable[] = {
|
||||
KEYWORD_NORMAL, NS_STYLE_SPACING_NORMAL,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kOverflowKTable[] = {
|
||||
KEYWORD_VISIBLE, NS_STYLE_OVERFLOW_VISIBLE,
|
||||
KEYWORD_HIDDEN, NS_STYLE_OVERFLOW_HIDDEN,
|
||||
|
@ -1190,11 +1173,6 @@ static PRInt32 kTextTransformKTable[] = {
|
|||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kTopKTable[] = {
|
||||
KEYWORD_AUTO, NS_STYLE_POSITION_VALUE_AUTO,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kVerticalAlignKTable[] = {
|
||||
KEYWORD_BASELINE, NS_STYLE_VERTICAL_ALIGN_BASELINE,
|
||||
KEYWORD_SUB, NS_STYLE_VERTICAL_ALIGN_SUB,
|
||||
|
@ -1221,16 +1199,6 @@ static PRInt32 kWhitespaceKTable[] = {
|
|||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kWidthKTable[] = {
|
||||
KEYWORD_AUTO, NS_STYLE_POSITION_VALUE_AUTO,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kZIndexKTable[] = {
|
||||
KEYWORD_AUTO, NS_STYLE_POSITION_VALUE_AUTO,
|
||||
-1
|
||||
};
|
||||
|
||||
static const char* kBorderTopNames[] = {
|
||||
"border-top-width",
|
||||
"border-top-style",
|
||||
|
@ -1331,16 +1299,42 @@ PRBool CSSParserImpl::ParseVariant(PRInt32* aErrorCode,
|
|||
if (!GetToken(aErrorCode, PR_TRUE)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (((aVariants & VARIANT_KEYWORD) != 0) &&
|
||||
if (((aVariants & (VARIANT_AHK | VARIANT_NORMAL | VARIANT_NONE)) != 0) &&
|
||||
(eCSSToken_Ident == tk->mType)) {
|
||||
char cbuf[50];
|
||||
tk->mIdent.ToCString(cbuf, sizeof(cbuf));
|
||||
PRInt32 sid = nsCSSKeywords::LookupName(cbuf);
|
||||
if (sid >= 0) {
|
||||
PRInt32 ix = SearchKeywordTable(sid, aTable);
|
||||
if (ix >= 0) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(aTable[ix+1], eCSSUnit_Enumerated));
|
||||
return PR_TRUE;
|
||||
if (sid >= 0) { // known keyword
|
||||
if ((aVariants & VARIANT_AUTO) != 0) {
|
||||
if (sid == KEYWORD_AUTO) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(eCSSUnit_Auto));
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
if ((aVariants & VARIANT_INHERIT) != 0) {
|
||||
if (sid == KEYWORD_INHERIT) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(eCSSUnit_Inherit));
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
if ((aVariants & VARIANT_NONE) != 0) {
|
||||
if (sid == KEYWORD_NONE) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(eCSSUnit_None));
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
if ((aVariants & VARIANT_NORMAL) != 0) {
|
||||
if (sid == KEYWORD_NORMAL) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(eCSSUnit_Normal));
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
if ((aVariants & VARIANT_KEYWORD) != 0) {
|
||||
PRInt32 ix = SearchKeywordTable(sid, aTable);
|
||||
if (ix >= 0) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(aTable[ix+1], eCSSUnit_Enumerated));
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1359,7 +1353,7 @@ PRBool CSSParserImpl::ParseVariant(PRInt32* aErrorCode,
|
|||
}
|
||||
if (((aVariants & VARIANT_INTEGER) != 0) &&
|
||||
(eCSSToken_Number == tk->mType) && tk->mIntegerValid) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(tk->mInteger, eCSSUnit_Absolute));
|
||||
aDeclaration->AddValue(aName, nsCSSValue(tk->mInteger, eCSSUnit_Integer));
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (((aVariants & VARIANT_URL) != 0) &&
|
||||
|
@ -1493,8 +1487,8 @@ PRBool CSSParserImpl::ParseProperty(PRInt32* aErrorCode,
|
|||
case PROP_BACKGROUND_FILTER:
|
||||
return ParseBackgroundFilter(aErrorCode, aDeclaration, aName);
|
||||
case PROP_BACKGROUND_IMAGE:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_UK,
|
||||
kBackgroundImageKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_URL | VARIANT_NONE,
|
||||
nsnull);
|
||||
case PROP_BACKGROUND_POSITION:
|
||||
return ParseBackgroundPosition(aErrorCode, aDeclaration, aName);
|
||||
case PROP_BACKGROUND_REPEAT:
|
||||
|
@ -1538,7 +1532,7 @@ PRBool CSSParserImpl::ParseProperty(PRInt32* aErrorCode,
|
|||
case PROP_COLOR:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_COLOR, nsnull);
|
||||
case PROP_CURSOR:
|
||||
return ParseEnum(aErrorCode, aDeclaration, aName, kCursorKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_AHK, kCursorKTable);
|
||||
case PROP_DIRECTION:
|
||||
return ParseEnum(aErrorCode, aDeclaration, aName, kDirectionKTable);
|
||||
case PROP_DISPLAY:
|
||||
|
@ -1561,9 +1555,9 @@ PRBool CSSParserImpl::ParseProperty(PRInt32* aErrorCode,
|
|||
case PROP_FONT_WEIGHT:
|
||||
return ParseFontWeight(aErrorCode, aDeclaration, aName);
|
||||
case PROP_HEIGHT:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KLP, kHeightKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_AHLP, nsnull);
|
||||
case PROP_LEFT:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KLP, kLeftKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_AHLP, nsnull);
|
||||
case PROP_LINE_HEIGHT:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KLPN,
|
||||
kLineHeightKTable);
|
||||
|
@ -1604,7 +1598,7 @@ PRBool CSSParserImpl::ParseProperty(PRInt32* aErrorCode,
|
|||
case PROP_TEXT_TRANSFORM:
|
||||
return ParseEnum(aErrorCode, aDeclaration, aName, kTextTransformKTable);
|
||||
case PROP_TOP:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KLP, kTopKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_AHLP, nsnull);
|
||||
case PROP_VERTICAL_ALIGN:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KP,
|
||||
kVerticalAlignKTable);
|
||||
|
@ -1613,12 +1607,12 @@ PRBool CSSParserImpl::ParseProperty(PRInt32* aErrorCode,
|
|||
case PROP_WHITE_SPACE:
|
||||
return ParseEnum(aErrorCode, aDeclaration, aName, kWhitespaceKTable);
|
||||
case PROP_WIDTH:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KLP, kWidthKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_AHLP, nsnull);
|
||||
case PROP_LETTER_SPACING:
|
||||
case PROP_WORD_SPACING:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KL, kSpacingKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_HL | VARIANT_NORMAL, nsnull);
|
||||
case PROP_Z_INDEX:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KI, kZIndexKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_AHI, nsnull);
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -1910,8 +1904,7 @@ PRBool CSSParserImpl::ParseClip(PRInt32* aErrorCode, nsICSSDeclaration* aDeclara
|
|||
}
|
||||
if (ident->EqualsIgnoreCase("auto")) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
aDeclaration->AddValue(kClipNames[i],
|
||||
nsCSSValue(NS_STYLE_CLIP_AUTO, eCSSUnit_Enumerated));
|
||||
aDeclaration->AddValue(kClipNames[i], nsCSSValue(eCSSUnit_Auto));
|
||||
}
|
||||
return PR_TRUE;
|
||||
} else if (ident->EqualsIgnoreCase("rect")) {
|
||||
|
@ -1919,8 +1912,7 @@ PRBool CSSParserImpl::ParseClip(PRInt32* aErrorCode, nsICSSDeclaration* aDeclara
|
|||
return PR_FALSE;
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (!ParseVariant(aErrorCode, aDeclaration, kClipNames[i], VARIANT_KL,
|
||||
kClipKTable)) {
|
||||
if (!ParseVariant(aErrorCode, aDeclaration, kClipNames[i], VARIANT_AL, nsnull)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (3 != i) {
|
||||
|
@ -2078,7 +2070,7 @@ PRBool CSSParserImpl::ParseFontWeight(PRInt32* aErrorCode, nsICSSDeclaration* aD
|
|||
if (v < 100) v = 100;
|
||||
else if (v > 900) v = 900;
|
||||
v = v - (v % 100);
|
||||
aDeclaration->AddValue(aName, nsCSSValue(v, eCSSUnit_Absolute));
|
||||
aDeclaration->AddValue(aName, nsCSSValue(v, eCSSUnit_Integer));
|
||||
} else {
|
||||
UngetToken();
|
||||
return PR_FALSE;
|
||||
|
@ -2204,6 +2196,6 @@ PRBool CSSParserImpl::ParseTextDecoration(PRInt32* aErrorCode,
|
|||
if (0 == decoration) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
aDeclaration->AddValue(aName, nsCSSValue(decoration, eCSSUnit_Absolute));
|
||||
aDeclaration->AddValue(aName, nsCSSValue(decoration, eCSSUnit_Integer));
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
|
|
@ -163,6 +163,9 @@ public:
|
|||
|
||||
virtual nscoord CalcLength(const nsCSSValue& aValue, nsStyleFont* aFont,
|
||||
nsIPresContext* aPresContext);
|
||||
virtual void SetCoord(const nsCSSValue& aValue, nsStyleCoord& aCoord,
|
||||
PRInt32 aMask, nsStyleFont* aFont,
|
||||
nsIPresContext* aPresContext);
|
||||
virtual void MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext);
|
||||
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
@ -437,6 +440,56 @@ nscoord CSSStyleRuleImpl::CalcLength(const nsCSSValue& aValue,
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define SETCOORD_LENGTH 0x01
|
||||
#define SETCOORD_PERCENT 0x02
|
||||
#define SETCOORD_INTEGER 0x04
|
||||
#define SETCOORD_ENUMERATED 0x08
|
||||
#define SETCOORD_AUTO 0x10
|
||||
#define SETCOORD_INHERIT 0x20
|
||||
#define SETCOORD_NORMAL 0x80
|
||||
|
||||
#define SETCOORD_LP (SETCOORD_LENGTH | SETCOORD_PERCENT)
|
||||
#define SETCOORD_LH (SETCOORD_LENGTH | SETCOORD_INHERIT)
|
||||
#define SETCOORD_AH (SETCOORD_AUTO | SETCOORD_INHERIT)
|
||||
#define SETCOORD_LPH (SETCOORD_LP | SETCOORD_INHERIT)
|
||||
#define SETCOORD_LPAH (SETCOORD_LP | SETCOORD_AH)
|
||||
#define SETCOORD_LPEH (SETCOORD_LP | SETCOORD_ENUMERATED | SETCOORD_INHERIT)
|
||||
#define SETCOORD_IAH (SETCOORD_INTEGER | SETCOORD_AH)
|
||||
|
||||
void CSSStyleRuleImpl::SetCoord(const nsCSSValue& aValue, nsStyleCoord& aCoord,
|
||||
PRInt32 aMask, nsStyleFont* aFont,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
if (((aMask & SETCOORD_LENGTH) != 0) &&
|
||||
aValue.IsLengthUnit()) {
|
||||
aCoord.SetCoordValue(CalcLength(aValue, aFont, aPresContext));
|
||||
}
|
||||
else if (((aMask & SETCOORD_PERCENT) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Percent)) {
|
||||
aCoord.SetPercentValue(aValue.GetPercentValue());
|
||||
}
|
||||
else if (((aMask & SETCOORD_INTEGER) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Integer)) {
|
||||
aCoord.SetIntValue(aValue.GetIntValue(), eStyleUnit_Integer);
|
||||
}
|
||||
else if (((aMask & SETCOORD_ENUMERATED) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Enumerated)) {
|
||||
aCoord.SetIntValue(aValue.GetIntValue(), eStyleUnit_Enumerated);
|
||||
}
|
||||
else if (((aMask & SETCOORD_AUTO) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Auto)) {
|
||||
aCoord.SetAutoValue();
|
||||
}
|
||||
else if (((aMask & SETCOORD_INHERIT) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Inherit)) {
|
||||
aCoord.SetInheritValue();
|
||||
}
|
||||
else if (((aMask & SETCOORD_NORMAL) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Normal)) {
|
||||
aCoord.SetNormalValue();
|
||||
}
|
||||
}
|
||||
|
||||
void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext)
|
||||
{
|
||||
if (nsnull != mDeclaration) {
|
||||
|
@ -483,7 +536,7 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
}
|
||||
|
||||
// font-weight: abs, enum
|
||||
if (ourFont->mWeight.GetUnit() == eCSSUnit_Absolute) {
|
||||
if (ourFont->mWeight.GetUnit() == eCSSUnit_Integer) {
|
||||
font->mFont.style = ourFont->mWeight.GetIntValue();
|
||||
}
|
||||
else if (ourFont->mWeight.GetUnit() == eCSSUnit_Enumerated) {
|
||||
|
@ -539,7 +592,7 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
font->mFont.size = CalcLength(ourFont->mSize, parentFont, aPresContext);
|
||||
}
|
||||
else if (ourFont->mSize.GetUnit() == eCSSUnit_Percent) {
|
||||
font->mFont.size = (nscoord)((float)(parentFont->mFont.size) * ourFont->mSize.GetFloatValue());
|
||||
font->mFont.size = (nscoord)((float)(parentFont->mFont.size) * ourFont->mSize.GetPercentValue());
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(parentContext);
|
||||
|
@ -553,25 +606,11 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
nsStyleText* text = (nsStyleText*) aContext->GetData(kStyleTextSID);
|
||||
|
||||
// letter-spacing
|
||||
if (ourText->mLetterSpacing.IsLengthUnit()) {
|
||||
text->mLetterSpacing.Set(CalcLength(ourText->mLetterSpacing,
|
||||
font, aPresContext));
|
||||
}
|
||||
else if (ourText->mLetterSpacing.GetUnit() == eCSSUnit_Enumerated) {
|
||||
text->mLetterSpacing.SetAuto();
|
||||
}
|
||||
SetCoord(ourText->mLetterSpacing, text->mLetterSpacing, SETCOORD_LH | SETCOORD_NORMAL,
|
||||
font, aPresContext);
|
||||
|
||||
// line-height
|
||||
if (ourText->mLineHeight.IsLengthUnit()) {
|
||||
text->mLineHeight.Set(CalcLength(ourText->mLineHeight,
|
||||
font, aPresContext));
|
||||
}
|
||||
else if (ourText->mLineHeight.GetUnit() == eCSSUnit_Enumerated) {
|
||||
text->mLineHeight.SetAuto();
|
||||
}
|
||||
else if (ourText->mLineHeight.GetUnit() == eCSSUnit_Percent) {
|
||||
text->mLineHeight.Set(ourText->mLineHeight.GetFloatValue());
|
||||
}
|
||||
SetCoord(ourText->mLineHeight, text->mLineHeight, SETCOORD_LPAH, font, aPresContext);
|
||||
|
||||
// text-align
|
||||
if (ourText->mTextAlign.GetUnit() == eCSSUnit_Enumerated) {
|
||||
|
@ -579,17 +618,11 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
}
|
||||
|
||||
// text-indent
|
||||
if (ourText->mTextIndent.IsLengthUnit()) {
|
||||
text->mTextIndent.Set(CalcLength(ourText->mTextIndent,
|
||||
font, aPresContext));
|
||||
}
|
||||
else if (ourText->mTextIndent.GetUnit() == eCSSUnit_Percent) {
|
||||
text->mTextIndent.Set(ourText->mTextIndent.GetFloatValue());
|
||||
}
|
||||
SetCoord(ourText->mTextIndent, text->mTextIndent, SETCOORD_LPH, font, aPresContext);
|
||||
|
||||
// text-decoration: enum, absolute (bit field)
|
||||
// text-decoration: enum, int (bit field)
|
||||
if ((ourText->mDecoration.GetUnit() == eCSSUnit_Enumerated) ||
|
||||
(ourText->mDecoration.GetUnit() == eCSSUnit_Absolute)) {
|
||||
(ourText->mDecoration.GetUnit() == eCSSUnit_Integer)) {
|
||||
PRInt32 td = ourText->mDecoration.GetIntValue();
|
||||
font->mFont.decorations = td;
|
||||
text->mTextDecoration = td;
|
||||
|
@ -601,16 +634,8 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
}
|
||||
|
||||
// vertical-align
|
||||
if (ourText->mVerticalAlign.IsLengthUnit()) {
|
||||
text->mVerticalAlign.Set(CalcLength(ourText->mVerticalAlign,
|
||||
font, aPresContext));
|
||||
}
|
||||
else if (ourText->mVerticalAlign.GetUnit() == eCSSUnit_Enumerated) {
|
||||
text->mVerticalAlign.Set(ourText->mVerticalAlign.GetIntValue(), eStyleUnit_Enumerated);
|
||||
}
|
||||
else if (ourText->mVerticalAlign.GetUnit() == eCSSUnit_Percent) {
|
||||
text->mVerticalAlign.Set(ourText->mVerticalAlign.GetFloatValue());
|
||||
}
|
||||
SetCoord(ourText->mVerticalAlign, text->mVerticalAlign, SETCOORD_LPEH,
|
||||
font, aPresContext);
|
||||
|
||||
// white-space
|
||||
if (ourText->mWhiteSpace.GetUnit() == eCSSUnit_Enumerated) {
|
||||
|
@ -618,13 +643,8 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
}
|
||||
|
||||
// word-spacing
|
||||
if (ourText->mWordSpacing.IsLengthUnit()) {
|
||||
text->mWordSpacing.Set(CalcLength(ourText->mWordSpacing,
|
||||
font, aPresContext));
|
||||
}
|
||||
else if (ourText->mWordSpacing.GetUnit() == eCSSUnit_Enumerated) {
|
||||
text->mWordSpacing.SetAuto();
|
||||
}
|
||||
SetCoord(ourText->mWordSpacing, text->mWordSpacing, SETCOORD_LH | SETCOORD_NORMAL,
|
||||
font, aPresContext);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -636,13 +656,11 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
aContext->GetData(kStyleDisplaySID);
|
||||
|
||||
// display
|
||||
display->mDisplay = NS_STYLE_DISPLAY_INLINE;
|
||||
if (ourDisplay->mDisplay.GetUnit() == eCSSUnit_Enumerated) {
|
||||
display->mDisplay = ourDisplay->mDisplay.GetIntValue();
|
||||
}
|
||||
|
||||
// direction: enum
|
||||
display->mDirection = NS_STYLE_DIRECTION_LTR;
|
||||
if (ourDisplay->mDirection.GetUnit() == eCSSUnit_Enumerated) {
|
||||
display->mDirection = ourDisplay->mDirection.GetIntValue();
|
||||
}
|
||||
|
@ -670,10 +688,16 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
color->mColor = ourColor->mColor.GetColorValue();
|
||||
}
|
||||
|
||||
// cursor: enum
|
||||
// cursor: enum, auto, inherit
|
||||
if (ourColor->mCursor.GetUnit() == eCSSUnit_Enumerated) {
|
||||
color->mCursor = ourColor->mCursor.GetIntValue();
|
||||
}
|
||||
else if (ourColor->mCursor.GetUnit() == eCSSUnit_Auto) {
|
||||
color->mCursor = NS_STYLE_CURSOR_AUTO;
|
||||
}
|
||||
else if (ourColor->mCursor.GetUnit() == eCSSUnit_Inherit) {
|
||||
color->mCursor = NS_STYLE_CURSOR_INHERIT;
|
||||
}
|
||||
|
||||
// cursor-image: string
|
||||
if (ourColor->mCursorImage.GetUnit() == eCSSUnit_String) {
|
||||
|
@ -689,12 +713,13 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
color->mBackgroundFlags |= NS_STYLE_BG_COLOR_TRANSPARENT;
|
||||
}
|
||||
|
||||
// background-image: string, enum (flags)
|
||||
// background-image: string (url), none
|
||||
if (ourColor->mBackImage.GetUnit() == eCSSUnit_String) {
|
||||
ourColor->mBackImage.GetStringValue(color->mBackgroundImage);
|
||||
color->mBackgroundFlags &= ~NS_STYLE_BG_IMAGE_NONE;
|
||||
}
|
||||
else if (ourColor->mBackImage.GetUnit() == eCSSUnit_Enumerated) {
|
||||
else if (ourColor->mBackImage.GetUnit() == eCSSUnit_None) {
|
||||
color->mBackgroundImage.Truncate();
|
||||
color->mBackgroundFlags |= NS_STYLE_BG_IMAGE_NONE;
|
||||
}
|
||||
|
||||
|
@ -710,7 +735,7 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
|
||||
// background-position: length, percent (flags)
|
||||
if (ourColor->mBackPositionX.GetUnit() == eCSSUnit_Percent) {
|
||||
color->mBackgroundXPosition = (nscoord)(TWIPS_CONST_FLOAT * ourColor->mBackPositionX.GetFloatValue());
|
||||
color->mBackgroundXPosition = (nscoord)(100.0f * ourColor->mBackPositionX.GetPercentValue());
|
||||
color->mBackgroundFlags |= NS_STYLE_BG_X_POSITION_PERCENT;
|
||||
color->mBackgroundFlags &= ~NS_STYLE_BG_X_POSITION_LENGTH;
|
||||
}
|
||||
|
@ -721,7 +746,7 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
color->mBackgroundFlags &= ~NS_STYLE_BG_X_POSITION_PERCENT;
|
||||
}
|
||||
if (ourColor->mBackPositionY.GetUnit() == eCSSUnit_Percent) {
|
||||
color->mBackgroundYPosition = (nscoord)(TWIPS_CONST_FLOAT * ourColor->mBackPositionY.GetFloatValue());
|
||||
color->mBackgroundYPosition = (nscoord)(100.0f * ourColor->mBackPositionY.GetPercentValue());
|
||||
color->mBackgroundFlags |= NS_STYLE_BG_Y_POSITION_PERCENT;
|
||||
color->mBackgroundFlags &= ~NS_STYLE_BG_Y_POSITION_LENGTH;
|
||||
}
|
||||
|
@ -750,25 +775,25 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
spacing->mMargin.left = CalcLength(ourMargin->mMargin->mLeft, font, aPresContext);
|
||||
} else if (ourMargin->mMargin->mLeft.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mMargin.left = (nscoord)ourMargin->mMargin->mLeft.GetFloatValue();
|
||||
spacing->mMargin.left = (nscoord)ourMargin->mMargin->mLeft.GetPercentValue();
|
||||
}
|
||||
if (ourMargin->mMargin->mTop.IsLengthUnit()) {
|
||||
spacing->mMargin.top = CalcLength(ourMargin->mMargin->mTop, font, aPresContext);
|
||||
} else if (ourMargin->mMargin->mTop.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mMargin.top = (nscoord)ourMargin->mMargin->mTop.GetFloatValue();
|
||||
spacing->mMargin.top = (nscoord)ourMargin->mMargin->mTop.GetPercentValue();
|
||||
}
|
||||
if (ourMargin->mMargin->mRight.IsLengthUnit()) {
|
||||
spacing->mMargin.right = CalcLength(ourMargin->mMargin->mRight, font, aPresContext);
|
||||
} else if (ourMargin->mMargin->mRight.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mMargin.right = (nscoord)ourMargin->mMargin->mRight.GetFloatValue();
|
||||
spacing->mMargin.right = (nscoord)ourMargin->mMargin->mRight.GetPercentValue();
|
||||
}
|
||||
if (ourMargin->mMargin->mBottom.IsLengthUnit()) {
|
||||
spacing->mMargin.bottom = CalcLength(ourMargin->mMargin->mBottom, font, aPresContext);
|
||||
} else if (ourMargin->mMargin->mBottom.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mMargin.bottom = (nscoord)ourMargin->mMargin->mBottom.GetFloatValue();
|
||||
spacing->mMargin.bottom = (nscoord)ourMargin->mMargin->mBottom.GetPercentValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -778,25 +803,25 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
spacing->mPadding.left = CalcLength(ourMargin->mPadding->mLeft, font, aPresContext);
|
||||
} else if (ourMargin->mPadding->mLeft.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mPadding.left = (nscoord)ourMargin->mPadding->mLeft.GetFloatValue();
|
||||
spacing->mPadding.left = (nscoord)ourMargin->mPadding->mLeft.GetPercentValue();
|
||||
}
|
||||
if (ourMargin->mPadding->mTop.IsLengthUnit()) {
|
||||
spacing->mPadding.top = CalcLength(ourMargin->mPadding->mTop, font, aPresContext);
|
||||
} else if (ourMargin->mPadding->mTop.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mPadding.top = (nscoord)ourMargin->mPadding->mTop.GetFloatValue();
|
||||
spacing->mPadding.top = (nscoord)ourMargin->mPadding->mTop.GetPercentValue();
|
||||
}
|
||||
if (ourMargin->mPadding->mRight.IsLengthUnit()) {
|
||||
spacing->mPadding.right = CalcLength(ourMargin->mPadding->mRight, font, aPresContext);
|
||||
} else if (ourMargin->mPadding->mRight.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mPadding.right = (nscoord)ourMargin->mPadding->mRight.GetFloatValue();
|
||||
spacing->mPadding.right = (nscoord)ourMargin->mPadding->mRight.GetPercentValue();
|
||||
}
|
||||
if (ourMargin->mPadding->mBottom.IsLengthUnit()) {
|
||||
spacing->mPadding.bottom = CalcLength(ourMargin->mPadding->mBottom, font, aPresContext);
|
||||
} else if (ourMargin->mPadding->mBottom.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mPadding.bottom = (nscoord)ourMargin->mPadding->mBottom.GetFloatValue();
|
||||
spacing->mPadding.bottom = (nscoord)ourMargin->mPadding->mBottom.GetPercentValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -808,25 +833,25 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
border->mSize.left = CalcLength(ourBorder->mLeft, font, aPresContext);
|
||||
} else if (ourBorder->mLeft.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
border->mSize.left = (nscoord)ourBorder->mLeft.GetFloatValue();
|
||||
border->mSize.left = (nscoord)ourBorder->mLeft.GetPercentValue();
|
||||
}
|
||||
if (ourBorder->mTop.IsLengthUnit()) {
|
||||
border->mSize.top = CalcLength(ourBorder->mTop, font, aPresContext);
|
||||
} else if (ourBorder->mTop.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
border->mSize.top = (nscoord)ourBorder->mTop.GetFloatValue();
|
||||
border->mSize.top = (nscoord)ourBorder->mTop.GetPercentValue();
|
||||
}
|
||||
if (ourBorder->mRight.IsLengthUnit()) {
|
||||
border->mSize.right = CalcLength(ourBorder->mRight, font, aPresContext);
|
||||
} else if (ourBorder->mRight.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
border->mSize.right = (nscoord)ourBorder->mRight.GetFloatValue();
|
||||
border->mSize.right = (nscoord)ourBorder->mRight.GetPercentValue();
|
||||
}
|
||||
if (ourBorder->mBottom.IsLengthUnit()) {
|
||||
border->mSize.bottom = CalcLength(ourBorder->mBottom, font, aPresContext);
|
||||
} else if (ourBorder->mBottom.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
border->mSize.bottom = (nscoord)ourBorder->mBottom.GetFloatValue();
|
||||
border->mSize.bottom = (nscoord)ourBorder->mBottom.GetPercentValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -882,64 +907,36 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
position->mOverflow = ourPosition->mOverflow.GetIntValue();
|
||||
}
|
||||
|
||||
// box offsets. note: default value is auto so we don't check for it here
|
||||
if (ourPosition->mLeft.IsLengthUnit()) {
|
||||
position->mLeftOffset = CalcLength(ourPosition->mLeft, font, aPresContext);
|
||||
position->mLeftOffsetFlags = NS_STYLE_POSITION_VALUE_LENGTH;
|
||||
} else if (ourPosition->mHeight.GetUnit() == eCSSUnit_Percent) {
|
||||
position->mLeftOffset = (nscoord)(100 * ourPosition->mLeft.GetFloatValue());
|
||||
position->mLeftOffsetFlags = NS_STYLE_POSITION_VALUE_PERCENT;
|
||||
}
|
||||
if (ourPosition->mTop.IsLengthUnit()) {
|
||||
position->mTopOffset = CalcLength(ourPosition->mTop, font, aPresContext);
|
||||
position->mTopOffsetFlags = NS_STYLE_POSITION_VALUE_LENGTH;
|
||||
} else if (ourPosition->mHeight.GetUnit() == eCSSUnit_Percent) {
|
||||
position->mTopOffset = (nscoord)(100 * ourPosition->mTop.GetFloatValue());
|
||||
position->mTopOffsetFlags = NS_STYLE_POSITION_VALUE_PERCENT;
|
||||
}
|
||||
if (ourPosition->mWidth.IsLengthUnit()) {
|
||||
position->mWidth = CalcLength(ourPosition->mWidth, font, aPresContext);
|
||||
position->mWidthFlags = NS_STYLE_POSITION_VALUE_LENGTH;
|
||||
} else if (ourPosition->mWidth.GetUnit() == eCSSUnit_Percent) {
|
||||
position->mWidth = (nscoord)(100 * ourPosition->mWidth.GetFloatValue());
|
||||
position->mWidthFlags = NS_STYLE_POSITION_VALUE_PERCENT;
|
||||
}
|
||||
if (ourPosition->mHeight.IsLengthUnit()) {
|
||||
position->mHeight = CalcLength(ourPosition->mHeight, font, aPresContext);
|
||||
position->mHeightFlags = NS_STYLE_POSITION_VALUE_LENGTH;
|
||||
} else if (ourPosition->mHeight.GetUnit() == eCSSUnit_Percent) {
|
||||
position->mHeight = (nscoord)(100 * ourPosition->mHeight.GetFloatValue());
|
||||
position->mHeightFlags = NS_STYLE_POSITION_VALUE_PERCENT;
|
||||
}
|
||||
// box offsets: length, percent, auto, inherit
|
||||
SetCoord(ourPosition->mLeft, position->mLeftOffset, SETCOORD_LPAH, font, aPresContext);
|
||||
SetCoord(ourPosition->mTop, position->mTopOffset, SETCOORD_LPAH, font, aPresContext);
|
||||
SetCoord(ourPosition->mWidth, position->mWidth, SETCOORD_LPAH, font, aPresContext);
|
||||
SetCoord(ourPosition->mHeight, position->mHeight, SETCOORD_LPAH, font, aPresContext);
|
||||
|
||||
// z-index
|
||||
if (ourPosition->mZIndex.GetUnit() == eCSSUnit_Enumerated) {
|
||||
position->mPosition = ourPosition->mPosition.GetIntValue();
|
||||
} else if (ourPosition->mZIndex.GetUnit() == eCSSUnit_Absolute) {
|
||||
position->mZIndex = ourPosition->mZIndex.GetIntValue();
|
||||
}
|
||||
SetCoord(ourPosition->mZIndex, position->mZIndex, SETCOORD_IAH, nsnull, nsnull);
|
||||
|
||||
// clip property
|
||||
// clip property: length, auto
|
||||
if (nsnull != ourPosition->mClip) {
|
||||
position->mClipFlags = NS_STYLE_CLIP_RECT;
|
||||
|
||||
if (ourPosition->mClip->mTop.GetUnit() == eCSSUnit_Enumerated) {
|
||||
position->mClip.top = ourPosition->mClip->mTop.GetIntValue();
|
||||
if (ourPosition->mClip->mTop.GetUnit() == eCSSUnit_Auto) {
|
||||
// XXX position->mClip.top = ourPosition->mClip->mTop.GetIntValue();
|
||||
} else if (ourPosition->mClip->mTop.IsLengthUnit()) {
|
||||
position->mClip.top = CalcLength(ourPosition->mClip->mTop, font, aPresContext);
|
||||
}
|
||||
if (ourPosition->mClip->mRight.GetUnit() == eCSSUnit_Enumerated) {
|
||||
position->mClip.right = ourPosition->mClip->mRight.GetIntValue();
|
||||
if (ourPosition->mClip->mRight.GetUnit() == eCSSUnit_Auto) {
|
||||
// XXX position->mClip.right = ourPosition->mClip->mRight.GetIntValue();
|
||||
} else if (ourPosition->mClip->mRight.IsLengthUnit()) {
|
||||
position->mClip.right = CalcLength(ourPosition->mClip->mRight, font, aPresContext);
|
||||
}
|
||||
if (ourPosition->mClip->mBottom.GetUnit() == eCSSUnit_Enumerated) {
|
||||
position->mClip.bottom = ourPosition->mClip->mBottom.GetIntValue();
|
||||
if (ourPosition->mClip->mBottom.GetUnit() == eCSSUnit_Auto) {
|
||||
// XXX position->mClip.bottom = ourPosition->mClip->mBottom.GetIntValue();
|
||||
} else if (ourPosition->mClip->mBottom.IsLengthUnit()) {
|
||||
position->mClip.bottom = CalcLength(ourPosition->mClip->mBottom, font, aPresContext);
|
||||
}
|
||||
if (ourPosition->mClip->mLeft.GetUnit() == eCSSUnit_Enumerated) {
|
||||
position->mClip.left = ourPosition->mClip->mLeft.GetIntValue();
|
||||
if (ourPosition->mClip->mLeft.GetUnit() == eCSSUnit_Auto) {
|
||||
// XXX position->mClip.left = ourPosition->mClip->mLeft.GetIntValue();
|
||||
} else if (ourPosition->mClip->mLeft.IsLengthUnit()) {
|
||||
position->mClip.left = CalcLength(ourPosition->mClip->mLeft, font, aPresContext);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ struct HTMLAttribute {
|
|||
}
|
||||
}
|
||||
else {
|
||||
aBuffer.SetLength(0);
|
||||
aBuffer.Truncate();
|
||||
aBuffer.Append("null");
|
||||
}
|
||||
}
|
||||
|
@ -303,13 +303,13 @@ PRInt32 HTMLAttributesImpl::SetAttribute(nsIAtom* aAttribute, const nsString& aV
|
|||
{
|
||||
if (nsHTMLAtoms::id == aAttribute) {
|
||||
nsIAtom* id = NS_NewAtom(aValue);
|
||||
PRInt32 result = SetID (id);
|
||||
PRInt32 result = SetID(id);
|
||||
NS_RELEASE(id);
|
||||
return result;
|
||||
}
|
||||
if (nsHTMLAtoms::kClass == aAttribute) {
|
||||
nsIAtom* classA = NS_NewAtom(aValue);
|
||||
PRInt32 result = SetClass (classA);
|
||||
PRInt32 result = SetClass(classA);
|
||||
NS_RELEASE(classA);
|
||||
return result;
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ PRInt32 HTMLAttributesImpl::SetAttribute(nsIAtom* aAttribute, const nsString& aV
|
|||
|
||||
while (nsnull != attr) {
|
||||
if (attr->mAttribute == aAttribute) {
|
||||
attr->mValue.Set (aValue);
|
||||
attr->mValue.SetStringValue(aValue);
|
||||
return mCount;
|
||||
}
|
||||
last = attr;
|
||||
|
@ -341,14 +341,14 @@ PRInt32 HTMLAttributesImpl::SetAttribute(nsIAtom* aAttribute, const nsHTMLValue&
|
|||
if (nsHTMLAtoms::id == aAttribute) {
|
||||
nsAutoString buffer;
|
||||
nsIAtom* id = NS_NewAtom(aValue.GetStringValue(buffer));
|
||||
PRInt32 result = SetID (id);
|
||||
PRInt32 result = SetID(id);
|
||||
NS_RELEASE(id);
|
||||
return result;
|
||||
}
|
||||
if (nsHTMLAtoms::kClass == aAttribute) {
|
||||
nsAutoString buffer;
|
||||
nsIAtom* classA = NS_NewAtom(aValue.GetStringValue(buffer));
|
||||
PRInt32 result = SetClass (classA);
|
||||
PRInt32 result = SetClass(classA);
|
||||
NS_RELEASE(classA);
|
||||
return result;
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ nsContentAttr HTMLAttributesImpl::GetAttribute(nsIAtom* aAttribute,
|
|||
if (nsnull != id) {
|
||||
nsAutoString buffer;
|
||||
id->ToString(buffer);
|
||||
aValue.Set(buffer);
|
||||
aValue.SetStringValue(buffer);
|
||||
NS_RELEASE(id);
|
||||
return eContentAttr_HasValue;
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ nsContentAttr HTMLAttributesImpl::GetAttribute(nsIAtom* aAttribute,
|
|||
if (nsnull != classA) {
|
||||
nsAutoString buffer;
|
||||
classA->ToString(buffer);
|
||||
aValue.Set(buffer);
|
||||
aValue.SetStringValue(buffer);
|
||||
NS_RELEASE(classA);
|
||||
return eContentAttr_HasValue;
|
||||
}
|
||||
|
|
|
@ -977,20 +977,29 @@ PRBool CSSParserImpl::ParseDeclaration(PRInt32* aErrorCode, nsICSSDeclaration* a
|
|||
}
|
||||
|
||||
// Flags for ParseVariant method
|
||||
#define VARIANT_KEYWORD 0x01
|
||||
#define VARIANT_LENGTH 0x02
|
||||
#define VARIANT_PERCENT 0x04
|
||||
#define VARIANT_COLOR 0x08
|
||||
#define VARIANT_URL 0x10
|
||||
#define VARIANT_NUMBER 0x20
|
||||
#define VARIANT_INTEGER 0x40
|
||||
#define VARIANT_KEYWORD 0x0001
|
||||
#define VARIANT_LENGTH 0x0002
|
||||
#define VARIANT_PERCENT 0x0004
|
||||
#define VARIANT_COLOR 0x0008
|
||||
#define VARIANT_URL 0x0010
|
||||
#define VARIANT_NUMBER 0x0020
|
||||
#define VARIANT_INTEGER 0x0040
|
||||
#define VARIANT_AUTO 0x0100
|
||||
#define VARIANT_INHERIT 0x0200
|
||||
#define VARIANT_NONE 0x0400
|
||||
#define VARIANT_NORMAL 0x0800
|
||||
|
||||
// Common combinations of variants
|
||||
#define VARIANT_KL (VARIANT_KEYWORD | VARIANT_LENGTH)
|
||||
#define VARIANT_KLP (VARIANT_KEYWORD | VARIANT_LENGTH | VARIANT_PERCENT)
|
||||
#define VARIANT_KLPN (VARIANT_KLP | VARIANT_NUMBER)
|
||||
#define VARIANT_KP (VARIANT_KEYWORD | VARIANT_PERCENT)
|
||||
#define VARIANT_KI (VARIANT_KEYWORD | VARIANT_INTEGER)
|
||||
#define VARIANT_AHLP (VARIANT_AUTO | VARIANT_INHERIT | VARIANT_LP)
|
||||
#define VARIANT_AHI (VARIANT_AUTO | VARIANT_INHERIT | VARIANT_INTEGER)
|
||||
#define VARIANT_AHK (VARIANT_AUTO | VARIANT_INHERIT | VARIANT_KEYWORD)
|
||||
#define VARIANT_HLP (VARIANT_INHERIT | VARIANT_LP)
|
||||
#define VARIANT_HL (VARIANT_INHERIT | VARIANT_LENGTH)
|
||||
#define VARIANT_AL (VARIANT_AUTO | VARIANT_LENGTH)
|
||||
#define VARIANT_LP (VARIANT_LENGTH | VARIANT_PERCENT)
|
||||
#define VARIANT_CK (VARIANT_COLOR | VARIANT_KEYWORD)
|
||||
#define VARIANT_C VARIANT_COLOR
|
||||
|
@ -1008,11 +1017,6 @@ static PRInt32 kBackgroundColorKTable[] = {
|
|||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kBackgroundImageKTable[] = {
|
||||
KEYWORD_NONE, NS_STYLE_BG_IMAGE_NONE,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kBackgroundRepeatKTable[] = {
|
||||
KEYWORD_NO_REPEAT, NS_STYLE_BG_REPEAT_OFF,
|
||||
KEYWORD_REPEAT, NS_STYLE_BG_REPEAT_XY,
|
||||
|
@ -1049,13 +1053,7 @@ static PRInt32 kClearKTable[] = {
|
|||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kClipKTable[] = {
|
||||
KEYWORD_AUTO, NS_STYLE_CLIP_AUTO,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kCursorKTable[] = {
|
||||
KEYWORD_INHERIT, NS_STYLE_CURSOR_INHERIT,
|
||||
KEYWORD_IBEAM, NS_STYLE_CURSOR_IBEAM,
|
||||
KEYWORD_ARROW, NS_STYLE_CURSOR_DEFAULT,
|
||||
KEYWORD_HAND, NS_STYLE_CURSOR_HAND,
|
||||
|
@ -1110,16 +1108,6 @@ static PRInt32 kFontVariantKTable[] = {
|
|||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kLeftKTable[] = {
|
||||
KEYWORD_AUTO, NS_STYLE_POSITION_VALUE_AUTO,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kHeightKTable[] = {
|
||||
KEYWORD_AUTO, NS_STYLE_POSITION_VALUE_AUTO,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kLineHeightKTable[] = {
|
||||
KEYWORD_NORMAL, NS_STYLE_LINE_HEIGHT_NORMAL,
|
||||
-1
|
||||
|
@ -1154,11 +1142,6 @@ static PRInt32 kMarginSizeKTable[] = {
|
|||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kSpacingKTable[] = {
|
||||
KEYWORD_NORMAL, NS_STYLE_SPACING_NORMAL,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kOverflowKTable[] = {
|
||||
KEYWORD_VISIBLE, NS_STYLE_OVERFLOW_VISIBLE,
|
||||
KEYWORD_HIDDEN, NS_STYLE_OVERFLOW_HIDDEN,
|
||||
|
@ -1190,11 +1173,6 @@ static PRInt32 kTextTransformKTable[] = {
|
|||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kTopKTable[] = {
|
||||
KEYWORD_AUTO, NS_STYLE_POSITION_VALUE_AUTO,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kVerticalAlignKTable[] = {
|
||||
KEYWORD_BASELINE, NS_STYLE_VERTICAL_ALIGN_BASELINE,
|
||||
KEYWORD_SUB, NS_STYLE_VERTICAL_ALIGN_SUB,
|
||||
|
@ -1221,16 +1199,6 @@ static PRInt32 kWhitespaceKTable[] = {
|
|||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kWidthKTable[] = {
|
||||
KEYWORD_AUTO, NS_STYLE_POSITION_VALUE_AUTO,
|
||||
-1
|
||||
};
|
||||
|
||||
static PRInt32 kZIndexKTable[] = {
|
||||
KEYWORD_AUTO, NS_STYLE_POSITION_VALUE_AUTO,
|
||||
-1
|
||||
};
|
||||
|
||||
static const char* kBorderTopNames[] = {
|
||||
"border-top-width",
|
||||
"border-top-style",
|
||||
|
@ -1331,16 +1299,42 @@ PRBool CSSParserImpl::ParseVariant(PRInt32* aErrorCode,
|
|||
if (!GetToken(aErrorCode, PR_TRUE)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (((aVariants & VARIANT_KEYWORD) != 0) &&
|
||||
if (((aVariants & (VARIANT_AHK | VARIANT_NORMAL | VARIANT_NONE)) != 0) &&
|
||||
(eCSSToken_Ident == tk->mType)) {
|
||||
char cbuf[50];
|
||||
tk->mIdent.ToCString(cbuf, sizeof(cbuf));
|
||||
PRInt32 sid = nsCSSKeywords::LookupName(cbuf);
|
||||
if (sid >= 0) {
|
||||
PRInt32 ix = SearchKeywordTable(sid, aTable);
|
||||
if (ix >= 0) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(aTable[ix+1], eCSSUnit_Enumerated));
|
||||
return PR_TRUE;
|
||||
if (sid >= 0) { // known keyword
|
||||
if ((aVariants & VARIANT_AUTO) != 0) {
|
||||
if (sid == KEYWORD_AUTO) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(eCSSUnit_Auto));
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
if ((aVariants & VARIANT_INHERIT) != 0) {
|
||||
if (sid == KEYWORD_INHERIT) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(eCSSUnit_Inherit));
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
if ((aVariants & VARIANT_NONE) != 0) {
|
||||
if (sid == KEYWORD_NONE) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(eCSSUnit_None));
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
if ((aVariants & VARIANT_NORMAL) != 0) {
|
||||
if (sid == KEYWORD_NORMAL) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(eCSSUnit_Normal));
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
if ((aVariants & VARIANT_KEYWORD) != 0) {
|
||||
PRInt32 ix = SearchKeywordTable(sid, aTable);
|
||||
if (ix >= 0) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(aTable[ix+1], eCSSUnit_Enumerated));
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1359,7 +1353,7 @@ PRBool CSSParserImpl::ParseVariant(PRInt32* aErrorCode,
|
|||
}
|
||||
if (((aVariants & VARIANT_INTEGER) != 0) &&
|
||||
(eCSSToken_Number == tk->mType) && tk->mIntegerValid) {
|
||||
aDeclaration->AddValue(aName, nsCSSValue(tk->mInteger, eCSSUnit_Absolute));
|
||||
aDeclaration->AddValue(aName, nsCSSValue(tk->mInteger, eCSSUnit_Integer));
|
||||
return PR_TRUE;
|
||||
}
|
||||
if (((aVariants & VARIANT_URL) != 0) &&
|
||||
|
@ -1493,8 +1487,8 @@ PRBool CSSParserImpl::ParseProperty(PRInt32* aErrorCode,
|
|||
case PROP_BACKGROUND_FILTER:
|
||||
return ParseBackgroundFilter(aErrorCode, aDeclaration, aName);
|
||||
case PROP_BACKGROUND_IMAGE:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_UK,
|
||||
kBackgroundImageKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_URL | VARIANT_NONE,
|
||||
nsnull);
|
||||
case PROP_BACKGROUND_POSITION:
|
||||
return ParseBackgroundPosition(aErrorCode, aDeclaration, aName);
|
||||
case PROP_BACKGROUND_REPEAT:
|
||||
|
@ -1538,7 +1532,7 @@ PRBool CSSParserImpl::ParseProperty(PRInt32* aErrorCode,
|
|||
case PROP_COLOR:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_COLOR, nsnull);
|
||||
case PROP_CURSOR:
|
||||
return ParseEnum(aErrorCode, aDeclaration, aName, kCursorKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_AHK, kCursorKTable);
|
||||
case PROP_DIRECTION:
|
||||
return ParseEnum(aErrorCode, aDeclaration, aName, kDirectionKTable);
|
||||
case PROP_DISPLAY:
|
||||
|
@ -1561,9 +1555,9 @@ PRBool CSSParserImpl::ParseProperty(PRInt32* aErrorCode,
|
|||
case PROP_FONT_WEIGHT:
|
||||
return ParseFontWeight(aErrorCode, aDeclaration, aName);
|
||||
case PROP_HEIGHT:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KLP, kHeightKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_AHLP, nsnull);
|
||||
case PROP_LEFT:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KLP, kLeftKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_AHLP, nsnull);
|
||||
case PROP_LINE_HEIGHT:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KLPN,
|
||||
kLineHeightKTable);
|
||||
|
@ -1604,7 +1598,7 @@ PRBool CSSParserImpl::ParseProperty(PRInt32* aErrorCode,
|
|||
case PROP_TEXT_TRANSFORM:
|
||||
return ParseEnum(aErrorCode, aDeclaration, aName, kTextTransformKTable);
|
||||
case PROP_TOP:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KLP, kTopKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_AHLP, nsnull);
|
||||
case PROP_VERTICAL_ALIGN:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KP,
|
||||
kVerticalAlignKTable);
|
||||
|
@ -1613,12 +1607,12 @@ PRBool CSSParserImpl::ParseProperty(PRInt32* aErrorCode,
|
|||
case PROP_WHITE_SPACE:
|
||||
return ParseEnum(aErrorCode, aDeclaration, aName, kWhitespaceKTable);
|
||||
case PROP_WIDTH:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KLP, kWidthKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_AHLP, nsnull);
|
||||
case PROP_LETTER_SPACING:
|
||||
case PROP_WORD_SPACING:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KL, kSpacingKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_HL | VARIANT_NORMAL, nsnull);
|
||||
case PROP_Z_INDEX:
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_KI, kZIndexKTable);
|
||||
return ParseVariant(aErrorCode, aDeclaration, aName, VARIANT_AHI, nsnull);
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -1910,8 +1904,7 @@ PRBool CSSParserImpl::ParseClip(PRInt32* aErrorCode, nsICSSDeclaration* aDeclara
|
|||
}
|
||||
if (ident->EqualsIgnoreCase("auto")) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
aDeclaration->AddValue(kClipNames[i],
|
||||
nsCSSValue(NS_STYLE_CLIP_AUTO, eCSSUnit_Enumerated));
|
||||
aDeclaration->AddValue(kClipNames[i], nsCSSValue(eCSSUnit_Auto));
|
||||
}
|
||||
return PR_TRUE;
|
||||
} else if (ident->EqualsIgnoreCase("rect")) {
|
||||
|
@ -1919,8 +1912,7 @@ PRBool CSSParserImpl::ParseClip(PRInt32* aErrorCode, nsICSSDeclaration* aDeclara
|
|||
return PR_FALSE;
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (!ParseVariant(aErrorCode, aDeclaration, kClipNames[i], VARIANT_KL,
|
||||
kClipKTable)) {
|
||||
if (!ParseVariant(aErrorCode, aDeclaration, kClipNames[i], VARIANT_AL, nsnull)) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
if (3 != i) {
|
||||
|
@ -2078,7 +2070,7 @@ PRBool CSSParserImpl::ParseFontWeight(PRInt32* aErrorCode, nsICSSDeclaration* aD
|
|||
if (v < 100) v = 100;
|
||||
else if (v > 900) v = 900;
|
||||
v = v - (v % 100);
|
||||
aDeclaration->AddValue(aName, nsCSSValue(v, eCSSUnit_Absolute));
|
||||
aDeclaration->AddValue(aName, nsCSSValue(v, eCSSUnit_Integer));
|
||||
} else {
|
||||
UngetToken();
|
||||
return PR_FALSE;
|
||||
|
@ -2204,6 +2196,6 @@ PRBool CSSParserImpl::ParseTextDecoration(PRInt32* aErrorCode,
|
|||
if (0 == decoration) {
|
||||
return PR_FALSE;
|
||||
}
|
||||
aDeclaration->AddValue(aName, nsCSSValue(decoration, eCSSUnit_Absolute));
|
||||
aDeclaration->AddValue(aName, nsCSSValue(decoration, eCSSUnit_Integer));
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
|
|
@ -163,6 +163,9 @@ public:
|
|||
|
||||
virtual nscoord CalcLength(const nsCSSValue& aValue, nsStyleFont* aFont,
|
||||
nsIPresContext* aPresContext);
|
||||
virtual void SetCoord(const nsCSSValue& aValue, nsStyleCoord& aCoord,
|
||||
PRInt32 aMask, nsStyleFont* aFont,
|
||||
nsIPresContext* aPresContext);
|
||||
virtual void MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext);
|
||||
|
||||
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
||||
|
@ -437,6 +440,56 @@ nscoord CSSStyleRuleImpl::CalcLength(const nsCSSValue& aValue,
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define SETCOORD_LENGTH 0x01
|
||||
#define SETCOORD_PERCENT 0x02
|
||||
#define SETCOORD_INTEGER 0x04
|
||||
#define SETCOORD_ENUMERATED 0x08
|
||||
#define SETCOORD_AUTO 0x10
|
||||
#define SETCOORD_INHERIT 0x20
|
||||
#define SETCOORD_NORMAL 0x80
|
||||
|
||||
#define SETCOORD_LP (SETCOORD_LENGTH | SETCOORD_PERCENT)
|
||||
#define SETCOORD_LH (SETCOORD_LENGTH | SETCOORD_INHERIT)
|
||||
#define SETCOORD_AH (SETCOORD_AUTO | SETCOORD_INHERIT)
|
||||
#define SETCOORD_LPH (SETCOORD_LP | SETCOORD_INHERIT)
|
||||
#define SETCOORD_LPAH (SETCOORD_LP | SETCOORD_AH)
|
||||
#define SETCOORD_LPEH (SETCOORD_LP | SETCOORD_ENUMERATED | SETCOORD_INHERIT)
|
||||
#define SETCOORD_IAH (SETCOORD_INTEGER | SETCOORD_AH)
|
||||
|
||||
void CSSStyleRuleImpl::SetCoord(const nsCSSValue& aValue, nsStyleCoord& aCoord,
|
||||
PRInt32 aMask, nsStyleFont* aFont,
|
||||
nsIPresContext* aPresContext)
|
||||
{
|
||||
if (((aMask & SETCOORD_LENGTH) != 0) &&
|
||||
aValue.IsLengthUnit()) {
|
||||
aCoord.SetCoordValue(CalcLength(aValue, aFont, aPresContext));
|
||||
}
|
||||
else if (((aMask & SETCOORD_PERCENT) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Percent)) {
|
||||
aCoord.SetPercentValue(aValue.GetPercentValue());
|
||||
}
|
||||
else if (((aMask & SETCOORD_INTEGER) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Integer)) {
|
||||
aCoord.SetIntValue(aValue.GetIntValue(), eStyleUnit_Integer);
|
||||
}
|
||||
else if (((aMask & SETCOORD_ENUMERATED) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Enumerated)) {
|
||||
aCoord.SetIntValue(aValue.GetIntValue(), eStyleUnit_Enumerated);
|
||||
}
|
||||
else if (((aMask & SETCOORD_AUTO) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Auto)) {
|
||||
aCoord.SetAutoValue();
|
||||
}
|
||||
else if (((aMask & SETCOORD_INHERIT) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Inherit)) {
|
||||
aCoord.SetInheritValue();
|
||||
}
|
||||
else if (((aMask & SETCOORD_NORMAL) != 0) &&
|
||||
(aValue.GetUnit() == eCSSUnit_Normal)) {
|
||||
aCoord.SetNormalValue();
|
||||
}
|
||||
}
|
||||
|
||||
void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* aPresContext)
|
||||
{
|
||||
if (nsnull != mDeclaration) {
|
||||
|
@ -483,7 +536,7 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
}
|
||||
|
||||
// font-weight: abs, enum
|
||||
if (ourFont->mWeight.GetUnit() == eCSSUnit_Absolute) {
|
||||
if (ourFont->mWeight.GetUnit() == eCSSUnit_Integer) {
|
||||
font->mFont.style = ourFont->mWeight.GetIntValue();
|
||||
}
|
||||
else if (ourFont->mWeight.GetUnit() == eCSSUnit_Enumerated) {
|
||||
|
@ -539,7 +592,7 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
font->mFont.size = CalcLength(ourFont->mSize, parentFont, aPresContext);
|
||||
}
|
||||
else if (ourFont->mSize.GetUnit() == eCSSUnit_Percent) {
|
||||
font->mFont.size = (nscoord)((float)(parentFont->mFont.size) * ourFont->mSize.GetFloatValue());
|
||||
font->mFont.size = (nscoord)((float)(parentFont->mFont.size) * ourFont->mSize.GetPercentValue());
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(parentContext);
|
||||
|
@ -553,25 +606,11 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
nsStyleText* text = (nsStyleText*) aContext->GetData(kStyleTextSID);
|
||||
|
||||
// letter-spacing
|
||||
if (ourText->mLetterSpacing.IsLengthUnit()) {
|
||||
text->mLetterSpacing.Set(CalcLength(ourText->mLetterSpacing,
|
||||
font, aPresContext));
|
||||
}
|
||||
else if (ourText->mLetterSpacing.GetUnit() == eCSSUnit_Enumerated) {
|
||||
text->mLetterSpacing.SetAuto();
|
||||
}
|
||||
SetCoord(ourText->mLetterSpacing, text->mLetterSpacing, SETCOORD_LH | SETCOORD_NORMAL,
|
||||
font, aPresContext);
|
||||
|
||||
// line-height
|
||||
if (ourText->mLineHeight.IsLengthUnit()) {
|
||||
text->mLineHeight.Set(CalcLength(ourText->mLineHeight,
|
||||
font, aPresContext));
|
||||
}
|
||||
else if (ourText->mLineHeight.GetUnit() == eCSSUnit_Enumerated) {
|
||||
text->mLineHeight.SetAuto();
|
||||
}
|
||||
else if (ourText->mLineHeight.GetUnit() == eCSSUnit_Percent) {
|
||||
text->mLineHeight.Set(ourText->mLineHeight.GetFloatValue());
|
||||
}
|
||||
SetCoord(ourText->mLineHeight, text->mLineHeight, SETCOORD_LPAH, font, aPresContext);
|
||||
|
||||
// text-align
|
||||
if (ourText->mTextAlign.GetUnit() == eCSSUnit_Enumerated) {
|
||||
|
@ -579,17 +618,11 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
}
|
||||
|
||||
// text-indent
|
||||
if (ourText->mTextIndent.IsLengthUnit()) {
|
||||
text->mTextIndent.Set(CalcLength(ourText->mTextIndent,
|
||||
font, aPresContext));
|
||||
}
|
||||
else if (ourText->mTextIndent.GetUnit() == eCSSUnit_Percent) {
|
||||
text->mTextIndent.Set(ourText->mTextIndent.GetFloatValue());
|
||||
}
|
||||
SetCoord(ourText->mTextIndent, text->mTextIndent, SETCOORD_LPH, font, aPresContext);
|
||||
|
||||
// text-decoration: enum, absolute (bit field)
|
||||
// text-decoration: enum, int (bit field)
|
||||
if ((ourText->mDecoration.GetUnit() == eCSSUnit_Enumerated) ||
|
||||
(ourText->mDecoration.GetUnit() == eCSSUnit_Absolute)) {
|
||||
(ourText->mDecoration.GetUnit() == eCSSUnit_Integer)) {
|
||||
PRInt32 td = ourText->mDecoration.GetIntValue();
|
||||
font->mFont.decorations = td;
|
||||
text->mTextDecoration = td;
|
||||
|
@ -601,16 +634,8 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
}
|
||||
|
||||
// vertical-align
|
||||
if (ourText->mVerticalAlign.IsLengthUnit()) {
|
||||
text->mVerticalAlign.Set(CalcLength(ourText->mVerticalAlign,
|
||||
font, aPresContext));
|
||||
}
|
||||
else if (ourText->mVerticalAlign.GetUnit() == eCSSUnit_Enumerated) {
|
||||
text->mVerticalAlign.Set(ourText->mVerticalAlign.GetIntValue(), eStyleUnit_Enumerated);
|
||||
}
|
||||
else if (ourText->mVerticalAlign.GetUnit() == eCSSUnit_Percent) {
|
||||
text->mVerticalAlign.Set(ourText->mVerticalAlign.GetFloatValue());
|
||||
}
|
||||
SetCoord(ourText->mVerticalAlign, text->mVerticalAlign, SETCOORD_LPEH,
|
||||
font, aPresContext);
|
||||
|
||||
// white-space
|
||||
if (ourText->mWhiteSpace.GetUnit() == eCSSUnit_Enumerated) {
|
||||
|
@ -618,13 +643,8 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
}
|
||||
|
||||
// word-spacing
|
||||
if (ourText->mWordSpacing.IsLengthUnit()) {
|
||||
text->mWordSpacing.Set(CalcLength(ourText->mWordSpacing,
|
||||
font, aPresContext));
|
||||
}
|
||||
else if (ourText->mWordSpacing.GetUnit() == eCSSUnit_Enumerated) {
|
||||
text->mWordSpacing.SetAuto();
|
||||
}
|
||||
SetCoord(ourText->mWordSpacing, text->mWordSpacing, SETCOORD_LH | SETCOORD_NORMAL,
|
||||
font, aPresContext);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -636,13 +656,11 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
aContext->GetData(kStyleDisplaySID);
|
||||
|
||||
// display
|
||||
display->mDisplay = NS_STYLE_DISPLAY_INLINE;
|
||||
if (ourDisplay->mDisplay.GetUnit() == eCSSUnit_Enumerated) {
|
||||
display->mDisplay = ourDisplay->mDisplay.GetIntValue();
|
||||
}
|
||||
|
||||
// direction: enum
|
||||
display->mDirection = NS_STYLE_DIRECTION_LTR;
|
||||
if (ourDisplay->mDirection.GetUnit() == eCSSUnit_Enumerated) {
|
||||
display->mDirection = ourDisplay->mDirection.GetIntValue();
|
||||
}
|
||||
|
@ -670,10 +688,16 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
color->mColor = ourColor->mColor.GetColorValue();
|
||||
}
|
||||
|
||||
// cursor: enum
|
||||
// cursor: enum, auto, inherit
|
||||
if (ourColor->mCursor.GetUnit() == eCSSUnit_Enumerated) {
|
||||
color->mCursor = ourColor->mCursor.GetIntValue();
|
||||
}
|
||||
else if (ourColor->mCursor.GetUnit() == eCSSUnit_Auto) {
|
||||
color->mCursor = NS_STYLE_CURSOR_AUTO;
|
||||
}
|
||||
else if (ourColor->mCursor.GetUnit() == eCSSUnit_Inherit) {
|
||||
color->mCursor = NS_STYLE_CURSOR_INHERIT;
|
||||
}
|
||||
|
||||
// cursor-image: string
|
||||
if (ourColor->mCursorImage.GetUnit() == eCSSUnit_String) {
|
||||
|
@ -689,12 +713,13 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
color->mBackgroundFlags |= NS_STYLE_BG_COLOR_TRANSPARENT;
|
||||
}
|
||||
|
||||
// background-image: string, enum (flags)
|
||||
// background-image: string (url), none
|
||||
if (ourColor->mBackImage.GetUnit() == eCSSUnit_String) {
|
||||
ourColor->mBackImage.GetStringValue(color->mBackgroundImage);
|
||||
color->mBackgroundFlags &= ~NS_STYLE_BG_IMAGE_NONE;
|
||||
}
|
||||
else if (ourColor->mBackImage.GetUnit() == eCSSUnit_Enumerated) {
|
||||
else if (ourColor->mBackImage.GetUnit() == eCSSUnit_None) {
|
||||
color->mBackgroundImage.Truncate();
|
||||
color->mBackgroundFlags |= NS_STYLE_BG_IMAGE_NONE;
|
||||
}
|
||||
|
||||
|
@ -710,7 +735,7 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
|
||||
// background-position: length, percent (flags)
|
||||
if (ourColor->mBackPositionX.GetUnit() == eCSSUnit_Percent) {
|
||||
color->mBackgroundXPosition = (nscoord)(TWIPS_CONST_FLOAT * ourColor->mBackPositionX.GetFloatValue());
|
||||
color->mBackgroundXPosition = (nscoord)(100.0f * ourColor->mBackPositionX.GetPercentValue());
|
||||
color->mBackgroundFlags |= NS_STYLE_BG_X_POSITION_PERCENT;
|
||||
color->mBackgroundFlags &= ~NS_STYLE_BG_X_POSITION_LENGTH;
|
||||
}
|
||||
|
@ -721,7 +746,7 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
color->mBackgroundFlags &= ~NS_STYLE_BG_X_POSITION_PERCENT;
|
||||
}
|
||||
if (ourColor->mBackPositionY.GetUnit() == eCSSUnit_Percent) {
|
||||
color->mBackgroundYPosition = (nscoord)(TWIPS_CONST_FLOAT * ourColor->mBackPositionY.GetFloatValue());
|
||||
color->mBackgroundYPosition = (nscoord)(100.0f * ourColor->mBackPositionY.GetPercentValue());
|
||||
color->mBackgroundFlags |= NS_STYLE_BG_Y_POSITION_PERCENT;
|
||||
color->mBackgroundFlags &= ~NS_STYLE_BG_Y_POSITION_LENGTH;
|
||||
}
|
||||
|
@ -750,25 +775,25 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
spacing->mMargin.left = CalcLength(ourMargin->mMargin->mLeft, font, aPresContext);
|
||||
} else if (ourMargin->mMargin->mLeft.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mMargin.left = (nscoord)ourMargin->mMargin->mLeft.GetFloatValue();
|
||||
spacing->mMargin.left = (nscoord)ourMargin->mMargin->mLeft.GetPercentValue();
|
||||
}
|
||||
if (ourMargin->mMargin->mTop.IsLengthUnit()) {
|
||||
spacing->mMargin.top = CalcLength(ourMargin->mMargin->mTop, font, aPresContext);
|
||||
} else if (ourMargin->mMargin->mTop.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mMargin.top = (nscoord)ourMargin->mMargin->mTop.GetFloatValue();
|
||||
spacing->mMargin.top = (nscoord)ourMargin->mMargin->mTop.GetPercentValue();
|
||||
}
|
||||
if (ourMargin->mMargin->mRight.IsLengthUnit()) {
|
||||
spacing->mMargin.right = CalcLength(ourMargin->mMargin->mRight, font, aPresContext);
|
||||
} else if (ourMargin->mMargin->mRight.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mMargin.right = (nscoord)ourMargin->mMargin->mRight.GetFloatValue();
|
||||
spacing->mMargin.right = (nscoord)ourMargin->mMargin->mRight.GetPercentValue();
|
||||
}
|
||||
if (ourMargin->mMargin->mBottom.IsLengthUnit()) {
|
||||
spacing->mMargin.bottom = CalcLength(ourMargin->mMargin->mBottom, font, aPresContext);
|
||||
} else if (ourMargin->mMargin->mBottom.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mMargin.bottom = (nscoord)ourMargin->mMargin->mBottom.GetFloatValue();
|
||||
spacing->mMargin.bottom = (nscoord)ourMargin->mMargin->mBottom.GetPercentValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -778,25 +803,25 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
spacing->mPadding.left = CalcLength(ourMargin->mPadding->mLeft, font, aPresContext);
|
||||
} else if (ourMargin->mPadding->mLeft.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mPadding.left = (nscoord)ourMargin->mPadding->mLeft.GetFloatValue();
|
||||
spacing->mPadding.left = (nscoord)ourMargin->mPadding->mLeft.GetPercentValue();
|
||||
}
|
||||
if (ourMargin->mPadding->mTop.IsLengthUnit()) {
|
||||
spacing->mPadding.top = CalcLength(ourMargin->mPadding->mTop, font, aPresContext);
|
||||
} else if (ourMargin->mPadding->mTop.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mPadding.top = (nscoord)ourMargin->mPadding->mTop.GetFloatValue();
|
||||
spacing->mPadding.top = (nscoord)ourMargin->mPadding->mTop.GetPercentValue();
|
||||
}
|
||||
if (ourMargin->mPadding->mRight.IsLengthUnit()) {
|
||||
spacing->mPadding.right = CalcLength(ourMargin->mPadding->mRight, font, aPresContext);
|
||||
} else if (ourMargin->mPadding->mRight.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mPadding.right = (nscoord)ourMargin->mPadding->mRight.GetFloatValue();
|
||||
spacing->mPadding.right = (nscoord)ourMargin->mPadding->mRight.GetPercentValue();
|
||||
}
|
||||
if (ourMargin->mPadding->mBottom.IsLengthUnit()) {
|
||||
spacing->mPadding.bottom = CalcLength(ourMargin->mPadding->mBottom, font, aPresContext);
|
||||
} else if (ourMargin->mPadding->mBottom.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
spacing->mPadding.bottom = (nscoord)ourMargin->mPadding->mBottom.GetFloatValue();
|
||||
spacing->mPadding.bottom = (nscoord)ourMargin->mPadding->mBottom.GetPercentValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -808,25 +833,25 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
border->mSize.left = CalcLength(ourBorder->mLeft, font, aPresContext);
|
||||
} else if (ourBorder->mLeft.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
border->mSize.left = (nscoord)ourBorder->mLeft.GetFloatValue();
|
||||
border->mSize.left = (nscoord)ourBorder->mLeft.GetPercentValue();
|
||||
}
|
||||
if (ourBorder->mTop.IsLengthUnit()) {
|
||||
border->mSize.top = CalcLength(ourBorder->mTop, font, aPresContext);
|
||||
} else if (ourBorder->mTop.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
border->mSize.top = (nscoord)ourBorder->mTop.GetFloatValue();
|
||||
border->mSize.top = (nscoord)ourBorder->mTop.GetPercentValue();
|
||||
}
|
||||
if (ourBorder->mRight.IsLengthUnit()) {
|
||||
border->mSize.right = CalcLength(ourBorder->mRight, font, aPresContext);
|
||||
} else if (ourBorder->mRight.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
border->mSize.right = (nscoord)ourBorder->mRight.GetFloatValue();
|
||||
border->mSize.right = (nscoord)ourBorder->mRight.GetPercentValue();
|
||||
}
|
||||
if (ourBorder->mBottom.IsLengthUnit()) {
|
||||
border->mSize.bottom = CalcLength(ourBorder->mBottom, font, aPresContext);
|
||||
} else if (ourBorder->mBottom.GetUnit() != eCSSUnit_Null) {
|
||||
// XXX handle percent properly, this isn't it
|
||||
border->mSize.bottom = (nscoord)ourBorder->mBottom.GetFloatValue();
|
||||
border->mSize.bottom = (nscoord)ourBorder->mBottom.GetPercentValue();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -882,64 +907,36 @@ void CSSStyleRuleImpl::MapStyleInto(nsIStyleContext* aContext, nsIPresContext* a
|
|||
position->mOverflow = ourPosition->mOverflow.GetIntValue();
|
||||
}
|
||||
|
||||
// box offsets. note: default value is auto so we don't check for it here
|
||||
if (ourPosition->mLeft.IsLengthUnit()) {
|
||||
position->mLeftOffset = CalcLength(ourPosition->mLeft, font, aPresContext);
|
||||
position->mLeftOffsetFlags = NS_STYLE_POSITION_VALUE_LENGTH;
|
||||
} else if (ourPosition->mHeight.GetUnit() == eCSSUnit_Percent) {
|
||||
position->mLeftOffset = (nscoord)(100 * ourPosition->mLeft.GetFloatValue());
|
||||
position->mLeftOffsetFlags = NS_STYLE_POSITION_VALUE_PERCENT;
|
||||
}
|
||||
if (ourPosition->mTop.IsLengthUnit()) {
|
||||
position->mTopOffset = CalcLength(ourPosition->mTop, font, aPresContext);
|
||||
position->mTopOffsetFlags = NS_STYLE_POSITION_VALUE_LENGTH;
|
||||
} else if (ourPosition->mHeight.GetUnit() == eCSSUnit_Percent) {
|
||||
position->mTopOffset = (nscoord)(100 * ourPosition->mTop.GetFloatValue());
|
||||
position->mTopOffsetFlags = NS_STYLE_POSITION_VALUE_PERCENT;
|
||||
}
|
||||
if (ourPosition->mWidth.IsLengthUnit()) {
|
||||
position->mWidth = CalcLength(ourPosition->mWidth, font, aPresContext);
|
||||
position->mWidthFlags = NS_STYLE_POSITION_VALUE_LENGTH;
|
||||
} else if (ourPosition->mWidth.GetUnit() == eCSSUnit_Percent) {
|
||||
position->mWidth = (nscoord)(100 * ourPosition->mWidth.GetFloatValue());
|
||||
position->mWidthFlags = NS_STYLE_POSITION_VALUE_PERCENT;
|
||||
}
|
||||
if (ourPosition->mHeight.IsLengthUnit()) {
|
||||
position->mHeight = CalcLength(ourPosition->mHeight, font, aPresContext);
|
||||
position->mHeightFlags = NS_STYLE_POSITION_VALUE_LENGTH;
|
||||
} else if (ourPosition->mHeight.GetUnit() == eCSSUnit_Percent) {
|
||||
position->mHeight = (nscoord)(100 * ourPosition->mHeight.GetFloatValue());
|
||||
position->mHeightFlags = NS_STYLE_POSITION_VALUE_PERCENT;
|
||||
}
|
||||
// box offsets: length, percent, auto, inherit
|
||||
SetCoord(ourPosition->mLeft, position->mLeftOffset, SETCOORD_LPAH, font, aPresContext);
|
||||
SetCoord(ourPosition->mTop, position->mTopOffset, SETCOORD_LPAH, font, aPresContext);
|
||||
SetCoord(ourPosition->mWidth, position->mWidth, SETCOORD_LPAH, font, aPresContext);
|
||||
SetCoord(ourPosition->mHeight, position->mHeight, SETCOORD_LPAH, font, aPresContext);
|
||||
|
||||
// z-index
|
||||
if (ourPosition->mZIndex.GetUnit() == eCSSUnit_Enumerated) {
|
||||
position->mPosition = ourPosition->mPosition.GetIntValue();
|
||||
} else if (ourPosition->mZIndex.GetUnit() == eCSSUnit_Absolute) {
|
||||
position->mZIndex = ourPosition->mZIndex.GetIntValue();
|
||||
}
|
||||
SetCoord(ourPosition->mZIndex, position->mZIndex, SETCOORD_IAH, nsnull, nsnull);
|
||||
|
||||
// clip property
|
||||
// clip property: length, auto
|
||||
if (nsnull != ourPosition->mClip) {
|
||||
position->mClipFlags = NS_STYLE_CLIP_RECT;
|
||||
|
||||
if (ourPosition->mClip->mTop.GetUnit() == eCSSUnit_Enumerated) {
|
||||
position->mClip.top = ourPosition->mClip->mTop.GetIntValue();
|
||||
if (ourPosition->mClip->mTop.GetUnit() == eCSSUnit_Auto) {
|
||||
// XXX position->mClip.top = ourPosition->mClip->mTop.GetIntValue();
|
||||
} else if (ourPosition->mClip->mTop.IsLengthUnit()) {
|
||||
position->mClip.top = CalcLength(ourPosition->mClip->mTop, font, aPresContext);
|
||||
}
|
||||
if (ourPosition->mClip->mRight.GetUnit() == eCSSUnit_Enumerated) {
|
||||
position->mClip.right = ourPosition->mClip->mRight.GetIntValue();
|
||||
if (ourPosition->mClip->mRight.GetUnit() == eCSSUnit_Auto) {
|
||||
// XXX position->mClip.right = ourPosition->mClip->mRight.GetIntValue();
|
||||
} else if (ourPosition->mClip->mRight.IsLengthUnit()) {
|
||||
position->mClip.right = CalcLength(ourPosition->mClip->mRight, font, aPresContext);
|
||||
}
|
||||
if (ourPosition->mClip->mBottom.GetUnit() == eCSSUnit_Enumerated) {
|
||||
position->mClip.bottom = ourPosition->mClip->mBottom.GetIntValue();
|
||||
if (ourPosition->mClip->mBottom.GetUnit() == eCSSUnit_Auto) {
|
||||
// XXX position->mClip.bottom = ourPosition->mClip->mBottom.GetIntValue();
|
||||
} else if (ourPosition->mClip->mBottom.IsLengthUnit()) {
|
||||
position->mClip.bottom = CalcLength(ourPosition->mClip->mBottom, font, aPresContext);
|
||||
}
|
||||
if (ourPosition->mClip->mLeft.GetUnit() == eCSSUnit_Enumerated) {
|
||||
position->mClip.left = ourPosition->mClip->mLeft.GetIntValue();
|
||||
if (ourPosition->mClip->mLeft.GetUnit() == eCSSUnit_Auto) {
|
||||
// XXX position->mClip.left = ourPosition->mClip->mLeft.GetIntValue();
|
||||
} else if (ourPosition->mClip->mLeft.IsLengthUnit()) {
|
||||
position->mClip.left = CalcLength(ourPosition->mClip->mLeft, font, aPresContext);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче