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

Unified Diff: Source/web/WebLocalFrameImpl.cpp

Issue 330613002: Copying text closes the keyboard and the text input gets unfocused, forcing virtual keyboard is get… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated code based on self review. Created 6 years, 6 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 | « Source/web/WebLocalFrameImpl.h ('k') | Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebLocalFrameImpl.cpp
diff --git a/Source/web/WebLocalFrameImpl.cpp b/Source/web/WebLocalFrameImpl.cpp
index 9da6d1bc717b6c2687451c6a1db43f858cdc1764..c2e4a7605977dea95d620971f7948e6fcdeedbe3 100644
--- a/Source/web/WebLocalFrameImpl.cpp
+++ b/Source/web/WebLocalFrameImpl.cpp
@@ -1842,6 +1842,31 @@ void WebLocalFrameImpl::setFindEndstateFocusAndSelection()
}
}
+bool WebLocalFrameImpl::setCaretSelectionFromRangeSelection()
+{
+ if (hasSelection()) {
yosin_UTC9 2014/06/13 04:20:15 nit: We prefer early return, e.g. if (!hasSelecti
+ // Check whether Selection exists
+ FrameSelection& selection = frame()->selection();
+ if (selection.isInTextField() && selection.isRange()) {
yosin_UTC9 2014/06/13 04:20:15 We may want not lose selection for contenteditable
AKVT 2014/06/16 10:34:34 Done.
AKVT 2014/06/16 10:34:34 Done.
+ // Check whether it's a range selection. It appears to be reduandant.
yosin_UTC9 2014/06/13 04:20:15 It seems Selection.collapseToEnd() == selection().
AKVT 2014/06/16 10:34:34 Done.
+ // During copy, Range selection should be available. For safety purpse added this condition.
Yuta Kitamura 2014/06/16 07:58:43 typo: purpse
AKVT 2014/06/16 10:34:34 Done.
+ RefPtrWillBeRawPtr<Range> selectedRange = selection.toNormalizedRange();
+ if (!selectedRange)
+ return false;
+
+ int startOffset = selectedRange->startOffset();
+ int endOffset = selectedRange->endOffset();
+ if (startOffset != endOffset) {
+ // Convert to Caret selection without clearing selection to allow continouous editing after copy.
+ frame()->inputMethodController().setEditableSelectionOffsets(PlainTextRange(endOffset, endOffset));
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
void WebLocalFrameImpl::didFail(const ResourceError& error, bool wasProvisional)
{
if (!client())
« no previous file with comments | « Source/web/WebLocalFrameImpl.h ('k') | Source/web/WebRemoteFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698