Bug 1297963 - Part 3: Use OMT-safe function for -moz-binding comparisons in CalcDifference. r=emilio
authorCameron McCormack <cam@mcc.id.au>
Sat, 03 Sep 2016 00:22:48 +1000
changeset 312443 4de2d08774a1ca1fb2b3bd00124acf93a970c3f0
parent 312442 0549f87f0c292b5bc27f2d62cf62cb7ec1ec4cff
child 312444 2fd65026fd36ca156b7179e448bf752fbfd7d5f4
push id20447
push userkwierso@gmail.com
push dateFri, 02 Sep 2016 20:36:44 +0000
treeherderfx-team@969397f22187 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1297963
milestone51.0a1
Bug 1297963 - Part 3: Use OMT-safe function for -moz-binding comparisons in CalcDifference. r=emilio MozReview-Commit-ID: 6n7j2DrAVFv
layout/base/nsCSSFrameConstructor.cpp
layout/style/nsCSSValue.cpp
layout/style/nsStyleStruct.cpp
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -9194,21 +9194,22 @@ nsCSSFrameConstructor::CaptureStateForFr
       GetRootFrame();
   }
   for ( ; frame;
         frame = nsLayoutUtils::GetNextContinuationOrIBSplitSibling(frame)) {
     CaptureFrameState(frame, aHistoryState);
   }
 }
 
-static bool EqualURIs(mozilla::css::URLValue *aURI1,
-                      mozilla::css::URLValue *aURI2)
-{
-  return aURI1 == aURI2 ||    // handle null==null, and optimize
-         (aURI1 && aURI2 && aURI1->URIEquals(*aURI2));
+static bool
+DefinitelyEqualURIsAndPrincipal(mozilla::css::URLValue* aURI1,
+                                mozilla::css::URLValue* aURI2)
+{
+  return aURI1 == aURI2 ||
+         (aURI1 && aURI2 && aURI1->DefinitelyEqualURIsAndPrincipal(*aURI2));
 }
 
 nsStyleContext*
 nsCSSFrameConstructor::MaybeRecreateFramesForElement(Element* aElement)
 {
   RefPtr<nsStyleContext> oldContext = GetUndisplayedContent(aElement);
   StyleDisplay oldDisplay = StyleDisplay::None_;
   if (!oldContext) {
@@ -9234,17 +9235,18 @@ nsCSSFrameConstructor::MaybeRecreateFram
     // We can skip trying to recreate frames here, but only if our style
     // context does not have a binding URI that differs from our old one.
     // Otherwise, we should try to recreate, because we may want to apply the
     // new binding
     if (!disp->mBinding) {
       return newContext;
     }
     const nsStyleDisplay* oldDisp = oldContext->PeekStyleDisplay();
-    if (oldDisp && EqualURIs(disp->mBinding, oldDisp->mBinding)) {
+    if (oldDisp &&
+        DefinitelyEqualURIsAndPrincipal(disp->mBinding, oldDisp->mBinding)) {
       return newContext;
     }
   }
 
   RecreateFramesForContent(aElement, false, REMOVE_FOR_RECONSTRUCTION, nullptr);
   return nullptr;
 }
 
--- a/layout/style/nsCSSValue.cpp
+++ b/layout/style/nsCSSValue.cpp
@@ -2679,17 +2679,17 @@ css::URLValueData::URIEquals(const URLVa
 }
 
 bool
 css::URLValueData::DefinitelyEqualURIs(const URLValueData& aOther) const
 {
   return mBaseURI == aOther.mBaseURI &&
          (mString == aOther.mString ||
           NS_strcmp(nsCSSValue::GetBufferValue(mString),
-                    nsCSSValue::GetBufferValue(aOther.mString)));
+                    nsCSSValue::GetBufferValue(aOther.mString)) == 0);
 }
 
 bool
 css::URLValueData::DefinitelyEqualURIsAndPrincipal(
     const URLValueData& aOther) const
 {
   return mOriginPrincipal == aOther.mOriginPrincipal &&
          DefinitelyEqualURIs(aOther);
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -55,20 +55,20 @@ EqualURIs(nsIURI *aURI1, nsIURI *aURI2)
   bool eq;
   return aURI1 == aURI2 ||    // handle null==null, and optimize
          (aURI1 && aURI2 &&
           NS_SUCCEEDED(aURI1->Equals(aURI2, &eq)) && // not equal on fail
           eq);
 }
 
 static bool
-MaybeUnresolvedURIEquals(css::URLValue *aURI1, css::URLValue *aURI2)
+DefinitelyEqualURIsAndPrincipal(css::URLValue* aURI1, css::URLValue* aURI2)
 {
-  return aURI1 == aURI2 ||    // handle null==null, and optimize
-         (aURI1 && aURI2 && aURI1->MaybeUnresolvedURIEquals(*aURI2));
+  return aURI1 == aURI2 ||
+         (aURI1 && aURI2 && aURI1->DefinitelyEqualURIsAndPrincipal(*aURI2));
 }
 
 static
 bool EqualURIs(const FragmentOrURL* aURI1, const FragmentOrURL* aURI2)
 {
   return aURI1 == aURI2 ||    // handle null==null, and optimize
          (aURI1 && aURI2 && *aURI1 == *aURI2);
 }
@@ -3103,17 +3103,17 @@ nsStyleDisplay::nsStyleDisplay(const nsS
   mPerspectiveOrigin[1] = aSource.mPerspectiveOrigin[1];
 }
 
 nsChangeHint
 nsStyleDisplay::CalcDifference(const nsStyleDisplay& aNewData) const
 {
   nsChangeHint hint = nsChangeHint(0);
 
-  if (!MaybeUnresolvedURIEquals(mBinding, aNewData.mBinding)
+  if (!DefinitelyEqualURIsAndPrincipal(mBinding, aNewData.mBinding)
       || mPosition != aNewData.mPosition
       || mDisplay != aNewData.mDisplay
       || mContain != aNewData.mContain
       || (mFloat == StyleFloat::None_) != (aNewData.mFloat == StyleFloat::None_)
       || mOverflowX != aNewData.mOverflowX
       || mOverflowY != aNewData.mOverflowY
       || mScrollBehavior != aNewData.mScrollBehavior
       || mScrollSnapTypeX != aNewData.mScrollSnapTypeX