Bug 15279 - Right clicking over text (or multiple spaces) auto selects the word (or multiple spaces) under it
: Right clicking over text (or multiple spaces) auto selects the word (or multi...
Status: RESOLVED FIXED
Product: WebKit
Classification: Unclassified
Component: WebCore Misc.
: 523.x (Safari 3)
: PC All
: P2 Normal
Assigned To: Nobody
: InRadar, ReviewedForRadar
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-25 11:50 PDT by Rahul Kuchhal
Modified: 2010-04-27 11:07 PDT (History)
10 users (show)

See Also:


Attachments
Disables the word selection behavior for Chromium using an #ifdef. (1.58 KB, patch)
2008-11-12 15:02 PST, Aaron Boodman
no flags Details | Formatted Diff | Diff
Disables the word selection behavior for Chromium, take 2 (1.79 KB, patch)
2008-11-12 22:57 PST, Aaron Boodman
aroben: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rahul Kuchhal 2007-09-25 11:50:04 PDT
Due to changes made in WebCore/page/EventHandler.cpp at @24499 & @24561, when I right click on a page, the word under is auto selected and I don't see the correct context menu (Reload, View Source etc). Instead a selection based menu of Search with Google, Copy etc is shown.
Comment 1 Darin Fisher (:fishd, Google) 2007-09-25 12:59:35 PDT
At least, it seems broken that this happens when right clicking on a link.
Comment 2 Adam Roben (:aroben) 2007-09-25 13:44:15 PDT
As you can see in the ChangeLog comments from r24499 <http://trac.webkit.org/projects/webkit/changeset/24499>, this is actually expected behavior. If you click on something other than a block of text, no selection should be made and you should see the Reload/View Source menu as you expected.
Comment 3 Darin Fisher (:fishd, Google) 2007-09-25 14:12:26 PDT
Really?  Even for hyperlinks?
Comment 4 Darin Fisher (:fishd, Google) 2007-09-25 14:23:50 PDT
This can't be wontfix.  At least it is very broken behavior on Windows.  Can we at least make it possible for embedders to define their own behavior here?
Comment 5 Mark Rowe (bdash) 2007-09-25 14:29:39 PDT
The behaviour when ctrl-clicking on a link in WebKit differs from that in TextEdit, so I think this is worthy of some investigation.  Ctrl-clicking on a link in TextEdit selects the entire URL, while in WebKit it only selects the word under the cursor.  There may be issues with right-clicking on other platforms at well, but at the very least this issue exists on Mac OS as well.
Comment 6 Mark Rowe (bdash) 2007-09-25 14:29:58 PDT
<rdar://problem/5450655>
Comment 7 Matt Lilek (pewtermoose) 2007-09-25 14:51:54 PDT
(In reply to comment #4)
> At least it is very broken behavior on Windows.

ToT on Windows behaves the same as ToT on Mac for me in regards to selection behavior and the contents of the context menu, etc.
Comment 8 Robert Blaut 2008-03-10 13:18:58 PDT
*** Bug 17747 has been marked as a duplicate of this bug. ***
Comment 9 Robert Blaut 2008-03-10 13:23:26 PDT
*** Bug 14399 has been marked as a duplicate of this bug. ***
Comment 10 Luca Bruno 2008-04-06 02:24:41 PDT
On the GTK+ port there's the same problem. When i right-click it selects the words before the cursor.
Comment 11 Robert Blaut 2008-06-06 03:24:29 PDT
*** Bug 19039 has been marked as a duplicate of this bug. ***
Comment 12 Aaron Boodman 2008-11-12 15:02:35 PST
Created attachment 25104 [details]
Disables the word selection behavior for Chromium using an #ifdef.
Comment 13 Adam Roben (:aroben) 2008-11-12 15:11:46 PST
Comment on attachment 25104 [details]
Disables the word selection behavior for Chromium using an #ifdef. 

You should set the review flag to "r?" for new patches to indicate that your patch is ready to review.

> +2008-11-12  aa  <set EMAIL_ADDRESS environment variable>

You should set the EMAIL_ADDRESS environment variable so that prepare-ChangeLog can fill in your email address correctly. You should also set the CHANGE_LOG_NAME environment variable to the name you want used in ChangeLogs.

> +
> +        Reviewed by NOBODY (OOPS!).
> +
> +        * page/EventHandler.cpp:
> +        (WebCore::EventHandler::sendContextMenuEvent):
> +        
> +        Disable word selection on context click for PLATFORM(CHROMIUM).

Normally we reference the Bugzilla bug we're fixing in the ChangeLog. Something like this:

Chromium fix for Bug 15279: Right clicking over text (or multiple spaces) auto selects the word (or multiple spaces) under it

<https://bugs.webkit.org/show_bug.cgi?id=15279>

> @@ -1627,8 +1627,9 @@ bool EventHandler::sendContextMenuEvent(
>      IntPoint viewportPos = v->windowToContents(event.pos());
>      MouseEventWithHitTestResults mev = doc->prepareMouseEvent(HitTestRequest(false, true), viewportPos, event);
>  
> -    // Context menu events shouldn't select text in GTK+ applications.
> -#if !PLATFORM(GTK)
> +    // Context menu events shouldn't select text in GTK+ applications or in Chromium.
> +    // TODO: This should probably be configurable by embedders. Consider making it a WebPreferences setting.

We normally use FIXME instead of TODO. If you have filed the bug for WebPreferences you could reference it here with a URL.

r=me

-Adam
Comment 14 Aaron Boodman 2008-11-12 15:28:51 PST
Note: I talked about this on IRC with aroben. For now, we're going to change this using a macro, but in the future (perhaps when the Chromium mac team gets to this area), we should change it to use a WebPreferences setting.
Comment 15 Aaron Boodman 2008-11-12 22:57:31 PST
Created attachment 25117 [details]
Disables the word selection behavior for Chromium, take 2

New patch. I believe I've addressed all your comments.
Comment 16 Adam Roben (:aroben) 2008-11-13 07:26:45 PST
Comment on attachment 25117 [details]
Disables the word selection behavior for Chromium, take 2

> Index: WebCore/ChangeLog
> ===================================================================
> --- WebCore/ChangeLog	(revision 38339)
> +++ WebCore/ChangeLog	(working copy)
> @@ -1,3 +1,16 @@
> +2008-11-12  aa  aa@chromium.org

We normally use full names in ChangeLog headers, but this isn't a requirement.

r=me
Comment 17 Eric Seidel 2008-12-02 12:38:33 PST
Shouldn't this only be disabled for chromium on windows and linux?
Comment 18 Dimitri Glazkov (Google) 2009-01-15 11:31:25 PST
Committed in https://bugs.webkit.org/show_bug.cgi?id=23351

New bug for solution with WebPreferences created: https://bugs.webkit.org/show_bug.cgi?id=23351