RWHV::SelectionBoundsChanged doesn't work correctly when text selection is changed from JavaScript
Reported by
pva...@inf.u-szeged.hu,
Dec 7 2016
|
|||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.28 Safari/537.36 Steps to reproduce the problem: 1. Select text in an input field with the select() JavaScript method: http://www.w3schools.com/jsref/met_text_select.asp What is the expected behavior? I would expect RenderWidgetHostViewBase::SelectionBoundsChanged() and RenderWidgetHostViewBase::SelectionChanged() to be called when text selection is changed from JavaScript. What went wrong? Based on the RenderFrameImpl::didChangeSelection() (content/renderer/render_frame_impl.cc) implementation it seems only input events and selection commands are handled but JavaScript selection operations are ignored by the early return: didChangeSelection() is called but SyncSelectionIfRequired() is not. Did this work before? No Does this work in other browsers? N/A Chrome version: 55.0.2883.28 Channel: n/a OS Version: Flash Version: I think this is rather Content API related issue than Blink. Based on the documentation of the SelectionBoundsChanged() and SelectionChanged() virtual functions in the render_widget_host_view_base.h header they should be called when selection is changed from JavaScript.
,
Dec 8 2016
Unable to reproduce the issue with provided URL http://www.w3schools.com/jsref/met_text_select.asp on Chrome 55.0.2883.75 on Windows 7,10, mac and Linux(ubuntu 14.04Lts)
,
Dec 9 2016
It seems the provided example is not the best since clicking on the button which triggers the select() is considered as an input event thus didChangeSelection() calls SyncSelectionIfRequired(). For reproducing this the select() should be called without user interaction as it would be done if the select() JavaScript method was called via the Content API. To mimic this I've attached an example which calls the select() after the page load.
,
Dec 13 2016
@ pvarga: Thanks for the test case provided. Using the test case observed that on loading the html file itself, the text in the text box was selected. Tried on chrome version 55.0.2883.87 on Windows 10, MAC 10.12.1 and Ubuntu 14.04. Please let us know if this is not expected. If not can you please explain the expected output as well. Thanks.!
,
Dec 13 2016
The text box is selected for me too and this is the expected behavior. The issue is rather related to the Content API than the Chrome browser but I can't set this in the "bug report wizard" :) The issue is that when the selection happens via the javascript API the corresponding virtual functions of the RWHV are not called however it should be called based on the documentation. Use case is when you implement an custom application above the Chromium Content API and want to be informed about the event when the selection is changed in the render view. Summarizing this: visually I can see the selection is changed but unable to detect the change via the Content API. FYI: I've also found that if a new IME composition clears the selection the issue is the same as in case of JavaScript selection change.
,
Dec 20 2016
Thank you for providing more feedback. Adding requester "ranjitkan@chromium.org" for another review and adding "Needs-Review" label for tracking. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Dec 21 2016
Adding Blink editing Content label, so that some one can help to triage the issue further. Thanks.!
,
Jan 13 2017
Adding TE-NeedsTriageHelp as its out of scope from TE end.
,
Jan 16 2017
Hi, Michael. Could you take a look? A developer implementing custom Chromium claims RWHV::SelectionBoundsChanged doesn't work correctly as commented. I don't know Chrome Content API circumstance and if we should work on it.
,
Apr 25 2017
There is yet another use case for this issue: the selected text via javascript should be pastable by a middle mouse button click on Linux. It works in Firefox but doesn't work in Chrome. I suppose, not ignoring non-user-initiated input events in RenderFrameImpl::didChangeSelection would solve this issue.
,
Apr 25 2017
I've just found that the middle click behavior is on purpose: https://bugs.chromium.org/p/chromium/issues/detail?id=12392 However, I still think that the TextInputState should be updated in this case and handle the middle click issue in the browser process where also the text selection is written to the clipboard. Possibly, this can be achieved by passing the input event source information to the RWHV.
,
May 23 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/d48794b9728276c1183b0c56f8cb7afe71b7bca4 commit d48794b9728276c1183b0c56f8cb7afe71b7bca4 Author: pvarga <pvarga@inf.u-szeged.hu> Date: Tue May 23 08:05:19 2017 Update TextSelection for non-user initiated events This makes Chromium Content API to be able to notify about text selection changes triggered by non-user events (eg. JavaScript, IME, autofill). R=creis@chromium.org,nasko@chromium.org,ekaramad@chromium.org BUG=671986 TEST=interactive_ui_tests --gtest_filter=SitePerProcessTextInputManagerTest.NonUserInitiatedTextSelection CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation Review-Url: https://codereview.chromium.org/2856093003 Cr-Commit-Position: refs/heads/master@{#473834} [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/AUTHORS [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/browser/frame_host/render_frame_host_impl.cc [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/browser/frame_host/render_frame_host_impl.h [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/browser/frame_host/render_widget_host_view_guest.cc [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/browser/frame_host/render_widget_host_view_guest.h [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/browser/renderer_host/render_widget_host_impl.cc [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/browser/renderer_host/render_widget_host_impl.h [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/browser/renderer_host/render_widget_host_view_aura.cc [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/browser/renderer_host/render_widget_host_view_base.cc [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/browser/renderer_host/render_widget_host_view_base.h [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/browser/renderer_host/text_input_manager.cc [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/browser/renderer_host/text_input_manager.h [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/common/frame_messages.h [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/public/renderer/render_frame.h [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/public/test/text_input_test_utils.cc [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/public/test/text_input_test_utils.h [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/renderer/pepper/pepper_plugin_instance_impl.cc [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/renderer/render_frame_impl.cc [modify] https://crrev.com/d48794b9728276c1183b0c56f8cb7afe71b7bca4/content/renderer/render_frame_impl.h
,
May 23 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/44664cdc94553b40ccb9979ed4a99b57453b4de6 commit 44664cdc94553b40ccb9979ed4a99b57453b4de6 Author: changwan <changwan@chromium.org> Date: Tue May 23 19:14:34 2017 Revert of Update TextSelection for non-user initiated events (patchset #7 id:120001 of https://codereview.chromium.org/2856093003/ ) Reason for revert: We started to seeing terribly flaky ImeTest on Android after this commit ( crbug.com/725532 ), so try reverting this one. Original issue's description: > Update TextSelection for non-user initiated events > > This makes Chromium Content API to be able to notify about text > selection changes triggered by non-user events (eg. JavaScript, IME, > autofill). > > R=creis@chromium.org,nasko@chromium.org,ekaramad@chromium.org > BUG=671986 > TEST=interactive_ui_tests > --gtest_filter=SitePerProcessTextInputManagerTest.NonUserInitiatedTextSelection > CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation > > Review-Url: https://codereview.chromium.org/2856093003 > Cr-Commit-Position: refs/heads/master@{#473834} > Committed: https://chromium.googlesource.com/chromium/src/+/d48794b9728276c1183b0c56f8cb7afe71b7bca4 TBR=creis@chromium.org,ekaramad@chromium.org,nasko@chromium.org,thestig@chromium.org,pvarga@inf.u-szeged.hu # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=671986 Review-Url: https://codereview.chromium.org/2901093003 Cr-Commit-Position: refs/heads/master@{#474009} [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/AUTHORS [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/chrome/browser/renderer_host/site_per_process_text_input_browsertest.cc [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/browser/frame_host/render_frame_host_impl.cc [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/browser/frame_host/render_frame_host_impl.h [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/browser/frame_host/render_widget_host_view_guest.cc [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/browser/frame_host/render_widget_host_view_guest.h [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/browser/renderer_host/render_widget_host_impl.cc [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/browser/renderer_host/render_widget_host_impl.h [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/browser/renderer_host/render_widget_host_view_aura.cc [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/browser/renderer_host/render_widget_host_view_base.cc [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/browser/renderer_host/render_widget_host_view_base.h [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/browser/renderer_host/text_input_manager.cc [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/browser/renderer_host/text_input_manager.h [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/common/frame_messages.h [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/public/renderer/render_frame.h [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/public/test/text_input_test_utils.cc [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/public/test/text_input_test_utils.h [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/renderer/pepper/pepper_plugin_instance_impl.cc [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/renderer/render_frame_impl.cc [modify] https://crrev.com/44664cdc94553b40ccb9979ed4a99b57453b4de6/content/renderer/render_frame_impl.h
,
Oct 31 2017
,
Dec 6 2017
Lower to Pri-3, since nobody works this last 6 months.
,
Dec 6
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jan 10
|
|||||||||||
►
Sign in to add a comment |
|||||||||||
Comment 1 by ranjitkan@chromium.org
, Dec 8 2016