Bug 1058040, part 10b - Account for the SVGContextPaint member in SVGImageContext::operator==. r=dholbert

MozReview-Commit-ID: KqP0al5v5mB
This commit is contained in:
Jonathan Watt 2017-03-01 10:41:14 +00:00
parent baeaa6587e
commit 8c4b35d802
2 changed files with 23 additions and 6 deletions

View File

@ -83,15 +83,15 @@ public:
void InitStrokeGeometry(gfxContext *aContext,
float devUnitsPerSVGUnit);
FallibleTArray<gfxFloat>& GetStrokeDashArray() {
const FallibleTArray<gfxFloat>& GetStrokeDashArray() const {
return mDashes;
}
gfxFloat GetStrokeDashOffset() {
gfxFloat GetStrokeDashOffset() const {
return mDashOffset;
}
gfxFloat GetStrokeWidth() {
gfxFloat GetStrokeWidth() const {
return mStrokeWidth;
}
@ -225,6 +225,15 @@ class SVGEmbeddingContextPaint : public SVGContextPaint
public:
SVGEmbeddingContextPaint() {}
bool operator==(const SVGEmbeddingContextPaint& aOther) const {
MOZ_ASSERT(GetStrokeWidth() == aOther.GetStrokeWidth() &&
GetStrokeDashOffset() == aOther.GetStrokeDashOffset() &&
GetStrokeDashArray() == aOther.GetStrokeDashArray(),
"We don't currently include these in the context information "
"from an embedding element");
return mFill == aOther.mFill && mStroke == aOther.mStroke;
}
void SetFill(nscolor aFill) {
mFill.emplace(gfx::ToDeviceColor(aFill));
}

View File

@ -79,7 +79,7 @@ public:
return mGlobalOpacity;
}
const SVGContextPaint* GetContextPaint() const {
const SVGEmbeddingContextPaint* GetContextPaint() const {
return mContextPaint.get();
}
@ -88,7 +88,15 @@ public:
}
bool operator==(const SVGImageContext& aOther) const {
return mViewportSize == aOther.mViewportSize &&
bool contextPaintIsEqual =
// neither have context paint, or they have the same object:
(mContextPaint == aOther.mContextPaint) ||
// or both have context paint that are different but equivalent objects:
(mContextPaint && aOther.mContextPaint &&
*mContextPaint == *aOther.mContextPaint);
return contextPaintIsEqual &&
mViewportSize == aOther.mViewportSize &&
mPreserveAspectRatio == aOther.mPreserveAspectRatio &&
mGlobalOpacity == aOther.mGlobalOpacity &&
mIsPaintingSVGImageElement == aOther.mIsPaintingSVGImageElement;
@ -119,7 +127,7 @@ private:
}
// NOTE: When adding new member-vars, remember to update Hash() & operator==.
RefPtr<SVGContextPaint> mContextPaint;
RefPtr<SVGEmbeddingContextPaint> mContextPaint;
Maybe<CSSIntSize> mViewportSize;
Maybe<SVGPreserveAspectRatio> mPreserveAspectRatio;
gfxFloat mGlobalOpacity;