Source/WebCore: Popups on Chromium now check the minimum row height set through the...
authorfsamuel@chromium.org <fsamuel@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jul 2011 03:55:58 +0000 (03:55 +0000)
committerfsamuel@chromium.org <fsamuel@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Jul 2011 03:55:58 +0000 (03:55 +0000)
computing the height of a row in a popup listbox.
https://bugs.webkit.org/show_bug.cgi?id=64897

Reviewed by Darin Fisher.

No new tests.

* platform/chromium/PopupMenuChromium.cpp:
(WebCore::PopupListBox::getRowHeight):
* platform/chromium/PopupMenuChromium.h:
(WebCore::PopupMenuChromium::minimumRowHeight):
(WebCore::PopupMenuChromium::setMinimumRowHeight):

Source/WebKit/chromium: Added a Chromium WebKit API method to set the minimum row height of a popup listbox.
https://bugs.webkit.org/show_bug.cgi?id=64897

Reviewed by Darin Fisher.

* public/WebPopupMenu.h:
* src/WebPopupMenuImpl.cpp:
(WebKit::WebPopupMenu::setMinimumRowHeight):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@91896 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/chromium/PopupMenuChromium.cpp
Source/WebCore/platform/chromium/PopupMenuChromium.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebPopupMenu.h
Source/WebKit/chromium/src/WebPopupMenuImpl.cpp

index 10e2da7df69035ccd2116c4ce86ab8a216bf953f..16dc5d4a8486aeefd77f55531850d9cf86686966 100644 (file)
@@ -1,3 +1,19 @@
+2011-07-27  Fady Samuel  <fsamuel@chromium.org>
+
+        Popups on Chromium now check the minimum row height set through the Chromium WebKit API when
+        computing the height of a row in a popup listbox.
+        https://bugs.webkit.org/show_bug.cgi?id=64897
+
+        Reviewed by Darin Fisher.
+
+        No new tests.
+
+        * platform/chromium/PopupMenuChromium.cpp:
+        (WebCore::PopupListBox::getRowHeight):
+        * platform/chromium/PopupMenuChromium.h:
+        (WebCore::PopupMenuChromium::minimumRowHeight):
+        (WebCore::PopupMenuChromium::setMinimumRowHeight):
+
 2011-07-27  MORITA Hajime  <morrita@google.com>
 
         Inconsistent state of TreeScope reference.
index 628b919aa2ac6de83c9618cc6041cfab228af94b..883311834d45007b01cde56df543991f1dc9f6da 100644 (file)
@@ -67,6 +67,8 @@ using std::max;
 
 namespace WebCore {
 
+int PopupMenuChromium::s_minimumRowHeight = 0;
+
 typedef unsigned long long TimeStamp;
 
 static const int kMaxVisibleRows = 20;
@@ -1176,14 +1178,14 @@ void PopupListBox::setOriginalIndex(int index)
 int PopupListBox::getRowHeight(int index)
 {
     if (index < 0)
-        return 0;
+        return PopupMenuChromium::minimumRowHeight();
 
     if (m_popupClient->itemStyle(index).isDisplayNone())
-        return 0;
+        return PopupMenuChromium::minimumRowHeight();
 
     // Separator row height is the same size as itself.
     if (m_popupClient->itemIsSeparator(index))
-        return separatorHeight;
+        return max(separatorHeight, PopupMenuChromium::minimumRowHeight());
 
     String icon = m_popupClient->itemIcon(index);
     RefPtr<Image> image(Image::loadPlatformResource(icon.utf8().data()));
@@ -1192,7 +1194,8 @@ int PopupListBox::getRowHeight(int index)
     int iconHeight = (image && !image->isNull()) ? image->rect().height() : 0;
 
     int linePaddingHeight = m_popupClient->menuStyle().menuType() == PopupMenuStyle::AutofillPopup ? kLinePaddingHeight : 0;
-    return max(fontHeight, iconHeight) + linePaddingHeight * 2;
+    int calculatedRowHeight = max(fontHeight, iconHeight) + linePaddingHeight * 2;
+    return max(calculatedRowHeight, PopupMenuChromium::minimumRowHeight());
 }
 
 IntRect PopupListBox::getRowBounds(int index)
index 46c12339052a43b8c057389d0084ba7bd60af05e..6ffa97b1b3a3b0372b872dd99d38dbbffcf89438 100644 (file)
@@ -175,7 +175,7 @@ public:
 private:
     friend class WTF::RefCounted<PopupContainer>;
 
-    PopupContainer(PopupMenuClient*, PopupType popupType, const PopupContainerSettings&);
+    PopupContainer(PopupMenuClient*, PopupType, const PopupContainerSettings&);
     ~PopupContainer();
 
     // Paint the border.
@@ -207,11 +207,16 @@ public:
     virtual void updateFromElement();
     virtual void disconnectClient();
 
+    static int minimumRowHeight() { return s_minimumRowHeight; }
+    static void setMinimumRowHeight(int minimumRowHeight) { s_minimumRowHeight = minimumRowHeight; }
+
 private:
     PopupMenuClient* client() const { return m_popupClient; }
 
     PopupMenuClient* m_popupClient;
     PopupMenuPrivate p;
+
+    static int s_minimumRowHeight;
 };
 
 } // namespace WebCore
index 4d888f163849487d13161b424403cca4d632b91d..e1bbee1954d147ff60b783f162a9507d2740da26 100644 (file)
@@ -1,3 +1,14 @@
+2011-07-27  Fady Samuel  <fsamuel@chromium.org>
+
+        Added a Chromium WebKit API method to set the minimum row height of a popup listbox.
+        https://bugs.webkit.org/show_bug.cgi?id=64897
+
+        Reviewed by Darin Fisher.
+
+        * public/WebPopupMenu.h:
+        * src/WebPopupMenuImpl.cpp:
+        (WebKit::WebPopupMenu::setMinimumRowHeight):
+
 2011-07-27  Peng Huang  <penghuang@chromium.org>
 
         Add more text input types for chromium
index c2cdec34445faa9eb6dd69f159a3a5a58b3297d8..53b63804f9925f8cd8152f43d3731b31823a3433 100644 (file)
@@ -41,6 +41,9 @@ class WebWidgetClient;
 class WebPopupMenu : public WebWidget {
 public:
     WEBKIT_API static WebPopupMenu* create(WebWidgetClient*);
+
+    // Sets the minimum height of a popup listbox row.
+    WEBKIT_API static void setMinimumRowHeight(int);
 };
 
 } // namespace WebKit
index 77d5b826b439acef18a781961970cbab78f0f5c3..62dcd6331841b49be52b52ba6b5b7f180c764cc3 100644 (file)
@@ -251,6 +251,11 @@ void WebPopupMenuImpl::setFocus(bool enable)
 {
 }
 
+void WebPopupMenu::setMinimumRowHeight(int minimumRowHeight)
+{
+    PopupMenuChromium::setMinimumRowHeight(minimumRowHeight);
+}
+
 bool WebPopupMenuImpl::setComposition(
     const WebString& text, const WebVector<WebCompositionUnderline>& underlines,
     int selectionStart, int selectionEnd)