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

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

Issue 1309413006: Move VisibleSelection::ChangeObserver out from VisibleSelection class (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-09-04T15:50:42 Created 5 years, 3 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
« no previous file with comments | « Source/core/editing/FrameSelection.cpp ('k') | Source/core/editing/VisibleSelection.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/VisibleSelection.h
diff --git a/Source/core/editing/VisibleSelection.h b/Source/core/editing/VisibleSelection.h
index 4aa7f7249f4faf78eae51a24eac1c79dbf1aca9f..823a96220673f7d7fd00e1964244af005a0e8b20 100644
--- a/Source/core/editing/VisibleSelection.h
+++ b/Source/core/editing/VisibleSelection.h
@@ -44,6 +44,21 @@ class LayoutPoint;
const TextAffinity SEL_DEFAULT_AFFINITY = TextAffinity::Downstream; // NOLINT
enum SelectionDirection { DirectionForward, DirectionBackward, DirectionRight, DirectionLeft };
+// Listener of |VisibleSelection| modification. |didChangeVisibleSelection()|
+// will be invoked when base, extent, start or end is moved to a different
+// position.
+//
+// Objects implementing |VisibleSelectionChangeObserver| interface must outlive
+// the |VisibleSelection| object.
+class CORE_EXPORT VisibleSelectionChangeObserver : public WillBeGarbageCollectedMixin {
+ WTF_MAKE_NONCOPYABLE(VisibleSelectionChangeObserver);
+public:
+ VisibleSelectionChangeObserver();
+ virtual ~VisibleSelectionChangeObserver();
+ virtual void didChangeVisibleSelection() = 0;
+ DEFINE_INLINE_VIRTUAL_TRACE() { }
+};
+
class CORE_EXPORT VisibleSelection {
DISALLOW_ALLOCATION();
DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(VisibleSelection);
@@ -174,20 +189,7 @@ public:
void setWithoutValidation(const Position&, const Position&);
void setWithoutValidation(const PositionInComposedTree&, const PositionInComposedTree&);
- // Listener of VisibleSelection modification. didChangeVisibleSelection() will be invoked when base, extent, start
- // or end is moved to a different position.
- //
- // Objects implementing |ChangeObserver| interface must outlive the VisibleSelection object.
- class CORE_EXPORT ChangeObserver : public WillBeGarbageCollectedMixin {
- WTF_MAKE_NONCOPYABLE(ChangeObserver);
- public:
- ChangeObserver();
- virtual ~ChangeObserver();
- virtual void didChangeVisibleSelection() = 0;
- DEFINE_INLINE_VIRTUAL_TRACE() { }
- };
-
- void setChangeObserver(ChangeObserver&);
+ void setChangeObserver(VisibleSelectionChangeObserver&);
void clearChangeObserver();
void didChange(); // Fire the change observer, if any.
@@ -242,7 +244,7 @@ private:
// Oilpan: this reference has a lifetime that is at least as long
// as this object.
- RawPtrWillBeMember<ChangeObserver> m_changeObserver;
+ RawPtrWillBeMember<VisibleSelectionChangeObserver> m_changeObserver;
// these are cached, can be recalculated by validate()
SelectionType m_selectionType; // None, Caret, Range
« no previous file with comments | « Source/core/editing/FrameSelection.cpp ('k') | Source/core/editing/VisibleSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698