[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.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@111009 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/html/HTMLProgressElement.cpp b/Source/WebCore/html/HTMLProgressElement.cpp
index 78bbde3..52aed2c 100644
--- a/Source/WebCore/html/HTMLProgressElement.cpp
+++ b/Source/WebCore/html/HTMLProgressElement.cpp
@@ -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();
 }