Skip to content
  • tkent@chromium.org's avatar
    maxLength should not be applied to non-text types · a0c6424e
    tkent@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=42814
    
    Reviewed by Darin Adler.
    
    WebCore:
    
    According to the HTML5 specification, maxLength attribute should
    be applied to text, search, url, tel, email, and password types.
    
    Test: fast/forms/input-maxlength-unsupported.html
    
    * dom/InputElement.cpp:
    (WebCore::InputElement::handleBeforeTextInsertedEvent):
     Apply maxLength() only if supportsMaxLength() is true.
    * dom/InputElement.h:
    * html/HTMLInputElement.cpp:
    (WebCore::HTMLInputElement::patternMismatch):
     Code cleanup by isTextType().
    (WebCore::HTMLInputElement::tooLong):
     ditto.
    (WebCore::HTMLInputElement::isTextType):
     Added. This returns true for types with maxLength/pattern/placeholder.
    * html/HTMLInputElement.h:
    (WebCore::HTMLInputElement::supportsMaxLength):
     Added. Just calls isTextType().
    (WebCore::HTMLInputElement::supportsPlaceholder):
     Code cleanup by isTextType().
    * wml/WMLInputElement.h:
    (WebCore::WMLInputElement::supportsMaxLength):
     Added. Always returns true.
    
    LayoutTests:
    
    * fast/forms/input-maxlength-unsupported-expected.txt: Added.
    * fast/forms/input-maxlength-unsupported.html: Added.
    * fast/forms/script-tests/input-maxlength-unsupported.js: Added.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63942 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    a0c6424e