зеркало из https://github.com/mozilla/pjs.git
Bug 251498. Implement outline-offset. r+sr=roc
This commit is contained in:
Родитель
bcc8902374
Коммит
b8351a14b5
|
@ -3451,7 +3451,12 @@ nsRuleNode::ComputeOutlineData(nsStyleStruct* aStartStruct,
|
|||
// outline-width: length, enum, inherit
|
||||
SetCoord(marginData.mOutlineWidth, outline->mOutlineWidth, parentOutline->mOutlineWidth,
|
||||
SETCOORD_LEH, aContext, mPresContext, inherited);
|
||||
|
||||
// outline-offset: length, enum, inherit
|
||||
SetCoord(marginData.mOutlineOffset, outline->mOutlineOffset, parentOutline->mOutlineOffset,
|
||||
SETCOORD_LEH, aContext, mPresContext, inherited);
|
||||
|
||||
|
||||
// outline-color: color, string, enum, inherit
|
||||
nscolor outlineColor;
|
||||
nscolor unused = NS_RGB(0,0,0);
|
||||
|
|
|
@ -4419,6 +4419,7 @@ PRBool CSSParserImpl::ParseSingleValueProperty(nsresult& aErrorCode,
|
|||
return ParseVariant(aErrorCode, aValue, VARIANT_HOK,
|
||||
nsCSSProps::kBorderStyleKTable);
|
||||
case eCSSProperty__moz_outline_width:
|
||||
case eCSSProperty__moz_outline_offset:
|
||||
return ParseVariant(aErrorCode, aValue, VARIANT_HKL,
|
||||
nsCSSProps::kBorderWidthKTable);
|
||||
#endif
|
||||
|
|
|
@ -582,6 +582,7 @@ nsCSSMargin::nsCSSMargin(const nsCSSMargin& aCopy)
|
|||
mOutlineColor(aCopy.mOutlineColor),
|
||||
mOutlineStyle(aCopy.mOutlineStyle),
|
||||
mOutlineRadius(aCopy.mOutlineRadius),
|
||||
mOutlineOffset(aCopy.mOutlineOffset),
|
||||
mFloatEdge(aCopy.mFloatEdge)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsCSSMargin);
|
||||
|
@ -639,6 +640,7 @@ void nsCSSMargin::List(FILE* out, PRInt32 aIndent) const
|
|||
nsAutoString buffer;
|
||||
mOutlineWidth.AppendToString(buffer, eCSSProperty__moz_outline_width);
|
||||
mOutlineColor.AppendToString(buffer, eCSSProperty__moz_outline_color);
|
||||
mOutlineOffset.AppendToString(buffer, eCSSProperty__moz_outline_offset);
|
||||
mOutlineStyle.AppendToString(buffer, eCSSProperty__moz_outline_style);
|
||||
{
|
||||
static const nsCSSProperty trbl[] = {
|
||||
|
|
|
@ -321,6 +321,7 @@ struct nsCSSMargin : public nsCSSStruct {
|
|||
nsCSSValue mOutlineWidth;
|
||||
nsCSSValue mOutlineColor;
|
||||
nsCSSValue mOutlineStyle;
|
||||
nsCSSValue mOutlineOffset;
|
||||
nsCSSRect mOutlineRadius; // (extension)
|
||||
nsCSSValue mFloatEdge; // NEW
|
||||
};
|
||||
|
|
|
@ -1372,6 +1372,42 @@ nsComputedDOMStyle::GetOutlineStyle(nsIFrame *aFrame,
|
|||
return CallQueryInterface(val, aValue);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetOutlineOffset(nsIFrame *aFrame,
|
||||
nsIDOMCSSValue** aValue)
|
||||
{
|
||||
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
||||
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
const nsStyleOutline* outline = nsnull;
|
||||
GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame);
|
||||
|
||||
if (outline) {
|
||||
switch (outline->mOutlineOffset.GetUnit()) {
|
||||
case eStyleUnit_Coord:
|
||||
val->SetTwips(outline->mOutlineOffset.GetCoordValue());
|
||||
break;
|
||||
case eStyleUnit_Integer:
|
||||
case eStyleUnit_Proportional:
|
||||
case eStyleUnit_Enumerated:
|
||||
case eStyleUnit_Chars:
|
||||
{
|
||||
const nsAFlatCString& width=
|
||||
nsCSSProps::ValueToKeyword(outline->mOutlineOffset.GetIntValue(),
|
||||
nsCSSProps::kBorderWidthKTable);
|
||||
val->SetIdent(width);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
NS_WARNING("Double check the unit");
|
||||
val->SetTwips(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CallQueryInterface(val, aValue);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetOutlineRadiusBottomLeft(nsIFrame *aFrame,
|
||||
nsIDOMCSSValue** aValue)
|
||||
|
@ -3742,6 +3778,7 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength)
|
|||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_color, OutlineColor),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_style, OutlineStyle),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_width, OutlineWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_offset, OutlineOffset),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_radius_bottomLeft, OutlineRadiusBottomLeft),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_radius_bottomRight,OutlineRadiusBottomRight),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_radius_topLeft, OutlineRadiusTopLeft),
|
||||
|
|
|
@ -237,6 +237,7 @@ private:
|
|||
nsresult GetOutlineWidth(nsIFrame *aFrame, nsIDOMCSSValue** aValue);
|
||||
nsresult GetOutlineStyle(nsIFrame *aFrame, nsIDOMCSSValue** aValue);
|
||||
nsresult GetOutlineColor(nsIFrame *aFrame, nsIDOMCSSValue** aValue);
|
||||
nsresult GetOutlineOffset(nsIFrame *aFrame, nsIDOMCSSValue** aValue);
|
||||
nsresult GetOutlineRadiusBottomLeft(nsIFrame *aFrame, nsIDOMCSSValue** aValue);
|
||||
nsresult GetOutlineRadiusBottomRight(nsIFrame *aFrame, nsIDOMCSSValue** aValue);
|
||||
nsresult GetOutlineRadiusTopLeft(nsIFrame *aFrame, nsIDOMCSSValue** aValue);
|
||||
|
|
|
@ -401,6 +401,7 @@ CSS_PROP_SHORTHAND(-moz-outline, _moz_outline, MozOutline) // XXX This is tempo
|
|||
CSS_PROP_OUTLINE(-moz-outline-color, _moz_outline_color, MozOutlineColor, Margin, mOutlineColor, eCSSType_Value, PR_FALSE, kOutlineColorKTable) // XXX bug 48973
|
||||
CSS_PROP_OUTLINE(-moz-outline-style, _moz_outline_style, MozOutlineStyle, Margin, mOutlineStyle, eCSSType_Value, PR_FALSE, kBorderStyleKTable) // XXX bug 48973
|
||||
CSS_PROP_OUTLINE(-moz-outline-width, _moz_outline_width, MozOutlineWidth, Margin, mOutlineWidth, eCSSType_Value, PR_TRUE, kBorderWidthKTable) // XXX bug 48973
|
||||
CSS_PROP_OUTLINE(-moz-outline-offset, _moz_outline_offset, MozOutlineOffset, Margin, mOutlineOffset, eCSSType_Value, PR_TRUE, nsnull)
|
||||
CSS_PROP_SHORTHAND(overflow, overflow, Overflow)
|
||||
CSS_PROP_DISPLAY(overflow-x, overflow_x, OverflowX, Display, mOverflowX, eCSSType_Value, PR_FALSE, kOverflowSubKTable)
|
||||
CSS_PROP_DISPLAY(overflow-y, overflow_y, OverflowY, Display, mOverflowY, eCSSType_Value, PR_FALSE, kOverflowSubKTable)
|
||||
|
|
|
@ -523,6 +523,16 @@ struct nsStyleOutline: public nsStyleStruct {
|
|||
nsStyleSides mOutlineRadius; // [reset] length, percent, inherit
|
||||
// (top=topLeft, right=topRight, bottom=bottomRight, left=bottomLeft)
|
||||
|
||||
nsStyleCoord mOutlineOffset; // [reset] length
|
||||
PRBool GetOutlineOffset(nscoord& aOffset) const
|
||||
{
|
||||
if (mHasCachedOutline) {
|
||||
aOffset = mCachedOutlineOffset;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsStyleCoord mOutlineWidth; // [reset] length, enum (see nsStyleConsts.h)
|
||||
|
||||
PRBool GetOutlineWidth(nscoord& aWidth) const
|
||||
|
@ -574,6 +584,7 @@ struct nsStyleOutline: public nsStyleStruct {
|
|||
|
||||
protected:
|
||||
nscoord mCachedOutlineWidth;
|
||||
nscoord mCachedOutlineOffset;
|
||||
|
||||
nscolor mOutlineColor; // [reset]
|
||||
|
||||
|
|
|
@ -642,6 +642,7 @@ nsStyleOutline::nsStyleOutline(nsPresContext* aPresContext)
|
|||
|
||||
// spacing values not inherited
|
||||
mOutlineRadius.Reset();
|
||||
mOutlineOffset.Reset();
|
||||
|
||||
nsStyleCoord medium(NS_STYLE_BORDER_WIDTH_MEDIUM, eStyleUnit_Enumerated);
|
||||
mOutlineWidth = medium;
|
||||
|
@ -664,6 +665,7 @@ nsStyleOutline::RecalcData(void)
|
|||
mCachedOutlineWidth = 0;
|
||||
else
|
||||
mCachedOutlineWidth = CalcCoord(mOutlineWidth, mBorderWidths, 3);
|
||||
mCachedOutlineOffset = CalcCoord(mOutlineOffset, mBorderWidths, 3);
|
||||
mHasCachedOutline = PR_TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -676,8 +678,9 @@ nsChangeHint nsStyleOutline::CalcDifference(const nsStyleOutline& aOther) const
|
|||
mCachedOutlineWidth > 0 && mOutlineStyle != NS_STYLE_BORDER_STYLE_NONE;
|
||||
PRBool outlineIsVisible =
|
||||
aOther.mCachedOutlineWidth > 0 && aOther.mOutlineStyle != NS_STYLE_BORDER_STYLE_NONE;
|
||||
if (outlineWasVisible != outlineIsVisible ||
|
||||
mOutlineWidth != aOther.mOutlineWidth) {
|
||||
if (outlineWasVisible != outlineIsVisible ||
|
||||
(outlineIsVisible && (mOutlineOffset != aOther.mOutlineOffset ||
|
||||
mOutlineWidth != aOther.mOutlineWidth))) {
|
||||
return NS_CombineHint(nsChangeHint_ReflowFrame, nsChangeHint_RepaintFrame);
|
||||
}
|
||||
if ((mOutlineStyle != aOther.mOutlineStyle) ||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
#include "domstubs.idl"
|
||||
|
||||
[scriptable, uuid(a6cf90d1-15b3-11d2-932e-00805f8add32)]
|
||||
[scriptable, uuid(529b987a-cb21-4d58-99d7-9586e7662801)]
|
||||
interface nsIDOMCSS2Properties : nsISupports
|
||||
{
|
||||
attribute DOMString azimuth;
|
||||
|
@ -535,6 +535,9 @@ interface nsIDOMNSCSS2Properties : nsIDOMCSS2Properties
|
|||
attribute DOMString MozOutlineWidth;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
attribute DOMString MozOutlineOffset;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
attribute DOMString MozPaddingEnd;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
|
|
|
@ -2053,7 +2053,7 @@ nsStyleCoord bordStyleRadius[4];
|
|||
PRInt16 borderRadii[4],i;
|
||||
float percent;
|
||||
const nsStyleBackground* bgColor = nsCSSRendering::FindNonTransparentBackground(aStyleContext);
|
||||
nscoord width;
|
||||
nscoord width, offset;
|
||||
|
||||
// Get our style context's color struct.
|
||||
const nsStyleColor* ourColor = aStyleContext->GetStyleColor();
|
||||
|
@ -2065,7 +2065,7 @@ nscoord width;
|
|||
return;
|
||||
}
|
||||
|
||||
// get the radius for our border
|
||||
// get the radius for our outline
|
||||
aOutlineStyle.mOutlineRadius.GetTop(bordStyleRadius[0]); //topleft
|
||||
aOutlineStyle.mOutlineRadius.GetRight(bordStyleRadius[1]); //topright
|
||||
aOutlineStyle.mOutlineRadius.GetBottom(bordStyleRadius[2]); //bottomright
|
||||
|
@ -2092,14 +2092,30 @@ nscoord width;
|
|||
return;
|
||||
}
|
||||
|
||||
// get the offset for our outline
|
||||
aOutlineStyle.GetOutlineOffset(offset);
|
||||
nsRect outside(*overflowArea);
|
||||
nsRect inside(outside);
|
||||
inside.Deflate(width, width);
|
||||
if (width + offset >= 0) {
|
||||
// the overflow area is exactly the outside edge of the outline
|
||||
inside.Deflate(width, width);
|
||||
} else {
|
||||
// the overflow area is exactly the rectangle containing the frame and its
|
||||
// children; we can compute the outline directly
|
||||
inside.Deflate(-offset, -offset);
|
||||
if (inside.width < 0 || inside.height < 0) {
|
||||
return; // Protect against negative outline sizes
|
||||
}
|
||||
outside = inside;
|
||||
outside.Inflate(width, width);
|
||||
}
|
||||
|
||||
// rounded version of the border
|
||||
for(i=0;i<4;i++){
|
||||
if(borderRadii[i] > 0){
|
||||
PaintRoundedBorder(aPresContext,aRenderingContext,aForFrame,aDirtyRect,aBorderArea,nsnull,&aOutlineStyle,aStyleContext,aSkipSides,borderRadii,aGap,PR_TRUE);
|
||||
PaintRoundedBorder(aPresContext, aRenderingContext, aForFrame, aDirtyRect,
|
||||
outside, nsnull, &aOutlineStyle, aStyleContext,
|
||||
aSkipSides, borderRadii, aGap, PR_TRUE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2494,7 +2494,10 @@ static nsRect ComputeOutlineRect(const nsIFrame* aFrame, PRBool* aAnyOutline,
|
|||
outline->GetOutlineWidth(width);
|
||||
NS_ASSERTION(result, "GetOutlineWidth had no cached outline width");
|
||||
if (width > 0) {
|
||||
r.Inflate(width, width);
|
||||
nscoord offset;
|
||||
outline->GetOutlineOffset(offset);
|
||||
nscoord inflateBy = PR_MAX(width + offset, 0);
|
||||
r.Inflate(inflateBy, inflateBy);
|
||||
*aAnyOutline = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2494,7 +2494,10 @@ static nsRect ComputeOutlineRect(const nsIFrame* aFrame, PRBool* aAnyOutline,
|
|||
outline->GetOutlineWidth(width);
|
||||
NS_ASSERTION(result, "GetOutlineWidth had no cached outline width");
|
||||
if (width > 0) {
|
||||
r.Inflate(width, width);
|
||||
nscoord offset;
|
||||
outline->GetOutlineOffset(offset);
|
||||
nscoord inflateBy = PR_MAX(width + offset, 0);
|
||||
r.Inflate(inflateBy, inflateBy);
|
||||
*aAnyOutline = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2053,7 +2053,7 @@ nsStyleCoord bordStyleRadius[4];
|
|||
PRInt16 borderRadii[4],i;
|
||||
float percent;
|
||||
const nsStyleBackground* bgColor = nsCSSRendering::FindNonTransparentBackground(aStyleContext);
|
||||
nscoord width;
|
||||
nscoord width, offset;
|
||||
|
||||
// Get our style context's color struct.
|
||||
const nsStyleColor* ourColor = aStyleContext->GetStyleColor();
|
||||
|
@ -2065,7 +2065,7 @@ nscoord width;
|
|||
return;
|
||||
}
|
||||
|
||||
// get the radius for our border
|
||||
// get the radius for our outline
|
||||
aOutlineStyle.mOutlineRadius.GetTop(bordStyleRadius[0]); //topleft
|
||||
aOutlineStyle.mOutlineRadius.GetRight(bordStyleRadius[1]); //topright
|
||||
aOutlineStyle.mOutlineRadius.GetBottom(bordStyleRadius[2]); //bottomright
|
||||
|
@ -2092,14 +2092,30 @@ nscoord width;
|
|||
return;
|
||||
}
|
||||
|
||||
// get the offset for our outline
|
||||
aOutlineStyle.GetOutlineOffset(offset);
|
||||
nsRect outside(*overflowArea);
|
||||
nsRect inside(outside);
|
||||
inside.Deflate(width, width);
|
||||
if (width + offset >= 0) {
|
||||
// the overflow area is exactly the outside edge of the outline
|
||||
inside.Deflate(width, width);
|
||||
} else {
|
||||
// the overflow area is exactly the rectangle containing the frame and its
|
||||
// children; we can compute the outline directly
|
||||
inside.Deflate(-offset, -offset);
|
||||
if (inside.width < 0 || inside.height < 0) {
|
||||
return; // Protect against negative outline sizes
|
||||
}
|
||||
outside = inside;
|
||||
outside.Inflate(width, width);
|
||||
}
|
||||
|
||||
// rounded version of the border
|
||||
for(i=0;i<4;i++){
|
||||
if(borderRadii[i] > 0){
|
||||
PaintRoundedBorder(aPresContext,aRenderingContext,aForFrame,aDirtyRect,aBorderArea,nsnull,&aOutlineStyle,aStyleContext,aSkipSides,borderRadii,aGap,PR_TRUE);
|
||||
PaintRoundedBorder(aPresContext, aRenderingContext, aForFrame, aDirtyRect,
|
||||
outside, nsnull, &aOutlineStyle, aStyleContext,
|
||||
aSkipSides, borderRadii, aGap, PR_TRUE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4419,6 +4419,7 @@ PRBool CSSParserImpl::ParseSingleValueProperty(nsresult& aErrorCode,
|
|||
return ParseVariant(aErrorCode, aValue, VARIANT_HOK,
|
||||
nsCSSProps::kBorderStyleKTable);
|
||||
case eCSSProperty__moz_outline_width:
|
||||
case eCSSProperty__moz_outline_offset:
|
||||
return ParseVariant(aErrorCode, aValue, VARIANT_HKL,
|
||||
nsCSSProps::kBorderWidthKTable);
|
||||
#endif
|
||||
|
|
|
@ -401,6 +401,7 @@ CSS_PROP_SHORTHAND(-moz-outline, _moz_outline, MozOutline) // XXX This is tempo
|
|||
CSS_PROP_OUTLINE(-moz-outline-color, _moz_outline_color, MozOutlineColor, Margin, mOutlineColor, eCSSType_Value, PR_FALSE, kOutlineColorKTable) // XXX bug 48973
|
||||
CSS_PROP_OUTLINE(-moz-outline-style, _moz_outline_style, MozOutlineStyle, Margin, mOutlineStyle, eCSSType_Value, PR_FALSE, kBorderStyleKTable) // XXX bug 48973
|
||||
CSS_PROP_OUTLINE(-moz-outline-width, _moz_outline_width, MozOutlineWidth, Margin, mOutlineWidth, eCSSType_Value, PR_TRUE, kBorderWidthKTable) // XXX bug 48973
|
||||
CSS_PROP_OUTLINE(-moz-outline-offset, _moz_outline_offset, MozOutlineOffset, Margin, mOutlineOffset, eCSSType_Value, PR_TRUE, nsnull)
|
||||
CSS_PROP_SHORTHAND(overflow, overflow, Overflow)
|
||||
CSS_PROP_DISPLAY(overflow-x, overflow_x, OverflowX, Display, mOverflowX, eCSSType_Value, PR_FALSE, kOverflowSubKTable)
|
||||
CSS_PROP_DISPLAY(overflow-y, overflow_y, OverflowY, Display, mOverflowY, eCSSType_Value, PR_FALSE, kOverflowSubKTable)
|
||||
|
|
|
@ -582,6 +582,7 @@ nsCSSMargin::nsCSSMargin(const nsCSSMargin& aCopy)
|
|||
mOutlineColor(aCopy.mOutlineColor),
|
||||
mOutlineStyle(aCopy.mOutlineStyle),
|
||||
mOutlineRadius(aCopy.mOutlineRadius),
|
||||
mOutlineOffset(aCopy.mOutlineOffset),
|
||||
mFloatEdge(aCopy.mFloatEdge)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsCSSMargin);
|
||||
|
@ -639,6 +640,7 @@ void nsCSSMargin::List(FILE* out, PRInt32 aIndent) const
|
|||
nsAutoString buffer;
|
||||
mOutlineWidth.AppendToString(buffer, eCSSProperty__moz_outline_width);
|
||||
mOutlineColor.AppendToString(buffer, eCSSProperty__moz_outline_color);
|
||||
mOutlineOffset.AppendToString(buffer, eCSSProperty__moz_outline_offset);
|
||||
mOutlineStyle.AppendToString(buffer, eCSSProperty__moz_outline_style);
|
||||
{
|
||||
static const nsCSSProperty trbl[] = {
|
||||
|
|
|
@ -321,6 +321,7 @@ struct nsCSSMargin : public nsCSSStruct {
|
|||
nsCSSValue mOutlineWidth;
|
||||
nsCSSValue mOutlineColor;
|
||||
nsCSSValue mOutlineStyle;
|
||||
nsCSSValue mOutlineOffset;
|
||||
nsCSSRect mOutlineRadius; // (extension)
|
||||
nsCSSValue mFloatEdge; // NEW
|
||||
};
|
||||
|
|
|
@ -1372,6 +1372,42 @@ nsComputedDOMStyle::GetOutlineStyle(nsIFrame *aFrame,
|
|||
return CallQueryInterface(val, aValue);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetOutlineOffset(nsIFrame *aFrame,
|
||||
nsIDOMCSSValue** aValue)
|
||||
{
|
||||
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
||||
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
const nsStyleOutline* outline = nsnull;
|
||||
GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame);
|
||||
|
||||
if (outline) {
|
||||
switch (outline->mOutlineOffset.GetUnit()) {
|
||||
case eStyleUnit_Coord:
|
||||
val->SetTwips(outline->mOutlineOffset.GetCoordValue());
|
||||
break;
|
||||
case eStyleUnit_Integer:
|
||||
case eStyleUnit_Proportional:
|
||||
case eStyleUnit_Enumerated:
|
||||
case eStyleUnit_Chars:
|
||||
{
|
||||
const nsAFlatCString& width=
|
||||
nsCSSProps::ValueToKeyword(outline->mOutlineOffset.GetIntValue(),
|
||||
nsCSSProps::kBorderWidthKTable);
|
||||
val->SetIdent(width);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
NS_WARNING("Double check the unit");
|
||||
val->SetTwips(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CallQueryInterface(val, aValue);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsComputedDOMStyle::GetOutlineRadiusBottomLeft(nsIFrame *aFrame,
|
||||
nsIDOMCSSValue** aValue)
|
||||
|
@ -3742,6 +3778,7 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength)
|
|||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_color, OutlineColor),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_style, OutlineStyle),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_width, OutlineWidth),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_offset, OutlineOffset),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_radius_bottomLeft, OutlineRadiusBottomLeft),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_radius_bottomRight,OutlineRadiusBottomRight),
|
||||
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_radius_topLeft, OutlineRadiusTopLeft),
|
||||
|
|
|
@ -237,6 +237,7 @@ private:
|
|||
nsresult GetOutlineWidth(nsIFrame *aFrame, nsIDOMCSSValue** aValue);
|
||||
nsresult GetOutlineStyle(nsIFrame *aFrame, nsIDOMCSSValue** aValue);
|
||||
nsresult GetOutlineColor(nsIFrame *aFrame, nsIDOMCSSValue** aValue);
|
||||
nsresult GetOutlineOffset(nsIFrame *aFrame, nsIDOMCSSValue** aValue);
|
||||
nsresult GetOutlineRadiusBottomLeft(nsIFrame *aFrame, nsIDOMCSSValue** aValue);
|
||||
nsresult GetOutlineRadiusBottomRight(nsIFrame *aFrame, nsIDOMCSSValue** aValue);
|
||||
nsresult GetOutlineRadiusTopLeft(nsIFrame *aFrame, nsIDOMCSSValue** aValue);
|
||||
|
|
|
@ -3451,7 +3451,12 @@ nsRuleNode::ComputeOutlineData(nsStyleStruct* aStartStruct,
|
|||
// outline-width: length, enum, inherit
|
||||
SetCoord(marginData.mOutlineWidth, outline->mOutlineWidth, parentOutline->mOutlineWidth,
|
||||
SETCOORD_LEH, aContext, mPresContext, inherited);
|
||||
|
||||
// outline-offset: length, enum, inherit
|
||||
SetCoord(marginData.mOutlineOffset, outline->mOutlineOffset, parentOutline->mOutlineOffset,
|
||||
SETCOORD_LEH, aContext, mPresContext, inherited);
|
||||
|
||||
|
||||
// outline-color: color, string, enum, inherit
|
||||
nscolor outlineColor;
|
||||
nscolor unused = NS_RGB(0,0,0);
|
||||
|
|
|
@ -642,6 +642,7 @@ nsStyleOutline::nsStyleOutline(nsPresContext* aPresContext)
|
|||
|
||||
// spacing values not inherited
|
||||
mOutlineRadius.Reset();
|
||||
mOutlineOffset.Reset();
|
||||
|
||||
nsStyleCoord medium(NS_STYLE_BORDER_WIDTH_MEDIUM, eStyleUnit_Enumerated);
|
||||
mOutlineWidth = medium;
|
||||
|
@ -664,6 +665,7 @@ nsStyleOutline::RecalcData(void)
|
|||
mCachedOutlineWidth = 0;
|
||||
else
|
||||
mCachedOutlineWidth = CalcCoord(mOutlineWidth, mBorderWidths, 3);
|
||||
mCachedOutlineOffset = CalcCoord(mOutlineOffset, mBorderWidths, 3);
|
||||
mHasCachedOutline = PR_TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -676,8 +678,9 @@ nsChangeHint nsStyleOutline::CalcDifference(const nsStyleOutline& aOther) const
|
|||
mCachedOutlineWidth > 0 && mOutlineStyle != NS_STYLE_BORDER_STYLE_NONE;
|
||||
PRBool outlineIsVisible =
|
||||
aOther.mCachedOutlineWidth > 0 && aOther.mOutlineStyle != NS_STYLE_BORDER_STYLE_NONE;
|
||||
if (outlineWasVisible != outlineIsVisible ||
|
||||
mOutlineWidth != aOther.mOutlineWidth) {
|
||||
if (outlineWasVisible != outlineIsVisible ||
|
||||
(outlineIsVisible && (mOutlineOffset != aOther.mOutlineOffset ||
|
||||
mOutlineWidth != aOther.mOutlineWidth))) {
|
||||
return NS_CombineHint(nsChangeHint_ReflowFrame, nsChangeHint_RepaintFrame);
|
||||
}
|
||||
if ((mOutlineStyle != aOther.mOutlineStyle) ||
|
||||
|
|
|
@ -523,6 +523,16 @@ struct nsStyleOutline: public nsStyleStruct {
|
|||
nsStyleSides mOutlineRadius; // [reset] length, percent, inherit
|
||||
// (top=topLeft, right=topRight, bottom=bottomRight, left=bottomLeft)
|
||||
|
||||
nsStyleCoord mOutlineOffset; // [reset] length
|
||||
PRBool GetOutlineOffset(nscoord& aOffset) const
|
||||
{
|
||||
if (mHasCachedOutline) {
|
||||
aOffset = mCachedOutlineOffset;
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsStyleCoord mOutlineWidth; // [reset] length, enum (see nsStyleConsts.h)
|
||||
|
||||
PRBool GetOutlineWidth(nscoord& aWidth) const
|
||||
|
@ -574,6 +584,7 @@ struct nsStyleOutline: public nsStyleStruct {
|
|||
|
||||
protected:
|
||||
nscoord mCachedOutlineWidth;
|
||||
nscoord mCachedOutlineOffset;
|
||||
|
||||
nscolor mOutlineColor; // [reset]
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче