Title: [131389] trunk
Revision
131389
Author
[email protected]
Date
2012-10-15 17:39:28 -0700 (Mon, 15 Oct 2012)

Log Message

Input elements with multiple fields UI should set appropriate direction for browser locale automatically
https://bugs.webkit.org/show_bug.cgi?id=99291

Reviewed by Hajime Morita.

Source/WebCore:

Input elemnts with multiple fields UI ignores HTML dir attribute or CSS
direction property, and their direction should be decided by the browser
locale. If the browser locale is a RTL language, date/time input fields
show formats/digits for the RTL language. The layout should be always
RTL regardless of the direction in such case.

Test: fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n.html

* html/BaseMultipleFieldsDateAndTimeInputType.cpp:
(WebCore::BaseMultipleFieldsDateAndTimeInputType::updateInnerTextValue):
Set approriate dir attribute value to the child element of the UA shadow root.

LayoutTests:

* fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n.html:
Added. We can confirm ar-eg and he-il have RTL layout.
* fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n-expected.txt: Added.
* platform/chromium-mac/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n-expected.png: Added.

* fast/forms/date-multiple-fields/date-multiple-fields-keyboard-events-expected.txt:
* fast/forms/date-multiple-fields/date-multiple-fields-keyboard-events.html:
- Enable the lang-attribute-aware-form-control-UI feature.
- Set lang=he-il instead of dir=rtl because dir=rtl is ignored.
* fast/forms/month-multiple-fields/month-multiple-fields-keyboard-events.html: Ditto.
* fast/forms/time-multiple-fields/time-multiple-fields-keyboard-events.html: Ditto.

* platform/chromium-mac/fast/forms/date-multiple-fields/date-multiple-fields-appearance-basic-expected.png:
Updated becaues dir=RTL doesn't affect.
* platform/chromium-mac/fast/forms/month-multiple-fields/month-multiple-fields-appearance-basic-expected.png:
Ditto.
* platform/chromium-mac/fast/forms/time-multiple-fields/time-multiple-fields-appearance-basic-expected.png:
Ditto.
* platform/chromium-mac/fast/forms/week-multiple-fields/week-multiple-fields-appearance-basic-expected.png:
Ditto.

* platform/chromium/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (131388 => 131389)


--- trunk/LayoutTests/ChangeLog	2012-10-16 00:36:39 UTC (rev 131388)
+++ trunk/LayoutTests/ChangeLog	2012-10-16 00:39:28 UTC (rev 131389)
@@ -1,3 +1,33 @@
+2012-10-14  Kent Tamura  <[email protected]>
+
+        Input elements with multiple fields UI should set appropriate direction for browser locale automatically
+        https://bugs.webkit.org/show_bug.cgi?id=99291
+
+        Reviewed by Hajime Morita.
+
+        * fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n.html:
+        Added. We can confirm ar-eg and he-il have RTL layout.
+        * fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n-expected.txt: Added.
+        * platform/chromium-mac/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n-expected.png: Added.
+
+        * fast/forms/date-multiple-fields/date-multiple-fields-keyboard-events-expected.txt:
+        * fast/forms/date-multiple-fields/date-multiple-fields-keyboard-events.html:
+        - Enable the lang-attribute-aware-form-control-UI feature.
+        - Set lang=he-il instead of dir=rtl because dir=rtl is ignored.
+        * fast/forms/month-multiple-fields/month-multiple-fields-keyboard-events.html: Ditto.
+        * fast/forms/time-multiple-fields/time-multiple-fields-keyboard-events.html: Ditto.
+
+        * platform/chromium-mac/fast/forms/date-multiple-fields/date-multiple-fields-appearance-basic-expected.png:
+        Updated becaues dir=RTL doesn't affect.
+        * platform/chromium-mac/fast/forms/month-multiple-fields/month-multiple-fields-appearance-basic-expected.png:
+        Ditto.
+        * platform/chromium-mac/fast/forms/time-multiple-fields/time-multiple-fields-appearance-basic-expected.png:
+        Ditto.
+        * platform/chromium-mac/fast/forms/week-multiple-fields/week-multiple-fields-appearance-basic-expected.png:
+        Ditto.
+
+        * platform/chromium/TestExpectations:
+
 2012-10-15  Dana Jansens  <[email protected]>
 
         inspector/styles/styles-computed-trace.html is timing out

Added: trunk/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n-expected.txt (0 => 131389)


--- trunk/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n-expected.txt	2012-10-16 00:39:28 UTC (rev 131389)
@@ -0,0 +1,24 @@
+ar-eg
+
+de-de
+
+el-gr
+
+en-us
+
+fr-fr
+
+he-il
+
+hi-in
+
+ja-jp
+
+ko-kr
+
+ru-ru
+
+zh-tw
+
+zh-cn
+
Property changes on: trunk/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n.html (0 => 131389)


--- trunk/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n.html	2012-10-16 00:39:28 UTC (rev 131389)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script>
+if (window.internals)
+    internals.settings.setLangAttributeAwareFormControlUIEnabled(true);
+if (window.testRunner)
+    testRunner.dumpAsText(true);
+</script>
+<style>
+dt {
+    float: left;
+    min-width: 5em;
+}
+</style>
+</head>
+<body>
+<dl>
+<dt>ar-eg
+<dd><input type="date" value="2012-12-31" lang="ar-eg">
+<dt>de-de
+<dd><input type="date" value="2012-12-31" lang="de-de">
+<dt>el-gr
+<dd><input type="date" value="2012-12-31" lang="el-gr">
+<dt>en-us
+<dd><input type="date" value="2012-12-31" lang="en-us">
+<dt>fr-fr
+<dd><input type="date" value="2012-12-31" lang="fr-fr">
+<dt>he-il
+<dd><input type="date" value="2012-12-31" lang="he-il">
+<dt>hi-in
+<dd><input type="date" value="2012-12-31" lang="hi-in">
+<dt>ja-jp
+<dd><input type="date" value="2012-12-31" lang="ja-jp">
+<dt>ko-kr
+<dd><input type="date" value="2012-12-31" lang="ko-kr">
+<dt>ru-ru
+<dd><input type="date" value="2012-12-31" lang="ru-ru">
+<dt>zh-tw
+<dd><input type="date" value="2012-12-31" lang="zh-tw">
+<dt>zh-cn
+<dd><input type="date" value="2012-12-31" lang="zh-cn">
+</dl>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-keyboard-events-expected.txt (131388 => 131389)


--- trunk/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-keyboard-events-expected.txt	2012-10-16 00:36:39 UTC (rev 131388)
+++ trunk/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-keyboard-events-expected.txt	2012-10-16 00:39:28 UTC (rev 131389)
@@ -52,9 +52,9 @@
 PASS input.value is "2012-12-01"
 PASS input.value is "2012-12-02"
 == RTL Left/Right keys ==
-PASS input.value is "2012-01-28"
-PASS input.value is "2012-01-02"
-PASS input.value is "2012-03-02"
+PASS input.value is "2012-09-01"
+PASS input.value is "2012-02-01"
+PASS input.value is "2012-03-01"
 == Disabled/readonly ==
 PASS input.value is "2012-10-08"
 PASS input.value is "2012-11-08"

Modified: trunk/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-keyboard-events.html (131388 => 131389)


--- trunk/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-keyboard-events.html	2012-10-16 00:36:39 UTC (rev 131388)
+++ trunk/LayoutTests/fast/forms/date-multiple-fields/date-multiple-fields-keyboard-events.html	2012-10-16 00:39:28 UTC (rev 131389)
@@ -22,6 +22,8 @@
 <div id="console"></div>
 <script>
 description('Multiple fields UI of month input type with keyboard events');
+if (window.internals)
+    internals.settings.setLangAttributeAwareFormControlUIEnabled(true);
 var input = document.getElementById('input');
 
 function keyDown(key, modifiers)
@@ -187,16 +189,20 @@
 keyDown('2'); //          -> 12/[02]/2012
 shouldBeEqualToString('input.value', '2012-12-02');
 
+// The tests in the following block fail on platforms without the
+// lang-attribute-aware-form-control-UI feature.
+input.setAttribute("lang", "he-il");
 beginTest('RTL Left/Right keys', '2012-09-28');
-input.setAttribute("dir", "rtl"); // -> 2012/28/[09]
-keyDown('1'); //          -> 2012/28/[01]
-shouldBeEqualToString('input.value', '2012-01-28');
-keyDown('leftArrow'); //  -> 2012/[28]/01
-keyDown('2'); //          -> 2012/[02]/01
-shouldBeEqualToString('input.value', '2012-01-02');
-keyDown('rightArrow'); // -> 2012/02/[01]
-keyDown('3'); //          -> 2012/02/[03]
-shouldBeEqualToString('input.value', '2012-03-02');
+// 2012/09/[28]
+keyDown('1'); //          -> 2012/09/[01]
+shouldBeEqualToString('input.value', '2012-09-01');
+keyDown('leftArrow'); //  -> 2012/[09]/01
+keyDown('2'); //          -> [2012]/02/01
+shouldBeEqualToString('input.value', '2012-02-01');
+keyDown('rightArrow'); // -> 2012/[02]/01
+keyDown('3'); //          -> [2012]/03/01
+shouldBeEqualToString('input.value', '2012-03-01');
+input.removeAttribute("lang");
 
 beginTest('Disabled/readonly', '2012-10-08');
 input.disabled = true;

Modified: trunk/LayoutTests/fast/forms/month-multiple-fields/month-multiple-fields-keyboard-events.html (131388 => 131389)


--- trunk/LayoutTests/fast/forms/month-multiple-fields/month-multiple-fields-keyboard-events.html	2012-10-16 00:36:39 UTC (rev 131388)
+++ trunk/LayoutTests/fast/forms/month-multiple-fields/month-multiple-fields-keyboard-events.html	2012-10-16 00:39:28 UTC (rev 131389)
@@ -22,6 +22,8 @@
 <div id="console"></div>
 <script>
 description("Multiple fields UI of month input type with keyboard events");
+if (window.internals)
+    internals.settings.setLangAttributeAwareFormControlUIEnabled(true);
 var input = document.getElementById("input");
 
 function keyDown(key, modifiers)
@@ -168,8 +170,10 @@
 keyDown('2');
 shouldBeEqualToString('input.value', '0002-12');
 
+// The tests in the following block fail on platforms without the
+// lang-attribute-aware-form-control-UI feature.
+input.setAttribute("lang", "he-il");
 beginTest('RTL Left/Right keys', '2012-09');
-input.setAttribute("dir", "rtl");
 keyDown('1');
 shouldBeEqualToString('input.value', '2012-01');
 keyDown('leftArrow');
@@ -178,6 +182,7 @@
 keyDown('rightArrow');
 keyDown('3');
 shouldBeEqualToString('input.value', '0002-03');
+input.removeAttribute("lang");
 </script>
 <script src=""
 </body>

Modified: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-keyboard-events.html (131388 => 131389)


--- trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-keyboard-events.html	2012-10-16 00:36:39 UTC (rev 131388)
+++ trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-keyboard-events.html	2012-10-16 00:39:28 UTC (rev 131389)
@@ -22,6 +22,8 @@
 <div id="console"></div>
 <script>
 description("Multiple fields UI of time input type with keyboard events");
+if (window.internals)
+    internals.settings.setLangAttributeAwareFormControlUIEnabled(true);
 var input = document.getElementById("input");
 
 function keyDown(key, modifiers)
@@ -162,16 +164,19 @@
 keyDown('2');
 shouldBeEqualToString('input.value', '12:02:56');
 
+// The tests in the following block fail on platforms without the
+// lang-attribute-aware-form-control-UI feature.
+input.setAttribute("lang", "he-il");
 beginTest('RTL Left/Right keys', '04:56');
-input.setAttribute("dir", "rtl");
-keyDown('1');
+keyDown('1'); //          -> 56:[01]
 shouldBeEqualToString('input.value', '01:56');
-keyDown('leftArrow');
-keyDown('2');
+keyDown('leftArrow'); //  -> [56]:01
+keyDown('2'); //          -> [02]:01
 shouldBeEqualToString('input.value', '01:02');
-keyDown('rightArrow');
-keyDown('3');
+keyDown('rightArrow'); // -> 02:[01]
+keyDown('3'); //          -> 01:[03]
 shouldBeEqualToString('input.value', '03:02');
+input.removeAttribute("lang");
 </script>
 <script src=""
 </body>

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (131388 => 131389)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-10-16 00:36:39 UTC (rev 131388)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-10-16 00:39:28 UTC (rev 131389)
@@ -3895,6 +3895,15 @@
 webkit.org/b/96720 [ Mac Win ] fast/forms/time-multiple-fields/time-multiple-fields-preserve-value-after-history-back.html [ Pass Timeout ]
 webkit.org/b/96720 [ Mac Win ] fast/forms/date-multiple-fields/date-multiple-fields-preserve-value-after-history-back.html [ Pass Timeout ]
 
+# Need rebaseline
+webkit.org/b/99291 fast/forms/date-multiple-fields/date-multiple-fields-appearance-basic.html [ Pass ImageOnlyFailure ]
+webkit.org/b/99291 fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n.html [ Pass ImageOnlyFailure Missing ]
+webkit.org/b/99291 fast/forms/month-multiple-fields/month-multiple-fields-appearance-basic.html [ Pass ImageOnlyFailure ]
+webkit.org/b/99291 fast/forms/time-multiple-fields/time-multiple-fields-appearance-basic.html [ Pass ImageOnlyFailure ]
+webkit.org/b/99291 fast/forms/week-multiple-fields/week-multiple-fields-appearance-basic.html [ Pass ImageOnlyFailure ]
+webkit.org/b/99291 platform/chromium/fast/forms/date/date-suggestion-picker-appearance-rtl.html [ Pass ImageOnlyFailure ]
+webkit.org/b/99291 platform/chromium/fast/forms/time/time-suggestion-picker-appearance-rtl.html [ Pass ImageOnlyFailure ]
+
 webkit.org/b/96549 [ Mac Android ] platform/chromium/virtual/gpu/fast/hidpi/focus-rings.html [ ImageOnlyFailure ]
 webkit.org/b/96549 [ Mac ] platform/chromium/virtual/gpu/fast/hidpi/video-controls-in-hidpi.html [ ImageOnlyFailure ]
 webkit.org/b/96628 [ Lion ] fast/frames/calculate-order.html [ Failure Pass ]

Modified: trunk/LayoutTests/platform/chromium-mac/fast/forms/date-multiple-fields/date-multiple-fields-appearance-basic-expected.png


(Binary files differ)

Added: trunk/LayoutTests/platform/chromium-mac/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/chromium-mac/fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n-expected.png ___________________________________________________________________

Added: svn:mime-type

Modified: trunk/LayoutTests/platform/chromium-mac/fast/forms/month-multiple-fields/month-multiple-fields-appearance-basic-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-mac/fast/forms/time-multiple-fields/time-multiple-fields-appearance-basic-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-mac/fast/forms/week-multiple-fields/week-multiple-fields-appearance-basic-expected.png


(Binary files differ)

Modified: trunk/Source/WebCore/ChangeLog (131388 => 131389)


--- trunk/Source/WebCore/ChangeLog	2012-10-16 00:36:39 UTC (rev 131388)
+++ trunk/Source/WebCore/ChangeLog	2012-10-16 00:39:28 UTC (rev 131389)
@@ -1,3 +1,22 @@
+2012-10-14  Kent Tamura  <[email protected]>
+
+        Input elements with multiple fields UI should set appropriate direction for browser locale automatically
+        https://bugs.webkit.org/show_bug.cgi?id=99291
+
+        Reviewed by Hajime Morita.
+
+        Input elemnts with multiple fields UI ignores HTML dir attribute or CSS
+        direction property, and their direction should be decided by the browser
+        locale. If the browser locale is a RTL language, date/time input fields
+        show formats/digits for the RTL language. The layout should be always
+        RTL regardless of the direction in such case.
+
+        Test: fast/forms/date-multiple-fields/date-multiple-fields-appearance-l10n.html
+
+        * html/BaseMultipleFieldsDateAndTimeInputType.cpp:
+        (WebCore::BaseMultipleFieldsDateAndTimeInputType::updateInnerTextValue):
+        Set approriate dir attribute value to the child element of the UA shadow root.
+
 2012-10-15  Andreas Kling  <[email protected]>
 
         StyleResolver: Garbage collect the matched properties cache on a timer.

Modified: trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp (131388 => 131389)


--- trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp	2012-10-16 00:36:39 UTC (rev 131388)
+++ trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp	2012-10-16 00:39:28 UTC (rev 131389)
@@ -273,6 +273,10 @@
     if (!m_dateTimeEditElement)
         return;
 
+    AtomicString direction = element()->localizer().isRTL() ? AtomicString("rtl", AtomicString::ConstructFromLiteral) : AtomicString("ltr", AtomicString::ConstructFromLiteral);
+    if (Element* container = firstElementChild(element()->userAgentShadowRoot()))
+        container->setAttribute(HTMLNames::dirAttr, direction);
+
     DateTimeEditElement::LayoutParameters layoutParameters(element()->localizer(), createStepRange(AnyIsDefaultStep));
 
     DateComponents date;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to