Bug 1290335: stylo: Assert the snapshot is taken in ServoRestyleManager::AttributeChanged. r=heycam
authorEmilio Cobos Álvarez <ecoal95@gmail.com>
Mon, 01 Aug 2016 10:34:00 -0700
changeset 349405 f572c7858103dd68d0319722281d12d95d64f207
parent 349404 f1d25be43bde294949d5004c5ccb21e043bc3616
child 349406 002fbc72afdddd8db2d50401793f09d52d68cb7b
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1290335
milestone51.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 1290335: stylo: Assert the snapshot is taken in ServoRestyleManager::AttributeChanged. r=heycam Also fixes an embarrassing typo in the implementation of ServoElementSnapshot::AddAttrs. MozReview-Commit-ID: 7LHZVLo6j60
layout/base/ServoRestyleManager.h
layout/style/ServoElementSnapshot.cpp
--- a/layout/base/ServoRestyleManager.h
+++ b/layout/base/ServoRestyleManager.h
@@ -61,20 +61,22 @@ public:
   nsresult ContentStateChanged(nsIContent* aContent,
                                EventStates aStateMask);
   void AttributeWillChange(dom::Element* aElement,
                            int32_t aNameSpaceID,
                            nsIAtom* aAttribute,
                            int32_t aModType,
                            const nsAttrValue* aNewValue);
 
-  // XXXbholley: We should assert that the element is already snapshotted.
   void AttributeChanged(dom::Element* aElement, int32_t aNameSpaceID,
                         nsIAtom* aAttribute, int32_t aModType,
-                        const nsAttrValue* aOldValue) {}
+                        const nsAttrValue* aOldValue)
+  {
+    MOZ_ASSERT(SnapshotForElement(aElement)->HasAttrs());
+  }
 
   nsresult ReparentStyleContext(nsIFrame* aFrame);
   nsresult ProcessRestyledFrames(nsStyleChangeList& aChangeList);
   void FlushOverflowChangedTracker();
 
   bool HasPendingRestyles() { return !mModifiedElements.IsEmpty(); }
 
 protected:
--- a/layout/style/ServoElementSnapshot.cpp
+++ b/layout/style/ServoElementSnapshot.cpp
@@ -23,17 +23,17 @@ ServoElementSnapshot::ServoElementSnapsh
     nsContentUtils::IsChromeDoc(aElement->OwnerDoc());
 }
 
 void
 ServoElementSnapshot::AddAttrs(Element* aElement)
 {
   MOZ_ASSERT(aElement);
 
-  if (!HasAny(Flags::Attributes)) {
+  if (HasAny(Flags::Attributes)) {
     return;
   }
 
   uint32_t attrCount = aElement->GetAttrCount();
   const nsAttrName* attrName;
   for (uint32_t i = 0; i < attrCount; ++i) {
     attrName = aElement->GetAttrNameAt(i);
     const nsAttrValue* attrValue =