Commit 96922921 authored by tkent@chromium.org's avatar tkent@chromium.org
Browse files

Rename HTMLFormControlElement::readOnly to isReadOnly

https://bugs.webkit.org/show_bug.cgi?id=113297

Reviewed by Alexey Proskuryakov.

Source/WebCore:

HTMLFormControlElement::readOnly is not an implementation of
'readOnly' IDL attribute. It's confusing and we don't need to
violate our naming convention.

No new tests. Just a refactoring.

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::isReadOnly):
* html/BaseMultipleFieldsDateAndTimeInputType.cpp:
(WebCore::BaseMultipleFieldsDateAndTimeInputType::isEditControlOwnerReadOnly):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::HTMLFormControlElement):
(WebCore::HTMLFormControlElement::parseAttribute):
* html/HTMLFormControlElement.h:
(WebCore::HTMLFormControlElement::isReadOnly):
(WebCore::HTMLFormControlElement::isDisabledOrReadOnly):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::matchesReadOnlyPseudoClass):
(WebCore::HTMLInputElement::matchesReadWritePseudoClass):
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::matchesReadOnlyPseudoClass):
(WebCore::HTMLTextAreaElement::matchesReadWritePseudoClass):
* html/shadow/SliderThumbElement.cpp:
(WebCore::SliderThumbElement::defaultEventHandler):
(WebCore::SliderThumbElement::willRespondToMouseMoveEvents):
(WebCore::SliderThumbElement::willRespondToMouseClickEvents):
* html/shadow/TextControlInnerElements.cpp:
(WebCore::InputFieldSpeechButtonElement::willRespondToMouseClickEvents):
(WebCore::InputFieldSpeechButtonElement::setRecognitionResult):
* html/shadow/TextFieldDecorationElement.cpp:
(WebCore::TextFieldDecorationElement::updateImage):
* rendering/RenderTextControl.cpp:
(WebCore::updateUserModifyProperty):
* rendering/RenderThemeMacShared.mm:
(WebCore::RenderThemeMacShared::paintSearchFieldCancelButton):

Source/WebKit/chromium:

* src/WebFormControlElement.cpp:
(WebKit::WebFormControlElement::isReadOnly):

Source/WebKit/win:

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


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146977 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a5f4a612
2013-03-27 Kent Tamura <tkent@chromium.org>
Rename HTMLFormControlElement::readOnly to isReadOnly
https://bugs.webkit.org/show_bug.cgi?id=113297
Reviewed by Alexey Proskuryakov.
HTMLFormControlElement::readOnly is not an implementation of
'readOnly' IDL attribute. It's confusing and we don't need to
violate our naming convention.
No new tests. Just a refactoring.
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::isReadOnly):
* html/BaseMultipleFieldsDateAndTimeInputType.cpp:
(WebCore::BaseMultipleFieldsDateAndTimeInputType::isEditControlOwnerReadOnly):
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::HTMLFormControlElement):
(WebCore::HTMLFormControlElement::parseAttribute):
* html/HTMLFormControlElement.h:
(WebCore::HTMLFormControlElement::isReadOnly):
(WebCore::HTMLFormControlElement::isDisabledOrReadOnly):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::matchesReadOnlyPseudoClass):
(WebCore::HTMLInputElement::matchesReadWritePseudoClass):
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::matchesReadOnlyPseudoClass):
(WebCore::HTMLTextAreaElement::matchesReadWritePseudoClass):
* html/shadow/SliderThumbElement.cpp:
(WebCore::SliderThumbElement::defaultEventHandler):
(WebCore::SliderThumbElement::willRespondToMouseMoveEvents):
(WebCore::SliderThumbElement::willRespondToMouseClickEvents):
* html/shadow/TextControlInnerElements.cpp:
(WebCore::InputFieldSpeechButtonElement::willRespondToMouseClickEvents):
(WebCore::InputFieldSpeechButtonElement::setRecognitionResult):
* html/shadow/TextFieldDecorationElement.cpp:
(WebCore::TextFieldDecorationElement::updateImage):
* rendering/RenderTextControl.cpp:
(WebCore::updateUserModifyProperty):
* rendering/RenderThemeMacShared.mm:
(WebCore::RenderThemeMacShared::paintSearchFieldCancelButton):
2013-03-27 Yury Semikhatsky <yurys@chromium.org>
 
Web Inspector: update Timeline.TimelineEvent definition to include DOM counters and native memory stats
......@@ -683,12 +683,12 @@ bool AccessibilityNodeObject::isReadOnly() const
return true;
if (node->hasTagName(textareaTag))
return static_cast<HTMLTextAreaElement*>(node)->readOnly();
return static_cast<HTMLTextAreaElement*>(node)->isReadOnly();
if (node->hasTagName(inputTag)) {
HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
if (input->isTextField())
return input->readOnly();
return input->isReadOnly();
}
return !node->rendererIsEditable();
......
......@@ -176,7 +176,7 @@ bool BaseMultipleFieldsDateAndTimeInputType::isEditControlOwnerDisabled() const
bool BaseMultipleFieldsDateAndTimeInputType::isEditControlOwnerReadOnly() const
{
return element()->readOnly();
return element()->isReadOnly();
}
void BaseMultipleFieldsDateAndTimeInputType::focusAndSelectSpinButtonOwner()
......
......@@ -51,7 +51,7 @@ using namespace std;
HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
: LabelableElement(tagName, document)
, m_disabled(false)
, m_readOnly(false)
, m_isReadOnly(false)
, m_isRequired(false)
, m_valueMatchesRenderer(false)
, m_ancestorDisabledState(AncestorDisabledStateUnknown)
......@@ -133,9 +133,9 @@ void HTMLFormControlElement::parseAttribute(const QualifiedName& name, const Ato
if (oldDisabled != m_disabled)
disabledAttributeChanged();
} else if (name == readonlyAttr) {
bool oldReadOnly = m_readOnly;
m_readOnly = !value.isNull();
if (oldReadOnly != m_readOnly) {
bool wasReadOnly = m_isReadOnly;
m_isReadOnly = !value.isNull();
if (wasReadOnly != m_isReadOnly) {
setNeedsWillValidateCheck();
setNeedsStyleRecalc();
if (renderer() && renderer()->style()->hasAppearance())
......
......@@ -94,8 +94,8 @@ public:
void setNeedsValidityCheck();
virtual void setCustomValidity(const String&) OVERRIDE;
bool readOnly() const { return m_readOnly; }
bool isDisabledOrReadOnly() const { return disabled() || m_readOnly; }
bool isReadOnly() const { return m_isReadOnly; }
bool isDisabledOrReadOnly() const { return disabled() || m_isReadOnly; }
bool hasAutofocused() { return m_hasAutofocused; }
void setAutofocused() { m_hasAutofocused = true; }
......@@ -148,7 +148,7 @@ private:
OwnPtr<ValidationMessage> m_validationMessage;
bool m_disabled : 1;
bool m_readOnly : 1;
bool m_isReadOnly : 1;
bool m_isRequired : 1;
bool m_valueMatchesRenderer : 1;
......
......@@ -1456,12 +1456,12 @@ bool HTMLInputElement::isRequiredFormControl() const
bool HTMLInputElement::matchesReadOnlyPseudoClass() const
{
return m_inputType->supportsReadOnly() && readOnly();
return m_inputType->supportsReadOnly() && isReadOnly();
}
bool HTMLInputElement::matchesReadWritePseudoClass() const
{
return m_inputType->supportsReadOnly() && !readOnly();
return m_inputType->supportsReadOnly() && !isReadOnly();
}
void HTMLInputElement::addSearchResult()
......
......@@ -529,12 +529,12 @@ void HTMLTextAreaElement::attach()
bool HTMLTextAreaElement::matchesReadOnlyPseudoClass() const
{
return readOnly();
return isReadOnly();
}
bool HTMLTextAreaElement::matchesReadWritePseudoClass() const
{
return !readOnly();
return !isReadOnly();
}
void HTMLTextAreaElement::updatePlaceholderText()
......
......@@ -344,7 +344,7 @@ void SliderThumbElement::defaultEventHandler(Event* event)
// FIXME: Should handle this readonly/disabled check in more general way.
// Missing this kind of check is likely to occur elsewhere if adding it in each shadow element.
HTMLInputElement* input = hostInput();
if (!input || input->readOnly() || !input->isEnabledFormControl()) {
if (!input || input->isDisabledOrReadOnly()) {
stopDragging();
HTMLDivElement::defaultEventHandler(event);
return;
......@@ -375,7 +375,7 @@ void SliderThumbElement::defaultEventHandler(Event* event)
bool SliderThumbElement::willRespondToMouseMoveEvents()
{
const HTMLInputElement* input = hostInput();
if (input && !input->readOnly() && input->isEnabledFormControl() && m_inDragMode)
if (input && !input->isDisabledOrReadOnly() && m_inDragMode)
return true;
return HTMLDivElement::willRespondToMouseMoveEvents();
......@@ -384,7 +384,7 @@ bool SliderThumbElement::willRespondToMouseMoveEvents()
bool SliderThumbElement::willRespondToMouseClickEvents()
{
const HTMLInputElement* input = hostInput();
if (input && !input->readOnly() && input->isEnabledFormControl())
if (input && !input->isDisabledOrReadOnly())
return true;
return HTMLDivElement::willRespondToMouseClickEvents();
......
......@@ -349,7 +349,7 @@ void InputFieldSpeechButtonElement::defaultEventHandler(Event* event)
bool InputFieldSpeechButtonElement::willRespondToMouseClickEvents()
{
const HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowHost());
if (input && !input->disabled() && !input->readOnly())
if (input && !input->isDisabledOrReadOnly())
return true;
return HTMLDivElement::willRespondToMouseClickEvents();
......@@ -386,7 +386,7 @@ void InputFieldSpeechButtonElement::setRecognitionResult(int, const SpeechInputR
// remove the input element from DOM. To make sure it remains valid until we finish our work
// here, we take a temporary reference.
RefPtr<HTMLInputElement> input(static_cast<HTMLInputElement*>(shadowHost()));
if (!input || input->disabled() || input->readOnly())
if (!input || input->isDisabledOrReadOnly())
return;
RefPtr<InputFieldSpeechButtonElement> holdRefButton(this);
......
......@@ -144,7 +144,7 @@ void TextFieldDecorationElement::updateImage()
CachedImage* image;
if (hostInput()->disabled())
image = m_textFieldDecorator->imageForDisabledState();
else if (hostInput()->readOnly())
else if (hostInput()->isReadOnly())
image = m_textFieldDecorator->imageForReadonlyState();
else if (m_isInHoverState)
image = m_textFieldDecorator->imageForHoverState();
......
......@@ -82,7 +82,7 @@ static inline bool updateUserModifyProperty(Node* node, RenderStyle* style)
if (node->isElementNode()) {
Element* element = toElement(node);
isEnabled = element->isEnabledFormControl();
isReadOnlyControl = element->isTextFormControl() && toHTMLTextFormControlElement(element)->readOnly();
isReadOnlyControl = element->isTextFormControl() && toHTMLTextFormControlElement(element)->isReadOnly();
}
style->setUserModify((isReadOnlyControl || !isEnabled) ? READ_ONLY : READ_WRITE_PLAINTEXT_ONLY);
......
......@@ -1550,7 +1550,7 @@ bool RenderThemeMacShared::paintSearchFieldCancelButton(RenderObject* o, const P
NSSearchFieldCell* search = this->search();
if (input->isEnabledFormControl() && (input->isTextFormControl() && !static_cast<HTMLTextFormControlElement*>(input)->readOnly())) {
if (input->isEnabledFormControl() && (input->isTextFormControl() && !toHTMLTextFormControlElement(input)->isReadOnly())) {
updateActiveState([search cancelButtonCell], o);
updatePressedState([search cancelButtonCell], o);
}
......
2013-03-27 Kent Tamura <tkent@chromium.org>
Rename HTMLFormControlElement::readOnly to isReadOnly
https://bugs.webkit.org/show_bug.cgi?id=113297
Reviewed by Alexey Proskuryakov.
* src/WebFormControlElement.cpp:
(WebKit::WebFormControlElement::isReadOnly):
2013-03-26 Hayato Ito <hayato@chromium.org>
 
Allow ShadowContents in HitTests by default.
......
......@@ -46,7 +46,7 @@ bool WebFormControlElement::isEnabled() const
bool WebFormControlElement::isReadOnly() const
{
return constUnwrap<HTMLFormControlElement>()->readOnly();
return constUnwrap<HTMLFormControlElement>()->isReadOnly();
}
WebString WebFormControlElement::formControlName() const
......
2013-03-27 Kent Tamura <tkent@chromium.org>
Rename HTMLFormControlElement::readOnly to isReadOnly
https://bugs.webkit.org/show_bug.cgi?id=113297
Reviewed by Alexey Proskuryakov.
* DOMHTMLClasses.cpp:
(DOMHTMLInputElement::readOnly):
2013-03-26 Hayato Ito <hayato@chromium.org>
 
Allow ShadowContents in HitTests by default.
......
......@@ -1123,7 +1123,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::readOnly(
{
ASSERT(m_element && m_element->hasTagName(inputTag));
HTMLInputElement* inputElement = static_cast<HTMLInputElement*>(m_element);
*result = inputElement->readOnly() ? TRUE : FALSE;
*result = inputElement->isReadOnly() ? TRUE : FALSE;
return S_OK;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment