Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Unified Diff: third_party/WebKit/Source/core/editing/VisibleSelection.h

Issue 1630903005: Introduce SelectionAdjuster to adjust selections between DOM tree version and composed tree version (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-01-26T18:27:24 Update selection type in SelectionEditor Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/VisibleSelection.h
diff --git a/third_party/WebKit/Source/core/editing/VisibleSelection.h b/third_party/WebKit/Source/core/editing/VisibleSelection.h
index 2a678279ed7fe7e8c0241e62f86c6ca88c6c70fc..9ece79726d5d6c2095e350c96e878dd7c410c4c4 100644
--- a/third_party/WebKit/Source/core/editing/VisibleSelection.h
+++ b/third_party/WebKit/Source/core/editing/VisibleSelection.h
@@ -39,6 +39,7 @@
namespace blink {
class LayoutPoint;
+class SelectionAdjuster;
// TODO(yosin) We should use capitalized name instead of |SEL_DEFAULT_AFFINITY|.
const TextAffinity SEL_DEFAULT_AFFINITY = TextAffinity::Downstream; // NOLINT
@@ -74,8 +75,6 @@ public:
explicit VisibleSelectionTemplate(const PositionWithAffinityTemplate<Strategy>&, bool isDirectional = false);
- static VisibleSelectionTemplate<Strategy> createWithoutValidation(const PositionTemplate<Strategy>& base, const PositionTemplate<Strategy>& extent, const PositionTemplate<Strategy>& start, const PositionTemplate<Strategy>& end, TextAffinity, bool isDirectional);
-
VisibleSelectionTemplate(const VisibleSelectionTemplate&);
VisibleSelectionTemplate& operator=(const VisibleSelectionTemplate&);
@@ -165,7 +164,7 @@ public:
void setEndRespectingGranularity(TextGranularity, EWordSide = RightWordIfOnBoundary);
private:
- VisibleSelectionTemplate(const PositionTemplate<Strategy>& base, const PositionTemplate<Strategy>& extent, const PositionTemplate<Strategy>& start, const PositionTemplate<Strategy>& end, TextAffinity, bool isDirectional);
+ friend class SelectionAdjuster;
void validate(TextGranularity = CharacterGranularity);
@@ -207,6 +206,16 @@ extern template class CORE_EXTERN_TEMPLATE_EXPORT VisibleSelectionTemplate<Editi
using VisibleSelection = VisibleSelectionTemplate<EditingStrategy>;
using VisibleSelectionInComposedTree = VisibleSelectionTemplate<EditingInComposedTreeStrategy>;
+// TODO(yosin): We should move |SelectionAdjuster| to its own file.
+class SelectionAdjuster final {
+ STATIC_ONLY(SelectionAdjuster);
+public:
+ static void adjustSelectionInComposedTree(VisibleSelectionInComposedTree*, const VisibleSelection&);
+ static void adjustSelectionInDOMTree(VisibleSelection*, const VisibleSelectionInComposedTree&);
+ static void adjustSelectionToAvoidCrossingShadowBoundaries(VisibleSelection*);
+ static void adjustSelectionToAvoidCrossingShadowBoundaries(VisibleSelectionInComposedTree*);
+};
+
// TODO(yosin): We should use |operator==()| instead of
// |equalSelectionsInDOMTree()|.
bool equalSelectionsInDOMTree(const VisibleSelection&, const VisibleSelection&);

Powered by Google App Engine
This is Rietveld 408576698