changed inheritance of colors
hacked inheritance of vert align for now git-svn-id: svn://10.0.0.236/trunk@14007 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
bb6dae00b4
commit
26593bba3e
@ -695,6 +695,7 @@ nscoord CalcLength(const nsCSSValue& aValue,
|
||||
switch (unit) {
|
||||
case eCSSUnit_EM:
|
||||
return NSToCoordRound(aValue.GetFloatValue() * (float)aFont->mFont.size);
|
||||
// XXX scale against font metrics height instead
|
||||
case eCSSUnit_EN:
|
||||
return NSToCoordRound((aValue.GetFloatValue() * (float)aFont->mFont.size) / 2.0f);
|
||||
case eCSSUnit_XHeight: {
|
||||
@ -807,10 +808,6 @@ static PRBool SetColor(const nsCSSValue& aValue, const nscolor aParentColor, nsc
|
||||
result = PR_TRUE;
|
||||
}
|
||||
}
|
||||
else if (eCSSUnit_Inherit == aValue.GetUnit()) {
|
||||
aResult = aParentColor;
|
||||
result = PR_TRUE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1035,8 +1032,13 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
}
|
||||
|
||||
// vertical-align: enum, length, percent, inherit
|
||||
SetCoord(ourText->mVerticalAlign, text->mVerticalAlign, SETCOORD_LPEH,
|
||||
font, aPresContext);
|
||||
if (! SetCoord(ourText->mVerticalAlign, text->mVerticalAlign, SETCOORD_LP | SETCOORD_ENUMERATED,
|
||||
font, aPresContext)) {
|
||||
// XXX this really needs to pass the inherit value along...
|
||||
if (eCSSUnit_Inherit == ourText->mVerticalAlign.GetUnit()) {
|
||||
text->mVerticalAlign = parentText->mVerticalAlign;
|
||||
}
|
||||
}
|
||||
|
||||
// white-space: enum, normal, inherit
|
||||
if (eCSSUnit_Enumerated == ourText->mWhiteSpace.GetUnit()) {
|
||||
@ -1193,7 +1195,11 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
}
|
||||
|
||||
// color: color, string, inherit
|
||||
SetColor(ourColor->mColor, parentColor->mColor, color->mColor);
|
||||
if (! SetColor(ourColor->mColor, parentColor->mColor, color->mColor)) {
|
||||
if (eCSSUnit_Inherit == ourColor->mColor.GetUnit()) {
|
||||
color->mColor = parentColor->mColor;
|
||||
}
|
||||
}
|
||||
|
||||
// cursor: enum, auto, url, inherit
|
||||
nsCSSValueList* list = ourColor->mCursor;
|
||||
@ -1220,6 +1226,11 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
else if (eCSSUnit_Enumerated == ourColor->mBackColor.GetUnit()) {
|
||||
color->mBackgroundFlags |= NS_STYLE_BG_COLOR_TRANSPARENT;
|
||||
}
|
||||
else if (eCSSUnit_Inherit == ourColor->mBackColor.GetUnit()) {
|
||||
color->mBackgroundColor = parentColor->mBackgroundColor;
|
||||
color->mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT;
|
||||
color->mBackgroundFlags |= (parentColor->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
|
||||
}
|
||||
|
||||
// background-image: url, none, inherit
|
||||
if (eCSSUnit_URL == ourColor->mBackImage.GetUnit()) {
|
||||
@ -1426,6 +1437,9 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
if (eCSSUnit_Enumerated == ourColor->mTop.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_TOP] = NS_RGBA(0, 0, 0, 0); // transparent
|
||||
}
|
||||
else if (eCSSUnit_Inherit == ourColor->mTop.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_TOP] = parentSpacing->mBorderColor[NS_SIDE_TOP];
|
||||
}
|
||||
}
|
||||
|
||||
if (! SetColor(ourColor->mRight, parentSpacing->mBorderColor[NS_SIDE_RIGHT],
|
||||
@ -1433,6 +1447,9 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
if (eCSSUnit_Enumerated == ourColor->mRight.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_RIGHT] = NS_RGBA(0, 0, 0, 0); // transparent
|
||||
}
|
||||
else if (eCSSUnit_Inherit == ourColor->mRight.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_RIGHT] = parentSpacing->mBorderColor[NS_SIDE_RIGHT];
|
||||
}
|
||||
}
|
||||
|
||||
if (! SetColor(ourColor->mBottom, parentSpacing->mBorderColor[NS_SIDE_BOTTOM],
|
||||
@ -1440,6 +1457,9 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
if (eCSSUnit_Enumerated == ourColor->mBottom.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_BOTTOM] = NS_RGBA(0, 0, 0, 0); // transparent
|
||||
}
|
||||
else if (eCSSUnit_Inherit == ourColor->mBottom.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_BOTTOM] = parentSpacing->mBorderColor[NS_SIDE_BOTTOM];
|
||||
}
|
||||
}
|
||||
|
||||
if (! SetColor(ourColor->mLeft, parentSpacing->mBorderColor[NS_SIDE_LEFT],
|
||||
@ -1447,6 +1467,9 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
if (eCSSUnit_Enumerated == ourColor->mLeft.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_LEFT] = NS_RGBA(0, 0, 0, 0); // transparent
|
||||
}
|
||||
else if (eCSSUnit_Inherit == ourColor->mLeft.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_LEFT] = parentSpacing->mBorderColor[NS_SIDE_LEFT];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -695,6 +695,7 @@ nscoord CalcLength(const nsCSSValue& aValue,
|
||||
switch (unit) {
|
||||
case eCSSUnit_EM:
|
||||
return NSToCoordRound(aValue.GetFloatValue() * (float)aFont->mFont.size);
|
||||
// XXX scale against font metrics height instead
|
||||
case eCSSUnit_EN:
|
||||
return NSToCoordRound((aValue.GetFloatValue() * (float)aFont->mFont.size) / 2.0f);
|
||||
case eCSSUnit_XHeight: {
|
||||
@ -807,10 +808,6 @@ static PRBool SetColor(const nsCSSValue& aValue, const nscolor aParentColor, nsc
|
||||
result = PR_TRUE;
|
||||
}
|
||||
}
|
||||
else if (eCSSUnit_Inherit == aValue.GetUnit()) {
|
||||
aResult = aParentColor;
|
||||
result = PR_TRUE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1035,8 +1032,13 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
}
|
||||
|
||||
// vertical-align: enum, length, percent, inherit
|
||||
SetCoord(ourText->mVerticalAlign, text->mVerticalAlign, SETCOORD_LPEH,
|
||||
font, aPresContext);
|
||||
if (! SetCoord(ourText->mVerticalAlign, text->mVerticalAlign, SETCOORD_LP | SETCOORD_ENUMERATED,
|
||||
font, aPresContext)) {
|
||||
// XXX this really needs to pass the inherit value along...
|
||||
if (eCSSUnit_Inherit == ourText->mVerticalAlign.GetUnit()) {
|
||||
text->mVerticalAlign = parentText->mVerticalAlign;
|
||||
}
|
||||
}
|
||||
|
||||
// white-space: enum, normal, inherit
|
||||
if (eCSSUnit_Enumerated == ourText->mWhiteSpace.GetUnit()) {
|
||||
@ -1193,7 +1195,11 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
}
|
||||
|
||||
// color: color, string, inherit
|
||||
SetColor(ourColor->mColor, parentColor->mColor, color->mColor);
|
||||
if (! SetColor(ourColor->mColor, parentColor->mColor, color->mColor)) {
|
||||
if (eCSSUnit_Inherit == ourColor->mColor.GetUnit()) {
|
||||
color->mColor = parentColor->mColor;
|
||||
}
|
||||
}
|
||||
|
||||
// cursor: enum, auto, url, inherit
|
||||
nsCSSValueList* list = ourColor->mCursor;
|
||||
@ -1220,6 +1226,11 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
else if (eCSSUnit_Enumerated == ourColor->mBackColor.GetUnit()) {
|
||||
color->mBackgroundFlags |= NS_STYLE_BG_COLOR_TRANSPARENT;
|
||||
}
|
||||
else if (eCSSUnit_Inherit == ourColor->mBackColor.GetUnit()) {
|
||||
color->mBackgroundColor = parentColor->mBackgroundColor;
|
||||
color->mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT;
|
||||
color->mBackgroundFlags |= (parentColor->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
|
||||
}
|
||||
|
||||
// background-image: url, none, inherit
|
||||
if (eCSSUnit_URL == ourColor->mBackImage.GetUnit()) {
|
||||
@ -1426,6 +1437,9 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
if (eCSSUnit_Enumerated == ourColor->mTop.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_TOP] = NS_RGBA(0, 0, 0, 0); // transparent
|
||||
}
|
||||
else if (eCSSUnit_Inherit == ourColor->mTop.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_TOP] = parentSpacing->mBorderColor[NS_SIDE_TOP];
|
||||
}
|
||||
}
|
||||
|
||||
if (! SetColor(ourColor->mRight, parentSpacing->mBorderColor[NS_SIDE_RIGHT],
|
||||
@ -1433,6 +1447,9 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
if (eCSSUnit_Enumerated == ourColor->mRight.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_RIGHT] = NS_RGBA(0, 0, 0, 0); // transparent
|
||||
}
|
||||
else if (eCSSUnit_Inherit == ourColor->mRight.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_RIGHT] = parentSpacing->mBorderColor[NS_SIDE_RIGHT];
|
||||
}
|
||||
}
|
||||
|
||||
if (! SetColor(ourColor->mBottom, parentSpacing->mBorderColor[NS_SIDE_BOTTOM],
|
||||
@ -1440,6 +1457,9 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
if (eCSSUnit_Enumerated == ourColor->mBottom.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_BOTTOM] = NS_RGBA(0, 0, 0, 0); // transparent
|
||||
}
|
||||
else if (eCSSUnit_Inherit == ourColor->mBottom.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_BOTTOM] = parentSpacing->mBorderColor[NS_SIDE_BOTTOM];
|
||||
}
|
||||
}
|
||||
|
||||
if (! SetColor(ourColor->mLeft, parentSpacing->mBorderColor[NS_SIDE_LEFT],
|
||||
@ -1447,6 +1467,9 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
if (eCSSUnit_Enumerated == ourColor->mLeft.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_LEFT] = NS_RGBA(0, 0, 0, 0); // transparent
|
||||
}
|
||||
else if (eCSSUnit_Inherit == ourColor->mLeft.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_LEFT] = parentSpacing->mBorderColor[NS_SIDE_LEFT];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -695,6 +695,7 @@ nscoord CalcLength(const nsCSSValue& aValue,
|
||||
switch (unit) {
|
||||
case eCSSUnit_EM:
|
||||
return NSToCoordRound(aValue.GetFloatValue() * (float)aFont->mFont.size);
|
||||
// XXX scale against font metrics height instead
|
||||
case eCSSUnit_EN:
|
||||
return NSToCoordRound((aValue.GetFloatValue() * (float)aFont->mFont.size) / 2.0f);
|
||||
case eCSSUnit_XHeight: {
|
||||
@ -807,10 +808,6 @@ static PRBool SetColor(const nsCSSValue& aValue, const nscolor aParentColor, nsc
|
||||
result = PR_TRUE;
|
||||
}
|
||||
}
|
||||
else if (eCSSUnit_Inherit == aValue.GetUnit()) {
|
||||
aResult = aParentColor;
|
||||
result = PR_TRUE;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1035,8 +1032,13 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
}
|
||||
|
||||
// vertical-align: enum, length, percent, inherit
|
||||
SetCoord(ourText->mVerticalAlign, text->mVerticalAlign, SETCOORD_LPEH,
|
||||
font, aPresContext);
|
||||
if (! SetCoord(ourText->mVerticalAlign, text->mVerticalAlign, SETCOORD_LP | SETCOORD_ENUMERATED,
|
||||
font, aPresContext)) {
|
||||
// XXX this really needs to pass the inherit value along...
|
||||
if (eCSSUnit_Inherit == ourText->mVerticalAlign.GetUnit()) {
|
||||
text->mVerticalAlign = parentText->mVerticalAlign;
|
||||
}
|
||||
}
|
||||
|
||||
// white-space: enum, normal, inherit
|
||||
if (eCSSUnit_Enumerated == ourText->mWhiteSpace.GetUnit()) {
|
||||
@ -1193,7 +1195,11 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
}
|
||||
|
||||
// color: color, string, inherit
|
||||
SetColor(ourColor->mColor, parentColor->mColor, color->mColor);
|
||||
if (! SetColor(ourColor->mColor, parentColor->mColor, color->mColor)) {
|
||||
if (eCSSUnit_Inherit == ourColor->mColor.GetUnit()) {
|
||||
color->mColor = parentColor->mColor;
|
||||
}
|
||||
}
|
||||
|
||||
// cursor: enum, auto, url, inherit
|
||||
nsCSSValueList* list = ourColor->mCursor;
|
||||
@ -1220,6 +1226,11 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
else if (eCSSUnit_Enumerated == ourColor->mBackColor.GetUnit()) {
|
||||
color->mBackgroundFlags |= NS_STYLE_BG_COLOR_TRANSPARENT;
|
||||
}
|
||||
else if (eCSSUnit_Inherit == ourColor->mBackColor.GetUnit()) {
|
||||
color->mBackgroundColor = parentColor->mBackgroundColor;
|
||||
color->mBackgroundFlags &= ~NS_STYLE_BG_COLOR_TRANSPARENT;
|
||||
color->mBackgroundFlags |= (parentColor->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT);
|
||||
}
|
||||
|
||||
// background-image: url, none, inherit
|
||||
if (eCSSUnit_URL == ourColor->mBackImage.GetUnit()) {
|
||||
@ -1426,6 +1437,9 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
if (eCSSUnit_Enumerated == ourColor->mTop.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_TOP] = NS_RGBA(0, 0, 0, 0); // transparent
|
||||
}
|
||||
else if (eCSSUnit_Inherit == ourColor->mTop.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_TOP] = parentSpacing->mBorderColor[NS_SIDE_TOP];
|
||||
}
|
||||
}
|
||||
|
||||
if (! SetColor(ourColor->mRight, parentSpacing->mBorderColor[NS_SIDE_RIGHT],
|
||||
@ -1433,6 +1447,9 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
if (eCSSUnit_Enumerated == ourColor->mRight.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_RIGHT] = NS_RGBA(0, 0, 0, 0); // transparent
|
||||
}
|
||||
else if (eCSSUnit_Inherit == ourColor->mRight.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_RIGHT] = parentSpacing->mBorderColor[NS_SIDE_RIGHT];
|
||||
}
|
||||
}
|
||||
|
||||
if (! SetColor(ourColor->mBottom, parentSpacing->mBorderColor[NS_SIDE_BOTTOM],
|
||||
@ -1440,6 +1457,9 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
if (eCSSUnit_Enumerated == ourColor->mBottom.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_BOTTOM] = NS_RGBA(0, 0, 0, 0); // transparent
|
||||
}
|
||||
else if (eCSSUnit_Inherit == ourColor->mBottom.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_BOTTOM] = parentSpacing->mBorderColor[NS_SIDE_BOTTOM];
|
||||
}
|
||||
}
|
||||
|
||||
if (! SetColor(ourColor->mLeft, parentSpacing->mBorderColor[NS_SIDE_LEFT],
|
||||
@ -1447,6 +1467,9 @@ void MapDeclarationInto(nsICSSDeclaration* aDeclaration,
|
||||
if (eCSSUnit_Enumerated == ourColor->mLeft.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_LEFT] = NS_RGBA(0, 0, 0, 0); // transparent
|
||||
}
|
||||
else if (eCSSUnit_Inherit == ourColor->mLeft.GetUnit()) {
|
||||
spacing->mBorderColor[NS_SIDE_LEFT] = parentSpacing->mBorderColor[NS_SIDE_LEFT];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user