[webkit-reviews] review denied: [Bug 24692] Allow ChromeClientChromium to access an HTML select element's menu items : [Attachment 28880] Updated patch for handling select elements in the chromium port

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 25 13:24:47 PDT 2009

Darin Fisher (:fishd, Google) <fishd at chromium.org> has denied Paul Godavari
<paul at chromium.org>'s request for review:
Bug 24692: Allow ChromeClientChromium to access an HTML select element's menu

Attachment 28880: Updated patch for handling select elements in the chromium

------- Additional Comments from Darin Fisher (:fishd, Google)
<fishd at chromium.org>
>Index: WebCore/page/chromium/ChromeClientChromium.h
>	  // Notifies the client of a new popup widget.  The client should
>	  // and size the widget with the given bounds, relative to the screen.

>	  virtual void popupOpened(FramelessScrollView* popupView, const
IntRect& bounds, bool focusOnShow) = 0;
>+	  // Similar to popupOpened above, but used for clients that will draw
>+	  // popup menu with native controls and thus need a more information.
>+	  virtual void popupOpenedWithItems(FramelessScrollView* popupView,
const IntRect& bounds,
>+					    bool focusOnShow, int itemHeight,
int selectedIndex,
>+					    const Vector<PopupListData*>&
menuItems) = 0;

train of thought here, sorry...

it occurs to me that in layout-test mode of test_shell we don't currently
have a way to run the tests that probe the drop-down select.  perhaps what
you are doing here would be reusable there.  that's an argument in favor
of not wrapping this new method in an #ifdef :)

perhaps we should also have a static setter on PopupContainer that can be
used to switch between modes?  so instead of an #ifdef, we'd have the Mac
code call that setter at startup.

Just commenting on this API, I'm surprised that you are not also passing
the PopupMenuStyle object.  It seems like we need to still respect some
of the styling options.

popupOpenedWithItems seems like a poor name for this.  what we are really
doing is asking the client to open a popup for us, and we are giving it
all of the data for that.

Maybe the better choice here would be to just pass the PopupContainer as
the parameter to popupOpened.  Then, the popupOpened implementation could
just read the menuItems, itemHeight, and selectedIndex from that.  Then
we would not need a new method on ChromeClientChromium.

>Index: WebCore/platform/chromium/PopupMenuChromium.cpp
> PopupContainer::~PopupContainer()
> {
>     if (m_listBox)
>	  removeChild(m_listBox.get());

instead, it seems like we should just check if m_listBox has a parent.

      if (m_listBox && m_listBox->parent())

>+void PopupContainer::showSelect(const IntRect& rect, FrameView* v, int index)

>+     if (!listBox())
>+	  return;
>+     listBox()->updateFromElement();
>+     // Get the ChromeClient and pass it the popup menu's listbox data.
>+     ChromeClientChromium* client =

nit: this line is really long.	can you wrap it like we do in showPopup?

>+void PopupMenu::show(const IntRect& r, FrameView* v, int index)
> {
>     if (!p.popup)
>	  p.popup = PopupContainer::create(client(), dropDownSettings);
>+    p.popup->showSelect(r, v, index);
>     p.popup->show(r, v, index);

maybe the #ifdef should just move into the PopupContainer::show method
since otherwise the show method doesn't make sense on ChromiumMac?

>Index: WebCore/platform/chromium/PopupMenuChromium.h
>+    // A container for the data for each menu item (represented by <option>

nit: please put "e.g., " in front of "represented" since that is only
one such case where this could be used.

>+    // <optgroup> in a <select> widget) and is used by PopupListBox.
>+    typedef struct PopupListData {

please remove the typedef.  it should just be "struct PopupListData {"

also, I think a better name for this is PopupItem.

>+	  enum Type {
>+	      TypeOption = 0,

nit: no need to initialize to 0 explicitly.

>+	      TypeGroup,
>+	      TypeSeparator
>+	  };
>+	  PopupListData(const String& label, Type type)
>+	      : label(label.copy()), type(type), y(0) {}

nit: the .copy() call is unnecessary.  just use the copy-constructor.

>+	  // Used on Mac Chromium for HTML Select menus.
>+	  void showSelect(const IntRect&, FrameView*, int index);

this comment is a little off since this code is used for more than just
HTML select menus.  It is also used for the autocomplete dropdown, and
there is another HTML usage as well.  Can you come up with a better
name for this method?

More information about the webkit-reviews mailing list