mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 23:05:42 +00:00
Backed out changeset 14c8ec387dd2 (bug 1277154) because it seems like a good candidate for what broke reftests
--HG-- extra : rebase_source : 97d3f6df5465d848f3c5785eca7a01de8867e185
This commit is contained in:
parent
baead5135e
commit
11d59fe446
@ -79,7 +79,7 @@ GetStrokeDashData(SVGContentUtils::AutoStrokeOptions* aStrokeOptions,
|
||||
Float totalLengthOfDashes = 0.0, totalLengthOfGaps = 0.0;
|
||||
Float pathScale = 1.0;
|
||||
|
||||
if (aContextPaint && aStyleSVG->StrokeDasharrayFromObject()) {
|
||||
if (aContextPaint && aStyleSVG->mStrokeDasharrayFromObject) {
|
||||
const FallibleTArray<gfxFloat>& dashSrc = aContextPaint->GetStrokeDashArray();
|
||||
dashArrayLength = dashSrc.Length();
|
||||
if (dashArrayLength <= 0) {
|
||||
@ -155,7 +155,7 @@ GetStrokeDashData(SVGContentUtils::AutoStrokeOptions* aStrokeOptions,
|
||||
return eNoStroke;
|
||||
}
|
||||
|
||||
if (aContextPaint && aStyleSVG->StrokeDashoffsetFromObject()) {
|
||||
if (aContextPaint && aStyleSVG->mStrokeDashoffsetFromObject) {
|
||||
aStrokeOptions->mDashOffset = Float(aContextPaint->GetStrokeDashOffset());
|
||||
} else {
|
||||
aStrokeOptions->mDashOffset =
|
||||
@ -262,7 +262,7 @@ SVGContentUtils::GetStrokeWidth(nsSVGElement* aElement,
|
||||
|
||||
const nsStyleSVG* styleSVG = styleContext->StyleSVG();
|
||||
|
||||
if (aContextPaint && styleSVG->StrokeWidthFromObject()) {
|
||||
if (aContextPaint && styleSVG->mStrokeWidthFromObject) {
|
||||
return aContextPaint->GetStrokeWidth();
|
||||
}
|
||||
|
||||
|
@ -9314,11 +9314,11 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
|
||||
|
||||
// fill-opacity: factor, inherit, initial,
|
||||
// context-fill-opacity, context-stroke-opacity
|
||||
nsStyleSVGOpacitySource contextFillOpacity = svg->FillOpacitySource();
|
||||
nsStyleSVGOpacitySource contextFillOpacity = svg->mFillOpacitySource;
|
||||
SetSVGOpacity(*aRuleData->ValueForFillOpacity(),
|
||||
svg->mFillOpacity, contextFillOpacity, conditions,
|
||||
parentSVG->mFillOpacity, parentSVG->FillOpacitySource());
|
||||
svg->SetFillOpacitySource(contextFillOpacity);
|
||||
parentSVG->mFillOpacity, parentSVG->mFillOpacitySource);
|
||||
svg->mFillOpacitySource = contextFillOpacity;
|
||||
|
||||
// fill-rule: enum, inherit, initial
|
||||
SetValue(*aRuleData->ValueForFillRule(),
|
||||
@ -9414,7 +9414,7 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
|
||||
case eCSSUnit_Inherit:
|
||||
case eCSSUnit_Unset:
|
||||
conditions.SetUncacheable();
|
||||
svg->SetStrokeDashoffsetFromObject(parentSVG->StrokeDashoffsetFromObject());
|
||||
svg->mStrokeDasharrayFromObject = parentSVG->mStrokeDasharrayFromObject;
|
||||
svg->mStrokeDasharray = parentSVG->mStrokeDasharray;
|
||||
break;
|
||||
|
||||
@ -9422,19 +9422,19 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
|
||||
MOZ_ASSERT(strokeDasharrayValue->GetIntValue() ==
|
||||
NS_STYLE_STROKE_PROP_CONTEXT_VALUE,
|
||||
"Unknown keyword for stroke-dasharray");
|
||||
svg->SetStrokeDashoffsetFromObject(true);
|
||||
svg->mStrokeDasharrayFromObject = true;
|
||||
svg->mStrokeDasharray.Clear();
|
||||
break;
|
||||
|
||||
case eCSSUnit_Initial:
|
||||
case eCSSUnit_None:
|
||||
svg->SetStrokeDashoffsetFromObject(false);
|
||||
svg->mStrokeDasharrayFromObject = false;
|
||||
svg->mStrokeDasharray.Clear();
|
||||
break;
|
||||
|
||||
case eCSSUnit_List:
|
||||
case eCSSUnit_ListDep: {
|
||||
svg->SetStrokeDashoffsetFromObject(false);
|
||||
svg->mStrokeDasharrayFromObject = false;
|
||||
svg->mStrokeDasharray.Clear();
|
||||
|
||||
// count number of values
|
||||
@ -9463,10 +9463,10 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
|
||||
// stroke-dashoffset: <dashoffset>, inherit
|
||||
const nsCSSValue *strokeDashoffsetValue =
|
||||
aRuleData->ValueForStrokeDashoffset();
|
||||
svg->SetStrokeDashoffsetFromObject(
|
||||
svg->mStrokeDashoffsetFromObject =
|
||||
strokeDashoffsetValue->GetUnit() == eCSSUnit_Enumerated &&
|
||||
strokeDashoffsetValue->GetIntValue() == NS_STYLE_STROKE_PROP_CONTEXT_VALUE);
|
||||
if (svg->StrokeDashoffsetFromObject()) {
|
||||
strokeDashoffsetValue->GetIntValue() == NS_STYLE_STROKE_PROP_CONTEXT_VALUE;
|
||||
if (svg->mStrokeDashoffsetFromObject) {
|
||||
svg->mStrokeDashoffset.SetCoordValue(0);
|
||||
} else {
|
||||
SetCoord(*aRuleData->ValueForStrokeDashoffset(),
|
||||
@ -9498,11 +9498,11 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
|
||||
SETFCT_UNSET_INHERIT);
|
||||
|
||||
// stroke-opacity:
|
||||
nsStyleSVGOpacitySource contextStrokeOpacity = svg->StrokeOpacitySource();
|
||||
nsStyleSVGOpacitySource contextStrokeOpacity = svg->mStrokeOpacitySource;
|
||||
SetSVGOpacity(*aRuleData->ValueForStrokeOpacity(),
|
||||
svg->mStrokeOpacity, contextStrokeOpacity, conditions,
|
||||
parentSVG->mStrokeOpacity, parentSVG->StrokeOpacitySource());
|
||||
svg->SetStrokeOpacitySource(contextStrokeOpacity);
|
||||
parentSVG->mStrokeOpacity, parentSVG->mStrokeOpacitySource);
|
||||
svg->mStrokeOpacitySource = contextStrokeOpacity;
|
||||
|
||||
// stroke-width:
|
||||
const nsCSSValue* strokeWidthValue = aRuleData->ValueForStrokeWidth();
|
||||
@ -9511,17 +9511,17 @@ nsRuleNode::ComputeSVGData(void* aStartStruct,
|
||||
MOZ_ASSERT(strokeWidthValue->GetIntValue() ==
|
||||
NS_STYLE_STROKE_PROP_CONTEXT_VALUE,
|
||||
"Unrecognized keyword for stroke-width");
|
||||
svg->SetStrokeWidthFromObject(true);
|
||||
svg->mStrokeWidthFromObject = true;
|
||||
svg->mStrokeWidth.SetCoordValue(nsPresContext::CSSPixelsToAppUnits(1));
|
||||
break;
|
||||
|
||||
case eCSSUnit_Initial:
|
||||
svg->SetStrokeWidthFromObject(false);
|
||||
svg->mStrokeWidthFromObject = false;
|
||||
svg->mStrokeWidth.SetCoordValue(nsPresContext::CSSPixelsToAppUnits(1));
|
||||
break;
|
||||
|
||||
default:
|
||||
svg->SetStrokeWidthFromObject(false);
|
||||
svg->mStrokeWidthFromObject = false;
|
||||
SetCoord(*strokeWidthValue,
|
||||
svg->mStrokeWidth, parentSVG->mStrokeWidth,
|
||||
SETCOORD_LPH | SETCOORD_FACTOR | SETCOORD_UNSET_INHERIT,
|
||||
|
@ -834,8 +834,11 @@ nsStyleSVG::nsStyleSVG(StyleStructContext aContext)
|
||||
, mStrokeLinecap(NS_STYLE_STROKE_LINECAP_BUTT)
|
||||
, mStrokeLinejoin(NS_STYLE_STROKE_LINEJOIN_MITER)
|
||||
, mTextAnchor(NS_STYLE_TEXT_ANCHOR_START)
|
||||
, mContextFlags((eStyleSVGOpacitySource_Normal << FILL_OPACITY_SOURCE_SHIFT) |
|
||||
(eStyleSVGOpacitySource_Normal << STROKE_OPACITY_SOURCE_SHIFT))
|
||||
, mFillOpacitySource(eStyleSVGOpacitySource_Normal)
|
||||
, mStrokeOpacitySource(eStyleSVGOpacitySource_Normal)
|
||||
, mStrokeDasharrayFromObject(false)
|
||||
, mStrokeDashoffsetFromObject(false)
|
||||
, mStrokeWidthFromObject(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsStyleSVG);
|
||||
}
|
||||
@ -866,7 +869,11 @@ nsStyleSVG::nsStyleSVG(const nsStyleSVG& aSource)
|
||||
, mStrokeLinecap(aSource.mStrokeLinecap)
|
||||
, mStrokeLinejoin(aSource.mStrokeLinejoin)
|
||||
, mTextAnchor(aSource.mTextAnchor)
|
||||
, mContextFlags(aSource.mContextFlags)
|
||||
, mFillOpacitySource(aSource.mFillOpacitySource)
|
||||
, mStrokeOpacitySource(aSource.mStrokeOpacitySource)
|
||||
, mStrokeDasharrayFromObject(aSource.mStrokeDasharrayFromObject)
|
||||
, mStrokeDashoffsetFromObject(aSource.mStrokeDashoffsetFromObject)
|
||||
, mStrokeWidthFromObject(aSource.mStrokeWidthFromObject)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsStyleSVG);
|
||||
}
|
||||
@ -948,7 +955,11 @@ nsChangeHint nsStyleSVG::CalcDifference(const nsStyleSVG& aOther) const
|
||||
mPaintOrder != aOther.mPaintOrder ||
|
||||
mShapeRendering != aOther.mShapeRendering ||
|
||||
mStrokeDasharray != aOther.mStrokeDasharray ||
|
||||
mContextFlags != aOther.mContextFlags) {
|
||||
mFillOpacitySource != aOther.mFillOpacitySource ||
|
||||
mStrokeOpacitySource != aOther.mStrokeOpacitySource ||
|
||||
mStrokeDasharrayFromObject != aOther.mStrokeDasharrayFromObject ||
|
||||
mStrokeDashoffsetFromObject != aOther.mStrokeDashoffsetFromObject ||
|
||||
mStrokeWidthFromObject != aOther.mStrokeWidthFromObject) {
|
||||
return hint | nsChangeHint_RepaintFrame;
|
||||
}
|
||||
|
||||
|
@ -3194,7 +3194,7 @@ enum nsStyleSVGPaintType {
|
||||
eStyleSVGPaintType_ContextStroke
|
||||
};
|
||||
|
||||
enum nsStyleSVGOpacitySource : uint8_t {
|
||||
enum nsStyleSVGOpacitySource {
|
||||
eStyleSVGOpacitySource_Normal,
|
||||
eStyleSVGOpacitySource_ContextFillOpacity,
|
||||
eStyleSVGOpacitySource_ContextStrokeOpacity
|
||||
@ -3277,46 +3277,16 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVG
|
||||
uint8_t mStrokeLinejoin; // [inherited] see nsStyleConsts.h
|
||||
uint8_t mTextAnchor; // [inherited] see nsStyleConsts.h
|
||||
|
||||
nsStyleSVGOpacitySource FillOpacitySource() const {
|
||||
uint8_t value = (mContextFlags & FILL_OPACITY_SOURCE_MASK) >>
|
||||
FILL_OPACITY_SOURCE_SHIFT;
|
||||
return nsStyleSVGOpacitySource(value);
|
||||
}
|
||||
nsStyleSVGOpacitySource StrokeOpacitySource() const {
|
||||
uint8_t value = (mContextFlags & STROKE_OPACITY_SOURCE_MASK) >>
|
||||
STROKE_OPACITY_SOURCE_SHIFT;
|
||||
return nsStyleSVGOpacitySource(value);
|
||||
}
|
||||
bool StrokeDasharrayFromObject() const {
|
||||
return mContextFlags & STROKE_DASHARRAY_CONTEXT;
|
||||
}
|
||||
bool StrokeDashoffsetFromObject() const {
|
||||
return mContextFlags & STROKE_DASHOFFSET_CONTEXT;
|
||||
}
|
||||
bool StrokeWidthFromObject() const {
|
||||
return mContextFlags & STROKE_WIDTH_CONTEXT;
|
||||
}
|
||||
// In SVG glyphs, whether we inherit fill or stroke opacity from the outer
|
||||
// text object.
|
||||
// Use 3 bits to avoid signedness problems in MSVC.
|
||||
nsStyleSVGOpacitySource mFillOpacitySource : 3;
|
||||
nsStyleSVGOpacitySource mStrokeOpacitySource : 3;
|
||||
|
||||
void SetFillOpacitySource(nsStyleSVGOpacitySource aValue) {
|
||||
mContextFlags = (mContextFlags & ~FILL_OPACITY_SOURCE_MASK) |
|
||||
(aValue << FILL_OPACITY_SOURCE_SHIFT);
|
||||
}
|
||||
void SetStrokeOpacitySource(nsStyleSVGOpacitySource aValue) {
|
||||
mContextFlags = (mContextFlags & ~STROKE_OPACITY_SOURCE_MASK) |
|
||||
(aValue << STROKE_OPACITY_SOURCE_SHIFT);
|
||||
}
|
||||
void SetStrokeDasharrayFromObject(bool aValue) {
|
||||
mContextFlags = (mContextFlags & ~STROKE_DASHARRAY_CONTEXT) |
|
||||
(aValue ? STROKE_DASHARRAY_CONTEXT : 0);
|
||||
}
|
||||
void SetStrokeDashoffsetFromObject(bool aValue) {
|
||||
mContextFlags = (mContextFlags & ~STROKE_DASHOFFSET_CONTEXT) |
|
||||
(aValue ? STROKE_DASHOFFSET_CONTEXT : 0);
|
||||
}
|
||||
void SetStrokeWidthFromObject(bool aValue) {
|
||||
mContextFlags = (mContextFlags & ~STROKE_WIDTH_CONTEXT) |
|
||||
(aValue ? STROKE_WIDTH_CONTEXT : 0);
|
||||
}
|
||||
// SVG glyph outer object inheritance for other properties
|
||||
bool mStrokeDasharrayFromObject : 1;
|
||||
bool mStrokeDashoffsetFromObject : 1;
|
||||
bool mStrokeWidthFromObject : 1;
|
||||
|
||||
bool HasMarker() const {
|
||||
return mMarkerStart || mMarkerMid || mMarkerEnd;
|
||||
@ -3337,22 +3307,6 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVG
|
||||
bool HasFill() const {
|
||||
return mFill.mType != eStyleSVGPaintType_None && mFillOpacity > 0;
|
||||
}
|
||||
|
||||
private:
|
||||
// Flags to represent the use of context-fill and context-stroke
|
||||
// for fill-opacity or stroke-opacity, and context-value for stroke-dasharray,
|
||||
// stroke-dashoffset and stroke-width.
|
||||
enum {
|
||||
FILL_OPACITY_SOURCE_MASK = 0x03, // fill-opacity: context-{fill,stroke}
|
||||
STROKE_OPACITY_SOURCE_MASK = 0x0C, // stroke-opacity: context-{fill,stroke}
|
||||
STROKE_DASHARRAY_CONTEXT = 0x10, // stroke-dasharray: context-value
|
||||
STROKE_DASHOFFSET_CONTEXT = 0x20, // stroke-dashoffset: context-value
|
||||
STROKE_WIDTH_CONTEXT = 0x40, // stroke-width: context-value
|
||||
FILL_OPACITY_SOURCE_SHIFT = 0,
|
||||
STROKE_OPACITY_SOURCE_SHIFT = 2,
|
||||
};
|
||||
|
||||
uint8_t mContextFlags; // [inherited]
|
||||
};
|
||||
|
||||
class nsStyleBasicShape final
|
||||
|
@ -1370,7 +1370,7 @@ nsSVGUtils::SetupContextPaint(const DrawTarget* aDrawTarget,
|
||||
if (style->mFill.mType == eStyleSVGPaintType_None) {
|
||||
aThisContextPaint->SetFillOpacity(0.0f);
|
||||
} else {
|
||||
float opacity = nsSVGUtils::GetOpacity(style->FillOpacitySource(),
|
||||
float opacity = nsSVGUtils::GetOpacity(style->mFillOpacitySource,
|
||||
style->mFillOpacity,
|
||||
aOuterContextPaint);
|
||||
|
||||
@ -1388,7 +1388,7 @@ nsSVGUtils::SetupContextPaint(const DrawTarget* aDrawTarget,
|
||||
if (style->mStroke.mType == eStyleSVGPaintType_None) {
|
||||
aThisContextPaint->SetStrokeOpacity(0.0f);
|
||||
} else {
|
||||
float opacity = nsSVGUtils::GetOpacity(style->StrokeOpacitySource(),
|
||||
float opacity = nsSVGUtils::GetOpacity(style->mStrokeOpacitySource,
|
||||
style->mStrokeOpacity,
|
||||
aOuterContextPaint);
|
||||
|
||||
@ -1427,7 +1427,7 @@ nsSVGUtils::MakeFillPatternFor(nsIFrame* aFrame,
|
||||
}
|
||||
|
||||
float opacity = MaybeOptimizeOpacity(aFrame,
|
||||
GetOpacity(style->FillOpacitySource(),
|
||||
GetOpacity(style->mFillOpacitySource,
|
||||
style->mFillOpacity,
|
||||
aContextPaint));
|
||||
const DrawTarget* dt = aContext->GetDrawTarget();
|
||||
@ -1487,7 +1487,7 @@ nsSVGUtils::MakeStrokePatternFor(nsIFrame* aFrame,
|
||||
}
|
||||
|
||||
float opacity = MaybeOptimizeOpacity(aFrame,
|
||||
GetOpacity(style->StrokeOpacitySource(),
|
||||
GetOpacity(style->mStrokeOpacitySource,
|
||||
style->mStrokeOpacity,
|
||||
aContextPaint));
|
||||
|
||||
@ -1577,7 +1577,7 @@ float
|
||||
nsSVGUtils::GetStrokeWidth(nsIFrame* aFrame, gfxTextContextPaint *aContextPaint)
|
||||
{
|
||||
const nsStyleSVG *style = aFrame->StyleSVG();
|
||||
if (aContextPaint && style->StrokeWidthFromObject()) {
|
||||
if (aContextPaint && style->mStrokeWidthFromObject) {
|
||||
return aContextPaint->GetStrokeWidth();
|
||||
}
|
||||
|
||||
@ -1604,7 +1604,7 @@ GetStrokeDashData(nsIFrame* aFrame,
|
||||
content->GetParent() : content);
|
||||
|
||||
gfxFloat totalLength = 0.0;
|
||||
if (aContextPaint && style->StrokeDasharrayFromObject()) {
|
||||
if (aContextPaint && style->mStrokeDasharrayFromObject) {
|
||||
aDashes = aContextPaint->GetStrokeDashArray();
|
||||
|
||||
for (uint32_t i = 0; i < aDashes.Length(); i++) {
|
||||
@ -1642,7 +1642,7 @@ GetStrokeDashData(nsIFrame* aFrame,
|
||||
}
|
||||
}
|
||||
|
||||
if (aContextPaint && style->StrokeDashoffsetFromObject()) {
|
||||
if (aContextPaint && style->mStrokeDashoffsetFromObject) {
|
||||
*aDashOffset = aContextPaint->GetStrokeDashOffset();
|
||||
} else {
|
||||
*aDashOffset = SVGContentUtils::CoordToFloat(ctx,
|
||||
|
Loading…
Reference in New Issue
Block a user