Title: [126966] trunk/Source/WebCore
Revision
126966
Author
yo...@chromium.org
Date
2012-08-29 00:12:50 -0700 (Wed, 29 Aug 2012)

Log Message

[Forms] Make HTMLInputElement::blur()/focus() override-able by input type
https://bugs.webkit.org/show_bug.cgi?id=95279

Reviewed by Hajime Morrita.

This patch allows HTMLInputElement::focus() and blur() functions to be
override-able.

This patch is part of Shift+Tab focus navigation change for multiple
field time input UI, bug 95168.

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

* dom/Element.h:
(WebCore::Element): Changed blur() to virtual function.
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::blur): Added to call InputType::blur().
(WebCore::HTMLInputElement::defaultBlur): Added for default implementation of blur().
(WebCore::HTMLInputElement::defaultFocus): Added for default implementation of focus().
(WebCore::HTMLInputElement::focus): Added to call InputType::focus()
* html/HTMLInputElement.h:
(HTMLInputElement): Added declarations of blur(), defaultBlur(), defaultFocus() and focus().
* html/InputType.cpp:
(WebCore::InputType::blur): Added to call HTMLInputElement::defaultBlur() as default implementation.
(WebCore::InputType::focus):  Added to call HTMLInputElement::defaultFocus() as default implementation.
* html/InputType.h:
(InputType): Added declarations of blur(), and focus().

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126965 => 126966)


--- trunk/Source/WebCore/ChangeLog	2012-08-29 07:03:01 UTC (rev 126965)
+++ trunk/Source/WebCore/ChangeLog	2012-08-29 07:12:50 UTC (rev 126966)
@@ -1,3 +1,33 @@
+2012-08-29  Yoshifumi Inoue  <yo...@chromium.org>
+
+        [Forms] Make HTMLInputElement::blur()/focus() override-able by input type
+        https://bugs.webkit.org/show_bug.cgi?id=95279
+
+        Reviewed by Hajime Morrita.
+
+        This patch allows HTMLInputElement::focus() and blur() functions to be
+        override-able.
+
+        This patch is part of Shift+Tab focus navigation change for multiple
+        field time input UI, bug 95168.
+
+        No new tests. This patch doesn't change behavior.
+
+        * dom/Element.h:
+        (WebCore::Element): Changed blur() to virtual function.
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::blur): Added to call InputType::blur().
+        (WebCore::HTMLInputElement::defaultBlur): Added for default implementation of blur().
+        (WebCore::HTMLInputElement::defaultFocus): Added for default implementation of focus().
+        (WebCore::HTMLInputElement::focus): Added to call InputType::focus()
+        * html/HTMLInputElement.h:
+        (HTMLInputElement): Added declarations of blur(), defaultBlur(), defaultFocus() and focus().
+        * html/InputType.cpp:
+        (WebCore::InputType::blur): Added to call HTMLInputElement::defaultBlur() as default implementation.
+        (WebCore::InputType::focus):  Added to call HTMLInputElement::defaultFocus() as default implementation.
+        * html/InputType.h:
+        (InputType): Added declarations of blur(), and focus().
+
 2012-08-29  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r126963.

Modified: trunk/Source/WebCore/dom/Element.h (126965 => 126966)


--- trunk/Source/WebCore/dom/Element.h	2012-08-29 07:03:01 UTC (rev 126965)
+++ trunk/Source/WebCore/dom/Element.h	2012-08-29 07:12:50 UTC (rev 126966)
@@ -303,7 +303,7 @@
 
     virtual void focus(bool restorePreviousSelection = true);
     virtual void updateFocusAppearance(bool restorePreviousSelection);
-    void blur();
+    virtual void blur();
 
     String innerText();
     String outerText();

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (126965 => 126966)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2012-08-29 07:03:01 UTC (rev 126965)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2012-08-29 07:12:50 UTC (rev 126966)
@@ -338,7 +338,26 @@
     m_inputType->stepUp(-n, ec);
 }
 
+void HTMLInputElement::blur()
+{
+    m_inputType->blur();
+}
 
+void HTMLInputElement::defaultBlur()
+{
+    HTMLTextFormControlElement::blur();
+}
+
+void HTMLInputElement::defaultFocus(bool restorePreviousSelection)
+{
+    HTMLTextFormControlElement::focus(restorePreviousSelection);
+}
+
+void HTMLInputElement::focus(bool restorePreviousSelection)
+{
+    m_inputType->focus(restorePreviousSelection);
+}
+
 bool HTMLInputElement::hasCustomFocusLogic() const
 {
     return m_inputType->hasCustomFocusLogic();

Modified: trunk/Source/WebCore/html/HTMLInputElement.h (126965 => 126966)


--- trunk/Source/WebCore/html/HTMLInputElement.h	2012-08-29 07:03:01 UTC (rev 126965)
+++ trunk/Source/WebCore/html/HTMLInputElement.h	2012-08-29 07:12:50 UTC (rev 126966)
@@ -276,6 +276,11 @@
     void setHeight(unsigned);
     void setWidth(unsigned);
 
+    virtual void blur() OVERRIDE;
+    void defaultBlur();
+    void defaultFocus(bool restorePreviousSelection);
+    virtual void focus(bool restorePreviousSelection = true) OVERRIDE;
+
     virtual const AtomicString& name() const OVERRIDE;
 
     static Vector<FileChooserFileInfo> filesFromFileInputFormControlState(const FormControlState&);

Modified: trunk/Source/WebCore/html/InputType.cpp (126965 => 126966)


--- trunk/Source/WebCore/html/InputType.cpp	2012-08-29 07:03:01 UTC (rev 126965)
+++ trunk/Source/WebCore/html/InputType.cpp	2012-08-29 07:12:50 UTC (rev 126966)
@@ -448,6 +448,16 @@
     return RenderObject::createObject(element(), style);
 }
 
+void InputType::blur()
+{
+    element()->defaultBlur();
+}
+
+void InputType::focus(bool restorePreviousSelection)
+{
+    element()->defaultFocus(restorePreviousSelection);
+}
+
 void InputType::createShadowSubtree()
 {
 }

Modified: trunk/Source/WebCore/html/InputType.h (126965 => 126966)


--- trunk/Source/WebCore/html/InputType.h	2012-08-29 07:03:01 UTC (rev 126965)
+++ trunk/Source/WebCore/html/InputType.h	2012-08-29 07:12:50 UTC (rev 126966)
@@ -213,6 +213,9 @@
     virtual bool hasTouchEventHandler() const;
 #endif
 
+    virtual void blur();
+    virtual void focus(bool restorePreviousSelection);
+
     // Shadow tree handling
 
     virtual void createShadowSubtree();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to