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

Unified Diff: third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h

Issue 2692093003: Rewrite DocumentMarkerController to use SynchronousMutationObserver (Closed)
Patch Set: Fix didShiftMarker assignment and remove removeZeroLengthMarkers() from header Created 3 years, 10 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/markers/DocumentMarkerController.h
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h
index 34d0f267b06cb3f836c2f8884d7bec74da9cde96..02ae47854a4e1dfadc2aa8c6d3e4b36aa1e151f1 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerController.h
@@ -30,6 +30,7 @@
#define DocumentMarkerController_h
#include "core/CoreExport.h"
+#include "core/dom/SynchronousMutationObserver.h"
#include "core/editing/iterators/TextIterator.h"
#include "core/editing/markers/DocumentMarker.h"
#include "platform/geometry/IntRect.h"
@@ -53,11 +54,13 @@ class MarkerRemoverPredicate final {
};
class CORE_EXPORT DocumentMarkerController final
- : public GarbageCollected<DocumentMarkerController> {
+ : public GarbageCollected<DocumentMarkerController>,
+ public SynchronousMutationObserver {
WTF_MAKE_NONCOPYABLE(DocumentMarkerController);
+ USING_GARBAGE_COLLECTED_MIXIN(DocumentMarkerController);
public:
- explicit DocumentMarkerController(const Document&);
+ explicit DocumentMarkerController(Document&);
void clear();
void addMarker(const Position& start,
@@ -106,7 +109,6 @@ class CORE_EXPORT DocumentMarkerController final
void removeMarkers(const MarkerRemoverPredicate& shouldRemoveMarker);
void repaintMarkers(
DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers());
- void shiftMarkers(Node*, unsigned startOffset, int delta);
// Returns true if markers within a range are found.
bool setMarkersActive(const EphemeralRange&, bool);
// Returns true if markers within a range defined by a node, |startOffset| and
@@ -131,6 +133,12 @@ class CORE_EXPORT DocumentMarkerController final
void showMarkers() const;
#endif
+ // SynchronousMutationObserver
+ void didUpdateCharacterData(CharacterData*,
+ unsigned offset,
+ unsigned oldLength,
+ unsigned newLength) override;
yosin_UTC9 2017/02/24 04:36:18 nit: s/override/final/
+
private:
void addMarker(Node*, const DocumentMarker&);

Powered by Google App Engine
This is Rietveld 408576698