Bug 111882 - [Chromium] Switch ContextMenu implementation to CROSS_PLATFORM_CONTEXT_MENU
Summary: [Chromium] Switch ContextMenu implementation to CROSS_PLATFORM_CONTEXT_MENU
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jesus Sanchez-Palencia
URL:
Keywords:
Depends on: 111876
Blocks: 111874
  Show dependency treegraph
 
Reported: 2013-03-08 12:07 PST by Jesus Sanchez-Palencia
Modified: 2013-04-08 16:45 PDT (History)
8 users (show)

See Also:


Attachments
Patch (16.18 KB, patch)
2013-03-13 13:41 PDT, Jesus Sanchez-Palencia
no flags Details | Formatted Diff | Diff
Patch (15.99 KB, patch)
2013-03-14 13:39 PDT, Jesus Sanchez-Palencia
no flags Details | Formatted Diff | Diff
Patch (16.05 KB, patch)
2013-04-03 07:45 PDT, Jesus Sanchez-Palencia
benjamin: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesus Sanchez-Palencia 2013-03-08 12:07:12 PST
Chromium could easily switch to Cross platform context menu implementation and reduce Context Menu related code significantly.
Comment 1 Jesus Sanchez-Palencia 2013-03-13 13:41:13 PDT
Created attachment 192985 [details]
Patch
Comment 2 Jesus Sanchez-Palencia 2013-03-14 13:39:36 PDT
Created attachment 193177 [details]
Patch
Comment 3 Caio Marcelo de Oliveira Filho 2013-03-15 10:19:05 PDT
Comment on attachment 193177 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=193177&action=review

What about making a ContextMenu(Item)?Common.cpp that have empty implementations for the ports that do not make use of the platform hooks for context menu?

This would prevent us for having stub-only file for both EFL and Chromium here. I also think those should not be marked as NotImplemented, since it is simply a hook that will not be used.

> Source/WebKit/chromium/src/ContextMenuClientImpl.cpp:189
> -        return 0;
> +        return defaultMenu;

This looks like a change from previous behavior of this function, is it intended?

> Source/WebKit/chromium/src/ContextMenuClientImpl.cpp:374
> -    return 0;
> +    return defaultMenu;

Same as above.
Comment 4 Jesus Sanchez-Palencia 2013-03-15 10:34:29 PDT
(In reply to comment #3)
> (From update of attachment 193177 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=193177&action=review
> 
> What about making a ContextMenu(Item)?Common.cpp that have empty implementations for the ports that do not make use of the platform hooks for context menu?
> 
> This would prevent us for having stub-only file for both EFL and Chromium here. I also think those should not be marked as NotImplemented, since it is simply a hook that will not be used.

Yes sure, but there are a lot of places in WebCore where we could use stub (common) .cpp files but we just don't, so that is why I haven't added one. I will do that.


> 
> > Source/WebKit/chromium/src/ContextMenuClientImpl.cpp:189
> > -        return 0;
> > +        return defaultMenu;
> 
> This looks like a change from previous behavior of this function, is it intended?
> 
> > Source/WebKit/chromium/src/ContextMenuClientImpl.cpp:374
> > -    return 0;
> > +    return defaultMenu;
> 
> Same as above.

At a first glance I thought that this wouldn't change anything since Chromium will use customizeMenu() to display the ContextMenu anyway, but now I believe that ContextMenuController should know about this null ptr just in case. I will have a look and fix that if needed.
Comment 5 Adam Barth 2013-03-21 13:32:52 PDT
Comment on attachment 193177 [details]
Patch

This looks great!
Comment 6 Adam Barth 2013-03-21 13:33:45 PDT
> I will have a look and fix that if needed.

Ok.  Sounds like we should wait for that before landing this patch.
Comment 7 Jesus Sanchez-Palencia 2013-03-22 06:59:28 PDT
(In reply to comment #6)
> > I will have a look and fix that if needed.
> 
> Ok.  Sounds like we should wait for that before landing this patch.

I had a better look at ContextMenuController and I believe the patch is correct the way it is. This doesn't change any behavior. The nullptr was used there to set m_contextMenu->setPlatformDescription, which in Chromium was an empty implementation. ContextMenuController always rely on having a valid m_contextMenu, and the valid checks are actually related to its items vector size.

Returning the same defaultMenu here is only a way to say that there was no need to customize the menu.


(In reply to comment #4)
> (In reply to comment #3)
> > (From update of attachment 193177 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=193177&action=review
> > 
> > What about making a ContextMenu(Item)?Common.cpp that have empty implementations for the ports that do not make use of the platform hooks for context menu?
> > 
> > This would prevent us for having stub-only file for both EFL and Chromium here. I also think those should not be marked as NotImplemented, since it is simply a hook that will not be used.
> 
> Yes sure, but there are a lot of places in WebCore where we could use stub (common) .cpp files but we just don't, so that is why I haven't added one. I will do that.

I will leave this for another patch, after I'm done with the other ports.


Thanks for having a looking at this patch!
Comment 8 Jesus Sanchez-Palencia 2013-04-03 07:45:39 PDT
Created attachment 196351 [details]
Patch