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 22 matching lines...) Expand all Loading... | |
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 LayoutPoint; | 38 class LayoutPoint; |
39 class LayoutRect; | 39 class LayoutRect; |
40 class Node; | 40 class Node; |
41 class Range; | 41 class Range; |
42 class RenderedDocumentMarker; | 42 class RenderedDocumentMarker; |
43 class Text; | |
44 | |
45 class MarkerRemoverPredicate { | |
46 public: | |
47 MarkerRemoverPredicate(const Vector<String>& words); | |
48 bool operator()(const DocumentMarker& documentMarker, | |
49 const Text* textNode) const; | |
50 private: | |
51 Vector<String> m_words; | |
yosin_UTC9
2014/08/13 01:29:52
My reasoning was |MarkRemovePredicate| is general
| |
52 }; | |
43 | 53 |
44 class DocumentMarkerController FINAL : public NoBaseWillBeGarbageCollected<Docum entMarkerController> { | 54 class DocumentMarkerController FINAL : public NoBaseWillBeGarbageCollected<Docum entMarkerController> { |
45 WTF_MAKE_NONCOPYABLE(DocumentMarkerController); WTF_MAKE_FAST_ALLOCATED_WILL _BE_REMOVED; | 55 WTF_MAKE_NONCOPYABLE(DocumentMarkerController); WTF_MAKE_FAST_ALLOCATED_WILL _BE_REMOVED; |
46 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(DocumentMarkerController); | 56 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(DocumentMarkerController); |
47 public: | 57 public: |
48 | 58 |
49 DocumentMarkerController(); | 59 DocumentMarkerController(); |
50 | 60 |
51 void clear(); | 61 void clear(); |
52 void addMarker(Range*, DocumentMarker::MarkerType); | 62 void addMarker(Range*, DocumentMarker::MarkerType); |
53 void addMarker(Range*, DocumentMarker::MarkerType, const String& description ); | 63 void addMarker(Range*, DocumentMarker::MarkerType, const String& description ); |
54 void addMarker(Range*, DocumentMarker::MarkerType, const String& description , uint32_t hash); | 64 void addMarker(Range*, DocumentMarker::MarkerType, const String& description , uint32_t hash); |
55 void addTextMatchMarker(const Range*, bool activeMatch); | 65 void addTextMatchMarker(const Range*, bool activeMatch); |
56 | 66 |
57 void copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstN ode, int delta); | 67 void copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstN ode, int delta); |
58 bool hasMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::AllMar kers()); | 68 bool hasMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::AllMar kers()); |
59 | 69 |
60 void prepareForDestruction(); | 70 void prepareForDestruction(); |
61 // When a marker partially overlaps with range, if removePartiallyOverlappin gMarkers is true, we completely | 71 // 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 | 72 // 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. | 73 // the portion that is outside of the range. |
64 enum RemovePartiallyOverlappingMarkerOrNot { DoNotRemovePartiallyOverlapping Marker, RemovePartiallyOverlappingMarker }; | 74 enum RemovePartiallyOverlappingMarkerOrNot { DoNotRemovePartiallyOverlapping Marker, RemovePartiallyOverlappingMarker }; |
65 void removeMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::All Markers(), RemovePartiallyOverlappingMarkerOrNot = DoNotRemovePartiallyOverlappi ngMarker); | 75 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); | 76 void removeMarkers(Node*, unsigned startOffset, int length, DocumentMarker:: MarkerTypes = DocumentMarker::AllMarkers(), RemovePartiallyOverlappingMarkerOrN ot = DoNotRemovePartiallyOverlappingMarker); |
67 | 77 |
68 void removeMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers( )); | 78 void removeMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers( )); |
69 void removeMarkers(Node*, DocumentMarker::MarkerTypes = DocumentMarker::AllM arkers()); | 79 void removeMarkers(Node*, DocumentMarker::MarkerTypes = DocumentMarker::AllM arkers()); |
80 void removeMarkers(const MarkerRemoverPredicate& shouldRemoveMarker); | |
70 void repaintMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers ()); | 81 void repaintMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers ()); |
71 void invalidateRenderedRectsForMarkersInRect(const LayoutRect&); | 82 void invalidateRenderedRectsForMarkersInRect(const LayoutRect&); |
72 void shiftMarkers(Node*, unsigned startOffset, int delta); | 83 void shiftMarkers(Node*, unsigned startOffset, int delta); |
73 void setMarkersActive(Range*, bool); | 84 void setMarkersActive(Range*, bool); |
74 void setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool) ; | 85 void setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool) ; |
75 | 86 |
76 DocumentMarker* markerContainingPoint(const LayoutPoint&, DocumentMarker::Ma rkerType); | 87 DocumentMarker* markerContainingPoint(const LayoutPoint&, DocumentMarker::Ma rkerType); |
77 DocumentMarkerVector markersFor(Node*, DocumentMarker::MarkerTypes = Documen tMarker::AllMarkers()); | 88 DocumentMarkerVector markersFor(Node*, DocumentMarker::MarkerTypes = Documen tMarker::AllMarkers()); |
78 DocumentMarkerVector markersInRange(Range*, DocumentMarker::MarkerTypes); | 89 DocumentMarkerVector markersInRange(Range*, DocumentMarker::MarkerTypes); |
79 DocumentMarkerVector markers(); | 90 DocumentMarkerVector markers(); |
(...skipping 20 matching lines...) Expand all Loading... | |
100 DocumentMarker::MarkerTypes m_possiblyExistingMarkerTypes; | 111 DocumentMarker::MarkerTypes m_possiblyExistingMarkerTypes; |
101 }; | 112 }; |
102 | 113 |
103 } // namespace blink | 114 } // namespace blink |
104 | 115 |
105 #ifndef NDEBUG | 116 #ifndef NDEBUG |
106 void showDocumentMarkers(const blink::DocumentMarkerController*); | 117 void showDocumentMarkers(const blink::DocumentMarkerController*); |
107 #endif | 118 #endif |
108 | 119 |
109 #endif // DocumentMarkerController_h | 120 #endif // DocumentMarkerController_h |
OLD | NEW |