summaryrefslogtreecommitdiffstats
path: root/layout/generic/nsFrameSelection.h
diff options
context:
space:
mode:
Diffstat (limited to 'layout/generic/nsFrameSelection.h')
-rw-r--r--layout/generic/nsFrameSelection.h32
1 files changed, 22 insertions, 10 deletions
diff --git a/layout/generic/nsFrameSelection.h b/layout/generic/nsFrameSelection.h
index e8c55d53b5..3ba6fa72ca 100644
--- a/layout/generic/nsFrameSelection.h
+++ b/layout/generic/nsFrameSelection.h
@@ -200,6 +200,7 @@ class SelectionChangeEventDispatcher;
namespace dom {
class Highlight;
class Selection;
+enum class ClickSelectionType { NotApplicable, Double, Triple };
} // namespace dom
/**
@@ -259,14 +260,17 @@ class nsFrameSelection final {
public:
/**
- * Sets flag to true if a selection is created by doubleclick or
- * long tapping a word.
+ * Sets the type of the selection based on whether a selection is created
+ * by doubleclick, long tapping a word or tripleclick.
*
- * @param aIsDoubleClickSelection True if the selection is created by
- * doubleclick or long tap over a word.
+ * @param aClickSelectionType ClickSelectionType::Double if the selection
+ * is created by doubleclick,
+ * ClickSelectionType::Triple if the selection
+ * is created by tripleclick.
*/
- void SetIsDoubleClickSelection(bool aIsDoubleClickSelection) {
- mIsDoubleClickSelection = aIsDoubleClickSelection;
+ void SetClickSelectionType(
+ mozilla::dom::ClickSelectionType aClickSelectionType) {
+ mClickSelectionType = aClickSelectionType;
}
/**
@@ -274,7 +278,14 @@ class nsFrameSelection final {
* long tap over a word.
*/
[[nodiscard]] bool IsDoubleClickSelection() const {
- return mIsDoubleClickSelection;
+ return mClickSelectionType == mozilla::dom::ClickSelectionType::Double;
+ }
+
+ /**
+ * Returns true if the selection was created by triple click
+ */
+ [[nodiscard]] bool IsTripleClickSelection() const {
+ return mClickSelectionType == mozilla::dom::ClickSelectionType::Triple;
}
/**
@@ -1102,11 +1113,12 @@ class nsFrameSelection final {
bool mDragState = false; // for drag purposes
bool mAccessibleCaretEnabled = false;
- // Records if a selection was created by doubleclicking a word.
- // This information is needed later on to determine if a leading
+ // Records if a selection was created by doubleclicking or tripleclicking
+ // a word. This information is needed later on to determine if a leading
// or trailing whitespace needs to be removed as well to achieve
// native behaviour on macOS.
- bool mIsDoubleClickSelection{false};
+ mozilla::dom::ClickSelectionType mClickSelectionType =
+ mozilla::dom::ClickSelectionType::NotApplicable;
};
/**