summaryrefslogtreecommitdiffstats
path: root/layout/generic/nsFrameSelection.cpp
diff options
context:
space:
mode:
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);
}