Loading dom/base/nsINode.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include "mozilla/InternalMutationEvent.h" #include "mozilla/Likely.h" #include "mozilla/MemoryReporting.h" #include "mozilla/ServoBindings.h" #include "mozilla/Telemetry.h" #include "mozilla/TimeStamp.h" #include "mozilla/css/StyleRule.h" Loading Loading @@ -148,6 +149,12 @@ nsINode::~nsINode() { MOZ_ASSERT(!HasSlots(), "nsNodeUtils::LastRelease was not called?"); MOZ_ASSERT(mSubtreeRoot == this, "Didn't restore state properly?"); #ifdef MOZ_STYLO if (mServoNodeData) { Servo_DropNodeData(mServoNodeData); } #endif } void* Loading dom/base/nsINode.h +34 −8 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ class nsIURI; class nsNodeSupportsWeakRefTearoff; class nsNodeWeakReference; class nsDOMMutationObserver; struct ServoNodeData; namespace mozilla { class EventListenerManager; Loading Loading @@ -313,14 +314,17 @@ public: #ifdef MOZILLA_INTERNAL_API explicit nsINode(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo) : mNodeInfo(aNodeInfo), mParent(nullptr), mBoolFlags(0), mNextSibling(nullptr), mPreviousSibling(nullptr), mFirstChild(nullptr), mSubtreeRoot(this), mSlots(nullptr) : mNodeInfo(aNodeInfo) , mParent(nullptr) , mBoolFlags(0) , mNextSibling(nullptr) , mPreviousSibling(nullptr) , mFirstChild(nullptr) , mSubtreeRoot(this) , mSlots(nullptr) #ifdef MOZ_STYLO , mServoNodeData(nullptr) #endif { } #endif Loading Loading @@ -1971,6 +1975,23 @@ public: #undef TOUCH_EVENT #undef EVENT ServoNodeData* GetServoNodeData() { #ifdef MOZ_STYLO return mServoNodeData; #else MOZ_CRASH("Accessing servo node data in non-stylo build"); #endif } void SetServoNodeData(ServoNodeData* aData) { #ifdef MOZ_STYLO MOZ_ASSERT(!mServoNodeData); mServoNodeData = aData; #else MOZ_CRASH("Setting servo node data in non-stylo build"); #endif } protected: static bool Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb); static void Unlink(nsINode *tmp); Loading Loading @@ -2008,6 +2029,11 @@ protected: // Storage for more members that are usually not needed; allocated lazily. nsSlots* mSlots; #ifdef MOZ_STYLO // Layout data managed by Servo. ServoNodeData* mServoNodeData; #endif }; inline nsIDOMNode* GetAsDOMNode(nsINode* aNode) Loading layout/style/ServoBindings.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -129,3 +129,14 @@ Gecko_IsRootElement(RawGeckoElement* aElement) return aElement->OwnerDoc()->GetRootElement() == aElement; } ServoNodeData* Gecko_GetNodeData(RawGeckoNode* aNode) { return aNode->GetServoNodeData(); } void Gecko_SetNodeData(RawGeckoNode* aNode, ServoNodeData* aData) { aNode->SetServoNodeData(aData); } layout/style/ServoBindings.h +8 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ using mozilla::dom::Element; typedef mozilla::dom::Element RawGeckoElement; class nsIDocument; typedef nsIDocument RawGeckoDocument; struct ServoNodeData; #else struct RawGeckoNode; typedef struct RawGeckoNode RawGeckoNode; Loading @@ -32,6 +33,8 @@ struct RawGeckoElement; typedef struct RawGeckoElement RawGeckoElement; struct RawGeckoDocument; typedef struct RawGeckoDocument RawGeckoDocument; struct ServoNodeData; typedef struct ServoNodeData ServoNodeData; #endif #ifdef __cplusplus Loading Loading @@ -61,6 +64,11 @@ int Gecko_IsVisitedLink(RawGeckoElement* element); int Gecko_IsUnvisitedLink(RawGeckoElement* element); int Gecko_IsRootElement(RawGeckoElement* element); // Node data. ServoNodeData* Gecko_GetNodeData(RawGeckoNode* node); void Gecko_SetNodeData(RawGeckoNode* node, ServoNodeData* data); void Servo_DropNodeData(ServoNodeData* data); // Servo API. void Servo_RestyleDocument(RawGeckoDocument* aDoc); Loading Loading
dom/base/nsINode.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include "mozilla/InternalMutationEvent.h" #include "mozilla/Likely.h" #include "mozilla/MemoryReporting.h" #include "mozilla/ServoBindings.h" #include "mozilla/Telemetry.h" #include "mozilla/TimeStamp.h" #include "mozilla/css/StyleRule.h" Loading Loading @@ -148,6 +149,12 @@ nsINode::~nsINode() { MOZ_ASSERT(!HasSlots(), "nsNodeUtils::LastRelease was not called?"); MOZ_ASSERT(mSubtreeRoot == this, "Didn't restore state properly?"); #ifdef MOZ_STYLO if (mServoNodeData) { Servo_DropNodeData(mServoNodeData); } #endif } void* Loading
dom/base/nsINode.h +34 −8 Original line number Diff line number Diff line Loading @@ -51,6 +51,7 @@ class nsIURI; class nsNodeSupportsWeakRefTearoff; class nsNodeWeakReference; class nsDOMMutationObserver; struct ServoNodeData; namespace mozilla { class EventListenerManager; Loading Loading @@ -313,14 +314,17 @@ public: #ifdef MOZILLA_INTERNAL_API explicit nsINode(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo) : mNodeInfo(aNodeInfo), mParent(nullptr), mBoolFlags(0), mNextSibling(nullptr), mPreviousSibling(nullptr), mFirstChild(nullptr), mSubtreeRoot(this), mSlots(nullptr) : mNodeInfo(aNodeInfo) , mParent(nullptr) , mBoolFlags(0) , mNextSibling(nullptr) , mPreviousSibling(nullptr) , mFirstChild(nullptr) , mSubtreeRoot(this) , mSlots(nullptr) #ifdef MOZ_STYLO , mServoNodeData(nullptr) #endif { } #endif Loading Loading @@ -1971,6 +1975,23 @@ public: #undef TOUCH_EVENT #undef EVENT ServoNodeData* GetServoNodeData() { #ifdef MOZ_STYLO return mServoNodeData; #else MOZ_CRASH("Accessing servo node data in non-stylo build"); #endif } void SetServoNodeData(ServoNodeData* aData) { #ifdef MOZ_STYLO MOZ_ASSERT(!mServoNodeData); mServoNodeData = aData; #else MOZ_CRASH("Setting servo node data in non-stylo build"); #endif } protected: static bool Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb); static void Unlink(nsINode *tmp); Loading Loading @@ -2008,6 +2029,11 @@ protected: // Storage for more members that are usually not needed; allocated lazily. nsSlots* mSlots; #ifdef MOZ_STYLO // Layout data managed by Servo. ServoNodeData* mServoNodeData; #endif }; inline nsIDOMNode* GetAsDOMNode(nsINode* aNode) Loading
layout/style/ServoBindings.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -129,3 +129,14 @@ Gecko_IsRootElement(RawGeckoElement* aElement) return aElement->OwnerDoc()->GetRootElement() == aElement; } ServoNodeData* Gecko_GetNodeData(RawGeckoNode* aNode) { return aNode->GetServoNodeData(); } void Gecko_SetNodeData(RawGeckoNode* aNode, ServoNodeData* aData) { aNode->SetServoNodeData(aData); }
layout/style/ServoBindings.h +8 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ using mozilla::dom::Element; typedef mozilla::dom::Element RawGeckoElement; class nsIDocument; typedef nsIDocument RawGeckoDocument; struct ServoNodeData; #else struct RawGeckoNode; typedef struct RawGeckoNode RawGeckoNode; Loading @@ -32,6 +33,8 @@ struct RawGeckoElement; typedef struct RawGeckoElement RawGeckoElement; struct RawGeckoDocument; typedef struct RawGeckoDocument RawGeckoDocument; struct ServoNodeData; typedef struct ServoNodeData ServoNodeData; #endif #ifdef __cplusplus Loading Loading @@ -61,6 +64,11 @@ int Gecko_IsVisitedLink(RawGeckoElement* element); int Gecko_IsUnvisitedLink(RawGeckoElement* element); int Gecko_IsRootElement(RawGeckoElement* element); // Node data. ServoNodeData* Gecko_GetNodeData(RawGeckoNode* node); void Gecko_SetNodeData(RawGeckoNode* node, ServoNodeData* data); void Servo_DropNodeData(ServoNodeData* data); // Servo API. void Servo_RestyleDocument(RawGeckoDocument* aDoc); Loading