Bug 1369954 - Part 5: Add FFI function for checking whether an element has XBL-created anonymous content. r=emilio
authorCameron McCormack <cam@mcc.id.au>
Fri, 09 Jun 2017 21:18:11 +0800
changeset 411339 dbfc1396ac142914a602236627471722b1d555df
parent 411338 0a3b78002ba3b8d0d1fea4b0ee36c16339e4a904
child 411340 11143139638479ed1b1fcab32f36fb5218cea863
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1369954
milestone55.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 1369954 - Part 5: Add FFI function for checking whether an element has XBL-created anonymous content. r=emilio MozReview-Commit-ID: 2ZXyBzxkfsA
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
--- 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);