зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1073043 - Fix mouse events trapped in shadow DOM. r=smaug
This commit is contained in:
Родитель
8a4adcbe04
Коммит
a2ff640daa
|
@ -187,6 +187,7 @@ public:
|
|||
|
||||
/**
|
||||
* Returns the parent node of aChild crossing document boundaries.
|
||||
* Uses the parent node in the composed document.
|
||||
*/
|
||||
static nsINode* GetCrossDocParentNode(nsINode* aChild);
|
||||
|
||||
|
@ -217,7 +218,8 @@ public:
|
|||
|
||||
/**
|
||||
* Similar to ContentIsDescendantOf except it crosses document boundaries,
|
||||
* also crosses ShadowRoot boundaries from ShadowRoot to its host.
|
||||
* this function uses ancestor/descendant relations in the composed document
|
||||
* (see shadow DOM spec).
|
||||
*/
|
||||
static bool ContentIsCrossDocDescendantOf(nsINode* aPossibleDescendant,
|
||||
nsINode* aPossibleAncestor);
|
||||
|
|
|
@ -2025,6 +2025,10 @@ nsContentUtils::GetCrossDocParentNode(nsINode* aChild)
|
|||
NS_PRECONDITION(aChild, "The child is null!");
|
||||
|
||||
nsINode* parent = aChild->GetParentNode();
|
||||
if (parent && parent->IsContent() && aChild->IsContent()) {
|
||||
parent = aChild->AsContent()->GetFlattenedTreeParent();
|
||||
}
|
||||
|
||||
if (parent || !aChild->IsNodeOfType(nsINode::eDOCUMENT))
|
||||
return parent;
|
||||
|
||||
|
@ -2083,12 +2087,6 @@ nsContentUtils::ContentIsCrossDocDescendantOf(nsINode* aPossibleDescendant,
|
|||
if (aPossibleDescendant == aPossibleAncestor)
|
||||
return true;
|
||||
|
||||
// Step over shadow root to the host node.
|
||||
ShadowRoot* shadowRoot = ShadowRoot::FromNode(aPossibleDescendant);
|
||||
if (shadowRoot) {
|
||||
aPossibleDescendant = shadowRoot->GetHost();
|
||||
}
|
||||
|
||||
aPossibleDescendant = GetCrossDocParentNode(aPossibleDescendant);
|
||||
} while (aPossibleDescendant);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче