diff options
| author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-08-31 17:39:26 +0200 |
|---|---|---|
| committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-05-03 10:57:12 +0200 |
| commit | 9b3238020a99040a4a35a948d1019f397ade82cd (patch) | |
| tree | 59f1f2d4078bc1cb8fa6bd57e1f8e8f87ee3f41a /chromium/content | |
| parent | 6051caad59764c5af47e1800ca3f3d8d79a88d97 (diff) | |
| download | qtwebengine-chromium-9b3238020a99040a4a35a948d1019f397ade82cd.tar.gz | |
Forward cleared selections
The UI layer needs to have the selection updated also when the selection
is not valid because it has been cleared.
Change-Id: I86dac087a8ea94fca4a91a2667658395b65e6046
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/content')
| -rw-r--r-- | chromium/content/renderer/render_frame_impl.cc | 14 | ||||
| -rw-r--r-- | chromium/content/renderer/render_frame_impl.h | 2 |
2 files changed, 7 insertions, 9 deletions
diff --git a/chromium/content/renderer/render_frame_impl.cc b/chromium/content/renderer/render_frame_impl.cc index 1af5e8ec904..fc1f246b3d9 100644 --- a/chromium/content/renderer/render_frame_impl.cc +++ b/chromium/content/renderer/render_frame_impl.cc @@ -1340,7 +1340,7 @@ void RenderFrameImpl::PepperSelectionChanged( PepperPluginInstanceImpl* instance) { if (instance != focused_pepper_plugin_) return; - SyncSelectionIfRequired(); + SyncSelectionIfRequired(false); } RenderWidgetFullscreenPepper* RenderFrameImpl::CreatePepperFullscreenContainer( @@ -1923,7 +1923,7 @@ void RenderFrameImpl::OnReplace(const base::string16& text) { frame_->selectWordAroundCaret(); frame_->replaceSelection(WebString::fromUTF16(text)); - SyncSelectionIfRequired(); + SyncSelectionIfRequired(false); } void RenderFrameImpl::OnReplaceMisspelling(const base::string16& text) { @@ -4042,8 +4042,6 @@ void RenderFrameImpl::didChangeSelection(bool is_empty_selection) { !handling_select_range_) return; - if (is_empty_selection) - selection_text_.clear(); // UpdateTextInputState should be called before SyncSelectionIfRequired. // UpdateTextInputState may send TextInputStateChanged to notify the focus @@ -4051,7 +4049,7 @@ void RenderFrameImpl::didChangeSelection(bool is_empty_selection) { // to notify the selection was changed. Focus change should be notified // before selection change. GetRenderWidget()->UpdateTextInputState(); - SyncSelectionIfRequired(); + SyncSelectionIfRequired(is_empty_selection); } bool RenderFrameImpl::handleCurrentKeyboardEvent() { @@ -6106,9 +6104,9 @@ void RenderFrameImpl::UpdateEncoding(WebFrame* frame, Send(new FrameHostMsg_UpdateEncoding(routing_id_, encoding_name)); } -void RenderFrameImpl::SyncSelectionIfRequired() { +void RenderFrameImpl::SyncSelectionIfRequired(bool is_empty_selection) { base::string16 text; - size_t offset; + size_t offset = 0; gfx::Range range; #if BUILDFLAG(ENABLE_PLUGINS) if (focused_pepper_plugin_) { @@ -6117,7 +6115,7 @@ void RenderFrameImpl::SyncSelectionIfRequired() { // TODO(kinaba): cut as needed. } else #endif - { + if (!is_empty_selection) { WebRange selection = GetRenderWidget()->GetWebWidget()->caretOrSelectionRange(); if (selection.isNull()) diff --git a/chromium/content/renderer/render_frame_impl.h b/chromium/content/renderer/render_frame_impl.h index 763807cf175..04e8dc8aa0b 100644 --- a/chromium/content/renderer/render_frame_impl.h +++ b/chromium/content/renderer/render_frame_impl.h @@ -993,7 +993,7 @@ class CONTENT_EXPORT RenderFrameImpl // it has changed. // TODO(varunjain): delete this method once we figure out how to keep // selection handles in sync with the webpage. - void SyncSelectionIfRequired(); + void SyncSelectionIfRequired(bool is_empty_selection); bool RunJavaScriptDialog(JavaScriptDialogType type, const base::string16& message, |
