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

Unified Diff: third_party/WebKit/Source/core/editing/FrameSelection.cpp

Issue 2292913002: Ensure clean layout before calling plainText() (flat tree version) (Closed)
Patch Set: 201608301918 Created 4 years, 4 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/editing/FrameSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
index 308f084bb748271753315bcbb0f1f7276e5560ab..65f8e46427a3250895e0cb56bfd2b998f8c25b41 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -1071,11 +1071,25 @@ String FrameSelection::selectedHTMLForClipboard() const
String FrameSelection::selectedText(TextIteratorBehavior behavior) const
{
+ if (!isAvailable())
+ return emptyString();
+
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ m_document->updateStyleAndLayoutIgnorePendingStylesheets();
+
return extractSelectedText(*this, behavior);
}
String FrameSelection::selectedTextForClipboard() const
yosin_UTC9 2016/08/31 04:58:21 There are only three call sites of selectedTextFor
Xiaocheng 2016/09/02 05:37:24 I guess the layout is already clean when called fr
{
+ if (!isAvailable())
+ return emptyString();
+
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ m_document->updateStyleAndLayoutIgnorePendingStylesheets();
+
if (m_frame->settings() && m_frame->settings()->selectionIncludesAltImageText())
return extractSelectedText(*this, TextIteratorEmitsImageAltText);
return selectedText();
yosin_UTC9 2016/08/31 04:58:21 It seems we can replace |selectedText()| call to |
Xiaocheng 2016/09/02 05:37:24 Makes sense. Done.

Powered by Google App Engine
This is Rietveld 408576698