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 333869 f572c7858103dd68d0319722281d12d95d64f207
parent 333868 f1d25be43bde294949d5004c5ccb21e043bc3616
child 333870 002fbc72afdddd8db2d50401793f09d52d68cb7b
push id10033
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:50:26 +0000
treeherdermozilla-aurora@5dddbefdf759 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1290335
milestone51.0a1
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 =