Changeset 110029 in webkit


Ignore:
Timestamp:
Mar 7, 2012 12:09:15 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

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

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

This patch changes base class of HTMLLegendElement to HTMLElement from
HTMLFormControlElement for saving memory space and iteration time of
extra "legend" 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 are required. No behavior changes.

  • editing/TextIterator.cpp:

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

  • html/HTMLLegendElement.cpp:

(WebCore::HTMLLegendElement::HTMLLegendElement): Remove form parameter.
(WebCore::HTMLLegendElement::create): Remove form parameter.
(WebCore::HTMLLegendElement::associatedControl): Stop checking legend element, because HTMLLegendElement is no longer HTMLFormControlElement.
(WebCore::HTMLLegendElement::supportFocus): Removed. It called HTMLElement::supportFocus.
(WebCore::HTMLLegendElement::formControlType): Remove implementation of virtual method declared in HTMLFormControlElement.

  • html/HTMLLegendElement.h:

(HTMLLegendElement): Change base class to HTMLElement.

  • html/HTMLTagNames.in: Remove "constructorNeedsFormElement" for not passing "form" parameter in HTMLElementFactory.
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r110024 r110029  
     12012-03-07  Yoshifumi Inoue  <yosin@chromium.org>
     2
     3        [Forms] The "legend" element should not be a form-associated element.
     4        https://bugs.webkit.org/show_bug.cgi?id=80239
     5
     6        Reviewed by Kent Tamura.
     7
     8        This patch changes base class of HTMLLegendElement to HTMLElement from
     9        HTMLFormControlElement for saving memory space and iteration time of
     10        extra "legend" 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 are required. No behavior changes.
     18
     19        * editing/TextIterator.cpp:
     20        (WebCore::TextIterator::advance): Check HTMLLegendElement in addition to isFormControlElement. This change is for text dump in LayoutTests implemented by document.innerText attribute.
     21        * html/HTMLLegendElement.cpp:
     22        (WebCore::HTMLLegendElement::HTMLLegendElement): Remove form parameter.
     23        (WebCore::HTMLLegendElement::create): Remove form parameter.
     24        (WebCore::HTMLLegendElement::associatedControl): Stop checking legend element, because HTMLLegendElement is no longer HTMLFormControlElement.
     25        (WebCore::HTMLLegendElement::supportFocus): Removed. It called HTMLElement::supportFocus.
     26        (WebCore::HTMLLegendElement::formControlType): Remove implementation of virtual method declared in HTMLFormControlElement.
     27        * html/HTMLLegendElement.h:
     28        (HTMLLegendElement): Change base class to HTMLElement.
     29        * html/HTMLTagNames.in: Remove "constructorNeedsFormElement" for not passing "form" parameter in HTMLElementFactory.
     30
    1312012-03-06  Raphael Kubo da Costa  <kubo@profusion.mobi>
    232
  • trunk/Source/WebCore/editing/TextIterator.cpp

    r108417 r110029  
    395395                else if (renderer && (renderer->isImage() || renderer->isWidget() ||
    396396                         (renderer->node() && renderer->node()->isElementNode() &&
    397                           static_cast<Element*>(renderer->node())->isFormControlElement())))
     397                          (static_cast<Element*>(renderer->node())->isFormControlElement()
     398                          || static_cast<Element*>(renderer->node())->hasTagName(legendTag)))))
    398399                    m_handledNode = handleReplacedElement();
    399400                else
  • trunk/Source/WebCore/html/HTMLLegendElement.cpp

    r100805 r110029  
    2626#include "HTMLLegendElement.h"
    2727
     28#include "HTMLFormControlElement.h"
    2829#include "HTMLNames.h"
    2930#include <wtf/StdLibExtras.h>
     
    3334using namespace HTMLNames;
    3435
    35 inline HTMLLegendElement::HTMLLegendElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
    36     : HTMLFormControlElement(tagName, document, form)
     36
     37inline HTMLLegendElement::HTMLLegendElement(const QualifiedName& tagName, Document* document)
     38    : HTMLElement(tagName, document)
    3739{
    3840    ASSERT(hasTagName(legendTag));
    3941}
    4042
    41 PassRefPtr<HTMLLegendElement> HTMLLegendElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
     43PassRefPtr<HTMLLegendElement> HTMLLegendElement::create(const QualifiedName& tagName, Document* document)
    4244{
    43     return adoptRef(new HTMLLegendElement(tagName, document, form));
    44 }
    45 
    46 bool HTMLLegendElement::supportsFocus() const
    47 {
    48     return HTMLElement::supportsFocus();
    49 }
    50 
    51 const AtomicString& HTMLLegendElement::formControlType() const
    52 {
    53     DEFINE_STATIC_LOCAL(const AtomicString, legend, ("legend"));
    54     return legend;
     45    return adoptRef(new HTMLLegendElement(tagName, document));
    5546}
    5647
     
    7061        if (node->isElementNode()) {
    7162            Element* element = static_cast<Element*>(node);
    72             if (!element->hasLocalName(legendTag) && element->isFormControlElement())
     63            if (element->isFormControlElement())
    7364                return static_cast<HTMLFormControlElement*>(element);
    7465        }
  • trunk/Source/WebCore/html/HTMLLegendElement.h

    r100805 r110029  
    2525#define HTMLLegendElement_h
    2626
    27 #include "HTMLFormControlElement.h"
     27#include "HTMLElement.h"
    2828
    2929namespace WebCore {
    3030
    31 class HTMLLegendElement : public HTMLFormControlElement {
     31class HTMLFormControlElement;
     32
     33class HTMLLegendElement : public HTMLElement {
    3234public:
    33     static PassRefPtr<HTMLLegendElement> create(const QualifiedName&, Document*, HTMLFormElement*);
     35    static PassRefPtr<HTMLLegendElement> create(const QualifiedName&, Document*);
    3436
    3537private:
    36     HTMLLegendElement(const QualifiedName&, Document*, HTMLFormElement*);
     38    HTMLLegendElement(const QualifiedName&, Document*);
    3739
    3840    // Control in the legend's fieldset that gets focus and access key.
    3941    HTMLFormControlElement* associatedControl();
    4042
    41     virtual bool supportsFocus() const;
    42     virtual const AtomicString& formControlType() const;
    4343    virtual void accessKeyAction(bool sendMouseEvents);
    4444    virtual void focus(bool restorePreviousSelection = true);
  • trunk/Source/WebCore/html/HTMLTagNames.in

    r110014 r110029  
    7575label
    7676layer interfaceName=HTMLElement
    77 legend constructorNeedsFormElement
     77legend
    7878li interfaceName=HTMLLIElement
    7979link constructorNeedsCreatedByParser
Note: See TracChangeset for help on using the changeset viewer.