Title: [109729] trunk/Source/WebCore
Revision
109729
Author
commit-qu...@webkit.org
Date
2012-03-05 02:26:53 -0800 (Mon, 05 Mar 2012)

Log Message

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

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

This patch changes base class of HTMLOptGroup to HTMLElement from
HTMLFormControlElement to avoid the "optgroup" element in form-associate
elements collection.

This patch doesn't affect HTMLOptionElement::disabled's static_cast. However,
it doesn't good at coding style. This patch also fix it.

No new tests. No behavior changes.

* html/HTMLOptGroupElement.cpp:
(WebCore::HTMLOptGroupElement::HTMLOptGroupElement): Remove "form" parameter.
(WebCore::HTMLOptGroupElement::create): Remove "form" parameter.
(WebCore::HTMLOptGroupElement::childrenChanged): Replace base method call.
(WebCore::HTMLOptGroupElement::parseAttribute): Replace base method call.
(WebCore::HTMLOptGroupElement::attach): Replace base method call.
(WebCore::HTMLOptGroupElement::detach): Replace base method call.
* html/HTMLOptGroupElement.h:
(HTMLOptGroupElement): Change base class to HTMLElement.
* html/HTMLOptionElement.cpp:
(WebCore::HTMLOptionElement::disabled): Replace static_cast<HTMLFormControlElement*> to static_cast<HTMLElement*> with checking isHTMLElement.
* html/HTMLTagNames.in: Remove "constructorNeedsFormElement" for not passing "form" parameter in HTMLElementFactory.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (109728 => 109729)


--- trunk/Source/WebCore/ChangeLog	2012-03-05 10:01:11 UTC (rev 109728)
+++ trunk/Source/WebCore/ChangeLog	2012-03-05 10:26:53 UTC (rev 109729)
@@ -1,3 +1,33 @@
+2012-03-05  Yoshifumi Inoue  <yo...@chromium.org>
+
+        [Forms] The "optgroup" element should not be a form-associated element
+        https://bugs.webkit.org/show_bug.cgi?id=80234
+
+        Reviewed by Kent Tamura.
+
+        This patch changes base class of HTMLOptGroup to HTMLElement from
+        HTMLFormControlElement to avoid the "optgroup" element in form-associate
+        elements collection.
+
+        This patch doesn't affect HTMLOptionElement::disabled's static_cast. However,
+        it doesn't good at coding style. This patch also fix it.
+
+
+        No new tests. No behavior changes.
+
+        * html/HTMLOptGroupElement.cpp:
+        (WebCore::HTMLOptGroupElement::HTMLOptGroupElement): Remove "form" parameter.
+        (WebCore::HTMLOptGroupElement::create): Remove "form" parameter.
+        (WebCore::HTMLOptGroupElement::childrenChanged): Replace base method call.
+        (WebCore::HTMLOptGroupElement::parseAttribute): Replace base method call.
+        (WebCore::HTMLOptGroupElement::attach): Replace base method call.
+        (WebCore::HTMLOptGroupElement::detach): Replace base method call.
+        * html/HTMLOptGroupElement.h:
+        (HTMLOptGroupElement): Change base class to HTMLElement.
+        * html/HTMLOptionElement.cpp:
+        (WebCore::HTMLOptionElement::disabled): Replace static_cast<HTMLFormControlElement*> to static_cast<HTMLElement*> with checking isHTMLElement.
+        * html/HTMLTagNames.in: Remove "constructorNeedsFormElement" for not passing "form" parameter in HTMLElementFactory.
+
 2012-03-05  Pavel Podivilov  <podivi...@chromium.org>
 
         Web Inspector: fix extensions-resource.html test.

Modified: trunk/Source/WebCore/html/HTMLOptGroupElement.cpp (109728 => 109729)


--- trunk/Source/WebCore/html/HTMLOptGroupElement.cpp	2012-03-05 10:01:11 UTC (rev 109728)
+++ trunk/Source/WebCore/html/HTMLOptGroupElement.cpp	2012-03-05 10:26:53 UTC (rev 109729)
@@ -38,15 +38,15 @@
 
 using namespace HTMLNames;
 
-inline HTMLOptGroupElement::HTMLOptGroupElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
-    : HTMLFormControlElement(tagName, document, form)
+inline HTMLOptGroupElement::HTMLOptGroupElement(const QualifiedName& tagName, Document* document)
+    : HTMLElement(tagName, document)
 {
     ASSERT(hasTagName(optgroupTag));
 }
 
-PassRefPtr<HTMLOptGroupElement> HTMLOptGroupElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
+PassRefPtr<HTMLOptGroupElement> HTMLOptGroupElement::create(const QualifiedName& tagName, Document* document)
 {
-    return adoptRef(new HTMLOptGroupElement(tagName, document, form));
+    return adoptRef(new HTMLOptGroupElement(tagName, document));
 }
 
 bool HTMLOptGroupElement::supportsFocus() const
@@ -69,12 +69,12 @@
 void HTMLOptGroupElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
 {
     recalcSelectOptions();
-    HTMLFormControlElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
+    HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
 }
 
 void HTMLOptGroupElement::parseAttribute(Attribute* attr)
 {
-    HTMLFormControlElement::parseAttribute(attr);
+    HTMLElement::parseAttribute(attr);
     recalcSelectOptions();
 }
 
@@ -91,13 +91,13 @@
 {
     if (parentNode()->renderStyle())
         setRenderStyle(styleForRenderer());
-    HTMLFormControlElement::attach();
+    HTMLElement::attach();
 }
 
 void HTMLOptGroupElement::detach()
 {
     m_style.clear();
-    HTMLFormControlElement::detach();
+    HTMLElement::detach();
 }
 
 void HTMLOptGroupElement::setRenderStyle(PassRefPtr<RenderStyle> newStyle)

Modified: trunk/Source/WebCore/html/HTMLOptGroupElement.h (109728 => 109729)


--- trunk/Source/WebCore/html/HTMLOptGroupElement.h	2012-03-05 10:01:11 UTC (rev 109728)
+++ trunk/Source/WebCore/html/HTMLOptGroupElement.h	2012-03-05 10:26:53 UTC (rev 109729)
@@ -24,22 +24,22 @@
 #ifndef HTMLOptGroupElement_h
 #define HTMLOptGroupElement_h
 
-#include "HTMLFormControlElement.h"
+#include "HTMLElement.h"
 
 namespace WebCore {
     
 class HTMLSelectElement;
 
-class HTMLOptGroupElement : public HTMLFormControlElement {
+class HTMLOptGroupElement : public HTMLElement {
 public:
-    static PassRefPtr<HTMLOptGroupElement> create(const QualifiedName&, Document*, HTMLFormElement*);
+    static PassRefPtr<HTMLOptGroupElement> create(const QualifiedName&, Document*);
 
     HTMLSelectElement* ownerSelectElement() const;
     
     String groupLabelText() const;
 
 private:
-    HTMLOptGroupElement(const QualifiedName&, Document*, HTMLFormElement*);
+    HTMLOptGroupElement(const QualifiedName&, Document*);
 
     virtual const AtomicString& formControlType() const;
     virtual bool supportsFocus() const;

Modified: trunk/Source/WebCore/html/HTMLOptionElement.cpp (109728 => 109729)


--- trunk/Source/WebCore/html/HTMLOptionElement.cpp	2012-03-05 10:01:11 UTC (rev 109728)
+++ trunk/Source/WebCore/html/HTMLOptionElement.cpp	2012-03-05 10:26:53 UTC (rev 109729)
@@ -299,7 +299,7 @@
 
 bool HTMLOptionElement::disabled() const
 {
-    return ownElementDisabled() || (parentNode() && static_cast<HTMLFormControlElement*>(parentNode())->disabled());
+    return ownElementDisabled() || (parentNode() && parentNode()->isHTMLElement() && static_cast<HTMLElement*>(parentNode())->disabled());
 }
 
 void HTMLOptionElement::insertedIntoTree(bool deep)

Modified: trunk/Source/WebCore/html/HTMLTagNames.in (109728 => 109729)


--- trunk/Source/WebCore/html/HTMLTagNames.in	2012-03-05 10:01:11 UTC (rev 109728)
+++ trunk/Source/WebCore/html/HTMLTagNames.in	2012-03-05 10:26:53 UTC (rev 109729)
@@ -91,7 +91,7 @@
 nolayer interfaceName=HTMLElement
 object constructorNeedsFormElement, constructorNeedsCreatedByParser
 ol interfaceName=HTMLOListElement
-optgroup interfaceName=HTMLOptGroupElement, constructorNeedsFormElement
+optgroup interfaceName=HTMLOptGroupElement
 option constructorNeedsFormElement
 output constructorNeedsFormElement
 shadow interfaceName=HTMLShadowElement, conditional=SHADOW_DOM
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to