Changeset 59645 in webkit


Ignore:
Timestamp:
May 17, 2010 8:57:06 PM (14 years ago)
Author:
tkent@chromium.org
Message:

':valid' CSS selector should not be applied to some form controls
https://bugs.webkit.org/show_bug.cgi?id=39162

Reviewed by Darin Adler.

WebCore:

  • html/HTMLElement.cpp:

(WebCore::inlineTagList): Always includes progressTag. This change is
needed in a case of no ENABLE_PROGRESS_TAG. Without this change and
ENABLE_PROGRESS_TAG, <progress> tags disappear.

  • html/HTMLInputElement.cpp:

(WebCore::HTMLInputElement::recalcWillValidate):

Return false for SUBMIT and IMAGE.

  • html/HTMLProgressElement.h:

(WebCore::HTMLProgressElement::recalcWillValidate):

Return false. This change is needed in a case of ENABLE_PROGRESS_TAG.

LayoutTests:

Add test cases for

  • <input type=submit>
  • <input type=image>
  • <progress>
  • <meter>
  • fast/css/pseudo-valid-unapplied-expected.txt:
  • fast/css/pseudo-valid-unapplied.html:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r59638 r59645  
     12010-05-17  Kent Tamura  <tkent@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        ':valid' CSS selector should not be applied to some form controls
     6        https://bugs.webkit.org/show_bug.cgi?id=39162
     7
     8        Add test cases for
     9         - <input type=submit>
     10         - <input type=image>
     11         - <progress>
     12         - <meter>
     13
     14        * fast/css/pseudo-valid-unapplied-expected.txt:
     15        * fast/css/pseudo-valid-unapplied.html:
     16
    1172010-05-17  Adam Barth  <abarth@webkit.org>
    218
  • trunk/LayoutTests/fast/css/pseudo-valid-unapplied-expected.txt

    r59153 r59645  
    99PASS getBackgroundColor('input-reset') is normalColor
    1010PASS getBackgroundColor('input-hidden') is normalColor
     11PASS getBackgroundColor('input-submit') is normalColor
     12PASS getBackgroundColor('input-image') is normalColor
    1113PASS getBackgroundColor('fieldset') is normalColor
    1214PASS getBackgroundColor('object') is normalColor
    1315PASS getBackgroundColor('button') is normalColor
     16PASS getBackgroundColor('progress') is normalColor
     17PASS getBackgroundColor('meter') is normalColor
    1418PASS successfullyParsed is true
    1519
  • trunk/LayoutTests/fast/css/pseudo-valid-unapplied.html

    r59153 r59645  
    1111 object { background: lime; }
    1212 button { background: lime; }
     13 progress { background: lime; }
     14 meter { background: lime; }
    1315</style>
    1416</head>
     
    2123<input name="input-reset" type="reset" value="Lorem ipsum"/>
    2224<input name="input-hidden" type="hidden" value="Lorem ipsum"/>
     25<input name="input-submit" type="submit">
     26<input name="input-image" type="image">
    2327<fieldset name="fieldset"></fieldset>
    2428<object name="object"></object>
    2529<button name="button">Lorem ipsum</button>
     30<progress id="progress" value=50 max=100>50</progress>
     31<meter id="meter" value=50 max=100>50</meter>
    2632</form>
    2733<div id="console"></div>
     
    2935description("This test performs a check for the :valid CSS selector on various input elements and other elements where it shouldn't be applied.");
    3036
    31 function getBackgroundColor(elementName) {
    32     var element = document.getElementsByName(elementName)[0];
     37function getBackgroundColor(nameOrId) {
     38    var list = document.getElementsByName(nameOrId);
     39    var element = list.length > 0 ? list[0] : document.getElementById(nameOrId);
    3340    return document.defaultView.getComputedStyle(element, null).getPropertyValue('background-color')
    3441}
     
    4047    "input-reset",
    4148    "input-hidden",
     49    "input-submit",
     50    "input-image",
    4251    "fieldset",
    4352    "object",
    4453    "button",
     54    "progress",
     55    "meter",
    4556];
    4657
  • trunk/WebCore/ChangeLog

    r59644 r59645  
     12010-05-17  Kent Tamura  <tkent@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        ':valid' CSS selector should not be applied to some form controls
     6        https://bugs.webkit.org/show_bug.cgi?id=39162
     7
     8        * html/HTMLElement.cpp:
     9        (WebCore::inlineTagList): Always includes progressTag. This change is
     10        needed in a case of no ENABLE_PROGRESS_TAG. Without this change and
     11        ENABLE_PROGRESS_TAG, <progress> tags disappear.
     12        * html/HTMLInputElement.cpp:
     13        (WebCore::HTMLInputElement::recalcWillValidate):
     14          Return false for SUBMIT and IMAGE.
     15        * html/HTMLProgressElement.h:
     16        (WebCore::HTMLProgressElement::recalcWillValidate):
     17          Return false. This change is needed in a case of ENABLE_PROGRESS_TAG.
     18
    1192010-05-17  Adam Barth  <abarth@webkit.org>
    220
  • trunk/WebCore/html/HTMLElement.cpp

    r59541 r59645  
    859859        tagList.add(rtTag.localName().impl());
    860860        tagList.add(rubyTag.localName().impl());
    861 #if ENABLE(PROGRESS_TAG)
    862861        tagList.add(progressTag.localName().impl());
    863 #endif
    864862        tagList.add(meterTag.localName().impl());
    865863    }
  • trunk/WebCore/html/HTMLInputElement.cpp

    r59472 r59645  
    26352635bool HTMLInputElement::recalcWillValidate() const
    26362636{
    2637     return HTMLFormControlElementWithState::recalcWillValidate()
    2638         && inputType() != HIDDEN && inputType() != BUTTON && inputType() != RESET;
     2637    switch (inputType()) {
     2638    case CHECKBOX:
     2639    case COLOR:
     2640    case DATE:
     2641    case DATETIME:
     2642    case DATETIMELOCAL:
     2643    case EMAIL:
     2644    case FILE:
     2645    case ISINDEX:
     2646    case MONTH:
     2647    case NUMBER:
     2648    case PASSWORD:
     2649    case RADIO:
     2650    case RANGE:
     2651    case SEARCH:
     2652    case TELEPHONE:
     2653    case TEXT:
     2654    case TIME:
     2655    case URL:
     2656    case WEEK:
     2657        return HTMLFormControlElementWithState::recalcWillValidate();
     2658    case BUTTON:
     2659    case HIDDEN:
     2660    case IMAGE:
     2661    case RESET:
     2662    case SUBMIT:
     2663        return false;
     2664    }
     2665    ASSERT_NOT_REACHED();
     2666    return false;
    26392667}
    26402668
  • trunk/WebCore/html/HTMLProgressElement.h

    r58687 r59645  
    4242    HTMLProgressElement(const QualifiedName&, Document*, HTMLFormElement*);
    4343
     44    virtual bool recalcWillValidate() const { return false; }
    4445    virtual bool isOptionalFormControl() const { return true; }
    4546
Note: See TracChangeset for help on using the changeset viewer.