RTL non-native <select> buttons should have arrows on the left
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Apr 2016 01:53:31 +0000 (01:53 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Apr 2016 01:53:31 +0000 (01:53 +0000)
commitaa371589d931a1637113ee48289ef9aff08d3d5a
treebe6655ef1f4a8ff698cab19f6103c75f2cb30e1a
parenteced5a5989b6109864f360b8e8d7ba182dfa7367
RTL non-native <select> buttons should have arrows on the left
https://bugs.webkit.org/show_bug.cgi?id=157112
<rdar://problem/25894441>

Reviewed by Simon Fraser.

Source/WebCore:

The <select> elements that are completely rendered by WebCore
(i.e. not the native controls) always assumed that they
were left-to-right.

This change allows the button to handle both directions,
swapping the side the little arrows are rendered on, as
well as the padding of the text label.

Test: fast/forms/select-non-native-rendering-direction.html

* rendering/RenderMenuList.cpp:
(RenderMenuList::clientPaddingLeft): This must take into account
the direction of the element.
(RenderMenuList::clientPaddingRight): Ditto.
* rendering/RenderThemeMac.mm: Change the left and right constants
to use the terms before and after.
(WebCore::RenderThemeMac::paintMenuListButtonDecorations): The left
and right positions must take the direction into account, which
means different calculations.
(WebCore::RenderThemeMac::popupInternalPaddingBox): Similarly for
the padding that is used to position the text label.

LayoutTests:

New test that checks the layout of WebCore-drawn <select>
elements in right-to-left mode.

* fast/forms/select-non-native-rendering-direction.html: Added.
* platform/mac/fast/forms/select-non-native-rendering-direction-expected.png: Added.
* platform/mac/fast/forms/select-non-native-rendering-direction-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@200165 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/forms/select-non-native-rendering-direction.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/forms/select-non-native-rendering-direction-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/forms/select-non-native-rendering-direction-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderThemeMac.mm