Title: [111009] trunk
Revision
111009
Author
[email protected]
Date
2012-03-16 08:01:16 -0700 (Fri, 16 Mar 2012)

Log 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 <[email protected]> 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.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (111008 => 111009)


--- trunk/LayoutTests/ChangeLog	2012-03-16 14:54:09 UTC (rev 111008)
+++ trunk/LayoutTests/ChangeLog	2012-03-16 15:01:16 UTC (rev 111009)
@@ -1,5 +1,21 @@
 2012-03-16  Yoshifumi Inoue  <[email protected]>
 
+        [Forms] The "progress" element should not be a form-associated element.
+        https://bugs.webkit.org/show_bug.cgi?id=80240
+
+        Reviewed by Kent Tamura.
+
+        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.
+
+2012-03-16  Yoshifumi Inoue  <[email protected]>
+
         [Forms] label.form attribute doesn't work
         https://bugs.webkit.org/show_bug.cgi?id=80499
 

Modified: trunk/LayoutTests/fast/dom/HTMLProgressElement/progress-element-form-expected.txt (111008 => 111009)


--- trunk/LayoutTests/fast/dom/HTMLProgressElement/progress-element-form-expected.txt	2012-03-16 14:54:09 UTC (rev 111008)
+++ trunk/LayoutTests/fast/dom/HTMLProgressElement/progress-element-form-expected.txt	2012-03-16 15:01:16 UTC (rev 111009)
@@ -1,3 +1,3 @@
 
-This test passes if the progress element can find its form.
+This test passes if the progress element doesn't have form attribute.
 PASS

Modified: trunk/LayoutTests/fast/dom/HTMLProgressElement/progress-element-form.html (111008 => 111009)


--- trunk/LayoutTests/fast/dom/HTMLProgressElement/progress-element-form.html	2012-03-16 14:54:09 UTC (rev 111008)
+++ trunk/LayoutTests/fast/dom/HTMLProgressElement/progress-element-form.html	2012-03-16 15:01:16 UTC (rev 111009)
@@ -9,11 +9,11 @@
 <table><form id=form1>
 <progress id=progress1></progress>
 </form></table>
-<div>This test passes if the progress element can find its form.</div>
+<div>This test passes if the progress element doesn't have form attribute.</div>
 <div id=console>FAIL</div>
 
 <script>
-if (document.getElementById('progress1').form.id == "form1")
+if (document.getElementById('progress1').form === undefined)
     document.getElementById('console').innerHTML = "PASS";
 </script>
 </body>

Modified: trunk/LayoutTests/fast/forms/form-attribute-expected.txt (111008 => 111009)


--- trunk/LayoutTests/fast/forms/form-attribute-expected.txt	2012-03-16 14:54:09 UTC (rev 111008)
+++ trunk/LayoutTests/fast/forms/form-attribute-expected.txt	2012-03-16 15:01:16 UTC (rev 111009)
@@ -11,7 +11,6 @@
 PASS document.getElementsByTagName("label")[0].form is owner
 PASS document.getElementsByTagName("object")[0].form is owner
 PASS document.getElementsByTagName("output")[0].form is owner
-PASS document.getElementsByTagName("progress")[0].form is owner
 PASS document.getElementsByTagName("select")[0].form is owner
 PASS document.getElementsByTagName("textarea")[0].form is owner
 

Modified: trunk/LayoutTests/fast/forms/form-attribute.html (111008 => 111009)


--- trunk/LayoutTests/fast/forms/form-attribute.html	2012-03-16 14:54:09 UTC (rev 111008)
+++ trunk/LayoutTests/fast/forms/form-attribute.html	2012-03-16 15:01:16 UTC (rev 111009)
@@ -21,7 +21,6 @@
     '<label name=victim form=owner />' +
     '<object name=victim form=owner></object>' +
     '<output name=victim form=owner />' +
-    '<progress name=victim form=owner />' +
     '<select name=victim form=owner />' +
     '<textarea name=victim form=owner />';
 
@@ -33,7 +32,6 @@
 shouldBe('document.getElementsByTagName("label")[0].form', 'owner');
 shouldBe('document.getElementsByTagName("object")[0].form', 'owner');
 shouldBe('document.getElementsByTagName("output")[0].form', 'owner');
-shouldBe('document.getElementsByTagName("progress")[0].form', 'owner');
 shouldBe('document.getElementsByTagName("select")[0].form', 'owner');
 shouldBe('document.getElementsByTagName("textarea")[0].form', 'owner');
 

Modified: trunk/Source/WebCore/ChangeLog (111008 => 111009)


--- trunk/Source/WebCore/ChangeLog	2012-03-16 14:54:09 UTC (rev 111008)
+++ trunk/Source/WebCore/ChangeLog	2012-03-16 15:01:16 UTC (rev 111009)
@@ -1,3 +1,38 @@
+2012-03-16  Yoshifumi Inoue  <[email protected]>
+
+        [Forms] The "progress" element should not be a form-associated element.
+        https://bugs.webkit.org/show_bug.cgi?id=80240
+
+        Reviewed by Kent Tamura.
+
+        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.
+
 2012-03-16  Ilya Tikhonovsky  <[email protected]>
 
         Web Inspector: Heap Snapshot: Unreviewed single line fix for isWindow getter.

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (111008 => 111009)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2012-03-16 14:54:09 UTC (rev 111008)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2012-03-16 15:01:16 UTC (rev 111009)
@@ -1207,20 +1207,6 @@
 
 bool CSSStyleSelector::canShareStyleWithControl(StyledElement* element) const
 {
-#if ENABLE(PROGRESS_TAG)
-    if (element->hasTagName(progressTag)) {
-        if (!m_element->hasTagName(progressTag))
-            return false;
-
-        HTMLProgressElement* thisProgressElement = static_cast<HTMLProgressElement*>(element);
-        HTMLProgressElement* otherProgressElement = static_cast<HTMLProgressElement*>(m_element);
-        if (thisProgressElement->isDeterminate() != otherProgressElement->isDeterminate())
-            return false;
-
-        return true;
-    }
-#endif
-
     HTMLInputElement* thisInputElement = element->toInputElement();
     HTMLInputElement* otherInputElement = m_element->toInputElement();
 
@@ -1346,6 +1332,18 @@
         return false;
 #endif
 
+#if ENABLE(PROGRESS_TAG)
+    if (element->hasTagName(progressTag)) {
+        if (!m_element->hasTagName(progressTag))
+            return false;
+
+        HTMLProgressElement* thisProgressElement = static_cast<HTMLProgressElement*>(element);
+        HTMLProgressElement* otherProgressElement = static_cast<HTMLProgressElement*>(m_element);
+        if (thisProgressElement->isDeterminate() != otherProgressElement->isDeterminate())
+            return false;
+    }
+#endif
+
     bool isControl = element->isFormControlElement();
 
     if (isControl != m_element->isFormControlElement())

Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (111008 => 111009)


--- trunk/Source/WebCore/css/SelectorChecker.cpp	2012-03-16 14:54:09 UTC (rev 111008)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp	2012-03-16 15:01:16 UTC (rev 111009)
@@ -1093,7 +1093,7 @@
             }
         case CSSSelector::PseudoIndeterminate:
             {
-                if (!element || !element->isFormControlElement())
+                if (!element)
                     break;
 #if ENABLE(PROGRESS_TAG)
                 if (element->hasTagName(progressTag)) {

Modified: trunk/Source/WebCore/editing/TextIterator.cpp (111008 => 111009)


--- trunk/Source/WebCore/editing/TextIterator.cpp	2012-03-16 14:54:09 UTC (rev 111008)
+++ trunk/Source/WebCore/editing/TextIterator.cpp	2012-03-16 15:01:16 UTC (rev 111009)
@@ -396,7 +396,8 @@
                          (renderer->node() && renderer->node()->isElementNode() &&
                           (static_cast<Element*>(renderer->node())->isFormControlElement()
                           || static_cast<Element*>(renderer->node())->hasTagName(legendTag)
-                          || static_cast<Element*>(renderer->node())->hasTagName(meterTag)))))
+                          || static_cast<Element*>(renderer->node())->hasTagName(meterTag)
+                          || static_cast<Element*>(renderer->node())->hasTagName(progressTag)))))
                     m_handledNode = handleReplacedElement();
                 else
                     m_handledNode = handleNonTextNode();

Modified: trunk/Source/WebCore/html/HTMLProgressElement.cpp (111008 => 111009)


--- trunk/Source/WebCore/html/HTMLProgressElement.cpp	2012-03-16 14:54:09 UTC (rev 111008)
+++ trunk/Source/WebCore/html/HTMLProgressElement.cpp	2012-03-16 15:01:16 UTC (rev 111009)
@@ -25,10 +25,8 @@
 #include "Attribute.h"
 #include "EventNames.h"
 #include "ExceptionCode.h"
-#include "FormDataList.h"
 #include "NodeRenderingContext.h"
 #include "HTMLDivElement.h"
-#include "HTMLFormElement.h"
 #include "HTMLNames.h"
 #include "HTMLParserIdioms.h"
 #include "ProgressShadowElement.h"
@@ -43,8 +41,8 @@
 const double HTMLProgressElement::IndeterminatePosition = -1;
 const double HTMLProgressElement::InvalidPosition = -2;
 
-HTMLProgressElement::HTMLProgressElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
-    : HTMLFormControlElement(tagName, document, form)
+HTMLProgressElement::HTMLProgressElement(const QualifiedName& tagName, Document* document)
+    : LabelableElement(tagName, document)
 {
     ASSERT(hasTagName(progressTag));
 }
@@ -53,9 +51,9 @@
 {
 }
 
-PassRefPtr<HTMLProgressElement> HTMLProgressElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
+PassRefPtr<HTMLProgressElement> HTMLProgressElement::create(const QualifiedName& tagName, Document* document)
 {
-    RefPtr<HTMLProgressElement> progress = adoptRef(new HTMLProgressElement(tagName, document, form));
+    RefPtr<HTMLProgressElement> progress = adoptRef(new HTMLProgressElement(tagName, document));
     progress->createShadowSubtree();
     return progress;
 }
@@ -75,12 +73,6 @@
     return Node::supportsFocus() && !disabled();
 }
 
-const AtomicString& HTMLProgressElement::formControlType() const
-{
-    DEFINE_STATIC_LOCAL(const AtomicString, progress, ("progress"));
-    return progress;
-}
-
 void HTMLProgressElement::parseAttribute(Attribute* attribute)
 {
     if (attribute->name() == valueAttr)
@@ -88,12 +80,12 @@
     else if (attribute->name() == maxAttr)
         didElementStateChange();
     else
-        HTMLFormControlElement::parseAttribute(attribute);
+        LabelableElement::parseAttribute(attribute);
 }
 
 void HTMLProgressElement::attach()
 {
-    HTMLFormControlElement::attach();
+    LabelableElement::attach();
     didElementStateChange();
 }
 

Modified: trunk/Source/WebCore/html/HTMLProgressElement.h (111008 => 111009)


--- trunk/Source/WebCore/html/HTMLProgressElement.h	2012-03-16 14:54:09 UTC (rev 111008)
+++ trunk/Source/WebCore/html/HTMLProgressElement.h	2012-03-16 15:01:16 UTC (rev 111009)
@@ -22,18 +22,18 @@
 #define HTMLProgressElement_h
 
 #if ENABLE(PROGRESS_TAG)
-#include "HTMLFormControlElement.h"
+#include "LabelableElement.h"
 
 namespace WebCore {
 
 class ProgressValueElement;
 
-class HTMLProgressElement : public HTMLFormControlElement {
+class HTMLProgressElement : public LabelableElement {
 public:
     static const double IndeterminatePosition;
     static const double InvalidPosition;
 
-    static PassRefPtr<HTMLProgressElement> create(const QualifiedName&, Document*, HTMLFormElement*);
+    static PassRefPtr<HTMLProgressElement> create(const QualifiedName&, Document*);
 
     double value() const;
     void setValue(double, ExceptionCode&);
@@ -48,17 +48,13 @@
     virtual bool canContainRangeEndPoint() const { return false; }
 
 private:
-    HTMLProgressElement(const QualifiedName&, Document*, HTMLFormElement*);
+    HTMLProgressElement(const QualifiedName&, Document*);
     virtual ~HTMLProgressElement();
 
     virtual bool supportLabels() const OVERRIDE { return true; }
 
     virtual bool supportsFocus() const;
 
-    virtual bool recalcWillValidate() const { return false; }
-
-    virtual const AtomicString& formControlType() const;
-
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
     virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const OVERRIDE;
 

Modified: trunk/Source/WebCore/html/HTMLProgressElement.idl (111008 => 111009)


--- trunk/Source/WebCore/html/HTMLProgressElement.idl	2012-03-16 14:54:09 UTC (rev 111008)
+++ trunk/Source/WebCore/html/HTMLProgressElement.idl	2012-03-16 15:01:16 UTC (rev 111009)
@@ -26,7 +26,6 @@
                  attribute  double                max
                      setter raises(DOMException);
         readonly attribute  double                position;
-        readonly attribute  HTMLFormElement       form;
         readonly attribute  NodeList              labels;
     };
 

Modified: trunk/Source/WebCore/html/HTMLTagNames.in (111008 => 111009)


--- trunk/Source/WebCore/html/HTMLTagNames.in	2012-03-16 14:54:09 UTC (rev 111008)
+++ trunk/Source/WebCore/html/HTMLTagNames.in	2012-03-16 15:01:16 UTC (rev 111009)
@@ -99,7 +99,7 @@
 param
 plaintext interfaceName=HTMLElement
 pre
-progress interfaceName=HTMLProgressElement, constructorNeedsFormElement, conditional=PROGRESS_TAG
+progress interfaceName=HTMLProgressElement, conditional=PROGRESS_TAG
 q interfaceName=HTMLQuoteElement
 rp interfaceName=HTMLElement
 rt interfaceName=HTMLElement
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to