Diff
Modified: trunk/LayoutTests/ChangeLog (200117 => 200118)
--- trunk/LayoutTests/ChangeLog 2016-04-27 01:28:03 UTC (rev 200117)
+++ trunk/LayoutTests/ChangeLog 2016-04-27 02:02:28 UTC (rev 200118)
@@ -1,3 +1,20 @@
+2016-04-26 Dean Jackson <[email protected]>
+
+ RTL native <select> buttons should have arrows on left
+ https://bugs.webkit.org/show_bug.cgi?id=157055
+
+ Reviewed by Myles Maxfield.
+
+ * fast/forms/select-writing-direction-natural.html: Removed some incorrect
+ text in the test.
+ * platform/ios-simulator/fast/forms/select-writing-direction-natural-expected.txt:
+ * platform/mac/fast/forms/select-writing-direction-natural-expected.png:
+ * platform/mac/fast/forms/select-writing-direction-natural-expected.txt:
+ * platform/mac/fast/text/international/bidi-menulist-expected.png:
+ * platform/mac/fast/text/international/bidi-menulist-expected.txt:
+ * platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.png:
+ * platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.txt:
+
2016-04-26 Michael Saboff <[email protected]>
[ES] Implement RegExp.prototype.@@replace and use it for String.prototype.replace
Modified: trunk/LayoutTests/fast/forms/select-writing-direction-natural.html (200117 => 200118)
--- trunk/LayoutTests/fast/forms/select-writing-direction-natural.html 2016-04-27 01:28:03 UTC (rev 200117)
+++ trunk/LayoutTests/fast/forms/select-writing-direction-natural.html 2016-04-27 02:02:28 UTC (rev 200118)
@@ -10,9 +10,6 @@
Test for <i><a href=""
REGRESSION: Popup button text should use "natural" directionality to match the items in the popup menu</i>.
</p>
- <p>
- In all of the popup buttons below, the letter A should be on the left and the letter א should be on the right.
- </p>
<div style="direction: ltr;">
<div style="text-align: left;">
<select><option>אA</option></select>
Modified: trunk/LayoutTests/platform/ios-simulator/fast/forms/select-writing-direction-natural-expected.txt (200117 => 200118)
--- trunk/LayoutTests/platform/ios-simulator/fast/forms/select-writing-direction-natural-expected.txt 2016-04-27 01:28:03 UTC (rev 200117)
+++ trunk/LayoutTests/platform/ios-simulator/fast/forms/select-writing-direction-natural-expected.txt 2016-04-27 02:02:28 UTC (rev 200118)
@@ -16,12 +16,7 @@
text run at (0,20) width 330: "directionality to match the items in the popup menu"
RenderText {#text} at (329,20) size 5x19
text run at (329,20) width 5: "."
- RenderBlock {P} at (0,56) size 784x20
- RenderText {#text} at (0,0) size 672x19
- text run at (0,0) width 517: "In all of the popup buttons below, the letter A should be on the left and the letter "
- text run at (516,0) width 9 RTL: "\x{5D0}"
- text run at (524,0) width 148: " should be on the right."
- RenderBlock {DIV} at (0,92) size 784x48
+ RenderBlock {DIV} at (0,56) size 784x48
RenderBlock {DIV} at (0,0) size 784x24
RenderMenuList {SELECT} at (0,2) size 70x20 [bgcolor=#FFFFFF02] [border: (1px solid #4C4C4C)]
RenderBlock (anonymous) at (6,2) size 58x16
@@ -80,7 +75,7 @@
text run at (0,0) width 11: "(A"
text run at (11,0) width 7 RTL: "\x{5D0}"
RenderText {#text} at (0,0) size 0x0
- RenderBlock {DIV} at (0,140) size 784x48
+ RenderBlock {DIV} at (0,104) size 784x48
RenderBlock {DIV} at (0,0) size 784x24
RenderMenuList {SELECT} at (222,2) size 70x20 [bgcolor=#FFFFFF02] [border: (1px solid #4C4C4C)]
RenderBlock (anonymous) at (6,2) size 58x16
Modified: trunk/LayoutTests/platform/mac/fast/forms/select-writing-direction-natural-expected.png
(Binary files differ)
Modified: trunk/LayoutTests/platform/mac/fast/forms/select-writing-direction-natural-expected.txt (200117 => 200118)
--- trunk/LayoutTests/platform/mac/fast/forms/select-writing-direction-natural-expected.txt 2016-04-27 01:28:03 UTC (rev 200117)
+++ trunk/LayoutTests/platform/mac/fast/forms/select-writing-direction-natural-expected.txt 2016-04-27 02:02:28 UTC (rev 200118)
@@ -16,12 +16,7 @@
text run at (0,18) width 330: "directionality to match the items in the popup menu"
RenderText {#text} at (329,18) size 5x18
text run at (329,18) width 5: "."
- RenderBlock {P} at (0,52) size 784x19
- RenderText {#text} at (0,1) size 675x18
- text run at (0,1) width 517: "In all of the popup buttons below, the letter A should be on the left and the letter "
- text run at (516,1) width 11 RTL: "\x{5D0}"
- text run at (526,1) width 149: " should be on the right."
- RenderBlock {DIV} at (0,87) size 784x44
+ RenderBlock {DIV} at (0,52) size 784x44
RenderBlock {DIV} at (0,0) size 784x22
RenderMenuList {SELECT} at (0,2) size 70x18 [bgcolor=#FFFFFF]
RenderBlock (anonymous) at (0,0) size 70x18
@@ -80,62 +75,62 @@
text run at (8,2) width 11: "(A"
text run at (18,2) width 8 RTL: "\x{5D0}"
RenderText {#text} at (0,0) size 0x0
- RenderBlock {DIV} at (0,131) size 784x44
+ RenderBlock {DIV} at (0,96) size 784x44
RenderBlock {DIV} at (0,0) size 784x22
RenderMenuList {SELECT} at (222,2) size 70x18 [bgcolor=#FFFFFF]
RenderBlock (anonymous) at (0,0) size 70x18
- RenderText at (32,2) size 15x13
- text run at (32,2) width 8: "A"
- text run at (39,2) width 8 RTL: "\x{5D0}"
+ RenderText at (47,2) size 15x13
+ text run at (47,2) width 8: "A"
+ text run at (54,2) width 8 RTL: "\x{5D0}"
RenderText {#text} at (218,1) size 4x18
text run at (218,1) width 4 RTL: " "
RenderMenuList {SELECT} at (148,2) size 70x18 [bgcolor=#FFFFFF]
RenderBlock (anonymous) at (0,0) size 70x18
- RenderText at (32,2) size 15x13
- text run at (32,2) width 8 RTL: "\x{5D0}"
- text run at (39,2) width 8: "A"
+ RenderText at (47,2) size 15x13
+ text run at (47,2) width 8 RTL: "\x{5D0}"
+ text run at (54,2) width 8: "A"
RenderText {#text} at (144,1) size 4x18
text run at (144,1) width 4 RTL: " "
RenderMenuList {SELECT} at (74,2) size 70x18 [bgcolor=#FFFFFF]
RenderBlock (anonymous) at (0,0) size 70x18
- RenderText at (29,2) size 18x13
- text run at (29,2) width 8: "A"
- text run at (36,2) width 11 RTL: "(\x{5D0}"
+ RenderText at (44,2) size 18x13
+ text run at (44,2) width 8: "A"
+ text run at (51,2) width 11 RTL: "(\x{5D0}"
RenderText {#text} at (70,1) size 4x18
text run at (70,1) width 4 RTL: " "
RenderMenuList {SELECT} at (0,2) size 70x18 [bgcolor=#FFFFFF]
RenderBlock (anonymous) at (0,0) size 70x18
- RenderText at (29,2) size 18x13
- text run at (29,2) width 8 RTL: "\x{5D0}"
- text run at (36,2) width 8: "A"
- text run at (43,2) width 4 RTL: "("
+ RenderText at (44,2) size 18x13
+ text run at (44,2) width 8 RTL: "\x{5D0}"
+ text run at (51,2) width 8: "A"
+ text run at (58,2) width 4 RTL: "("
RenderText {#text} at (0,0) size 0x0
RenderBlock {DIV} at (0,22) size 784x22
RenderMenuList {SELECT} at (714,2) size 70x18 [bgcolor=#FFFFFF]
RenderBlock (anonymous) at (0,0) size 70x18
- RenderText at (32,2) size 15x13
- text run at (32,2) width 8: "A"
- text run at (39,2) width 8 RTL: "\x{5D0}"
+ RenderText at (47,2) size 15x13
+ text run at (47,2) width 8: "A"
+ text run at (54,2) width 8 RTL: "\x{5D0}"
RenderText {#text} at (710,1) size 4x18
text run at (710,1) width 4 RTL: " "
RenderMenuList {SELECT} at (640,2) size 70x18 [bgcolor=#FFFFFF]
RenderBlock (anonymous) at (0,0) size 70x18
- RenderText at (32,2) size 15x13
- text run at (32,2) width 8 RTL: "\x{5D0}"
- text run at (39,2) width 8: "A"
+ RenderText at (47,2) size 15x13
+ text run at (47,2) width 8 RTL: "\x{5D0}"
+ text run at (54,2) width 8: "A"
RenderText {#text} at (636,1) size 4x18
text run at (636,1) width 4 RTL: " "
RenderMenuList {SELECT} at (566,2) size 70x18 [bgcolor=#FFFFFF]
RenderBlock (anonymous) at (0,0) size 70x18
- RenderText at (29,2) size 18x13
- text run at (29,2) width 8: "A"
- text run at (36,2) width 11 RTL: "(\x{5D0}"
+ RenderText at (44,2) size 18x13
+ text run at (44,2) width 8: "A"
+ text run at (51,2) width 11 RTL: "(\x{5D0}"
RenderText {#text} at (562,1) size 4x18
text run at (562,1) width 4 RTL: " "
RenderMenuList {SELECT} at (492,2) size 70x18 [bgcolor=#FFFFFF]
RenderBlock (anonymous) at (0,0) size 70x18
- RenderText at (29,2) size 18x13
- text run at (29,2) width 8 RTL: "\x{5D0}"
- text run at (36,2) width 8: "A"
- text run at (43,2) width 4 RTL: "("
+ RenderText at (44,2) size 18x13
+ text run at (44,2) width 8 RTL: "\x{5D0}"
+ text run at (51,2) width 8: "A"
+ text run at (58,2) width 4 RTL: "("
RenderText {#text} at (0,0) size 0x0
Modified: trunk/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.png
(Binary files differ)
Modified: trunk/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.txt (200117 => 200118)
--- trunk/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.txt 2016-04-27 01:28:03 UTC (rev 200117)
+++ trunk/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.txt 2016-04-27 02:02:28 UTC (rev 200118)
@@ -16,9 +16,9 @@
RenderBR {BR} at (285,14) size 1x0
RenderMenuList {SELECT} at (0,20) size 100x18 [bgcolor=#FFFFFF]
RenderBlock (anonymous) at (0,0) size 100x18
- RenderText at (16,2) size 61x13
- text run at (16,2) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
- text run at (57,2) width 20: "abc"
+ RenderText at (31,2) size 61x13
+ text run at (31,2) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
+ text run at (72,2) width 20: "abc"
RenderBR {BR} at (100,33) size 0x0
RenderBlock {DIV} at (0,110) size 100x19
RenderText {#text} at (0,1) size 82x18
Modified: trunk/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.png
(Binary files differ)
Modified: trunk/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.txt (200117 => 200118)
--- trunk/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.txt 2016-04-27 01:28:03 UTC (rev 200117)
+++ trunk/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.txt 2016-04-27 02:02:28 UTC (rev 200118)
@@ -55,12 +55,12 @@
RenderBlock {DIV} at (0,278) size 784x242
RenderMenuList {SELECT} at (0,0) size 500x21 [bgcolor=#FFFFFF]
RenderBlock (anonymous) at (0,0) size 500x21
- RenderText at (320,2) size 157x16
- text run at (320,2) width 32: "First "
- text run at (351,2) width 48 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA}"
- text run at (398,2) width 17: "03"
- text run at (414,2) width 36 RTL: "\x{5E9}\x{5E0}\x{5D9}\x{5D4} ("
- text run at (449,2) width 28: " fifth"
+ RenderText at (335,2) size 157x16
+ text run at (335,2) width 32: "First "
+ text run at (366,2) width 48 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA}"
+ text run at (413,2) width 17: "03"
+ text run at (429,2) width 36 RTL: "\x{5E9}\x{5E0}\x{5D9}\x{5D4} ("
+ text run at (464,2) width 28: " fifth"
RenderBlock {DIV} at (0,23) size 470x36
RenderText {#text} at (297,10) size 163x16
text run at (297,10) width 33: "First "
@@ -70,12 +70,12 @@
text run at (429,10) width 31: " fifth"
RenderMenuList {SELECT} at (0,61) size 500x21 [bgcolor=#FFFFFF]
RenderBlock (anonymous) at (0,0) size 500x21
- RenderText at (320,2) size 158x16
- text run at (320,2) width 24: "fifth"
- text run at (343,2) width 53 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} "
- text run at (395,2) width 16: "03"
- text run at (410,2) width 40 RTL: " \x{5E9}\x{5E0}\x{5D9}\x{5D4} ("
- text run at (449,2) width 29: "First"
+ RenderText at (335,2) size 158x16
+ text run at (335,2) width 24: "fifth"
+ text run at (358,2) width 53 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} "
+ text run at (410,2) width 16: "03"
+ text run at (425,2) width 40 RTL: " \x{5E9}\x{5E0}\x{5D9}\x{5D4} ("
+ text run at (464,2) width 29: "First"
RenderBlock {DIV} at (0,84) size 470x36
RenderText {#text} at (297,10) size 163x16
text run at (297,10) width 28: "fifth"
@@ -85,15 +85,15 @@
text run at (432,10) width 28: "First"
RenderMenuList {SELECT} at (0,122) size 500x21 [bgcolor=#FFFFFF]
RenderBlock (anonymous) at (0,0) size 500x21
- RenderText at (320,2) size 157x16
- text run at (320,2) width 157 LTR override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
+ RenderText at (335,2) size 157x16
+ text run at (335,2) width 157 LTR override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
RenderBlock {DIV} at (0,145) size 470x36
RenderText {#text} at (297,10) size 163x16
text run at (297,10) width 163 LTR override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
RenderMenuList {SELECT} at (0,183) size 500x21 [bgcolor=#FFFFFF]
RenderBlock (anonymous) at (0,0) size 500x21
- RenderText at (320,2) size 157x16
- text run at (320,2) width 157 RTL override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
+ RenderText at (335,2) size 157x16
+ text run at (335,2) width 157 RTL override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
RenderBlock {DIV} at (0,206) size 470x36
RenderText {#text} at (297,10) size 163x16
text run at (297,10) width 163 RTL override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
Modified: trunk/Source/WebCore/ChangeLog (200117 => 200118)
--- trunk/Source/WebCore/ChangeLog 2016-04-27 01:28:03 UTC (rev 200117)
+++ trunk/Source/WebCore/ChangeLog 2016-04-27 02:02:28 UTC (rev 200118)
@@ -1,3 +1,24 @@
+2016-04-26 Dean Jackson <[email protected]>
+
+ RTL native <select> buttons should have arrows on left
+ https://bugs.webkit.org/show_bug.cgi?id=157055
+ <rdar://problem/25894428>
+
+ Reviewed by Myles Maxfield.
+
+ If the text direction is right-to-left, the select popup
+ buttons should have the arrows on the left side.
+
+ Test: fast/forms/select-writing-direction-natural.html
+
+ * rendering/RenderThemeMac.h:
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::popupButtonPadding): Takes a direction parameter.
+ (WebCore::RenderThemeMac::popupInternalPaddingBox): Checks the direction for the padding.
+ (WebCore::RenderThemeMac::setPopupButtonCellState): Tell the button to put the
+ arrows on the correct side.
+ (WebCore::RenderThemeMac::popupButton): Deleted an unnecessary comment.
+
2016-04-26 Myles C. Maxfield <[email protected]>
[WK2] [OS X] Create API for switching RTL scrollbar policy
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (200117 => 200118)
--- trunk/Source/WebCore/rendering/RenderThemeMac.h 2016-04-27 01:28:03 UTC (rev 200117)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h 2016-04-27 02:02:28 UTC (rev 200118)
@@ -192,7 +192,7 @@
void setPopupButtonCellState(const RenderObject&, const IntSize&);
const IntSize* popupButtonSizes() const;
const int* popupButtonMargins() const;
- const int* popupButtonPadding(NSControlSize) const;
+ const int* popupButtonPadding(NSControlSize, bool isRTL) const;
void paintMenuListButtonGradients(const RenderObject&, const PaintInfo&, const IntRect&);
const IntSize* menuListSizes() const;
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (200117 => 200118)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2016-04-27 01:28:03 UTC (rev 200117)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2016-04-27 02:02:28 UTC (rev 200118)
@@ -896,15 +896,21 @@
return sizes;
}
-const int* RenderThemeMac::popupButtonPadding(NSControlSize size) const
+const int* RenderThemeMac::popupButtonPadding(NSControlSize size, bool isRTL) const
{
- static const int padding[3][4] =
+ static const int paddingLTR[3][4] =
{
{ 2, 26, 3, 8 },
{ 2, 23, 3, 8 },
{ 2, 22, 3, 10 }
};
- return padding[size];
+ static const int paddingRTL[3][4] =
+ {
+ { 2, 8, 3, 26 },
+ { 2, 8, 3, 23 },
+ { 2, 8, 3, 22 }
+ };
+ return isRTL ? paddingRTL[size] : paddingLTR[size];
}
bool RenderThemeMac::paintMenuList(const RenderObject& renderer, const PaintInfo& paintInfo, const FloatRect& rect)
@@ -1368,10 +1374,11 @@
LengthBox RenderThemeMac::popupInternalPaddingBox(const RenderStyle& style) const
{
if (style.appearance() == MenulistPart) {
- return { static_cast<int>(popupButtonPadding(controlSizeForFont(style))[topPadding] * style.effectiveZoom()),
- static_cast<int>(popupButtonPadding(controlSizeForFont(style))[rightPadding] * style.effectiveZoom()),
- static_cast<int>(popupButtonPadding(controlSizeForFont(style))[bottomPadding] * style.effectiveZoom()),
- static_cast<int>(popupButtonPadding(controlSizeForFont(style))[leftPadding] * style.effectiveZoom()) };
+ const int* padding = popupButtonPadding(controlSizeForFont(style), style.direction() == RTL);
+ return { static_cast<int>(padding[topPadding] * style.effectiveZoom()),
+ static_cast<int>(padding[rightPadding] * style.effectiveZoom()),
+ static_cast<int>(padding[bottomPadding] * style.effectiveZoom()),
+ static_cast<int>(padding[leftPadding] * style.effectiveZoom()) };
}
if (style.appearance() == MenulistButtonPart) {
@@ -1423,6 +1430,8 @@
// Set the control size based off the rectangle we're painting into.
setControlSize(popupButton, popupButtonSizes(), buttonSize, o.style().effectiveZoom());
+ popupButton.userInterfaceLayoutDirection = o.style().direction() == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft;
+
// Update the various states we respond to.
updateCheckedState(popupButton, o);
updateEnabledState(popupButton, o);
@@ -1957,10 +1966,6 @@
m_popupButton = adoptNS([[NSPopUpButtonCell alloc] initTextCell:@"" pullsDown:NO]);
[m_popupButton.get() setUsesItemFromMenu:NO];
[m_popupButton.get() setFocusRingType:NSFocusRingTypeExterior];
- // We don't want the app's UI layout direction to affect the appearance of popup buttons in
- // web content, which has its own layout direction.
- // FIXME: Make this depend on the directionality of the select element, once the rest of the
- // rendering code can account for the popup arrows appearing on the other side.
[m_popupButton setUserInterfaceLayoutDirection:NSUserInterfaceLayoutDirectionLeftToRight];
}