Title: [127235] trunk
- Revision
- 127235
- Author
- [email protected]
- Date
- 2012-08-31 00:09:11 -0700 (Fri, 31 Aug 2012)
Log Message
[Forms] Left/Right keys in multiple fields time input UI should move focus physical left/right instead of logical left/right regardless text direction.
https://bugs.webkit.org/show_bug.cgi?id=95434
Reviewed by Kent Tamura.
Source/WebCore:
This patch also changes handling of Left/Right keys to aware text
direction ("dir" attribute"). Left/Right keys should move focus
physical right/left instead of logical right/left.
This patch affects ports which enable both ENABLE_INPUT_TYPE_TIME and
ENABLE_INPUT_TYPE_TIME_MULTIPLE_FIELDS.
No new tests. This patch adds a test case into fast/forms/time-multiple-fields/time-multiple-fields-keyboard-events.html
* html/shadow/DateTimeFieldElement.cpp:
(WebCore::DateTimeFieldElement::defaultKeyboardEventHandler): Changed to check isRTL() for Left/Right keys then we call
appropriate focus motion function.
(WebCore::DateTimeFieldElement::isRTL): Added for checking text direction is right-to-left or not.
* html/shadow/DateTimeFieldElement.h:
(DateTimeFieldElement): Added declaration of isRTL().
LayoutTests:
This patch adds a new test case of Left/Right keys navigation on
right-to-left text direction for multiple field time input UI.
This patch affects ports which enable both ENABLE_INPUT_TYPE_TIME and
ENABLE_INPUT_TYPE_TIME_MULTIPLE_FIELDS.
* fast/forms/time-multiple-fields/time-multiple-fields-keyboard-events.html: Changed to have Left/Right keys navigation in
right-to-left text direction.
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (127234 => 127235)
--- trunk/LayoutTests/ChangeLog 2012-08-31 06:31:42 UTC (rev 127234)
+++ trunk/LayoutTests/ChangeLog 2012-08-31 07:09:11 UTC (rev 127235)
@@ -1,3 +1,19 @@
+2012-08-31 Yoshifumi Inoue <[email protected]>
+
+ [Forms] Left/Right keys in multiple fields time input UI should move focus physical left/right instead of logical left/right regardless text direction.
+ https://bugs.webkit.org/show_bug.cgi?id=95434
+
+ Reviewed by Kent Tamura.
+
+ This patch adds a new test case of Left/Right keys navigation on
+ right-to-left text direction for multiple field time input UI.
+
+ This patch affects ports which enable both ENABLE_INPUT_TYPE_TIME and
+ ENABLE_INPUT_TYPE_TIME_MULTIPLE_FIELDS.
+
+ * fast/forms/time-multiple-fields/time-multiple-fields-keyboard-events.html: Changed to have Left/Right keys navigation in
+ right-to-left text direction.
+
2012-08-30 Yoshifumi Inoue <[email protected]>
[Forms] Blur from field should reset typeahead buffer in multiple fields time input UI
Modified: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-keyboard-events-expected.txt (127234 => 127235)
--- trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-keyboard-events-expected.txt 2012-08-31 06:31:42 UTC (rev 127234)
+++ trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-keyboard-events-expected.txt 2012-08-31 07:09:11 UTC (rev 127235)
@@ -37,6 +37,10 @@
== Typeahead ==
PASS input.value is "12:01:56"
PASS input.value is "12:02:56"
+== RTL Left/Right keys ==
+PASS input.value is "01:56"
+PASS input.value is "01:02"
+PASS input.value is "03:02"
PASS successfullyParsed is true
TEST COMPLETE
Modified: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-keyboard-events.html (127234 => 127235)
--- trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-keyboard-events.html 2012-08-31 06:31:42 UTC (rev 127234)
+++ trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-keyboard-events.html 2012-08-31 07:09:11 UTC (rev 127235)
@@ -126,6 +126,17 @@
keyDown('leftArrow');
keyDown('2');
shouldBeEqualToString('input.value', '12:02:56');
+
+beginTest('RTL Left/Right keys', '04:56');
+input.setAttribute("dir", "rtl");
+keyDown('1');
+shouldBeEqualToString('input.value', '01:56');
+keyDown('leftArrow');
+keyDown('2');
+shouldBeEqualToString('input.value', '01:02');
+keyDown('rightArrow');
+keyDown('3');
+shouldBeEqualToString('input.value', '03:02');
</script>
<script src=""
</body>
Modified: trunk/Source/WebCore/ChangeLog (127234 => 127235)
--- trunk/Source/WebCore/ChangeLog 2012-08-31 06:31:42 UTC (rev 127234)
+++ trunk/Source/WebCore/ChangeLog 2012-08-31 07:09:11 UTC (rev 127235)
@@ -1,3 +1,26 @@
+2012-08-31 Yoshifumi Inoue <[email protected]>
+
+ [Forms] Left/Right keys in multiple fields time input UI should move focus physical left/right instead of logical left/right regardless text direction.
+ https://bugs.webkit.org/show_bug.cgi?id=95434
+
+ Reviewed by Kent Tamura.
+
+ This patch also changes handling of Left/Right keys to aware text
+ direction ("dir" attribute"). Left/Right keys should move focus
+ physical right/left instead of logical right/left.
+
+ This patch affects ports which enable both ENABLE_INPUT_TYPE_TIME and
+ ENABLE_INPUT_TYPE_TIME_MULTIPLE_FIELDS.
+
+ No new tests. This patch adds a test case into fast/forms/time-multiple-fields/time-multiple-fields-keyboard-events.html
+
+ * html/shadow/DateTimeFieldElement.cpp:
+ (WebCore::DateTimeFieldElement::defaultKeyboardEventHandler): Changed to check isRTL() for Left/Right keys then we call
+ appropriate focus motion function.
+ (WebCore::DateTimeFieldElement::isRTL): Added for checking text direction is right-to-left or not.
+ * html/shadow/DateTimeFieldElement.h:
+ (DateTimeFieldElement): Added declaration of isRTL().
+
2012-08-30 Yoshifumi Inoue <[email protected]>
[Forms] Blur from field should reset typeahead buffer in multiple fields time input UI
Modified: trunk/Source/WebCore/html/shadow/DateTimeFieldElement.cpp (127234 => 127235)
--- trunk/Source/WebCore/html/shadow/DateTimeFieldElement.cpp 2012-08-31 06:31:42 UTC (rev 127234)
+++ trunk/Source/WebCore/html/shadow/DateTimeFieldElement.cpp 2012-08-31 07:09:11 UTC (rev 127235)
@@ -84,7 +84,7 @@
if (keyIdentifier == "Left") {
if (!m_fieldOwner)
return;
- if (m_fieldOwner->focusOnPreviousField(*this))
+ if (isRTL() ? m_fieldOwner->focusOnNextField(*this) : m_fieldOwner->focusOnPreviousField(*this))
keyboardEvent->setDefaultHandled();
return;
}
@@ -92,7 +92,7 @@
if (keyIdentifier == "Right") {
if (!m_fieldOwner)
return;
- if (m_fieldOwner->focusOnNextField(*this))
+ if (isRTL() ? m_fieldOwner->focusOnPreviousField(*this) : m_fieldOwner->focusOnNextField(*this))
keyboardEvent->setDefaultHandled();
return;
}
@@ -145,6 +145,11 @@
return fastHasAttribute(readonlyAttr);
}
+bool DateTimeFieldElement::isRTL() const
+{
+ return renderer() && renderer()->style()->direction() == RTL;
+}
+
void DateTimeFieldElement::setReadOnly()
{
// Set HTML attribute readonly to change apperance.
Modified: trunk/Source/WebCore/html/shadow/DateTimeFieldElement.h (127234 => 127235)
--- trunk/Source/WebCore/html/shadow/DateTimeFieldElement.h 2012-08-31 06:31:42 UTC (rev 127234)
+++ trunk/Source/WebCore/html/shadow/DateTimeFieldElement.h 2012-08-31 07:09:11 UTC (rev 127235)
@@ -84,6 +84,7 @@
private:
void defaultKeyboardEventHandler(KeyboardEvent*);
virtual bool isFocusable() const OVERRIDE FINAL;
+ bool isRTL() const;
virtual bool supportsFocus() const OVERRIDE FINAL;
FieldOwner* m_fieldOwner;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes