Bug 1361938 - Set the dirty flag of DeclarationBlock when the DeclarationBlock is modified and clear the flag when it's resyled. r=heycam
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Wed, 31 May 2017 09:24:40 +0900
changeset 409545 2585796d42803deb0e4e89e95beabc8e8f52040a
parent 409544 c3bf3996068d2ce6468aa92d6682d11af923e4a9
child 409546 e6ba19be442ffc26a5fc05befcc563aec20f2291
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1361938
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1361938 - Set the dirty flag of DeclarationBlock when the DeclarationBlock is modified and clear the flag when it's resyled. r=heycam MozReview-Commit-ID: 9GpFgx8N13e
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
layout/style/nsDOMCSSAttrDeclaration.cpp
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -406,16 +406,32 @@ Gecko_GetStyleAttrDeclarationBlock(RawGe
     // XXX This can happen when nodes are adopted from a Gecko-style-backend
     //     document into a Servo-style-backend document.  See bug 1330051.
     NS_WARNING("stylo: requesting a Gecko declaration block?");
     return nullptr;
   }
   return decl->AsServo()->RefRawStrong();
 }
 
+void
+Gecko_UnsetDirtyStyleAttr(RawGeckoElementBorrowed aElement)
+{
+  DeclarationBlock* decl = aElement->GetInlineStyleDeclaration();
+  if (!decl) {
+    return;
+  }
+  if (decl->IsGecko()) {
+    // XXX This can happen when nodes are adopted from a Gecko-style-backend
+    //     document into a Servo-style-backend document.  See bug 1330051.
+    NS_WARNING("stylo: requesting a Gecko declaration block?");
+    return;
+  }
+  decl->UnsetDirty();
+}
+
 RawServoDeclarationBlockStrongBorrowedOrNull
 Gecko_GetSMILOverrideDeclarationBlock(RawGeckoElementBorrowed aElement)
 {
   // This function duplicates a lot of the code in
   // Gecko_GetStyleAttrDeclarationBlock above because I haven't worked out a way
   // to persuade hazard analysis that a pointer-to-lambda is ok yet.
   MOZ_ASSERT(aElement, "Invalid GeckoElement");
 
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -187,16 +187,17 @@ SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNC
 SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS(Gecko_Snapshot,
                                               const ServoElementSnapshot*)
 
 #undef SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS
 
 // Style attributes.
 RawServoDeclarationBlockStrongBorrowedOrNull
 Gecko_GetStyleAttrDeclarationBlock(RawGeckoElementBorrowed element);
+void Gecko_UnsetDirtyStyleAttr(RawGeckoElementBorrowed element);
 RawServoDeclarationBlockStrongBorrowedOrNull
 Gecko_GetHTMLPresentationAttrDeclarationBlock(RawGeckoElementBorrowed element);
 RawServoDeclarationBlockStrongBorrowedOrNull
 Gecko_GetExtraContentStyleDeclarations(RawGeckoElementBorrowed element);
 
 // Animations
 bool
 Gecko_GetAnimationRule(RawGeckoElementBorrowed aElementOrPseudo,
--- a/layout/style/nsDOMCSSAttrDeclaration.cpp
+++ b/layout/style/nsDOMCSSAttrDeclaration.cpp
@@ -68,16 +68,17 @@ NS_IMPL_QUERY_TAIL_INHERITING(nsDOMCSSDe
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMCSSAttributeDeclaration)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMCSSAttributeDeclaration)
 
 nsresult
 nsDOMCSSAttributeDeclaration::SetCSSDeclaration(DeclarationBlock* aDecl)
 {
   NS_ASSERTION(mElement, "Must have Element to set the declaration!");
+  aDecl->SetDirty();
   return mIsSMILOverride
     ? mElement->SetSMILOverrideStyleDeclaration(aDecl, true)
     : mElement->SetInlineStyleDeclaration(aDecl, nullptr, true);
 }
 
 nsIDocument*
 nsDOMCSSAttributeDeclaration::DocToUpdate()
 {