2011-05-19 Kent Tamura <tkent@chromium.org>
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 May 2011 09:50:07 +0000 (09:50 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 May 2011 09:50:07 +0000 (09:50 +0000)
commita57ae2d24bae648a36506b01834e9fe6cb32bbe6
tree9ce672b63735c10e0175c3bc095aa0795b6fb958
parenteae60e23703a9208e5c84718b08ff5c47e50c20c
2011-05-19  Kent Tamura  <tkent@chromium.org>

        Reviewed by Hajime Morita.

        tooLong validity should not be true for a value set by a script
        https://bugs.webkit.org/show_bug.cgi?id=60948

        Update existing tests for the new behavior.

        * fast/forms/ValidityState-tooLong-input-expected.txt:
        * fast/forms/ValidityState-tooLong-textarea-expected.txt:
        * fast/forms/resources/textarea-live-pseudo-selectors.js:
        * fast/forms/script-tests/ValidityState-tooLong-input.js:
        * fast/forms/script-tests/ValidityState-tooLong-textarea.js:
2011-05-19  Kent Tamura  <tkent@chromium.org>

        Reviewed by Hajime Morita.

        tooLong validity should not be true for a value set by a script
        https://bugs.webkit.org/show_bug.cgi?id=60948

        The specification has been updated so that tooLong should be true only
        for user-edit values.

        Introduce m_wasModifiedByUser flag to HTMLInputElement and
        HTMLTextAreaElemnt. It is set to true when a renderer updates the
        value, and is cleared when the value is updated by others.

        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::HTMLInputElement):
          Initialize m_wasModifiedByUser.
        (WebCore::HTMLInputElement::tooLong):
          Skip the check if m_wasModifiedByUser is false.
        (WebCore::HTMLInputElement::updateType): Clear m_wasModifiedByUser.
        (WebCore::HTMLInputElement::copyNonAttributeProperties):
        (WebCore::HTMLInputElement::setValue): If sendChange is true,
          m_wasModifiedByUser should be true because sendChange is set in a case
          of form auto-fill.  We assume a value set by form auto-fill is a kind
          of user-edit.
        (WebCore::HTMLInputElement::setValueFromRenderer):
          m_wasModifiedByUser should be true for the update by a renderer.
        * html/HTMLInputElement.h: Declare m_wasModifiedByUser.
        * html/HTMLTextAreaElement.cpp:
        (WebCore::HTMLTextAreaElement::HTMLTextAreaElement):
          Initialize m_wasModifiedByUser.
        (WebCore::HTMLTextAreaElement::updateValue):
          m_wasModifiedByUser should be true for the update by a renderer.
        (WebCore::HTMLTextAreaElement::setValueCommon): Clear m_wasModifiedByUser.
        (WebCore::HTMLTextAreaElement::tooLong):
          Skip the check if m_wasModifiedByUser is false.
        * html/HTMLTextAreaElement.h: Declare m_wasModifiedByUser.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86832 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/forms/ValidityState-tooLong-input-expected.txt
LayoutTests/fast/forms/ValidityState-tooLong-textarea-expected.txt
LayoutTests/fast/forms/resources/textarea-live-pseudo-selectors.js
LayoutTests/fast/forms/script-tests/ValidityState-tooLong-input.js
LayoutTests/fast/forms/script-tests/ValidityState-tooLong-textarea.js
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/html/HTMLTextAreaElement.cpp
Source/WebCore/html/HTMLTextAreaElement.h