Bug 1365659 part 2. Add id/class flags to stylo snapshots and set them correctly on the Gecko side. r=emilio draft
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 18 May 2017 11:31:54 -0400
changeset 580466 e103418eb75fda17a3f83fd017514b2b9d821ec3
parent 580465 95d02763720de8797367304e90b9eeef2a22309c
child 629294 2b26156bf65087dfd0c826cf7ce541914d8e1311
push id59565
push userbzbarsky@mozilla.com
push dateThu, 18 May 2017 15:36:04 +0000
reviewersemilio
bugs1365659
milestone55.0a1
Bug 1365659 part 2. Add id/class flags to stylo snapshots and set them correctly on the Gecko side. r=emilio MozReview-Commit-ID: 4ylYDIbR3lI
layout/style/ServoElementSnapshot.cpp
layout/style/ServoElementSnapshot.h
--- a/layout/style/ServoElementSnapshot.cpp
+++ b/layout/style/ServoElementSnapshot.cpp
@@ -40,11 +40,17 @@ ServoElementSnapshot::AddAttrs(Element* 
   const nsAttrName* attrName;
   for (uint32_t i = 0; i < attrCount; ++i) {
     attrName = aElement->GetAttrNameAt(i);
     const nsAttrValue* attrValue =
       aElement->GetParsedAttr(attrName->LocalName(), attrName->NamespaceID());
     mAttrs.AppendElement(ServoAttrSnapshot(*attrName, *attrValue));
   }
   mContains |= Flags::Attributes;
+  if (aElement->HasID()) {
+    mContains |= Flags::Id;
+  }
+  if (aElement->MayHaveClass()) {
+    mContains |= Flags::MaybeClass;
+  }
 }
 
 } // namespace mozilla
--- a/layout/style/ServoElementSnapshot.h
+++ b/layout/style/ServoElementSnapshot.h
@@ -41,17 +41,18 @@ struct ServoAttrSnapshot
 /**
  * A bitflags enum class used to determine what data does a ServoElementSnapshot
  * contains.
  */
 enum class ServoElementSnapshotFlags : uint8_t
 {
   State = 1 << 0,
   Attributes = 1 << 1,
-  All = State | Attributes
+  Id = 1 << 2,
+  MaybeClass = 1 << 3,
 };
 
 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(ServoElementSnapshotFlags)
 
 /**
  * This class holds all non-tree-structural state of an element that might be
  * used for selector matching eventually.
  *