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

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

Issue 2704933006: Expand FrameSeleciton::rootEditableElement() to increase chances of hoisting update layout (Closed)
Patch Set: 2017-02-21T15:42:51 Created 3 years, 10 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/InputMethodController.cpp
diff --git a/third_party/WebKit/Source/core/editing/InputMethodController.cpp b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
index 01eaa00c9e91afeec04a76f01c97f5ee661a4128..966c2cfc88b4898a02dabe6c5b399ddc820dbe22 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodController.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
@@ -279,7 +279,11 @@ bool InputMethodController::finishComposingText(
return true;
}
- Element* rootEditableElement = frame().selection().rootEditableElement();
+ Element* rootEditableElement =
+ frame()
+ .selection()
+ .computeVisibleSelectionInDOMTreeDeprecated()
+ .rootEditableElement();
if (!rootEditableElement)
return false;
PlainTextRange compositionRange =
@@ -374,7 +378,11 @@ bool InputMethodController::replaceCompositionAndMoveCaret(
const String& text,
int relativeCaretPosition,
const Vector<CompositionUnderline>& underlines) {
- Element* rootEditableElement = frame().selection().rootEditableElement();
+ Element* rootEditableElement =
+ frame()
+ .selection()
+ .computeVisibleSelectionInDOMTreeDeprecated()
+ .rootEditableElement();
if (!rootEditableElement)
return false;
DCHECK(hasComposition());
@@ -419,7 +427,11 @@ bool InputMethodController::insertTextAndMoveCaret(
if (!insertText(text))
return false;
- Element* rootEditableElement = frame().selection().rootEditableElement();
+ Element* rootEditableElement =
+ frame()
+ .selection()
+ .computeVisibleSelectionInDOMTreeDeprecated()
+ .rootEditableElement();
if (rootEditableElement) {
addCompositionUnderlines(underlines, rootEditableElement, textStart);
}
@@ -626,7 +638,10 @@ void InputMethodController::setCompositionFromExistingText(
const Vector<CompositionUnderline>& underlines,
unsigned compositionStart,
unsigned compositionEnd) {
- Element* editable = frame().selection().rootEditableElement();
+ Element* editable = frame()
+ .selection()
+ .computeVisibleSelectionInDOMTreeDeprecated()
+ .rootEditableElement();
if (!editable)
return;
@@ -689,7 +704,11 @@ EphemeralRange InputMethodController::ephemeralRangeForOffsets(
const PlainTextRange& offsets) const {
if (offsets.isNull())
return EphemeralRange();
- Element* rootEditableElement = frame().selection().rootEditableElement();
+ Element* rootEditableElement =
+ frame()
+ .selection()
+ .computeVisibleSelectionInDOMTreeDeprecated()
+ .rootEditableElement();
if (!rootEditableElement)
return EphemeralRange();
@@ -726,7 +745,11 @@ PlainTextRange InputMethodController::createRangeForSelection(
start = std::max(start, 0);
end = std::max(end, start);
- Element* rootEditableElement = frame().selection().rootEditableElement();
+ Element* rootEditableElement =
+ frame()
+ .selection()
+ .computeVisibleSelectionInDOMTreeDeprecated()
+ .rootEditableElement();
if (!rootEditableElement)
return PlainTextRange();
const EphemeralRange& range =
@@ -813,7 +836,10 @@ void InputMethodController::deleteSurroundingText(int before, int after) {
if (selectionOffsets.isNull())
return;
Element* const rootEditableElement =
- frame().selection().rootEditableElement();
+ frame()
+ .selection()
+ .computeVisibleSelectionInDOMTreeDeprecated()
+ .rootEditableElement();
if (!rootEditableElement)
return;
int selectionStart = static_cast<int>(selectionOffsets.start());
@@ -877,7 +903,10 @@ WebTextInputInfo InputMethodController::textInputInfo() const {
// plugins/mouse-capture-inside-shadow.html reaches here.
return info;
}
- Element* element = frame().selection().rootEditableElement();
+ Element* element = frame()
+ .selection()
+ .computeVisibleSelectionInDOMTreeDeprecated()
+ .rootEditableElement();
if (!element)
return info;
« no previous file with comments | « third_party/WebKit/Source/core/editing/Editor.cpp ('k') | third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698