Bug 72370

Summary: [Gtk] display:none has no effect on <option> element
Product: WebKit Reporter: Antaryami Pandia <xqb748>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: cgarcia, mrobinson
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
Proposed Patch
xan.lopez: review-
Updated patch none

Antaryami Pandia
Reported 2011-11-15 02:58:28 PST
The display:none style has no effect on <option> elements. <select> <option>First choice</option> <option style="display: none">You must NOT see this</option> <option>Second choice</option> </select> Bug 8351 is the master bug of this. Bug 49169 fixes the chromium port. This bug will fix the Gtk port.
Attachments
Proposed Patch (2.27 KB, patch)
2011-11-15 03:05 PST, Antaryami Pandia
xan.lopez: review-
Updated patch (2.29 KB, patch)
2011-11-15 21:56 PST, Antaryami Pandia
no flags
Antaryami Pandia
Comment 1 2011-11-15 03:05:12 PST
Created attachment 115134 [details] Proposed Patch Proposed patch. Not adding any test cases as the test cases added in bug 49169 (WebCore/manual-tests/display-none-option.html) is also valid for this bug.
Martin Robinson
Comment 2 2011-11-15 09:24:39 PST
This looks fine to me, but I'd also like cgarcia to take a look at it.
Xan Lopez
Comment 3 2011-11-15 12:07:31 PST
Comment on attachment 115134 [details] Proposed Patch This looks good to me, but I think you'll have to remove the "No new tests. (OOPS!)" thing or the patch will fail to land?
Xan Lopez
Comment 4 2011-11-15 12:08:44 PST
Comment on attachment 115134 [details] Proposed Patch Marking r- per the ChangeLog. cgarcia's comment is still welcome, but if you upload a new patch I think we can just land this!
Antaryami Pandia
Comment 5 2011-11-15 21:56:59 PST
Created attachment 115319 [details] Updated patch Updated patch with review comments.
Carlos Garcia Campos
Comment 6 2011-11-16 00:16:29 PST
Comment on attachment 115319 [details] Updated patch View in context: https://bugs.webkit.org/attachment.cgi?id=115319&action=review > Source/WebCore/platform/gtk/GtkPopupMenu.cpp:72 > - gtk_widget_show(menuItem); > + > + if (gtk_action_is_visible(action)) > + gtk_widget_show(menuItem); Instead of creating a new menu item that will never be shown (because display:none can't change while the popup menu is shown, right?), I think it would be better to simply not create the menu item, In PopupMenuGtk::show() you could do something like: GRefPtr<GtkAction> action = adoptGRef(createGtkActionForMenuItem(i)); if (gtk_action_is_visible(action.get()) m_popup->appendItem(action.get());
Antaryami Pandia
Comment 7 2011-11-16 01:38:25 PST
(In reply to comment #6) > (From update of attachment 115319 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=115319&action=review > > > Source/WebCore/platform/gtk/GtkPopupMenu.cpp:72 > > - gtk_widget_show(menuItem); > > + > > + if (gtk_action_is_visible(action)) > > + gtk_widget_show(menuItem); > > Instead of creating a new menu item that will never be shown (because display:none can't change while the popup menu is shown, right?), I think it would be better to simply not create the menu item, In PopupMenuGtk::show() you could do something like: > > GRefPtr<GtkAction> action = adoptGRef(createGtkActionForMenuItem(i)); > if (gtk_action_is_visible(action.get()) > m_popup->appendItem(action.get()); Yes.The thought behind the change was that the menu item is part of the select box and only its display property is none.For such case we just don't show the item. And in fact I have also explored the option suggested by you earlier.But the problem was, after this piece code is executed we call m_popup->popUp(...) with the "size" parameter we got using client()->listSize(). This causes a mismatch and results in crash. One way to resolve this is, we maintain a counter for number of items those are added and we pass this value. const int counter = 0; if (gtk_action_is_visible(action.get())) { m_popup->appendItem(action.get()); counter++; } ....... m_popup->popUp(..., counter, ...); Please provide your thought.I will modify accordingly.
Carlos Garcia Campos
Comment 8 2011-11-16 01:53:00 PST
(In reply to comment #7) > (In reply to comment #6) > > (From update of attachment 115319 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=115319&action=review > > > > > Source/WebCore/platform/gtk/GtkPopupMenu.cpp:72 > > > - gtk_widget_show(menuItem); > > > + > > > + if (gtk_action_is_visible(action)) > > > + gtk_widget_show(menuItem); > > > > Instead of creating a new menu item that will never be shown (because display:none can't change while the popup menu is shown, right?), I think it would be better to simply not create the menu item, In PopupMenuGtk::show() you could do something like: > > > > GRefPtr<GtkAction> action = adoptGRef(createGtkActionForMenuItem(i)); > > if (gtk_action_is_visible(action.get()) > > m_popup->appendItem(action.get()); > > Yes.The thought behind the change was that the menu item is part of the select box and only its display property is none.For such case we just don't show the item. > > And in fact I have also explored the option suggested by you earlier.But the problem was, after this piece code is executed we call m_popup->popUp(...) with the "size" parameter we got using client()->listSize(). This causes a mismatch and results in crash. I see, in that case I think it's better to keep the item, even hidden, since it's part of the option menu after all. Your patch looks good to me too.
Martin Robinson
Comment 9 2011-11-16 08:42:55 PST
Comment on attachment 115319 [details] Updated patch View in context: https://bugs.webkit.org/attachment.cgi?id=115319&action=review > Source/WebCore/ChangeLog:11 > + * platform/gtk/GtkPopupMenu.cpp: > + (WebCore::GtkPopupMenu::appendItem): > + * platform/gtk/PopupMenuGtk.cpp: > + (WebCore::PopupMenuGtk::createGtkActionForMenuItem): In the future, please remember to fill these in.
WebKit Review Bot
Comment 10 2011-11-16 10:56:23 PST
Comment on attachment 115319 [details] Updated patch Clearing flags on attachment: 115319 Committed r100470: <http://trac.webkit.org/changeset/100470>
Note You need to log in before you can comment on or make changes to this bug.