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

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

Issue 2834343002: Make InputMethodController::TextInputType() to use canonicalized position (Closed)
Patch Set: 2017-04-24T15:09:42 Created 3 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cb9ac4ba052bccbb65cbe670ba198d32ce369d10..1d880e513e4a5ed8d765678f2a04352ee79b47ec 100644
--- a/third_party/WebKit/Source/core/editing/InputMethodController.cpp
+++ b/third_party/WebKit/Source/core/editing/InputMethodController.cpp
@@ -263,8 +263,25 @@ int CalculateAfterDeletionLengthsInCodePoints(
return offset;
}
-Element* RootEditableElementOfSelection(const FrameSelection& selection) {
- return RootEditableElementOf(selection.GetSelectionInDOMTree().Base());
+Element* RootEditableElementOfSelection(const FrameSelection& frameSelection) {
+ const SelectionInDOMTree& selection = frameSelection.GetSelectionInDOMTree();
+ if (selection.IsNone())
+ return nullptr;
+ // To avoid update layout, we attempt to get root editable element from
+ // a position where script/user specified.
+ if (Element* editable = RootEditableElementOf(selection.Base()))
+ return editable;
+
+ // This is work around for applications assumes a position before editable
+ // element as editable[1]
+ // [1] http://crbug.com/712761
+
+ // TODO(editing-dev): Use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. see http://crbug.com/590369 for more details.
+ frameSelection.GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets();
+ const VisibleSelection& visibleSeleciton =
+ frameSelection.ComputeVisibleSelectionInDOMTree();
+ return RootEditableElementOf(visibleSeleciton.Start());
}
} // anonymous namespace
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/InputMethodControllerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698