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: https://svn.webkit.org/repository/webkit/trunk@111009
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-03-16 Yoshifumi Inoue <yosin@chromium.org>
+
+ [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 <yosin@chromium.org>
[Forms] label.form attribute doesn't work
-This test passes if the progress element can find its form.
+This test passes if the progress element doesn't have form attribute.
PASS
<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>
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
'<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 />';
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');
+2012-03-16 Yoshifumi Inoue <yosin@chromium.org>
+
+ [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 <loislo@chromium.org>
Web Inspector: Heap Snapshot: Unreviewed single line fix for isWindow getter.
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();
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())
}
case CSSSelector::PseudoIndeterminate:
{
- if (!element || !element->isFormControlElement())
+ if (!element)
break;
#if ENABLE(PROGRESS_TAG)
if (element->hasTagName(progressTag)) {
(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();
#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"
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));
}
{
}
-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;
}
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)
else if (attribute->name() == maxAttr)
didElementStateChange();
else
- HTMLFormControlElement::parseAttribute(attribute);
+ LabelableElement::parseAttribute(attribute);
}
void HTMLProgressElement::attach()
{
- HTMLFormControlElement::attach();
+ LabelableElement::attach();
didElementStateChange();
}
#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&);
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;
attribute double max
setter raises(DOMException);
readonly attribute double position;
- readonly attribute HTMLFormElement form;
readonly attribute NodeList labels;
};
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