Commit 6e55fa23 authored by eric@webkit.org's avatar eric@webkit.org
Browse files

2009-11-18 Daniel Bates <dbates@webkit.org>

        Reviewed by Darin Adler.

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

        Renames RenderTextControl::m_edited and RenderTextControl::m_userEdited to
        m_wasChangedSinceLastChangeEvent and m_lastChangeWasUserEdit, respectively.
        These are more descriptive names so as to clear an ambiguity surrounding
        their usage. Also, renames associated setters and getters so that they
        coincide with the renamed fields.

        No functionality was changed. So, no tests were included.

        * bindings/objc/DOMHTML.mm:
        (-[DOMHTMLInputElement _isEdited]):
        (-[DOMHTMLTextAreaElement _isEdited]):
        * dom/Document.cpp:
        (WebCore::Document::setFocusedNode):
        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::defaultEventHandler):
        * rendering/RenderTextControl.cpp:
        (WebCore::RenderTextControl::RenderTextControl):
        (WebCore::RenderTextControl::setInnerTextValue):
        (WebCore::RenderTextControl::setLastChangeWasUserEdit): Formerly named setUserEdited.
        (WebCore::RenderTextControl::subtreeHasChanged):
        * rendering/RenderTextControl.h:
        (WebCore::RenderTextControl::wasChangedSinceLastChangeEvent): Formerly named isEdited.
        (WebCore::RenderTextControl::setChangedSinceLastChangeEvent): Formerly named setEdited.
        (WebCore::RenderTextControl::lastChangeWasUserEdit): Formerly named setUserEdited.
        * rendering/RenderTextControlSingleLine.cpp:
        (WebCore::RenderTextControlSingleLine::subtreeHasChanged):
        * wml/WMLInputElement.cpp:
        (WebCore::WMLInputElement::defaultEventHandler):
2009-11-18  Daniel Bates  <dbates@webkit.org>

        Reviewed by Darin Adler.

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

        Changes associated with renaming RenderTextControl::isUserEdited.

        * DOMHTMLClasses.cpp:
        (DOMHTMLInputElement::isUserEdited): Formerly named isUserEdited.
        (DOMHTMLTextAreaElement::isUserEdited): Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51148 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 64a6d422
2009-11-18 Daniel Bates <dbates@webkit.org>
Reviewed by Darin Adler.
https://bugs.webkit.org/show_bug.cgi?id=31186
Renames RenderTextControl::m_edited and RenderTextControl::m_userEdited to
m_wasChangedSinceLastChangeEvent and m_lastChangeWasUserEdit, respectively.
These are more descriptive names so as to clear an ambiguity surrounding
their usage. Also, renames associated setters and getters so that they
coincide with the renamed fields.
No functionality was changed. So, no tests were included.
* bindings/objc/DOMHTML.mm:
(-[DOMHTMLInputElement _isEdited]):
(-[DOMHTMLTextAreaElement _isEdited]):
* dom/Document.cpp:
(WebCore::Document::setFocusedNode):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::defaultEventHandler):
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::RenderTextControl):
(WebCore::RenderTextControl::setInnerTextValue):
(WebCore::RenderTextControl::setLastChangeWasUserEdit): Formerly named setUserEdited.
(WebCore::RenderTextControl::subtreeHasChanged):
* rendering/RenderTextControl.h:
(WebCore::RenderTextControl::wasChangedSinceLastChangeEvent): Formerly named isEdited.
(WebCore::RenderTextControl::setChangedSinceLastChangeEvent): Formerly named setEdited.
(WebCore::RenderTextControl::lastChangeWasUserEdit): Formerly named setUserEdited.
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::subtreeHasChanged):
* wml/WMLInputElement.cpp:
(WebCore::WMLInputElement::defaultEventHandler):
2009-11-18 Tony Chang <tony@chromium.org>
 
Reviewed by Adam Barth.
......@@ -167,7 +167,7 @@
- (BOOL)_isEdited
{
WebCore::RenderObject *renderer = core(self)->renderer();
return renderer && [self _isTextField] && static_cast<WebCore::RenderTextControl *>(renderer)->isUserEdited();
return renderer && [self _isTextField] && static_cast<WebCore::RenderTextControl *>(renderer)->lastChangeWasUserEdit();
}
@end
......@@ -177,7 +177,7 @@
- (BOOL)_isEdited
{
WebCore::RenderObject* renderer = core(self)->renderer();
return renderer && static_cast<WebCore::RenderTextControl*>(renderer)->isUserEdited();
return renderer && static_cast<WebCore::RenderTextControl*>(renderer)->lastChangeWasUserEdit();
}
@end
......
......@@ -2655,11 +2655,11 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode)
// Dispatch a change event for text fields or textareas that have been edited
RenderObject* r = oldFocusedNode->renderer();
if (r && r->isTextControl() && toRenderTextControl(r)->isEdited()) {
if (r && r->isTextControl() && toRenderTextControl(r)->wasChangedSinceLastChangeEvent()) {
oldFocusedNode->dispatchEvent(Event::create(eventNames().changeEvent, true, false));
r = oldFocusedNode->renderer();
if (r && r->isTextControl())
toRenderTextControl(r)->setEdited(false);
toRenderTextControl(r)->setChangedSinceLastChangeEvent(false);
}
// Dispatch the blur event and let the node do any other blur related activities (important for text fields)
......
......@@ -1584,12 +1584,12 @@ void HTMLInputElement::defaultEventHandler(Event* evt)
}
// Fire onChange for text fields.
RenderObject* r = renderer();
if (r && r->isTextField() && toRenderTextControl(r)->isEdited()) {
if (r && r->isTextField() && toRenderTextControl(r)->wasChangedSinceLastChangeEvent()) {
dispatchFormControlChangeEvent();
// Refetch the renderer since arbitrary JS code run during onchange can do anything, including destroying it.
r = renderer();
if (r && r->isTextField())
toRenderTextControl(r)->setEdited(false);
toRenderTextControl(r)->setChangedSinceLastChangeEvent(false);
}
RefPtr<HTMLFormElement> formForSubmission = form();
......
......@@ -70,8 +70,8 @@ static Color disabledTextColor(const Color& textColor, const Color& backgroundCo
RenderTextControl::RenderTextControl(Node* node, bool placeholderVisible)
: RenderBlock(node)
, m_placeholderVisible(placeholderVisible)
, m_edited(false)
, m_userEdited(false)
, m_wasChangedSinceLastChangeEvent(false)
, m_lastChangeWasUserEdit(false)
{
}
......@@ -195,17 +195,17 @@ void RenderTextControl::setInnerTextValue(const String& innerTextValue)
ASSERT(!ec);
}
// We set m_userEdited to false since this change was not explicty made by the user (say, via typing on the keyboard), see <rdar://problem/5359921>.
m_userEdited = false;
// We set m_lastChangeWasUserEdit to false since this change was not explicty made by the user (say, via typing on the keyboard), see <rdar://problem/5359921>.
m_lastChangeWasUserEdit = false;
}
static_cast<Element*>(node())->setFormControlValueMatchesRenderer(true);
}
void RenderTextControl::setUserEdited(bool isUserEdited)
void RenderTextControl::setLastChangeWasUserEdit(bool lastChangeWasUserEdit)
{
m_userEdited = isUserEdited;
document()->setIgnoreAutofocus(isUserEdited);
m_lastChangeWasUserEdit = lastChangeWasUserEdit;
document()->setIgnoreAutofocus(lastChangeWasUserEdit);
}
int RenderTextControl::selectionStart()
......@@ -312,8 +312,8 @@ int RenderTextControl::indexForVisiblePosition(const VisiblePosition& pos)
void RenderTextControl::subtreeHasChanged()
{
m_edited = true;
m_userEdited = true;
m_wasChangedSinceLastChangeEvent = true;
m_lastChangeWasUserEdit = true;
}
String RenderTextControl::finishText(Vector<UChar>& result) const
......
......@@ -34,11 +34,11 @@ class RenderTextControl : public RenderBlock {
public:
virtual ~RenderTextControl();
bool isEdited() const { return m_edited; }
void setEdited(bool isEdited) { m_edited = isEdited; }
bool wasChangedSinceLastChangeEvent() const { return m_wasChangedSinceLastChangeEvent; }
void setChangedSinceLastChangeEvent(bool wasChangedSinceLastChangeEvent) { m_wasChangedSinceLastChangeEvent = wasChangedSinceLastChangeEvent; }
bool isUserEdited() const { return m_userEdited; }
void setUserEdited(bool isUserEdited);
bool lastChangeWasUserEdit() const { return m_lastChangeWasUserEdit; }
void setLastChangeWasUserEdit(bool lastChangeWasUserEdit);
int selectionStart();
int selectionEnd();
......@@ -105,8 +105,8 @@ private:
String finishText(Vector<UChar>&) const;
bool m_edited;
bool m_userEdited;
bool m_wasChangedSinceLastChangeEvent;
bool m_lastChangeWasUserEdit;
RefPtr<TextControlInnerTextElement> m_innerText;
};
......
......@@ -150,7 +150,7 @@ void RenderTextControlSingleLine::hidePopup()
void RenderTextControlSingleLine::subtreeHasChanged()
{
bool wasEdited = isEdited();
bool wasChanged = wasChangedSinceLastChangeEvent();
RenderTextControl::subtreeHasChanged();
InputElement* input = inputElement();
......@@ -167,7 +167,7 @@ void RenderTextControlSingleLine::subtreeHasChanged()
if (input->searchEventsShouldBeDispatched())
startSearchEventTimer();
if (!wasEdited && node()->focused()) {
if (!wasChanged && node()->focused()) {
if (Frame* frame = document()->frame())
frame->textFieldDidBeginEditing(static_cast<Element*>(node()));
}
......
......@@ -280,13 +280,13 @@ void WMLInputElement::defaultEventHandler(Event* evt)
if (clickDefaultFormButton) {
// Fire onChange for text fields.
RenderObject* r = renderer();
if (r && toRenderTextControl(r)->isEdited()) {
if (r && toRenderTextControl(r)->wasChangedSinceLastChangeEvent()) {
dispatchEvent(eventNames().changeEvent, true, false);
// Refetch the renderer since arbitrary JS code run during onchange can do anything, including destroying it.
r = renderer();
if (r)
toRenderTextControl(r)->setEdited(false);
toRenderTextControl(r)->setChangedSinceLastChangeEvent(false);
}
evt->setDefaultHandled();
......
2009-11-18 Daniel Bates <dbates@webkit.org>
Reviewed by Darin Adler.
https://bugs.webkit.org/show_bug.cgi?id=31186
Changes associated with renaming RenderTextControl::isUserEdited.
* DOMHTMLClasses.cpp:
(DOMHTMLInputElement::isUserEdited): Formerly named isUserEdited.
(DOMHTMLTextAreaElement::isUserEdited): Ditto.
2009-11-12 Jon Honeycutt <jhoneycutt@apple.com>
Implement DOMHTMLInputElement::replaceCharactersInRange().
......
......@@ -1361,7 +1361,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLInputElement::isUserEdited(
if (FAILED(isTextField(&textField)) || !textField)
return S_OK;
RenderObject* renderer = m_element->renderer();
if (renderer && toRenderTextControl(renderer)->isUserEdited())
if (renderer && toRenderTextControl(renderer)->lastChangeWasUserEdit())
*result = TRUE;
return S_OK;
}
......@@ -1558,7 +1558,7 @@ HRESULT STDMETHODCALLTYPE DOMHTMLTextAreaElement::isUserEdited(
*result = FALSE;
ASSERT(m_element);
RenderObject* renderer = m_element->renderer();
if (renderer && toRenderTextControl(renderer)->isUserEdited())
if (renderer && toRenderTextControl(renderer)->lastChangeWasUserEdit())
*result = TRUE;
return S_OK;
}
Supports Markdown
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