mirror of
https://github.com/ManchildProductions/UXP-Fixed.git
synced 2026-06-28 10:18:48 +00:00
Bug 1466991 - Part 1: Factor out ShouldUseXBLScope.
This commit is contained in:
+17
-1
@@ -3439,13 +3439,29 @@ nsINode::OwnerDocAsNode() const
|
||||
return OwnerDoc();
|
||||
}
|
||||
|
||||
// ShouldUseXBLScope is defined here as a template so that we can get the faster
|
||||
// version of IsInAnonymousSubtree if we're statically known to be an
|
||||
// nsIContent. we could try defining ShouldUseXBLScope separately on nsINode
|
||||
// and nsIContent, but then we couldn't put its nsINode implementation here
|
||||
// (because this header does not include nsIContent) and we can't put it in
|
||||
// nsIContent.h, because the definition of nsIContent::IsInAnonymousSubtree is
|
||||
// in nsIContentInlines.h. And then we get include hell from people trying to
|
||||
// call nsINode::GetParentObject but not including nsIContentInlines.h and with
|
||||
// no really good way to include it.
|
||||
template<typename T>
|
||||
inline bool ShouldUseXBLScope(const T* aNode)
|
||||
{
|
||||
return aNode->IsInAnonymousSubtree() &&
|
||||
!aNode->IsAnonymousContentInSVGUseSubtree();
|
||||
}
|
||||
|
||||
inline mozilla::dom::ParentObject
|
||||
nsINode::GetParentObject() const
|
||||
{
|
||||
mozilla::dom::ParentObject p(OwnerDoc());
|
||||
// Note that mUseXBLScope is a no-op for chrome, and other places where we
|
||||
// don't use XBL scopes.
|
||||
p.mUseXBLScope = IsInAnonymousSubtree() && !IsAnonymousContentInSVGUseSubtree();
|
||||
p.mUseXBLScope = ShouldUseXBLScope(this);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user