| 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 | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
| 7 * reserved. | 7 * reserved. |
| 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
| 9 * (http://www.torchmobile.com/) | 9 * (http://www.torchmobile.com/) |
| 10 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 case DocumentMarker::kTextMatch: | 58 case DocumentMarker::kTextMatch: |
| 59 return DocumentMarker::kTextMatchMarkerIndex; | 59 return DocumentMarker::kTextMatchMarkerIndex; |
| 60 case DocumentMarker::kComposition: | 60 case DocumentMarker::kComposition: |
| 61 return DocumentMarker::kCompositionMarkerIndex; | 61 return DocumentMarker::kCompositionMarkerIndex; |
| 62 } | 62 } |
| 63 | 63 |
| 64 NOTREACHED(); | 64 NOTREACHED(); |
| 65 return DocumentMarker::kSpellingMarkerIndex; | 65 return DocumentMarker::kSpellingMarkerIndex; |
| 66 } | 66 } |
| 67 | 67 |
| 68 DocumentMarkerList* CreateListForType(DocumentMarker::MarkerType type) { |
| 69 // All MarkerTypes use GenericDocumentMarkerListImpl for now. Eventually we |
| 70 // will use different marker list classes for different MarkerTypes. |
| 71 return new GenericDocumentMarkerListImpl(); |
| 72 } |
| 73 |
| 68 } // namespace | 74 } // namespace |
| 69 | 75 |
| 70 Member<DocumentMarkerList>& DocumentMarkerController::ListForType( | 76 Member<DocumentMarkerList>& DocumentMarkerController::ListForType( |
| 71 MarkerLists* marker_lists, | 77 MarkerLists* marker_lists, |
| 72 DocumentMarker::MarkerType type) { | 78 DocumentMarker::MarkerType type) { |
| 73 const size_t marker_list_index = MarkerTypeToMarkerIndex(type); | 79 const size_t marker_list_index = MarkerTypeToMarkerIndex(type); |
| 74 return (*marker_lists)[marker_list_index]; | 80 return (*marker_lists)[marker_list_index]; |
| 75 } | 81 } |
| 76 | 82 |
| 77 inline bool DocumentMarkerController::PossiblyHasMarkers( | 83 inline bool DocumentMarkerController::PossiblyHasMarkers( |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 possibly_existing_marker_types_.Add(new_marker->GetType()); | 205 possibly_existing_marker_types_.Add(new_marker->GetType()); |
| 200 | 206 |
| 201 Member<MarkerLists>& markers = | 207 Member<MarkerLists>& markers = |
| 202 markers_.insert(node, nullptr).stored_value->value; | 208 markers_.insert(node, nullptr).stored_value->value; |
| 203 if (!markers) { | 209 if (!markers) { |
| 204 markers = new MarkerLists; | 210 markers = new MarkerLists; |
| 205 markers->Grow(DocumentMarker::kMarkerTypeIndexesCount); | 211 markers->Grow(DocumentMarker::kMarkerTypeIndexesCount); |
| 206 } | 212 } |
| 207 | 213 |
| 208 const DocumentMarker::MarkerType new_marker_type = new_marker->GetType(); | 214 const DocumentMarker::MarkerType new_marker_type = new_marker->GetType(); |
| 209 if (!ListForType(markers, new_marker_type)) { | 215 if (!ListForType(markers, new_marker_type)) |
| 210 // TODO(rlanday): add method for deciding what type of list to create based | 216 ListForType(markers, new_marker_type) = CreateListForType(new_marker_type); |
| 211 // on the MarkerType | |
| 212 ListForType(markers, new_marker_type) = new GenericDocumentMarkerListImpl; | |
| 213 } | |
| 214 | 217 |
| 215 DocumentMarkerList* const list = ListForType(markers, new_marker_type); | 218 DocumentMarkerList* const list = ListForType(markers, new_marker_type); |
| 216 list->Add(new_marker); | 219 list->Add(new_marker); |
| 217 | 220 |
| 218 // repaint the affected node | 221 // repaint the affected node |
| 219 if (node->GetLayoutObject()) { | 222 if (node->GetLayoutObject()) { |
| 220 node->GetLayoutObject()->SetShouldDoFullPaintInvalidation( | 223 node->GetLayoutObject()->SetShouldDoFullPaintInvalidation( |
| 221 kPaintInvalidationDocumentMarkerChange); | 224 kPaintInvalidationDocumentMarkerChange); |
| 222 } | 225 } |
| 223 } | 226 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 243 new MarkerLists(DocumentMarker::kMarkerTypeIndexesCount)); | 246 new MarkerLists(DocumentMarker::kMarkerTypeIndexesCount)); |
| 244 } | 247 } |
| 245 MarkerLists* dst_markers = markers_.at(dst_node); | 248 MarkerLists* dst_markers = markers_.at(dst_node); |
| 246 | 249 |
| 247 bool doc_dirty = false; | 250 bool doc_dirty = false; |
| 248 for (DocumentMarker::MarkerType type : DocumentMarker::AllMarkers()) { | 251 for (DocumentMarker::MarkerType type : DocumentMarker::AllMarkers()) { |
| 249 DocumentMarkerList* const src_list = ListForType(src_markers, type); | 252 DocumentMarkerList* const src_list = ListForType(src_markers, type); |
| 250 if (!src_list) | 253 if (!src_list) |
| 251 continue; | 254 continue; |
| 252 | 255 |
| 253 if (!ListForType(dst_markers, type)) { | 256 if (!ListForType(dst_markers, type)) |
| 254 // TODO(rlanday): add method for deciding what type of list to create | 257 ListForType(dst_markers, type) = CreateListForType(type); |
| 255 // based on the MarkerType | |
| 256 ListForType(dst_markers, type) = new GenericDocumentMarkerListImpl; | |
| 257 } | |
| 258 | 258 |
| 259 DocumentMarkerList* const dst_list = ListForType(dst_markers, type); | 259 DocumentMarkerList* const dst_list = ListForType(dst_markers, type); |
| 260 if (src_list->MoveMarkers(length, dst_list)) | 260 if (src_list->MoveMarkers(length, dst_list)) |
| 261 doc_dirty = true; | 261 doc_dirty = true; |
| 262 } | 262 } |
| 263 | 263 |
| 264 // repaint the affected node | 264 // repaint the affected node |
| 265 if (doc_dirty && dst_node->GetLayoutObject()) { | 265 if (doc_dirty && dst_node->GetLayoutObject()) { |
| 266 dst_node->GetLayoutObject()->SetShouldDoFullPaintInvalidation( | 266 dst_node->GetLayoutObject()->SetShouldDoFullPaintInvalidation( |
| 267 kPaintInvalidationDocumentMarkerChange); | 267 kPaintInvalidationDocumentMarkerChange); |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 } | 741 } |
| 742 | 742 |
| 743 } // namespace blink | 743 } // namespace blink |
| 744 | 744 |
| 745 #ifndef NDEBUG | 745 #ifndef NDEBUG |
| 746 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { | 746 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { |
| 747 if (controller) | 747 if (controller) |
| 748 controller->ShowMarkers(); | 748 controller->ShowMarkers(); |
| 749 } | 749 } |
| 750 #endif | 750 #endif |
| OLD | NEW |