OLD | NEW |
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
reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 8 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 17 matching lines...) Expand all Loading... |
28 #define DocumentMarkerController_h | 28 #define DocumentMarkerController_h |
29 | 29 |
30 #include "core/dom/DocumentMarker.h" | 30 #include "core/dom/DocumentMarker.h" |
31 #include "platform/geometry/IntRect.h" | 31 #include "platform/geometry/IntRect.h" |
32 #include "platform/heap/Handle.h" | 32 #include "platform/heap/Handle.h" |
33 #include "wtf/HashMap.h" | 33 #include "wtf/HashMap.h" |
34 #include "wtf/Vector.h" | 34 #include "wtf/Vector.h" |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
| 38 class Document; |
38 class LayoutPoint; | 39 class LayoutPoint; |
39 class LayoutRect; | 40 class LayoutRect; |
40 class Node; | 41 class Node; |
41 class Range; | 42 class Range; |
42 class RenderedDocumentMarker; | 43 class RenderedDocumentMarker; |
43 | 44 |
| 45 class MarkerRemoverPredicate { |
| 46 public: |
| 47 MarkerRemoverPredicate(Document&, const Vector<String>& words); |
| 48 bool operator()(const DocumentMarker& documentMarker, |
| 49 const Node* node) const; |
| 50 private: |
| 51 Document& m_document; |
| 52 Vector<String> m_words; |
| 53 }; |
| 54 |
44 class DocumentMarkerController FINAL : public NoBaseWillBeGarbageCollected<Docum
entMarkerController> { | 55 class DocumentMarkerController FINAL : public NoBaseWillBeGarbageCollected<Docum
entMarkerController> { |
45 WTF_MAKE_NONCOPYABLE(DocumentMarkerController); WTF_MAKE_FAST_ALLOCATED_WILL
_BE_REMOVED; | 56 WTF_MAKE_NONCOPYABLE(DocumentMarkerController); WTF_MAKE_FAST_ALLOCATED_WILL
_BE_REMOVED; |
46 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(DocumentMarkerController); | 57 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(DocumentMarkerController); |
47 public: | 58 public: |
48 | 59 |
49 DocumentMarkerController(); | 60 DocumentMarkerController(); |
50 | 61 |
51 void clear(); | 62 void clear(); |
52 void addMarker(Range*, DocumentMarker::MarkerType); | 63 void addMarker(Range*, DocumentMarker::MarkerType); |
53 void addMarker(Range*, DocumentMarker::MarkerType, const String& description
); | 64 void addMarker(Range*, DocumentMarker::MarkerType, const String& description
); |
54 void addMarker(Range*, DocumentMarker::MarkerType, const String& description
, uint32_t hash); | 65 void addMarker(Range*, DocumentMarker::MarkerType, const String& description
, uint32_t hash); |
55 void addTextMatchMarker(const Range*, bool activeMatch); | 66 void addTextMatchMarker(const Range*, bool activeMatch); |
56 | 67 |
57 void copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstN
ode, int delta); | 68 void copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstN
ode, int delta); |
58 bool hasMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::AllMar
kers()); | 69 bool hasMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::AllMar
kers()); |
59 | 70 |
60 void prepareForDestruction(); | 71 void prepareForDestruction(); |
61 // When a marker partially overlaps with range, if removePartiallyOverlappin
gMarkers is true, we completely | 72 // When a marker partially overlaps with range, if removePartiallyOverlappin
gMarkers is true, we completely |
62 // remove the marker. If the argument is false, we will adjust the span of t
he marker so that it retains | 73 // remove the marker. If the argument is false, we will adjust the span of t
he marker so that it retains |
63 // the portion that is outside of the range. | 74 // the portion that is outside of the range. |
64 enum RemovePartiallyOverlappingMarkerOrNot { DoNotRemovePartiallyOverlapping
Marker, RemovePartiallyOverlappingMarker }; | 75 enum RemovePartiallyOverlappingMarkerOrNot { DoNotRemovePartiallyOverlapping
Marker, RemovePartiallyOverlappingMarker }; |
65 void removeMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::All
Markers(), RemovePartiallyOverlappingMarkerOrNot = DoNotRemovePartiallyOverlappi
ngMarker); | 76 void removeMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::All
Markers(), RemovePartiallyOverlappingMarkerOrNot = DoNotRemovePartiallyOverlappi
ngMarker); |
66 void removeMarkers(Node*, unsigned startOffset, int length, DocumentMarker::
MarkerTypes = DocumentMarker::AllMarkers(), RemovePartiallyOverlappingMarkerOrN
ot = DoNotRemovePartiallyOverlappingMarker); | 77 void removeMarkers(Node*, unsigned startOffset, int length, DocumentMarker::
MarkerTypes = DocumentMarker::AllMarkers(), RemovePartiallyOverlappingMarkerOrN
ot = DoNotRemovePartiallyOverlappingMarker); |
67 | 78 |
68 void removeMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers(
)); | 79 void removeMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers(
)); |
69 void removeMarkers(Node*, DocumentMarker::MarkerTypes = DocumentMarker::AllM
arkers()); | 80 void removeMarkers(Node*, DocumentMarker::MarkerTypes = DocumentMarker::AllM
arkers()); |
| 81 void removeMarkers(const MarkerRemoverPredicate& shouldRemoveMarker); |
70 void repaintMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers
()); | 82 void repaintMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers
()); |
71 void invalidateRenderedRectsForMarkersInRect(const LayoutRect&); | 83 void invalidateRenderedRectsForMarkersInRect(const LayoutRect&); |
72 void shiftMarkers(Node*, unsigned startOffset, int delta); | 84 void shiftMarkers(Node*, unsigned startOffset, int delta); |
73 void setMarkersActive(Range*, bool); | 85 void setMarkersActive(Range*, bool); |
74 void setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool)
; | 86 void setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool)
; |
75 | 87 |
76 DocumentMarker* markerContainingPoint(const LayoutPoint&, DocumentMarker::Ma
rkerType); | 88 DocumentMarker* markerContainingPoint(const LayoutPoint&, DocumentMarker::Ma
rkerType); |
77 DocumentMarkerVector markersFor(Node*, DocumentMarker::MarkerTypes = Documen
tMarker::AllMarkers()); | 89 DocumentMarkerVector markersFor(Node*, DocumentMarker::MarkerTypes = Documen
tMarker::AllMarkers()); |
78 DocumentMarkerVector markersInRange(Range*, DocumentMarker::MarkerTypes); | 90 DocumentMarkerVector markersInRange(Range*, DocumentMarker::MarkerTypes); |
79 DocumentMarkerVector markers(); | 91 DocumentMarkerVector markers(); |
(...skipping 20 matching lines...) Expand all Loading... |
100 DocumentMarker::MarkerTypes m_possiblyExistingMarkerTypes; | 112 DocumentMarker::MarkerTypes m_possiblyExistingMarkerTypes; |
101 }; | 113 }; |
102 | 114 |
103 } // namespace blink | 115 } // namespace blink |
104 | 116 |
105 #ifndef NDEBUG | 117 #ifndef NDEBUG |
106 void showDocumentMarkers(const blink::DocumentMarkerController*); | 118 void showDocumentMarkers(const blink::DocumentMarkerController*); |
107 #endif | 119 #endif |
108 | 120 |
109 #endif // DocumentMarkerController_h | 121 #endif // DocumentMarkerController_h |
OLD | NEW |