Commit 34509f0a authored by xiaochengh's avatar xiaochengh Committed by Commit bot

Audit the use of updateStyleAndLayoutIgnorePendingStylesheets in FrameSelection::selectedText

BUG=590369

Review-Url: https://codereview.chromium.org/2315223002
Cr-Commit-Position: refs/heads/master@{#417156}
parent 362b0c75
...@@ -1071,13 +1071,6 @@ String FrameSelection::selectedHTMLForClipboard() const ...@@ -1071,13 +1071,6 @@ String FrameSelection::selectedHTMLForClipboard() const
String FrameSelection::selectedText(TextIteratorBehavior behavior) 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); return extractSelectedText(*this, behavior);
} }
......
...@@ -326,6 +326,10 @@ void HTMLTextAreaElement::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent* ...@@ -326,6 +326,10 @@ void HTMLTextAreaElement::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*
// that case, and nothing in the text field will be removed. // that case, and nothing in the text field will be removed.
unsigned selectionLength = 0; unsigned selectionLength = 0;
if (focused()) { if (focused()) {
// TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
// needs to be audited. See http://crbug.com/590369 for more details.
document().updateStyleAndLayoutIgnorePendingStylesheets();
selectionLength = computeLengthForSubmission(document().frame()->selection().selectedText()); selectionLength = computeLengthForSubmission(document().frame()->selection().selectedText());
} }
DCHECK_GE(currentLength, selectionLength); DCHECK_GE(currentLength, selectionLength);
......
...@@ -419,6 +419,10 @@ void TextFieldInputType::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent* ...@@ -419,6 +419,10 @@ void TextFieldInputType::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*
// that case, and nothing in the text field will be removed. // that case, and nothing in the text field will be removed.
unsigned selectionLength = 0; unsigned selectionLength = 0;
if (element().focused()) { if (element().focused()) {
// TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
// needs to be audited. See http://crbug.com/590369 for more details.
element().document().updateStyleAndLayoutIgnorePendingStylesheets();
selectionLength = element().document().frame()->selection().selectedText().length(); selectionLength = element().document().frame()->selection().selectedText().length();
} }
DCHECK_GE(oldLength, selectionLength); DCHECK_GE(oldLength, selectionLength);
......
...@@ -1117,6 +1117,10 @@ WebString WebLocalFrameImpl::selectionAsText() const ...@@ -1117,6 +1117,10 @@ WebString WebLocalFrameImpl::selectionAsText() const
if (pluginContainer) if (pluginContainer)
return pluginContainer->plugin()->selectionAsText(); return pluginContainer->plugin()->selectionAsText();
// TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
// needs to be audited. See http://crbug.com/590369 for more details.
frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
String text = frame()->selection().selectedText(TextIteratorEmitsObjectReplacementCharacter); String text = frame()->selection().selectedText(TextIteratorEmitsObjectReplacementCharacter);
#if OS(WIN) #if OS(WIN)
replaceNewlinesWithWindowsStyleNewlines(text); replaceNewlinesWithWindowsStyleNewlines(text);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment