Commit 2113254c authored by falken@chromium.org's avatar 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.

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: http://svn.webkit.org/repository/webkit/trunk@147135 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 690279bf
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>.
......@@ -63,7 +63,7 @@ bool AccessibilityListBox::canSetSelectedChildrenAttribute() const
if (!selectNode)
return false;
return !toHTMLSelectElement(selectNode)->disabled();
return !toHTMLSelectElement(selectNode)->isDisabledFormControl();
}
void AccessibilityListBox::addChildren()
......
......@@ -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;
......
......@@ -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)
......
......@@ -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();
}
......
......@@ -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();
......
......@@ -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();
......
......@@ -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())
......
......@@ -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.
......
......@@ -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);
......
......@@ -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)
......
......@@ -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();
......
......@@ -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())
......
......@@ -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
......
......@@ -171,7 +171,7 @@ bool BaseMultipleFieldsDateAndTimeInputType::hasCustomFocusLogic() const
bool BaseMultipleFieldsDateAndTimeInputType::isEditControlOwnerDisabled() const
{
return element()->disabled();
return element()->isDisabledFormControl();
}
bool BaseMultipleFieldsDateAndTimeInputType::isEditControlOwnerReadOnly() const
......
......@@ -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);
}
}
......
......@@ -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()
......
......@@ -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
......
......@@ -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;
......
......@@ -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
......
......@@ -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; }
......
......@@ -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();
......
......@@ -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);
}
......
......@@ -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();
......
......@@ -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)
......
......@@ -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;
......
......@@ -81,7 +81,7 @@ bool HTMLPlugInElement::canProcessDrag() const
bool HTMLPlugInElement::willRespondToMouseClickEvents()
{
if (disabled())
if (isDisabledFormControl())
return false;
RenderObject* r = renderer();
if (!r)
......
......@@ -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)