Bug 1371130 - Part 1: Add FFI function for checking whether an element has XBL-created anonymous content. r=emilio
MozReview-Commit-ID: 2ZXyBzxkfsA
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -235,16 +235,28 @@ Gecko_MaybeCreateStyleChildrenIterator(R
void
Gecko_DropStyleChildrenIterator(StyleChildrenIteratorOwned aIterator)
{
MOZ_ASSERT(aIterator);
delete aIterator;
}
+bool
+Gecko_ElementHasBindingWithAnonymousContent(RawGeckoElementBorrowed aElement)
+{
+ if (!aElement->HasFlag(NODE_MAY_BE_IN_BINDING_MNGR)) {
+ return false;
+ }
+
+ nsBindingManager* manager = aElement->OwnerDoc()->BindingManager();
+ nsXBLBinding* binding = manager->GetBindingWithContent(aElement);
+ return binding && binding->GetAnonymousContent();
+}
+
RawGeckoNodeBorrowed
Gecko_GetNextStyleChild(StyleChildrenIteratorBorrowedMut aIterator)
{
MOZ_ASSERT(aIterator);
return aIterator->GetNextChild();
}
EventStates::ServoType
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -150,16 +150,17 @@ void Gecko_LoadStyleSheet(mozilla::css::
// first child. This generally works, but misses anonymous children, which we
// want to traverse during styling. To support these cases, we create an
// optional heap-allocated iterator for nodes that need it. If the creation
// method returns null, Servo falls back to the aforementioned simpler (and
// faster) sibling traversal.
StyleChildrenIteratorOwnedOrNull Gecko_MaybeCreateStyleChildrenIterator(RawGeckoNodeBorrowed node);
void Gecko_DropStyleChildrenIterator(StyleChildrenIteratorOwned it);
RawGeckoNodeBorrowedOrNull Gecko_GetNextStyleChild(StyleChildrenIteratorBorrowedMut it);
+bool Gecko_ElementHasBindingWithAnonymousContent(RawGeckoElementBorrowed element);
// Selector Matching.
uint64_t Gecko_ElementState(RawGeckoElementBorrowed element);
bool Gecko_IsTextNode(RawGeckoNodeBorrowed node);
bool Gecko_IsRootElement(RawGeckoElementBorrowed element);
bool Gecko_MatchesElement(mozilla::CSSPseudoClassType type, RawGeckoElementBorrowed element);
nsIAtom* Gecko_LocalName(RawGeckoElementBorrowed element);
nsIAtom* Gecko_Namespace(RawGeckoElementBorrowed element);