Title: [218468] trunk
Revision
218468
Author
[email protected]
Date
2017-06-18 21:00:49 -0700 (Sun, 18 Jun 2017)

Log Message

Meter element doesn't respect the writing direction
https://bugs.webkit.org/show_bug.cgi?id=173507

Reviewed by Sam Weinig.

Source/WebCore:

The bug was caused by NSLevelIndicatorCell no longer using the value of baseWritingDirection
to determine the direction of rendering in macOS Sierra and later. It instead relies on
the value of userInterfaceLayoutDirection.

Fixed the bug by setting both values. Once we dropped the support for macOS El Capitan
and earlier, we can remove the code to set baseWritingDirection.

Test: fast/dom/HTMLMeterElement/meter-rtl.html

* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::levelIndicatorFor):

LayoutTests:

A regression ref test since existing tests were pixel tests and did not catch this regression.
Note that black border was added to workaround the anti-aliasing differences in macOS High Sierra.

* fast/dom/HTMLMeterElement/meter-rtl-expected.html: Added.
* fast/dom/HTMLMeterElement/meter-rtl.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (218467 => 218468)


--- trunk/LayoutTests/ChangeLog	2017-06-19 03:12:15 UTC (rev 218467)
+++ trunk/LayoutTests/ChangeLog	2017-06-19 04:00:49 UTC (rev 218468)
@@ -1,3 +1,16 @@
+2017-06-18  Ryosuke Niwa  <[email protected]>
+
+        Meter element doesn't respect the writing direction
+        https://bugs.webkit.org/show_bug.cgi?id=173507
+
+        Reviewed by Sam Weinig.
+
+        A regression ref test since existing tests were pixel tests and did not catch this regression.
+        Note that black border was added to workaround the anti-aliasing differences in macOS High Sierra.
+
+        * fast/dom/HTMLMeterElement/meter-rtl-expected.html: Added.
+        * fast/dom/HTMLMeterElement/meter-rtl.html: Added.
+
 2017-06-18  Chris Dumez  <[email protected]>
 
         Crash when re-entering MediaDevicesEnumerationRequest::cancel()

Added: trunk/LayoutTests/fast/dom/HTMLMeterElement/meter-rtl-expected.html (0 => 218468)


--- trunk/LayoutTests/fast/dom/HTMLMeterElement/meter-rtl-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLMeterElement/meter-rtl-expected.html	2017-06-19 04:00:49 UTC (rev 218468)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This tests making the meter element RTL. You should see two identical meters progressing from the right to the left.</p>
+<style> meter { border: solid 1px black; } </style>
+<meter min=0 value=50 max=100 style="transform: scaleX(-1);"></meter><br>
+<meter min=0 value=50 max=100 style="transform: scaleX(-1);"></meter>
+</body>
+</html>

Added: trunk/LayoutTests/fast/dom/HTMLMeterElement/meter-rtl.html (0 => 218468)


--- trunk/LayoutTests/fast/dom/HTMLMeterElement/meter-rtl.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/HTMLMeterElement/meter-rtl.html	2017-06-19 04:00:49 UTC (rev 218468)
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>This tests making the meter element RTL. You should see two identical meters progressing from the right to the left.</p>
+<style> meter { border: solid 1px black; } </style>
+<meter min=0 value=50 max=100 dir="rtl"></meter><br>
+<meter min=0 value=50 max=100 style="transform: scaleX(-1);"></meter>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (218467 => 218468)


--- trunk/Source/WebCore/ChangeLog	2017-06-19 03:12:15 UTC (rev 218467)
+++ trunk/Source/WebCore/ChangeLog	2017-06-19 04:00:49 UTC (rev 218468)
@@ -1,3 +1,22 @@
+2017-06-18  Ryosuke Niwa  <[email protected]>
+
+        Meter element doesn't respect the writing direction
+        https://bugs.webkit.org/show_bug.cgi?id=173507
+
+        Reviewed by Sam Weinig.
+
+        The bug was caused by NSLevelIndicatorCell no longer using the value of baseWritingDirection
+        to determine the direction of rendering in macOS Sierra and later. It instead relies on
+        the value of userInterfaceLayoutDirection.
+
+        Fixed the bug by setting both values. Once we dropped the support for macOS El Capitan
+        and earlier, we can remove the code to set baseWritingDirection.
+
+        Test: fast/dom/HTMLMeterElement/meter-rtl.html
+
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::levelIndicatorFor):
+
 2017-06-18  Dewei Zhu  <[email protected]>
 
         Remove 'EditCommand::isEditCommandComposition'.

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (218467 => 218468)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2017-06-19 03:12:15 UTC (rev 218467)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2017-06-19 04:00:49 UTC (rev 218468)
@@ -1074,7 +1074,12 @@
     }
 
     [cell setLevelIndicatorStyle:levelIndicatorStyleFor(style.appearance())];
+    // FIXME: Remove the call to setBaseWritingDirection once __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100 is always true.
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+    [cell setUserInterfaceLayoutDirection: style.isLeftToRightDirection() ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft];
+#else
     [cell setBaseWritingDirection:style.isLeftToRightDirection() ? NSWritingDirectionLeftToRight : NSWritingDirectionRightToLeft];
+#endif
     [cell setMinValue:element->min()];
     [cell setMaxValue:element->max()];
     [cell setObjectValue:@(value)];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to