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 20 matching lines...) Expand all Loading... |
31 #include <algorithm> | 31 #include <algorithm> |
32 #include "core/dom/Node.h" | 32 #include "core/dom/Node.h" |
33 #include "core/dom/NodeTraversal.h" | 33 #include "core/dom/NodeTraversal.h" |
34 #include "core/dom/Range.h" | 34 #include "core/dom/Range.h" |
35 #include "core/dom/Text.h" | 35 #include "core/dom/Text.h" |
36 #include "core/editing/iterators/TextIterator.h" | 36 #include "core/editing/iterators/TextIterator.h" |
37 #include "core/editing/markers/CompositionMarkerListImpl.h" | 37 #include "core/editing/markers/CompositionMarkerListImpl.h" |
38 #include "core/editing/markers/DocumentMarkerListEditor.h" | 38 #include "core/editing/markers/DocumentMarkerListEditor.h" |
39 #include "core/editing/markers/GenericDocumentMarkerListImpl.h" | 39 #include "core/editing/markers/GenericDocumentMarkerListImpl.h" |
40 #include "core/editing/markers/RenderedDocumentMarker.h" | 40 #include "core/editing/markers/RenderedDocumentMarker.h" |
| 41 #include "core/editing/markers/SpellCheckMarkerListImpl.h" |
41 #include "core/frame/FrameView.h" | 42 #include "core/frame/FrameView.h" |
42 #include "core/layout/LayoutObject.h" | 43 #include "core/layout/LayoutObject.h" |
43 | 44 |
44 #ifndef NDEBUG | 45 #ifndef NDEBUG |
45 #include <stdio.h> | 46 #include <stdio.h> |
46 #endif | 47 #endif |
47 | 48 |
48 namespace blink { | 49 namespace blink { |
49 | 50 |
50 namespace { | 51 namespace { |
(...skipping 12 matching lines...) Expand all Loading... |
63 } | 64 } |
64 | 65 |
65 NOTREACHED(); | 66 NOTREACHED(); |
66 return DocumentMarker::kSpellingMarkerIndex; | 67 return DocumentMarker::kSpellingMarkerIndex; |
67 } | 68 } |
68 | 69 |
69 DocumentMarkerList* CreateListForType(DocumentMarker::MarkerType type) { | 70 DocumentMarkerList* CreateListForType(DocumentMarker::MarkerType type) { |
70 switch (type) { | 71 switch (type) { |
71 case DocumentMarker::kComposition: | 72 case DocumentMarker::kComposition: |
72 return new CompositionMarkerListImpl(); | 73 return new CompositionMarkerListImpl(); |
| 74 case DocumentMarker::kSpelling: |
| 75 case DocumentMarker::kGrammar: |
| 76 return new SpellCheckMarkerListImpl(); |
73 default: | 77 default: |
74 return new GenericDocumentMarkerListImpl(); | 78 return new GenericDocumentMarkerListImpl(); |
75 } | 79 } |
76 } | 80 } |
77 | 81 |
78 } // namespace | 82 } // namespace |
79 | 83 |
80 Member<DocumentMarkerList>& DocumentMarkerController::ListForType( | 84 Member<DocumentMarkerList>& DocumentMarkerController::ListForType( |
81 MarkerLists* marker_lists, | 85 MarkerLists* marker_lists, |
82 DocumentMarker::MarkerType type) { | 86 DocumentMarker::MarkerType type) { |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 for (auto& node_markers : markers_) { | 509 for (auto& node_markers : markers_) { |
506 const Node& node = *node_markers.key; | 510 const Node& node = *node_markers.key; |
507 if (!node.IsTextNode()) | 511 if (!node.IsTextNode()) |
508 continue; | 512 continue; |
509 MarkerLists* markers = node_markers.value; | 513 MarkerLists* markers = node_markers.value; |
510 for (DocumentMarker::MarkerType type : | 514 for (DocumentMarker::MarkerType type : |
511 DocumentMarker::MisspellingMarkers()) { | 515 DocumentMarker::MisspellingMarkers()) { |
512 DocumentMarkerList* const list = ListForType(markers, type); | 516 DocumentMarkerList* const list = ListForType(markers, type); |
513 if (!list) | 517 if (!list) |
514 continue; | 518 continue; |
515 list->RemoveMarkersUnderWords(ToText(node).data(), words); | 519 static_cast<SpellCheckMarkerListImpl* const>(list) |
| 520 ->RemoveMarkersUnderWords(ToText(node).data(), words); |
516 } | 521 } |
517 } | 522 } |
518 } | 523 } |
519 | 524 |
520 void DocumentMarkerController::RemoveMarkersOfTypes( | 525 void DocumentMarkerController::RemoveMarkersOfTypes( |
521 DocumentMarker::MarkerTypes marker_types) { | 526 DocumentMarker::MarkerTypes marker_types) { |
522 if (!PossiblyHasMarkers(marker_types)) | 527 if (!PossiblyHasMarkers(marker_types)) |
523 return; | 528 return; |
524 DCHECK(!markers_.IsEmpty()); | 529 DCHECK(!markers_.IsEmpty()); |
525 | 530 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 } | 750 } |
746 | 751 |
747 } // namespace blink | 752 } // namespace blink |
748 | 753 |
749 #ifndef NDEBUG | 754 #ifndef NDEBUG |
750 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { | 755 void showDocumentMarkers(const blink::DocumentMarkerController* controller) { |
751 if (controller) | 756 if (controller) |
752 controller->ShowMarkers(); | 757 controller->ShowMarkers(); |
753 } | 758 } |
754 #endif | 759 #endif |
OLD | NEW |