summaryrefslogtreecommitdiffstats
path: root/layout/generic/nsFrameSelection.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /layout/generic/nsFrameSelection.cpp
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/generic/nsFrameSelection.cpp')
-rw-r--r--layout/generic/nsFrameSelection.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/layout/generic/nsFrameSelection.cpp b/layout/generic/nsFrameSelection.cpp
index f1a8c7e27c..ca4e3d647e 100644
--- a/layout/generic/nsFrameSelection.cpp
+++ b/layout/generic/nsFrameSelection.cpp
@@ -156,9 +156,10 @@ PeekOffsetStruct::PeekOffsetStruct(nsSelectionAmount aAmount,
} // namespace mozilla
-// Array which contains index of each SelecionType in Selection::mDOMSelections.
-// For avoiding using if nor switch to retrieve the index, this needs to have
-// -1 for SelectionTypes which won't be created its Selection instance.
+// Array which contains index of each SelectionType in
+// Selection::mDOMSelections. For avoiding using if nor switch to retrieve the
+// index, this needs to have -1 for SelectionTypes which won't be created its
+// Selection instance.
static const int8_t kIndexOfSelections[] = {
-1, // SelectionType::eInvalid
-1, // SelectionType::eNone
@@ -172,6 +173,7 @@ static const int8_t kIndexOfSelections[] = {
7, // SelectionType::eFind
8, // SelectionType::eURLSecondary
9, // SelectionType::eURLStrikeout
+ 10, // SelectionType::eTargetText
-1, // SelectionType::eHighlight
};
@@ -539,7 +541,11 @@ nsresult nsFrameSelection::ConstrainFrameAndPointToAnchorSubtree(
NS_ENSURE_STATE(mPresShell);
RefPtr<PresShell> presShell = mPresShell;
- nsIContent* anchorRoot = anchorContent->GetSelectionRootContent(presShell);
+ nsIContent* anchorRoot =
+ anchorContent
+ ->GetSelectionRootContent(
+ presShell,
+ StaticPrefs::dom_shadowdom_selection_across_boundary_enabled() /* aAllowCrossShadowBoundary */);
NS_ENSURE_TRUE(anchorRoot, NS_ERROR_UNEXPECTED);
//
@@ -549,7 +555,10 @@ nsresult nsFrameSelection::ConstrainFrameAndPointToAnchorSubtree(
nsCOMPtr<nsIContent> content = aFrame->GetContent();
if (content) {
- nsIContent* contentRoot = content->GetSelectionRootContent(presShell);
+ nsIContent* contentRoot =
+ content->GetSelectionRootContent(
+ presShell, StaticPrefs::
+ dom_shadowdom_selection_across_boundary_enabled() /* aAllowCrossShadowBoundary */);
NS_ENSURE_TRUE(contentRoot, NS_ERROR_UNEXPECTED);
if (anchorRoot == contentRoot) {
@@ -573,8 +582,9 @@ nsresult nsFrameSelection::ConstrainFrameAndPointToAnchorSubtree(
if (cursorFrame && cursorFrame->PresShell() == presShell) {
nsCOMPtr<nsIContent> cursorContent = cursorFrame->GetContent();
NS_ENSURE_TRUE(cursorContent, NS_ERROR_FAILURE);
- nsIContent* cursorContentRoot =
- cursorContent->GetSelectionRootContent(presShell);
+ nsIContent* cursorContentRoot = cursorContent->GetSelectionRootContent(
+ presShell, StaticPrefs::
+ dom_shadowdom_selection_across_boundary_enabled() /* aAllowCrossShadowBoundary */);
NS_ENSURE_TRUE(cursorContentRoot, NS_ERROR_UNEXPECTED);
if (cursorContentRoot == anchorRoot) {
*aRetFrame = cursorFrame;
@@ -1493,11 +1503,11 @@ void nsFrameSelection::SetDragState(bool aState) {
// Notify that reason is mouse up.
SetChangeReasons(nsISelectionListener::MOUSEUP_REASON);
- // flag is set to false in `NotifySelectionListeners`.
+ // flag is set to NotApplicable in `Selection::NotifySelectionListeners`.
// since this function call is part of click event, this would immediately
// reset the flag, rendering it useless.
- AutoRestore<bool> restoreIsDoubleClickSelectionFlag(
- mIsDoubleClickSelection);
+ AutoRestore<ClickSelectionType> restoreClickSelectionType(
+ mClickSelectionType);
// Be aware, the Selection instance may be destroyed after this call.
NotifySelectionListeners(SelectionType::eNormal);
}