Changeset 111009 in webkit


Ignore:
Timestamp:
Mar 16, 2012 8:01:16 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[Forms] The "progress" element should not be a form-associated element.
https://bugs.webkit.org/show_bug.cgi?id=80240

Patch by Yoshifumi Inoue <yosin@chromium.org> on 2012-03-16
Reviewed by Kent Tamura.

Source/WebCore:

This patch changes base class of HTMLProgressElement to LabelableElement from
HTMLFormControlElement for saving memory space and iteration time of
extra "progress" elements in HTMLFormElement::m_formAssociatedElements
and matching the HTML5 specification for ease of maintenance.

Changes of TextIterator is lead by usage of isFormControlElement. This
changes will be replaced with more meaningful predicate as part of
https://bugs.webkit.org/show_bug.cgi?id=80381

No new tests. Update existing tests to cover this change.

  • css/CSSStyleSelector.cpp:

(WebCore::CSSStyleSelector::canShareStyleWithElement): Moved the "progress" element support code from canShareStyleWithControl.
(WebCore::CSSStyleSelector::canShareStyleWithControl):

  • css/SelectorChecker.cpp:

(WebCore::SelectorChecker::checkOneSelector): Remove isFormControlElement check for PseudoIndeterminate.

  • editing/TextIterator.cpp:

(WebCore::TextIterator::advance): Check HTMLProgressElement in addition to isFormControlElement. This change is for text dump in LayoutTests implemented by document.innerText attribute.

  • html/HTMLProgressElement.cpp: Remove unused include file.

(WebCore::HTMLProgressElement::HTMLProgressElement): Changed base class to LabelableElement.
(WebCore::HTMLProgressElement::create): Remove form paraprogress.
(WebCore::HTMLProgressElement::parseAttribute): Replace HTMLFormControlElement to LabelableElement.
(WebCore::HTMLProgressElement::attach): Replace HTMLFormControlElement to LabelableElement.

  • html/HTMLProgressElement.h:

(HTMLProgressElement):

  • html/HTMLProgressElement.idl: Remove the "form" attribute which isn't listed in the HTML5 specification.
  • html/HTMLTagNames.in: Remove "constructorNeedsFormElement" for not passing "form" parameter in HTMLElementFactory.

LayoutTests:

This patch changes tests for non-existent "form" attribute of the
"progress" element. The "form" attribute is available only for
form-associate elements. However, the "progress" element isn't.

  • fast/dom/HTMLProgressElement/progress-element-form-expected.txt: Update expectation for test output changes.
  • fast/dom/HTMLProgressElement/progress-element-form.html: Changed for the "progress" element doesn't have IDL attribute "form".
  • fast/forms/form-attribute-expected.txt: Update expectation for test output changes.
  • fast/forms/form-attribute.html: Removed lines for the "progress" element.
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r110996 r111009  
     12012-03-16  Yoshifumi Inoue  <yosin@chromium.org>
     2
     3        [Forms] The "progress" element should not be a form-associated element.
     4        https://bugs.webkit.org/show_bug.cgi?id=80240
     5
     6        Reviewed by Kent Tamura.
     7
     8        This patch changes tests for non-existent "form" attribute of the
     9        "progress" element. The "form" attribute is available only for
     10        form-associate elements. However, the "progress" element isn't.
     11
     12        * fast/dom/HTMLProgressElement/progress-element-form-expected.txt: Update expectation for test output changes.
     13        * fast/dom/HTMLProgressElement/progress-element-form.html: Changed for the "progress" element doesn't have IDL attribute "form".
     14        * fast/forms/form-attribute-expected.txt: Update expectation for test output changes.
     15        * fast/forms/form-attribute.html: Removed lines for the "progress" element.
     16
    1172012-03-16  Yoshifumi Inoue  <yosin@chromium.org>
    218
  • trunk/LayoutTests/fast/dom/HTMLProgressElement/progress-element-form-expected.txt

    r72976 r111009  
    11
    2 This test passes if the progress element can find its form.
     2This test passes if the progress element doesn't have form attribute.
    33PASS
  • trunk/LayoutTests/fast/dom/HTMLProgressElement/progress-element-form.html

    r72976 r111009  
    1010<progress id=progress1></progress>
    1111</form></table>
    12 <div>This test passes if the progress element can find its form.</div>
     12<div>This test passes if the progress element doesn't have form attribute.</div>
    1313<div id=console>FAIL</div>
    1414
    1515<script>
    16 if (document.getElementById('progress1').form.id == "form1")
     16if (document.getElementById('progress1').form === undefined)
    1717    document.getElementById('console').innerHTML = "PASS";
    1818</script>
  • trunk/LayoutTests/fast/forms/form-attribute-expected.txt

    r110996 r111009  
    1212PASS document.getElementsByTagName("object")[0].form is owner
    1313PASS document.getElementsByTagName("output")[0].form is owner
    14 PASS document.getElementsByTagName("progress")[0].form is owner
    1514PASS document.getElementsByTagName("select")[0].form is owner
    1615PASS document.getElementsByTagName("textarea")[0].form is owner
  • trunk/LayoutTests/fast/forms/form-attribute.html

    r110996 r111009  
    2222    '<object name=victim form=owner></object>' +
    2323    '<output name=victim form=owner />' +
    24     '<progress name=victim form=owner />' +
    2524    '<select name=victim form=owner />' +
    2625    '<textarea name=victim form=owner />';
     
    3433shouldBe('document.getElementsByTagName("object")[0].form', 'owner');
    3534shouldBe('document.getElementsByTagName("output")[0].form', 'owner');
    36 shouldBe('document.getElementsByTagName("progress")[0].form', 'owner');
    3735shouldBe('document.getElementsByTagName("select")[0].form', 'owner');
    3836shouldBe('document.getElementsByTagName("textarea")[0].form', 'owner');
  • trunk/Source/WebCore/ChangeLog

    r111008 r111009  
     12012-03-16  Yoshifumi Inoue  <yosin@chromium.org>
     2
     3        [Forms] The "progress" element should not be a form-associated element.
     4        https://bugs.webkit.org/show_bug.cgi?id=80240
     5
     6        Reviewed by Kent Tamura.
     7
     8        This patch changes base class of HTMLProgressElement to LabelableElement from
     9        HTMLFormControlElement for saving memory space and iteration time of
     10        extra "progress" elements in HTMLFormElement::m_formAssociatedElements
     11        and matching the HTML5 specification for ease of maintenance.
     12
     13        Changes of TextIterator is lead by usage of isFormControlElement. This
     14        changes will be replaced with more meaningful predicate as part of
     15        https://bugs.webkit.org/show_bug.cgi?id=80381
     16
     17        No new tests. Update existing tests to cover this change.
     18
     19        * css/CSSStyleSelector.cpp:
     20        (WebCore::CSSStyleSelector::canShareStyleWithElement): Moved the "progress" element support code from canShareStyleWithControl.
     21        (WebCore::CSSStyleSelector::canShareStyleWithControl):
     22        * css/SelectorChecker.cpp:
     23        (WebCore::SelectorChecker::checkOneSelector): Remove isFormControlElement check for PseudoIndeterminate.
     24        * editing/TextIterator.cpp:
     25        (WebCore::TextIterator::advance): Check HTMLProgressElement in addition to isFormControlElement. This change is for text dump in LayoutTests implemented by document.innerText attribute.
     26        * html/HTMLProgressElement.cpp: Remove unused include file.
     27        (WebCore::HTMLProgressElement::HTMLProgressElement): Changed base class to LabelableElement.
     28        (WebCore::HTMLProgressElement::create): Remove form paraprogress.
     29        (WebCore::HTMLProgressElement::parseAttribute): Replace HTMLFormControlElement to LabelableElement.
     30        (WebCore::HTMLProgressElement::attach): Replace HTMLFormControlElement to LabelableElement.
     31        * html/HTMLProgressElement.h:
     32        (HTMLProgressElement):
     33        * html/HTMLProgressElement.idl: Remove the "form" attribute which isn't listed in the HTML5 specification.
     34        * html/HTMLTagNames.in: Remove "constructorNeedsFormElement" for not passing "form" parameter in HTMLElementFactory.
     35
    1362012-03-16  Ilya Tikhonovsky  <loislo@chromium.org>
    237
  • trunk/Source/WebCore/css/CSSStyleSelector.cpp

    r110985 r111009  
    12081208bool CSSStyleSelector::canShareStyleWithControl(StyledElement* element) const
    12091209{
    1210 #if ENABLE(PROGRESS_TAG)
    1211     if (element->hasTagName(progressTag)) {
    1212         if (!m_element->hasTagName(progressTag))
    1213             return false;
    1214 
    1215         HTMLProgressElement* thisProgressElement = static_cast<HTMLProgressElement*>(element);
    1216         HTMLProgressElement* otherProgressElement = static_cast<HTMLProgressElement*>(m_element);
    1217         if (thisProgressElement->isDeterminate() != otherProgressElement->isDeterminate())
    1218             return false;
    1219 
    1220         return true;
    1221     }
    1222 #endif
    1223 
    12241210    HTMLInputElement* thisInputElement = element->toInputElement();
    12251211    HTMLInputElement* otherInputElement = m_element->toInputElement();
     
    13451331    if (element->hasScopedHTMLStyleChild())
    13461332        return false;
     1333#endif
     1334
     1335#if ENABLE(PROGRESS_TAG)
     1336    if (element->hasTagName(progressTag)) {
     1337        if (!m_element->hasTagName(progressTag))
     1338            return false;
     1339
     1340        HTMLProgressElement* thisProgressElement = static_cast<HTMLProgressElement*>(element);
     1341        HTMLProgressElement* otherProgressElement = static_cast<HTMLProgressElement*>(m_element);
     1342        if (thisProgressElement->isDeterminate() != otherProgressElement->isDeterminate())
     1343            return false;
     1344    }
    13471345#endif
    13481346
  • trunk/Source/WebCore/css/SelectorChecker.cpp

    r109884 r111009  
    10941094        case CSSSelector::PseudoIndeterminate:
    10951095            {
    1096                 if (!element || !element->isFormControlElement())
     1096                if (!element)
    10971097                    break;
    10981098#if ENABLE(PROGRESS_TAG)
  • trunk/Source/WebCore/editing/TextIterator.cpp

    r110927 r111009  
    397397                          (static_cast<Element*>(renderer->node())->isFormControlElement()
    398398                          || static_cast<Element*>(renderer->node())->hasTagName(legendTag)
    399                           || static_cast<Element*>(renderer->node())->hasTagName(meterTag)))))
     399                          || static_cast<Element*>(renderer->node())->hasTagName(meterTag)
     400                          || static_cast<Element*>(renderer->node())->hasTagName(progressTag)))))
    400401                    m_handledNode = handleReplacedElement();
    401402                else
  • trunk/Source/WebCore/html/HTMLProgressElement.cpp

    r108758 r111009  
    2626#include "EventNames.h"
    2727#include "ExceptionCode.h"
    28 #include "FormDataList.h"
    2928#include "NodeRenderingContext.h"
    3029#include "HTMLDivElement.h"
    31 #include "HTMLFormElement.h"
    3230#include "HTMLNames.h"
    3331#include "HTMLParserIdioms.h"
     
    4442const double HTMLProgressElement::InvalidPosition = -2;
    4543
    46 HTMLProgressElement::HTMLProgressElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
    47     : HTMLFormControlElement(tagName, document, form)
     44HTMLProgressElement::HTMLProgressElement(const QualifiedName& tagName, Document* document)
     45    : LabelableElement(tagName, document)
    4846{
    4947    ASSERT(hasTagName(progressTag));
     
    5452}
    5553
    56 PassRefPtr<HTMLProgressElement> HTMLProgressElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
     54PassRefPtr<HTMLProgressElement> HTMLProgressElement::create(const QualifiedName& tagName, Document* document)
    5755{
    58     RefPtr<HTMLProgressElement> progress = adoptRef(new HTMLProgressElement(tagName, document, form));
     56    RefPtr<HTMLProgressElement> progress = adoptRef(new HTMLProgressElement(tagName, document));
    5957    progress->createShadowSubtree();
    6058    return progress;
     
    7674}
    7775
    78 const AtomicString& HTMLProgressElement::formControlType() const
    79 {
    80     DEFINE_STATIC_LOCAL(const AtomicString, progress, ("progress"));
    81     return progress;
    82 }
    83 
    8476void HTMLProgressElement::parseAttribute(Attribute* attribute)
    8577{
     
    8981        didElementStateChange();
    9082    else
    91         HTMLFormControlElement::parseAttribute(attribute);
     83        LabelableElement::parseAttribute(attribute);
    9284}
    9385
    9486void HTMLProgressElement::attach()
    9587{
    96     HTMLFormControlElement::attach();
     88    LabelableElement::attach();
    9789    didElementStateChange();
    9890}
  • trunk/Source/WebCore/html/HTMLProgressElement.h

    r110927 r111009  
    2323
    2424#if ENABLE(PROGRESS_TAG)
    25 #include "HTMLFormControlElement.h"
     25#include "LabelableElement.h"
    2626
    2727namespace WebCore {
     
    2929class ProgressValueElement;
    3030
    31 class HTMLProgressElement : public HTMLFormControlElement {
     31class HTMLProgressElement : public LabelableElement {
    3232public:
    3333    static const double IndeterminatePosition;
    3434    static const double InvalidPosition;
    3535
    36     static PassRefPtr<HTMLProgressElement> create(const QualifiedName&, Document*, HTMLFormElement*);
     36    static PassRefPtr<HTMLProgressElement> create(const QualifiedName&, Document*);
    3737
    3838    double value() const;
     
    4949
    5050private:
    51     HTMLProgressElement(const QualifiedName&, Document*, HTMLFormElement*);
     51    HTMLProgressElement(const QualifiedName&, Document*);
    5252    virtual ~HTMLProgressElement();
    5353
     
    5555
    5656    virtual bool supportsFocus() const;
    57 
    58     virtual bool recalcWillValidate() const { return false; }
    59 
    60     virtual const AtomicString& formControlType() const;
    6157
    6258    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
  • trunk/Source/WebCore/html/HTMLProgressElement.idl

    r89269 r111009  
    2727                     setter raises(DOMException);
    2828        readonly attribute  double                position;
    29         readonly attribute  HTMLFormElement       form;
    3029        readonly attribute  NodeList              labels;
    3130    };
  • trunk/Source/WebCore/html/HTMLTagNames.in

    r110927 r111009  
    100100plaintext interfaceName=HTMLElement
    101101pre
    102 progress interfaceName=HTMLProgressElement, constructorNeedsFormElement, conditional=PROGRESS_TAG
     102progress interfaceName=HTMLProgressElement, conditional=PROGRESS_TAG
    103103q interfaceName=HTMLQuoteElement
    104104rp interfaceName=HTMLElement
Note: See TracChangeset for help on using the changeset viewer.