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

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

Issue 2833753004: [DMC #1.915] Refactor DocumentMarkerController::RemoveMarkers(const MarkerRemoverPredicate&) (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
7 * reserved. 7 * reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
(...skipping 24 matching lines...) Expand all
35 #include "core/editing/markers/DocumentMarker.h" 35 #include "core/editing/markers/DocumentMarker.h"
36 #include "platform/geometry/IntRect.h" 36 #include "platform/geometry/IntRect.h"
37 #include "platform/heap/Handle.h" 37 #include "platform/heap/Handle.h"
38 #include "platform/wtf/HashMap.h" 38 #include "platform/wtf/HashMap.h"
39 #include "platform/wtf/Vector.h" 39 #include "platform/wtf/Vector.h"
40 40
41 namespace blink { 41 namespace blink {
42 42
43 class Node; 43 class Node;
44 class RenderedDocumentMarker; 44 class RenderedDocumentMarker;
45 class Text;
46
47 class MarkerRemoverPredicate final {
48 public:
49 explicit MarkerRemoverPredicate(const Vector<String>& words);
50 bool operator()(const DocumentMarker&, const Text&) const;
51
52 private:
53 Vector<String> words_;
54 };
55 45
56 class CORE_EXPORT DocumentMarkerController final 46 class CORE_EXPORT DocumentMarkerController final
57 : public GarbageCollected<DocumentMarkerController>, 47 : public GarbageCollected<DocumentMarkerController>,
58 public SynchronousMutationObserver { 48 public SynchronousMutationObserver {
59 WTF_MAKE_NONCOPYABLE(DocumentMarkerController); 49 WTF_MAKE_NONCOPYABLE(DocumentMarkerController);
60 USING_GARBAGE_COLLECTED_MIXIN(DocumentMarkerController); 50 USING_GARBAGE_COLLECTED_MIXIN(DocumentMarkerController);
61 51
62 public: 52 public:
63 explicit DocumentMarkerController(Document&); 53 explicit DocumentMarkerController(Document&);
64 54
(...skipping 10 matching lines...) Expand all
75 Color background_color); 65 Color background_color);
76 66
77 void MoveMarkers(Node* src_node, int length, Node* dst_node); 67 void MoveMarkers(Node* src_node, int length, Node* dst_node);
78 68
79 void PrepareForDestruction(); 69 void PrepareForDestruction();
80 void RemoveMarkersInRange(const EphemeralRange&, DocumentMarker::MarkerTypes); 70 void RemoveMarkersInRange(const EphemeralRange&, DocumentMarker::MarkerTypes);
81 void RemoveAllMarkers(DocumentMarker::MarkerTypes); 71 void RemoveAllMarkers(DocumentMarker::MarkerTypes);
82 void RemoveMarkersForNode( 72 void RemoveMarkersForNode(
83 Node*, 73 Node*,
84 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); 74 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers());
85 void RemoveMarkers(const MarkerRemoverPredicate& should_remove_marker); 75 void RemoveSpellingMarkersUnderWords(const Vector<String>& words);
86 void RepaintMarkers( 76 void RepaintMarkers(
87 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers()); 77 DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers());
88 // Returns true if markers within a range are found. 78 // Returns true if markers within a range are found.
89 bool SetMarkersActive(const EphemeralRange&, bool); 79 bool SetMarkersActive(const EphemeralRange&, bool);
90 // Returns true if markers within a range defined by a node, |startOffset| and 80 // Returns true if markers within a range defined by a node, |startOffset| and
91 // |endOffset| are found. 81 // |endOffset| are found.
92 bool SetMarkersActive(Node*, 82 bool SetMarkersActive(Node*,
93 unsigned start_offset, 83 unsigned start_offset,
94 unsigned end_offset, 84 unsigned end_offset,
95 bool); 85 bool);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 const Member<const Document> document_; 133 const Member<const Document> document_;
144 }; 134 };
145 135
146 } // namespace blink 136 } // namespace blink
147 137
148 #ifndef NDEBUG 138 #ifndef NDEBUG
149 void showDocumentMarkers(const blink::DocumentMarkerController*); 139 void showDocumentMarkers(const blink::DocumentMarkerController*);
150 #endif 140 #endif
151 141
152 #endif // DocumentMarkerController_h 142 #endif // DocumentMarkerController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698