Title: [146638] trunk/Source/WebCore
Revision
146638
Author
[email protected]
Date
2013-03-22 12:01:22 -0700 (Fri, 22 Mar 2013)

Log Message

Implement isEnabledFormControl() for SliderThumbElement and SpinButtonElement in terms of disabled()
https://bugs.webkit.org/show_bug.cgi?id=112993

Reviewed by Kent Tamura.

This is an intermediate step for refactoring Node::disabled and
Element::isEnabledFormControl. All classes that override
isEnabledFormControl just return !disabled(), except for
SliderThumbElement and SpinButtonElement. This patch changes those two
classes to do so, which shows that the two functions are redundant and
easy to refactor into a single function in a subsequent patch.

No new tests, there should be no behavior change.

* html/shadow/SliderThumbElement.cpp:
(WebCore::SliderThumbElement::disabled):
(WebCore):
(WebCore::SliderThumbElement::isEnabledFormControl):
* html/shadow/SliderThumbElement.h:
(SliderThumbElement):
* html/shadow/SpinButtonElement.h: The check of shadowHost() is
necessary because it can be detached by _javascript_ that runs during
event handling (see r76566)

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (146637 => 146638)


--- trunk/Source/WebCore/ChangeLog	2013-03-22 18:47:36 UTC (rev 146637)
+++ trunk/Source/WebCore/ChangeLog	2013-03-22 19:01:22 UTC (rev 146638)
@@ -1,3 +1,29 @@
+2013-03-22  Matt Falkenhagen  <[email protected]>
+
+        Implement isEnabledFormControl() for SliderThumbElement and SpinButtonElement in terms of disabled()
+        https://bugs.webkit.org/show_bug.cgi?id=112993
+
+        Reviewed by Kent Tamura.
+
+        This is an intermediate step for refactoring Node::disabled and
+        Element::isEnabledFormControl. All classes that override
+        isEnabledFormControl just return !disabled(), except for
+        SliderThumbElement and SpinButtonElement. This patch changes those two
+        classes to do so, which shows that the two functions are redundant and
+        easy to refactor into a single function in a subsequent patch.
+
+        No new tests, there should be no behavior change.
+
+        * html/shadow/SliderThumbElement.cpp:
+        (WebCore::SliderThumbElement::disabled):
+        (WebCore):
+        (WebCore::SliderThumbElement::isEnabledFormControl):
+        * html/shadow/SliderThumbElement.h:
+        (SliderThumbElement):
+        * html/shadow/SpinButtonElement.h: The check of shadowHost() is
+        necessary because it can be detached by _javascript_ that runs during
+        event handling (see r76566)
+
 2013-03-22  Allan Sandfeld Jensen  <[email protected]>
 
         [Qt] New fast/text/word-space-with-kerning-3.html fails on Qt.

Modified: trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp (146637 => 146638)


--- trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp	2013-03-22 18:47:36 UTC (rev 146637)
+++ trunk/Source/WebCore/html/shadow/SliderThumbElement.cpp	2013-03-22 19:01:22 UTC (rev 146638)
@@ -221,9 +221,14 @@
     return new (arena) RenderSliderThumb(this);
 }
 
+bool SliderThumbElement::disabled() const
+{
+    return hostInput()->disabled();
+}
+
 bool SliderThumbElement::isEnabledFormControl() const
 {
-    return hostInput()->isEnabledFormControl();
+    return !disabled();
 }
 
 bool SliderThumbElement::matchesReadOnlyPseudoClass() const

Modified: trunk/Source/WebCore/html/shadow/SliderThumbElement.h (146637 => 146638)


--- trunk/Source/WebCore/html/shadow/SliderThumbElement.h	2013-03-22 18:47:36 UTC (rev 146637)
+++ trunk/Source/WebCore/html/shadow/SliderThumbElement.h	2013-03-22 19:01:22 UTC (rev 146638)
@@ -65,7 +65,8 @@
     SliderThumbElement(Document*);
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
     virtual PassRefPtr<Element> cloneElementWithoutAttributesAndChildren();
-    virtual bool isEnabledFormControl() const;
+    virtual bool disabled() const OVERRIDE;
+    virtual bool isEnabledFormControl() const OVERRIDE;
     virtual bool matchesReadOnlyPseudoClass() const OVERRIDE;
     virtual bool matchesReadWritePseudoClass() const OVERRIDE;
     virtual Node* focusDelegate();

Modified: trunk/Source/WebCore/html/shadow/SpinButtonElement.h (146637 => 146638)


--- trunk/Source/WebCore/html/shadow/SpinButtonElement.h	2013-03-22 18:47:36 UTC (rev 146637)
+++ trunk/Source/WebCore/html/shadow/SpinButtonElement.h	2013-03-22 19:01:22 UTC (rev 146638)
@@ -72,7 +72,8 @@
     virtual const AtomicString& shadowPseudoId() const;
     virtual void detach();
     virtual bool isSpinButtonElement() const { return true; }
-    virtual bool isEnabledFormControl() const { return shadowHost()->isEnabledFormControl(); }
+    virtual bool disabled() const OVERRIDE { return shadowHost() && shadowHost()->disabled(); }
+    virtual bool isEnabledFormControl() const OVERRIDE { return !disabled(); }
     virtual bool matchesReadOnlyPseudoClass() const OVERRIDE;
     virtual bool matchesReadWritePseudoClass() const OVERRIDE;
     virtual void defaultEventHandler(Event*);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to