Title: [120695] trunk/Source/WebCore
Revision
120695
Author
[email protected]
Date
2012-06-19 01:57:14 -0700 (Tue, 19 Jun 2012)

Log Message

[Forms] Move isKeyboardFocusable and isMouseFocusable to InputType from HTMLInputElement
https://bugs.webkit.org/show_bug.cgi?id=89425

Reviewed by Kent Tamura.

This patch moves implementation of HTMLInpueElement::isKeyboardFocusable
and isMouseFocusable to InputType class to allow each implementation
of InputType can decide focus-ability.

No new tests. This patch doesn't change behavior.

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::isKeyboardFocusable): Changed to call InputType::isKeyboardFocusable.
(WebCore::HTMLInputElement::isMouseFocusable): Changed to call InputType::isMouseFocusable.
(WebCore::HTMLInputElement::isTextFormControlFocusable): Added to allow InputType can call a method in HTMLTextFormControlElement.
(WebCore::HTMLInputElement::isTextFormControlKeyboardFocusable): Added to allow InputType can call a method in HTMLTextFormControlElement.
(WebCore::HTMLInputElement::isTextFormControlMouseFocusable): Added to allow InputType can call a method in HTMLTextFormControlElement.
* html/HTMLInputElement.h:
(HTMLInputElement):
* html/InputType.cpp:
(WebCore::InputType::isKeyboardFocusable): Changed to call isTextFormControlKeyboardFocusable.
(WebCore::InputType::isMouseFocusable): Added for default method of derived InputType classes.
* html/InputType.h:
(InputType): Chagned signature of isKeyboardFocusable.
* html/RadioInputType.cpp:
(WebCore::RadioInputType::isKeyboardFocusable): Changed to call isTextFormControlKeyboardFocusable which was done in HTMLInputElement.
* html/RadioInputType.h:
(RadioInputType):
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::isKeyboardFocusable): Moved implementation from HTMLInputElement.
(WebCore::TextFieldInputType::isMouseFocusable): Moved implementation from HTMLInputElement.
* html/TextFieldInputType.h:
(TextFieldInputType):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (120694 => 120695)


--- trunk/Source/WebCore/ChangeLog	2012-06-19 08:55:09 UTC (rev 120694)
+++ trunk/Source/WebCore/ChangeLog	2012-06-19 08:57:14 UTC (rev 120695)
@@ -1,3 +1,39 @@
+2012-06-19  Yoshifumi Inoue  <[email protected]>
+
+        [Forms] Move isKeyboardFocusable and isMouseFocusable to InputType from HTMLInputElement
+        https://bugs.webkit.org/show_bug.cgi?id=89425
+
+        Reviewed by Kent Tamura.
+
+        This patch moves implementation of HTMLInpueElement::isKeyboardFocusable
+        and isMouseFocusable to InputType class to allow each implementation
+        of InputType can decide focus-ability.
+
+        No new tests. This patch doesn't change behavior.
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::isKeyboardFocusable): Changed to call InputType::isKeyboardFocusable.
+        (WebCore::HTMLInputElement::isMouseFocusable): Changed to call InputType::isMouseFocusable.
+        (WebCore::HTMLInputElement::isTextFormControlFocusable): Added to allow InputType can call a method in HTMLTextFormControlElement.
+        (WebCore::HTMLInputElement::isTextFormControlKeyboardFocusable): Added to allow InputType can call a method in HTMLTextFormControlElement.
+        (WebCore::HTMLInputElement::isTextFormControlMouseFocusable): Added to allow InputType can call a method in HTMLTextFormControlElement.
+        * html/HTMLInputElement.h:
+        (HTMLInputElement):
+        * html/InputType.cpp:
+        (WebCore::InputType::isKeyboardFocusable): Changed to call isTextFormControlKeyboardFocusable.
+        (WebCore::InputType::isMouseFocusable): Added for default method of derived InputType classes.
+        * html/InputType.h:
+        (InputType): Chagned signature of isKeyboardFocusable.
+        * html/RadioInputType.cpp:
+        (WebCore::RadioInputType::isKeyboardFocusable): Changed to call isTextFormControlKeyboardFocusable which was done in HTMLInputElement.
+        * html/RadioInputType.h:
+        (RadioInputType):
+        * html/TextFieldInputType.cpp:
+        (WebCore::TextFieldInputType::isKeyboardFocusable): Moved implementation from HTMLInputElement.
+        (WebCore::TextFieldInputType::isMouseFocusable): Moved implementation from HTMLInputElement.
+        * html/TextFieldInputType.h:
+        (TextFieldInputType):
+
 2012-06-19  Sergio Villar Senin  <[email protected]>
 
         Calling nativeImageForCurrentFrame() causes assertion failure: m_verifier.isSafeToUse()

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (120694 => 120695)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2012-06-19 08:55:09 UTC (rev 120694)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2012-06-19 08:57:14 UTC (rev 120695)
@@ -296,15 +296,26 @@
 
 bool HTMLInputElement::isKeyboardFocusable(KeyboardEvent* event) const
 {
-    if (isTextField())
-        return HTMLTextFormControlElement::isFocusable();
-    return HTMLTextFormControlElement::isKeyboardFocusable(event) && m_inputType->isKeyboardFocusable();
+    return m_inputType->isKeyboardFocusable(event);
 }
 
 bool HTMLInputElement::isMouseFocusable() const
 {
-    if (isTextField())
-        return HTMLTextFormControlElement::isFocusable();
+    return m_inputType->isMouseFocusable();
+}
+
+bool HTMLInputElement::isTextFormControlFocusable() const
+{
+    return HTMLTextFormControlElement::isFocusable();
+}
+
+bool HTMLInputElement::isTextFormControlKeyboardFocusable(KeyboardEvent* event) const
+{
+    return HTMLTextFormControlElement::isKeyboardFocusable(event);
+}
+
+bool HTMLInputElement::isTextFormControlMouseFocusable() const
+{
     return HTMLTextFormControlElement::isMouseFocusable();
 }
 

Modified: trunk/Source/WebCore/html/HTMLInputElement.h (120694 => 120695)


--- trunk/Source/WebCore/html/HTMLInputElement.h	2012-06-19 08:55:09 UTC (rev 120694)
+++ trunk/Source/WebCore/html/HTMLInputElement.h	2012-06-19 08:57:14 UTC (rev 120695)
@@ -241,6 +241,10 @@
 
     void setValueInternal(const String&, TextFieldEventBehavior);
 
+    bool isTextFormControlFocusable() const;
+    bool isTextFormControlKeyboardFocusable(KeyboardEvent*) const;
+    bool isTextFormControlMouseFocusable() const;
+
     void cacheSelectionInResponseToSetValue(int caretOffset) { cacheSelection(caretOffset, caretOffset, SelectionHasNoDirection); }
 
 #if ENABLE(INPUT_TYPE_COLOR)

Modified: trunk/Source/WebCore/html/InputType.cpp (120694 => 120695)


--- trunk/Source/WebCore/html/InputType.cpp	2012-06-19 08:55:09 UTC (rev 120694)
+++ trunk/Source/WebCore/html/InputType.cpp	2012-06-19 08:57:14 UTC (rev 120695)
@@ -500,11 +500,16 @@
     return true;
 }
 
-bool InputType::isKeyboardFocusable() const
+bool InputType::isKeyboardFocusable(KeyboardEvent* event) const
 {
-    return true;
+    return element()->isTextFormControlKeyboardFocusable(event);
 }
 
+bool InputType::isMouseFocusable() const
+{
+    return element()->isTextFormControlMouseFocusable();
+}
+
 bool InputType::shouldUseInputMethod() const
 {
     return false;

Modified: trunk/Source/WebCore/html/InputType.h (120694 => 120695)


--- trunk/Source/WebCore/html/InputType.h	2012-06-19 08:55:09 UTC (rev 120694)
+++ trunk/Source/WebCore/html/InputType.h	2012-06-19 08:57:14 UTC (rev 120695)
@@ -194,7 +194,8 @@
     // Helpers for event handlers.
     virtual bool shouldSubmitImplicitly(Event*);
     virtual PassRefPtr<HTMLFormElement> formForSubmission() const;
-    virtual bool isKeyboardFocusable() const;
+    virtual bool isKeyboardFocusable(KeyboardEvent*) const;
+    virtual bool isMouseFocusable() const;
     virtual bool shouldUseInputMethod() const;
     virtual void handleFocusEvent();
     virtual void handleBlurEvent();

Modified: trunk/Source/WebCore/html/RadioInputType.cpp (120694 => 120695)


--- trunk/Source/WebCore/html/RadioInputType.cpp	2012-06-19 08:55:09 UTC (rev 120694)
+++ trunk/Source/WebCore/html/RadioInputType.cpp	2012-06-19 08:57:14 UTC (rev 120695)
@@ -114,8 +114,11 @@
     dispatchSimulatedClickIfActive(event);
 }
 
-bool RadioInputType::isKeyboardFocusable() const
+bool RadioInputType::isKeyboardFocusable(KeyboardEvent* event) const
 {
+    if (!InputType::isKeyboardFocusable(event))
+        return false;
+
     // When using Spatial Navigation, every radio button should be focusable.
     if (isSpatialNavigationEnabled(element()->document()->frame()))
         return true;

Modified: trunk/Source/WebCore/html/RadioInputType.h (120694 => 120695)


--- trunk/Source/WebCore/html/RadioInputType.h	2012-06-19 08:55:09 UTC (rev 120694)
+++ trunk/Source/WebCore/html/RadioInputType.h	2012-06-19 08:57:14 UTC (rev 120695)
@@ -47,7 +47,7 @@
     virtual void handleClickEvent(MouseEvent*) OVERRIDE;
     virtual void handleKeydownEvent(KeyboardEvent*) OVERRIDE;
     virtual void handleKeyupEvent(KeyboardEvent*) OVERRIDE;
-    virtual bool isKeyboardFocusable() const OVERRIDE;
+    virtual bool isKeyboardFocusable(KeyboardEvent*) const OVERRIDE;
     virtual bool shouldSendChangeEventAfterCheckedChanged() OVERRIDE;
     virtual PassOwnPtr<ClickHandlingState> willDispatchClick() OVERRIDE;
     virtual void didDispatchClick(Event*, const ClickHandlingState&) OVERRIDE;

Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (120694 => 120695)


--- trunk/Source/WebCore/html/TextFieldInputType.cpp	2012-06-19 08:55:09 UTC (rev 120694)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp	2012-06-19 08:57:14 UTC (rev 120695)
@@ -65,6 +65,16 @@
 {
 }
 
+bool TextFieldInputType::isKeyboardFocusable(KeyboardEvent*) const
+{
+    return element()->isTextFormControlFocusable();
+}
+
+bool TextFieldInputType::isMouseFocusable() const
+{
+    return element()->isTextFormControlFocusable();
+}
+
 bool TextFieldInputType::isTextField() const
 {
     return true;

Modified: trunk/Source/WebCore/html/TextFieldInputType.h (120694 => 120695)


--- trunk/Source/WebCore/html/TextFieldInputType.h	2012-06-19 08:55:09 UTC (rev 120694)
+++ trunk/Source/WebCore/html/TextFieldInputType.h	2012-06-19 08:57:14 UTC (rev 120695)
@@ -67,6 +67,8 @@
     virtual void handleBlurEvent() OVERRIDE;
 
 private:
+    virtual bool isKeyboardFocusable(KeyboardEvent*) const OVERRIDE;
+    virtual bool isMouseFocusable() const OVERRIDE;
     virtual bool isTextField() const OVERRIDE;
     virtual bool valueMissing(const String&) const OVERRIDE;
     virtual void handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*) OVERRIDE;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to