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

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

Issue 307353002: Use Position instead of VisiblePosition for SurroundingText. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: convert layouttests to unit tests Created 6 years, 6 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "core/dom/ViewportDescription.h" 66 #include "core/dom/ViewportDescription.h"
67 #include "core/dom/WheelController.h" 67 #include "core/dom/WheelController.h"
68 #include "core/dom/shadow/ComposedTreeWalker.h" 68 #include "core/dom/shadow/ComposedTreeWalker.h"
69 #include "core/dom/shadow/ElementShadow.h" 69 #include "core/dom/shadow/ElementShadow.h"
70 #include "core/dom/shadow/SelectRuleFeatureSet.h" 70 #include "core/dom/shadow/SelectRuleFeatureSet.h"
71 #include "core/dom/shadow/ShadowRoot.h" 71 #include "core/dom/shadow/ShadowRoot.h"
72 #include "core/editing/Editor.h" 72 #include "core/editing/Editor.h"
73 #include "core/editing/PlainTextRange.h" 73 #include "core/editing/PlainTextRange.h"
74 #include "core/editing/SpellCheckRequester.h" 74 #include "core/editing/SpellCheckRequester.h"
75 #include "core/editing/SpellChecker.h" 75 #include "core/editing/SpellChecker.h"
76 #include "core/editing/SurroundingText.h"
77 #include "core/editing/TextIterator.h" 76 #include "core/editing/TextIterator.h"
78 #include "core/fetch/MemoryCache.h" 77 #include "core/fetch/MemoryCache.h"
79 #include "core/fetch/ResourceFetcher.h" 78 #include "core/fetch/ResourceFetcher.h"
80 #include "core/frame/DOMPoint.h" 79 #include "core/frame/DOMPoint.h"
81 #include "core/frame/DOMWindow.h" 80 #include "core/frame/DOMWindow.h"
82 #include "core/frame/EventHandlerRegistry.h" 81 #include "core/frame/EventHandlerRegistry.h"
83 #include "core/frame/FrameView.h" 82 #include "core/frame/FrameView.h"
84 #include "core/frame/LocalFrame.h" 83 #include "core/frame/LocalFrame.h"
85 #include "core/frame/Settings.h" 84 #include "core/frame/Settings.h"
86 #include "core/html/HTMLContentElement.h" 85 #include "core/html/HTMLContentElement.h"
(...skipping 2240 matching lines...) Expand 10 before | Expand all | Expand 10 after
2327 { 2326 {
2328 visitor->trace(m_runtimeFlags); 2327 visitor->trace(m_runtimeFlags);
2329 visitor->trace(m_profilers); 2328 visitor->trace(m_profilers);
2330 } 2329 }
2331 2330
2332 void Internals::setValueForUser(Element* element, const String& value) 2331 void Internals::setValueForUser(Element* element, const String& value)
2333 { 2332 {
2334 toHTMLInputElement(element)->setValueForUser(value); 2333 toHTMLInputElement(element)->setValueForUser(value);
2335 } 2334 }
2336 2335
2337 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength)
2338 {
2339 if (!node)
2340 return String();
2341 blink::WebPoint point(x, y);
2342 SurroundingText surroundingText(VisiblePosition(node->renderer()->positionFo rPoint(static_cast<IntPoint>(point))), maxLength);
2343 return surroundingText.content();
2344 }
2345
2346 void Internals::setFocused(bool focused) 2336 void Internals::setFocused(bool focused)
2347 { 2337 {
2348 frame()->page()->focusController().setFocused(focused); 2338 frame()->page()->focusController().setFocused(focused);
2349 } 2339 }
2350 2340
2351 void Internals::setNetworkStateNotifierTestOnly(bool testOnly) 2341 void Internals::setNetworkStateNotifierTestOnly(bool testOnly)
2352 { 2342 {
2353 networkStateNotifier().setTestUpdatesOnly(testOnly); 2343 networkStateNotifier().setTestUpdatesOnly(testOnly);
2354 } 2344 }
2355 2345
(...skipping 13 matching lines...) Expand all
2369 } else if (type == "none") { 2359 } else if (type == "none") {
2370 webtype = blink::ConnectionTypeNone; 2360 webtype = blink::ConnectionTypeNone;
2371 } else { 2361 } else {
2372 exceptionState.throwDOMException(NotFoundError, ExceptionMessages::faile dToEnumerate("connection type", type)); 2362 exceptionState.throwDOMException(NotFoundError, ExceptionMessages::faile dToEnumerate("connection type", type));
2373 return; 2363 return;
2374 } 2364 }
2375 networkStateNotifier().setWebConnectionTypeForTest(webtype); 2365 networkStateNotifier().setWebConnectionTypeForTest(webtype);
2376 } 2366 }
2377 2367
2378 } // namespace WebCore 2368 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698