Fix RTL rendering of SELECT on macOS and input[type=color] on all platforms.

We had two issues.

* 'menulist' and 'menulist-button' appearances were not RTL-aware on macOS
  They are used for <select> and <input type=color list>.
  They were always rendered in LTR.

* Paddings of <input type=color list> were not RTL-aware on all platforms.

This CL fixes them.

BUG=232333

Review-Url: https://codereview.chromium.org/2224883002
Cr-Commit-Position: refs/heads/master@{#410534}
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index bd08ccede..7dd1bcaf 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -841,7 +841,12 @@
 crbug.com/487880 virtual/threaded/fast/scroll-behavior/overflow-scroll-root-frame-animates.html [ Pass Timeout ]
 crbug.com/487880 virtual/threaded/fast/scroll-behavior/overflow-scroll-animates.html [ Pass Timeout ]
 crbug.com/552556 virtual/threaded/fast/scroll-behavior/smooth-scroll/mousewheel-scroll.html [ Pass Failure ]
-
+crbug.com/232333 fast/forms/color/input-appearance-color.html [ NeedsRebaseline ]
+crbug.com/232333 [ Mac ] fast/forms/select/menulist-appearance-basic.html [ NeedsRebaseline ]
+crbug.com/232333 [ Mac ] fast/forms/select/select-writing-direction-natural.html [ NeedsRebaseline ]
+crbug.com/232333 [ Mac ] fast/text/international/bidi-menulist.html [ NeedsRebaseline ]
+crbug.com/232333 [ Mac ] fast/text/international/menulist-width-rtl.html [ NeedsRebaseline ]
+crbug.com/232333 [ Mac ] fast/text/international/pop-up-button-text-alignment-and-direction.html [ NeedsRebaseline ]
 crbug.com/425113 svg/clip-path/clip-path-multiple-children.svg [ Failure ]
 
 crbug.com/480769 http/tests/inspector/service-workers/service-workers-redundant.html [ Crash Pass Failure ]
diff --git a/third_party/WebKit/LayoutTests/fast/forms/color/input-appearance-color.html b/third_party/WebKit/LayoutTests/fast/forms/color/input-appearance-color.html
index 9c61c01..0bb617129 100644
--- a/third_party/WebKit/LayoutTests/fast/forms/color/input-appearance-color.html
+++ b/third_party/WebKit/LayoutTests/fast/forms/color/input-appearance-color.html
@@ -33,3 +33,5 @@
 <input type="color" value="#FF0000" style="background-color:yellow" list>
 <input type="color" value="#FF0000" style="border:1px solid lime; border-radius:0">
 <input type="color" value="#FF0000" style="border:1px solid lime; border-radius:0" list>
+<input type="color" value="#40e0d0" dir=rtl>
+<input type="color" value="#FF0000" list dir=rtl>
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/input-appearance-color-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/input-appearance-color-expected.png
index 6786dd0..466a899 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/input-appearance-color-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/input-appearance-color-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/input-appearance-color-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/input-appearance-color-expected.txt
index 253e2498..cc65e50e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/input-appearance-color-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/input-appearance-color-expected.txt
@@ -146,4 +146,14 @@
         LayoutBlockFlow {INPUT} at (188,0) size 88x23 [bgcolor=#F8F8F8] [border: (1px solid #00FF00)]
           LayoutFlexibleBox {DIV} at (1,1) size 86x21
             LayoutBlockFlow {DIV} at (8,4) size 54x13 [bgcolor=#FF0000] [border: (1px solid #000000)]
+        LayoutText {#text} at (276,3) size 4x18
+          text run at (276,3) width 4: " "
+        LayoutBlockFlow {INPUT} at (280,0) size 44x23 [bgcolor=#C0C0C0] [border: none (1px solid #A9A9A9) none (1px solid #A9A9A9)]
+          LayoutFlexibleBox {DIV} at (3,1) size 38x21
+            LayoutBlockFlow {DIV} at (2,4) size 34x13 [bgcolor=#40E0D0] [border: (1px solid #777777)]
+        LayoutText {#text} at (324,3) size 4x18
+          text run at (324,3) width 4: " "
+        LayoutBlockFlow {INPUT} at (328,0) size 88x23 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
+          LayoutFlexibleBox {DIV} at (1,1) size 86x21
+            LayoutBlockFlow {DIV} at (24,4) size 54x13 [bgcolor=#FF0000] [border: (1px solid #000000)]
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/menulist-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/menulist-appearance-basic-expected.png
index 7aadfa1..b1c334b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/menulist-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/menulist-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/menulist-appearance-basic-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/menulist-appearance-basic-expected.txt
index bc2f9adf..0be68d26 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/menulist-appearance-basic-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/menulist-appearance-basic-expected.txt
@@ -125,26 +125,26 @@
       LayoutBR {BR} at (72,409) size 0x18
       LayoutMenuList {SELECT} at (4,443) size 48x18 [bgcolor=#F8F8F8]
         LayoutBlockFlow (anonymous) at (0,0) size 48x18
-          LayoutText (anonymous) at (8,2) size 17x13
-            text run at (8,2) width 17: "foo"
+          LayoutText (anonymous) at (23,2) size 17x13
+            text run at (23,2) width 17: "foo"
       LayoutText {#text} at (56,442) size 4x18
         text run at (56,442) width 4: " "
       LayoutMenuList {SELECT} at (64,441) size 44x22 [bgcolor=#F8F8F8] [border: (3px solid #00FF00)]
         LayoutBlockFlow (anonymous) at (3,3) size 38x16
-          LayoutText (anonymous) at (8,1) size 17x13
-            text run at (8,1) width 17: "foo"
+          LayoutText (anonymous) at (13,1) size 17x13
+            text run at (13,1) width 17: "foo"
       LayoutText {#text} at (112,442) size 4x18
         text run at (112,442) width 4: " "
       LayoutMenuList {SELECT} at (120,436) size 54x32 [bgcolor=#F8F8F8] [border: (8px solid #00FF00)]
         LayoutBlockFlow (anonymous) at (8,8) size 38x16
-          LayoutText (anonymous) at (8,1) size 17x13
-            text run at (8,1) width 17: "foo"
+          LayoutText (anonymous) at (13,1) size 17x13
+            text run at (13,1) width 17: "foo"
       LayoutText {#text} at (178,442) size 4x18
         text run at (178,442) width 4: " "
       LayoutMenuList {SELECT} at (186,443) size 40x18 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
         LayoutBlockFlow (anonymous) at (1,1) size 38x16
-          LayoutText (anonymous) at (8,1) size 17x13
-            text run at (8,1) width 17: "foo"
+          LayoutText (anonymous) at (13,1) size 17x13
+            text run at (13,1) width 17: "foo"
       LayoutText {#text} at (230,442) size 4x18
         text run at (230,442) width 4: " "
       LayoutBR {BR} at (234,442) size 0x18
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/select-writing-direction-natural-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/select-writing-direction-natural-expected.png
index da89f09..3ecf9020 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/select-writing-direction-natural-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/select-writing-direction-natural-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/select-writing-direction-natural-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/select-writing-direction-natural-expected.txt
index 525bcd4..0c5d18d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/select-writing-direction-natural-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/select-writing-direction-natural-expected.txt
@@ -84,58 +84,58 @@
         LayoutBlockFlow {DIV} at (0,0) size 784x19
           LayoutMenuList {SELECT} at (222,1) size 70x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 70x18
-              LayoutText (anonymous) at (32,2) size 15x13
-                text run at (32,2) width 8: "A"
-                text run at (39,2) width 8 RTL: "\x{5D0}"
+              LayoutText (anonymous) at (47,2) size 15x13
+                text run at (47,2) width 8: "A"
+                text run at (54,2) width 8 RTL: "\x{5D0}"
           LayoutText {#text} at (218,0) size 4x18
             text run at (218,0) width 4 RTL: " "
           LayoutMenuList {SELECT} at (148,1) size 70x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 70x18
-              LayoutText (anonymous) at (32,2) size 15x13
-                text run at (32,2) width 8 RTL: "\x{5D0}"
-                text run at (39,2) width 8: "A"
+              LayoutText (anonymous) at (47,2) size 15x13
+                text run at (47,2) width 8 RTL: "\x{5D0}"
+                text run at (54,2) width 8: "A"
           LayoutText {#text} at (144,0) size 4x18
             text run at (144,0) width 4 RTL: " "
           LayoutMenuList {SELECT} at (74,1) size 70x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 70x18
-              LayoutText (anonymous) at (28,2) size 19x13
-                text run at (28,2) width 9: "A"
-                text run at (36,2) width 11 RTL: "(\x{5D0}"
+              LayoutText (anonymous) at (43,2) size 19x13
+                text run at (43,2) width 9: "A"
+                text run at (51,2) width 11 RTL: "(\x{5D0}"
           LayoutText {#text} at (70,0) size 4x18
             text run at (70,0) width 4 RTL: " "
           LayoutMenuList {SELECT} at (0,1) size 70x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 70x18
-              LayoutText (anonymous) at (28,2) size 19x13
-                text run at (28,2) width 8 RTL: "\x{5D0}"
-                text run at (35,2) width 9: "A"
-                text run at (43,2) width 4 RTL: "("
+              LayoutText (anonymous) at (43,2) size 19x13
+                text run at (43,2) width 8 RTL: "\x{5D0}"
+                text run at (50,2) width 9: "A"
+                text run at (58,2) width 4 RTL: "("
           LayoutText {#text} at (0,0) size 0x0
         LayoutBlockFlow {DIV} at (0,19) size 784x19
           LayoutMenuList {SELECT} at (714,1) size 70x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 70x18
-              LayoutText (anonymous) at (32,2) size 15x13
-                text run at (32,2) width 8: "A"
-                text run at (39,2) width 8 RTL: "\x{5D0}"
+              LayoutText (anonymous) at (47,2) size 15x13
+                text run at (47,2) width 8: "A"
+                text run at (54,2) width 8 RTL: "\x{5D0}"
           LayoutText {#text} at (710,0) size 4x18
             text run at (710,0) width 4 RTL: " "
           LayoutMenuList {SELECT} at (640,1) size 70x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 70x18
-              LayoutText (anonymous) at (32,2) size 15x13
-                text run at (32,2) width 8 RTL: "\x{5D0}"
-                text run at (39,2) width 8: "A"
+              LayoutText (anonymous) at (47,2) size 15x13
+                text run at (47,2) width 8 RTL: "\x{5D0}"
+                text run at (54,2) width 8: "A"
           LayoutText {#text} at (636,0) size 4x18
             text run at (636,0) width 4 RTL: " "
           LayoutMenuList {SELECT} at (566,1) size 70x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 70x18
-              LayoutText (anonymous) at (28,2) size 19x13
-                text run at (28,2) width 9: "A"
-                text run at (36,2) width 11 RTL: "(\x{5D0}"
+              LayoutText (anonymous) at (43,2) size 19x13
+                text run at (43,2) width 9: "A"
+                text run at (51,2) width 11 RTL: "(\x{5D0}"
           LayoutText {#text} at (562,0) size 4x18
             text run at (562,0) width 4 RTL: " "
           LayoutMenuList {SELECT} at (492,1) size 70x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 70x18
-              LayoutText (anonymous) at (28,2) size 19x13
-                text run at (28,2) width 8 RTL: "\x{5D0}"
-                text run at (35,2) width 9: "A"
-                text run at (43,2) width 4 RTL: "("
+              LayoutText (anonymous) at (43,2) size 19x13
+                text run at (43,2) width 8 RTL: "\x{5D0}"
+                text run at (50,2) width 9: "A"
+                text run at (58,2) width 4 RTL: "("
           LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.png
index a17f1edd..bc90a38 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.txt
index d82b1a8..a133fd1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.txt
@@ -16,9 +16,9 @@
         LayoutBR {BR} at (285,14) size 1x0
         LayoutMenuList {SELECT} at (0,18) size 100x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 100x18
-            LayoutText (anonymous) at (16,2) size 61x13
-              text run at (16,2) width 43 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
-              text run at (58,2) width 19: "abc"
+            LayoutText (anonymous) at (31,2) size 61x13
+              text run at (31,2) width 43 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
+              text run at (73,2) width 19: "abc"
         LayoutBR {BR} at (100,31) size 0x0
       LayoutBlockFlow {DIV} at (0,106) size 100x19
         LayoutText {#text} at (0,1) size 82x18
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/menulist-width-rtl-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/menulist-width-rtl-expected.png
index 6bc4fa3..be2515c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/menulist-width-rtl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/menulist-width-rtl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/menulist-width-rtl-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/menulist-width-rtl-expected.txt
index f63e8a32..99a22dbf 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/menulist-width-rtl-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/menulist-width-rtl-expected.txt
@@ -12,6 +12,6 @@
       LayoutBlockFlow (anonymous) at (0,36) size 784x19
         LayoutMenuList {SELECT} at (669,1) size 115x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 115x21
-            LayoutText (anonymous) at (8,2) size 84x13
-              text run at (8,2) width 84 RTL: "\x{627}\x{644}\x{627}\x{642}\x{62A}\x{631}\x{627}\x{62D}\x{627}\x{62A} / \x{627}\x{644}\x{634}\x{643}\x{627}\x{648}\x{64A}"
+            LayoutText (anonymous) at (23,2) size 84x13
+              text run at (23,2) width 84 RTL: "\x{627}\x{644}\x{627}\x{642}\x{62A}\x{631}\x{627}\x{62D}\x{627}\x{62A} / \x{627}\x{644}\x{634}\x{643}\x{627}\x{648}\x{64A}"
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.png
index ee5e71bb..9c91f96 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.txt
index d015cef0..e477e3a6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.txt
@@ -55,12 +55,12 @@
       LayoutBlockFlow {DIV} at (0,270) size 784x236
         LayoutMenuList {SELECT} at (0,0) size 500x23 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
           LayoutBlockFlow (anonymous) at (1,1) size 498x21
-            LayoutText (anonymous) at (284,1) size 198x18
-              text run at (284,1) width 39: "First "
-              text run at (322,1) width 60 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA}"
-              text run at (381,1) width 21: "03"
-              text run at (401,1) width 46 RTL: "\x{5E9}\x{5E0}\x{5D9}\x{5D4} ("
-              text run at (446,1) width 36: " fifth"
+            LayoutText (anonymous) at (292,1) size 198x18
+              text run at (292,1) width 39: "First "
+              text run at (330,1) width 60 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA}"
+              text run at (389,1) width 21: "03"
+              text run at (409,1) width 46 RTL: "\x{5E9}\x{5E0}\x{5D9}\x{5D4} ("
+              text run at (454,1) width 36: " fifth"
         LayoutBlockFlow {DIV} at (0,23) size 470x36
           LayoutText {#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"
         LayoutMenuList {SELECT} at (0,59) size 500x23 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
           LayoutBlockFlow (anonymous) at (1,1) size 498x21
-            LayoutText (anonymous) at (284,1) size 198x18
-              text run at (284,1) width 32: "fifth"
-              text run at (315,1) width 65 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} "
-              text run at (379,1) width 21: "03"
-              text run at (399,1) width 50 RTL: " \x{5E9}\x{5E0}\x{5D9}\x{5D4} ("
-              text run at (448,1) width 34: "First"
+            LayoutText (anonymous) at (292,1) size 198x18
+              text run at (292,1) width 32: "fifth"
+              text run at (323,1) width 65 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} "
+              text run at (387,1) width 21: "03"
+              text run at (407,1) width 50 RTL: " \x{5E9}\x{5E0}\x{5D9}\x{5D4} ("
+              text run at (456,1) width 34: "First"
         LayoutBlockFlow {DIV} at (0,82) size 470x36
           LayoutText {#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"
         LayoutMenuList {SELECT} at (0,118) size 500x23 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
           LayoutBlockFlow (anonymous) at (1,1) size 498x21
-            LayoutText (anonymous) at (284,1) size 198x18
-              text run at (284,1) width 198 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"
+            LayoutText (anonymous) at (292,1) size 198x18
+              text run at (292,1) width 198 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"
         LayoutBlockFlow {DIV} at (0,141) size 470x36
           LayoutText {#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"
         LayoutMenuList {SELECT} at (0,177) size 500x23 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
           LayoutBlockFlow (anonymous) at (1,1) size 498x21
-            LayoutText (anonymous) at (284,1) size 198x18
-              text run at (284,1) width 198 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"
+            LayoutText (anonymous) at (292,1) size 198x18
+              text run at (292,1) width 198 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"
         LayoutBlockFlow {DIV} at (0,200) size 470x36
           LayoutText {#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"
diff --git a/third_party/WebKit/Source/core/css/html.css b/third_party/WebKit/Source/core/css/html.css
index f078286..52d3407 100644
--- a/third_party/WebKit/Source/core/css/html.css
+++ b/third_party/WebKit/Source/core/css/html.css
@@ -688,8 +688,8 @@
 }
 
 input[type="color" i][list]::-webkit-color-swatch-wrapper {
-    padding-left: 8px;
-    padding-right: 24px;
+    -webkit-padding-start: 8px;
+    -webkit-padding-end: 24px;
 }
 
 input[type="color" i][list]::-webkit-color-swatch {
diff --git a/third_party/WebKit/Source/core/layout/LayoutThemeMac.h b/third_party/WebKit/Source/core/layout/LayoutThemeMac.h
index f6e11f9a..a7e5923 100644
--- a/third_party/WebKit/Source/core/layout/LayoutThemeMac.h
+++ b/third_party/WebKit/Source/core/layout/LayoutThemeMac.h
@@ -147,8 +147,8 @@
     static constexpr float menuListBaseArrowHeight = 4.0f;
     static constexpr float menuListBaseArrowWidth = 5.0f;
     static constexpr float menuListBaseSpaceBetweenArrows = 2.0f;
-    static const int menuListArrowPaddingLeft = 4;
-    static const int menuListArrowPaddingRight = 4;
+    static const int menuListArrowPaddingStart = 4;
+    static const int menuListArrowPaddingEnd = 4;
     static const int sliderThumbWidth = 15;
     static const int sliderThumbHeight = 15;
     static const int sliderThumbShadowBlur = 1;
diff --git a/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm b/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm
index 7c85b6e9..2a8ec74 100644
--- a/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm
+++ b/third_party/WebKit/Source/core/layout/LayoutThemeMac.mm
@@ -476,6 +476,10 @@
             return true;
         if (!style.height().isIntrinsicOrAuto())
             return true;
+        // NSPopUpButtonCell on macOS 10.9 doesn't support
+        // NSUserInterfaceLayoutDirectionRightToLeft.
+        if (IsOSMavericks() && style.direction() == RTL)
+            return true;
     }
     // Some other cells don't work well when scaled.
     if (style.effectiveZoom() != 1) {
@@ -747,7 +751,7 @@
 }
 
 static const int baseBorderRadius = 5;
-static const int styledPopupPaddingLeft = 8;
+static const int styledPopupPaddingStart = 8;
 static const int styledPopupPaddingTop = 1;
 static const int styledPopupPaddingBottom = 2;
 
@@ -755,23 +759,32 @@
 // by LayoutMenuList.
 int LayoutThemeMac::popupInternalPaddingLeft(const ComputedStyle& style) const
 {
+    bool isRTL = style.direction() == RTL;
     if (style.appearance() == MenulistPart)
-        return popupButtonPadding(controlSizeForFont(style))[ThemeMac::LeftMargin] * style.effectiveZoom();
-    if (style.appearance() == MenulistButtonPart)
-        return styledPopupPaddingLeft * style.effectiveZoom();
-    return 0;
+        return popupButtonPadding(controlSizeForFont(style))[isRTL ? ThemeMac::RightMargin : ThemeMac::LeftMargin] * style.effectiveZoom();
+    if (style.appearance() != MenulistButtonPart)
+        return 0;
+    if (isRTL) {
+        float fontScale = style.fontSize() / baseFontSize;
+        float arrowWidth = menuListBaseArrowWidth * fontScale;
+        return static_cast<int>(ceilf(arrowWidth + (menuListArrowPaddingStart + menuListArrowPaddingEnd) * style.effectiveZoom()));
+    }
+    return styledPopupPaddingStart * style.effectiveZoom();
 }
 
 int LayoutThemeMac::popupInternalPaddingRight(const ComputedStyle& style) const
 {
+    bool isRTL = style.direction() == RTL;
     if (style.appearance() == MenulistPart)
-        return popupButtonPadding(controlSizeForFont(style))[ThemeMac::RightMargin] * style.effectiveZoom();
-    if (style.appearance() == MenulistButtonPart) {
-        float fontScale = style.fontSize() / baseFontSize;
-        float arrowWidth = menuListBaseArrowWidth * fontScale;
-        return static_cast<int>(ceilf(arrowWidth + (menuListArrowPaddingLeft + menuListArrowPaddingRight) * style.effectiveZoom()));
+        return popupButtonPadding(controlSizeForFont(style))[isRTL ? ThemeMac::LeftMargin : ThemeMac::RightMargin] * style.effectiveZoom();
+    if (style.appearance() != MenulistButtonPart)
+        return 0;
+    if (isRTL) {
+        return styledPopupPaddingStart * style.effectiveZoom();
     }
-    return 0;
+    float fontScale = style.fontSize() / baseFontSize;
+    float arrowWidth = menuListBaseArrowWidth * fontScale;
+    return static_cast<int>(ceilf(arrowWidth + (menuListArrowPaddingStart + menuListArrowPaddingEnd) * style.effectiveZoom()));
 }
 
 int LayoutThemeMac::popupInternalPaddingTop(const ComputedStyle& style) const
@@ -817,6 +830,8 @@
     updateCheckedState(popupButton, object);
     updateEnabledState(popupButton, object);
     updatePressedState(popupButton, object);
+
+    popupButton.userInterfaceLayoutDirection = object.styleRef().direction() == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft;
 }
 
 const IntSize* LayoutThemeMac::menuListSizes() const
diff --git a/third_party/WebKit/Source/core/paint/ThemePainterMac.mm b/third_party/WebKit/Source/core/paint/ThemePainterMac.mm
index 1b35b80..512f084a 100644
--- a/third_party/WebKit/Source/core/paint/ThemePainterMac.mm
+++ b/third_party/WebKit/Source/core/paint/ThemePainterMac.mm
@@ -260,10 +260,15 @@
     float centerY = bounds.y() + bounds.height() / 2.0f;
     float arrowHeight = LayoutThemeMac::menuListBaseArrowHeight * fontScale;
     float arrowWidth = LayoutThemeMac::menuListBaseArrowWidth * fontScale;
-    float leftEdge = bounds.maxX() - LayoutThemeMac::menuListArrowPaddingRight * o.styleRef().effectiveZoom() - arrowWidth;
     float spaceBetweenArrows = LayoutThemeMac::menuListBaseSpaceBetweenArrows * fontScale;
-
-    if (bounds.width() < arrowWidth + LayoutThemeMac::menuListArrowPaddingLeft * o.styleRef().effectiveZoom())
+    float scaledPaddingEnd = LayoutThemeMac::menuListArrowPaddingEnd * o.styleRef().effectiveZoom();
+    float leftEdge;
+    if (o.styleRef().direction() == LTR) {
+        leftEdge = bounds.maxX() - scaledPaddingEnd - arrowWidth;
+    } else {
+        leftEdge = bounds.x() + scaledPaddingEnd;
+    }
+    if (bounds.width() < arrowWidth + scaledPaddingEnd)
         return false;
 
     Color color = o.styleRef().visitedDependentColor(CSSPropertyColor);