From a0876134ef9d48c137a4000dd665372282814690 Mon Sep 17 00:00:00 2001 From: "pierre%netscape.com" Date: Mon, 24 Jan 2000 11:19:55 +0000 Subject: [PATCH] Bug 24676 ("Need -moz-outline-radius feature"). Added the 'outline_radius' similarly to the 'border_radius'. git-svn-id: svn://10.0.0.236/trunk@58467 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsStyleContext.cpp | 4 +- .../html/style/src/nsCSSDeclaration.cpp | 79 ++++++++++++++++++- .../content/html/style/src/nsCSSParser.cpp | 15 ++++ .../content/html/style/src/nsCSSPropList.h | 5 ++ .../content/html/style/src/nsCSSStruct.cpp | 79 ++++++++++++++++++- .../content/html/style/src/nsCSSStyleRule.cpp | 22 ++++++ .../html/style/src/nsICSSDeclaration.h | 1 + mozilla/content/shared/public/nsCSSPropList.h | 5 ++ mozilla/layout/base/public/nsIStyleContext.h | 1 + mozilla/layout/base/src/nsStyleContext.cpp | 4 +- .../html/style/src/nsCSSDeclaration.cpp | 79 ++++++++++++++++++- mozilla/layout/html/style/src/nsCSSParser.cpp | 15 ++++ mozilla/layout/html/style/src/nsCSSPropList.h | 5 ++ .../layout/html/style/src/nsCSSStyleRule.cpp | 22 ++++++ .../layout/html/style/src/nsICSSDeclaration.h | 1 + mozilla/layout/style/nsCSSDeclaration.cpp | 79 ++++++++++++++++++- mozilla/layout/style/nsCSSParser.cpp | 15 ++++ mozilla/layout/style/nsCSSPropList.h | 5 ++ mozilla/layout/style/nsCSSStruct.cpp | 79 ++++++++++++++++++- mozilla/layout/style/nsCSSStyleRule.cpp | 22 ++++++ mozilla/layout/style/nsStyleContext.cpp | 4 +- 21 files changed, 528 insertions(+), 13 deletions(-) diff --git a/mozilla/content/base/src/nsStyleContext.cpp b/mozilla/content/base/src/nsStyleContext.cpp index 4bbc3f29948..71c8a5c5866 100644 --- a/mozilla/content/base/src/nsStyleContext.cpp +++ b/mozilla/content/base/src/nsStyleContext.cpp @@ -567,6 +567,7 @@ void StyleSpacingImpl::ResetFrom(const nsStyleSpacing* aParent, nsIPresContext* mBorderColor[3] = NS_RGB(0, 0, 0); mBorderRadius.Reset(); + mOutlineRadius.Reset(); mOutlineWidth = medium; mOutlineStyle = NS_STYLE_BORDER_STYLE_NONE; @@ -762,7 +763,8 @@ PRInt32 StyleSpacingImpl::CalcDifference(const StyleSpacingImpl& aOther) const } if ((mOutlineWidth != aOther.mOutlineWidth) || (mOutlineStyle != aOther.mOutlineStyle) || - (mOutlineColor != aOther.mOutlineColor)) { + (mOutlineColor != aOther.mOutlineColor) || + (mOutlineRadius != aOther.mOutlineRadius)) { return NS_STYLE_HINT_REFLOW; // XXX: should be VISUAL: see bugs 9809 and 9816 } return NS_STYLE_HINT_NONE; diff --git a/mozilla/content/html/style/src/nsCSSDeclaration.cpp b/mozilla/content/html/style/src/nsCSSDeclaration.cpp index 806423123fa..1185d6327dc 100644 --- a/mozilla/content/html/style/src/nsCSSDeclaration.cpp +++ b/mozilla/content/html/style/src/nsCSSDeclaration.cpp @@ -374,13 +374,13 @@ void nsCSSDisplay::List(FILE* out, PRInt32 aIndent) const nsCSSMargin::nsCSSMargin(void) : mMargin(nsnull), mPadding(nsnull), - mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull) + mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull), mOutlineRadius(nsnull) { } nsCSSMargin::nsCSSMargin(const nsCSSMargin& aCopy) : mMargin(nsnull), mPadding(nsnull), - mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull), + mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull), mOutlineRadius(nsnull), mOutlineWidth(aCopy.mOutlineWidth), mOutlineColor(aCopy.mOutlineColor), mOutlineStyle(aCopy.mOutlineStyle), @@ -392,6 +392,7 @@ nsCSSMargin::nsCSSMargin(const nsCSSMargin& aCopy) CSS_IF_COPY(mBorderColor, nsCSSRect); CSS_IF_COPY(mBorderStyle, nsCSSRect); CSS_IF_COPY(mBorderRadius, nsCSSRect); + CSS_IF_COPY(mOutlineRadius, nsCSSRect); } nsCSSMargin::~nsCSSMargin(void) @@ -402,6 +403,7 @@ nsCSSMargin::~nsCSSMargin(void) CSS_IF_DELETE(mBorderColor); CSS_IF_DELETE(mBorderStyle); CSS_IF_DELETE(mBorderRadius); + CSS_IF_DELETE(mOutlineRadius); } const nsID& nsCSSMargin::GetID(void) @@ -460,6 +462,15 @@ void nsCSSMargin::List(FILE* out, PRInt32 aIndent) const mOutlineWidth.AppendToString(buffer, eCSSProperty_outline_width); mOutlineColor.AppendToString(buffer, eCSSProperty_outline_color); mOutlineStyle.AppendToString(buffer, eCSSProperty_outline_style); + if (nsnull != mOutlineRadius) { + static const nsCSSProperty trbl[] = { + eCSSProperty__moz_outline_radius_topLeft, + eCSSProperty__moz_outline_radius_topRight, + eCSSProperty__moz_outline_radius_bottomRight, + eCSSProperty__moz_outline_radius_bottomLeft + }; + mOutlineRadius->List(out, aIndent, trbl); + } mFloatEdge.AppendToString(buffer, eCSSProperty_float_edge); fputs(buffer, out); } @@ -1390,6 +1401,23 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu } break; + case eCSSProperty__moz_outline_radius_topLeft: + case eCSSProperty__moz_outline_radius_topRight: + case eCSSProperty__moz_outline_radius_bottomRight: + case eCSSProperty__moz_outline_radius_bottomLeft: + CSS_ENSURE(Margin) { + CSS_ENSURE_RECT(mMargin->mOutlineRadius) { + switch (aProperty) { + case eCSSProperty__moz_outline_radius_topLeft: mMargin->mOutlineRadius->mTop = aValue; break; + case eCSSProperty__moz_outline_radius_topRight: mMargin->mOutlineRadius->mRight = aValue; break; + case eCSSProperty__moz_outline_radius_bottomRight: mMargin->mOutlineRadius->mBottom = aValue; break; + case eCSSProperty__moz_outline_radius_bottomLeft: mMargin->mOutlineRadius->mLeft = aValue; break; + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + } + break; + case eCSSProperty_outline_width: case eCSSProperty_outline_color: case eCSSProperty_outline_style: @@ -2065,6 +2093,27 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) } break; + case eCSSProperty__moz_outline_radius_topLeft: + case eCSSProperty__moz_outline_radius_topRight: + case eCSSProperty__moz_outline_radius_bottomRight: + case eCSSProperty__moz_outline_radius_bottomLeft: + if (nsnull != mMargin) { + if (nsnull != mMargin->mOutlineRadius) { + CSS_ENSURE_IMPORTANT(Margin) { + CSS_ENSURE_RECT(mImportant->mMargin->mOutlineRadius) { + switch (aProperty) { + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_topLeft, mMargin->mOutlineRadius->mTop); + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_topRight, mMargin->mOutlineRadius->mRight); + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_bottomRight, mMargin->mOutlineRadius->mBottom); + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_bottomLeft, mMargin->mOutlineRadius->mLeft); + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + } + } + } + break; + case eCSSProperty_outline_width: case eCSSProperty_outline_color: case eCSSProperty_outline_style: @@ -2765,6 +2814,24 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) } break; + case eCSSProperty__moz_outline_radius_topLeft: + case eCSSProperty__moz_outline_radius_topRight: + case eCSSProperty__moz_outline_radius_bottomRight: + case eCSSProperty__moz_outline_radius_bottomLeft: + if ((nsnull != mMargin) && (nsnull != mMargin->mOutlineRadius)) { + switch (aProperty) { + case eCSSProperty__moz_outline_radius_topLeft: aValue = mMargin->mOutlineRadius->mTop; break; + case eCSSProperty__moz_outline_radius_topRight: aValue = mMargin->mOutlineRadius->mRight; break; + case eCSSProperty__moz_outline_radius_bottomRight: aValue = mMargin->mOutlineRadius->mBottom; break; + case eCSSProperty__moz_outline_radius_bottomLeft: aValue = mMargin->mOutlineRadius->mLeft; break; + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + else { + aValue.Reset(); + } + break; + case eCSSProperty_outline_width: case eCSSProperty_outline_color: case eCSSProperty_outline_style: @@ -3428,6 +3495,14 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty__moz_border_radius_bottomLeft, aValue); } break; + case eCSSProperty__moz_outline_radius: + if (HAS_RECT(mMargin,mOutlineRadius)) { + AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomLeft, aValue); + } + break; case eCSSProperty_border_width: if (HAS_RECT(mMargin,mBorderWidth)) { AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.Append(' '); diff --git a/mozilla/content/html/style/src/nsCSSParser.cpp b/mozilla/content/html/style/src/nsCSSParser.cpp index 4d976bd7689..85446561527 100644 --- a/mozilla/content/html/style/src/nsCSSParser.cpp +++ b/mozilla/content/html/style/src/nsCSSParser.cpp @@ -206,6 +206,7 @@ protected: PRBool ParseBorderStyle(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint); PRBool ParseBorderWidth(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint); PRBool ParseBorderRadius(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint); + PRBool ParseOutlineRadius(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint); PRBool ParseClip(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint); PRBool ParseContent(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint); PRBool ParseCounterData(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, @@ -2677,6 +2678,8 @@ PRBool CSSParserImpl::ParseProperty(PRInt32& aErrorCode, return ParseBorderWidth(aErrorCode, aDeclaration, aChangeHint); case eCSSProperty__moz_border_radius: return ParseBorderRadius(aErrorCode, aDeclaration, aChangeHint); + case eCSSProperty__moz_outline_radius: + return ParseOutlineRadius(aErrorCode, aDeclaration, aChangeHint); case eCSSProperty_clip: return ParseClip(aErrorCode, aDeclaration, aChangeHint); case eCSSProperty_content: @@ -3346,6 +3349,12 @@ static const nsCSSProperty kBorderRadiusIDs[] = { eCSSProperty__moz_border_radius_bottomRight, eCSSProperty__moz_border_radius_bottomLeft }; +static const nsCSSProperty kOutlineRadiusIDs[] = { + eCSSProperty__moz_outline_radius_topLeft, + eCSSProperty__moz_outline_radius_topRight, + eCSSProperty__moz_outline_radius_bottomRight, + eCSSProperty__moz_outline_radius_bottomLeft +}; PRBool CSSParserImpl::ParseBorder(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint) @@ -3468,6 +3477,12 @@ PRBool CSSParserImpl::ParseBorderRadius(PRInt32& aErrorCode, nsICSSDeclaration* return ParseBoxProperties(aErrorCode, aDeclaration, kBorderRadiusIDs, aChangeHint); } +PRBool CSSParserImpl::ParseOutlineRadius(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, + PRInt32& aChangeHint) +{ + return ParseBoxProperties(aErrorCode, aDeclaration, kOutlineRadiusIDs, aChangeHint); +} + PRBool CSSParserImpl::ParseClip(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint) diff --git a/mozilla/content/html/style/src/nsCSSPropList.h b/mozilla/content/html/style/src/nsCSSPropList.h index a71b13a4eee..2430d27798d 100644 --- a/mozilla/content/html/style/src/nsCSSPropList.h +++ b/mozilla/content/html/style/src/nsCSSPropList.h @@ -47,6 +47,11 @@ CSS_PROP(_moz_border_radius_topLeft, VISUAL) CSS_PROP(_moz_border_radius_topRight, VISUAL) CSS_PROP(_moz_border_radius_bottomLeft, VISUAL) CSS_PROP(_moz_border_radius_bottomRight, VISUAL) +CSS_PROP(_moz_outline_radius, VISUAL) +CSS_PROP(_moz_outline_radius_topLeft, VISUAL) +CSS_PROP(_moz_outline_radius_topRight, VISUAL) +CSS_PROP(_moz_outline_radius_bottomLeft, VISUAL) +CSS_PROP(_moz_outline_radius_bottomRight, VISUAL) CSS_PROP(azimuth, AURAL) CSS_PROP(background, VISUAL) CSS_PROP(background_attachment, VISUAL) diff --git a/mozilla/content/html/style/src/nsCSSStruct.cpp b/mozilla/content/html/style/src/nsCSSStruct.cpp index 806423123fa..1185d6327dc 100644 --- a/mozilla/content/html/style/src/nsCSSStruct.cpp +++ b/mozilla/content/html/style/src/nsCSSStruct.cpp @@ -374,13 +374,13 @@ void nsCSSDisplay::List(FILE* out, PRInt32 aIndent) const nsCSSMargin::nsCSSMargin(void) : mMargin(nsnull), mPadding(nsnull), - mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull) + mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull), mOutlineRadius(nsnull) { } nsCSSMargin::nsCSSMargin(const nsCSSMargin& aCopy) : mMargin(nsnull), mPadding(nsnull), - mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull), + mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull), mOutlineRadius(nsnull), mOutlineWidth(aCopy.mOutlineWidth), mOutlineColor(aCopy.mOutlineColor), mOutlineStyle(aCopy.mOutlineStyle), @@ -392,6 +392,7 @@ nsCSSMargin::nsCSSMargin(const nsCSSMargin& aCopy) CSS_IF_COPY(mBorderColor, nsCSSRect); CSS_IF_COPY(mBorderStyle, nsCSSRect); CSS_IF_COPY(mBorderRadius, nsCSSRect); + CSS_IF_COPY(mOutlineRadius, nsCSSRect); } nsCSSMargin::~nsCSSMargin(void) @@ -402,6 +403,7 @@ nsCSSMargin::~nsCSSMargin(void) CSS_IF_DELETE(mBorderColor); CSS_IF_DELETE(mBorderStyle); CSS_IF_DELETE(mBorderRadius); + CSS_IF_DELETE(mOutlineRadius); } const nsID& nsCSSMargin::GetID(void) @@ -460,6 +462,15 @@ void nsCSSMargin::List(FILE* out, PRInt32 aIndent) const mOutlineWidth.AppendToString(buffer, eCSSProperty_outline_width); mOutlineColor.AppendToString(buffer, eCSSProperty_outline_color); mOutlineStyle.AppendToString(buffer, eCSSProperty_outline_style); + if (nsnull != mOutlineRadius) { + static const nsCSSProperty trbl[] = { + eCSSProperty__moz_outline_radius_topLeft, + eCSSProperty__moz_outline_radius_topRight, + eCSSProperty__moz_outline_radius_bottomRight, + eCSSProperty__moz_outline_radius_bottomLeft + }; + mOutlineRadius->List(out, aIndent, trbl); + } mFloatEdge.AppendToString(buffer, eCSSProperty_float_edge); fputs(buffer, out); } @@ -1390,6 +1401,23 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu } break; + case eCSSProperty__moz_outline_radius_topLeft: + case eCSSProperty__moz_outline_radius_topRight: + case eCSSProperty__moz_outline_radius_bottomRight: + case eCSSProperty__moz_outline_radius_bottomLeft: + CSS_ENSURE(Margin) { + CSS_ENSURE_RECT(mMargin->mOutlineRadius) { + switch (aProperty) { + case eCSSProperty__moz_outline_radius_topLeft: mMargin->mOutlineRadius->mTop = aValue; break; + case eCSSProperty__moz_outline_radius_topRight: mMargin->mOutlineRadius->mRight = aValue; break; + case eCSSProperty__moz_outline_radius_bottomRight: mMargin->mOutlineRadius->mBottom = aValue; break; + case eCSSProperty__moz_outline_radius_bottomLeft: mMargin->mOutlineRadius->mLeft = aValue; break; + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + } + break; + case eCSSProperty_outline_width: case eCSSProperty_outline_color: case eCSSProperty_outline_style: @@ -2065,6 +2093,27 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) } break; + case eCSSProperty__moz_outline_radius_topLeft: + case eCSSProperty__moz_outline_radius_topRight: + case eCSSProperty__moz_outline_radius_bottomRight: + case eCSSProperty__moz_outline_radius_bottomLeft: + if (nsnull != mMargin) { + if (nsnull != mMargin->mOutlineRadius) { + CSS_ENSURE_IMPORTANT(Margin) { + CSS_ENSURE_RECT(mImportant->mMargin->mOutlineRadius) { + switch (aProperty) { + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_topLeft, mMargin->mOutlineRadius->mTop); + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_topRight, mMargin->mOutlineRadius->mRight); + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_bottomRight, mMargin->mOutlineRadius->mBottom); + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_bottomLeft, mMargin->mOutlineRadius->mLeft); + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + } + } + } + break; + case eCSSProperty_outline_width: case eCSSProperty_outline_color: case eCSSProperty_outline_style: @@ -2765,6 +2814,24 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) } break; + case eCSSProperty__moz_outline_radius_topLeft: + case eCSSProperty__moz_outline_radius_topRight: + case eCSSProperty__moz_outline_radius_bottomRight: + case eCSSProperty__moz_outline_radius_bottomLeft: + if ((nsnull != mMargin) && (nsnull != mMargin->mOutlineRadius)) { + switch (aProperty) { + case eCSSProperty__moz_outline_radius_topLeft: aValue = mMargin->mOutlineRadius->mTop; break; + case eCSSProperty__moz_outline_radius_topRight: aValue = mMargin->mOutlineRadius->mRight; break; + case eCSSProperty__moz_outline_radius_bottomRight: aValue = mMargin->mOutlineRadius->mBottom; break; + case eCSSProperty__moz_outline_radius_bottomLeft: aValue = mMargin->mOutlineRadius->mLeft; break; + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + else { + aValue.Reset(); + } + break; + case eCSSProperty_outline_width: case eCSSProperty_outline_color: case eCSSProperty_outline_style: @@ -3428,6 +3495,14 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty__moz_border_radius_bottomLeft, aValue); } break; + case eCSSProperty__moz_outline_radius: + if (HAS_RECT(mMargin,mOutlineRadius)) { + AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomLeft, aValue); + } + break; case eCSSProperty_border_width: if (HAS_RECT(mMargin,mBorderWidth)) { AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.Append(' '); diff --git a/mozilla/content/html/style/src/nsCSSStyleRule.cpp b/mozilla/content/html/style/src/nsCSSStyleRule.cpp index b694eac51a6..0e91b95333c 100644 --- a/mozilla/content/html/style/src/nsCSSStyleRule.cpp +++ b/mozilla/content/html/style/src/nsCSSStyleRule.cpp @@ -2022,6 +2022,28 @@ MapDeclarationMarginInto(nsICSSDeclaration* aDeclaration, } } + // -moz-outline-radius: length, percent, inherit + if (nsnull != ourMargin->mOutlineRadius) { + nsStyleCoord coord; + nsStyleCoord parentCoord; + parentSpacing->mOutlineRadius.GetLeft(parentCoord); + if (SetCoord(ourMargin->mOutlineRadius->mLeft, coord, parentCoord, SETCOORD_LPH, aFont->mFont, aPresContext)) { + spacing->mOutlineRadius.SetLeft(coord); + } + parentSpacing->mOutlineRadius.GetTop(parentCoord); + if (SetCoord(ourMargin->mOutlineRadius->mTop, coord, parentCoord, SETCOORD_LPH, aFont->mFont, aPresContext)) { + spacing->mOutlineRadius.SetTop(coord); + } + parentSpacing->mOutlineRadius.GetRight(parentCoord); + if (SetCoord(ourMargin->mOutlineRadius->mRight, coord, parentCoord, SETCOORD_LPH, aFont->mFont, aPresContext)) { + spacing->mOutlineRadius.SetRight(coord); + } + parentSpacing->mOutlineRadius.GetBottom(parentCoord); + if (SetCoord(ourMargin->mOutlineRadius->mBottom, coord, parentCoord, SETCOORD_LPH, aFont->mFont, aPresContext)) { + spacing->mOutlineRadius.SetBottom(coord); + } + } + // outline-width: length, enum, inherit if (! SetCoord(ourMargin->mOutlineWidth, spacing->mOutlineWidth, parentSpacing->mOutlineWidth, SETCOORD_LEH, aFont->mFont, aPresContext)) { diff --git a/mozilla/content/html/style/src/nsICSSDeclaration.h b/mozilla/content/html/style/src/nsICSSDeclaration.h index d7b809a577a..40b92e276aa 100644 --- a/mozilla/content/html/style/src/nsICSSDeclaration.h +++ b/mozilla/content/html/style/src/nsICSSDeclaration.h @@ -219,6 +219,7 @@ struct nsCSSMargin : public nsCSSStruct { nsCSSValue mOutlineWidth; nsCSSValue mOutlineColor; nsCSSValue mOutlineStyle; + nsCSSRect* mOutlineRadius; // (extension) nsCSSValue mFloatEdge; // NEW }; diff --git a/mozilla/content/shared/public/nsCSSPropList.h b/mozilla/content/shared/public/nsCSSPropList.h index a71b13a4eee..2430d27798d 100644 --- a/mozilla/content/shared/public/nsCSSPropList.h +++ b/mozilla/content/shared/public/nsCSSPropList.h @@ -47,6 +47,11 @@ CSS_PROP(_moz_border_radius_topLeft, VISUAL) CSS_PROP(_moz_border_radius_topRight, VISUAL) CSS_PROP(_moz_border_radius_bottomLeft, VISUAL) CSS_PROP(_moz_border_radius_bottomRight, VISUAL) +CSS_PROP(_moz_outline_radius, VISUAL) +CSS_PROP(_moz_outline_radius_topLeft, VISUAL) +CSS_PROP(_moz_outline_radius_topRight, VISUAL) +CSS_PROP(_moz_outline_radius_bottomLeft, VISUAL) +CSS_PROP(_moz_outline_radius_bottomRight, VISUAL) CSS_PROP(azimuth, AURAL) CSS_PROP(background, VISUAL) CSS_PROP(background_attachment, VISUAL) diff --git a/mozilla/layout/base/public/nsIStyleContext.h b/mozilla/layout/base/public/nsIStyleContext.h index 7645815b6bb..526c27e830c 100644 --- a/mozilla/layout/base/public/nsIStyleContext.h +++ b/mozilla/layout/base/public/nsIStyleContext.h @@ -85,6 +85,7 @@ struct nsStyleSpacing: public nsStyleStruct { nsStyleSides mBorder; // [reset] length, enum (see nsStyleConsts.h) nsStyleSides mBorderRadius; // [reset] length, percent, inherit + nsStyleSides mOutlineRadius; // [reset] length, percent, inherit // (top=topLeft, right=topRight, bottom=bottomRight, left=bottomLeft) nsStyleCoord mOutlineWidth; // [reset] length, enum (see nsStyleConsts.h) diff --git a/mozilla/layout/base/src/nsStyleContext.cpp b/mozilla/layout/base/src/nsStyleContext.cpp index 4bbc3f29948..71c8a5c5866 100644 --- a/mozilla/layout/base/src/nsStyleContext.cpp +++ b/mozilla/layout/base/src/nsStyleContext.cpp @@ -567,6 +567,7 @@ void StyleSpacingImpl::ResetFrom(const nsStyleSpacing* aParent, nsIPresContext* mBorderColor[3] = NS_RGB(0, 0, 0); mBorderRadius.Reset(); + mOutlineRadius.Reset(); mOutlineWidth = medium; mOutlineStyle = NS_STYLE_BORDER_STYLE_NONE; @@ -762,7 +763,8 @@ PRInt32 StyleSpacingImpl::CalcDifference(const StyleSpacingImpl& aOther) const } if ((mOutlineWidth != aOther.mOutlineWidth) || (mOutlineStyle != aOther.mOutlineStyle) || - (mOutlineColor != aOther.mOutlineColor)) { + (mOutlineColor != aOther.mOutlineColor) || + (mOutlineRadius != aOther.mOutlineRadius)) { return NS_STYLE_HINT_REFLOW; // XXX: should be VISUAL: see bugs 9809 and 9816 } return NS_STYLE_HINT_NONE; diff --git a/mozilla/layout/html/style/src/nsCSSDeclaration.cpp b/mozilla/layout/html/style/src/nsCSSDeclaration.cpp index 806423123fa..1185d6327dc 100644 --- a/mozilla/layout/html/style/src/nsCSSDeclaration.cpp +++ b/mozilla/layout/html/style/src/nsCSSDeclaration.cpp @@ -374,13 +374,13 @@ void nsCSSDisplay::List(FILE* out, PRInt32 aIndent) const nsCSSMargin::nsCSSMargin(void) : mMargin(nsnull), mPadding(nsnull), - mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull) + mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull), mOutlineRadius(nsnull) { } nsCSSMargin::nsCSSMargin(const nsCSSMargin& aCopy) : mMargin(nsnull), mPadding(nsnull), - mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull), + mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull), mOutlineRadius(nsnull), mOutlineWidth(aCopy.mOutlineWidth), mOutlineColor(aCopy.mOutlineColor), mOutlineStyle(aCopy.mOutlineStyle), @@ -392,6 +392,7 @@ nsCSSMargin::nsCSSMargin(const nsCSSMargin& aCopy) CSS_IF_COPY(mBorderColor, nsCSSRect); CSS_IF_COPY(mBorderStyle, nsCSSRect); CSS_IF_COPY(mBorderRadius, nsCSSRect); + CSS_IF_COPY(mOutlineRadius, nsCSSRect); } nsCSSMargin::~nsCSSMargin(void) @@ -402,6 +403,7 @@ nsCSSMargin::~nsCSSMargin(void) CSS_IF_DELETE(mBorderColor); CSS_IF_DELETE(mBorderStyle); CSS_IF_DELETE(mBorderRadius); + CSS_IF_DELETE(mOutlineRadius); } const nsID& nsCSSMargin::GetID(void) @@ -460,6 +462,15 @@ void nsCSSMargin::List(FILE* out, PRInt32 aIndent) const mOutlineWidth.AppendToString(buffer, eCSSProperty_outline_width); mOutlineColor.AppendToString(buffer, eCSSProperty_outline_color); mOutlineStyle.AppendToString(buffer, eCSSProperty_outline_style); + if (nsnull != mOutlineRadius) { + static const nsCSSProperty trbl[] = { + eCSSProperty__moz_outline_radius_topLeft, + eCSSProperty__moz_outline_radius_topRight, + eCSSProperty__moz_outline_radius_bottomRight, + eCSSProperty__moz_outline_radius_bottomLeft + }; + mOutlineRadius->List(out, aIndent, trbl); + } mFloatEdge.AppendToString(buffer, eCSSProperty_float_edge); fputs(buffer, out); } @@ -1390,6 +1401,23 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu } break; + case eCSSProperty__moz_outline_radius_topLeft: + case eCSSProperty__moz_outline_radius_topRight: + case eCSSProperty__moz_outline_radius_bottomRight: + case eCSSProperty__moz_outline_radius_bottomLeft: + CSS_ENSURE(Margin) { + CSS_ENSURE_RECT(mMargin->mOutlineRadius) { + switch (aProperty) { + case eCSSProperty__moz_outline_radius_topLeft: mMargin->mOutlineRadius->mTop = aValue; break; + case eCSSProperty__moz_outline_radius_topRight: mMargin->mOutlineRadius->mRight = aValue; break; + case eCSSProperty__moz_outline_radius_bottomRight: mMargin->mOutlineRadius->mBottom = aValue; break; + case eCSSProperty__moz_outline_radius_bottomLeft: mMargin->mOutlineRadius->mLeft = aValue; break; + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + } + break; + case eCSSProperty_outline_width: case eCSSProperty_outline_color: case eCSSProperty_outline_style: @@ -2065,6 +2093,27 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) } break; + case eCSSProperty__moz_outline_radius_topLeft: + case eCSSProperty__moz_outline_radius_topRight: + case eCSSProperty__moz_outline_radius_bottomRight: + case eCSSProperty__moz_outline_radius_bottomLeft: + if (nsnull != mMargin) { + if (nsnull != mMargin->mOutlineRadius) { + CSS_ENSURE_IMPORTANT(Margin) { + CSS_ENSURE_RECT(mImportant->mMargin->mOutlineRadius) { + switch (aProperty) { + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_topLeft, mMargin->mOutlineRadius->mTop); + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_topRight, mMargin->mOutlineRadius->mRight); + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_bottomRight, mMargin->mOutlineRadius->mBottom); + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_bottomLeft, mMargin->mOutlineRadius->mLeft); + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + } + } + } + break; + case eCSSProperty_outline_width: case eCSSProperty_outline_color: case eCSSProperty_outline_style: @@ -2765,6 +2814,24 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) } break; + case eCSSProperty__moz_outline_radius_topLeft: + case eCSSProperty__moz_outline_radius_topRight: + case eCSSProperty__moz_outline_radius_bottomRight: + case eCSSProperty__moz_outline_radius_bottomLeft: + if ((nsnull != mMargin) && (nsnull != mMargin->mOutlineRadius)) { + switch (aProperty) { + case eCSSProperty__moz_outline_radius_topLeft: aValue = mMargin->mOutlineRadius->mTop; break; + case eCSSProperty__moz_outline_radius_topRight: aValue = mMargin->mOutlineRadius->mRight; break; + case eCSSProperty__moz_outline_radius_bottomRight: aValue = mMargin->mOutlineRadius->mBottom; break; + case eCSSProperty__moz_outline_radius_bottomLeft: aValue = mMargin->mOutlineRadius->mLeft; break; + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + else { + aValue.Reset(); + } + break; + case eCSSProperty_outline_width: case eCSSProperty_outline_color: case eCSSProperty_outline_style: @@ -3428,6 +3495,14 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty__moz_border_radius_bottomLeft, aValue); } break; + case eCSSProperty__moz_outline_radius: + if (HAS_RECT(mMargin,mOutlineRadius)) { + AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomLeft, aValue); + } + break; case eCSSProperty_border_width: if (HAS_RECT(mMargin,mBorderWidth)) { AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.Append(' '); diff --git a/mozilla/layout/html/style/src/nsCSSParser.cpp b/mozilla/layout/html/style/src/nsCSSParser.cpp index 4d976bd7689..85446561527 100644 --- a/mozilla/layout/html/style/src/nsCSSParser.cpp +++ b/mozilla/layout/html/style/src/nsCSSParser.cpp @@ -206,6 +206,7 @@ protected: PRBool ParseBorderStyle(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint); PRBool ParseBorderWidth(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint); PRBool ParseBorderRadius(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint); + PRBool ParseOutlineRadius(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint); PRBool ParseClip(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint); PRBool ParseContent(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint); PRBool ParseCounterData(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, @@ -2677,6 +2678,8 @@ PRBool CSSParserImpl::ParseProperty(PRInt32& aErrorCode, return ParseBorderWidth(aErrorCode, aDeclaration, aChangeHint); case eCSSProperty__moz_border_radius: return ParseBorderRadius(aErrorCode, aDeclaration, aChangeHint); + case eCSSProperty__moz_outline_radius: + return ParseOutlineRadius(aErrorCode, aDeclaration, aChangeHint); case eCSSProperty_clip: return ParseClip(aErrorCode, aDeclaration, aChangeHint); case eCSSProperty_content: @@ -3346,6 +3349,12 @@ static const nsCSSProperty kBorderRadiusIDs[] = { eCSSProperty__moz_border_radius_bottomRight, eCSSProperty__moz_border_radius_bottomLeft }; +static const nsCSSProperty kOutlineRadiusIDs[] = { + eCSSProperty__moz_outline_radius_topLeft, + eCSSProperty__moz_outline_radius_topRight, + eCSSProperty__moz_outline_radius_bottomRight, + eCSSProperty__moz_outline_radius_bottomLeft +}; PRBool CSSParserImpl::ParseBorder(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint) @@ -3468,6 +3477,12 @@ PRBool CSSParserImpl::ParseBorderRadius(PRInt32& aErrorCode, nsICSSDeclaration* return ParseBoxProperties(aErrorCode, aDeclaration, kBorderRadiusIDs, aChangeHint); } +PRBool CSSParserImpl::ParseOutlineRadius(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, + PRInt32& aChangeHint) +{ + return ParseBoxProperties(aErrorCode, aDeclaration, kOutlineRadiusIDs, aChangeHint); +} + PRBool CSSParserImpl::ParseClip(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint) diff --git a/mozilla/layout/html/style/src/nsCSSPropList.h b/mozilla/layout/html/style/src/nsCSSPropList.h index a71b13a4eee..2430d27798d 100644 --- a/mozilla/layout/html/style/src/nsCSSPropList.h +++ b/mozilla/layout/html/style/src/nsCSSPropList.h @@ -47,6 +47,11 @@ CSS_PROP(_moz_border_radius_topLeft, VISUAL) CSS_PROP(_moz_border_radius_topRight, VISUAL) CSS_PROP(_moz_border_radius_bottomLeft, VISUAL) CSS_PROP(_moz_border_radius_bottomRight, VISUAL) +CSS_PROP(_moz_outline_radius, VISUAL) +CSS_PROP(_moz_outline_radius_topLeft, VISUAL) +CSS_PROP(_moz_outline_radius_topRight, VISUAL) +CSS_PROP(_moz_outline_radius_bottomLeft, VISUAL) +CSS_PROP(_moz_outline_radius_bottomRight, VISUAL) CSS_PROP(azimuth, AURAL) CSS_PROP(background, VISUAL) CSS_PROP(background_attachment, VISUAL) diff --git a/mozilla/layout/html/style/src/nsCSSStyleRule.cpp b/mozilla/layout/html/style/src/nsCSSStyleRule.cpp index b694eac51a6..0e91b95333c 100644 --- a/mozilla/layout/html/style/src/nsCSSStyleRule.cpp +++ b/mozilla/layout/html/style/src/nsCSSStyleRule.cpp @@ -2022,6 +2022,28 @@ MapDeclarationMarginInto(nsICSSDeclaration* aDeclaration, } } + // -moz-outline-radius: length, percent, inherit + if (nsnull != ourMargin->mOutlineRadius) { + nsStyleCoord coord; + nsStyleCoord parentCoord; + parentSpacing->mOutlineRadius.GetLeft(parentCoord); + if (SetCoord(ourMargin->mOutlineRadius->mLeft, coord, parentCoord, SETCOORD_LPH, aFont->mFont, aPresContext)) { + spacing->mOutlineRadius.SetLeft(coord); + } + parentSpacing->mOutlineRadius.GetTop(parentCoord); + if (SetCoord(ourMargin->mOutlineRadius->mTop, coord, parentCoord, SETCOORD_LPH, aFont->mFont, aPresContext)) { + spacing->mOutlineRadius.SetTop(coord); + } + parentSpacing->mOutlineRadius.GetRight(parentCoord); + if (SetCoord(ourMargin->mOutlineRadius->mRight, coord, parentCoord, SETCOORD_LPH, aFont->mFont, aPresContext)) { + spacing->mOutlineRadius.SetRight(coord); + } + parentSpacing->mOutlineRadius.GetBottom(parentCoord); + if (SetCoord(ourMargin->mOutlineRadius->mBottom, coord, parentCoord, SETCOORD_LPH, aFont->mFont, aPresContext)) { + spacing->mOutlineRadius.SetBottom(coord); + } + } + // outline-width: length, enum, inherit if (! SetCoord(ourMargin->mOutlineWidth, spacing->mOutlineWidth, parentSpacing->mOutlineWidth, SETCOORD_LEH, aFont->mFont, aPresContext)) { diff --git a/mozilla/layout/html/style/src/nsICSSDeclaration.h b/mozilla/layout/html/style/src/nsICSSDeclaration.h index d7b809a577a..40b92e276aa 100644 --- a/mozilla/layout/html/style/src/nsICSSDeclaration.h +++ b/mozilla/layout/html/style/src/nsICSSDeclaration.h @@ -219,6 +219,7 @@ struct nsCSSMargin : public nsCSSStruct { nsCSSValue mOutlineWidth; nsCSSValue mOutlineColor; nsCSSValue mOutlineStyle; + nsCSSRect* mOutlineRadius; // (extension) nsCSSValue mFloatEdge; // NEW }; diff --git a/mozilla/layout/style/nsCSSDeclaration.cpp b/mozilla/layout/style/nsCSSDeclaration.cpp index 806423123fa..1185d6327dc 100644 --- a/mozilla/layout/style/nsCSSDeclaration.cpp +++ b/mozilla/layout/style/nsCSSDeclaration.cpp @@ -374,13 +374,13 @@ void nsCSSDisplay::List(FILE* out, PRInt32 aIndent) const nsCSSMargin::nsCSSMargin(void) : mMargin(nsnull), mPadding(nsnull), - mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull) + mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull), mOutlineRadius(nsnull) { } nsCSSMargin::nsCSSMargin(const nsCSSMargin& aCopy) : mMargin(nsnull), mPadding(nsnull), - mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull), + mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull), mOutlineRadius(nsnull), mOutlineWidth(aCopy.mOutlineWidth), mOutlineColor(aCopy.mOutlineColor), mOutlineStyle(aCopy.mOutlineStyle), @@ -392,6 +392,7 @@ nsCSSMargin::nsCSSMargin(const nsCSSMargin& aCopy) CSS_IF_COPY(mBorderColor, nsCSSRect); CSS_IF_COPY(mBorderStyle, nsCSSRect); CSS_IF_COPY(mBorderRadius, nsCSSRect); + CSS_IF_COPY(mOutlineRadius, nsCSSRect); } nsCSSMargin::~nsCSSMargin(void) @@ -402,6 +403,7 @@ nsCSSMargin::~nsCSSMargin(void) CSS_IF_DELETE(mBorderColor); CSS_IF_DELETE(mBorderStyle); CSS_IF_DELETE(mBorderRadius); + CSS_IF_DELETE(mOutlineRadius); } const nsID& nsCSSMargin::GetID(void) @@ -460,6 +462,15 @@ void nsCSSMargin::List(FILE* out, PRInt32 aIndent) const mOutlineWidth.AppendToString(buffer, eCSSProperty_outline_width); mOutlineColor.AppendToString(buffer, eCSSProperty_outline_color); mOutlineStyle.AppendToString(buffer, eCSSProperty_outline_style); + if (nsnull != mOutlineRadius) { + static const nsCSSProperty trbl[] = { + eCSSProperty__moz_outline_radius_topLeft, + eCSSProperty__moz_outline_radius_topRight, + eCSSProperty__moz_outline_radius_bottomRight, + eCSSProperty__moz_outline_radius_bottomLeft + }; + mOutlineRadius->List(out, aIndent, trbl); + } mFloatEdge.AppendToString(buffer, eCSSProperty_float_edge); fputs(buffer, out); } @@ -1390,6 +1401,23 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu } break; + case eCSSProperty__moz_outline_radius_topLeft: + case eCSSProperty__moz_outline_radius_topRight: + case eCSSProperty__moz_outline_radius_bottomRight: + case eCSSProperty__moz_outline_radius_bottomLeft: + CSS_ENSURE(Margin) { + CSS_ENSURE_RECT(mMargin->mOutlineRadius) { + switch (aProperty) { + case eCSSProperty__moz_outline_radius_topLeft: mMargin->mOutlineRadius->mTop = aValue; break; + case eCSSProperty__moz_outline_radius_topRight: mMargin->mOutlineRadius->mRight = aValue; break; + case eCSSProperty__moz_outline_radius_bottomRight: mMargin->mOutlineRadius->mBottom = aValue; break; + case eCSSProperty__moz_outline_radius_bottomLeft: mMargin->mOutlineRadius->mLeft = aValue; break; + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + } + break; + case eCSSProperty_outline_width: case eCSSProperty_outline_color: case eCSSProperty_outline_style: @@ -2065,6 +2093,27 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) } break; + case eCSSProperty__moz_outline_radius_topLeft: + case eCSSProperty__moz_outline_radius_topRight: + case eCSSProperty__moz_outline_radius_bottomRight: + case eCSSProperty__moz_outline_radius_bottomLeft: + if (nsnull != mMargin) { + if (nsnull != mMargin->mOutlineRadius) { + CSS_ENSURE_IMPORTANT(Margin) { + CSS_ENSURE_RECT(mImportant->mMargin->mOutlineRadius) { + switch (aProperty) { + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_topLeft, mMargin->mOutlineRadius->mTop); + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_topRight, mMargin->mOutlineRadius->mRight); + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_bottomRight, mMargin->mOutlineRadius->mBottom); + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_bottomLeft, mMargin->mOutlineRadius->mLeft); + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + } + } + } + break; + case eCSSProperty_outline_width: case eCSSProperty_outline_color: case eCSSProperty_outline_style: @@ -2765,6 +2814,24 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) } break; + case eCSSProperty__moz_outline_radius_topLeft: + case eCSSProperty__moz_outline_radius_topRight: + case eCSSProperty__moz_outline_radius_bottomRight: + case eCSSProperty__moz_outline_radius_bottomLeft: + if ((nsnull != mMargin) && (nsnull != mMargin->mOutlineRadius)) { + switch (aProperty) { + case eCSSProperty__moz_outline_radius_topLeft: aValue = mMargin->mOutlineRadius->mTop; break; + case eCSSProperty__moz_outline_radius_topRight: aValue = mMargin->mOutlineRadius->mRight; break; + case eCSSProperty__moz_outline_radius_bottomRight: aValue = mMargin->mOutlineRadius->mBottom; break; + case eCSSProperty__moz_outline_radius_bottomLeft: aValue = mMargin->mOutlineRadius->mLeft; break; + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + else { + aValue.Reset(); + } + break; + case eCSSProperty_outline_width: case eCSSProperty_outline_color: case eCSSProperty_outline_style: @@ -3428,6 +3495,14 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty__moz_border_radius_bottomLeft, aValue); } break; + case eCSSProperty__moz_outline_radius: + if (HAS_RECT(mMargin,mOutlineRadius)) { + AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomLeft, aValue); + } + break; case eCSSProperty_border_width: if (HAS_RECT(mMargin,mBorderWidth)) { AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.Append(' '); diff --git a/mozilla/layout/style/nsCSSParser.cpp b/mozilla/layout/style/nsCSSParser.cpp index 4d976bd7689..85446561527 100644 --- a/mozilla/layout/style/nsCSSParser.cpp +++ b/mozilla/layout/style/nsCSSParser.cpp @@ -206,6 +206,7 @@ protected: PRBool ParseBorderStyle(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint); PRBool ParseBorderWidth(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint); PRBool ParseBorderRadius(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint); + PRBool ParseOutlineRadius(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint); PRBool ParseClip(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint); PRBool ParseContent(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint); PRBool ParseCounterData(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, @@ -2677,6 +2678,8 @@ PRBool CSSParserImpl::ParseProperty(PRInt32& aErrorCode, return ParseBorderWidth(aErrorCode, aDeclaration, aChangeHint); case eCSSProperty__moz_border_radius: return ParseBorderRadius(aErrorCode, aDeclaration, aChangeHint); + case eCSSProperty__moz_outline_radius: + return ParseOutlineRadius(aErrorCode, aDeclaration, aChangeHint); case eCSSProperty_clip: return ParseClip(aErrorCode, aDeclaration, aChangeHint); case eCSSProperty_content: @@ -3346,6 +3349,12 @@ static const nsCSSProperty kBorderRadiusIDs[] = { eCSSProperty__moz_border_radius_bottomRight, eCSSProperty__moz_border_radius_bottomLeft }; +static const nsCSSProperty kOutlineRadiusIDs[] = { + eCSSProperty__moz_outline_radius_topLeft, + eCSSProperty__moz_outline_radius_topRight, + eCSSProperty__moz_outline_radius_bottomRight, + eCSSProperty__moz_outline_radius_bottomLeft +}; PRBool CSSParserImpl::ParseBorder(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint) @@ -3468,6 +3477,12 @@ PRBool CSSParserImpl::ParseBorderRadius(PRInt32& aErrorCode, nsICSSDeclaration* return ParseBoxProperties(aErrorCode, aDeclaration, kBorderRadiusIDs, aChangeHint); } +PRBool CSSParserImpl::ParseOutlineRadius(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, + PRInt32& aChangeHint) +{ + return ParseBoxProperties(aErrorCode, aDeclaration, kOutlineRadiusIDs, aChangeHint); +} + PRBool CSSParserImpl::ParseClip(PRInt32& aErrorCode, nsICSSDeclaration* aDeclaration, PRInt32& aChangeHint) diff --git a/mozilla/layout/style/nsCSSPropList.h b/mozilla/layout/style/nsCSSPropList.h index a71b13a4eee..2430d27798d 100644 --- a/mozilla/layout/style/nsCSSPropList.h +++ b/mozilla/layout/style/nsCSSPropList.h @@ -47,6 +47,11 @@ CSS_PROP(_moz_border_radius_topLeft, VISUAL) CSS_PROP(_moz_border_radius_topRight, VISUAL) CSS_PROP(_moz_border_radius_bottomLeft, VISUAL) CSS_PROP(_moz_border_radius_bottomRight, VISUAL) +CSS_PROP(_moz_outline_radius, VISUAL) +CSS_PROP(_moz_outline_radius_topLeft, VISUAL) +CSS_PROP(_moz_outline_radius_topRight, VISUAL) +CSS_PROP(_moz_outline_radius_bottomLeft, VISUAL) +CSS_PROP(_moz_outline_radius_bottomRight, VISUAL) CSS_PROP(azimuth, AURAL) CSS_PROP(background, VISUAL) CSS_PROP(background_attachment, VISUAL) diff --git a/mozilla/layout/style/nsCSSStruct.cpp b/mozilla/layout/style/nsCSSStruct.cpp index 806423123fa..1185d6327dc 100644 --- a/mozilla/layout/style/nsCSSStruct.cpp +++ b/mozilla/layout/style/nsCSSStruct.cpp @@ -374,13 +374,13 @@ void nsCSSDisplay::List(FILE* out, PRInt32 aIndent) const nsCSSMargin::nsCSSMargin(void) : mMargin(nsnull), mPadding(nsnull), - mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull) + mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull), mOutlineRadius(nsnull) { } nsCSSMargin::nsCSSMargin(const nsCSSMargin& aCopy) : mMargin(nsnull), mPadding(nsnull), - mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull), + mBorderWidth(nsnull), mBorderColor(nsnull), mBorderStyle(nsnull), mBorderRadius(nsnull), mOutlineRadius(nsnull), mOutlineWidth(aCopy.mOutlineWidth), mOutlineColor(aCopy.mOutlineColor), mOutlineStyle(aCopy.mOutlineStyle), @@ -392,6 +392,7 @@ nsCSSMargin::nsCSSMargin(const nsCSSMargin& aCopy) CSS_IF_COPY(mBorderColor, nsCSSRect); CSS_IF_COPY(mBorderStyle, nsCSSRect); CSS_IF_COPY(mBorderRadius, nsCSSRect); + CSS_IF_COPY(mOutlineRadius, nsCSSRect); } nsCSSMargin::~nsCSSMargin(void) @@ -402,6 +403,7 @@ nsCSSMargin::~nsCSSMargin(void) CSS_IF_DELETE(mBorderColor); CSS_IF_DELETE(mBorderStyle); CSS_IF_DELETE(mBorderRadius); + CSS_IF_DELETE(mOutlineRadius); } const nsID& nsCSSMargin::GetID(void) @@ -460,6 +462,15 @@ void nsCSSMargin::List(FILE* out, PRInt32 aIndent) const mOutlineWidth.AppendToString(buffer, eCSSProperty_outline_width); mOutlineColor.AppendToString(buffer, eCSSProperty_outline_color); mOutlineStyle.AppendToString(buffer, eCSSProperty_outline_style); + if (nsnull != mOutlineRadius) { + static const nsCSSProperty trbl[] = { + eCSSProperty__moz_outline_radius_topLeft, + eCSSProperty__moz_outline_radius_topRight, + eCSSProperty__moz_outline_radius_bottomRight, + eCSSProperty__moz_outline_radius_bottomLeft + }; + mOutlineRadius->List(out, aIndent, trbl); + } mFloatEdge.AppendToString(buffer, eCSSProperty_float_edge); fputs(buffer, out); } @@ -1390,6 +1401,23 @@ CSSDeclarationImpl::AppendValue(nsCSSProperty aProperty, const nsCSSValue& aValu } break; + case eCSSProperty__moz_outline_radius_topLeft: + case eCSSProperty__moz_outline_radius_topRight: + case eCSSProperty__moz_outline_radius_bottomRight: + case eCSSProperty__moz_outline_radius_bottomLeft: + CSS_ENSURE(Margin) { + CSS_ENSURE_RECT(mMargin->mOutlineRadius) { + switch (aProperty) { + case eCSSProperty__moz_outline_radius_topLeft: mMargin->mOutlineRadius->mTop = aValue; break; + case eCSSProperty__moz_outline_radius_topRight: mMargin->mOutlineRadius->mRight = aValue; break; + case eCSSProperty__moz_outline_radius_bottomRight: mMargin->mOutlineRadius->mBottom = aValue; break; + case eCSSProperty__moz_outline_radius_bottomLeft: mMargin->mOutlineRadius->mLeft = aValue; break; + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + } + break; + case eCSSProperty_outline_width: case eCSSProperty_outline_color: case eCSSProperty_outline_style: @@ -2065,6 +2093,27 @@ CSSDeclarationImpl::SetValueImportant(nsCSSProperty aProperty) } break; + case eCSSProperty__moz_outline_radius_topLeft: + case eCSSProperty__moz_outline_radius_topRight: + case eCSSProperty__moz_outline_radius_bottomRight: + case eCSSProperty__moz_outline_radius_bottomLeft: + if (nsnull != mMargin) { + if (nsnull != mMargin->mOutlineRadius) { + CSS_ENSURE_IMPORTANT(Margin) { + CSS_ENSURE_RECT(mImportant->mMargin->mOutlineRadius) { + switch (aProperty) { + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_topLeft, mMargin->mOutlineRadius->mTop); + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_topRight, mMargin->mOutlineRadius->mRight); + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_bottomRight, mMargin->mOutlineRadius->mBottom); + CSS_CASE_IMPORTANT(eCSSProperty__moz_outline_radius_bottomLeft, mMargin->mOutlineRadius->mLeft); + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + } + } + } + break; + case eCSSProperty_outline_width: case eCSSProperty_outline_color: case eCSSProperty_outline_style: @@ -2765,6 +2814,24 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsCSSValue& aValue) } break; + case eCSSProperty__moz_outline_radius_topLeft: + case eCSSProperty__moz_outline_radius_topRight: + case eCSSProperty__moz_outline_radius_bottomRight: + case eCSSProperty__moz_outline_radius_bottomLeft: + if ((nsnull != mMargin) && (nsnull != mMargin->mOutlineRadius)) { + switch (aProperty) { + case eCSSProperty__moz_outline_radius_topLeft: aValue = mMargin->mOutlineRadius->mTop; break; + case eCSSProperty__moz_outline_radius_topRight: aValue = mMargin->mOutlineRadius->mRight; break; + case eCSSProperty__moz_outline_radius_bottomRight: aValue = mMargin->mOutlineRadius->mBottom; break; + case eCSSProperty__moz_outline_radius_bottomLeft: aValue = mMargin->mOutlineRadius->mLeft; break; + CSS_BOGUS_DEFAULT; // make compiler happy + } + } + else { + aValue.Reset(); + } + break; + case eCSSProperty_outline_width: case eCSSProperty_outline_color: case eCSSProperty_outline_style: @@ -3428,6 +3495,14 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty__moz_border_radius_bottomLeft, aValue); } break; + case eCSSProperty__moz_outline_radius: + if (HAS_RECT(mMargin,mOutlineRadius)) { + AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomLeft, aValue); + } + break; case eCSSProperty_border_width: if (HAS_RECT(mMargin,mBorderWidth)) { AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.Append(' '); diff --git a/mozilla/layout/style/nsCSSStyleRule.cpp b/mozilla/layout/style/nsCSSStyleRule.cpp index b694eac51a6..0e91b95333c 100644 --- a/mozilla/layout/style/nsCSSStyleRule.cpp +++ b/mozilla/layout/style/nsCSSStyleRule.cpp @@ -2022,6 +2022,28 @@ MapDeclarationMarginInto(nsICSSDeclaration* aDeclaration, } } + // -moz-outline-radius: length, percent, inherit + if (nsnull != ourMargin->mOutlineRadius) { + nsStyleCoord coord; + nsStyleCoord parentCoord; + parentSpacing->mOutlineRadius.GetLeft(parentCoord); + if (SetCoord(ourMargin->mOutlineRadius->mLeft, coord, parentCoord, SETCOORD_LPH, aFont->mFont, aPresContext)) { + spacing->mOutlineRadius.SetLeft(coord); + } + parentSpacing->mOutlineRadius.GetTop(parentCoord); + if (SetCoord(ourMargin->mOutlineRadius->mTop, coord, parentCoord, SETCOORD_LPH, aFont->mFont, aPresContext)) { + spacing->mOutlineRadius.SetTop(coord); + } + parentSpacing->mOutlineRadius.GetRight(parentCoord); + if (SetCoord(ourMargin->mOutlineRadius->mRight, coord, parentCoord, SETCOORD_LPH, aFont->mFont, aPresContext)) { + spacing->mOutlineRadius.SetRight(coord); + } + parentSpacing->mOutlineRadius.GetBottom(parentCoord); + if (SetCoord(ourMargin->mOutlineRadius->mBottom, coord, parentCoord, SETCOORD_LPH, aFont->mFont, aPresContext)) { + spacing->mOutlineRadius.SetBottom(coord); + } + } + // outline-width: length, enum, inherit if (! SetCoord(ourMargin->mOutlineWidth, spacing->mOutlineWidth, parentSpacing->mOutlineWidth, SETCOORD_LEH, aFont->mFont, aPresContext)) { diff --git a/mozilla/layout/style/nsStyleContext.cpp b/mozilla/layout/style/nsStyleContext.cpp index 4bbc3f29948..71c8a5c5866 100644 --- a/mozilla/layout/style/nsStyleContext.cpp +++ b/mozilla/layout/style/nsStyleContext.cpp @@ -567,6 +567,7 @@ void StyleSpacingImpl::ResetFrom(const nsStyleSpacing* aParent, nsIPresContext* mBorderColor[3] = NS_RGB(0, 0, 0); mBorderRadius.Reset(); + mOutlineRadius.Reset(); mOutlineWidth = medium; mOutlineStyle = NS_STYLE_BORDER_STYLE_NONE; @@ -762,7 +763,8 @@ PRInt32 StyleSpacingImpl::CalcDifference(const StyleSpacingImpl& aOther) const } if ((mOutlineWidth != aOther.mOutlineWidth) || (mOutlineStyle != aOther.mOutlineStyle) || - (mOutlineColor != aOther.mOutlineColor)) { + (mOutlineColor != aOther.mOutlineColor) || + (mOutlineRadius != aOther.mOutlineRadius)) { return NS_STYLE_HINT_REFLOW; // XXX: should be VISUAL: see bugs 9809 and 9816 } return NS_STYLE_HINT_NONE;