Refactoring: Replace Element::disabled and isEnabledFormControl with isDisabledFormCo...
authorfalken@chromium.org <falken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Mar 2013 18:38:38 +0000 (18:38 +0000)
committerfalken@chromium.org <falken@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Mar 2013 18:38:38 +0000 (18:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=113273

Reviewed by Kent Tamura.

Element::disabled is about form controls and Element::isEnabledFormControl
is redundant with it, so replace them with a single function
Element::isDisabledFormControl.

Source/WebCore:

No new tests, there should be no behavior change.

* accessibility/AccessibilityListBox.cpp:
(WebCore::AccessibilityListBox::canSetSelectedChildrenAttribute):
* accessibility/AccessibilityListBoxOption.cpp:
(WebCore::AccessibilityListBoxOption::canSetSelectedAttribute):
* accessibility/AccessibilityMenuList.cpp:
(WebCore::AccessibilityMenuList::canSetFocusAttribute):
* accessibility/AccessibilityMenuListOption.cpp:
(WebCore::AccessibilityMenuListOption::isEnabled):
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::isEnabled):
(WebCore::AccessibilityNodeObject::actionElement):
(WebCore::AccessibilityNodeObject::canSetFocusAttribute):
* css/SelectorChecker.cpp:
(WebCore::SelectorChecker::checkOne):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::canShareStyleWithControl):
* dom/Element.cpp:
(WebCore::Element::isDisabledFormControl):
* dom/Element.h:
(Element):
(WebCore::isDisabledFormControl): Add helper function for convenience.
(WebCore):
* dom/EventDispatcher.cpp:
(WebCore::EventDispatcher::dispatchSimulatedClick):
* dom/GestureEvent.cpp:
(WebCore::GestureEventDispatchMediator::dispatchEvent):
* dom/MouseEvent.cpp:
(WebCore::MouseEventDispatchMediator::dispatchEvent):
* dom/Node.cpp:
(WebCore::Node::handleLocalEvents):
(WebCore::Node::willRespondToMouseMoveEvents):
(WebCore::Node::willRespondToMouseClickEvents):
(WebCore::Node::willRespondToTouchEvents):
* html/BaseMultipleFieldsDateAndTimeInputType.cpp:
(WebCore::BaseMultipleFieldsDateAndTimeInputType::isEditControlOwnerDisabled):
* html/DOMFormData.cpp:
(WebCore::DOMFormData::DOMFormData):
* html/FileInputType.cpp:
(WebCore::FileInputType::handleDOMActivateEvent):
(WebCore::FileInputType::disabledAttributeChanged):
* html/HTMLButtonElement.cpp:
(WebCore::HTMLButtonElement::defaultEventHandler):
(WebCore::HTMLButtonElement::willRespondToMouseClickEvents):
(WebCore::HTMLButtonElement::isSuccessfulSubmitButton):
* html/HTMLCollection.cpp:
(WebCore::isMatchingElement):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::updateAncestorDisabledState):
(WebCore::HTMLFormControlElement::isDisabledFormControl):
(WebCore::HTMLFormControlElement::supportsFocus):
* html/HTMLFormControlElement.h:
(HTMLFormControlElement):
(WebCore::HTMLFormControlElement::isDisabledOrReadOnly):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::isSuccessfulSubmitButton):
(WebCore::HTMLInputElement::willRespondToMouseClickEvents):
* html/HTMLOptGroupElement.cpp:
(WebCore::HTMLOptGroupElement::isDisabledFormControl):
* html/HTMLOptGroupElement.h:
(HTMLOptGroupElement):
* html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::isDisabledFormControl):
* html/HTMLOptionElement.h:
(HTMLOptionElement):
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::willRespondToMouseClickEvents):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::nextValidIndex):
(WebCore::HTMLSelectElement::updateListBoxSelection):
(WebCore::HTMLSelectElement::recalcListItems):
(WebCore::HTMLSelectElement::appendFormData):
(WebCore::HTMLSelectElement::updateSelectedState):
(WebCore::HTMLSelectElement::listBoxDefaultEventHandler):
(WebCore::HTMLSelectElement::defaultEventHandler):
(WebCore::HTMLSelectElement::optionAtIndex):
* html/ImageInputType.cpp:
(WebCore::ImageInputType::handleDOMActivateEvent):
* html/ResetInputType.cpp:
(WebCore::ResetInputType::handleDOMActivateEvent):
* html/SubmitInputType.cpp:
(WebCore::SubmitInputType::handleDOMActivateEvent):
* html/shadow/SliderThumbElement.cpp:
(WebCore::SliderThumbElement::isDisabledFormControl):
(WebCore::SliderThumbElement::defaultEventHandler):
(WebCore::SliderThumbElement::willRespondToMouseMoveEvents):
(WebCore::SliderThumbElement::willRespondToMouseClickEvents):
* html/shadow/SliderThumbElement.h:
(SliderThumbElement):
* html/shadow/SpinButtonElement.h:
* html/shadow/TextFieldDecorationElement.cpp:
(WebCore::TextFieldDecorationElement::updateImage):
* loader/FormSubmission.cpp:
(WebCore::FormSubmission::create):
* page/DragController.cpp:
(WebCore::DragController::tryDocumentDrag):
(WebCore::DragController::concludeEditDrag):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::addFocusRingRects):
(WebCore::RenderListBox::paintItemForeground):
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::itemIsEnabled):
* rendering/RenderTextControl.cpp:
(WebCore::updateUserModifyProperty):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::isEnabled):
* rendering/RenderThemeMac.mm:
(WebCore::getMediaUIPartStateFlags):
* rendering/RenderThemeMacShared.mm:
(WebCore::RenderThemeMacShared::adjustMenuListStyle):
(WebCore::RenderThemeMacShared::paintSearchFieldCancelButton):
* rendering/RenderThemeSafari.cpp:
(WebCore::RenderThemeSafari::adjustMenuListStyle):

Source/WebKit/blackberry:

* WebCoreSupport/CredentialTransformData.cpp:
(WebCore::CredentialTransformData::findPasswordFormFields):
* WebKitSupport/DOMSupport.cpp:
(BlackBerry::WebKit::DOMSupport::isTextBasedContentEditableElement):
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::openSelectPopup):

Source/WebKit/chromium:

* src/WebFormControlElement.cpp:
(WebKit::WebFormControlElement::isEnabled):
* src/WebOptionElement.cpp:
(WebKit::WebOptionElement::isEnabled):
* src/WebPasswordFormUtils.cpp:
(WebKit::findPasswordFormFields):
* src/WebSearchableFormData.cpp:
(HTMLNames::findSuitableSearchInputElement):
(HTMLNames::buildSearchString):

Source/WebKit/win:

* DOMHTMLClasses.cpp:
(DOMHTMLInputElement::disabled):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@147135 268f45cc-cd09-0410-ab3c-d52691b4dbfc

55 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityListBox.cpp
Source/WebCore/accessibility/AccessibilityListBoxOption.cpp
Source/WebCore/accessibility/AccessibilityMenuList.cpp
Source/WebCore/accessibility/AccessibilityMenuListOption.cpp
Source/WebCore/accessibility/AccessibilityNodeObject.cpp
Source/WebCore/css/SelectorChecker.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/EventDispatcher.cpp
Source/WebCore/dom/GestureEvent.cpp
Source/WebCore/dom/MouseEvent.cpp
Source/WebCore/dom/Node.cpp
Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp
Source/WebCore/html/DOMFormData.cpp
Source/WebCore/html/FileInputType.cpp
Source/WebCore/html/HTMLButtonElement.cpp
Source/WebCore/html/HTMLCollection.cpp
Source/WebCore/html/HTMLFormControlElement.cpp
Source/WebCore/html/HTMLFormControlElement.h
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLOptGroupElement.cpp
Source/WebCore/html/HTMLOptGroupElement.h
Source/WebCore/html/HTMLOptionElement.cpp
Source/WebCore/html/HTMLOptionElement.h
Source/WebCore/html/HTMLPlugInElement.cpp
Source/WebCore/html/HTMLSelectElement.cpp
Source/WebCore/html/ImageInputType.cpp
Source/WebCore/html/ResetInputType.cpp
Source/WebCore/html/SubmitInputType.cpp
Source/WebCore/html/shadow/SliderThumbElement.cpp
Source/WebCore/html/shadow/SliderThumbElement.h
Source/WebCore/html/shadow/SpinButtonElement.h
Source/WebCore/html/shadow/TextFieldDecorationElement.cpp
Source/WebCore/loader/FormSubmission.cpp
Source/WebCore/page/DragController.cpp
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderTextControl.cpp
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderThemeMac.mm
Source/WebCore/rendering/RenderThemeMacShared.mm
Source/WebCore/rendering/RenderThemeSafari.cpp
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/CredentialTransformData.cpp
Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp
Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/WebFormControlElement.cpp
Source/WebKit/chromium/src/WebOptionElement.cpp
Source/WebKit/chromium/src/WebPasswordFormUtils.cpp
Source/WebKit/chromium/src/WebSearchableFormData.cpp
Source/WebKit/win/ChangeLog
Source/WebKit/win/DOMHTMLClasses.cpp

index 49bcc12..7443cad 100644 (file)
@@ -1,3 +1,129 @@
+2013-03-28  Matt Falkenhagen  <falken@chromium.org>
+
+        Refactoring: Replace Element::disabled and isEnabledFormControl with isDisabledFormControl
+        https://bugs.webkit.org/show_bug.cgi?id=113273
+
+        Reviewed by Kent Tamura.
+
+        Element::disabled is about form controls and Element::isEnabledFormControl
+        is redundant with it, so replace them with a single function
+        Element::isDisabledFormControl.
+
+        No new tests, there should be no behavior change.
+
+        * accessibility/AccessibilityListBox.cpp:
+        (WebCore::AccessibilityListBox::canSetSelectedChildrenAttribute):
+        * accessibility/AccessibilityListBoxOption.cpp:
+        (WebCore::AccessibilityListBoxOption::canSetSelectedAttribute):
+        * accessibility/AccessibilityMenuList.cpp:
+        (WebCore::AccessibilityMenuList::canSetFocusAttribute):
+        * accessibility/AccessibilityMenuListOption.cpp:
+        (WebCore::AccessibilityMenuListOption::isEnabled):
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::isEnabled):
+        (WebCore::AccessibilityNodeObject::actionElement):
+        (WebCore::AccessibilityNodeObject::canSetFocusAttribute):
+        * css/SelectorChecker.cpp:
+        (WebCore::SelectorChecker::checkOne):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::canShareStyleWithControl):
+        * dom/Element.cpp:
+        (WebCore::Element::isDisabledFormControl):
+        * dom/Element.h:
+        (Element):
+        (WebCore::isDisabledFormControl): Add helper function for convenience.
+        (WebCore):
+        * dom/EventDispatcher.cpp:
+        (WebCore::EventDispatcher::dispatchSimulatedClick):
+        * dom/GestureEvent.cpp:
+        (WebCore::GestureEventDispatchMediator::dispatchEvent):
+        * dom/MouseEvent.cpp:
+        (WebCore::MouseEventDispatchMediator::dispatchEvent):
+        * dom/Node.cpp:
+        (WebCore::Node::handleLocalEvents):
+        (WebCore::Node::willRespondToMouseMoveEvents):
+        (WebCore::Node::willRespondToMouseClickEvents):
+        (WebCore::Node::willRespondToTouchEvents):
+        * html/BaseMultipleFieldsDateAndTimeInputType.cpp:
+        (WebCore::BaseMultipleFieldsDateAndTimeInputType::isEditControlOwnerDisabled):
+        * html/DOMFormData.cpp:
+        (WebCore::DOMFormData::DOMFormData):
+        * html/FileInputType.cpp:
+        (WebCore::FileInputType::handleDOMActivateEvent):
+        (WebCore::FileInputType::disabledAttributeChanged):
+        * html/HTMLButtonElement.cpp:
+        (WebCore::HTMLButtonElement::defaultEventHandler):
+        (WebCore::HTMLButtonElement::willRespondToMouseClickEvents):
+        (WebCore::HTMLButtonElement::isSuccessfulSubmitButton):
+        * html/HTMLCollection.cpp:
+        (WebCore::isMatchingElement):
+        * html/HTMLFormControlElement.cpp:
+        (WebCore::HTMLFormControlElement::updateAncestorDisabledState):
+        (WebCore::HTMLFormControlElement::isDisabledFormControl):
+        (WebCore::HTMLFormControlElement::supportsFocus):
+        * html/HTMLFormControlElement.h:
+        (HTMLFormControlElement):
+        (WebCore::HTMLFormControlElement::isDisabledOrReadOnly):
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::isSuccessfulSubmitButton):
+        (WebCore::HTMLInputElement::willRespondToMouseClickEvents):
+        * html/HTMLOptGroupElement.cpp:
+        (WebCore::HTMLOptGroupElement::isDisabledFormControl):
+        * html/HTMLOptGroupElement.h:
+        (HTMLOptGroupElement):
+        * html/HTMLOptionElement.cpp:
+        (WebCore::HTMLOptionElement::isDisabledFormControl):
+        * html/HTMLOptionElement.h:
+        (HTMLOptionElement):
+        * html/HTMLPlugInElement.cpp:
+        (WebCore::HTMLPlugInElement::willRespondToMouseClickEvents):
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::nextValidIndex):
+        (WebCore::HTMLSelectElement::updateListBoxSelection):
+        (WebCore::HTMLSelectElement::recalcListItems):
+        (WebCore::HTMLSelectElement::appendFormData):
+        (WebCore::HTMLSelectElement::updateSelectedState):
+        (WebCore::HTMLSelectElement::listBoxDefaultEventHandler):
+        (WebCore::HTMLSelectElement::defaultEventHandler):
+        (WebCore::HTMLSelectElement::optionAtIndex):
+        * html/ImageInputType.cpp:
+        (WebCore::ImageInputType::handleDOMActivateEvent):
+        * html/ResetInputType.cpp:
+        (WebCore::ResetInputType::handleDOMActivateEvent):
+        * html/SubmitInputType.cpp:
+        (WebCore::SubmitInputType::handleDOMActivateEvent):
+        * html/shadow/SliderThumbElement.cpp:
+        (WebCore::SliderThumbElement::isDisabledFormControl):
+        (WebCore::SliderThumbElement::defaultEventHandler):
+        (WebCore::SliderThumbElement::willRespondToMouseMoveEvents):
+        (WebCore::SliderThumbElement::willRespondToMouseClickEvents):
+        * html/shadow/SliderThumbElement.h:
+        (SliderThumbElement):
+        * html/shadow/SpinButtonElement.h:
+        * html/shadow/TextFieldDecorationElement.cpp:
+        (WebCore::TextFieldDecorationElement::updateImage):
+        * loader/FormSubmission.cpp:
+        (WebCore::FormSubmission::create):
+        * page/DragController.cpp:
+        (WebCore::DragController::tryDocumentDrag):
+        (WebCore::DragController::concludeEditDrag):
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::addFocusRingRects):
+        (WebCore::RenderListBox::paintItemForeground):
+        * rendering/RenderMenuList.cpp:
+        (WebCore::RenderMenuList::itemIsEnabled):
+        * rendering/RenderTextControl.cpp:
+        (WebCore::updateUserModifyProperty):
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::isEnabled):
+        * rendering/RenderThemeMac.mm:
+        (WebCore::getMediaUIPartStateFlags):
+        * rendering/RenderThemeMacShared.mm:
+        (WebCore::RenderThemeMacShared::adjustMenuListStyle):
+        (WebCore::RenderThemeMacShared::paintSearchFieldCancelButton):
+        * rendering/RenderThemeSafari.cpp:
+        (WebCore::RenderThemeSafari::adjustMenuListStyle):
+
 2013-03-28  Brady Eidson  <beidson@apple.com>
 
         Remove workaround for <rdar://problem/5321972>.
index 4795849..9c4970e 100644 (file)
@@ -63,7 +63,7 @@ bool AccessibilityListBox::canSetSelectedChildrenAttribute() const
     if (!selectNode)
         return false;
     
-    return !toHTMLSelectElement(selectNode)->disabled();
+    return !toHTMLSelectElement(selectNode)->isDisabledFormControl();
 }
 
 void AccessibilityListBox::addChildren()
index 3074f1f..d70932c 100644 (file)
@@ -139,11 +139,11 @@ bool AccessibilityListBoxOption::canSetSelectedAttribute() const
     if (!m_optionElement->hasTagName(optionTag))
         return false;
     
-    if (m_optionElement->disabled())
+    if (m_optionElement->isDisabledFormControl())
         return false;
     
     HTMLSelectElement* selectElement = listBoxOptionParentNode();
-    if (selectElement && selectElement->disabled())
+    if (selectElement && selectElement->isDisabledFormControl())
         return false;
     
     return true;
index 05a5632..994a334 100644 (file)
@@ -92,7 +92,7 @@ bool AccessibilityMenuList::canSetFocusAttribute() const
     if (!node())
         return false;
 
-    return toElement(node())->isEnabledFormControl();
+    return !toElement(node())->isDisabledFormControl();
 }
 
 void AccessibilityMenuList::didUpdateActiveOption(int optionIndex)
index 480e357..cc62a1a 100644 (file)
@@ -52,7 +52,7 @@ Element* AccessibilityMenuListOption::actionElement() const
     
 bool AccessibilityMenuListOption::isEnabled() const
 {
-    // disabled() returns true if the parent <select> element is disabled,
+    // isDisabledFormControl() returns true if the parent <select> element is disabled,
     // which we don't want.
     return !static_cast<HTMLOptionElement*>(m_element.get())->ownElementDisabled();
 }
index 11e60f1..26e1ab4 100644 (file)
@@ -598,7 +598,7 @@ bool AccessibilityNodeObject::isEnabled() const
     if (!node || !node->isElementNode())
         return true;
 
-    return toElement(node)->isEnabledFormControl();
+    return !toElement(node)->isDisabledFormControl();
 }
 
 bool AccessibilityNodeObject::isIndeterminate() const
@@ -909,7 +909,7 @@ Element* AccessibilityNodeObject::actionElement() const
 
     if (node->hasTagName(inputTag)) {
         HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
-        if (!input->disabled() && (isCheckboxOrRadio() || input->isTextButton()))
+        if (!input->isDisabledFormControl() && (isCheckboxOrRadio() || input->isTextButton()))
             return input;
     } else if (node->hasTagName(buttonTag))
         return toElement(node);
@@ -1760,7 +1760,7 @@ bool AccessibilityNodeObject::canSetFocusAttribute() const
     if (!node)
         return false;
 
-    if (node->isElementNode() && !toElement(node)->isEnabledFormControl())
+    if (isDisabledFormControl(node))
         return false;
 
     return node->supportsFocus();
index 0b3edf3..314c7db 100644 (file)
@@ -607,7 +607,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
             break;
         case CSSSelector::PseudoEnabled:
             if (element && (element->isFormControlElement() || element->hasTagName(optionTag) || element->hasTagName(optgroupTag)))
-                return element->isEnabledFormControl();
+                return !element->isDisabledFormControl();
             break;
         case CSSSelector::PseudoFullPageMedia:
             return element && element->document() && element->document()->isMediaDocument();
@@ -616,7 +616,7 @@ bool SelectorChecker::checkOne(const SelectorCheckingContext& context, const Sib
             return element && element->isDefaultButtonForForm();
         case CSSSelector::PseudoDisabled:
             if (element && (element->isFormControlElement() || element->hasTagName(optionTag) || element->hasTagName(optgroupTag)))
-                return !element->isEnabledFormControl();
+                return element->isDisabledFormControl();
             break;
         case CSSSelector::PseudoReadOnly:
             return element && element->matchesReadOnlyPseudoClass();
index 8d68c4e..a976d6f 100644 (file)
@@ -548,7 +548,7 @@ bool StyleResolver::canShareStyleWithControl(StyledElement* element) const
     if (thisInputElement->isRequired() != otherInputElement->isRequired())
         return false;
 
-    if (element->isEnabledFormControl() != state.element()->isEnabledFormControl())
+    if (element->isDisabledFormControl() != state.element()->isDisabledFormControl())
         return false;
 
     if (element->isDefaultButtonForForm() != state.element()->isDefaultButtonForForm())
index 437471d..61015c6 100644 (file)
@@ -1176,7 +1176,7 @@ void Element::setChangedSinceLastFormControlChangeEvent(bool)
 {
 }
 
-bool Element::disabled() const
+bool Element::isDisabledFormControl() const
 {
 #if ENABLE(DIALOG_ELEMENT)
     // FIXME: disabled and inert are separate concepts in the spec, but now we treat them as the same.
index dd860f0..14d5f12 100644 (file)
@@ -537,7 +537,6 @@ public:
 #endif
 
     virtual bool isFormControlElement() const { return false; }
-    virtual bool isEnabledFormControl() const { return true; }
     virtual bool isSpinButtonElement() const { return false; }
     virtual bool isTextFormControl() const { return false; }
     virtual bool isOptionalFormControl() const { return false; }
@@ -560,7 +559,7 @@ public:
 
     // Used for disabled form elements; if true, prevents mouse events from being dispatched
     // to event listeners, and prevents DOMActivate events from being sent at all.
-    virtual bool disabled() const;
+    virtual bool isDisabledFormControl() const;
 
 #if ENABLE(DIALOG_ELEMENT)
     bool isInert() const;
@@ -754,6 +753,11 @@ inline const Element* toElement(const Node* node)
 // This will catch anyone doing an unnecessary cast.
 void toElement(const Element*);
 
+inline bool isDisabledFormControl(const Node* node)
+{
+    return node->isElementNode() && toElement(node)->isDisabledFormControl();
+}
+
 inline bool Node::hasTagName(const QualifiedName& name) const
 {
     return isElementNode() && toElement(this)->hasTagName(name);
index a21cfb7..ab19699 100644 (file)
@@ -79,7 +79,7 @@ void EventDispatcher::dispatchScopedEvent(Node* node, PassRefPtr<EventDispatchMe
 
 void EventDispatcher::dispatchSimulatedClick(Node* node, Event* underlyingEvent, SimulatedClickMouseEventOptions mouseEventOptions, SimulatedClickVisualOptions visualOptions)
 {
-    if (node->isElementNode() && toElement(node)->disabled())
+    if (isDisabledFormControl(node))
         return;
 
     if (!gNodesDispatchingSimulatedClicks)
index 015755a..4fa8163 100644 (file)
@@ -119,7 +119,7 @@ GestureEvent* GestureEventDispatchMediator::event() const
 
 bool GestureEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) const
 {
-    if (dispatcher->node()->isElementNode() && toElement(dispatcher->node())->disabled())
+    if (isDisabledFormControl(dispatcher->node()))
         return true;
 
     dispatcher->dispatch();
index 10f3928..faa91a1 100644 (file)
@@ -300,7 +300,7 @@ bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher* dispatcher) cons
         return dispatcher->dispatch();
     }
 
-    if (dispatcher->node()->isElementNode() && toElement(dispatcher->node())->disabled()) // Don't even send DOM events for disabled controls..
+    if (isDisabledFormControl(dispatcher->node()))
         return false;
 
     if (event()->type().isEmpty())
index 966fe72..2f25f0e 100644 (file)
@@ -2324,7 +2324,7 @@ void Node::handleLocalEvents(Event* event)
     if (!hasEventTargetData())
         return;
 
-    if (isElementNode() && toElement(this)->disabled() && event->isMouseEvent())
+    if (isDisabledFormControl(this) && event->isMouseEvent())
         return;
 
     fireEventListeners(event);
@@ -2523,14 +2523,14 @@ void Node::defaultEventHandler(Event* event)
 
 bool Node::willRespondToMouseMoveEvents()
 {
-    if (isElementNode() && toElement(this)->disabled())
+    if (isDisabledFormControl(this))
         return false;
     return hasEventListeners(eventNames().mousemoveEvent) || hasEventListeners(eventNames().mouseoverEvent) || hasEventListeners(eventNames().mouseoutEvent);
 }
 
 bool Node::willRespondToMouseClickEvents()
 {
-    if (isElementNode() && toElement(this)->disabled())
+    if (isDisabledFormControl(this))
         return false;
     return isContentEditable(UserSelectAllIsAlwaysNonEditable) || hasEventListeners(eventNames().mouseupEvent) || hasEventListeners(eventNames().mousedownEvent) || hasEventListeners(eventNames().clickEvent) || hasEventListeners(eventNames().DOMActivateEvent);
 }
@@ -2538,7 +2538,7 @@ bool Node::willRespondToMouseClickEvents()
 bool Node::willRespondToTouchEvents()
 {
 #if ENABLE(TOUCH_EVENTS)
-    if (isElementNode() && toElement(this)->disabled())
+    if (isDisabledFormControl(this))
         return false;
     return hasEventListeners(eventNames().touchstartEvent) || hasEventListeners(eventNames().touchmoveEvent) || hasEventListeners(eventNames().touchcancelEvent) || hasEventListeners(eventNames().touchendEvent);
 #else
index 30eb997..c37983f 100644 (file)
@@ -171,7 +171,7 @@ bool BaseMultipleFieldsDateAndTimeInputType::hasCustomFocusLogic() const
 
 bool BaseMultipleFieldsDateAndTimeInputType::isEditControlOwnerDisabled() const
 {
-    return element()->disabled();
+    return element()->isDisabledFormControl();
 }
 
 bool BaseMultipleFieldsDateAndTimeInputType::isEditControlOwnerReadOnly() const
index 703a69d..bfde91b 100644 (file)
@@ -52,7 +52,7 @@ DOMFormData::DOMFormData(HTMLFormElement* form)
 
     for (unsigned i = 0; i < form->associatedElements().size(); ++i) {
         FormAssociatedElement* element = form->associatedElements()[i];
-        if (!toHTMLElement(element)->disabled())
+        if (!toHTMLElement(element)->isDisabledFormControl())
             element->appendFormData(*this, true);
     }
 }
index 8bcc101..b0cff83 100644 (file)
@@ -175,7 +175,7 @@ String FileInputType::valueMissingText() const
 
 void FileInputType::handleDOMActivateEvent(Event* event)
 {
-    if (element()->disabled())
+    if (element()->isDisabledFormControl())
         return;
 
     if (!ScriptController::processingUserGesture())
@@ -310,7 +310,7 @@ void FileInputType::disabledAttributeChanged()
     ASSERT(element()->shadow());
     UploadButtonElement* button = static_cast<UploadButtonElement*>(element()->userAgentShadowRoot()->firstChild());
     if (button)
-        button->setBooleanAttribute(disabledAttr, element()->disabled());
+        button->setBooleanAttribute(disabledAttr, element()->isDisabledFormControl());
 }
 
 void FileInputType::multipleAttributeChanged()
index c102b19..b13b6a6 100644 (file)
@@ -111,7 +111,7 @@ void HTMLButtonElement::parseAttribute(const QualifiedName& name, const AtomicSt
 
 void HTMLButtonElement::defaultEventHandler(Event* event)
 {
-    if (event->type() == eventNames().DOMActivateEvent && !disabled()) {
+    if (event->type() == eventNames().DOMActivateEvent && !isDisabledFormControl()) {
         if (form() && m_type == SUBMIT) {
             m_isActivatedSubmit = true;
             form()->prepareForSubmission(event);
@@ -155,7 +155,7 @@ void HTMLButtonElement::defaultEventHandler(Event* event)
 
 bool HTMLButtonElement::willRespondToMouseClickEvents()
 {
-    if (!disabled() && form() && (m_type == SUBMIT || m_type == RESET))
+    if (!isDisabledFormControl() && form() && (m_type == SUBMIT || m_type == RESET))
         return true;
     return HTMLFormControlElement::willRespondToMouseClickEvents();
 }
@@ -164,7 +164,7 @@ bool HTMLButtonElement::isSuccessfulSubmitButton() const
 {
     // HTML spec says that buttons must have names to be considered successful.
     // However, other browsers do not impose this constraint.
-    return m_type == SUBMIT && !disabled();
+    return m_type == SUBMIT && !isDisabledFormControl();
 }
 
 bool HTMLButtonElement::isActivatedSubmit() const
index 8ad0bb7..4c26582 100644 (file)
@@ -227,7 +227,7 @@ template <> inline bool isMatchingElement(const HTMLCollection* htmlCollection,
     case DataListOptions:
         if (element->hasLocalName(optionTag)) {
             HTMLOptionElement* option = static_cast<HTMLOptionElement*>(element);
-            if (!option->disabled() && !option->value().isEmpty())
+            if (!option->isDisabledFormControl() && !option->value().isEmpty())
                 return true;
         }
         return false;
index 155de4f..50d8f5d 100644 (file)
@@ -113,7 +113,7 @@ void HTMLFormControlElement::updateAncestorDisabledState() const
             break;
         }
     }
-    m_ancestorDisabledState = (fieldSetAncestor && fieldSetAncestor->disabled() && !(legendAncestor && legendAncestor == fieldSetAncestor->legend())) ? AncestorDisabledStateDisabled : AncestorDisabledStateEnabled;
+    m_ancestorDisabledState = (fieldSetAncestor && fieldSetAncestor->isDisabledFormControl() && !(legendAncestor && legendAncestor == fieldSetAncestor->legend())) ? AncestorDisabledStateDisabled : AncestorDisabledStateEnabled;
 }
 
 void HTMLFormControlElement::ancestorDisabledStateWasChanged()
@@ -274,7 +274,7 @@ void HTMLFormControlElement::dispatchFormControlInputEvent()
     HTMLElement::dispatchInputEvent();
 }
 
-bool HTMLFormControlElement::disabled() const
+bool HTMLFormControlElement::isDisabledFormControl() const
 {
     if (m_disabled)
         return true;
@@ -283,7 +283,7 @@ bool HTMLFormControlElement::disabled() const
         updateAncestorDisabledState();
     if (m_ancestorDisabledState == AncestorDisabledStateDisabled)
         return true;
-    return HTMLElement::disabled();
+    return HTMLElement::isDisabledFormControl();
 }
 
 bool HTMLFormControlElement::isRequired() const
@@ -309,7 +309,7 @@ void HTMLFormControlElement::didRecalcStyle(StyleChange)
 
 bool HTMLFormControlElement::supportsFocus() const
 {
-    return !disabled();
+    return !isDisabledFormControl();
 }
 
 bool HTMLFormControlElement::isFocusable() const
index 18c593e..08b85b2 100644 (file)
@@ -64,7 +64,7 @@ public:
     virtual void dispatchFormControlChangeEvent();
     virtual void dispatchFormControlInputEvent();
 
-    virtual bool disabled() const;
+    virtual bool isDisabledFormControl() const OVERRIDE;
 
     virtual bool isFocusable() const;
     virtual bool isEnumeratable() const { return false; }
@@ -74,7 +74,6 @@ public:
     const AtomicString& type() const { return formControlType(); }
 
     virtual const AtomicString& formControlType() const OVERRIDE = 0;
-    virtual bool isEnabledFormControl() const { return !disabled(); }
 
     virtual bool canTriggerImplicitSubmission() const { return false; }
 
@@ -95,7 +94,7 @@ public:
     virtual void setCustomValidity(const String&) OVERRIDE;
 
     bool isReadOnly() const { return m_isReadOnly; }
-    bool isDisabledOrReadOnly() const { return disabled() || m_isReadOnly; }
+    bool isDisabledOrReadOnly() const { return isDisabledFormControl() || m_isReadOnly; }
 
     bool hasAutofocused() { return m_hasAutofocused; }
     void setAutofocused() { m_hasAutofocused = true; }
index 37c6bf7..fa86f29 100644 (file)
@@ -841,7 +841,7 @@ bool HTMLInputElement::isSuccessfulSubmitButton() const
 {
     // HTML spec says that buttons must have names to be considered successful.
     // However, other browsers do not impose this constraint. So we do not.
-    return !disabled() && m_inputType->canBeSuccessfulSubmitButton();
+    return !isDisabledFormControl() && m_inputType->canBeSuccessfulSubmitButton();
 }
 
 bool HTMLInputElement::isActivatedSubmit() const
@@ -1222,7 +1222,7 @@ void HTMLInputElement::defaultEventHandler(Event* evt)
 bool HTMLInputElement::willRespondToMouseClickEvents()
 {
     // FIXME: Consider implementing willRespondToMouseClickEvents() in InputType if more accurate results are necessary.
-    if (!disabled())
+    if (!isDisabledFormControl())
         return true;
 
     return HTMLTextFormControlElement::willRespondToMouseClickEvents();
index 1271b52..a90799c 100644 (file)
@@ -50,7 +50,7 @@ PassRefPtr<HTMLOptGroupElement> HTMLOptGroupElement::create(const QualifiedName&
     return adoptRef(new HTMLOptGroupElement(tagName, document));
 }
 
-bool HTMLOptGroupElement::disabled() const
+bool HTMLOptGroupElement::isDisabledFormControl() const
 {
     return fastHasAttribute(disabledAttr);
 }
index 1bfb140..fe181f7 100644 (file)
@@ -34,7 +34,7 @@ class HTMLOptGroupElement : public HTMLElement {
 public:
     static PassRefPtr<HTMLOptGroupElement> create(const QualifiedName&, Document*);
 
-    virtual bool disabled() const OVERRIDE;
+    virtual bool isDisabledFormControl() const OVERRIDE;
     HTMLSelectElement* ownerSelectElement() const;
     
     String groupLabelText() const;
@@ -45,7 +45,6 @@ private:
     virtual const AtomicString& formControlType() const;
     virtual bool supportsFocus() const;
     virtual bool isFocusable() const;
-    virtual bool isEnabledFormControl() const OVERRIDE { return !disabled(); }
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
     virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; }
     virtual void attach();
index 1305a99..761248a 100644 (file)
@@ -346,7 +346,7 @@ String HTMLOptionElement::textIndentedToRespectGroupLabel() const
     return text();
 }
 
-bool HTMLOptionElement::disabled() const
+bool HTMLOptionElement::isDisabledFormControl() const
 {
     if (ownElementDisabled())
         return true;
@@ -355,7 +355,7 @@ bool HTMLOptionElement::disabled() const
         return false;
 
     HTMLElement* parentElement = static_cast<HTMLElement*>(parentNode());
-    return parentElement->hasTagName(optgroupTag) && parentElement->disabled();
+    return parentElement->hasTagName(optgroupTag) && parentElement->isDisabledFormControl();
 }
 
 Node::InsertionNotificationRequest HTMLOptionElement::insertedInto(ContainerNode* insertionPoint)
index 19f569b..673f077 100644 (file)
@@ -58,10 +58,9 @@ public:
     String label() const;
     void setLabel(const String&);
 
-    virtual bool isEnabledFormControl() const OVERRIDE { return !disabled(); }
     bool ownElementDisabled() const { return m_disabled; }
 
-    virtual bool disabled() const;
+    virtual bool isDisabledFormControl() const OVERRIDE;
 
     String textIndentedToRespectGroupLabel() const;
 
index 726ab44..5f7cd26 100644 (file)
@@ -81,7 +81,7 @@ bool HTMLPlugInElement::canProcessDrag() const
 
 bool HTMLPlugInElement::willRespondToMouseClickEvents()
 {
-    if (disabled())
+    if (isDisabledFormControl())
         return false;
     RenderObject* r = renderer();
     if (!r)
index 1ba8ae3..dc1615a 100644 (file)
@@ -498,7 +498,7 @@ int HTMLSelectElement::nextValidIndex(int listIndex, SkipDirection direction, in
     int size = listItems.size();
     for (listIndex += direction; listIndex >= 0 && listIndex < size; listIndex += direction) {
         --skip;
-        if (!listItems[listIndex]->disabled() && listItems[listIndex]->hasTagName(optionTag)) {
+        if (!listItems[listIndex]->isDisabledFormControl() && listItems[listIndex]->hasTagName(optionTag)) {
             lastGoodIndex = listIndex;
             if (skip <= 0)
                 break;
@@ -615,7 +615,7 @@ void HTMLSelectElement::updateListBoxSelection(bool deselectOtherOptions)
     const Vector<HTMLElement*>& items = listItems();
     for (unsigned i = 0; i < items.size(); ++i) {
         HTMLElement* element = items[i];
-        if (!element->hasTagName(optionTag) || toHTMLOptionElement(element)->disabled())
+        if (!element->hasTagName(optionTag) || toHTMLOptionElement(element)->isDisabledFormControl())
             continue;
 
         if (i >= start && i <= end)
@@ -767,7 +767,7 @@ void HTMLSelectElement::recalcListItems(bool updateSelectedStates) const
                     if (foundSelected)
                         foundSelected->setSelectedState(false);
                     foundSelected = option;
-                } else if (m_size <= 1 && !foundSelected && !option->disabled()) {
+                } else if (m_size <= 1 && !foundSelected && !option->isDisabledFormControl()) {
                     foundSelected = option;
                     foundSelected->setSelectedState(true);
                 }
@@ -1020,7 +1020,7 @@ bool HTMLSelectElement::appendFormData(FormDataList& list, bool)
 
     for (unsigned i = 0; i < items.size(); ++i) {
         HTMLElement* element = items[i];
-        if (element->hasTagName(optionTag) && toHTMLOptionElement(element)->selected() && !toHTMLOptionElement(element)->disabled()) {
+        if (element->hasTagName(optionTag) && toHTMLOptionElement(element)->selected() && !toHTMLOptionElement(element)->isDisabledFormControl()) {
             list.appendData(name, toHTMLOptionElement(element)->value());
             successful = true;
         }
@@ -1263,7 +1263,7 @@ void HTMLSelectElement::updateSelectedState(int listIndex, bool multi, bool shif
         setActiveSelectionAnchorIndex(selectedIndex());
 
     // Set the selection state of the clicked option.
-    if (clickedElement->hasTagName(optionTag) && !toHTMLOptionElement(clickedElement)->disabled())
+    if (clickedElement->hasTagName(optionTag) && !toHTMLOptionElement(clickedElement)->isDisabledFormControl())
         toHTMLOptionElement(clickedElement)->setSelectedState(true);
 
     // If there was no selectedIndex() for the previous initialization, or If
@@ -1292,7 +1292,7 @@ void HTMLSelectElement::listBoxDefaultEventHandler(Event* event)
         IntPoint localOffset = roundedIntPoint(renderer()->absoluteToLocal(mouseEvent->absoluteLocation(), UseTransforms));
         int listIndex = toRenderListBox(renderer())->listIndexAtOffset(toIntSize(localOffset));
         if (listIndex >= 0) {
-            if (!disabled()) {
+            if (!isDisabledFormControl()) {
 #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN))
                 updateSelectedState(listIndex, mouseEvent->metaKey(), mouseEvent->shiftKey());
 #else
@@ -1312,7 +1312,7 @@ void HTMLSelectElement::listBoxDefaultEventHandler(Event* event)
         IntPoint localOffset = roundedIntPoint(renderer()->absoluteToLocal(mouseEvent->absoluteLocation(), UseTransforms));
         int listIndex = toRenderListBox(renderer())->listIndexAtOffset(toIntSize(localOffset));
         if (listIndex >= 0) {
-            if (!disabled()) {
+            if (!isDisabledFormControl()) {
                 if (m_multiple) {
                     // Only extend selection if there is something selected.
                     if (m_activeSelectionAnchorIndex < 0)
@@ -1440,7 +1440,7 @@ void HTMLSelectElement::defaultEventHandler(Event* event)
     if (!renderer())
         return;
 
-    if (disabled()) {
+    if (isDisabledFormControl()) {
         HTMLFormControlElementWithState::defaultEventHandler(event);
         return;
     }
@@ -1489,7 +1489,7 @@ String HTMLSelectElement::optionAtIndex(int index) const
     const Vector<HTMLElement*>& items = listItems();
     
     HTMLElement* element = items[index];
-    if (!element->hasTagName(optionTag) || toHTMLOptionElement(element)->disabled())
+    if (!element->hasTagName(optionTag) || toHTMLOptionElement(element)->isDisabledFormControl())
         return String();
     return toHTMLOptionElement(element)->textIndentedToRespectGroupLabel();
 }
index b935df0..db57aa4 100644 (file)
@@ -88,7 +88,7 @@ bool ImageInputType::supportsValidation() const
 void ImageInputType::handleDOMActivateEvent(Event* event)
 {
     RefPtr<HTMLInputElement> element = this->element();
-    if (element->disabled() || !element->form())
+    if (element->isDisabledFormControl() || !element->form())
         return;
     element->setActivatedSubmit(true);
     if (event->underlyingEvent() && event->underlyingEvent()->isMouseEvent()) {
index 8fec0ff..bbcc6c7 100644 (file)
@@ -58,7 +58,7 @@ bool ResetInputType::supportsValidation() const
 
 void ResetInputType::handleDOMActivateEvent(Event* event)
 {
-    if (element()->disabled() || !element()->form())
+    if (element()->isDisabledFormControl() || !element()->form())
         return;
     element()->form()->reset();
     event->setDefaultHandled();
index 489d9a1..8724ffb 100644 (file)
@@ -68,7 +68,7 @@ bool SubmitInputType::supportsRequired() const
 void SubmitInputType::handleDOMActivateEvent(Event* event)
 {
     RefPtr<HTMLInputElement> element = this->element();
-    if (element->disabled() || !element->form())
+    if (element->isDisabledFormControl() || !element->form())
         return;
     element->setActivatedSubmit(true);
     element->form()->prepareForSubmission(event); // Event handlers can run.
index 4d0f3d8..3cb857a 100644 (file)
@@ -221,14 +221,9 @@ RenderObject* SliderThumbElement::createRenderer(RenderArena* arena, RenderStyle
     return new (arena) RenderSliderThumb(this);
 }
 
-bool SliderThumbElement::disabled() const
+bool SliderThumbElement::isDisabledFormControl() const
 {
-    return hostInput()->disabled();
-}
-
-bool SliderThumbElement::isEnabledFormControl() const
-{
-    return !disabled();
+    return hostInput()->isDisabledFormControl();
 }
 
 bool SliderThumbElement::matchesReadOnlyPseudoClass() const
index de51037..b1460ec 100644 (file)
@@ -65,8 +65,7 @@ private:
     SliderThumbElement(Document*);
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
     virtual PassRefPtr<Element> cloneElementWithoutAttributesAndChildren();
-    virtual bool disabled() const OVERRIDE;
-    virtual bool isEnabledFormControl() const OVERRIDE;
+    virtual bool isDisabledFormControl() const OVERRIDE;
     virtual bool matchesReadOnlyPseudoClass() const OVERRIDE;
     virtual bool matchesReadWritePseudoClass() const OVERRIDE;
     virtual Node* focusDelegate();
index 549ae44..b223440 100644 (file)
@@ -72,8 +72,7 @@ private:
     virtual const AtomicString& shadowPseudoId() const;
     virtual void detach();
     virtual bool isSpinButtonElement() const { return true; }
-    virtual bool disabled() const OVERRIDE { return shadowHost() && shadowHost()->disabled(); }
-    virtual bool isEnabledFormControl() const OVERRIDE { return !disabled(); }
+    virtual bool isDisabledFormControl() const OVERRIDE { return shadowHost() && shadowHost()->isDisabledFormControl(); }
     virtual bool matchesReadOnlyPseudoClass() const OVERRIDE;
     virtual bool matchesReadWritePseudoClass() const OVERRIDE;
     virtual void defaultEventHandler(Event*);
index fa2f179..efb501f 100644 (file)
@@ -142,7 +142,7 @@ void TextFieldDecorationElement::updateImage()
         return;
     RenderImageResource* resource = toRenderImage(renderer())->imageResource();
     CachedImage* image;
-    if (hostInput()->disabled())
+    if (hostInput()->isDisabledFormControl())
         image = m_textFieldDecorator->imageForDisabledState();
     else if (hostInput()->isReadOnly())
         image = m_textFieldDecorator->imageForReadonlyState();
index 5d40e78..79721ba 100644 (file)
@@ -187,7 +187,7 @@ PassRefPtr<FormSubmission> FormSubmission::create(HTMLFormElement* form, const A
     for (unsigned i = 0; i < form->associatedElements().size(); ++i) {
         FormAssociatedElement* control = form->associatedElements()[i];
         HTMLElement* element = toHTMLElement(control);
-        if (!element->disabled())
+        if (!element->isDisabledFormControl())
             control->appendFormData(*domFormData, isMultiPartForm);
         if (element->hasLocalName(inputTag)) {
             HTMLInputElement* input = static_cast<HTMLInputElement*>(control);
index fb5ba52..6c0cb83 100644 (file)
@@ -371,7 +371,7 @@ bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction a
 
         unsigned numberOfFiles = dragData->numberOfFiles();
         if (m_fileInputElementUnderMouse) {
-            if (m_fileInputElementUnderMouse->disabled())
+            if (m_fileInputElementUnderMouse->isDisabledFormControl())
                 dragSession.numberOfItemsToBeAccepted = 0;
             else if (m_fileInputElementUnderMouse->multiple())
                 dragSession.numberOfItemsToBeAccepted = numberOfFiles;
@@ -486,7 +486,7 @@ bool DragController::concludeEditDrag(DragData* dragData)
         // fileInput should be the element we hit tested for, unless it was made
         // display:none in a drop event handler.
         ASSERT(fileInput == element || !fileInput->renderer());
-        if (fileInput->disabled())
+        if (fileInput->isDisabledFormControl())
             return false;
 
         return fileInput->receiveDroppedFiles(dragData);
index 1fd8878..4a3d80a 100644 (file)
@@ -346,7 +346,7 @@ void RenderListBox::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint&
     const Vector<HTMLElement*>& listItems = select->listItems();
     for (int i = 0; i < size; ++i) {
         HTMLElement* element = listItems[i];
-        if (element->hasTagName(optionTag) && !toHTMLOptionElement(element)->disabled()) {
+        if (element->hasTagName(optionTag) && !element->isDisabledFormControl()) {
             rects.append(pixelSnappedIntRect(itemBoundingBoxRect(additionalOffset, i)));
             return;
         }
@@ -414,7 +414,7 @@ void RenderListBox::paintItemForeground(PaintInfo& paintInfo, const LayoutPoint&
         if (frame()->selection()->isFocusedAndActive() && document()->focusedNode() == node())
             textColor = theme()->activeListBoxSelectionForegroundColor();
         // Honor the foreground color for disabled items
-        else if (!element->disabled() && !select->disabled())
+        else if (!element->isDisabledFormControl() && !select->isDisabledFormControl())
             textColor = theme()->inactiveListBoxSelectionForegroundColor();
     }
 
index 475c7d7..5a4e36a 100644 (file)
@@ -453,12 +453,12 @@ bool RenderMenuList::itemIsEnabled(unsigned listIndex) const
     bool groupEnabled = true;
     if (Element* parentElement = element->parentElement()) {
         if (parentElement->hasTagName(optgroupTag))
-            groupEnabled = !static_cast<HTMLOptGroupElement*>(parentElement)->disabled();
+            groupEnabled = !parentElement->isDisabledFormControl();
     }
     if (!groupEnabled)
         return false;
 
-    return element->isEnabledFormControl();
+    return !element->isDisabledFormControl();
 }
 
 PopupMenuStyle RenderMenuList::itemStyle(unsigned listIndex) const
index 8bd59f5..dcf547a 100644 (file)
@@ -76,17 +76,17 @@ void RenderTextControl::styleDidChange(StyleDifference diff, const RenderStyle*
 
 static inline bool updateUserModifyProperty(Node* node, RenderStyle* style)
 {
-    bool isEnabled = true;
+    bool isDisabled = false;
     bool isReadOnlyControl = false;
 
     if (node->isElementNode()) {
         Element* element = toElement(node);
-        isEnabled = element->isEnabledFormControl();
+        isDisabled = element->isDisabledFormControl();
         isReadOnlyControl = element->isTextFormControl() && toHTMLTextFormControlElement(element)->isReadOnly();
     }
 
-    style->setUserModify((isReadOnlyControl || !isEnabled) ? READ_ONLY : READ_WRITE_PLAINTEXT_ONLY);
-    return !isEnabled;
+    style->setUserModify((isReadOnlyControl || isDisabled) ? READ_ONLY : READ_WRITE_PLAINTEXT_ONLY);
+    return isDisabled;
 }
 
 void RenderTextControl::adjustInnerTextStyle(const RenderStyle* startStyle, RenderStyle* textBlockStyle) const
index e45de15..972be90 100644 (file)
@@ -788,7 +788,7 @@ bool RenderTheme::isEnabled(const RenderObject* o) const
     Node* node = o->node();
     if (!node || !node->isElementNode())
         return true;
-    return toElement(node)->isEnabledFormControl();
+    return !toElement(node)->isDisabledFormControl();
 }
 
 bool RenderTheme::isFocused(const RenderObject* o) const
index 1acce5a..2e8d56e 100644 (file)
@@ -138,7 +138,7 @@ static unsigned getMediaUIPartStateFlags(Node* node)
 {
     unsigned flags = 0;
 
-    if (node->isElementNode() && toElement(node)->disabled())
+    if (isDisabledFormControl(node))
         flags |= MediaUIPartDisabledFlag;
     else if (node->active())
         flags |= MediaUIPartPressedFlag;
index 3332b91..7bbff51 100644 (file)
@@ -1232,7 +1232,7 @@ void RenderThemeMacShared::adjustMenuListStyle(StyleResolver* styleResolver, Ren
 
     // Set the foreground color to black or gray when we have the aqua look.
     // Cast to RGB32 is to work around a compiler bug.
-    style->setColor(e && e->isEnabledFormControl() ? static_cast<RGBA32>(Color::black) : Color::darkGray);
+    style->setColor(e && !e->isDisabledFormControl() ? static_cast<RGBA32>(Color::black) : Color::darkGray);
 
     // Set the button's vertical size.
     setSizeFromFont(style, menuListButtonSizes());
@@ -1550,7 +1550,7 @@ bool RenderThemeMacShared::paintSearchFieldCancelButton(RenderObject* o, const P
 
     NSSearchFieldCell* search = this->search();
 
-    if (input->isEnabledFormControl() && (input->isTextFormControl() && !toHTMLTextFormControlElement(input)->isReadOnly())) {
+    if (!input->isDisabledFormControl() && (input->isTextFormControl() && !toHTMLTextFormControlElement(input)->isReadOnly())) {
         updateActiveState([search cancelButtonCell], o);
         updatePressedState([search cancelButtonCell], o);
     }
index 0e23fde..f301eac 100644 (file)
@@ -874,7 +874,7 @@ void RenderThemeSafari::adjustMenuListStyle(StyleResolver* styleResolver, Render
 
     // Set the foreground color to black or gray when we have the aqua look.
     // Cast to RGB32 is to work around a compiler bug.
-    style->setColor(e && e->isEnabledFormControl() ? static_cast<RGBA32>(Color::black) : Color::darkGray);
+    style->setColor(e && !e->isDisabledFormControl() ? static_cast<RGBA32>(Color::black) : Color::darkGray);
 
     // Set the button's vertical size.
     setButtonSize(style);
index a33cd78..3514dcc 100644 (file)
@@ -1,3 +1,21 @@
+2013-03-28  Matt Falkenhagen  <falken@chromium.org>
+
+        Refactoring: Replace Element::disabled and isEnabledFormControl with isDisabledFormControl
+        https://bugs.webkit.org/show_bug.cgi?id=113273
+
+        Reviewed by Kent Tamura.
+
+        Element::disabled is about form controls and Element::isEnabledFormControl
+        is redundant with it, so replace them with a single function
+        Element::isDisabledFormControl.
+
+        * WebCoreSupport/CredentialTransformData.cpp:
+        (WebCore::CredentialTransformData::findPasswordFormFields):
+        * WebKitSupport/DOMSupport.cpp:
+        (BlackBerry::WebKit::DOMSupport::isTextBasedContentEditableElement):
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::openSelectPopup):
+
 2013-03-27  Eli Fidler <efidler@blackberry.com>
 
         [BlackBerry] Show compositing on the Inspector timeline properly
index 92b558d..fa4dec0 100644 (file)
@@ -195,7 +195,7 @@ bool CredentialTransformData::findPasswordFormFields(HTMLFormElement* form)
             continue;
 
         HTMLInputElement* inputElement = formElement->toInputElement();
-        if (!inputElement->isEnabledFormControl())
+        if (inputElement->isDisabledFormControl())
             continue;
 
         if ((passwords.size() < maxPasswords)
@@ -217,7 +217,7 @@ bool CredentialTransformData::findPasswordFormFields(HTMLFormElement* form)
                 continue;
 
             HTMLInputElement* inputElement = formElement->toInputElement();
-            if (!inputElement->isEnabledFormControl())
+            if (inputElement->isDisabledFormControl())
                 continue;
 
             // Various input types such as text, url, email can be a username field.
index 56300a7..b779212 100644 (file)
@@ -260,7 +260,7 @@ bool isTextBasedContentEditableElement(Element* element)
     if (!element)
         return false;
 
-    if (element->isReadOnlyNode() || !element->isEnabledFormControl())
+    if (element->isReadOnlyNode() || element->isDisabledFormControl())
         return false;
 
     if (isPopupInputField(element))
index 69989f8..7dde2b9 100644 (file)
@@ -1901,7 +1901,7 @@ bool InputHandler::didNodeOpenPopup(Node* node)
 
 bool InputHandler::openSelectPopup(HTMLSelectElement* select)
 {
-    if (!select || select->disabled())
+    if (!select || select->isDisabledFormControl())
         return false;
 
     // If there's no view, do nothing and return.
@@ -1936,13 +1936,13 @@ bool InputHandler::openSelectPopup(HTMLSelectElement* select)
             if (listItems[i]->hasTagName(HTMLNames::optionTag)) {
                 HTMLOptionElement* option = static_cast<HTMLOptionElement*>(listItems[i]);
                 labels[i] = option->textIndentedToRespectGroupLabel();
-                enableds[i] = option->disabled() ? 0 : 1;
+                enableds[i] = option->isDisabledFormControl() ? 0 : 1;
                 selecteds[i] = option->selected();
                 itemTypes[i] = option->parentNode() && option->parentNode()->hasTagName(HTMLNames::optgroupTag) ? TypeOptionInGroup : TypeOption;
             } else if (listItems[i]->hasTagName(HTMLNames::optgroupTag)) {
                 HTMLOptGroupElement* optGroup = static_cast<HTMLOptGroupElement*>(listItems[i]);
                 labels[i] = optGroup->groupLabelText();
-                enableds[i] = optGroup->disabled() ? 0 : 1;
+                enableds[i] = optGroup->isDisabledFormControl() ? 0 : 1;
                 selecteds[i] = false;
                 itemTypes[i] = TypeGroup;
             } else if (listItems[i]->hasTagName(HTMLNames::hrTag)) {
index ddbe069..aba6c83 100644 (file)
@@ -1,3 +1,24 @@
+2013-03-28  Matt Falkenhagen  <falken@chromium.org>
+
+        Refactoring: Replace Element::disabled and isEnabledFormControl with isDisabledFormControl
+        https://bugs.webkit.org/show_bug.cgi?id=113273
+
+        Reviewed by Kent Tamura.
+
+        Element::disabled is about form controls and Element::isEnabledFormControl
+        is redundant with it, so replace them with a single function
+        Element::isDisabledFormControl.
+
+        * src/WebFormControlElement.cpp:
+        (WebKit::WebFormControlElement::isEnabled):
+        * src/WebOptionElement.cpp:
+        (WebKit::WebOptionElement::isEnabled):
+        * src/WebPasswordFormUtils.cpp:
+        (WebKit::findPasswordFormFields):
+        * src/WebSearchableFormData.cpp:
+        (HTMLNames::findSuitableSearchInputElement):
+        (HTMLNames::buildSearchString):
+
 2013-03-27  Keishi Hattori  <keishi@webkit.org>
 
         [Chromium] Enable touch events in PagePopup
index d9dc70c..dd445c0 100644 (file)
@@ -41,7 +41,7 @@ namespace WebKit {
 
 bool WebFormControlElement::isEnabled() const
 {
-    return constUnwrap<HTMLFormControlElement>()->isEnabledFormControl();
+    return !constUnwrap<HTMLFormControlElement>()->isDisabledFormControl();
 }
 
 bool WebFormControlElement::isReadOnly() const
index b511697..edc568e 100644 (file)
@@ -79,7 +79,7 @@ WebString WebOptionElement::label() const
 
 bool WebOptionElement::isEnabled() const
 {
-    return !(constUnwrap<HTMLOptionElement>()->disabled());
+    return !(constUnwrap<HTMLOptionElement>()->isDisabledFormControl());
 }
 
 WebOptionElement::WebOptionElement(const PassRefPtr<HTMLOptionElement>& elem)
index ae39994..5ad4a1e 100644 (file)
@@ -76,7 +76,7 @@ void findPasswordFormFields(HTMLFormElement* form, PasswordFormFields* fields)
             continue;
 
         HTMLInputElement* inputElement = toHTMLInputElement(formElement);
-        if (!inputElement->isEnabledFormControl())
+        if (inputElement->isDisabledFormControl())
             continue;
 
         if ((fields->passwords.size() < maxPasswords)
index c385291..d0d9c65 100644 (file)
@@ -162,7 +162,7 @@ HTMLInputElement* findSuitableSearchInputElement(const HTMLFormElement* form)
 
         HTMLFormControlElement* formElement = static_cast<HTMLFormControlElement*>(*i);
 
-        if (formElement->disabled() || formElement->name().isNull())
+        if (formElement->isDisabledFormControl() || formElement->name().isNull())
             continue;
 
         if (!IsInDefaultState(formElement) || formElement->hasTagName(HTMLNames::textareaTag))
@@ -205,7 +205,7 @@ bool buildSearchString(const HTMLFormElement* form, Vector<char>* encodedString,
 
         HTMLFormControlElement* formElement = static_cast<HTMLFormControlElement*>(*i);
 
-        if (formElement->disabled() || formElement->name().isNull())
+        if (formElement->isDisabledFormControl() || formElement->name().isNull())
             continue;
 
         FormDataList dataList(*encoding);
index b17fe05..e374eed 100644 (file)
@@ -1,3 +1,17 @@
+2013-03-28  Matt Falkenhagen  <falken@chromium.org>
+
+        Refactoring: Replace Element::disabled and isEnabledFormControl with isDisabledFormControl
+        https://bugs.webkit.org/show_bug.cgi?id=113273
+
+        Reviewed by Kent Tamura.
+
+        Element::disabled is about form controls and Element::isEnabledFormControl
+        is redundant with it, so replace them with a single function
+        Element::isDisabledFormControl.
+
+        * DOMHTMLClasses.cpp:
+        (DOMHTMLInputElement::disabled):
+
 2013-03-27  Mark Lam  <mark.lam@apple.com>
 
         Rolling out r147044.
index 87fb899..3fa1171 100644 (file)
@@ -1079,7 +1079,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::disabled(
 {
     ASSERT(m_element && m_element->hasTagName(inputTag));
     HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
-    *result = inputElement->disabled() ? TRUE : FALSE;
+    *result = inputElement->isDisabledFormControl() ? TRUE : FALSE;
     return S_OK;
 }