Bug 14685

Summary: text-align affects <select> button but not its drop-down menu
Product: WebKit Reporter: mitz
Component: FormsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: adele, aroben
Priority: P2 Keywords: InRadar
Version: 523.x (Safari 3)   
Hardware: PC   
OS: Windows XP   
Attachments:
Description Flags
Test case
none
Windows Safari rendering
none
WinIE 7 rendering
none
Use left alignment and natural writing direction in popup buttons and menus on Windows.
none
Use left alignment and natural writing direction in popup buttons and menus on Windows. aroben: review+

Description mitz 2007-07-20 01:35:11 PDT
In Windows Safari, <select> buttons respect the text-align property but their drop-down menus do not. See the attached test case and screenshot.

In Mac Safari, the popup menus are always left-aligned (I think this is an AppKit constraint in Tiger), and the buttons are styled to match.

In WinIE7, text-align is ignored, but the direction property is used to decide between left- and right-alignment. The right-to-left button also has the drop-down arrow on the left.

Regardless of whether Windows Safari matches Mac Safari in this regard or not, the alignment and writing direction in the drop-down should match those of the button itself.
Comment 1 mitz 2007-07-20 01:35:33 PDT
Created attachment 15592 [details]
Test case
Comment 2 mitz 2007-07-20 01:36:06 PDT
Created attachment 15593 [details]
Windows Safari rendering
Comment 3 mitz 2007-07-20 01:36:41 PDT
Created attachment 15594 [details]
WinIE 7 rendering
Comment 4 mitz 2007-07-20 02:06:11 PDT
I guess this was fixed at some point and then re-introduced in <http://trac.webkit.org/projects/webkit/changeset/21900> when fixing bug 13775 on the Mac. That patch coupled forced left-alignment with natural writing direction, and since Windows does not opt in for the latter, it no longer got the former.

To match Mac Safari, Windows can simply return true from PopupMenu::itemWritingDirectionIsNatural(). If Windows Safari is to have left alignment but specified writing direction, then either there should be a way for PopupMenu to specify those two features independently of each other, or PopupMenu can be given control over styling of the button (i.e. define a static function in PopupMenu that receives a RenderStyle and the item text and mutates the style as it sees fit to do).
Comment 5 David Kilzer (:ddkilzer) 2007-07-20 04:37:16 PDT
<rdar://problem/5349755>
Comment 6 Dave Hyatt 2007-07-20 14:47:52 PDT
We should match Mac I think.
Comment 7 mitz 2007-09-01 03:40:14 PDT
Created attachment 16172 [details]
Use left alignment and natural writing direction in popup buttons and menus on Windows.

Matches Mac.
Comment 8 mitz 2007-09-01 04:32:33 PDT
I think this bug is a regression from the first Windows beta...
Comment 9 mitz 2007-09-04 16:10:08 PDT
Created attachment 16201 [details]
Use left alignment and natural writing direction in popup buttons and menus on Windows.

Matches the Mac behavior.
Comment 10 Adam Roben (:aroben) 2007-09-05 09:19:04 PDT
Comment on attachment 16201 [details]
Use left alignment and natural writing direction in popup buttons and menus on Windows.

r=me

We should check in your testcase as a manual test (unless we have one already).
Comment 11 Mark Rowe (bdash) 2007-09-06 05:27:36 PDT
Landed in r25386.