Diff
Modified: trunk/LayoutTests/ChangeLog (141834 => 141835)
--- trunk/LayoutTests/ChangeLog 2013-02-05 01:13:18 UTC (rev 141834)
+++ trunk/LayoutTests/ChangeLog 2013-02-05 01:17:11 UTC (rev 141835)
@@ -1,3 +1,13 @@
+2013-02-04 Kent Tamura <[email protected]>
+
+ INPUT_MULTIPLE_FIELDS_UI: Focus order is not controllable by tabIndex attribute on <input>
+ https://bugs.webkit.org/show_bug.cgi?id=108447
+
+ Reviewed by Hajime Morita.
+
+ * fast/forms/time-multiple-fields/time-multiple-fields-tabindex-expected.txt: Added.
+ * fast/forms/time-multiple-fields/time-multiple-fields-tabindex.html: Added.
+
2013-02-04 Jessie Berlin <[email protected]>
REGRESSION (r129478-r129480): http/tests/loading/text-content-type-with-binary-extension.html failing on Apple MountainLion Debug WK2 (Tests)
Added: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-tabindex-expected.txt (0 => 141835)
--- trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-tabindex-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-tabindex-expected.txt 2013-02-05 01:17:11 UTC (rev 141835)
@@ -0,0 +1,18 @@
+Forword:
+PASS eventSender.keyDown(tab); document.activeElement.id is "tabindex20-1"
+PASS eventSender.keyDown(tab); document.activeElement.id is "time-with-tabindex20"
+PASS shadowRoot.activeElement.getAttribute("pseudo") is firstSubField
+PASS eventSender.keyDown(tab); eventSender.keyDown(tab); shadowRoot.activeElement.getAttribute("pseudo") is lastSubField
+PASS eventSender.keyDown(tab); document.activeElement.id is "tabindex20-3"
+PASS eventSender.keyDown(tab); document.activeElement.id is "tabindex30"
+
+Backword:
+PASS eventSender.keyDown(tab, shift); document.activeElement.id is "tabindex20-3"
+PASS eventSender.keyDown(tab, shift); document.activeElement.id is "time-with-tabindex20"
+PASS shadowRoot.activeElement.getAttribute("pseudo") is lastSubField
+PASS eventSender.keyDown(tab, shift); eventSender.keyDown(tab, shift); shadowRoot.activeElement.getAttribute("pseudo") is firstSubField
+PASS eventSender.keyDown(tab, shift); document.activeElement.id is "tabindex20-1"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-tabindex.html (0 => 141835)
--- trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-tabindex.html (rev 0)
+++ trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-tabindex.html 2013-02-05 01:17:11 UTC (rev 141835)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script src=""
+
+<input id="tabindex30" tabindex="30">
+<input id="tabindex20-1" tabindex="20">
+<input id="time-with-tabindex20" tabindex="20" type="time">
+<input id="tabindex20-3" tabindex="20">
+<input id="tabindex10" tabindex="10">
+
+<script>
+if (!window.eventSender || !window.internals)
+ debug('This requires DRT/WRT.');
+
+var firstSubField = "-webkit-datetime-edit-hour-field";
+var lastSubField = "-webkit-datetime-edit-ampm-field";
+var tab = '\t';
+var shift = ['shiftKey'];
+
+$('tabindex10').focus();
+var shadowRoot = internals.youngestShadowRoot($('time-with-tabindex20'));
+
+debug('Forword:');
+shouldBeEqualToString('eventSender.keyDown(tab); document.activeElement.id', 'tabindex20-1');
+shouldBeEqualToString('eventSender.keyDown(tab); document.activeElement.id', 'time-with-tabindex20');
+shouldBe('shadowRoot.activeElement.getAttribute("pseudo")', 'firstSubField');
+shouldBe('eventSender.keyDown(tab); eventSender.keyDown(tab); shadowRoot.activeElement.getAttribute("pseudo")', 'lastSubField');
+shouldBeEqualToString('eventSender.keyDown(tab); document.activeElement.id', 'tabindex20-3');
+shouldBeEqualToString('eventSender.keyDown(tab); document.activeElement.id', 'tabindex30');
+
+debug('');
+debug('Backword:');
+shouldBeEqualToString('eventSender.keyDown(tab, shift); document.activeElement.id', 'tabindex20-3');
+shouldBeEqualToString('eventSender.keyDown(tab, shift); document.activeElement.id', 'time-with-tabindex20');
+shouldBe('shadowRoot.activeElement.getAttribute("pseudo")', 'lastSubField');
+shouldBe('eventSender.keyDown(tab, shift); eventSender.keyDown(tab, shift); shadowRoot.activeElement.getAttribute("pseudo")', 'firstSubField');
+shouldBeEqualToString('eventSender.keyDown(tab, shift); document.activeElement.id', 'tabindex20-1');
+
+
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (141834 => 141835)
--- trunk/Source/WebCore/ChangeLog 2013-02-05 01:13:18 UTC (rev 141834)
+++ trunk/Source/WebCore/ChangeLog 2013-02-05 01:17:11 UTC (rev 141835)
@@ -1,3 +1,58 @@
+2013-02-04 Kent Tamura <[email protected]>
+
+ INPUT_MULTIPLE_FIELDS_UI: Focus order is not controllable by tabIndex attribute on <input>
+ https://bugs.webkit.org/show_bug.cgi?id=108447
+
+ Reviewed by Hajime Morita.
+
+ We make <input> elements with the multiple-fields UI focusable.
+ - However, we don't want to change the existing focus behavior for
+ multiple-fields <input>. We'd like to focus on the last sub-field of
+ an<input> with Shift + TAB focus navigation, and focus on the first
+ sub-field of the <input> otherwise. So, we move focus immediately
+ after the <input> gets focus.
+ - We don't need the isFocusableByClickOnLabel hack any more. <input>
+ elements with the multiple-fields UI are mouse-focusable.
+
+ Test: fast/forms/time-multiple-fields/time-multiple-fields-tabindex.html
+
+ * html/InputType.h:
+ (InputType): Add FocusDirection argument to handleFocusEvent, and remove
+ unnecessary isFocusableByClickOnLabel and focus.
+ * html/InputType.cpp:
+ (WebCore::InputType::handleFocusEvent): Ditto.
+ * html/PasswordInputType.cpp:
+ (WebCore::PasswordInputType::handleFocusEvent): Follow the argument change.
+ * html/PasswordInputType.h:
+ (PasswordInputType): Ditto.
+
+ * html/BaseMultipleFieldsDateAndTimeInputType.cpp:
+ (WebCore::BaseMultipleFieldsDateAndTimeInputType::handleFocusEvent):
+ If this element gets focus by FocusDirectionBackward (it means the focus
+ is moved from the first sub-field of the element,) move the focus
+ backward once more. Otherwise, we focus on the first sub-filed of the
+ element.
+ (WebCore::BaseMultipleFieldsDateAndTimeInputType::isKeyboardFocusable):
+ Make this keyboard-focusable. We have a wrong test to ensure read-only
+ input does NOT get focus. We'll address it later.
+ (WebCore::BaseMultipleFieldsDateAndTimeInputType::isMouseFocusable):
+ Make this mouse-focusable.
+ * html/BaseMultipleFieldsDateAndTimeInputType.h:
+ (BaseMultipleFieldsDateAndTimeInputType):
+
+ * html/HTMLInputElement.h:
+ (HTMLInputElement): Remove defaultFocus, focus, and isFocusableByClickOnLabel.
+ Add missing OVERRIDE to handleFocusEvent.
+ * html/HTMLInputElement.cpp: Remove unnecessary functions.
+ (WebCore::HTMLInputElement::handleFocusEvent):
+ Pass FocusDirection value to InputTYpe::handleFocusEvent.
+
+ * html/HTMLLabelElement.cpp:
+ (WebCore::HTMLLabelElement::defaultEventHandler):
+ Use isMouseFocusable().
+ * html/HTMLElement.cpp: Remove unnecessary isFocusableByClickOnLabel.
+ * html/HTMLElement.h: Ditto.
+
2013-02-04 Seulgi Kim <[email protected]>
Coordinated Graphics: crash in TiledBackingStore::adjustForContentsRect
Modified: trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp (141834 => 141835)
--- trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp 2013-02-05 01:13:18 UTC (rev 141834)
+++ trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp 2013-02-05 01:17:11 UTC (rev 141835)
@@ -36,6 +36,7 @@
#include "DateComponents.h"
#include "DateTimeFieldsState.h"
#include "ElementShadow.h"
+#include "FocusController.h"
#include "FormController.h"
#include "HTMLDataListElement.h"
#include "HTMLInputElement.h"
@@ -240,9 +241,14 @@
BaseDateAndTimeInputType::destroyShadowSubtree();
}
-void BaseMultipleFieldsDateAndTimeInputType::focus(bool, FocusDirection)
+void BaseMultipleFieldsDateAndTimeInputType::handleFocusEvent(FocusDirection direction)
{
- if (m_dateTimeEditElement)
+ if (!m_dateTimeEditElement)
+ return;
+ if (direction == FocusDirectionBackward) {
+ if (element()->document()->page())
+ element()->document()->page()->focusController()->advanceFocus(direction, 0);
+ } else
m_dateTimeEditElement->focusByOwner();
}
@@ -283,19 +289,15 @@
return element()->value().isEmpty() && m_dateTimeEditElement && m_dateTimeEditElement->anyEditableFieldsHaveValues();
}
-bool BaseMultipleFieldsDateAndTimeInputType::isFocusableByClickOnLabel() const
-{
- return element()->isTextFormControlFocusable();
-}
-
bool BaseMultipleFieldsDateAndTimeInputType::isKeyboardFocusable(KeyboardEvent*) const
{
- return false;
+ // FIXME: This should be focusable even if readOnly(). webkit.org/b/108795.
+ return element()->isTextFormControlFocusable() && !element()->readOnly();
}
bool BaseMultipleFieldsDateAndTimeInputType::isMouseFocusable() const
{
- return false;
+ return element()->isTextFormControlFocusable();
}
AtomicString BaseMultipleFieldsDateAndTimeInputType::localeIdentifier() const
Modified: trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h (141834 => 141835)
--- trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h 2013-02-05 01:13:18 UTC (rev 141834)
+++ trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h 2013-02-05 01:17:11 UTC (rev 141835)
@@ -81,12 +81,11 @@
virtual void createShadowSubtree() OVERRIDE FINAL;
virtual void destroyShadowSubtree() OVERRIDE FINAL;
virtual void disabledAttributeChanged() OVERRIDE FINAL;
- virtual void focus(bool restorePreviousSelection, FocusDirection) OVERRIDE FINAL;
virtual void forwardEvent(Event*) OVERRIDE FINAL;
+ virtual void handleFocusEvent(FocusDirection) OVERRIDE;
virtual void handleKeydownEvent(KeyboardEvent*) OVERRIDE FINAL;
virtual bool hasBadInput() const OVERRIDE;
virtual bool hasCustomFocusLogic() const OVERRIDE FINAL;
- virtual bool isFocusableByClickOnLabel() const OVERRIDE;
virtual bool isKeyboardFocusable(KeyboardEvent*) const OVERRIDE FINAL;
virtual bool isMouseFocusable() const OVERRIDE FINAL;
virtual void minOrMaxAttributeChanged() OVERRIDE FINAL;
Modified: trunk/Source/WebCore/html/HTMLElement.cpp (141834 => 141835)
--- trunk/Source/WebCore/html/HTMLElement.cpp 2013-02-05 01:13:18 UTC (rev 141834)
+++ trunk/Source/WebCore/html/HTMLElement.cpp 2013-02-05 01:17:11 UTC (rev 141835)
@@ -1163,11 +1163,6 @@
style->setProperty(propertyID, cssValuePool().createColorValue(parsedColor.rgb()));
}
-bool HTMLElement::isFocusableByClickOnLabel() const
-{
- return isMouseFocusable();
-}
-
} // namespace WebCore
#ifndef NDEBUG
Modified: trunk/Source/WebCore/html/HTMLElement.h (141834 => 141835)
--- trunk/Source/WebCore/html/HTMLElement.h 2013-02-05 01:13:18 UTC (rev 141834)
+++ trunk/Source/WebCore/html/HTMLElement.h 2013-02-05 01:17:11 UTC (rev 141835)
@@ -105,7 +105,6 @@
virtual bool isHTMLUnknownElement() const { return false; }
virtual bool isLabelable() const { return false; }
- virtual bool isFocusableByClickOnLabel() const;
protected:
HTMLElement(const QualifiedName& tagName, Document*, ConstructionType);
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (141834 => 141835)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2013-02-05 01:13:18 UTC (rev 141834)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2013-02-05 01:17:11 UTC (rev 141835)
@@ -370,16 +370,6 @@
HTMLTextFormControlElement::blur();
}
-void HTMLInputElement::defaultFocus(bool restorePreviousSelection, FocusDirection direction)
-{
- HTMLTextFormControlElement::focus(restorePreviousSelection, direction);
-}
-
-void HTMLInputElement::focus(bool restorePreviousSelection, FocusDirection direction)
-{
- m_inputType->focus(restorePreviousSelection, direction);
-}
-
bool HTMLInputElement::hasCustomFocusLogic() const
{
return m_inputType->hasCustomFocusLogic();
@@ -437,10 +427,9 @@
return m_inputType->shouldUseInputMethod();
}
-void HTMLInputElement::handleFocusEvent(FocusDirection)
+void HTMLInputElement::handleFocusEvent(FocusDirection direction)
{
- // FIXME: Pass the FocusDirection argument to InputType:handleFocusEvent.
- m_inputType->handleFocusEvent();
+ m_inputType->handleFocusEvent(direction);
}
void HTMLInputElement::handleBlurEvent()
@@ -1233,11 +1222,6 @@
return attribute.name() == srcAttr || attribute.name() == formactionAttr || HTMLTextFormControlElement::isURLAttribute(attribute);
}
-bool HTMLInputElement::isFocusableByClickOnLabel() const
-{
- return m_inputType->isFocusableByClickOnLabel();
-}
-
String HTMLInputElement::defaultValue() const
{
return fastGetAttribute(valueAttr);
Modified: trunk/Source/WebCore/html/HTMLInputElement.h (141834 => 141835)
--- trunk/Source/WebCore/html/HTMLInputElement.h 2013-02-05 01:13:18 UTC (rev 141834)
+++ trunk/Source/WebCore/html/HTMLInputElement.h 2013-02-05 01:17:11 UTC (rev 141835)
@@ -280,8 +280,6 @@
virtual void blur() OVERRIDE;
void defaultBlur();
- void defaultFocus(bool restorePreviousSelection, FocusDirection);
- virtual void focus(bool restorePreviousSelection = true, FocusDirection = FocusDirectionNone) OVERRIDE;
virtual const AtomicString& name() const OVERRIDE;
@@ -360,7 +358,6 @@
virtual void postDispatchEventHandler(Event*, void* dataFromPreDispatch);
virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
- virtual bool isFocusableByClickOnLabel() const OVERRIDE;
virtual bool isInRange() const;
virtual bool isOutOfRange() const;
@@ -380,7 +377,7 @@
virtual void updatePlaceholderText();
virtual bool isEmptyValue() const OVERRIDE { return innerTextValue().isEmpty(); }
virtual bool isEmptySuggestedValue() const { return suggestedValue().isEmpty(); }
- virtual void handleFocusEvent(FocusDirection);
+ virtual void handleFocusEvent(FocusDirection) OVERRIDE;
virtual void handleBlurEvent();
virtual bool isOptionalFormControl() const { return !isRequiredFormControl(); }
Modified: trunk/Source/WebCore/html/HTMLLabelElement.cpp (141834 => 141835)
--- trunk/Source/WebCore/html/HTMLLabelElement.cpp 2013-02-05 01:13:18 UTC (rev 141834)
+++ trunk/Source/WebCore/html/HTMLLabelElement.cpp 2013-02-05 01:17:11 UTC (rev 141835)
@@ -136,7 +136,7 @@
// Click the corresponding control.
element->dispatchSimulatedClick(evt);
- if (element->isFocusableByClickOnLabel())
+ if (element->isMouseFocusable())
element->focus();
processingClick = false;
Modified: trunk/Source/WebCore/html/InputType.cpp (141834 => 141835)
--- trunk/Source/WebCore/html/InputType.cpp 2013-02-05 01:13:18 UTC (rev 141834)
+++ trunk/Source/WebCore/html/InputType.cpp 2013-02-05 01:17:11 UTC (rev 141835)
@@ -470,11 +470,6 @@
element()->defaultBlur();
}
-void InputType::focus(bool restorePreviousSelection, FocusDirection direction)
-{
- element()->defaultFocus(restorePreviousSelection, direction);
-}
-
void InputType::createShadowSubtree()
{
}
@@ -547,11 +542,6 @@
return true;
}
-bool InputType::isFocusableByClickOnLabel() const
-{
- return isMouseFocusable();
-}
-
bool InputType::isKeyboardFocusable(KeyboardEvent* event) const
{
return element()->isTextFormControlKeyboardFocusable(event);
@@ -567,7 +557,7 @@
return false;
}
-void InputType::handleFocusEvent()
+void InputType::handleFocusEvent(FocusDirection)
{
}
Modified: trunk/Source/WebCore/html/InputType.h (141834 => 141835)
--- trunk/Source/WebCore/html/InputType.h 2013-02-05 01:13:18 UTC (rev 141834)
+++ trunk/Source/WebCore/html/InputType.h 2013-02-05 01:17:11 UTC (rev 141835)
@@ -201,11 +201,10 @@
virtual bool shouldSubmitImplicitly(Event*);
virtual PassRefPtr<HTMLFormElement> formForSubmission() const;
virtual bool hasCustomFocusLogic() const;
- virtual bool isFocusableByClickOnLabel() const;
virtual bool isKeyboardFocusable(KeyboardEvent*) const;
virtual bool isMouseFocusable() const;
virtual bool shouldUseInputMethod() const;
- virtual void handleFocusEvent();
+ virtual void handleFocusEvent(FocusDirection);
virtual void handleBlurEvent();
virtual void accessKeyAction(bool sendMouseEvents);
virtual bool canBeSuccessfulSubmitButton();
@@ -215,7 +214,6 @@
#endif
virtual void blur();
- virtual void focus(bool restorePreviousSelection, FocusDirection);
// Shadow tree handling
Modified: trunk/Source/WebCore/html/PasswordInputType.cpp (141834 => 141835)
--- trunk/Source/WebCore/html/PasswordInputType.cpp 2013-02-05 01:13:18 UTC (rev 141834)
+++ trunk/Source/WebCore/html/PasswordInputType.cpp 2013-02-05 01:17:11 UTC (rev 141835)
@@ -95,9 +95,9 @@
return true;
}
-void PasswordInputType::handleFocusEvent()
+void PasswordInputType::handleFocusEvent(FocusDirection direction)
{
- BaseTextInputType::handleFocusEvent();
+ BaseTextInputType::handleFocusEvent(direction);
if (element()->document()->frame())
element()->document()->setUseSecureKeyboardEntryWhenActive(true);
}
Modified: trunk/Source/WebCore/html/PasswordInputType.h (141834 => 141835)
--- trunk/Source/WebCore/html/PasswordInputType.h 2013-02-05 01:13:18 UTC (rev 141834)
+++ trunk/Source/WebCore/html/PasswordInputType.h 2013-02-05 01:17:11 UTC (rev 141835)
@@ -50,7 +50,7 @@
virtual bool shouldRespectListAttribute() OVERRIDE;
virtual bool shouldRespectSpeechAttribute() OVERRIDE;
virtual bool isPasswordField() const OVERRIDE;
- virtual void handleFocusEvent() OVERRIDE;
+ virtual void handleFocusEvent(FocusDirection) OVERRIDE;
virtual void handleBlurEvent() OVERRIDE;
};