diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-09-11 15:33:44 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-09-11 15:33:44 +0200 |
commit | a6d4e65dbfccc77c027bd827f3ea6be0e8df2838 (patch) | |
tree | 2762d493a9b8ad96268f5a5f60be86e9c9866293 /dom/base | |
parent | 9830cd079d8306abc223461190553af64b6fd0ca (diff) | |
download | UXP-a6d4e65dbfccc77c027bd827f3ea6be0e8df2838.tar UXP-a6d4e65dbfccc77c027bd827f3ea6be0e8df2838.tar.gz UXP-a6d4e65dbfccc77c027bd827f3ea6be0e8df2838.tar.lz UXP-a6d4e65dbfccc77c027bd827f3ea6be0e8df2838.tar.xz UXP-a6d4e65dbfccc77c027bd827f3ea6be0e8df2838.zip |
Bug 1466991 - Part 1: Factor out ShouldUseXBLScope.
Diffstat (limited to 'dom/base')
-rw-r--r-- | dom/base/nsIDocument.h | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h index 7a73fae71..e5d12ab8f 100644 --- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -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; } |