Title: [88021] trunk/Source
Revision
88021
Author
[email protected]
Date
2011-06-03 09:00:25 -0700 (Fri, 03 Jun 2011)

Log Message

2011-06-03  Naoki Takano  <[email protected]>

        Reviewed by Eric Seidel.

        [Chromium] Call setToolTipText() in WebPopupMenuImpl mouse move handler to show tool tip in select popup window.
        https://bugs.webkit.org/show_bug.cgi?id=61260
        http://code.google.com/p/chromium/issues/detail?id=12721

        Manual test: select-popup-tooltip-test.html

        * manual-tests/select-popup-tooltip-test.html: Added.
        * platform/chromium/PopupMenuChromium.cpp:
        (WebCore::PopupContainer::getSelectedItemToolTip): Get selected item tooltip string according to hovering mouse position.
        * platform/chromium/PopupMenuChromium.h: Add getSelectedItemToolTip() declaration.
2011-06-03  Naoki Takano  <[email protected]>

        Reviewed by Eric Seidel.

        [Chromium] Call setToolTipText() in WebPopupMenuImpl mouse move handler to show tool tip in select popup window.
        https://bugs.webkit.org/show_bug.cgi?id=61260
        http://code.google.com/p/chromium/issues/detail?id=12721

        * public/WebMenuItemInfo.h: Add toolTip.
        * public/WebViewClient.h: Remove setToolTipText().
        * public/WebWidgetClient.h: Add setTooTipText().
        (WebKit::WebWidgetClient::setToolTipText):
        * src/ExternalPopupMenu.cpp:
        (WebKit::ExternalPopupMenu::getPopupMenuInfo): Add popupItem.toolTip set.
        * src/WebPopupMenuImpl.cpp:
        (WebKit::WebPopupMenuImpl::MouseMove): Call setToolTipText().

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (88020 => 88021)


--- trunk/Source/WebCore/ChangeLog	2011-06-03 15:45:27 UTC (rev 88020)
+++ trunk/Source/WebCore/ChangeLog	2011-06-03 16:00:25 UTC (rev 88021)
@@ -1,3 +1,18 @@
+2011-06-03  Naoki Takano  <[email protected]>
+
+        Reviewed by Eric Seidel.
+
+        [Chromium] Call setToolTipText() in WebPopupMenuImpl mouse move handler to show tool tip in select popup window.
+        https://bugs.webkit.org/show_bug.cgi?id=61260
+        http://code.google.com/p/chromium/issues/detail?id=12721
+
+        Manual test: select-popup-tooltip-test.html
+
+        * manual-tests/select-popup-tooltip-test.html: Added.
+        * platform/chromium/PopupMenuChromium.cpp:
+        (WebCore::PopupContainer::getSelectedItemToolTip): Get selected item tooltip string according to hovering mouse position.
+        * platform/chromium/PopupMenuChromium.h: Add getSelectedItemToolTip() declaration.
+
 2011-06-03  Rob Buis  <[email protected]>
 
         Reviewed by Nikolas Zimmermann.

Added: trunk/Source/WebCore/manual-tests/select-popup-tooltip-test.html (0 => 88021)


--- trunk/Source/WebCore/manual-tests/select-popup-tooltip-test.html	                        (rev 0)
+++ trunk/Source/WebCore/manual-tests/select-popup-tooltip-test.html	2011-06-03 16:00:25 UTC (rev 88021)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<body>
+<h3> Test tool tip is correctly shown when popup select is displayed.</h3>
+<ol>
+<li>Click the following select tag.</li>
+<li> Move mouse cursor on "option 1" and stop moving.</li>
+<li> After seconds, make sure you can see tool tip text "This is the first option".</li>
+<li> Move mouse cursor on "option 2" and stop moving.</li>
+<li> Make sure you can see tool tip text "This is the second option".</li>
+</ol>
+
+<select size=1>
+<option title="This is the first option">option 1</option>
+<option title="This is the second option">option 2</option>
+<option title="This is the third option">option 3</option>
+</select>
+</body>
+</html>

Modified: trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp (88020 => 88021)


--- trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp	2011-06-03 15:45:27 UTC (rev 88020)
+++ trunk/Source/WebCore/platform/chromium/PopupMenuChromium.cpp	2011-06-03 16:00:25 UTC (rev 88021)
@@ -616,6 +616,13 @@
     return m_listBox->items();
 }
 
+String PopupContainer::getSelectedItemToolTip()
+{
+    // We cannot use m_popupClient->selectedIndex() to choose tooltip message,
+    // because the selectedIndex() might return final selected index, not hovering selection.
+    return listBox()->m_popupClient->itemToolTip(listBox()->m_selectedIndex);
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 // PopupListBox implementation
 

Modified: trunk/Source/WebCore/platform/chromium/PopupMenuChromium.h (88020 => 88021)


--- trunk/Source/WebCore/platform/chromium/PopupMenuChromium.h	2011-06-03 15:45:27 UTC (rev 88020)
+++ trunk/Source/WebCore/platform/chromium/PopupMenuChromium.h	2011-06-03 16:00:25 UTC (rev 88021)
@@ -167,6 +167,9 @@
 
     PopupType popupType() const { return m_popupType; }
 
+    // While hovering popup menu window, we want to show tool tip message.
+    String getSelectedItemToolTip();
+
 private:
     friend class WTF::RefCounted<PopupContainer>;
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (88020 => 88021)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-06-03 15:45:27 UTC (rev 88020)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-06-03 16:00:25 UTC (rev 88021)
@@ -1,3 +1,20 @@
+2011-06-03  Naoki Takano  <[email protected]>
+
+        Reviewed by Eric Seidel.
+
+        [Chromium] Call setToolTipText() in WebPopupMenuImpl mouse move handler to show tool tip in select popup window.
+        https://bugs.webkit.org/show_bug.cgi?id=61260
+        http://code.google.com/p/chromium/issues/detail?id=12721
+
+        * public/WebMenuItemInfo.h: Add toolTip.
+        * public/WebViewClient.h: Remove setToolTipText().
+        * public/WebWidgetClient.h: Add setTooTipText().
+        (WebKit::WebWidgetClient::setToolTipText):
+        * src/ExternalPopupMenu.cpp:
+        (WebKit::ExternalPopupMenu::getPopupMenuInfo): Add popupItem.toolTip set.
+        * src/WebPopupMenuImpl.cpp:
+        (WebKit::WebPopupMenuImpl::MouseMove): Call setToolTipText().
+
 2011-06-03  Hans Wennborg  <[email protected]>
 
         Reviewed by Steve Block.

Modified: trunk/Source/WebKit/chromium/public/WebMenuItemInfo.h (88020 => 88021)


--- trunk/Source/WebKit/chromium/public/WebMenuItemInfo.h	2011-06-03 15:45:27 UTC (rev 88020)
+++ trunk/Source/WebKit/chromium/public/WebMenuItemInfo.h	2011-06-03 16:00:25 UTC (rev 88021)
@@ -57,6 +57,7 @@
     }
 
     WebString label;
+    WebString toolTip;
     Type type;
     unsigned action;
     WebTextDirection textDirection;

Modified: trunk/Source/WebKit/chromium/public/WebViewClient.h (88020 => 88021)


--- trunk/Source/WebKit/chromium/public/WebViewClient.h	2011-06-03 15:45:27 UTC (rev 88020)
+++ trunk/Source/WebKit/chromium/public/WebViewClient.h	2011-06-03 16:00:25 UTC (rev 88021)
@@ -227,9 +227,6 @@
     // Called when keyboard focus switches to an anchor with the given URL.
     virtual void setKeyboardFocusURL(const WebURL&) { }
 
-    // Called when a tooltip should be shown at the current cursor position.
-    virtual void setToolTipText(const WebString&, WebTextDirection hint) { }
-
     // Shows a context menu with commands relevant to a specific element on
     // the given frame. Additional context data is supplied.
     virtual void showContextMenu(WebFrame*, const WebContextMenuData&) { }

Modified: trunk/Source/WebKit/chromium/public/WebWidgetClient.h (88020 => 88021)


--- trunk/Source/WebKit/chromium/public/WebWidgetClient.h	2011-06-03 15:45:27 UTC (rev 88020)
+++ trunk/Source/WebKit/chromium/public/WebWidgetClient.h	2011-06-03 16:00:25 UTC (rev 88021)
@@ -38,6 +38,7 @@
 
 namespace WebKit {
 
+class WebString;
 class WebWidget;
 struct WebCursorInfo;
 
@@ -81,6 +82,9 @@
     virtual WebRect windowRect() { return WebRect(); }
     virtual void setWindowRect(const WebRect&) { }
 
+    // Called when a tooltip should be shown at the current cursor position.
+    virtual void setToolTipText(const WebString&, WebTextDirection hint) { }
+
     // Called to get the position of the resizer rect in window coordinates.
     virtual WebRect windowResizerRect() { return WebRect(); }
 

Modified: trunk/Source/WebKit/chromium/src/ExternalPopupMenu.cpp (88020 => 88021)


--- trunk/Source/WebKit/chromium/src/ExternalPopupMenu.cpp	2011-06-03 15:45:27 UTC (rev 88020)
+++ trunk/Source/WebKit/chromium/src/ExternalPopupMenu.cpp	2011-06-03 16:00:25 UTC (rev 88021)
@@ -133,6 +133,7 @@
     for (int i = 0; i < itemCount; ++i) {
         WebMenuItemInfo& popupItem = items[i];
         popupItem.label = m_popupMenuClient->itemText(i);
+        popupItem.toolTip = m_popupMenuClient->itemToolTip(i);
         if (m_popupMenuClient->itemIsSeparator(i))
             popupItem.type = WebMenuItemInfo::Separator;
         else if (m_popupMenuClient->itemIsLabel(i))

Modified: trunk/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp (88020 => 88021)


--- trunk/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp	2011-06-03 15:45:27 UTC (rev 88020)
+++ trunk/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp	2011-06-03 16:00:25 UTC (rev 88021)
@@ -40,12 +40,14 @@
 #include "PlatformKeyboardEvent.h"
 #include "PlatformMouseEvent.h"
 #include "PlatformWheelEvent.h"
+#include "PopupMenuChromium.h"
 #include "SkiaUtils.h"
 
 #include "WebInputEvent.h"
 #include "WebInputEventConversion.h"
 #include "WebRange.h"
 #include "WebRect.h"
+#include "WebViewClient.h"
 #include "WebWidgetClient.h"
 
 #include <skia/ext/platform_canvas.h>
@@ -95,6 +97,10 @@
     if (event.x != m_lastMousePosition.x || event.y != m_lastMousePosition.y) {
         m_lastMousePosition = WebPoint(event.x, event.y);
         m_widget->handleMouseMoveEvent(PlatformMouseEventBuilder(m_widget, event));
+
+        // We cannot call setToolTipText() in PopupContainer, because PopupContainer is in WebCore, and we cannot refer to WebKit from Webcore.
+        WebCore::PopupContainer* container = static_cast<WebCore::PopupContainer*>(m_widget);
+        client()->setToolTipText(container->getSelectedItemToolTip(), container->menuStyle().textDirection() == WebCore::RTL ? WebTextDirectionRightToLeft : WebTextDirectionLeftToRight);
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to