Bug 1308234 - Fix signatures of Servo_ functions to match servo glue; r?heycam draft
authorManish Goregaokar <manishsmail@gmail.com>
Thu, 06 Oct 2016 20:58:01 +0530
changeset 421707 f0040bfb7c342b7762b82cae14a6ead66ecad5b9
parent 419992 b193834a94b6804ac1499294b35f8f573d7cc010
child 533142 488653b9f3fe81a0971a1801b3e7f33573991ce1
push id31568
push userbmo:manishearth@gmail.com
push dateThu, 06 Oct 2016 17:14:11 +0000
reviewersheycam
bugs1308234
milestone52.0a1
Bug 1308234 - Fix signatures of Servo_ functions to match servo glue; r?heycam MozReview-Commit-ID: K0k93JoFVKb
dom/base/nsINode.cpp
dom/base/nsINode.h
layout/style/ServoBindingList.h
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -1402,16 +1402,25 @@ nsINode::UnoptimizableCCNode() const
                                       NODE_IS_IN_SHADOW_TREE);
   return HasFlag(problematicFlags) ||
          NodeType() == nsIDOMNode::ATTRIBUTE_NODE ||
          // For strange cases like xbl:content/xbl:children
          (IsElement() &&
           AsElement()->IsInNamespace(kNameSpaceID_XBL));
 }
 
+void
+nsINode::ClearServoData() {
+#ifdef MOZ_STYLO
+  Servo_Node_ClearNodeData(this);
+#else
+  MOZ_CRASH("Accessing servo node data in non-stylo build");
+#endif
+}
+
 /* static */
 bool
 nsINode::Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb)
 {
   if (MOZ_LIKELY(!cb.WantAllTraces())) {
     nsIDocument *currentDoc = tmp->GetUncomposedDoc();
     if (currentDoc &&
         nsCCUncollectableMarker::InGeneration(currentDoc->GetMarkedCCGeneration())) {
--- a/dom/base/nsINode.h
+++ b/dom/base/nsINode.h
@@ -49,18 +49,16 @@ class nsINode;
 class nsINodeList;
 class nsIPresShell;
 class nsIPrincipal;
 class nsIURI;
 class nsNodeSupportsWeakRefTearoff;
 class nsNodeWeakReference;
 class nsDOMMutationObserver;
 
-extern "C" void Servo_Node_ClearNodeData(nsINode*);
-
 namespace mozilla {
 class EventListenerManager;
 namespace dom {
 /**
  * @return true if aChar is what the DOM spec defines as 'space character'.
  * http://dom.spec.whatwg.org/#space-character
  */
 inline bool IsSpaceCharacter(char16_t aChar) {
@@ -2080,23 +2078,17 @@ public:
   bool HasServoData() {
 #ifdef MOZ_STYLO
     return !!mServoData.Get();
 #else
     MOZ_CRASH("Accessing servo node data in non-stylo build");
 #endif
   }
 
-  void ClearServoData() {
-#ifdef MOZ_STYLO
-    Servo_Node_ClearNodeData(this);
-#else
-    MOZ_CRASH("Accessing servo node data in non-stylo build");
-#endif
-  }
+  void ClearServoData();
 
 protected:
   static bool Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb);
   static void Unlink(nsINode *tmp);
 
   RefPtr<mozilla::dom::NodeInfo> mNodeInfo;
 
   // mParent is an owning ref most of the time, except for the case of document
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -14,17 +14,17 @@
  * and the parameter list of the function.
  *
  * Users of this list should define a macro
  * SERVO_BINDING_FUNC(name_, return_, ...)
  * before including this file.
  */
 
 // Node data
-SERVO_BINDING_FUNC(Servo_Node_ClearNodeData, void, RawGeckoNode* node)
+SERVO_BINDING_FUNC(Servo_Node_ClearNodeData, void, RawGeckoNodeBorrowed node)
 
 // Styleset and Stylesheet management
 SERVO_BINDING_FUNC(Servo_StyleSheet_FromUTF8Bytes, RawServoStyleSheetStrong,
                    const uint8_t* bytes, uint32_t length,
                    mozilla::css::SheetParsingMode parsing_mode,
                    const uint8_t* base_bytes, uint32_t base_length,
                    ThreadSafeURIHolder* base,
                    ThreadSafeURIHolder* referrer,
@@ -88,22 +88,22 @@ SERVO_BINDING_FUNC(Servo_ComputedValues_
 
 // Initialize Servo components. Should be called exactly once at startup.
 SERVO_BINDING_FUNC(Servo_Initialize, void)
 // Shut down Servo components. Should be called exactly once at shutdown.
 SERVO_BINDING_FUNC(Servo_Shutdown, void)
 
 // Restyle hints
 SERVO_BINDING_FUNC(Servo_ComputeRestyleHint, nsRestyleHint,
-                   RawGeckoElement* element, ServoElementSnapshot* snapshot,
+                   RawGeckoElementBorrowed element, ServoElementSnapshot* snapshot,
                    RawServoStyleSetBorrowed set)
 
 // Restyle the given subtree.
 SERVO_BINDING_FUNC(Servo_RestyleSubtree, void,
                    RawGeckoNodeBorrowed node, RawServoStyleSetBorrowedMut set)
 
 // Style-struct management.
 #define STYLE_STRUCT(name, checkdata_cb)                            \
   struct nsStyle##name;                                             \
   SERVO_BINDING_FUNC(Servo_GetStyle##name, const nsStyle##name*,  \
-                     ServoComputedValuesBorrowed computed_values)
+                     ServoComputedValuesBorrowedOrNull computed_values)
 #include "nsStyleStructList.h"
 #undef STYLE_STRUCT