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

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

Issue 1237093003: Robustify window.internals.textSurroundingNode(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « LayoutTests/editing/surrounding-text/surrounding-text-detached-no-crash-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2296 matching lines...) Expand 10 before | Expand all | Expand 10 after
2307 ContextLifecycleObserver::trace(visitor); 2307 ContextLifecycleObserver::trace(visitor);
2308 } 2308 }
2309 2309
2310 void Internals::setValueForUser(Element* element, const String& value) 2310 void Internals::setValueForUser(Element* element, const String& value)
2311 { 2311 {
2312 toHTMLInputElement(element)->setValueForUser(value); 2312 toHTMLInputElement(element)->setValueForUser(value);
2313 } 2313 }
2314 2314
2315 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength) 2315 String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma xLength)
2316 { 2316 {
2317 if (!node) 2317 if (!node || !node->layoutObject())
2318 return String(); 2318 return String();
2319 blink::WebPoint point(x, y); 2319 blink::WebPoint point(x, y);
2320 SurroundingText surroundingText(VisiblePosition(node->layoutObject()->positi onForPoint(static_cast<IntPoint>(point))).deepEquivalent().parentAnchoredEquival ent(), maxLength); 2320 SurroundingText surroundingText(VisiblePosition(node->layoutObject()->positi onForPoint(static_cast<IntPoint>(point))).deepEquivalent().parentAnchoredEquival ent(), maxLength);
2321 return surroundingText.content(); 2321 return surroundingText.content();
2322 } 2322 }
2323 2323
2324 void Internals::setFocused(bool focused) 2324 void Internals::setFocused(bool focused)
2325 { 2325 {
2326 frame()->page()->focusController().setFocused(focused); 2326 frame()->page()->focusController().setFocused(focused);
2327 } 2327 }
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 return ClientRectList::create(rects); 2456 return ClientRectList::create(rects);
2457 } 2457 }
2458 2458
2459 void Internals::setCapsLockState(bool enabled) 2459 void Internals::setCapsLockState(bool enabled)
2460 { 2460 {
2461 PlatformKeyboardEvent::setCurrentCapsLockState(enabled ? 2461 PlatformKeyboardEvent::setCurrentCapsLockState(enabled ?
2462 PlatformKeyboardEvent::OverrideCapsLockState::On : PlatformKeyboardEvent ::OverrideCapsLockState::Off); 2462 PlatformKeyboardEvent::OverrideCapsLockState::On : PlatformKeyboardEvent ::OverrideCapsLockState::Off);
2463 } 2463 }
2464 2464
2465 } // namespace blink 2465 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/editing/surrounding-text/surrounding-text-detached-no-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698