Commit 576af270 authored by mrowe@apple.com's avatar mrowe@apple.com

Bug 27828: Title attribute is not respected on option elements

Fix <https://bugs.webkit.org/show_bug.cgi?id=27828> for Mac.

Reviewed by Adele Peterson and Jon Honeycutt.

No tests added as it is not clear how to test a tool tip from DumpRenderTree.

* platform/PopupMenuClient.h: Add a method for retrieving the tool tip of an item.
* platform/mac/PopupMenuMac.mm:
(WebCore::PopupMenu::populate): Set the tool tip of the menu item to that of the represented item.
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::itemToolTip): Expose the title attribute of the element as the tool tip.
* rendering/RenderMenuList.h:
* rendering/RenderTextControlSingleLine.h:
(WebCore::RenderTextControlSingleLine::itemToolTip): Return an empty string, indicating no tool tip, for
the popup menu in RenderTextControlSingleLine.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@46617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f9ed178f
2009-07-30 Mark Rowe <mrowe@apple.com>
Reviewed by Adele Peterson and Jon Honeycutt.
Fix <https://bugs.webkit.org/show_bug.cgi?id=27828> for Mac.
Bug 27828: Title attribute is not respected on option elements
No tests added as it is not clear how to test a tool tip from DumpRenderTree.
* platform/PopupMenuClient.h: Add a method for retrieving the tool tip of an item.
* platform/mac/PopupMenuMac.mm:
(WebCore::PopupMenu::populate): Set the tool tip of the menu item to that of the represented item.
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::itemToolTip): Expose the title attribute of the element as the tool tip.
* rendering/RenderMenuList.h:
* rendering/RenderTextControlSingleLine.h:
(WebCore::RenderTextControlSingleLine::itemToolTip): Return an empty string, indicating no tool tip, for
the popup menu in RenderTextControlSingleLine.
2009-07-30 Xiaomei Ji <xji@chromium.org>
Reviewed by Dan Bernstein.
......
......@@ -39,6 +39,7 @@ public:
virtual void valueChanged(unsigned listIndex, bool fireEvents = true) = 0;
virtual String itemText(unsigned listIndex) const = 0;
virtual String itemToolTip(unsigned listIndex) const = 0;
virtual bool itemIsEnabled(unsigned listIndex) const = 0;
virtual PopupMenuStyle itemStyle(unsigned listIndex) const = 0;
virtual PopupMenuStyle menuStyle() const = 0;
......
......@@ -91,6 +91,7 @@ void PopupMenu::populate()
NSMenuItem* menuItem = [m_popup.get() lastItem];
[menuItem setAttributedTitle:string];
[menuItem setEnabled:client()->itemIsEnabled(i)];
[menuItem setToolTip:client()->itemToolTip(i)];
[string release];
}
}
......
......@@ -318,6 +318,13 @@ String RenderMenuList::itemText(unsigned listIndex) const
return String();
}
String RenderMenuList::itemToolTip(unsigned listIndex) const
{
SelectElement* select = toSelectElement(static_cast<Element*>(node()));
Element* element = select->listItems()[listIndex];
return element->title();
}
bool RenderMenuList::itemIsEnabled(unsigned listIndex) const
{
SelectElement* select = toSelectElement(static_cast<Element*>(node()));
......
......@@ -73,6 +73,7 @@ private:
// PopupMenuClient methods
virtual String itemText(unsigned listIndex) const;
virtual String itemToolTip(unsigned listIndex) const;
virtual bool itemIsEnabled(unsigned listIndex) const;
virtual PopupMenuStyle itemStyle(unsigned listIndex) const;
virtual PopupMenuStyle menuStyle() const;
......
......@@ -98,6 +98,7 @@ private:
// PopupMenuClient methods
virtual void valueChanged(unsigned listIndex, bool fireEvents = true);
virtual String itemText(unsigned listIndex) const;
virtual String itemToolTip(unsigned) const { return String(); }
virtual bool itemIsEnabled(unsigned listIndex) const;
virtual PopupMenuStyle itemStyle(unsigned listIndex) const;
virtual PopupMenuStyle menuStyle() const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment