Bug 1322570 Part 1 - Add MOZ_ASSERT in nsStyleContext::GetParent() to disallow usage by stylo.
Also, add GetParentAllowServo() to whitelist the usage in servo-backed style
system in subsequent parts so that we could revisit them later.
MozReview-Commit-ID: JthU18Ftx02
--- a/layout/style/nsStyleContext.h
+++ b/layout/style/nsStyleContext.h
@@ -158,17 +158,25 @@ public:
nsPresContext* PresContext() const {
#ifdef MOZ_STYLO
return mPresContext;
#else
return mSource.AsGeckoRuleNode()->PresContext();
#endif
}
- nsStyleContext* GetParent() const { return mParent; }
+ nsStyleContext* GetParent() const {
+ MOZ_ASSERT(mSource.IsGeckoRuleNode(),
+ "This should be used only in Gecko-backed style system!");
+ return mParent;
+ }
+
+ nsStyleContext* GetParentAllowServo() const {
+ return mParent;
+ }
nsIAtom* GetPseudo() const { return mPseudoTag; }
mozilla::CSSPseudoElementType GetPseudoType() const {
return static_cast<mozilla::CSSPseudoElementType>(
mBits >> NS_STYLE_CONTEXT_TYPE_SHIFT);
}
bool IsAnonBox() const {