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
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);
}
......
......@@ -326,6 +326,10 @@ void HTMLTextAreaElement::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*
// that case, and nothing in the text field will be removed.
unsigned selectionLength = 0;
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());
}
DCHECK_GE(currentLength, selectionLength);
......
......@@ -419,6 +419,10 @@ void TextFieldInputType::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*
// that case, and nothing in the text field will be removed.
unsigned selectionLength = 0;
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();
}
DCHECK_GE(oldLength, selectionLength);
......
......@@ -1117,6 +1117,10 @@ WebString WebLocalFrameImpl::selectionAsText() const
if (pluginContainer)
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);
#if OS(WIN)
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