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 15 matching lines...) Expand all Loading... |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 #include "core/dom/DocumentMarkerController.h" | 28 #include "core/dom/DocumentMarkerController.h" |
29 | 29 |
30 #include "core/dom/Node.h" | 30 #include "core/dom/Node.h" |
31 #include "core/dom/NodeTraversal.h" | 31 #include "core/dom/NodeTraversal.h" |
32 #include "core/dom/Range.h" | 32 #include "core/dom/Range.h" |
33 #include "core/dom/RenderedDocumentMarker.h" | 33 #include "core/dom/RenderedDocumentMarker.h" |
34 #include "core/dom/Text.h" | 34 #include "core/dom/Text.h" |
35 #include "core/editing/iterators/TextIterator.h" | 35 #include "core/editing/iterators/TextIterator.h" |
36 #include "core/rendering/RenderObject.h" | 36 #include "core/layout/LayoutObject.h" |
37 | 37 |
38 #ifndef NDEBUG | 38 #ifndef NDEBUG |
39 #include <stdio.h> | 39 #include <stdio.h> |
40 #endif | 40 #endif |
41 | 41 |
42 namespace blink { | 42 namespace blink { |
43 | 43 |
44 MarkerRemoverPredicate::MarkerRemoverPredicate(const Vector<String>& words) | 44 MarkerRemoverPredicate::MarkerRemoverPredicate(const Vector<String>& words) |
45 : m_words(words) | 45 : m_words(words) |
46 { | 46 { |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 list.clear(); | 566 list.clear(); |
567 ++emptyListsCount; | 567 ++emptyListsCount; |
568 needsRepainting = true; | 568 needsRepainting = true; |
569 } | 569 } |
570 } | 570 } |
571 | 571 |
572 nodeCanBeRemoved = emptyListsCount == DocumentMarker::MarkerTypeIndexesC
ount; | 572 nodeCanBeRemoved = emptyListsCount == DocumentMarker::MarkerTypeIndexesC
ount; |
573 } | 573 } |
574 | 574 |
575 if (needsRepainting) { | 575 if (needsRepainting) { |
576 if (RenderObject* renderer = iterator->key->renderer()) | 576 if (LayoutObject* renderer = iterator->key->renderer()) |
577 renderer->setShouldDoFullPaintInvalidation(); | 577 renderer->setShouldDoFullPaintInvalidation(); |
578 } | 578 } |
579 | 579 |
580 if (nodeCanBeRemoved) { | 580 if (nodeCanBeRemoved) { |
581 m_markers.remove(iterator); | 581 m_markers.remove(iterator); |
582 if (m_markers.isEmpty()) | 582 if (m_markers.isEmpty()) |
583 m_possiblyExistingMarkerTypes = 0; | 583 m_possiblyExistingMarkerTypes = 0; |
584 } | 584 } |
585 } | 585 } |
586 | 586 |
587 void DocumentMarkerController::repaintMarkers(DocumentMarker::MarkerTypes marker
Types) | 587 void DocumentMarkerController::repaintMarkers(DocumentMarker::MarkerTypes marker
Types) |
588 { | 588 { |
589 if (!possiblyHasMarkers(markerTypes)) | 589 if (!possiblyHasMarkers(markerTypes)) |
590 return; | 590 return; |
591 ASSERT(!m_markers.isEmpty()); | 591 ASSERT(!m_markers.isEmpty()); |
592 | 592 |
593 // outer loop: process each markered node in the document | 593 // outer loop: process each markered node in the document |
594 MarkerMap::iterator end = m_markers.end(); | 594 MarkerMap::iterator end = m_markers.end(); |
595 for (MarkerMap::iterator i = m_markers.begin(); i != end; ++i) { | 595 for (MarkerMap::iterator i = m_markers.begin(); i != end; ++i) { |
596 const Node* node = i->key; | 596 const Node* node = i->key; |
597 | 597 |
598 // inner loop: process each marker in the current node | 598 // inner loop: process each marker in the current node |
599 MarkerLists* markers = i->value.get(); | 599 MarkerLists* markers = i->value.get(); |
600 for (size_t markerListIndex = 0; markerListIndex < DocumentMarker::Marke
rTypeIndexesCount; ++markerListIndex) { | 600 for (size_t markerListIndex = 0; markerListIndex < DocumentMarker::Marke
rTypeIndexesCount; ++markerListIndex) { |
601 OwnPtrWillBeMember<MarkerList>& list = (*markers)[markerListIndex]; | 601 OwnPtrWillBeMember<MarkerList>& list = (*markers)[markerListIndex]; |
602 if (!list || list->isEmpty() || !markerTypes.contains((*list->begin(
))->type())) | 602 if (!list || list->isEmpty() || !markerTypes.contains((*list->begin(
))->type())) |
603 continue; | 603 continue; |
604 | 604 |
605 // cause the node to be redrawn | 605 // cause the node to be redrawn |
606 if (RenderObject* renderer = node->renderer()) { | 606 if (LayoutObject* renderer = node->renderer()) { |
607 renderer->setShouldDoFullPaintInvalidation(); | 607 renderer->setShouldDoFullPaintInvalidation(); |
608 break; | 608 break; |
609 } | 609 } |
610 } | 610 } |
611 } | 611 } |
612 } | 612 } |
613 | 613 |
614 void DocumentMarkerController::invalidateRenderedRectsForMarkersInRect(const Lay
outRect& r) | 614 void DocumentMarkerController::invalidateRenderedRectsForMarkersInRect(const Lay
outRect& r) |
615 { | 615 { |
616 // outer loop: process each markered node in the document | 616 // outer loop: process each markered node in the document |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 | 755 |
756 } // namespace blink | 756 } // namespace blink |
757 | 757 |
758 #ifndef NDEBUG | 758 #ifndef NDEBUG |
759 void showDocumentMarkers(const blink::DocumentMarkerController* controller) | 759 void showDocumentMarkers(const blink::DocumentMarkerController* controller) |
760 { | 760 { |
761 if (controller) | 761 if (controller) |
762 controller->showMarkers(); | 762 controller->showMarkers(); |
763 } | 763 } |
764 #endif | 764 #endif |
OLD | NEW |