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

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

Issue 2702403004: Expand FrameSeleciton::start() to increase chances of hoisting update layout (Closed)
Patch Set: 2017-02-22T12:32:36 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/Editor.cpp
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp
index 5a50facd29f34cfd7e38e20e0632135d5b042c34..ea9f3d2b59a7eb5992f2bb678dc6e07b5f0542d2 100644
--- a/third_party/WebKit/Source/core/editing/Editor.cpp
+++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -208,7 +208,8 @@ static bool isCaretAtStartOfWrappedLine(const FrameSelection& selection) {
return false;
if (selection.selectionInDOMTree().affinity() != TextAffinity::Downstream)
return false;
- const Position& position = selection.start();
+ const Position& position =
+ selection.computeVisibleSelectionInDOMTreeDeprecated().start();
return !inSameLine(PositionWithAffinity(position, TextAffinity::Upstream),
PositionWithAffinity(position, TextAffinity::Downstream));
}
@@ -1096,7 +1097,10 @@ void Editor::cut(EditorCommandSource source) {
// TODO(yosin) We should use early return style here.
if (canDeleteRange(selectedRange())) {
spellChecker().updateMarkersForWordsAffectedByEditing(true);
- if (enclosingTextControl(frame().selection().start())) {
+ if (enclosingTextControl(frame()
+ .selection()
+ .computeVisibleSelectionInDOMTreeDeprecated()
+ .start())) {
String plainText = frame().selectedTextForClipboard();
Pasteboard::generalPasteboard()->writePlainText(
plainText, canSmartCopyOrDelete() ? Pasteboard::CanSmartReplace
@@ -1133,7 +1137,10 @@ void Editor::copy() {
// we need clean layout to obtain the selected content.
frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
- if (enclosingTextControl(frame().selection().start())) {
+ if (enclosingTextControl(frame()
+ .selection()
+ .computeVisibleSelectionInDOMTreeDeprecated()
+ .start())) {
Pasteboard::generalPasteboard()->writePlainText(
frame().selectedTextForClipboard(),
canSmartCopyOrDelete() ? Pasteboard::CanSmartReplace

Powered by Google App Engine
This is Rietveld 408576698