| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 #include "core/dom/shadow/ElementShadowV0.h" | 58 #include "core/dom/shadow/ElementShadowV0.h" |
| 59 #include "core/dom/shadow/FlatTreeTraversal.h" | 59 #include "core/dom/shadow/FlatTreeTraversal.h" |
| 60 #include "core/dom/shadow/SelectRuleFeatureSet.h" | 60 #include "core/dom/shadow/SelectRuleFeatureSet.h" |
| 61 #include "core/dom/shadow/ShadowRoot.h" | 61 #include "core/dom/shadow/ShadowRoot.h" |
| 62 #include "core/editing/Editor.h" | 62 #include "core/editing/Editor.h" |
| 63 #include "core/editing/PlainTextRange.h" | 63 #include "core/editing/PlainTextRange.h" |
| 64 #include "core/editing/SurroundingText.h" | 64 #include "core/editing/SurroundingText.h" |
| 65 #include "core/editing/iterators/TextIterator.h" | 65 #include "core/editing/iterators/TextIterator.h" |
| 66 #include "core/editing/markers/DocumentMarker.h" | 66 #include "core/editing/markers/DocumentMarker.h" |
| 67 #include "core/editing/markers/DocumentMarkerController.h" | 67 #include "core/editing/markers/DocumentMarkerController.h" |
| 68 #include "core/editing/markers/TextMatchMarker.h" |
| 68 #include "core/editing/serializers/Serialization.h" | 69 #include "core/editing/serializers/Serialization.h" |
| 69 #include "core/editing/spellcheck/IdleSpellCheckCallback.h" | 70 #include "core/editing/spellcheck/IdleSpellCheckCallback.h" |
| 70 #include "core/editing/spellcheck/SpellCheckRequester.h" | 71 #include "core/editing/spellcheck/SpellCheckRequester.h" |
| 71 #include "core/editing/spellcheck/SpellChecker.h" | 72 #include "core/editing/spellcheck/SpellChecker.h" |
| 72 #include "core/frame/EventHandlerRegistry.h" | 73 #include "core/frame/EventHandlerRegistry.h" |
| 73 #include "core/frame/FrameConsole.h" | 74 #include "core/frame/FrameConsole.h" |
| 74 #include "core/frame/LocalDOMWindow.h" | 75 #include "core/frame/LocalDOMWindow.h" |
| 75 #include "core/frame/LocalFrame.h" | 76 #include "core/frame/LocalFrame.h" |
| 76 #include "core/frame/LocalFrameView.h" | 77 #include "core/frame/LocalFrameView.h" |
| 77 #include "core/frame/Settings.h" | 78 #include "core/frame/Settings.h" |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 unsigned Internals::activeMarkerCountForNode(Node* node) { | 958 unsigned Internals::activeMarkerCountForNode(Node* node) { |
| 958 DCHECK(node); | 959 DCHECK(node); |
| 959 | 960 |
| 960 // Only TextMatch markers can be active. | 961 // Only TextMatch markers can be active. |
| 961 DocumentMarker::MarkerType marker_type = DocumentMarker::kTextMatch; | 962 DocumentMarker::MarkerType marker_type = DocumentMarker::kTextMatch; |
| 962 DocumentMarkerVector markers = | 963 DocumentMarkerVector markers = |
| 963 node->GetDocument().Markers().MarkersFor(node, marker_type); | 964 node->GetDocument().Markers().MarkersFor(node, marker_type); |
| 964 | 965 |
| 965 unsigned active_marker_count = 0; | 966 unsigned active_marker_count = 0; |
| 966 for (const auto& marker : markers) { | 967 for (const auto& marker : markers) { |
| 967 if (marker->IsActiveMatch()) | 968 if (ToTextMatchMarker(marker)->IsActiveMatch()) |
| 968 active_marker_count++; | 969 active_marker_count++; |
| 969 } | 970 } |
| 970 | 971 |
| 971 return active_marker_count; | 972 return active_marker_count; |
| 972 } | 973 } |
| 973 | 974 |
| 974 DocumentMarker* Internals::MarkerAt(Node* node, | 975 DocumentMarker* Internals::MarkerAt(Node* node, |
| 975 const String& marker_type, | 976 const String& marker_type, |
| 976 unsigned index, | 977 unsigned index, |
| 977 ExceptionState& exception_state) { | 978 ExceptionState& exception_state) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1007 String Internals::markerDescriptionForNode(Node* node, | 1008 String Internals::markerDescriptionForNode(Node* node, |
| 1008 const String& marker_type, | 1009 const String& marker_type, |
| 1009 unsigned index, | 1010 unsigned index, |
| 1010 ExceptionState& exception_state) { | 1011 ExceptionState& exception_state) { |
| 1011 DocumentMarker* marker = MarkerAt(node, marker_type, index, exception_state); | 1012 DocumentMarker* marker = MarkerAt(node, marker_type, index, exception_state); |
| 1012 if (!marker) | 1013 if (!marker) |
| 1013 return String(); | 1014 return String(); |
| 1014 return marker->Description(); | 1015 return marker->Description(); |
| 1015 } | 1016 } |
| 1016 | 1017 |
| 1017 static WTF::Optional<DocumentMarker::MatchStatus> MatchStatusFrom( | 1018 static WTF::Optional<TextMatchMarker::MatchStatus> MatchStatusFrom( |
| 1018 const String& match_status) { | 1019 const String& match_status) { |
| 1019 if (EqualIgnoringASCIICase(match_status, "kActive")) | 1020 if (EqualIgnoringASCIICase(match_status, "kActive")) |
| 1020 return DocumentMarker::MatchStatus::kActive; | 1021 return TextMatchMarker::MatchStatus::kActive; |
| 1021 if (EqualIgnoringASCIICase(match_status, "kInactive")) | 1022 if (EqualIgnoringASCIICase(match_status, "kInactive")) |
| 1022 return DocumentMarker::MatchStatus::kInactive; | 1023 return TextMatchMarker::MatchStatus::kInactive; |
| 1023 return WTF::nullopt; | 1024 return WTF::nullopt; |
| 1024 } | 1025 } |
| 1025 | 1026 |
| 1026 void Internals::addTextMatchMarker(const Range* range, | 1027 void Internals::addTextMatchMarker(const Range* range, |
| 1027 const String& match_status, | 1028 const String& match_status, |
| 1028 ExceptionState& exception_state) { | 1029 ExceptionState& exception_state) { |
| 1029 DCHECK(range); | 1030 DCHECK(range); |
| 1030 if (!range->OwnerDocument().View()) | 1031 if (!range->OwnerDocument().View()) |
| 1031 return; | 1032 return; |
| 1032 | 1033 |
| 1033 WTF::Optional<DocumentMarker::MatchStatus> match_status_enum = | 1034 WTF::Optional<TextMatchMarker::MatchStatus> match_status_enum = |
| 1034 MatchStatusFrom(match_status); | 1035 MatchStatusFrom(match_status); |
| 1035 if (!match_status_enum) { | 1036 if (!match_status_enum) { |
| 1036 exception_state.ThrowDOMException( | 1037 exception_state.ThrowDOMException( |
| 1037 kSyntaxError, | 1038 kSyntaxError, |
| 1038 "The match status provided ('" + match_status + "') is invalid."); | 1039 "The match status provided ('" + match_status + "') is invalid."); |
| 1039 return; | 1040 return; |
| 1040 } | 1041 } |
| 1041 | 1042 |
| 1042 range->OwnerDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); | 1043 range->OwnerDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); |
| 1043 range->OwnerDocument().Markers().AddTextMatchMarker( | 1044 range->OwnerDocument().Markers().AddTextMatchMarker( |
| (...skipping 2245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3289 | 3290 |
| 3290 void Internals::crash() { | 3291 void Internals::crash() { |
| 3291 CHECK(false) << "Intentional crash"; | 3292 CHECK(false) << "Intentional crash"; |
| 3292 } | 3293 } |
| 3293 | 3294 |
| 3294 void Internals::setIsLowEndDevice(bool is_low_end_device) { | 3295 void Internals::setIsLowEndDevice(bool is_low_end_device) { |
| 3295 MemoryCoordinator::SetIsLowEndDeviceForTesting(is_low_end_device); | 3296 MemoryCoordinator::SetIsLowEndDeviceForTesting(is_low_end_device); |
| 3296 } | 3297 } |
| 3297 | 3298 |
| 3298 } // namespace blink | 3299 } // namespace blink |
| OLD | NEW |