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
--- 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.
*