Bug 60563 - [Chromium] Click event is not fired for a menulist <select>
Summary: [Chromium] Click event is not fired for a menulist <select>
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 61943
Blocks:
  Show dependency treegraph
 
Reported: 2011-05-10 11:16 PDT by Naoki Takano
Modified: 2013-04-11 13:48 PDT (History)
9 users (show)

See Also:


Attachments
Try to forward mouse button event if it is select popup element. (10.77 KB, patch)
2011-05-10 20:05 PDT, Naoki Takano
no flags Details | Formatted Diff | Diff
Use disptachMouseEvent version (7.33 KB, patch)
2011-05-11 19:29 PDT, Naoki Takano
no flags Details | Formatted Diff | Diff
EventHandler version (11.60 KB, patch)
2011-05-12 23:48 PDT, Naoki Takano
no flags Details | Formatted Diff | Diff
Use focused node version. (10.77 KB, patch)
2011-05-24 21:40 PDT, Naoki Takano
no flags Details | Formatted Diff | Diff
Use focused node version. (4.67 KB, patch)
2011-05-25 18:30 PDT, Naoki Takano
no flags Details | Formatted Diff | Diff
Change to use RefPtr. (4.98 KB, patch)
2011-05-26 22:14 PDT, Naoki Takano
no flags Details | Formatted Diff | Diff
Implement unit test (17.97 KB, patch)
2011-05-30 18:49 PDT, Naoki Takano
no flags Details | Formatted Diff | Diff
Fix some nits. (15.15 KB, patch)
2011-05-31 19:12 PDT, Naoki Takano
no flags Details | Formatted Diff | Diff
Added ChangeLog (18.03 KB, patch)
2011-06-01 18:21 PDT, Naoki Takano
no flags Details | Formatted Diff | Diff
Add WEBKIT_IMPLEMENTATION change (18.17 KB, patch)
2011-06-02 23:41 PDT, Naoki Takano
tkent: review-
Details | Formatted Diff | Diff
Add PopupMenuTest.cpp into WebKit.gyp (18.78 KB, patch)
2011-06-06 19:13 PDT, Naoki Takano
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Naoki Takano 2011-05-10 11:16:24 PDT
Popup window consumes the mouse up event and the event doesn't reach to the <select> node.
That is the reason why the even is not fired.

Actually, not only click but also mouseup isn't fired.

The same problem is in WebKit2 here
https://bugs.webkit.org/show_bug.cgi?id=57904

That solution was to send mouse event directly (e.g. using PostMessage() WIn32 API) but for Chromium, I'd rather like to use call API directly to the target <select> node.
Comment 1 Naoki Takano 2011-05-10 20:05:08 PDT
Created attachment 93065 [details]
Try to forward mouse button event if it is select popup element.

The current my wekit-patch command is broken, so I upload my patch manually.

Please review it.
Comment 3 Dimitri Glazkov (Google) 2011-05-11 12:40:17 PDT
Comment on attachment 93065 [details]
Try to forward mouse button event if it is select popup element.

This seems like the wrong approach. From the perspective of WebCore, there shouldn't be a difference in how ports dispatch events.
Comment 4 Naoki Takano 2011-05-11 13:17:34 PDT
Ok,

So could you tell me what approach we need?
Do we need to send mouse event directly?

Thanks,

(In reply to comment #3)
> (From update of attachment 93065 [details])
> This seems like the wrong approach. From the perspective of WebCore, there shouldn't be a difference in how ports dispatch events.
Comment 5 Dimitri Glazkov (Google) 2011-05-11 15:15:46 PDT
(In reply to comment #4)
> Ok,
> 
> So could you tell me what approach we need?
> Do we need to send mouse event directly?

I am not sure. Can we forward the mouse up from the popup? This way we don't need to fire simulated clicks.
Comment 6 Naoki Takano 2011-05-11 15:20:18 PDT
Actually, WebKit2 has the same problem, see
https://bugs.webkit.org/show_bug.cgi?id=57904

Their solution is to send native mouse event to the browser.

But I don't like this way;-(

What do you think?

(In reply to comment #5)
> (In reply to comment #4)
> > Ok,
> > 
> > So could you tell me what approach we need?
> > Do we need to send mouse event directly?
> 
> I am not sure. Can we forward the mouse up from the popup? This way we don't need to fire simulated clicks.
Comment 7 Dimitri Glazkov (Google) 2011-05-11 15:22:04 PDT
(In reply to comment #6)
> Actually, WebKit2 has the same problem, see
> https://bugs.webkit.org/show_bug.cgi?id=57904
> 
> Their solution is to send native mouse event to the browser.
> 
> But I don't like this way;-(
> 
> What do you think?

Can you explain why you don't like it? Forwarding a PlatformMouseEvent from the popup seems like the right thing to do.

> 
> (In reply to comment #5)
> > (In reply to comment #4)
> > > Ok,
> > > 
> > > So could you tell me what approach we need?
> > > Do we need to send mouse event directly?
> > 
> > I am not sure. Can we forward the mouse up from the popup? This way we don't need to fire simulated clicks.
Comment 8 Naoki Takano 2011-05-11 15:24:13 PDT
My intention is not that I don't like to use Windows or Mac specific calls. As you see, they use ::PostMessage(), right?

But if we can use PlatformMouseEvent, it might not use Native calls.

I'll try it.

(In reply to comment #7)
> (In reply to comment #6)
> > Actually, WebKit2 has the same problem, see
> > https://bugs.webkit.org/show_bug.cgi?id=57904
> > 
> > Their solution is to send native mouse event to the browser.
> > 
> > But I don't like this way;-(
> > 
> > What do you think?
> 
> Can you explain why you don't like it? Forwarding a PlatformMouseEvent from the popup seems like the right thing to do.
> 
> > 
> > (In reply to comment #5)
> > > (In reply to comment #4)
> > > > Ok,
> > > > 
> > > > So could you tell me what approach we need?
> > > > Do we need to send mouse event directly?
> > > 
> > > I am not sure. Can we forward the mouse up from the popup? This way we don't need to fire simulated clicks.
Comment 9 Naoki Takano 2011-05-11 16:27:20 PDT
Hmmm... There is the function, Node::dispatchMouseEvent(), so maybe I can use the function to forward the mouse up event to the node.

Thanks,

(In reply to comment #8)
> My intention is not that I don't like to use Windows or Mac specific calls. As you see, they use ::PostMessage(), right?
> 
> But if we can use PlatformMouseEvent, it might not use Native calls.
> 
> I'll try it.
> 
> (In reply to comment #7)
> > (In reply to comment #6)
> > > Actually, WebKit2 has the same problem, see
> > > https://bugs.webkit.org/show_bug.cgi?id=57904
> > > 
> > > Their solution is to send native mouse event to the browser.
> > > 
> > > But I don't like this way;-(
> > > 
> > > What do you think?
> > 
> > Can you explain why you don't like it? Forwarding a PlatformMouseEvent from the popup seems like the right thing to do.
> > 
> > > 
> > > (In reply to comment #5)
> > > > (In reply to comment #4)
> > > > > Ok,
> > > > > 
> > > > > So could you tell me what approach we need?
> > > > > Do we need to send mouse event directly?
> > > > 
> > > > I am not sure. Can we forward the mouse up from the popup? This way we don't need to fire simulated clicks.
Comment 10 Naoki Takano 2011-05-11 19:29:55 PDT
Created attachment 93236 [details]
Use disptachMouseEvent version

Please review again.

I believe this version is much better.

Thanks,
Comment 11 Dimitri Glazkov (Google) 2011-05-12 09:45:37 PDT
Comment on attachment 93236 [details]
Use disptachMouseEvent version

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

I think you're almost there. For the most natural way, try handing this off to eventHandler::handleMouseRelease in AutoFillPopuMenuClient?

> Source/WebCore/rendering/RenderMenuList.cpp:314
> +    node()->dispatchMouseEvent(event, eventNames().mouseupEvent);
> +    node()->dispatchMouseEvent(event, eventNames().clickEvent);

This logic is probably a bit more complicated than this. When you mouse down on a menu, then move the mouse off the menu, should the click still be dispatched? That's not how normal DOM works. See http://codesearch.google.com/codesearch/p#OAMlx_jo-ck/src/third_party/WebKit/Source/WebCore/page/EventHandler.cpp&l=1666&exact_package=chromium. Perhaps you should just hand this to EventHandler?

> Source/WebCore/rendering/RenderTextControlSingleLine.h:118
> +    virtual void dispatchMouseUpAndClick(const PlatformMouseEvent&) { }

This is definitely wrong. We shouldn't dispatch events from RenderObjects.
Comment 12 Naoki Takano 2011-05-12 10:44:11 PDT
Thank you for your review.

(In reply to comment #11)
> (From update of attachment 93236 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=93236&action=review
> 
> I think you're almost there. For the most natural way, try handing this off to eventHandler::handleMouseRelease in AutoFillPopuMenuClient?

I want to make sure what you are saying.

Why do we need to forward the event to eventHandler::handleMouseRelease in AutoFillPopuMenuClient? I guess this is only for select tag event handler and we should not trigger the event in autofill popup.

> 
> > Source/WebCore/rendering/RenderMenuList.cpp:314
> > +    node()->dispatchMouseEvent(event, eventNames().mouseupEvent);
> > +    node()->dispatchMouseEvent(event, eventNames().clickEvent);
> 
> This logic is probably a bit more complicated than this. When you mouse down on a menu, then move the mouse off the menu, should the click still be dispatched? That's not how normal DOM works. See http://codesearch.google.com/codesearch/p#OAMlx_jo-ck/src/third_party/WebKit/Source/WebCore/page/EventHandler.cpp&l=1666&exact_package=chromium. Perhaps you should just hand this to EventHandler?

I see, I try it.

> 
> > Source/WebCore/rendering/RenderTextControlSingleLine.h:118
> > +    virtual void dispatchMouseUpAndClick(const PlatformMouseEvent&) { }
> 
> This is definitely wrong. We shouldn't dispatch events from RenderObjects.
As you see, I don't do anything for the object. dispatchMouseUpAndClick() is pure virtual function, so we need to implement something here.

Or don't we declare the function as pure virtual function?

Thanks
Comment 13 Dimitri Glazkov (Google) 2011-05-12 11:03:04 PDT
Comment on attachment 93236 [details]
Use disptachMouseEvent version

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

>>> Source/WebCore/rendering/RenderTextControlSingleLine.h:118
>>> +    virtual void dispatchMouseUpAndClick(const PlatformMouseEvent&) { }
>> 
>> This is definitely wrong. We shouldn't dispatch events from RenderObjects.
> 
> As you see, I don't do anything for the object. dispatchMouseUpAndClick() is pure virtual function, so we need to implement something here.
> 
> Or don't we declare the function as pure virtual function?
> 
> Thanks

Dispatching DOM events from a RenderObject is just a perverse concept :) RenderTrees and DOM trees are two separate things.
Comment 14 Naoki Takano 2011-05-12 12:28:02 PDT
Ok, I got your point.

But from the event handled class(here PopupListBox), we only can use PopupMenuClient class as a channel to forward the event.

That's why I added the function, dispatchMouseUpAndClick() in PopupMenuClient class.

So is it Ok to change the name to forwardMouseUpAndClick()?

Or do you mean to drag other information like event handler into PopupListBox to forward the event?

If you have any advice or comment, I would appreciate.

Thanks,


(In reply to comment #13)
> (From update of attachment 93236 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=93236&action=review
> 
> >>> Source/WebCore/rendering/RenderTextControlSingleLine.h:118
> >>> +    virtual void dispatchMouseUpAndClick(const PlatformMouseEvent&) { }
> >> 
> >> This is definitely wrong. We shouldn't dispatch events from RenderObjects.
Comment 15 Naoki Takano 2011-05-12 23:48:16 PDT
Created attachment 93407 [details]
EventHandler version

According to your suggestion, I changed to use EventHandler to forward the event.

Actually, just forwarding doesn't work well because of coordinate issue.

As you know, user click the item in select option window, the mouse point is out of bound from the actual select widget.
The event hander isn't fired correctly.

So, inspired by WebKit2 solution, I stored the mouse button down position first, and use the location when the up.

I left dispatchMouseUpAndClick() in AutoFillPopupMenuClient.h, because I didn't get your answer.

Please review again.

Thanks,
Comment 16 Dimitri Glazkov (Google) 2011-05-13 10:43:00 PDT
(In reply to comment #15)
> Created an attachment (id=93407) [details]
> EventHandler version
> 
> According to your suggestion, I changed to use EventHandler to forward the event.
> 
> Actually, just forwarding doesn't work well because of coordinate issue.
> 
> As you know, user click the item in select option window, the mouse point is out of bound from the actual select widget.
> The event hander isn't fired correctly.
> 
> So, inspired by WebKit2 solution, I stored the mouse button down position first, and use the location when the up.
> 
> I left dispatchMouseUpAndClick() in AutoFillPopupMenuClient.h, because I didn't get your answer.
> 
> Please review again.
> 
> Thanks,

This patch looks even worse than the others :(

I am sorry that this is taking so many roundtrips. I don't know the code around popups well enough to offer the solution directly, but I can see a problem with existing code. In short, it's:

Don't reach into WebCore to make stuff in WebKit layer work. 

The long version: See how the patch in bug 57904 doesn't make any changes in WebCore code?  That's because they respect the layering boundaries and realize that even though it is more work to fix this particular issue, the WebCore code should work the same way for _all_ ports. What you're proposing is hooks in WebCore that are only relevant for Chromium. I assert that this is unnecessary.

I actually rather like the solution in bug 57904 and find it very rational. Co-opting the mousedown event seems reasonable and logical from the perspective of WebCore.

Hope this helps.
Comment 17 Dimitri Glazkov (Google) 2011-05-13 10:43:47 PDT
Also, the manual test is using alerts, which is a bit disruptive for the testers. How about something like this:

http://jsfiddle.net/FXBgG/
Comment 18 Naoki Takano 2011-05-13 13:47:20 PDT
Thank you for your review so many times!!
I appreciate your review even if so many round trips;-)
Now I understand more clearly what you are talking about.

AFAIK, in chromium, we use PopupMenuChromium.cpp to handle events.
But it doesn't know the parent window. That's why I forward the event to WebCore.

On the other hand, PopupMenuWin.cpp and WebKit2 have there parent window handles.
That's why they can simulate the mouse click natively.

So I guess, if we cannot touch WebCore part, we should also have to have parent handle in PopupMenuChromium.cpp. Of course the handle should be Chromium specific handle, not native HWND or GTK handles.

But still I'm still not sure how we can simulate mouse event between Chromium and WebKit.


>Kent-san,

Do you have any idea about that, if you know?

Thanks,



(In reply to comment #16)
> (In reply to comment #15)
> > Created an attachment (id=93407) [details] [details]
> > EventHandler version
> > 
> > According to your suggestion, I changed to use EventHandler to forward the event.
> > 
> > Actually, just forwarding doesn't work well because of coordinate issue.
> > 
> > As you know, user click the item in select option window, the mouse point is out of bound from the actual select widget.
> > The event hander isn't fired correctly.
> > 
> > So, inspired by WebKit2 solution, I stored the mouse button down position first, and use the location when the up.
> > 
> > I left dispatchMouseUpAndClick() in AutoFillPopupMenuClient.h, because I didn't get your answer.
> > 
> > Please review again.
> > 
> > Thanks,
> 
> This patch looks even worse than the others :(
> 
> I am sorry that this is taking so many roundtrips. I don't know the code around popups well enough to offer the solution directly, but I can see a problem with existing code. In short, it's:
> 
> Don't reach into WebCore to make stuff in WebKit layer work. 
> 
> The long version: See how the patch in bug 57904 doesn't make any changes in WebCore code?  That's because they respect the layering boundaries and realize that even though it is more work to fix this particular issue, the WebCore code should work the same way for _all_ ports. What you're proposing is hooks in WebCore that are only relevant for Chromium. I assert that this is unnecessary.
> 
> I actually rather like the solution in bug 57904 and find it very rational. Co-opting the mousedown event seems reasonable and logical from the perspective of WebCore.
> 
> Hope this helps.
Comment 19 Naoki Takano 2011-05-14 21:02:55 PDT
After looking around the source code, I guess render_view in Chromium code is better choice to forward mouse up event.

But I'm stuck I cannot forward the event well.

Dimitri,
Are you familiar with render_view message routing in Chromium?

Or do you know who is the right person to ask?

Thanks,

(In reply to comment #18)
> Thank you for your review so many times!!
> I appreciate your review even if so many round trips;-)
> Now I understand more clearly what you are talking about.
> 
> AFAIK, in chromium, we use PopupMenuChromium.cpp to handle events.
> But it doesn't know the parent window. That's why I forward the event to WebCore.
> 
> On the other hand, PopupMenuWin.cpp and WebKit2 have there parent window handles.
> That's why they can simulate the mouse click natively.
> 
> So I guess, if we cannot touch WebCore part, we should also have to have parent handle in PopupMenuChromium.cpp. Of course the handle should be Chromium specific handle, not native HWND or GTK handles.
> 
> But still I'm still not sure how we can simulate mouse event between Chromium and WebKit.
> 
> 
> >Kent-san,
> 
> Do you have any idea about that, if you know?
> 
> Thanks,
> 
> 
> 
> (In reply to comment #16)
> > (In reply to comment #15)
> > > Created an attachment (id=93407) [details] [details] [details]
> > > EventHandler version
> > > 
> > > According to your suggestion, I changed to use EventHandler to forward the event.
> > > 
> > > Actually, just forwarding doesn't work well because of coordinate issue.
> > > 
> > > As you know, user click the item in select option window, the mouse point is out of bound from the actual select widget.
> > > The event hander isn't fired correctly.
> > > 
> > > So, inspired by WebKit2 solution, I stored the mouse button down position first, and use the location when the up.
> > > 
> > > I left dispatchMouseUpAndClick() in AutoFillPopupMenuClient.h, because I didn't get your answer.
> > > 
> > > Please review again.
> > > 
> > > Thanks,
> > 
> > This patch looks even worse than the others :(
> > 
> > I am sorry that this is taking so many roundtrips. I don't know the code around popups well enough to offer the solution directly, but I can see a problem with existing code. In short, it's:
> > 
> > Don't reach into WebCore to make stuff in WebKit layer work. 
> > 
> > The long version: See how the patch in bug 57904 doesn't make any changes in WebCore code?  That's because they respect the layering boundaries and realize that even though it is more work to fix this particular issue, the WebCore code should work the same way for _all_ ports. What you're proposing is hooks in WebCore that are only relevant for Chromium. I assert that this is unnecessary.
> > 
> > I actually rather like the solution in bug 57904 and find it very rational. Co-opting the mousedown event seems reasonable and logical from the perspective of WebCore.
> > 
> > Hope this helps.
Comment 20 Jay Civelli 2011-05-17 10:17:12 PDT
From what I understand, the external popup is consuming the mouse up and down events so they dont have a chance to be sent to the renderer.


I think one way to do it would be to:
- On the Chrome side, change the ViewMsg_SelectPopupMenuItem message (see content/common/view_messages.h) to take an extra parameter which is the click coordinates of the location clicked (probably translated to the page coordinates) when the selection occurred (could be -1, -1 to mean no click triggered the selection). That message is sent by the browser when a popup menu item is clicked from chrome/browser/tab_contents/popup_menu_helper_mac.mm, that would also have to be changed to include that click info. The render view would then pass that click along to the WebKit side.
- On the WebKit Chromium API side the select popup interfaces would have to be modified to take in that new parameter, and the WebViewImpl or ExternalPopupMenu would create and send a click event to the select.

Now that I think of it, another way that would probably be much easier woud be to forward the mouse up event from the external popup menu to the the render widget host view (after translating the coordinates as necessary). That would probably happen in  chrome/browser/tab_contents/popup_menu_helper_mac.mm. That solution is probably better and would only affect Chromium code.
Comment 21 Naoki Takano 2011-05-17 11:32:47 PDT
Jay,

Thank you for your good suggestion!!

I'll try to do it.

For me, Linux is dev environment, so I'll compare between Mac and Linux code.

Thanks,

(In reply to comment #20)
> From what I understand, the external popup is consuming the mouse up and down events so they dont have a chance to be sent to the renderer.
> 
> 
> I think one way to do it would be to:
> - On the Chrome side, change the ViewMsg_SelectPopupMenuItem message (see content/common/view_messages.h) to take an extra parameter which is the click coordinates of the location clicked (probably translated to the page coordinates) when the selection occurred (could be -1, -1 to mean no click triggered the selection). That message is sent by the browser when a popup menu item is clicked from chrome/browser/tab_contents/popup_menu_helper_mac.mm, that would also have to be changed to include that click info. The render view would then pass that click along to the WebKit side.
> - On the WebKit Chromium API side the select popup interfaces would have to be modified to take in that new parameter, and the WebViewImpl or ExternalPopupMenu would create and send a click event to the select.
> 
> Now that I think of it, another way that would probably be much easier woud be to forward the mouse up event from the external popup menu to the the render widget host view (after translating the coordinates as necessary). That would probably happen in  chrome/browser/tab_contents/popup_menu_helper_mac.mm. That solution is probably better and would only affect Chromium code.
Comment 22 Naoki Takano 2011-05-17 13:20:20 PDT
Jay,

After just glance in Chromium source code, Mac is really special and it might not be fitting to Linux and Win.

Because your suggesting way uses external_popup_menu_, and which is called from  RenderView::OnSelectPopupMenuItem(). But external_popup_menu_ looks only used for Mac.

I look into it more, but what do you think of Mac and Win?

Thanks,

(In reply to comment #21)
> Jay,
> 
> Thank you for your good suggestion!!
> 
> I'll try to do it.
> 
> For me, Linux is dev environment, so I'll compare between Mac and Linux code.
> 
> Thanks,
> 
> (In reply to comment #20)
> > From what I understand, the external popup is consuming the mouse up and down events so they dont have a chance to be sent to the renderer.
> > 
> > 
> > I think one way to do it would be to:
> > - On the Chrome side, change the ViewMsg_SelectPopupMenuItem message (see content/common/view_messages.h) to take an extra parameter which is the click coordinates of the location clicked (probably translated to the page coordinates) when the selection occurred (could be -1, -1 to mean no click triggered the selection). That message is sent by the browser when a popup menu item is clicked from chrome/browser/tab_contents/popup_menu_helper_mac.mm, that would also have to be changed to include that click info. The render view would then pass that click along to the WebKit side.
> > - On the WebKit Chromium API side the select popup interfaces would have to be modified to take in that new parameter, and the WebViewImpl or ExternalPopupMenu would create and send a click event to the select.
> > 
> > Now that I think of it, another way that would probably be much easier woud be to forward the mouse up event from the external popup menu to the the render widget host view (after translating the coordinates as necessary). That would probably happen in  chrome/browser/tab_contents/popup_menu_helper_mac.mm. That solution is probably better and would only affect Chromium code.
Comment 23 Jay Civelli 2011-05-17 13:36:40 PDT
Naoki,
You are right, my bad. I mistakingly thought this was a Mac only problem.
I'll look into it a bit more and will have more suggestions soon.

Jay

(In reply to comment #22)
> Jay,
> 
> After just glance in Chromium source code, Mac is really special and it might not be fitting to Linux and Win.
> 
> Because your suggesting way uses external_popup_menu_, and which is called from  RenderView::OnSelectPopupMenuItem(). But external_popup_menu_ looks only used for Mac.
> 
> I look into it more, but what do you think of Mac and Win?
> 
> Thanks,
> 
> (In reply to comment #21)
> > Jay,
> > 
> > Thank you for your good suggestion!!
> > 
> > I'll try to do it.
> > 
> > For me, Linux is dev environment, so I'll compare between Mac and Linux code.
> > 
> > Thanks,
> > 
> > (In reply to comment #20)
> > > From what I understand, the external popup is consuming the mouse up and down events so they dont have a chance to be sent to the renderer.
> > > 
> > > 
> > > I think one way to do it would be to:
> > > - On the Chrome side, change the ViewMsg_SelectPopupMenuItem message (see content/common/view_messages.h) to take an extra parameter which is the click coordinates of the location clicked (probably translated to the page coordinates) when the selection occurred (could be -1, -1 to mean no click triggered the selection). That message is sent by the browser when a popup menu item is clicked from chrome/browser/tab_contents/popup_menu_helper_mac.mm, that would also have to be changed to include that click info. The render view would then pass that click along to the WebKit side.
> > > - On the WebKit Chromium API side the select popup interfaces would have to be modified to take in that new parameter, and the WebViewImpl or ExternalPopupMenu would create and send a click event to the select.
> > > 
> > > Now that I think of it, another way that would probably be much easier woud be to forward the mouse up event from the external popup menu to the the render widget host view (after translating the coordinates as necessary). That would probably happen in  chrome/browser/tab_contents/popup_menu_helper_mac.mm. That solution is probably better and would only affect Chromium code.
Comment 24 Naoki Takano 2011-05-18 13:20:52 PDT
Hi, Jay.

Do you have any update?
Comment 25 Naoki Takano 2011-05-20 12:20:27 PDT
Jay,

Do you have any update since the last discussion?

Thanks,
Comment 26 Naoki Takano 2011-05-23 00:59:10 PDT
Jay,

Stil, I'm thinking how to deal with this problem.

And my current idea is to forward the mouse down event in WebPopupMenuImpl::popupClosed().
In the function, we can get PopupContainer from m_widget, and get ChromeClientImpl::webView().

We can get WebViewClient from webView()::client(). Once we can get WebViewClient which derives RenderView, we can forward mouse click events to RenderView.

The tricky point is to get PopupContainer from m_widget with static_cast. But if we don't change anything in WebCore source code, I guess that is the only way.

What do you think?

Thanks,

(In reply to comment #25)
> Jay,
> 
> Do you have any update since the last discussion?
> 
> Thanks,
Comment 27 Naoki Takano 2011-05-23 12:59:30 PDT
Jay looks pretty busy.

Is there anybody who are familiar with this area?

This bug need knowledge about Chromium, popup window and <select> form.

Thanks,

(In reply to comment #26)
> Jay,
> 
> Stil, I'm thinking how to deal with this problem.
> 
> And my current idea is to forward the mouse down event in WebPopupMenuImpl::popupClosed().
> In the function, we can get PopupContainer from m_widget, and get ChromeClientImpl::webView().
> 
> We can get WebViewClient from webView()::client(). Once we can get WebViewClient which derives RenderView, we can forward mouse click events to RenderView.
> 
> The tricky point is to get PopupContainer from m_widget with static_cast. But if we don't change anything in WebCore source code, I guess that is the only way.
> 
> What do you think?
> 
> Thanks,
> 
> (In reply to comment #25)
> > Jay,
> > 
> > Do you have any update since the last discussion?
> > 
> > Thanks,
Comment 28 Jay Civelli 2011-05-23 14:48:14 PDT
(In reply to comment #26)
> Jay,
> 
> Stil, I'm thinking how to deal with this problem.
> 
> And my current idea is to forward the mouse down event in WebPopupMenuImpl::popupClosed().
> In the function, we can get PopupContainer from m_widget, and get ChromeClientImpl::webView().
> 
> We can get WebViewClient from webView()::client(). Once we can get WebViewClient which derives RenderView, we can forward mouse click events to RenderView.
> 
> The tricky point is to get PopupContainer from m_widget with static_cast. But if we don't change anything in WebCore source code, I guess that is the only way.
> 
> What do you think?

Sorry for the delay.
Wouldn't WebPopupMenuImpl::popupClosed() be called even when the mouse is not involved (popup closed by keyboard action)?
I am looking into it to see if I have other suggestions.
Comment 29 Naoki Takano 2011-05-23 14:51:00 PDT
Yes, I forgot to tell you one more thing.

So, to make sure the even is accepted or cancel, I add one more function in PopupContainer, like bool clickIsAccepted() something like that.

And only if the return value is true, we send the event.

What do you think?

(In reply to comment #28)
> (In reply to comment #26)
> > Jay,
> > 
> > Stil, I'm thinking how to deal with this problem.
> > 
> > And my current idea is to forward the mouse down event in WebPopupMenuImpl::popupClosed().
> > In the function, we can get PopupContainer from m_widget, and get ChromeClientImpl::webView().
> > 
> > We can get WebViewClient from webView()::client(). Once we can get WebViewClient which derives RenderView, we can forward mouse click events to RenderView.
> > 
> > The tricky point is to get PopupContainer from m_widget with static_cast. But if we don't change anything in WebCore source code, I guess that is the only way.
> > 
> > What do you think?
> 
> Sorry for the delay.
> Wouldn't WebPopupMenuImpl::popupClosed() be called even when the mouse is not involved (popup closed by keyboard action)?
> I am looking into it to see if I have other suggestions.
Comment 30 Jay Civelli 2011-05-23 17:20:40 PDT
I kind of dislike having to keep a state (whether mouse was clicked or not).
Could we may be add a pointer to a PlatformEvent as an optional param in PopupMenuClient::valueChanged()?
If there the RenderMenuList would dispatch it to the frame event handler, if NULL nothing would happen.

That way PopupMenuChromium.cpp could decide whether the event needs to be forwarded or not.

Let me know what you think.

Jay
Comment 31 Naoki Takano 2011-05-23 17:38:41 PDT
Hmmm...

But, as you know, PopupMenuClient::valueChanged() is in WebCore domain. So we have to change the logic only for Chromium in WebCore, right?

Dimitri already said,
> This seems like the wrong approach. From the perspective of WebCore, there shouldn't be a difference in how ports dispatch events.

Or does he mean different thing? Did I misunderstand?

Thanks,


(In reply to comment #30)
> I kind of dislike having to keep a state (whether mouse was clicked or not).
> Could we may be add a pointer to a PlatformEvent as an optional param in PopupMenuClient::valueChanged()?
> If there the RenderMenuList would dispatch it to the frame event handler, if NULL nothing would happen.
> 
> That way PopupMenuChromium.cpp could decide whether the event needs to be forwarded or not.
> 
> Let me know what you think.
> 
> Jay
Comment 32 Jay Civelli 2011-05-24 16:34:18 PDT
Here is another suggestion that might be interesting.
The problem when you wat to forward the mouse event from PopupMenuChromium.cpp is that you need access to the node you want to forward this event to.
Since the popup menu is created from  PopupMenuChromium::show() at which point we have access to the Frame (through the FrameView).
We could associate the Frame with the PopupContainer.
So then in PopupListBox::handleMouseReleaseEvent() you could forward the mouse event to the focused node (assuming this is the right one).
That way you would not have to change the PopupMenuClient API.

Let me know what you think.
Comment 33 Naoki Takano 2011-05-24 21:40:04 PDT
Created attachment 94743 [details]
Use focused node version.

Just with only focused node, I cant forward mouse release event!!
Comment 34 Naoki Takano 2011-05-24 21:40:53 PDT
Comment on attachment 94743 [details]
Use focused node version.

Jay

Thank you for your great suggestion!!

Now I can implement the simplest way to forward the event.
Comment 35 Naoki Takano 2011-05-25 12:21:29 PDT
Dimitri or Jay,

Could you review my patch?

Thanks,

(In reply to comment #34)
> (From update of attachment 94743 [details])
> Jay
> 
> Thank you for your great suggestion!!
> 
> Now I can implement the simplest way to forward the event.
Comment 36 Dimitri Glazkov (Google) 2011-05-25 12:29:25 PDT
Comment on attachment 94743 [details]
Use focused node version.

Is this the right patch?
Comment 37 Naoki Takano 2011-05-25 12:43:44 PDT
Sorry, my webkit-patch script didn't work, and I did wrong thing manually;-(

I'll upload it again.

Sorry for bothering you again...

(In reply to comment #36)
> (From update of attachment 94743 [details])
> Is this the right patch?
Comment 38 Naoki Takano 2011-05-25 18:30:15 PDT
Created attachment 94898 [details]
Use focused node version.

Please review.
Comment 39 Jay Civelli 2011-05-26 09:15:39 PDT
Comment on attachment 94898 [details]
Use focused node version.

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

> Source/WebCore/manual-tests/select-element-mouse-event.html:1
> + <!DOCTYPE html>

I wonder if it would be possible to add a test case for this in Source/WebKit/chromium/tests/PopupMenuTest.cpp?
The test framework let's you load HTML in a page, you could then explicitly open the popup and send a fake mouse event to it and ensure everything works as expected.
(and you could test with and without a focused node).

> Source/WebCore/platform/chromium/PopupMenuChromium.cpp:414
> +    listBox()->m_focusedNode = m_frameView->frame()->document()->focusedNode();

It would be a good idea to set m_focusedNode to 0 when we hide the popup, so we don't keep a pointer to a potentially deleted object.
Comment 40 Dimitri Glazkov (Google) 2011-05-26 09:16:35 PDT
Comment on attachment 94898 [details]
Use focused node version.

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

> Source/WebCore/platform/chromium/PopupMenuChromium.cpp:193
> +    void acceptIndex(int index, const PlatformMouseEvent* event = 0);

this should just be const PlatformMouseEvent&.

> Source/WebCore/platform/chromium/PopupMenuChromium.cpp:283
> +    Node* m_focusedNode;

This node could be removed from the tree while the popup is still open. I think you need a RefPtr here.

> Source/WebCore/platform/chromium/PopupMenuChromium.cpp:1104
> +            m_focusedNode->dispatchMouseEvent(*event, eventNames().mouseupEvent);

What's the re-entrance opportunity here? If up event removes the corresponding select element, are we still safe to continue this execution?
Comment 41 Naoki Takano 2011-05-26 10:07:50 PDT
Dimitri and Jay,

Thank you for review.

About test, I'll try it. But I've heard a couple of times, we don't have any good way to handle autofill test.

(In reply to comment #40)
> (From update of attachment 94898 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=94898&action=review
> 
> > Source/WebCore/platform/chromium/PopupMenuChromium.cpp:193
> > +    void acceptIndex(int index, const PlatformMouseEvent* event = 0);
> 
> this should just be const PlatformMouseEvent&.

But acceptIndex() is called by other functions where we don't have event. That's why I declared where with default value.

> > Source/WebCore/platform/chromium/PopupMenuChromium.cpp:283
> > +    Node* m_focusedNode;
> 
> This node could be removed from the tree while the popup is still open. I think you need a RefPtr here.

Ok


> > Source/WebCore/platform/chromium/PopupMenuChromium.cpp:1104
> > +            m_focusedNode->dispatchMouseEvent(*event, eventNames().mouseupEvent);
> 
> What's the re-entrance opportunity here? If up event removes the corresponding select element, are we still safe to continue this execution?
In this case, it should be fine if we use RefPtr.

But to clarify it, do we have to move this dispatch call to upper function PopupListBox::handleMouseReleaseEvent() from here?

If so, acceptIndex() don't have to take event anymore either. But acceptIndex() have to return boolean to check if we should forward event or not.

Thanks,
Comment 42 Naoki Takano 2011-05-26 22:14:33 PDT
Created attachment 95112 [details]
Change to use RefPtr.

Please review.

1. I cannot write automation test, because PopupMenuTest cannot load test html file and cannot test event handler.
2. Change to use RefPtr.
3. Clear m_focusedNode after the event forward.
4. Check select popup, because we don't want to fire when autofill.
Comment 43 Dimitri Glazkov (Google) 2011-05-27 09:10:46 PDT
Comment on attachment 95112 [details]
Change to use RefPtr.

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

ok with nits, if Jay confirms this can't be tested using unit testing framework.

> Source/WebCore/ChangeLog:5
> +        [Chromium]Click event is not fired for a menulist <select>

Need a space between [Chromium] and Click.

> Source/WebCore/ChangeLog:8
> +        Manual test with select-element-mouse-event.html.

Manual test: select-element-mouse-event.html

> Source/WebCore/manual-tests/select-element-mouse-event.html:19
> +  alert('down');

Please don't use alerts. Log into the page itself. That's a lot less intrusive.

> Source/WebCore/platform/chromium/PopupMenuChromium.cpp:684
> +    // Clear m_fcosuedNode here, because we cannot clear in hidePopup() which is called before dispatchMouseEvent() is called.

typo: m_focusedNode.
Comment 44 Jay Civelli 2011-05-27 09:32:27 PDT
Comment on attachment 95112 [details]
Change to use RefPtr.

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

> Source/WebCore/manual-tests/select-element-mouse-event.html:12
> +<select id=s size=1>

I can think of several other important test cases:
- have disabled items in the select and try to click it
- have a onchange event handler that removes the select node from the DOM (we had crashes in the past with such scenarios)
- have a onclick event handler that removes the select node from the DOM
- use the keyboard to make the selection and ensures the right events are sent (change but no click)

Regarding making unit-tests. 
You can load actual content in a WebView from a test. See for example WebFrameTest and WebPageSerializerTest.
These tests use mocking of URLs, but in your case you could probably just get away with a data URL for the main frame content.
I cannot guarantee this is going to work, but I think it would be a good thing to try as having unit-tests for this would be really nice.

> Source/WebCore/platform/chromium/PopupMenuChromium.cpp:685
> +    m_focusedNode = 0;

In the case where acceptIndex returned false, don't we want to keep the m_focusedNode? (the popup might not have been hidden)

> Source/WebCore/platform/chromium/PopupMenuChromium.cpp:1111
> +    return true;

Don't you want to return false in that case?
Comment 45 Naoki Takano 2011-05-28 16:43:36 PDT
Jay,

Thank you for your detail suggestion for the test.

Now I can find how I write unit test.

But this looks like only for Win, and my dev environment is Linux;-(

Actually I have Win7 VMWare environment, so I try to implement it on it. It is really slow though;-(

If I have chance, I want to port this Popup window unit test for Linux. But this is another topic...

Thanks,

(In reply to comment #44)
> (From update of attachment 95112 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=95112&action=review
> 
> > Source/WebCore/manual-tests/select-element-mouse-event.html:12
> > +<select id=s size=1>
> 
> I can think of several other important test cases:
> - have disabled items in the select and try to click it
> - have a onchange event handler that removes the select node from the DOM (we had crashes in the past with such scenarios)
> - have a onclick event handler that removes the select node from the DOM
> - use the keyboard to make the selection and ensures the right events are sent (change but no click)
> 
> Regarding making unit-tests. 
> You can load actual content in a WebView from a test. See for example WebFrameTest and WebPageSerializerTest.
> These tests use mocking of URLs, but in your case you could probably just get away with a data URL for the main frame content.
> I cannot guarantee this is going to work, but I think it would be a good thing to try as having unit-tests for this would be really nice.
> 
> > Source/WebCore/platform/chromium/PopupMenuChromium.cpp:685
> > +    m_focusedNode = 0;
> 
> In the case where acceptIndex returned false, don't we want to keep the m_focusedNode? (the popup might not have been hidden)
> 
> > Source/WebCore/platform/chromium/PopupMenuChromium.cpp:1111
> > +    return true;
> 
> Don't you want to return false in that case?
Comment 46 Naoki Takano 2011-05-30 18:26:05 PDT
Jay,

Thank you for your detail suggestion for the test.

Now I can find how I write unit test.

But this looks like only for Win, and my dev environment is Linux;-(

Actually I have Win7 VMWare environment, so I try to implement it on it. It is really slow though;-(

If I have chance, I want to port this Popup window unit test for Linux. But this is another topic...

Thanks,

(In reply to comment #44)
> (From update of attachment 95112 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=95112&action=review
> 
> > Source/WebCore/manual-tests/select-element-mouse-event.html:12
> > +<select id=s size=1>
> 
> I can think of several other important test cases:
> - have disabled items in the select and try to click it
> - have a onchange event handler that removes the select node from the DOM (we had crashes in the past with such scenarios)
> - have a onclick event handler that removes the select node from the DOM
> - use the keyboard to make the selection and ensures the right events are sent (change but no click)
> 
> Regarding making unit-tests. 
> You can load actual content in a WebView from a test. See for example WebFrameTest and WebPageSerializerTest.
> These tests use mocking of URLs, but in your case you could probably just get away with a data URL for the main frame content.
> I cannot guarantee this is going to work, but I think it would be a good thing to try as having unit-tests for this would be really nice.
> 
> > Source/WebCore/platform/chromium/PopupMenuChromium.cpp:685
> > +    m_focusedNode = 0;
> 
> In the case where acceptIndex returned false, don't we want to keep the m_focusedNode? (the popup might not have been hidden)
> 
> > Source/WebCore/platform/chromium/PopupMenuChromium.cpp:1111
> > +    return true;
> 
> Don't you want to return false in that case?
Comment 47 Naoki Takano 2011-05-30 18:49:39 PDT
Created attachment 95389 [details]
Implement unit test

Jay,

I implemented unit test.

Please review again.
Comment 48 Naoki Takano 2011-05-31 10:33:04 PDT
Jay,

Could you review?

(In reply to comment #47)
> Created an attachment (id=95389) [details]
> Implement unit test
> 
> Jay,
> 
> I implemented unit test.
> 
> Please review again.
Comment 49 Jay Civelli 2011-05-31 14:06:22 PDT
Comment on attachment 95389 [details]
Implement unit test

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

> Source/WebKit/chromium/tests/PopupMenuTest.cpp:255
> +        filePath += "/Source/WebKit/chromium/tests/data/";

Could you move the test files to a subdirectory (ex: data/popup)?
This folder is only going to get more crowded, so it's good to keep it organized.

> Source/WebKit/chromium/tests/PopupMenuTest.cpp:424
> +    // mousedown evnet is held by select node, and we don't simulate the event for the node.

Typo: evnet

> Source/WebKit/chromium/tests/PopupMenuTest.cpp:473
> +    // Make sure no crash, even if select node is moreved on 'change' event handler.

Typo: moreved -> removed

> Source/WebKit/chromium/tests/PopupMenuTest.cpp:495
> +    // Make sure no crash, even if select node is moreved on 'click' event handler.

Same typo as above.
Comment 50 Jay Civelli 2011-05-31 14:07:15 PDT
Great tests! Thanks for writing them!
Some minor comments, otherwise this looks good to me.
Comment 51 Naoki Takano 2011-05-31 19:12:06 PDT
Created attachment 95533 [details]
Fix some nits.

Please review again.
Comment 52 WebKit Commit Bot 2011-06-01 10:53:12 PDT
Comment on attachment 95533 [details]
Fix some nits.

Rejecting attachment 95533 [details] from commit-queue.

Failed to run "['./Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '--bot-id=cr-jail-8', 'land-a..." exit_code: 2

Last 500 characters of output:
ce/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
	M	Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h
r87822 = f5ebb50a8f945b5c8570319b6a74a5d16f3bd332 (refs/remotes/trunk)
	M	Source/WebKit/gtk/webkit/webkitwebframe.cpp
	M	Source/WebKit/gtk/webkit/webkitwebframe.h
	M	Source/WebKit/gtk/ChangeLog
r87823 = 774fb7c2f75f2e5c7f97deebeee7bf94fd600f63 (refs/remotes/trunk)
First, rewinding head to replay your work on top of it...
Fast-forwarded master to refs/remotes/trunk.

Full output: http://queues.webkit.org/results/8752875
Comment 53 Naoki Takano 2011-06-01 10:55:07 PDT
Oops,

I forgot to include ChangeLog;-(

I will include it into the patch tonight...

(In reply to comment #52)
> (From update of attachment 95533 [details])
> Rejecting attachment 95533 [details] from commit-queue.
> 
> Failed to run "['./Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '--bot-id=cr-jail-8', 'land-a..." exit_code: 2
> 
> Last 500 characters of output:
> ce/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
>     M    Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h
> r87822 = f5ebb50a8f945b5c8570319b6a74a5d16f3bd332 (refs/remotes/trunk)
>     M    Source/WebKit/gtk/webkit/webkitwebframe.cpp
>     M    Source/WebKit/gtk/webkit/webkitwebframe.h
>     M    Source/WebKit/gtk/ChangeLog
> r87823 = 774fb7c2f75f2e5c7f97deebeee7bf94fd600f63 (refs/remotes/trunk)
> First, rewinding head to replay your work on top of it...
> Fast-forwarded master to refs/remotes/trunk.
> 
> Full output: http://queues.webkit.org/results/8752875
Comment 54 Naoki Takano 2011-06-01 18:21:58 PDT
Created attachment 95695 [details]
Added ChangeLog

Please commit again.

I just added ChangeLog.
Comment 55 WebKit Commit Bot 2011-06-02 09:45:15 PDT
Comment on attachment 95695 [details]
Added ChangeLog

Clearing flags on attachment: 95695

Committed r87920: <http://trac.webkit.org/changeset/87920>
Comment 56 Adam Barth 2011-06-02 11:08:14 PDT
I had to roll out this patch because it does not compile:

http://build.chromium.org/p/chromium/builders/Win%20Builder%20%28dbg%29%28shared%29/builds/8325/steps/compile/logs/stdio


24>.\tests\PopupMenuTest.cpp(254) :error C2440: 'initializing' : cannot convert from 'WebKit::WebCString' to 'std::basic_string<_Elem,_Traits,_Ax>'
24>        with
24>        [
24>            _Elem=char,
24>            _Traits=std::char_traits<char>,
24>            _Ax=std::allocator<char>
24>        ]
24>        No constructor could take the source type, or constructor overload resolution was ambiguous
24>.\tests\PopupMenuTest.cpp(258) :error C2665: 'WebKit::WebString::fromUTF8' : none of the 2 overloads could convert all the argument types
24>        public\WebString.h(87): could be 'WebKit::WebString WebKit::WebString::fromUTF8(const char *)'
24>        while trying to match the argument list '(std::string)'
24>.\tests\PopupMenuTest.cpp(258) :error C3861: 'GURL': identifier not found
24>.\tests\PopupMenuTest.cpp(270) :error C3861: 'GURL': identifier not found
24>.\tests\PopupMenuTest.cpp(426) :error C2440: '<function-style-cast>' : cannot convert from 'WebKit::WebCString' to 'std::string'
24>        No constructor could take the source type, or constructor overload resolution was ambiguous
24>.\tests\PopupMenuTest.cpp(426) :error C2228: left of '.c_str' must have class/struct/union
24>.\tests\PopupMenuTest.cpp(426) :error C2512: 'testing::AssertionResult' : no appropriate default constructor available
24>.\tests\PopupMenuTest.cpp(438) :error C2440: '<function-style-cast>' : cannot convert from 'WebKit::WebCString' to 'std::string'
24>        No constructor could take the source type, or constructor overload resolution was ambiguous
24>.\tests\PopupMenuTest.cpp(438) :error C2228: left of '.c_str' must have class/struct/union
24>.\tests\PopupMenuTest.cpp(438) :error C2512: 'testing::AssertionResult' : no appropriate default constructor available
24>.\tests\PopupMenuTest.cpp(447) :error C2440: '<function-style-cast>' : cannot convert from 'WebKit::WebCString' to 'std::string'
24>        No constructor could take the source type, or constructor overload resolution was ambiguous
24>.\tests\PopupMenuTest.cpp(447) :error C2228: left of '.c_str' must have class/struct/union
24>.\tests\PopupMenuTest.cpp(447) :error C2512: 'testing::AssertionResult' : no appropriate default constructor available
24>.\tests\PopupMenuTest.cpp(468) :error C2440: '<function-style-cast>' : cannot convert from 'WebKit::WebCString' to 'std::string'
24>        No constructor could take the source type, or constructor overload resolution was ambiguous
24>.\tests\PopupMenuTest.cpp(468) :error C2228: left of '.c_str' must have class/struct/union
24>.\tests\PopupMenuTest.cpp(468) :error C2512: 'testing::AssertionResult' : no appropriate default constructor available
24>.\tests\PopupMenuTest.cpp(490) :error C2440: '<function-style-cast>' : cannot convert from 'WebKit::WebCString' to 'std::string'
24>        No constructor could take the source type, or constructor overload resolution was ambiguous
24>.\tests\PopupMenuTest.cpp(490) :error C2228: left of '.c_str' must have class/struct/union
24>.\tests\PopupMenuTest.cpp(490) :error C2512: 'testing::AssertionResult' : no appropriate default constructor available
24>.\tests\PopupMenuTest.cpp(512) :error C2440: '<function-style-cast>' : cannot convert from 'WebKit::WebCString' to 'std::string'
24>        No constructor could take the source type, or constructor overload resolution was ambiguous
24>.\tests\PopupMenuTest.cpp(512) :error C2228: left of '.c_str' must have class/struct/union
24>.\tests\PopupMenuTest.cpp(512) :error C2512: 'testing::AssertionResult' : no appropriate default constructor available
Comment 57 Naoki Takano 2011-06-02 11:17:52 PDT
Hmmm...

Very strange, I thought PopupMenuTest.cpp is only for chromium, so I wonder why WebKit win build bot try to build...

Do you have any suggestions?

(In reply to comment #56)
> I had to roll out this patch because it does not compile:
> 
> http://build.chromium.org/p/chromium/builders/Win%20Builder%20%28dbg%29%28shared%29/builds/8325/steps/compile/logs/stdio
> 
> 
> 24>.\tests\PopupMenuTest.cpp(254) :error C2440: 'initializing' : cannot convert from 'WebKit::WebCString' to 'std::basic_string<_Elem,_Traits,_Ax>'
> 24>        with
> 24>        [
> 24>            _Elem=char,
> 24>            _Traits=std::char_traits<char>,
> 24>            _Ax=std::allocator<char>
> 24>        ]
> 24>        No constructor could take the source type, or constructor overload resolution was ambiguous
> 24>.\tests\PopupMenuTest.cpp(258) :error C2665: 'WebKit::WebString::fromUTF8' : none of the 2 overloads could convert all the argument types
> 24>        public\WebString.h(87): could be 'WebKit::WebString WebKit::WebString::fromUTF8(const char *)'
> 24>        while trying to match the argument list '(std::string)'
> 24>.\tests\PopupMenuTest.cpp(258) :error C3861: 'GURL': identifier not found
> 24>.\tests\PopupMenuTest.cpp(270) :error C3861: 'GURL': identifier not found
> 24>.\tests\PopupMenuTest.cpp(426) :error C2440: '<function-style-cast>' : cannot convert from 'WebKit::WebCString' to 'std::string'
> 24>        No constructor could take the source type, or constructor overload resolution was ambiguous
> 24>.\tests\PopupMenuTest.cpp(426) :error C2228: left of '.c_str' must have class/struct/union
> 24>.\tests\PopupMenuTest.cpp(426) :error C2512: 'testing::AssertionResult' : no appropriate default constructor available
> 24>.\tests\PopupMenuTest.cpp(438) :error C2440: '<function-style-cast>' : cannot convert from 'WebKit::WebCString' to 'std::string'
> 24>        No constructor could take the source type, or constructor overload resolution was ambiguous
> 24>.\tests\PopupMenuTest.cpp(438) :error C2228: left of '.c_str' must have class/struct/union
> 24>.\tests\PopupMenuTest.cpp(438) :error C2512: 'testing::AssertionResult' : no appropriate default constructor available
> 24>.\tests\PopupMenuTest.cpp(447) :error C2440: '<function-style-cast>' : cannot convert from 'WebKit::WebCString' to 'std::string'
> 24>        No constructor could take the source type, or constructor overload resolution was ambiguous
> 24>.\tests\PopupMenuTest.cpp(447) :error C2228: left of '.c_str' must have class/struct/union
> 24>.\tests\PopupMenuTest.cpp(447) :error C2512: 'testing::AssertionResult' : no appropriate default constructor available
> 24>.\tests\PopupMenuTest.cpp(468) :error C2440: '<function-style-cast>' : cannot convert from 'WebKit::WebCString' to 'std::string'
> 24>        No constructor could take the source type, or constructor overload resolution was ambiguous
> 24>.\tests\PopupMenuTest.cpp(468) :error C2228: left of '.c_str' must have class/struct/union
> 24>.\tests\PopupMenuTest.cpp(468) :error C2512: 'testing::AssertionResult' : no appropriate default constructor available
> 24>.\tests\PopupMenuTest.cpp(490) :error C2440: '<function-style-cast>' : cannot convert from 'WebKit::WebCString' to 'std::string'
> 24>        No constructor could take the source type, or constructor overload resolution was ambiguous
> 24>.\tests\PopupMenuTest.cpp(490) :error C2228: left of '.c_str' must have class/struct/union
> 24>.\tests\PopupMenuTest.cpp(490) :error C2512: 'testing::AssertionResult' : no appropriate default constructor available
> 24>.\tests\PopupMenuTest.cpp(512) :error C2440: '<function-style-cast>' : cannot convert from 'WebKit::WebCString' to 'std::string'
> 24>        No constructor could take the source type, or constructor overload resolution was ambiguous
> 24>.\tests\PopupMenuTest.cpp(512) :error C2228: left of '.c_str' must have class/struct/union
> 24>.\tests\PopupMenuTest.cpp(512) :error C2512: 'testing::AssertionResult' : no appropriate default constructor available
Comment 58 Naoki Takano 2011-06-02 23:41:51 PDT
Created attachment 95858 [details]
Add WEBKIT_IMPLEMENTATION change

Jay,

Still I'm not sure this correct is fix, but I believe WEBKIT_IMPLEMENTATION causes the build error.

Do you know why?

I added #define WEBKIT_IMPLEMENTATION 0, but it seems we have better way...

Thanks,
Comment 59 Naoki Takano 2011-06-03 15:57:45 PDT
Jay,

Could you give me your thought?

(In reply to comment #58)
> Created an attachment (id=95858) [details]
> Add WEBKIT_IMPLEMENTATION change
> 
> Jay,
> 
> Still I'm not sure this correct is fix, but I believe WEBKIT_IMPLEMENTATION causes the build error.
> 
> Do you know why?
> 
> I added #define WEBKIT_IMPLEMENTATION 0, but it seems we have better way...
> 
> Thanks,
Comment 60 Kent Tamura 2011-06-06 07:17:22 PDT
Comment on attachment 95858 [details]
Add WEBKIT_IMPLEMENTATION change

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

> Source/WebKit/chromium/tests/PopupMenuTest.cpp:33
> +#if WEBKIT_IMPLEMENTATION
> +#define WEBKIT_IMPLEMENTATION 0
> +#endif

Don't do this.

> Source/WebKit/chromium/tests/PopupMenuTest.cpp:38
> +#include <webkit/support/webkit_support.h>

Because webkit_support dependency is added, we can't build PopupMenuTest.cpp with Chromium-win (shared) configuration.
You need to add PopupMenuTest.cpp to the sources! section of https://trac.webkit.org/browser/trunk/Source/WebKit/chromium/WebKit.gyp?rev=87948#L642
Comment 61 Naoki Takano 2011-06-06 19:13:10 PDT
Created attachment 96177 [details]
Add PopupMenuTest.cpp into WebKit.gyp

Kent-san,

Please review again.
Comment 62 WebKit Commit Bot 2011-06-07 02:44:37 PDT
Comment on attachment 96177 [details]
Add PopupMenuTest.cpp into WebKit.gyp

Clearing flags on attachment: 96177

Committed r88232: <http://trac.webkit.org/changeset/88232>
Comment 63 Dmitry Lomov 2011-07-08 18:33:29 PDT
(In reply to comment #62)
> (From update of attachment 96177 [details])
> Clearing flags on attachment: 96177
> 
> Committed r88232: <http://trac.webkit.org/changeset/88232>

This changeset introduced a crash in crhromium: http://code.google.com/p/chromium/issues/detail?id=88260