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 24 matching lines...) Expand all Loading... | |
35 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 | 37 |
38 class ContainerNode; | 38 class ContainerNode; |
39 class LayoutPoint; | 39 class LayoutPoint; |
40 class LayoutRect; | 40 class LayoutRect; |
41 class Node; | 41 class Node; |
42 class Range; | 42 class Range; |
43 class RenderedDocumentMarker; | 43 class RenderedDocumentMarker; |
44 | 44 |
45 class DocumentMarkerController FINAL : public NoBaseWillBeGarbageCollectedFinali zed<DocumentMarkerController> { | 45 class DocumentMarkerController FINAL : public NoBaseWillBeGarbageCollected<Docum entMarkerController> { |
46 WTF_MAKE_NONCOPYABLE(DocumentMarkerController); WTF_MAKE_FAST_ALLOCATED_WILL _BE_REMOVED; | 46 WTF_MAKE_NONCOPYABLE(DocumentMarkerController); WTF_MAKE_FAST_ALLOCATED_WILL _BE_REMOVED; |
47 public: | 47 public: |
48 | 48 |
49 DocumentMarkerController(); | 49 DocumentMarkerController(); |
50 ~DocumentMarkerController(); | |
haraken
2014/05/19 07:13:20
You can use DEFINE_EMPTY_VIRTUAL_DESTRUCTOR_WILL_B
Erik Corry
2014/05/19 07:52:11
Not writing anything at all seems better though.
Erik Corry
2014/05/20 08:40:37
I put this back after our offline discussion this
| |
51 | 50 |
52 void clear(); | 51 void clear(); |
53 void addMarker(Range*, DocumentMarker::MarkerType); | 52 void addMarker(Range*, DocumentMarker::MarkerType); |
54 void addMarker(Range*, DocumentMarker::MarkerType, const String& description ); | 53 void addMarker(Range*, DocumentMarker::MarkerType, const String& description ); |
55 void addMarker(Range*, DocumentMarker::MarkerType, const String& description , uint32_t hash); | 54 void addMarker(Range*, DocumentMarker::MarkerType, const String& description , uint32_t hash); |
56 void addTextMatchMarker(const Range*, bool activeMatch); | 55 void addTextMatchMarker(const Range*, bool activeMatch); |
57 | 56 |
58 void copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstN ode, int delta); | 57 void copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstN ode, int delta); |
59 bool hasMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::AllMar kers()); | 58 bool hasMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::AllMar kers()); |
60 | 59 |
61 void prepareForDestruction(); | 60 void prepareForDestruction(); |
62 // When a marker partially overlaps with range, if removePartiallyOverlappin gMarkers is true, we completely | 61 // When a marker partially overlaps with range, if removePartiallyOverlappin gMarkers is true, we completely |
63 // remove the marker. If the argument is false, we will adjust the span of t he marker so that it retains | 62 // remove the marker. If the argument is false, we will adjust the span of t he marker so that it retains |
64 // the portion that is outside of the range. | 63 // the portion that is outside of the range. |
65 enum RemovePartiallyOverlappingMarkerOrNot { DoNotRemovePartiallyOverlapping Marker, RemovePartiallyOverlappingMarker }; | 64 enum RemovePartiallyOverlappingMarkerOrNot { DoNotRemovePartiallyOverlapping Marker, RemovePartiallyOverlappingMarker }; |
66 void removeMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::All Markers(), RemovePartiallyOverlappingMarkerOrNot = DoNotRemovePartiallyOverlappi ngMarker); | 65 void removeMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::All Markers(), RemovePartiallyOverlappingMarkerOrNot = DoNotRemovePartiallyOverlappi ngMarker); |
67 void removeMarkers(Node*, unsigned startOffset, int length, DocumentMarker:: MarkerTypes = DocumentMarker::AllMarkers(), RemovePartiallyOverlappingMarkerOrN ot = DoNotRemovePartiallyOverlappingMarker); | 66 void removeMarkers(Node*, unsigned startOffset, int length, DocumentMarker:: MarkerTypes = DocumentMarker::AllMarkers(), RemovePartiallyOverlappingMarkerOrN ot = DoNotRemovePartiallyOverlappingMarker); |
68 | 67 |
69 void removeMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers( )); | 68 void removeMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers( )); |
70 void removeMarkers(Node*, DocumentMarker::MarkerTypes = DocumentMarker::AllM arkers()); | 69 void removeMarkers(Node*, DocumentMarker::MarkerTypes = DocumentMarker::AllM arkers()); |
71 void repaintMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers ()); | 70 void repaintMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers ()); |
72 void invalidateRenderedRectsForMarkersInRect(const LayoutRect&); | 71 void invalidateRenderedRectsForMarkersInRect(const LayoutRect&); |
73 void shiftMarkers(Node*, unsigned startOffset, int delta); | 72 void shiftMarkers(Node*, unsigned startOffset, int delta); |
74 void setMarkersActive(Range*, bool); | 73 void setMarkersActive(Range*, bool); |
75 void setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool) ; | 74 void setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool) ; |
76 | 75 |
77 DocumentMarker* markerContainingPoint(const LayoutPoint&, DocumentMarker::Ma rkerType); | 76 DocumentMarker* markerContainingPoint(const LayoutPoint&, DocumentMarker::Ma rkerType); |
78 Vector<DocumentMarker*> markersFor(Node*, DocumentMarker::MarkerTypes = Docu mentMarker::AllMarkers()); | 77 WillBeHeapVector<DocumentMarker*> markersFor(Node*, DocumentMarker::MarkerTy pes = DocumentMarker::AllMarkers()); |
haraken
2014/05/19 07:13:20
Let's use WillBeHeapVector<Member<DocumentMarker>>
Erik Corry
2014/05/19 07:52:11
DocumentMarker is not on the heap.
| |
79 Vector<DocumentMarker*> markersInRange(Range*, DocumentMarker::MarkerTypes); | 78 WillBeHeapVector<DocumentMarker*> markersInRange(Range*, DocumentMarker::Mar kerTypes); |
80 Vector<DocumentMarker*> markers(); | 79 WillBeHeapVector<DocumentMarker*> markers(); |
81 Vector<IntRect> renderedRectsForMarkers(DocumentMarker::MarkerType); | 80 Vector<IntRect> renderedRectsForMarkers(DocumentMarker::MarkerType); |
82 | 81 |
83 void trace(Visitor*); | 82 void trace(Visitor*); |
84 | 83 |
85 #ifndef NDEBUG | 84 #ifndef NDEBUG |
86 void showMarkers() const; | 85 void showMarkers() const; |
87 #endif | 86 #endif |
88 | 87 |
89 private: | 88 private: |
90 void addMarker(Node*, const DocumentMarker&); | 89 void addMarker(Node*, const DocumentMarker&); |
91 | 90 |
92 typedef Vector<RenderedDocumentMarker> MarkerList; | 91 typedef WillBeHeapVector<RenderedDocumentMarker> MarkerList; |
sof
2014/05/19 07:05:24
Clarifying Q: DocumentMarker objects contain a Ref
Erik Corry
2014/05/19 07:52:11
Yes, SimpleClassVectorTraits are allowed RefPtrs a
| |
93 typedef Vector<OwnPtr<MarkerList>, DocumentMarker::MarkerTypeIndexesCount> M arkerLists; | 92 typedef WillBeHeapVector<OwnPtrWillBeMember<MarkerList>, DocumentMarker::Mar kerTypeIndexesCount> MarkerLists; |
94 typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<const Node>, OwnPtr<MarkerL ists> > MarkerMap; | 93 typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<const Node>, OwnPtrWillBeMe mber<MarkerLists> > MarkerMap; |
95 void mergeOverlapping(MarkerList*, DocumentMarker&); | 94 void mergeOverlapping(MarkerList*, DocumentMarker&); |
96 bool possiblyHasMarkers(DocumentMarker::MarkerTypes); | 95 bool possiblyHasMarkers(DocumentMarker::MarkerTypes); |
97 void removeMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes) ; | 96 void removeMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes) ; |
98 | 97 |
99 MarkerMap m_markers; | 98 MarkerMap m_markers; |
100 // Provide a quick way to determine whether a particular marker type is abse nt without going through the map. | 99 // Provide a quick way to determine whether a particular marker type is abse nt without going through the map. |
101 DocumentMarker::MarkerTypes m_possiblyExistingMarkerTypes; | 100 DocumentMarker::MarkerTypes m_possiblyExistingMarkerTypes; |
102 }; | 101 }; |
103 | 102 |
104 } // namespace WebCore | 103 } // namespace WebCore |
105 | 104 |
106 #ifndef NDEBUG | 105 #ifndef NDEBUG |
107 void showDocumentMarkers(const WebCore::DocumentMarkerController*); | 106 void showDocumentMarkers(const WebCore::DocumentMarkerController*); |
108 #endif | 107 #endif |
109 | 108 |
110 #endif // DocumentMarkerController_h | 109 #endif // DocumentMarkerController_h |
OLD | NEW |