Bug 53942 - [Chromium] Select popup box does not align with select button when appearance is not "menulist".
Summary: [Chromium] Select popup box does not align with select button when appearance...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-07 14:26 PST by xiyuan
Modified: 2011-02-07 23:07 PST (History)
3 users (show)

See Also:


Attachments
Test case. (2.08 KB, text/html)
2011-02-07 14:26 PST, xiyuan
no flags Details
Proposed patch. (5.15 KB, patch)
2011-02-07 14:42 PST, xiyuan
no flags Details | Formatted Diff | Diff
Fix typo in manual test name. (5.15 KB, patch)
2011-02-07 14:45 PST, xiyuan
tony: review-
Details | Formatted Diff | Diff
Address tony's comments @3,4 (5.64 KB, patch)
2011-02-07 16:36 PST, xiyuan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description xiyuan 2011-02-07 14:26:22 PST
Created attachment 81520 [details]
Test case.

When a select element's appearance is not "menulist", we use the css padding to calculdate popup width (since https://bugs.webkit.org/show_bug.cgi?id=33235). And this caused the popup box is wider than the select button when appearance is not menulist. And use has no way to fix this via css padding.
Comment 1 xiyuan 2011-02-07 14:42:22 PST
Created attachment 81523 [details]
Proposed patch.
Comment 2 xiyuan 2011-02-07 14:45:15 PST
Created attachment 81525 [details]
Fix typo in manual test name.
Comment 3 Tony Chang 2011-02-07 16:06:54 PST
Comment on attachment 81525 [details]
Fix typo in manual test name.

View in context: https://bugs.webkit.org/attachment.cgi?id=81525&action=review

just some small nits

> Source/WebCore/platform/chromium/PopupMenuChromium.cpp:1272
> +const int minEndOfLinePadding = 2;

static?  Also, should this be at the top of the file with the other constants?  The other constants are named incorrectly (k prefix), but we can fix that later.

> Source/WebCore/platform/chromium/PopupMenuChromium.cpp:1275
> +    bool rightAligned = m_popupClient->menuStyle().textDirection() == RTL;

Nit: rightAligned -> isRightAligned
Comment 4 Tony Chang 2011-02-07 16:07:30 PST
Comment on attachment 81525 [details]
Fix typo in manual test name.

View in context: https://bugs.webkit.org/attachment.cgi?id=81525&action=review

> Source/WebCore/platform/chromium/PopupMenuChromium.cpp:1349
> +        // Use minEndOfLinePadding when there is a scrollbar.

Why does a scrollbar cause us to need 2 extra pixels?
Comment 5 xiyuan 2011-02-07 16:36:01 PST
Comment on attachment 81525 [details]
Fix typo in manual test name.

View in context: https://bugs.webkit.org/attachment.cgi?id=81525&action=review

>> Source/WebCore/platform/chromium/PopupMenuChromium.cpp:1272

> 
> static?  Also, should this be at the top of the file with the other constants?  The other constants are named incorrectly (k prefix), but we can fix that later.

Done.

>> Source/WebCore/platform/chromium/PopupMenuChromium.cpp:1275

> 
> Nit: rightAligned -> isRightAligned

Done

>> Source/WebCore/platform/chromium/PopupMenuChromium.cpp:1349
>> +        // Use minEndOfLinePadding when there is a scrollbar.
> 
> Why does a scrollbar cause us to need 2 extra pixels?

Updated the comment to make it more clear.

It's not that we need the 2 extra pixels. We replace the lineEndPaddingWidth space with the minimum 2 pixel space when there is a scrollbar. In this way, scrollbar will stay as much as possible inside the line end padding space. User could use a big enough "padding-right" (>= scrollbarWidth + 2px) to make the popup listbox align with the select button.

This is because https://bugs.webkit.org/show_bug.cgi?id=33235 makes popup respect the "padding-right". It works well when there is no scrollbar. But when popup has a scrollbar, the popup is always wider than the select button no matter what padding-right value you use. You can see that from the test case page.
Comment 6 xiyuan 2011-02-07 16:36:52 PST
Created attachment 81550 [details]
Address tony's comments @3,4
Comment 7 Tony Chang 2011-02-07 16:41:25 PST
Comment on attachment 81550 [details]
Address tony's comments @3,4

View in context: https://bugs.webkit.org/attachment.cgi?id=81550&action=review

> Source/WebCore/platform/chromium/PopupMenuChromium.cpp:1353
> +        // Use kMinEndOfLinePadding when there is a scrollbar so that we use
> +        // as much as (lineEndPaddingWidth - kMinEndOfLinePadding) padding
> +        // space for scrollbar and allow user to use CSS padding to make the
> +        // popup listbox align with the select element.
> +        paddingWidth = paddingWidth - lineEndPaddingWidth + kMinEndOfLinePadding;

This comment is much more useful.  Thanks!
Comment 8 WebKit Commit Bot 2011-02-07 23:07:18 PST
Comment on attachment 81550 [details]
Address tony's comments @3,4

Clearing flags on attachment: 81550

Committed r77907: <http://trac.webkit.org/changeset/77907>
Comment 9 WebKit Commit Bot 2011-02-07 23:07:24 PST
All reviewed patches have been landed.  Closing bug.