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

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

Issue 2326593003: Audit the use of UpdateStyleAndLayoutIgnorePendingStylesheets in FrameSelection::revealSelection (Closed)
Patch Set: 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/editing/Editor.cpp
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp
index 05ce23eed63f5161958e044fa99fd3829756dc3c..cc654139f369460515b8ebb6883fb3d82c405be4 100644
--- a/third_party/WebKit/Source/core/editing/Editor.cpp
+++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -137,8 +137,13 @@ Editor::RevealSelectionScope::~RevealSelectionScope()
{
DCHECK(m_editor->m_preventRevealSelection);
--m_editor->m_preventRevealSelection;
- if (!m_editor->m_preventRevealSelection)
+ if (!m_editor->m_preventRevealSelection) {
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ m_editor->frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
+
m_editor->frame().selection().revealSelection(ScrollAlignment::alignToEdgeIfNeeded, RevealExtent);
+ }
}
// When an event handler has moved the selection outside of a text control
@@ -827,8 +832,15 @@ bool Editor::insertTextWithoutSendingTextEvent(const String& text, bool selectIn
// Reveal the current selection
if (LocalFrame* editedFrame = selection.start().document()->frame()) {
- if (Page* page = editedFrame->page())
- toLocalFrame(page->focusController().focusedOrMainFrame())->selection().revealSelection(ScrollAlignment::alignCenterIfNeeded);
+ if (Page* page = editedFrame->page()) {
+ LocalFrame* focusedOrMainFrame = toLocalFrame(page->focusController().focusedOrMainFrame());
+
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ focusedOrMainFrame->document()->updateStyleAndLayoutIgnorePendingStylesheets();
+
+ focusedOrMainFrame->selection().revealSelection(ScrollAlignment::alignCenterIfNeeded);
+ }
}
return true;
@@ -1082,6 +1094,10 @@ void Editor::revealSelectionAfterEditingOperation(const ScrollAlignment& alignme
if (m_preventRevealSelection)
return;
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
+
frame().selection().revealSelection(alignment, revealExtentOption);
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.cpp ('k') | third_party/WebKit/Source/core/editing/FrameSelection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698