 Chromium Code Reviews
 Chromium Code Reviews 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
    
  
    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| 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()) |