Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: third_party/WebKit/Source/core/testing/Internals.cpp

Issue 2780313002: [WIP] Refactor DocumentMarker (Closed)
Patch Set: Move accessor methods into derived classes Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 #include "core/dom/shadow/ElementShadowV0.h" 61 #include "core/dom/shadow/ElementShadowV0.h"
62 #include "core/dom/shadow/FlatTreeTraversal.h" 62 #include "core/dom/shadow/FlatTreeTraversal.h"
63 #include "core/dom/shadow/SelectRuleFeatureSet.h" 63 #include "core/dom/shadow/SelectRuleFeatureSet.h"
64 #include "core/dom/shadow/ShadowRoot.h" 64 #include "core/dom/shadow/ShadowRoot.h"
65 #include "core/editing/Editor.h" 65 #include "core/editing/Editor.h"
66 #include "core/editing/PlainTextRange.h" 66 #include "core/editing/PlainTextRange.h"
67 #include "core/editing/SurroundingText.h" 67 #include "core/editing/SurroundingText.h"
68 #include "core/editing/iterators/TextIterator.h" 68 #include "core/editing/iterators/TextIterator.h"
69 #include "core/editing/markers/DocumentMarker.h" 69 #include "core/editing/markers/DocumentMarker.h"
70 #include "core/editing/markers/DocumentMarkerController.h" 70 #include "core/editing/markers/DocumentMarkerController.h"
71 #include "core/editing/markers/SpellCheckMarker.h"
72 #include "core/editing/markers/TextMatchMarker.h"
71 #include "core/editing/serializers/Serialization.h" 73 #include "core/editing/serializers/Serialization.h"
72 #include "core/editing/spellcheck/IdleSpellCheckCallback.h" 74 #include "core/editing/spellcheck/IdleSpellCheckCallback.h"
73 #include "core/editing/spellcheck/SpellCheckRequester.h" 75 #include "core/editing/spellcheck/SpellCheckRequester.h"
74 #include "core/editing/spellcheck/SpellChecker.h" 76 #include "core/editing/spellcheck/SpellChecker.h"
75 #include "core/frame/EventHandlerRegistry.h" 77 #include "core/frame/EventHandlerRegistry.h"
76 #include "core/frame/FrameConsole.h" 78 #include "core/frame/FrameConsole.h"
77 #include "core/frame/FrameView.h" 79 #include "core/frame/FrameView.h"
78 #include "core/frame/LocalDOMWindow.h" 80 #include "core/frame/LocalDOMWindow.h"
79 #include "core/frame/LocalFrame.h" 81 #include "core/frame/LocalFrame.h"
80 #include "core/frame/Settings.h" 82 #include "core/frame/Settings.h"
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 unsigned Internals::activeMarkerCountForNode(Node* node) { 949 unsigned Internals::activeMarkerCountForNode(Node* node) {
948 DCHECK(node); 950 DCHECK(node);
949 951
950 // Only TextMatch markers can be active. 952 // Only TextMatch markers can be active.
951 DocumentMarker::MarkerType markerType = DocumentMarker::TextMatch; 953 DocumentMarker::MarkerType markerType = DocumentMarker::TextMatch;
952 DocumentMarkerVector markers = 954 DocumentMarkerVector markers =
953 node->document().markers().markersFor(node, markerType); 955 node->document().markers().markersFor(node, markerType);
954 956
955 unsigned activeMarkerCount = 0; 957 unsigned activeMarkerCount = 0;
956 for (const auto& marker : markers) { 958 for (const auto& marker : markers) {
957 if (marker->activeMatch()) 959 if (toTextMatchMarker(marker)->activeMatch())
958 activeMarkerCount++; 960 activeMarkerCount++;
959 } 961 }
960 962
961 return activeMarkerCount; 963 return activeMarkerCount;
962 } 964 }
963 965
964 DocumentMarker* Internals::markerAt(Node* node, 966 DocumentMarker* Internals::markerAt(Node* node,
965 const String& markerType, 967 const String& markerType,
966 unsigned index, 968 unsigned index,
967 ExceptionState& exceptionState) { 969 ExceptionState& exceptionState) {
(...skipping 26 matching lines...) Expand all
994 marker->endOffset()); 996 marker->endOffset());
995 } 997 }
996 998
997 String Internals::markerDescriptionForNode(Node* node, 999 String Internals::markerDescriptionForNode(Node* node,
998 const String& markerType, 1000 const String& markerType,
999 unsigned index, 1001 unsigned index,
1000 ExceptionState& exceptionState) { 1002 ExceptionState& exceptionState) {
1001 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState); 1003 DocumentMarker* marker = markerAt(node, markerType, index, exceptionState);
1002 if (!marker) 1004 if (!marker)
1003 return String(); 1005 return String();
1004 return marker->description(); 1006 return toSpellCheckMarker(marker)->description();
1005 } 1007 }
1006 1008
1007 void Internals::addTextMatchMarker(const Range* range, bool isActive) { 1009 void Internals::addTextMatchMarker(const Range* range, bool isActive) {
1008 DCHECK(range); 1010 DCHECK(range);
1009 if (!range->ownerDocument().view()) 1011 if (!range->ownerDocument().view())
1010 return; 1012 return;
1011 1013
1012 range->ownerDocument().updateStyleAndLayoutIgnorePendingStylesheets(); 1014 range->ownerDocument().updateStyleAndLayoutIgnorePendingStylesheets();
1013 range->ownerDocument().markers().addTextMatchMarker(EphemeralRange(range), 1015 range->ownerDocument().markers().addTextMatchMarker(EphemeralRange(range),
1014 isActive); 1016 isActive);
(...skipping 2201 matching lines...) Expand 10 before | Expand all | Expand 10 after
3216 3218
3217 void Internals::crash() { 3219 void Internals::crash() {
3218 CHECK(false) << "Intentional crash"; 3220 CHECK(false) << "Intentional crash";
3219 } 3221 }
3220 3222
3221 void Internals::setIsLowEndDevice(bool isLowEndDevice) { 3223 void Internals::setIsLowEndDevice(bool isLowEndDevice) {
3222 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice); 3224 MemoryCoordinator::setIsLowEndDeviceForTesting(isLowEndDevice);
3223 } 3225 }
3224 3226
3225 } // namespace blink 3227 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698