Bug 1298774 - Part 5: Make nsStyleSVGPaint use css::URLValue for url() storage instead of FragmentOrURL. r=cjku

MozReview-Commit-ID: CkNcSxVToTL

--HG--
extra : rebase_source : 956149a0d12e7633aca15eb460704926a7db7371
This commit is contained in:
Cameron McCormack 2016-10-11 14:56:11 +08:00
Родитель f1dcd6fc45
Коммит a9271aac63
12 изменённых файлов: 254 добавлений и 159 удалений

Просмотреть файл

@ -3735,7 +3735,7 @@ nsTextPaintStyle::GetTextColor()
return NS_SAME_AS_FOREGROUND_COLOR;
const nsStyleSVG* style = mFrame->StyleSVG();
switch (style->mFill.mType) {
switch (style->mFill.Type()) {
case eStyleSVGPaintType_None:
return NS_RGBA(0, 0, 0, 0);
case eStyleSVGPaintType_Color:
@ -6477,8 +6477,8 @@ nsTextFrame::GetCaretColorAt(int32_t aOffset)
bool isSolidTextColor = true;
if (IsSVGText()) {
const nsStyleSVG* style = StyleSVG();
if (style->mFill.mType != eStyleSVGPaintType_None &&
style->mFill.mType != eStyleSVGPaintType_Color) {
if (style->mFill.Type() != eStyleSVGPaintType_None &&
style->mFill.Type() != eStyleSVGPaintType_Color) {
isSolidTextColor = false;
}
}

Просмотреть файл

@ -4312,42 +4312,40 @@ StyleAnimationValue::ExtractComputedValue(nsCSSPropertyID aProperty,
case eStyleAnimType_PaintServer: {
const nsStyleSVGPaint& paint =
StyleDataAtOffset<nsStyleSVGPaint>(styleStruct, ssOffset);
if (paint.mType == eStyleSVGPaintType_Color) {
aComputedValue.SetColorValue(paint.mPaint.mColor);
return true;
}
if (paint.mType == eStyleSVGPaintType_Server) {
if (!paint.mPaint.mPaintServer) {
NS_WARNING("Null paint server");
return false;
switch (paint.Type()) {
case eStyleSVGPaintType_Color:
aComputedValue.SetColorValue(paint.GetColor());
return true;
case eStyleSVGPaintType_Server: {
css::URLValue* url = paint.GetPaintServer();
if (!url) {
NS_WARNING("Null paint server");
return false;
}
nsAutoPtr<nsCSSValuePair> pair(new nsCSSValuePair);
pair->mXValue.SetURLValue(url);
pair->mYValue.SetColorValue(paint.GetFallbackColor());
aComputedValue.SetAndAdoptCSSValuePairValue(pair.forget(),
eUnit_CSSValuePair);
return true;
}
nsAutoPtr<nsCSSValuePair> pair(new nsCSSValuePair);
nsIDocument* doc = aStyleContext->PresContext()->Document();
RefPtr<mozilla::css::URLValue> url =
FragmentOrURLToURLValue(paint.mPaint.mPaintServer, doc);
pair->mXValue.SetURLValue(url);
pair->mYValue.SetColorValue(paint.mFallbackColor);
aComputedValue.SetAndAdoptCSSValuePairValue(pair.forget(),
eUnit_CSSValuePair);
return true;
case eStyleSVGPaintType_ContextFill:
case eStyleSVGPaintType_ContextStroke: {
nsAutoPtr<nsCSSValuePair> pair(new nsCSSValuePair);
pair->mXValue.SetIntValue(paint.Type() == eStyleSVGPaintType_ContextFill ?
NS_COLOR_CONTEXT_FILL : NS_COLOR_CONTEXT_STROKE,
eCSSUnit_Enumerated);
pair->mYValue.SetColorValue(paint.GetFallbackColor());
aComputedValue.SetAndAdoptCSSValuePairValue(pair.forget(),
eUnit_CSSValuePair);
return true;
}
default:
MOZ_ASSERT(paint.Type() == eStyleSVGPaintType_None,
"Unexpected SVG paint type");
aComputedValue.SetNoneValue();
return true;
}
if (paint.mType == eStyleSVGPaintType_ContextFill ||
paint.mType == eStyleSVGPaintType_ContextStroke) {
nsAutoPtr<nsCSSValuePair> pair(new nsCSSValuePair);
pair->mXValue.SetIntValue(paint.mType == eStyleSVGPaintType_ContextFill ?
NS_COLOR_CONTEXT_FILL : NS_COLOR_CONTEXT_STROKE,
eCSSUnit_Enumerated);
pair->mYValue.SetColorValue(paint.mFallbackColor);
aComputedValue.SetAndAdoptCSSValuePairValue(pair.forget(),
eUnit_CSSValuePair);
return true;
}
MOZ_ASSERT(paint.mType == eStyleSVGPaintType_None,
"Unexpected SVG paint type");
aComputedValue.SetNoneValue();
return true;
}
case eStyleAnimType_Shadow: {
const nsCSSShadowArray* shadowArray =

Просмотреть файл

@ -5584,38 +5584,31 @@ nsComputedDOMStyle::GetSVGPaintFor(bool aFill)
nsAutoString paintString;
switch (paint->mType) {
switch (paint->Type()) {
case eStyleSVGPaintType_None:
{
val->SetIdent(eCSSKeyword_none);
break;
}
case eStyleSVGPaintType_Color:
{
SetToRGBAColor(val, paint->mPaint.mColor);
SetToRGBAColor(val, paint->GetColor());
break;
}
case eStyleSVGPaintType_Server:
{
case eStyleSVGPaintType_Server: {
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(false);
RefPtr<nsROCSSPrimitiveValue> fallback = new nsROCSSPrimitiveValue;
SetValueToFragmentOrURL(paint->mPaint.mPaintServer, val);
SetToRGBAColor(fallback, paint->mFallbackColor);
SetValueToURLValue(paint->GetPaintServer(), val);
SetToRGBAColor(fallback, paint->GetFallbackColor());
valueList->AppendCSSValue(val.forget());
valueList->AppendCSSValue(fallback.forget());
return valueList.forget();
}
case eStyleSVGPaintType_ContextFill:
{
val->SetIdent(eCSSKeyword_context_fill);
// XXXheycam context-fill and context-stroke can have fallback colors,
// so they should be serialized here too
break;
}
case eStyleSVGPaintType_ContextStroke:
{
val->SetIdent(eCSSKeyword_context_stroke);
break;
}
}
return val.forget();

Просмотреть файл

@ -9168,6 +9168,12 @@ SetSVGPaint(const nsCSSValue& aValue, const nsStyleSVGPaint& parentPaint,
nsStyleSVGPaint& aResult, nsStyleSVGPaintType aInitialPaintType,
RuleNodeCacheConditions& aConditions)
{
MOZ_ASSERT(aInitialPaintType == eStyleSVGPaintType_None ||
aInitialPaintType == eStyleSVGPaintType_Color,
"SetSVGPaint only supports initial values being either 'black' "
"(represented by eStyleSVGPaintType_Color) or none (by "
"eStyleSVGPaintType_None)");
nscolor color;
if (aValue.GetUnit() == eCSSUnit_Inherit ||
@ -9175,30 +9181,39 @@ SetSVGPaint(const nsCSSValue& aValue, const nsStyleSVGPaint& parentPaint,
aResult = parentPaint;
aConditions.SetUncacheable();
} else if (aValue.GetUnit() == eCSSUnit_None) {
aResult.SetType(eStyleSVGPaintType_None);
aResult.SetNone();
} else if (aValue.GetUnit() == eCSSUnit_Initial) {
aResult.SetType(aInitialPaintType);
aResult.mPaint.mColor = NS_RGB(0, 0, 0);
aResult.mFallbackColor = NS_RGB(0, 0, 0);
if (aInitialPaintType == eStyleSVGPaintType_None) {
aResult.SetNone();
} else {
aResult.SetColor(NS_RGB(0, 0, 0));
}
} else if (SetColor(aValue, NS_RGB(0, 0, 0), aPresContext, aContext,
color, aConditions)) {
aResult.SetType(eStyleSVGPaintType_Color);
aResult.mPaint.mColor = color;
aResult.SetColor(color);
} else if (aValue.GetUnit() == eCSSUnit_Pair) {
const nsCSSValuePair& pair = aValue.GetPairValue();
nscolor fallback;
if (pair.mYValue.GetUnit() == eCSSUnit_None) {
fallback = NS_RGBA(0, 0, 0, 0);
} else {
MOZ_ASSERT(pair.mYValue.GetUnit() != eCSSUnit_Inherit,
"cannot inherit fallback colour");
SetColor(pair.mYValue, NS_RGB(0, 0, 0), aPresContext, aContext,
fallback, aConditions);
}
if (pair.mXValue.GetUnit() == eCSSUnit_URL) {
aResult.SetType(eStyleSVGPaintType_Server);
aResult.mPaint.mPaintServer = new FragmentOrURL();
aResult.mPaint.mPaintServer->SetValue(&pair.mXValue);
aResult.SetPaintServer(pair.mXValue.GetURLStructValue(), fallback);
} else if (pair.mXValue.GetUnit() == eCSSUnit_Enumerated) {
switch (pair.mXValue.GetIntValue()) {
case NS_COLOR_CONTEXT_FILL:
aResult.SetType(eStyleSVGPaintType_ContextFill);
aResult.SetContextValue(eStyleSVGPaintType_ContextFill, fallback);
break;
case NS_COLOR_CONTEXT_STROKE:
aResult.SetType(eStyleSVGPaintType_ContextStroke);
aResult.SetContextValue(eStyleSVGPaintType_ContextStroke, fallback);
break;
default:
NS_NOTREACHED("unknown keyword as paint server value");
@ -9208,14 +9223,6 @@ SetSVGPaint(const nsCSSValue& aValue, const nsStyleSVGPaint& parentPaint,
NS_NOTREACHED("malformed paint server value");
}
if (pair.mYValue.GetUnit() == eCSSUnit_None) {
aResult.mFallbackColor = NS_RGBA(0, 0, 0, 0);
} else {
MOZ_ASSERT(pair.mYValue.GetUnit() != eCSSUnit_Inherit,
"cannot inherit fallback colour");
SetColor(pair.mYValue, NS_RGB(0, 0, 0), aPresContext, aContext,
aResult.mFallbackColor, aConditions);
}
} else {
MOZ_ASSERT(aValue.GetUnit() == eCSSUnit_Null,
"malformed paint server value");

Просмотреть файл

@ -59,6 +59,13 @@ EqualURIs(nsIURI *aURI1, nsIURI *aURI2)
eq);
}
static bool
DefinitelyEqualURIs(css::URLValue* aURI1, css::URLValue* aURI2)
{
return aURI1 == aURI2 ||
(aURI1 && aURI2 && aURI1->DefinitelyEqualURIs(*aURI2));
}
static bool
DefinitelyEqualURIsAndPrincipal(css::URLValue* aURI1, css::URLValue* aURI2)
{
@ -1006,12 +1013,13 @@ nsStyleSVG::nsStyleSVG(const nsStyleSVG& aSource)
static bool
PaintURIChanged(const nsStyleSVGPaint& aPaint1, const nsStyleSVGPaint& aPaint2)
{
if (aPaint1.mType != aPaint2.mType) {
return aPaint1.mType == eStyleSVGPaintType_Server ||
aPaint2.mType == eStyleSVGPaintType_Server;
if (aPaint1.Type() != aPaint2.Type()) {
return aPaint1.Type() == eStyleSVGPaintType_Server ||
aPaint2.Type() == eStyleSVGPaintType_Server;
}
return aPaint1.mType == eStyleSVGPaintType_Server &&
!EqualURIs(aPaint1.mPaint.mPaintServer, aPaint2.mPaint.mPaintServer);
return aPaint1.Type() == eStyleSVGPaintType_Server &&
!DefinitelyEqualURIs(aPaint1.GetPaintServer(),
aPaint2.GetPaintServer());
}
nsChangeHint
@ -1321,24 +1329,19 @@ nsStyleSVGReset::CalcDifference(const nsStyleSVGReset& aNewData) const
// nsStyleSVGPaint implementation
nsStyleSVGPaint::nsStyleSVGPaint(nsStyleSVGPaintType aType)
: mType(nsStyleSVGPaintType(0))
: mType(aType)
, mFallbackColor(NS_RGB(0, 0, 0))
{
SetType(aType);
MOZ_ASSERT(aType == nsStyleSVGPaintType(0) ||
aType == eStyleSVGPaintType_None ||
aType == eStyleSVGPaintType_Color);
mPaint.mColor = NS_RGB(0, 0, 0);
}
nsStyleSVGPaint::nsStyleSVGPaint(const nsStyleSVGPaint& aSource)
: mType(nsStyleSVGPaintType(0))
, mFallbackColor(NS_RGB(0, 0, 0))
: nsStyleSVGPaint(nsStyleSVGPaintType(0))
{
SetType(aSource.mType);
mFallbackColor = aSource.mFallbackColor;
if (mType == eStyleSVGPaintType_Server) {
mPaint.mPaintServer = new FragmentOrURL(*aSource.mPaint.mPaintServer);
} else {
mPaint.mColor = aSource.mPaint.mColor;
}
Assign(aSource);
}
nsStyleSVGPaint::~nsStyleSVGPaint()
@ -1349,52 +1352,115 @@ nsStyleSVGPaint::~nsStyleSVGPaint()
void
nsStyleSVGPaint::Reset()
{
SetType(nsStyleSVGPaintType(0));
}
void
nsStyleSVGPaint::SetType(nsStyleSVGPaintType aType)
{
if (mType == eStyleSVGPaintType_Server) {
delete mPaint.mPaintServer;
mPaint.mPaintServer = nullptr;
} else {
mPaint.mColor = NS_RGB(0, 0, 0);
switch (mType) {
case eStyleSVGPaintType_None:
break;
case eStyleSVGPaintType_Color:
mPaint.mColor = NS_RGB(0, 0, 0);
break;
case eStyleSVGPaintType_Server:
mPaint.mPaintServer->Release();
mPaint.mPaintServer = nullptr;
MOZ_FALLTHROUGH;
case eStyleSVGPaintType_ContextFill:
case eStyleSVGPaintType_ContextStroke:
mFallbackColor = NS_RGB(0, 0, 0);
break;
}
mType = aType;
mType = nsStyleSVGPaintType(0);
}
nsStyleSVGPaint&
nsStyleSVGPaint::operator=(const nsStyleSVGPaint& aOther)
{
if (this == &aOther) {
return *this;
}
SetType(aOther.mType);
mFallbackColor = aOther.mFallbackColor;
if (mType == eStyleSVGPaintType_Server) {
mPaint.mPaintServer = new FragmentOrURL(*aOther.mPaint.mPaintServer);
} else {
mPaint.mColor = aOther.mPaint.mColor;
if (this != &aOther) {
Assign(aOther);
}
return *this;
}
void
nsStyleSVGPaint::Assign(const nsStyleSVGPaint& aOther)
{
MOZ_ASSERT(aOther.mType != nsStyleSVGPaintType(0),
"shouldn't copy uninitialized nsStyleSVGPaint");
switch (aOther.mType) {
case eStyleSVGPaintType_None:
SetNone();
break;
case eStyleSVGPaintType_Color:
SetColor(aOther.mPaint.mColor);
break;
case eStyleSVGPaintType_Server:
SetPaintServer(aOther.mPaint.mPaintServer,
aOther.mFallbackColor);
break;
case eStyleSVGPaintType_ContextFill:
case eStyleSVGPaintType_ContextStroke:
SetContextValue(aOther.mType, aOther.mFallbackColor);
break;
}
}
void
nsStyleSVGPaint::SetNone()
{
Reset();
mType = eStyleSVGPaintType_None;
}
void
nsStyleSVGPaint::SetContextValue(nsStyleSVGPaintType aType,
nscolor aFallbackColor)
{
MOZ_ASSERT(aType == eStyleSVGPaintType_ContextFill ||
aType == eStyleSVGPaintType_ContextStroke);
Reset();
mType = aType;
mFallbackColor = aFallbackColor;
}
void
nsStyleSVGPaint::SetColor(nscolor aColor)
{
Reset();
mType = eStyleSVGPaintType_Color;
mPaint.mColor = aColor;
}
void
nsStyleSVGPaint::SetPaintServer(css::URLValue* aPaintServer,
nscolor aFallbackColor)
{
MOZ_ASSERT(aPaintServer);
Reset();
mType = eStyleSVGPaintType_Server;
mPaint.mPaintServer = aPaintServer;
mPaint.mPaintServer->AddRef();
mFallbackColor = aFallbackColor;
}
bool nsStyleSVGPaint::operator==(const nsStyleSVGPaint& aOther) const
{
if (mType != aOther.mType) {
return false;
}
if (mType == eStyleSVGPaintType_Server) {
return EqualURIs(mPaint.mPaintServer, aOther.mPaint.mPaintServer) &&
mFallbackColor == aOther.mFallbackColor;
switch (mType) {
case eStyleSVGPaintType_Color:
return mPaint.mColor == aOther.mPaint.mColor;
case eStyleSVGPaintType_Server:
return DefinitelyEqualURIs(mPaint.mPaintServer,
aOther.mPaint.mPaintServer) &&
mFallbackColor == aOther.mFallbackColor;
case eStyleSVGPaintType_ContextFill:
case eStyleSVGPaintType_ContextStroke:
return mFallbackColor == aOther.mFallbackColor;
default:
MOZ_ASSERT(mType == eStyleSVGPaintType_None,
"Unexpected SVG paint type");
return true;
}
if (mType == eStyleSVGPaintType_Color) {
return mPaint.mColor == aOther.mPaint.mColor;
}
return true;
}
// --------------------

Просмотреть файл

@ -3441,26 +3441,56 @@ enum nsStyleSVGOpacitySource : uint8_t {
eStyleSVGOpacitySource_ContextStrokeOpacity
};
struct nsStyleSVGPaint
class nsStyleSVGPaint
{
union {
nscolor mColor;
mozilla::FragmentOrURL* mPaintServer;
} mPaint;
nsStyleSVGPaintType mType;
nscolor mFallbackColor;
public:
explicit nsStyleSVGPaint(nsStyleSVGPaintType aType = nsStyleSVGPaintType(0));
nsStyleSVGPaint(const nsStyleSVGPaint& aSource);
~nsStyleSVGPaint();
void Reset();
void SetType(nsStyleSVGPaintType aType);
nsStyleSVGPaint& operator=(const nsStyleSVGPaint& aOther);
bool operator==(const nsStyleSVGPaint& aOther) const;
nsStyleSVGPaint& operator=(const nsStyleSVGPaint& aOther);
nsStyleSVGPaintType Type() const { return mType; }
void SetNone();
void SetColor(nscolor aColor);
void SetPaintServer(mozilla::css::URLValue* aPaintServer,
nscolor aFallbackColor);
void SetContextValue(nsStyleSVGPaintType aType,
nscolor aFallbackColor);
nscolor GetColor() const {
MOZ_ASSERT(mType == eStyleSVGPaintType_Color);
return mPaint.mColor;
}
mozilla::css::URLValue* GetPaintServer() const {
MOZ_ASSERT(mType == eStyleSVGPaintType_Server);
return mPaint.mPaintServer;
}
nscolor GetFallbackColor() const {
MOZ_ASSERT(mType == eStyleSVGPaintType_Server ||
mType == eStyleSVGPaintType_ContextFill ||
mType == eStyleSVGPaintType_ContextStroke);
return mFallbackColor;
}
bool operator==(const nsStyleSVGPaint& aOther) const;
bool operator!=(const nsStyleSVGPaint& aOther) const {
return !(*this == aOther);
}
private:
void Reset();
void Assign(const nsStyleSVGPaint& aOther);
union {
nscolor mColor;
mozilla::css::URLValue* mPaintServer;
} mPaint;
nsStyleSVGPaintType mType;
nscolor mFallbackColor;
};
struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVG
@ -3569,7 +3599,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVG
* than zero. This ignores stroke-widths as that depends on the context.
*/
bool HasStroke() const {
return mStroke.mType != eStyleSVGPaintType_None && mStrokeOpacity > 0;
return mStroke.Type() != eStyleSVGPaintType_None && mStrokeOpacity > 0;
}
/**
@ -3577,7 +3607,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleSVG
* than zero.
*/
bool HasFill() const {
return mFill.mType != eStyleSVGPaintType_None && mFillOpacity > 0;
return mFill.Type() != eStyleSVGPaintType_None && mFillOpacity > 0;
}
private:

Просмотреть файл

@ -50,7 +50,7 @@ SetupInheritablePaint(const DrawTarget* aDrawTarget,
}
if (aOuterContextPaint) {
RefPtr<gfxPattern> pattern;
switch ((style->*aFillOrStroke).mType) {
switch ((style->*aFillOrStroke).Type()) {
case eStyleSVGPaintType_ContextFill:
pattern = aOuterContextPaint->GetFillPattern(aDrawTarget, aOpacity,
aContextMatrix);
@ -63,7 +63,7 @@ SetupInheritablePaint(const DrawTarget* aDrawTarget,
;
}
if (pattern) {
aTargetPaint.SetContextPaint(aOuterContextPaint, (style->*aFillOrStroke).mType);
aTargetPaint.SetContextPaint(aOuterContextPaint, (style->*aFillOrStroke).Type());
return;
}
}
@ -83,7 +83,7 @@ SVGContextPaintImpl::Init(const DrawTarget* aDrawTarget,
const nsStyleSVG *style = aFrame->StyleSVG();
// fill:
if (style->mFill.mType == eStyleSVGPaintType_None) {
if (style->mFill.Type() == eStyleSVGPaintType_None) {
SetFillOpacity(0.0f);
} else {
float opacity = nsSVGUtils::GetOpacity(style->FillOpacitySource(),
@ -101,7 +101,7 @@ SVGContextPaintImpl::Init(const DrawTarget* aDrawTarget,
}
// stroke:
if (style->mStroke.mType == eStyleSVGPaintType_None) {
if (style->mStroke.Type() == eStyleSVGPaintType_None) {
SetStrokeOpacity(0.0f);
} else {
float opacity = nsSVGUtils::GetOpacity(style->StrokeOpacitySource(),

Просмотреть файл

@ -3789,7 +3789,7 @@ SVGTextFrame::ReflowSVG()
TextRenderedRunIterator it(this, TextRenderedRunIterator::eAllFrames);
for (TextRenderedRun run = it.Current(); run.mFrame; run = it.Next()) {
uint32_t runFlags = 0;
if (run.mFrame->StyleSVG()->mFill.mType != eStyleSVGPaintType_None) {
if (run.mFrame->StyleSVG()->mFill.Type() != eStyleSVGPaintType_None) {
runFlags |= TextRenderedRun::eIncludeFill |
TextRenderedRun::eIncludeTextShadow;
}
@ -3862,7 +3862,7 @@ TextRenderedRunFlagsForBBoxContribution(const TextRenderedRun& aRun,
uint32_t flags = 0;
if ((aBBoxFlags & nsSVGUtils::eBBoxIncludeFillGeometry) ||
((aBBoxFlags & nsSVGUtils::eBBoxIncludeFill) &&
aRun.mFrame->StyleSVG()->mFill.mType != eStyleSVGPaintType_None)) {
aRun.mFrame->StyleSVG()->mFill.Type() != eStyleSVGPaintType_None)) {
flags |= TextRenderedRun::eIncludeFill;
}
if ((aBBoxFlags & nsSVGUtils::eBBoxIncludeStrokeGeometry) ||
@ -5200,8 +5200,8 @@ SVGTextFrame::ShouldRenderAsPath(nsTextFrame* aFrame,
// Fill is a non-solid paint, has a non-default fill-rule or has
// non-1 opacity.
if (!(style->mFill.mType == eStyleSVGPaintType_None ||
(style->mFill.mType == eStyleSVGPaintType_Color &&
if (!(style->mFill.Type() == eStyleSVGPaintType_None ||
(style->mFill.Type() == eStyleSVGPaintType_Color &&
style->mFillOpacity == 1))) {
return true;
}

Просмотреть файл

@ -600,7 +600,7 @@ nsSVGEffects::GetPaintServer(nsIFrame* aTargetFrame,
PaintingPropertyDescriptor aType)
{
const nsStyleSVG* svgStyle = aTargetFrame->StyleSVG();
if ((svgStyle->*aPaint).mType != eStyleSVGPaintType_Server)
if ((svgStyle->*aPaint).Type() != eStyleSVGPaintType_Server)
return nullptr;
// If we're looking at a frame within SVG text, then we need to look up
@ -1037,10 +1037,11 @@ nsSVGEffects::GetPaintURI(nsIFrame* aFrame,
nsStyleSVGPaint nsStyleSVG::* aPaint)
{
const nsStyleSVG* svgStyle = aFrame->StyleSVG();
MOZ_ASSERT((svgStyle->*aPaint).mType ==
MOZ_ASSERT((svgStyle->*aPaint).Type() ==
nsStyleSVGPaintType::eStyleSVGPaintType_Server);
return ResolveFragmentOrURL(aFrame, (svgStyle->*aPaint).mPaint.mPaintServer);
return ResolveURLUsingLocalRef(aFrame,
(svgStyle->*aPaint).GetPaintServer());
}
already_AddRefed<nsIURI>

Просмотреть файл

@ -511,7 +511,7 @@ nsSVGPathGeometryFrame::GetBBoxContribution(const Matrix &aToBBoxUserspace,
bool getFill = (aFlags & nsSVGUtils::eBBoxIncludeFillGeometry) ||
((aFlags & nsSVGUtils::eBBoxIncludeFill) &&
StyleSVG()->mFill.mType != eStyleSVGPaintType_None);
StyleSVG()->mFill.Type() != eStyleSVGPaintType_None);
bool getStroke = (aFlags & nsSVGUtils::eBBoxIncludeStrokeGeometry) ||
((aFlags & nsSVGUtils::eBBoxIncludeStroke) &&

Просмотреть файл

@ -1280,10 +1280,10 @@ nsSVGUtils::GetFallbackOrPaintColor(nsStyleContext *aStyleContext,
{
const nsStyleSVGPaint &paint = aStyleContext->StyleSVG()->*aFillOrStroke;
nsStyleContext *styleIfVisited = aStyleContext->GetStyleIfVisited();
bool isServer = paint.mType == eStyleSVGPaintType_Server ||
paint.mType == eStyleSVGPaintType_ContextFill ||
paint.mType == eStyleSVGPaintType_ContextStroke;
nscolor color = isServer ? paint.mFallbackColor : paint.mPaint.mColor;
bool isServer = paint.Type() == eStyleSVGPaintType_Server ||
paint.Type() == eStyleSVGPaintType_ContextFill ||
paint.Type() == eStyleSVGPaintType_ContextStroke;
nscolor color = isServer ? paint.GetFallbackColor() : paint.GetColor();
if (styleIfVisited) {
const nsStyleSVGPaint &paintIfVisited =
styleIfVisited->StyleSVG()->*aFillOrStroke;
@ -1294,9 +1294,9 @@ nsSVGUtils::GetFallbackOrPaintColor(nsStyleContext *aStyleContext,
// paint server is used or switch between paint servers and simple
// colors. A :visited style may only override a simple color with
// another simple color.
if (paintIfVisited.mType == eStyleSVGPaintType_Color &&
paint.mType == eStyleSVGPaintType_Color) {
nscolor colors[2] = { color, paintIfVisited.mPaint.mColor };
if (paintIfVisited.Type() == eStyleSVGPaintType_Color &&
paint.Type() == eStyleSVGPaintType_Color) {
nscolor colors[2] = { color, paintIfVisited.GetColor() };
return nsStyleContext::CombineVisitedColors(
colors, aStyleContext->RelevantLinkVisited());
}
@ -1311,7 +1311,7 @@ nsSVGUtils::MakeFillPatternFor(nsIFrame* aFrame,
SVGContextPaint* aContextPaint)
{
const nsStyleSVG* style = aFrame->StyleSVG();
if (style->mFill.mType == eStyleSVGPaintType_None) {
if (style->mFill.Type() == eStyleSVGPaintType_None) {
return;
}
@ -1345,7 +1345,7 @@ nsSVGUtils::MakeFillPatternFor(nsIFrame* aFrame,
if (aContextPaint) {
RefPtr<gfxPattern> pattern;
switch (style->mFill.mType) {
switch (style->mFill.Type()) {
case eStyleSVGPaintType_ContextFill:
pattern = aContextPaint->GetFillPattern(dt, fillOpacity,
aContext->CurrentMatrix());
@ -1379,7 +1379,7 @@ nsSVGUtils::MakeStrokePatternFor(nsIFrame* aFrame,
SVGContextPaint* aContextPaint)
{
const nsStyleSVG* style = aFrame->StyleSVG();
if (style->mStroke.mType == eStyleSVGPaintType_None) {
if (style->mStroke.Type() == eStyleSVGPaintType_None) {
return;
}
@ -1413,7 +1413,7 @@ nsSVGUtils::MakeStrokePatternFor(nsIFrame* aFrame,
if (aContextPaint) {
RefPtr<gfxPattern> pattern;
switch (style->mStroke.mType) {
switch (style->mStroke.Type()) {
case eStyleSVGPaintType_ContextFill:
pattern = aContextPaint->GetFillPattern(dt, strokeOpacity,
aContext->CurrentMatrix());
@ -1619,9 +1619,9 @@ nsSVGUtils::GetGeometryHitTestFlags(nsIFrame* aFrame)
case NS_STYLE_POINTER_EVENTS_AUTO:
case NS_STYLE_POINTER_EVENTS_VISIBLEPAINTED:
if (aFrame->StyleVisibility()->IsVisible()) {
if (aFrame->StyleSVG()->mFill.mType != eStyleSVGPaintType_None)
if (aFrame->StyleSVG()->mFill.Type() != eStyleSVGPaintType_None)
flags |= SVG_HIT_TEST_FILL;
if (aFrame->StyleSVG()->mStroke.mType != eStyleSVGPaintType_None)
if (aFrame->StyleSVG()->mStroke.Type() != eStyleSVGPaintType_None)
flags |= SVG_HIT_TEST_STROKE;
if (aFrame->StyleSVG()->mStrokeOpacity > 0)
flags |= SVG_HIT_TEST_CHECK_MRECT;
@ -1643,9 +1643,9 @@ nsSVGUtils::GetGeometryHitTestFlags(nsIFrame* aFrame)
}
break;
case NS_STYLE_POINTER_EVENTS_PAINTED:
if (aFrame->StyleSVG()->mFill.mType != eStyleSVGPaintType_None)
if (aFrame->StyleSVG()->mFill.Type() != eStyleSVGPaintType_None)
flags |= SVG_HIT_TEST_FILL;
if (aFrame->StyleSVG()->mStroke.mType != eStyleSVGPaintType_None)
if (aFrame->StyleSVG()->mStroke.Type() != eStyleSVGPaintType_None)
flags |= SVG_HIT_TEST_STROKE;
if (aFrame->StyleSVG()->mStrokeOpacity)
flags |= SVG_HIT_TEST_CHECK_MRECT;

Просмотреть файл

@ -33,6 +33,7 @@ class nsIDocument;
class nsIFrame;
class nsPresContext;
class nsStyleContext;
class nsStyleSVGPaint;
class nsSVGDisplayContainerFrame;
class nsSVGElement;
class nsSVGEnum;
@ -42,7 +43,6 @@ class nsSVGPathGeometryFrame;
class nsTextFrame;
struct nsStyleSVG;
struct nsStyleSVGPaint;
struct nsRect;
namespace mozilla {