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 20 matching lines...) Expand all Loading... |
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 LayoutPoint; | 38 class LayoutPoint; |
39 class LayoutRect; | 39 class LayoutRect; |
40 class Node; | 40 class Node; |
| 41 class Position; |
41 class Range; | 42 class Range; |
42 class RenderedDocumentMarker; | 43 class RenderedDocumentMarker; |
43 class Text; | 44 class Text; |
| 45 class TextIterator; |
44 | 46 |
45 class MarkerRemoverPredicate FINAL { | 47 class MarkerRemoverPredicate FINAL { |
46 public: | 48 public: |
47 explicit MarkerRemoverPredicate(const Vector<String>& words); | 49 explicit MarkerRemoverPredicate(const Vector<String>& words); |
48 bool operator()(const DocumentMarker&, const Text&) const; | 50 bool operator()(const DocumentMarker&, const Text&) const; |
49 | 51 |
50 private: | 52 private: |
51 Vector<String> m_words; | 53 Vector<String> m_words; |
52 }; | 54 }; |
53 | 55 |
(...skipping 12 matching lines...) Expand all Loading... |
66 | 68 |
67 void copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstN
ode, int delta); | 69 void copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstN
ode, int delta); |
68 bool hasMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::AllMar
kers()); | 70 bool hasMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::AllMar
kers()); |
69 | 71 |
70 void prepareForDestruction(); | 72 void prepareForDestruction(); |
71 // When a marker partially overlaps with range, if removePartiallyOverlappin
gMarkers is true, we completely | 73 // When a marker partially overlaps with range, if removePartiallyOverlappin
gMarkers is true, we completely |
72 // remove the marker. If the argument is false, we will adjust the span of t
he marker so that it retains | 74 // remove the marker. If the argument is false, we will adjust the span of t
he marker so that it retains |
73 // the portion that is outside of the range. | 75 // the portion that is outside of the range. |
74 enum RemovePartiallyOverlappingMarkerOrNot { DoNotRemovePartiallyOverlapping
Marker, RemovePartiallyOverlappingMarker }; | 76 enum RemovePartiallyOverlappingMarkerOrNot { DoNotRemovePartiallyOverlapping
Marker, RemovePartiallyOverlappingMarker }; |
75 void removeMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::All
Markers(), RemovePartiallyOverlappingMarkerOrNot = DoNotRemovePartiallyOverlappi
ngMarker); | 77 void removeMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::All
Markers(), RemovePartiallyOverlappingMarkerOrNot = DoNotRemovePartiallyOverlappi
ngMarker); |
| 78 void removeMarkers(const Position& start, const Position& end, DocumentMarke
r::MarkerTypes = DocumentMarker::AllMarkers(), RemovePartiallyOverlappingMarkerO
rNot = DoNotRemovePartiallyOverlappingMarker); |
76 void removeMarkers(Node*, unsigned startOffset, int length, DocumentMarker::
MarkerTypes = DocumentMarker::AllMarkers(), RemovePartiallyOverlappingMarkerOrN
ot = DoNotRemovePartiallyOverlappingMarker); | 79 void removeMarkers(Node*, unsigned startOffset, int length, DocumentMarker::
MarkerTypes = DocumentMarker::AllMarkers(), RemovePartiallyOverlappingMarkerOrN
ot = DoNotRemovePartiallyOverlappingMarker); |
77 | 80 |
78 void removeMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers(
)); | 81 void removeMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers(
)); |
79 void removeMarkers(Node*, DocumentMarker::MarkerTypes = DocumentMarker::AllM
arkers()); | 82 void removeMarkers(Node*, DocumentMarker::MarkerTypes = DocumentMarker::AllM
arkers()); |
80 void removeMarkers(const MarkerRemoverPredicate& shouldRemoveMarker); | 83 void removeMarkers(const MarkerRemoverPredicate& shouldRemoveMarker); |
81 void repaintMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers
()); | 84 void repaintMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers
()); |
82 void invalidateRenderedRectsForMarkersInRect(const LayoutRect&); | 85 void invalidateRenderedRectsForMarkersInRect(const LayoutRect&); |
83 void shiftMarkers(Node*, unsigned startOffset, int delta); | 86 void shiftMarkers(Node*, unsigned startOffset, int delta); |
84 void setMarkersActive(Range*, bool); | 87 void setMarkersActive(Range*, bool); |
85 void setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool)
; | 88 void setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool)
; |
(...skipping 12 matching lines...) Expand all Loading... |
98 | 101 |
99 private: | 102 private: |
100 void addMarker(Node*, const DocumentMarker&); | 103 void addMarker(Node*, const DocumentMarker&); |
101 | 104 |
102 typedef WillBeHeapVector<OwnPtrWillBeMember<RenderedDocumentMarker> > Marker
List; | 105 typedef WillBeHeapVector<OwnPtrWillBeMember<RenderedDocumentMarker> > Marker
List; |
103 typedef WillBeHeapVector<OwnPtrWillBeMember<MarkerList>, DocumentMarker::Mar
kerTypeIndexesCount> MarkerLists; | 106 typedef WillBeHeapVector<OwnPtrWillBeMember<MarkerList>, DocumentMarker::Mar
kerTypeIndexesCount> MarkerLists; |
104 typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<const Node>, OwnPtrWillBeMe
mber<MarkerLists> > MarkerMap; | 107 typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<const Node>, OwnPtrWillBeMe
mber<MarkerLists> > MarkerMap; |
105 void mergeOverlapping(MarkerList*, DocumentMarker&); | 108 void mergeOverlapping(MarkerList*, DocumentMarker&); |
106 bool possiblyHasMarkers(DocumentMarker::MarkerTypes); | 109 bool possiblyHasMarkers(DocumentMarker::MarkerTypes); |
107 void removeMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes)
; | 110 void removeMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes)
; |
| 111 void removeMarkers(TextIterator&, DocumentMarker::MarkerTypes, RemovePartial
lyOverlappingMarkerOrNot); |
108 | 112 |
109 MarkerMap m_markers; | 113 MarkerMap m_markers; |
110 // Provide a quick way to determine whether a particular marker type is abse
nt without going through the map. | 114 // Provide a quick way to determine whether a particular marker type is abse
nt without going through the map. |
111 DocumentMarker::MarkerTypes m_possiblyExistingMarkerTypes; | 115 DocumentMarker::MarkerTypes m_possiblyExistingMarkerTypes; |
112 }; | 116 }; |
113 | 117 |
114 } // namespace blink | 118 } // namespace blink |
115 | 119 |
116 #ifndef NDEBUG | 120 #ifndef NDEBUG |
117 void showDocumentMarkers(const blink::DocumentMarkerController*); | 121 void showDocumentMarkers(const blink::DocumentMarkerController*); |
118 #endif | 122 #endif |
119 | 123 |
120 #endif // DocumentMarkerController_h | 124 #endif // DocumentMarkerController_h |
OLD | NEW |