[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

bweinstein at apple.com bweinstein at apple.com
Thu Apr 8 00:58:00 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit b10c7ad9eb1a032dd80725e7dc81020712738d91
Author: bweinstein at apple.com <bweinstein at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 8 00:28:27 2010 +0000

    Padding in popup menu gets lost with styled <select> in Windows.
    Fixes <rdar://7285538>, and <http://webkit.org/b/33235>.
    
    Reviewed by Adele Peterson.
    
    [Win] Support padding-right on selects when webkit-appearance is off. Added a test
    case for narrow selects with -webkit-appearance: none, and padding left and right to
    show that both types of padding are honored.
    
    * manual-tests/select-webkit-appearance-off-narrow-select.html: Added.
    * platform/win/PopupMenuWin.cpp:
    (WebCore::PopupMenu::calculatePositionAndSize): Use clientPaddingRight instead of a hardcoded constant.
    * rendering/RenderMenuList.cpp:
    (WebCore::RenderMenuList::clientPaddingRight): If webkit-appearance is off, use padding-right instead of
    the hardcoded constant.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52958 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4923f09..35e563a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-01-07  Brian Weinstein  <bweinstein at apple.com>
+
+        Reviewed by Adele Peterson.
+
+        Padding in popup menu gets lost with styled <select> in Windows.
+        Fixes <rdar://7285538>, and <http://webkit.org/b/33235>.
+
+        [Win] Support padding-right on selects when webkit-appearance is off. Added a test
+        case for narrow selects with -webkit-appearance: none, and padding left and right to
+        show that both types of padding are honored.
+
+        * manual-tests/select-webkit-appearance-off-narrow-select.html: Added.
+        * platform/win/PopupMenuWin.cpp:
+        (WebCore::PopupMenu::calculatePositionAndSize): Use clientPaddingRight instead of a hardcoded constant.
+        * rendering/RenderMenuList.cpp:
+        (WebCore::RenderMenuList::clientPaddingRight): If webkit-appearance is off, use padding-right instead of
+        the hardcoded constant.
+
 2010-01-07  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Geoffrey Garen.
diff --git a/WebCore/manual-tests/select-webkit-appearance-off-narrow-select.html b/WebCore/manual-tests/select-webkit-appearance-off-narrow-select.html
new file mode 100644
index 0000000..34e4681
--- /dev/null
+++ b/WebCore/manual-tests/select-webkit-appearance-off-narrow-select.html
@@ -0,0 +1,49 @@
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+    <title>Padding on select with webkit-appearance: off</title>
+    <style type="text/css">
+        #webkit-appearance-none {
+            -webkit-appearance: none;
+            border: 1px solid black;
+            width: 15px;
+            padding-left: 5px;
+            padding-right: 5px;
+        }
+        
+        #narrow-with-border {
+            border: 1px solid black;
+            width: 40px;
+        }
+    </style>
+</head>
+
+<body>
+    <p>This is a manual test for <a href="https://bugs.webkit.org/show_bug.cgi?id=33235">Padding in popup 
+    menu gets lost with styled select in Windows</a></p>
+    <p>To open the selects, click inside the select boxes below.</p>
+
+    <p>The options in this selects should have padding on both the left and the right, the edges of
+    the text should not be pressed against the edges of the opened select.</p>
+    <select id="webkit-appearance-none">
+        <option href="#">Do Action ABCDEFG</option>
+        <option href="#">Do Action ABCDEFG</option>
+        <option href="#">Do Action ABCDEFG</option>
+        <option href="#">Do Action ABCDEFG</option>
+        <hr />
+        <option href="#">Do Action ABCDEFG</option>
+        <option href="#">Do Action ABCDEFG</option>
+    </select>
+    
+    <p>The options in this select should not have too much padding on the right</p>
+    <select id="narrow-with-border">
+        <option href="#">Do Action ABCDEFG</option>
+        <option href="#">Do Action ABCDEFG</option>
+        <option href="#">Do Action ABCDEFG</option>
+        <option href="#">Do Action ABCDEFG</option>
+        <hr />
+        <option href="#">Do Action ABCDEFG</option>
+        <option href="#">Do Action ABCDEFG</option>
+    </select>
+</body>
+</html>
diff --git a/WebCore/platform/win/PopupMenuWin.cpp b/WebCore/platform/win/PopupMenuWin.cpp
index 0a8e8e8..c998ca4 100644
--- a/WebCore/platform/win/PopupMenuWin.cpp
+++ b/WebCore/platform/win/PopupMenuWin.cpp
@@ -280,7 +280,6 @@ void PopupMenu::hide()
     ::PostMessage(m_popup, WM_NULL, 0, 0);
 }
 
-const int endOfLinePadding = 2;
 void PopupMenu::calculatePositionAndSize(const IntRect& r, FrameView* v)
 {
     // r is in absolute document coordinates, but we want to be in screen coordinates
@@ -326,9 +325,7 @@ void PopupMenu::calculatePositionAndSize(const IntRect& r, FrameView* v)
         popupWidth += ScrollbarTheme::nativeTheme()->scrollbarThickness(SmallScrollbar);
 
     // Add padding to align the popup text with the <select> text
-    // Note: We can't add paddingRight() because that value includes the width
-    // of the dropdown button, so we must use our own endOfLinePadding constant.
-    popupWidth += max(0, endOfLinePadding - client()->clientInsetRight()) + max(0, client()->clientPaddingLeft() - client()->clientInsetLeft());
+    popupWidth += max(0, client()->clientPaddingRight() - client()->clientInsetRight()) + max(0, client()->clientPaddingLeft() - client()->clientInsetLeft());
 
     // Leave room for the border
     popupWidth += 2 * popupWindowBorderWidth;
diff --git a/WebCore/rendering/RenderMenuList.cpp b/WebCore/rendering/RenderMenuList.cpp
index f48c30f..bf732fc 100644
--- a/WebCore/rendering/RenderMenuList.cpp
+++ b/WebCore/rendering/RenderMenuList.cpp
@@ -388,7 +388,6 @@ Color RenderMenuList::itemBackgroundColor(unsigned listIndex) const
 
 PopupMenuStyle RenderMenuList::menuStyle() const
 {
-
     RenderStyle* s = m_innerBlock ? m_innerBlock->style() : style();
     return PopupMenuStyle(s->color(), s->backgroundColor(), s->font(), s->visibility() == VISIBLE, s->textIndent(), s->direction());
 }
@@ -424,8 +423,19 @@ int RenderMenuList::clientPaddingLeft() const
     return paddingLeft();
 }
 
+const int endOfLinePadding = 2;
 int RenderMenuList::clientPaddingRight() const
 {
+    if (style()->appearance() == MenulistPart || style()->appearance() == MenulistButtonPart) {
+        // For these appearance values, the theme applies padding to leave room for the
+        // drop-down button. But leaving room for the button inside the popup menu itself
+        // looks strange, so we return a small default padding to avoid having a large empty
+        // space appear on the side of the popup menu.
+        return endOfLinePadding;
+    }
+
+    // If the appearance isn't MenulistPart, then the select is styled (non-native), so
+    // we want to return the user specified padding.
     return paddingRight();
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list