| 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 DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(DocumentMarkerController); |
| 47 public: | 48 public: |
| 48 | 49 |
| 49 DocumentMarkerController(); | 50 DocumentMarkerController(); |
| 50 ~DocumentMarkerController(); | |
| 51 | 51 |
| 52 void clear(); | 52 void clear(); |
| 53 void addMarker(Range*, DocumentMarker::MarkerType); | 53 void addMarker(Range*, DocumentMarker::MarkerType); |
| 54 void addMarker(Range*, DocumentMarker::MarkerType, const String& description
); | 54 void addMarker(Range*, DocumentMarker::MarkerType, const String& description
); |
| 55 void addMarker(Range*, DocumentMarker::MarkerType, const String& description
, uint32_t hash); | 55 void addMarker(Range*, DocumentMarker::MarkerType, const String& description
, uint32_t hash); |
| 56 void addTextMatchMarker(const Range*, bool activeMatch); | 56 void addTextMatchMarker(const Range*, bool activeMatch); |
| 57 | 57 |
| 58 void copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstN
ode, int delta); | 58 void copyMarkers(Node* srcNode, unsigned startOffset, int length, Node* dstN
ode, int delta); |
| 59 bool hasMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::AllMar
kers()); | 59 bool hasMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::AllMar
kers()); |
| 60 | 60 |
| 61 void prepareForDestruction(); | 61 void prepareForDestruction(); |
| 62 // When a marker partially overlaps with range, if removePartiallyOverlappin
gMarkers is true, we completely | 62 // 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 | 63 // 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. | 64 // the portion that is outside of the range. |
| 65 enum RemovePartiallyOverlappingMarkerOrNot { DoNotRemovePartiallyOverlapping
Marker, RemovePartiallyOverlappingMarker }; | 65 enum RemovePartiallyOverlappingMarkerOrNot { DoNotRemovePartiallyOverlapping
Marker, RemovePartiallyOverlappingMarker }; |
| 66 void removeMarkers(Range*, DocumentMarker::MarkerTypes = DocumentMarker::All
Markers(), RemovePartiallyOverlappingMarkerOrNot = DoNotRemovePartiallyOverlappi
ngMarker); | 66 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); | 67 void removeMarkers(Node*, unsigned startOffset, int length, DocumentMarker::
MarkerTypes = DocumentMarker::AllMarkers(), RemovePartiallyOverlappingMarkerOrN
ot = DoNotRemovePartiallyOverlappingMarker); |
| 68 | 68 |
| 69 void removeMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers(
)); | 69 void removeMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers(
)); |
| 70 void removeMarkers(Node*, DocumentMarker::MarkerTypes = DocumentMarker::AllM
arkers()); | 70 void removeMarkers(Node*, DocumentMarker::MarkerTypes = DocumentMarker::AllM
arkers()); |
| 71 void repaintMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers
()); | 71 void repaintMarkers(DocumentMarker::MarkerTypes = DocumentMarker::AllMarkers
()); |
| 72 void invalidateRenderedRectsForMarkersInRect(const LayoutRect&); | 72 void invalidateRenderedRectsForMarkersInRect(const LayoutRect&); |
| 73 void shiftMarkers(Node*, unsigned startOffset, int delta); | 73 void shiftMarkers(Node*, unsigned startOffset, int delta); |
| 74 void setMarkersActive(Range*, bool); | 74 void setMarkersActive(Range*, bool); |
| 75 void setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool)
; | 75 void setMarkersActive(Node*, unsigned startOffset, unsigned endOffset, bool)
; |
| 76 | 76 |
| 77 DocumentMarker* markerContainingPoint(const LayoutPoint&, DocumentMarker::Ma
rkerType); | 77 DocumentMarker* markerContainingPoint(const LayoutPoint&, DocumentMarker::Ma
rkerType); |
| 78 Vector<DocumentMarker*> markersFor(Node*, DocumentMarker::MarkerTypes = Docu
mentMarker::AllMarkers()); | 78 WillBeHeapVector<DocumentMarker*> markersFor(Node*, DocumentMarker::MarkerTy
pes = DocumentMarker::AllMarkers()); |
| 79 Vector<DocumentMarker*> markersInRange(Range*, DocumentMarker::MarkerTypes); | 79 WillBeHeapVector<DocumentMarker*> markersInRange(Range*, DocumentMarker::Mar
kerTypes); |
| 80 Vector<DocumentMarker*> markers(); | 80 WillBeHeapVector<DocumentMarker*> markers(); |
| 81 Vector<IntRect> renderedRectsForMarkers(DocumentMarker::MarkerType); | 81 Vector<IntRect> renderedRectsForMarkers(DocumentMarker::MarkerType); |
| 82 | 82 |
| 83 void trace(Visitor*); | 83 void trace(Visitor*); |
| 84 | 84 |
| 85 #ifndef NDEBUG | 85 #ifndef NDEBUG |
| 86 void showMarkers() const; | 86 void showMarkers() const; |
| 87 #endif | 87 #endif |
| 88 | 88 |
| 89 private: | 89 private: |
| 90 void addMarker(Node*, const DocumentMarker&); | 90 void addMarker(Node*, const DocumentMarker&); |
| 91 | 91 |
| 92 typedef Vector<RenderedDocumentMarker> MarkerList; | 92 typedef WillBeHeapVector<RenderedDocumentMarker> MarkerList; |
| 93 typedef Vector<OwnPtr<MarkerList>, DocumentMarker::MarkerTypeIndexesCount> M
arkerLists; | 93 typedef WillBeHeapVector<OwnPtrWillBeMember<MarkerList>, DocumentMarker::Mar
kerTypeIndexesCount> MarkerLists; |
| 94 typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<const Node>, OwnPtr<MarkerL
ists> > MarkerMap; | 94 typedef WillBeHeapHashMap<RawPtrWillBeWeakMember<const Node>, OwnPtrWillBeMe
mber<MarkerLists> > MarkerMap; |
| 95 void mergeOverlapping(MarkerList*, DocumentMarker&); | 95 void mergeOverlapping(MarkerList*, DocumentMarker&); |
| 96 bool possiblyHasMarkers(DocumentMarker::MarkerTypes); | 96 bool possiblyHasMarkers(DocumentMarker::MarkerTypes); |
| 97 void removeMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes)
; | 97 void removeMarkersFromList(MarkerMap::iterator, DocumentMarker::MarkerTypes)
; |
| 98 | 98 |
| 99 MarkerMap m_markers; | 99 MarkerMap m_markers; |
| 100 // Provide a quick way to determine whether a particular marker type is abse
nt without going through the map. | 100 // Provide a quick way to determine whether a particular marker type is abse
nt without going through the map. |
| 101 DocumentMarker::MarkerTypes m_possiblyExistingMarkerTypes; | 101 DocumentMarker::MarkerTypes m_possiblyExistingMarkerTypes; |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 } // namespace WebCore | 104 } // namespace WebCore |
| 105 | 105 |
| 106 #ifndef NDEBUG | 106 #ifndef NDEBUG |
| 107 void showDocumentMarkers(const WebCore::DocumentMarkerController*); | 107 void showDocumentMarkers(const WebCore::DocumentMarkerController*); |
| 108 #endif | 108 #endif |
| 109 | 109 |
| 110 #endif // DocumentMarkerController_h | 110 #endif // DocumentMarkerController_h |
| OLD | NEW |