Index: third_party/WebKit/Source/core/editing/DOMSelection.cpp |
diff --git a/third_party/WebKit/Source/core/editing/DOMSelection.cpp b/third_party/WebKit/Source/core/editing/DOMSelection.cpp |
index 73136ce983b8d43220fa26e51654abc49057bda2..4b379b6c1f203194c4aed59ce1d5689f9d86a0f6 100644 |
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp |
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp |
@@ -233,6 +233,13 @@ void DOMSelection::collapseToEnd(ExceptionState& exceptionState) { |
return; |
} |
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
+ // needs to be audited. See http://crbug.com/590369 for more details. |
+ // In the long term, we should change FrameSelection::setSelection to take a |
+ // parameter that does not require clean layout, so that modifying selection |
+ // no longer performs synchronous layout by itself. |
+ frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
+ |
frame()->selection().moveTo(selection.end(), SelDefaultAffinity); |
} |
@@ -248,6 +255,13 @@ void DOMSelection::collapseToStart(ExceptionState& exceptionState) { |
return; |
} |
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
+ // needs to be audited. See http://crbug.com/590369 for more details. |
+ // In the long term, we should change FrameSelection::setSelection to take a |
+ // parameter that does not require clean layout, so that modifying selection |
+ // no longer performs synchronous layout by itself. |
+ frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
+ |
frame()->selection().moveTo(selection.start(), SelDefaultAffinity); |
} |
@@ -444,6 +458,13 @@ void DOMSelection::addRange(Range* newRange) { |
return; |
} |
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
+ // needs to be audited. See http://crbug.com/590369 for more details. |
+ // In the long term, we should change FrameSelection::setSelection to take a |
+ // parameter that does not require clean layout, so that modifying selection |
+ // no longer performs synchronous layout by itself. |
+ frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
Xiaocheng
2016/10/04 01:01:40
Originally, DOMSelection::addRange doesn't trigger
yosin_UTC9
2016/10/04 01:52:06
Upon failure, we don't grantee state. So, it shoul
|
+ |
if (selection.isNone()) { |
selection.setSelectedRange(newRange, VP_DEFAULT_AFFINITY); |
return; |