From def92d1b8e9d373e2f6f27c366d578d97d8960c6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:34:50 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- dom/base/nsINode.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'dom/base/nsINode.h') diff --git a/dom/base/nsINode.h b/dom/base/nsINode.h index 3a47992cc8..d2a2fd008d 100644 --- a/dom/base/nsINode.h +++ b/dom/base/nsINode.h @@ -1099,7 +1099,7 @@ class nsINode : public mozilla::dom::EventTarget { : nullptr; } - enum FlattenedParentType { eNotForStyle, eForStyle }; + enum FlattenedParentType { eNormal, eForStyle, eForSelection }; /** * Returns the node that is the parent of this node in the flattened @@ -1121,6 +1121,15 @@ class nsINode : public mozilla::dom::EventTarget { */ inline nsINode* GetFlattenedTreeParentNodeForStyle() const; + /** + * Similar to GetFlattenedTreeParentNode, it does two things differently + * 1. For contents that are not in the flattened tree, use its + * parent rather than nullptr. + * 2. For contents that are slotted into a UA shadow tree, use its + * parent rather than the slot element. + */ + inline nsIContent* GetFlattenedTreeParentNodeForSelection() const; + inline mozilla::dom::Element* GetFlattenedTreeParentElement() const; inline mozilla::dom::Element* GetFlattenedTreeParentElementForStyle() const; @@ -1629,7 +1638,7 @@ class nsINode : public mozilla::dom::EventTarget { * not in same subtree, this returns the root content of the closeset subtree. */ MOZ_CAN_RUN_SCRIPT nsIContent* GetSelectionRootContent( - mozilla::PresShell* aPresShell); + mozilla::PresShell* aPresShell, bool aAllowCrossShadowBoundary = false); nsINodeList* ChildNodes(); @@ -2074,6 +2083,14 @@ class nsINode : public mozilla::dom::EventTarget { ClearBoolFlag(ElementCreatedFromPrototypeAndHasUnmodifiedL10n); } + mozilla::dom::ShadowRoot* GetShadowRoot() const; + + // Return the shadow root of the node if it is a shadow host and + // it meets the requirements for being a shadow host of a selection. + // For example,
,