Bug 1404243 Part 2 - Change StyleShapeSource::operator==() to use logic in DefinitelyEquals().
The original operator==() (implemented by EqualsInternal<true>) is not been
used. Therefore, I expand EqualsInternal<false> into it, and move it to
nsStyleStruct.cpp.
Also, use DefinitelyEqualURIs() in nsStyleStruct.cpp in operator==().
MozReview-Commit-ID: HccwKvzQHR
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -1070,16 +1070,35 @@ StyleShapeSource::operator=(const StyleS
ReleaseRef();
mReferenceBox = StyleGeometryBox::NoBox;
mType = StyleShapeSourceType::None;
}
return *this;
}
bool
+StyleShapeSource::operator==(const StyleShapeSource& aOther) const
+{
+ if (mType != aOther.mType) {
+ return false;
+ }
+
+ if (mType == StyleShapeSourceType::URL) {
+ return DefinitelyEqualURIs(mURL, aOther.mURL);
+ } else if (mType == StyleShapeSourceType::Shape) {
+ return *mBasicShape == *aOther.mBasicShape &&
+ mReferenceBox == aOther.mReferenceBox;
+ } else if (mType == StyleShapeSourceType::Box) {
+ return mReferenceBox == aOther.mReferenceBox;
+ }
+
+ return true;
+}
+
+bool
StyleShapeSource::SetURL(css::URLValue* aValue)
{
MOZ_ASSERT(aValue);
ReleaseRef();
mURL = aValue;
mURL->AddRef();
mType = StyleShapeSourceType::URL;
return true;
@@ -1296,17 +1315,17 @@ nsStyleSVGReset::FinishStyle(nsPresConte
}
}
nsChangeHint
nsStyleSVGReset::CalcDifference(const nsStyleSVGReset& aNewData) const
{
nsChangeHint hint = nsChangeHint(0);
- if (!mClipPath.DefinitelyEquals(aNewData.mClipPath)) {
+ if (mClipPath != aNewData.mClipPath) {
hint |= nsChangeHint_UpdateEffects |
nsChangeHint_RepaintFrame;
// clip-path changes require that we update the PreEffectsBBoxProperty,
// which is done during overflow computation.
hint |= nsChangeHint_UpdateOverflow;
}
if (mDominantBaseline != aNewData.mDominantBaseline) {
@@ -3649,17 +3668,17 @@ nsStyleDisplay::CalcDifference(const nsS
* if this does become common perhaps a faster-path might be worth while.
*/
if (mFloat != aNewData.mFloat) {
// Changing which side we're floating on (float:none was handled above).
hint |= nsChangeHint_ReflowHintsForFloatAreaChange;
}
- if (!mShapeOutside.DefinitelyEquals(aNewData.mShapeOutside)) {
+ if (mShapeOutside != aNewData.mShapeOutside) {
if (aNewData.mFloat != StyleFloat::None) {
// If we are floating, and our shape-outside property changes, our
// descendants are not impacted, but our ancestor and siblings are.
// This is similar to a float-only change, but since the ISize of the
// float area changes arbitrarily along its block axis, more is required
// to get the siblings to adjust properly. Hinting overflow change is
// sufficient to trigger the correct calculation, but may be too
// heavyweight.
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -2449,45 +2449,17 @@ struct StyleShapeSource
~StyleShapeSource()
{
ReleaseRef();
}
StyleShapeSource& operator=(const StyleShapeSource& aOther);
- bool operator==(const StyleShapeSource& aOther) const
- {
- return EqualsInternal<true>(aOther);
- }
-
- bool DefinitelyEquals(const StyleShapeSource& aOther) const
- {
- return EqualsInternal<false>(aOther);
- }
-
- template<bool aPrecise>
- bool EqualsInternal(const StyleShapeSource& aOther) const
- {
- if (mType != aOther.mType) {
- return false;
- }
-
- if (mType == StyleShapeSourceType::URL) {
- return aPrecise ? mURL->Equals(*aOther.mURL)
- : mURL->DefinitelyEqualURIs(*aOther.mURL);
- } else if (mType == StyleShapeSourceType::Shape) {
- return *mBasicShape == *aOther.mBasicShape &&
- mReferenceBox == aOther.mReferenceBox;
- } else if (mType == StyleShapeSourceType::Box) {
- return mReferenceBox == aOther.mReferenceBox;
- }
-
- return true;
- }
+ bool operator==(const StyleShapeSource& aOther) const;
bool operator!=(const StyleShapeSource& aOther) const
{
return !(*this == aOther);
}
StyleShapeSourceType GetType() const
{