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

Unified Diff: third_party/WebKit/Source/core/testing/Internals.cpp

Issue 2350303003: Prune CreateVisiblePositionDeprecated from SurroundingText-related callers (Closed)
Patch Set: Address comments Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/testing/Internals.cpp
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp
index 61c8f550ac6d89bd2682672d8d1daff92ca4c000..25d0726171c3258c7b12bd409f09274d1bb20d52 100644
--- a/third_party/WebKit/Source/core/testing/Internals.cpp
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -2431,10 +2431,17 @@ void Internals::setValueForUser(Element* element, const String& value)
String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long maxLength)
{
- if (!node || !node->layoutObject())
+ if (!node)
+ return String();
+
+ // VisiblePosition and SurroundingText must be created with clean layout.
+ node->document().updateStyleAndLayoutIgnorePendingStylesheets();
+ DocumentLifecycle::DisallowTransitionScope disallowTransition(node->document().lifecycle());
+
+ if (!node->layoutObject())
return String();
blink::WebPoint point(x, y);
- SurroundingText surroundingText(createVisiblePositionDeprecated(node->layoutObject()->positionForPoint(static_cast<IntPoint>(point))).deepEquivalent().parentAnchoredEquivalent(), maxLength);
+ SurroundingText surroundingText(createVisiblePosition(node->layoutObject()->positionForPoint(static_cast<IntPoint>(point))).deepEquivalent().parentAnchoredEquivalent(), maxLength);
return surroundingText.content();
}
« no previous file with comments | « third_party/WebKit/Source/core/editing/SurroundingText.cpp ('k') | third_party/WebKit/Source/web/WebSurroundingText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698