Bug 1337068 - stylo: :empty, :-moz-first-node, :-moz-last-node, and :-moz-only-whitespace. r=emilio draft
authorMatt Brubeck <mbrubeck@mozilla.com>
Wed, 22 Mar 2017 09:18:34 -0700
changeset 502998 fb395492e2e6551d3a9203d2dc87fbbb6c699682
parent 502997 e03e0c60462c775c7558a1dc9d5cf2076c3cd1f9
child 502999 57e2ad20c9c13130239fc4d4b1ff537733a77577
push id50444
push userbmo:mbrubeck@mozilla.com
push dateWed, 22 Mar 2017 16:20:36 +0000
reviewersemilio
bugs1337068
milestone55.0a1
Bug 1337068 - stylo: :empty, :-moz-first-node, :-moz-last-node, and :-moz-only-whitespace. r=emilio MozReview-Commit-ID: 5wEk8OQAFSP
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -83,16 +83,30 @@ bool
 Gecko_FlattenedTreeParentIsParent(RawGeckoNodeBorrowed aNode)
 {
   // Servo calls this in debug builds to verify the result of its own
   // flattened_tree_parent_is_parent() function.
   return FlattenedTreeParentIsParent<nsIContent::eForStyle>(aNode);
 }
 #endif
 
+/*
+ * Does this child count as significant for selector matching?
+ *
+ * See nsStyleUtil::IsSignificantChild for details.
+ */
+bool
+Gecko_IsSignificantChild(RawGeckoNodeBorrowed aNode, bool aTextIsSignificant,
+                         bool aWhitespaceIsSignificant)
+{
+  return nsStyleUtil::ThreadSafeIsSignificantChild(aNode->AsContent(),
+                                                   aTextIsSignificant,
+                                                   aWhitespaceIsSignificant);
+}
+
 RawGeckoNodeBorrowedOrNull
 Gecko_GetParentNode(RawGeckoNodeBorrowed aNode)
 {
   MOZ_ASSERT(!FlattenedTreeParentIsParent<nsIContent::eForStyle>(aNode),
              "Should have taken the inline path");
   MOZ_ASSERT(aNode->IsContent(), "Slow path only applies to content");
   const nsIContent* c = aNode->AsContent();
   return c->GetFlattenedTreeParentNodeInternal(nsIContent::eForStyle);
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -110,16 +110,19 @@ public:
   RefPtr<ThreadSafePrincipalHolder> mPrincipal;
 };
 
 // DOM Traversal.
 uint32_t Gecko_ChildrenCount(RawGeckoNodeBorrowed node);
 bool Gecko_NodeIsElement(RawGeckoNodeBorrowed node);
 bool Gecko_IsInDocument(RawGeckoNodeBorrowed node);
 bool Gecko_FlattenedTreeParentIsParent(RawGeckoNodeBorrowed node);
+bool Gecko_IsSignificantChild(RawGeckoNodeBorrowed node,
+                              bool text_is_significant,
+                              bool whitespace_is_significant);
 RawGeckoNodeBorrowedOrNull Gecko_GetParentNode(RawGeckoNodeBorrowed node);
 RawGeckoNodeBorrowedOrNull Gecko_GetFirstChild(RawGeckoNodeBorrowed node);
 RawGeckoNodeBorrowedOrNull Gecko_GetLastChild(RawGeckoNodeBorrowed node);
 RawGeckoNodeBorrowedOrNull Gecko_GetPrevSibling(RawGeckoNodeBorrowed node);
 RawGeckoNodeBorrowedOrNull Gecko_GetNextSibling(RawGeckoNodeBorrowed node);
 RawGeckoElementBorrowedOrNull Gecko_GetFirstChildElement(RawGeckoElementBorrowed element);
 RawGeckoElementBorrowedOrNull Gecko_GetLastChildElement(RawGeckoElementBorrowed element);
 RawGeckoElementBorrowedOrNull Gecko_GetPrevSiblingElement(RawGeckoElementBorrowed element);