Changeset 39111 in webkit


Ignore:
Timestamp:
Dec 8, 2008 4:06:41 PM (15 years ago)
Author:
jchaffraix@webkit.org
Message:

2008-12-08 Julien Chaffraix <jchaffraix@webkit.org>

Reviewed by Darin Adler.

Bug 22665: Remove setCreatedByParser(bool) from the few elements that use it
https://bugs.webkit.org/show_bug.cgi?id=22665

Remove setCreatedByParser from the script elements (HTML and SVG).

  • dom/XMLTokenizer.cpp: (WebCore::XMLTokenizer::eventuallyMarkAsParserCreated): Removed call to setCreatedByParser for the 2 elements.
  • dom/make_names.pl: Modified to call the constructor with the createByParser parameter if 'constructorNeedsCreatedByParser' is set.


  • html/HTMLElementFactory.cpp: (WebCore::scriptConstructor):
  • html/HTMLScriptElement.cpp: (WebCore::HTMLScriptElement::HTMLScriptElement):
  • html/HTMLScriptElement.h:
  • html/HTMLTagNames.in: Added constructorNeedsCreatedByParser to script.
  • svg/SVGScriptElement.cpp: (WebCore::SVGScriptElement::SVGScriptElement):
  • svg/SVGScriptElement.h:
  • svg/svgtags.in: Added constructorNeedsCreatedByParser to script.
Location:
trunk/WebCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r39109 r39111  
     12008-12-08  Julien Chaffraix  <jchaffraix@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Bug 22665: Remove setCreatedByParser(bool) from the few elements that use it
     6        https://bugs.webkit.org/show_bug.cgi?id=22665
     7
     8        Remove setCreatedByParser from the script elements (HTML and SVG).
     9
     10        * dom/XMLTokenizer.cpp:
     11        (WebCore::XMLTokenizer::eventuallyMarkAsParserCreated): Removed
     12        call to setCreatedByParser for the 2 elements.
     13
     14        * dom/make_names.pl: Modified to call the constructor with
     15        the createByParser parameter if 'constructorNeedsCreatedByParser'
     16        is set.
     17
     18        * html/HTMLElementFactory.cpp:
     19        (WebCore::scriptConstructor):
     20        * html/HTMLScriptElement.cpp:
     21        (WebCore::HTMLScriptElement::HTMLScriptElement):
     22        * html/HTMLScriptElement.h:
     23        * html/HTMLTagNames.in: Added constructorNeedsCreatedByParser
     24        to script.
     25        * svg/SVGScriptElement.cpp:
     26        (WebCore::SVGScriptElement::SVGScriptElement):
     27        * svg/SVGScriptElement.h:
     28        * svg/svgtags.in: Added constructorNeedsCreatedByParser
     29        to script.
     30
    1312008-12-08  David Kilzer  <ddkilzer@apple.com>
    232
  • trunk/WebCore/dom/XMLTokenizer.cpp

    r38793 r39111  
    135135void XMLTokenizer::eventuallyMarkAsParserCreated(Element* element)
    136136{
    137     if (element->hasTagName(HTMLNames::scriptTag))
    138         static_cast<HTMLScriptElement*>(element)->setCreatedByParser(true);
    139 #if ENABLE(SVG)
    140     else if (element->hasTagName(SVGNames::scriptTag))
    141         static_cast<SVGScriptElement*>(element)->setCreatedByParser(true);
    142 #endif
    143     else if (element->hasTagName(HTMLNames::styleTag))
     137    if (element->hasTagName(HTMLNames::styleTag))
    144138        static_cast<HTMLStyleElement*>(element)->setCreatedByParser(true);
    145139#if ENABLE(SVG)
  • trunk/WebCore/dom/make_names.pl

    r38754 r39111  
    8787sub initializeTagPropertyHash
    8888{
    89     return ('exportString' => 0,
     89    return ('constructorNeedsCreatedByParser' => 0,
     90            'exportString' => 0,
    9091            'interfaceName' => defaultInterfaceName($_[0]),
    9192            # By default, the JSInterfaceName is the same as the interfaceName.
     
    219220        print F "static PassRefPtr<$parameters{'namespace'}Element> ${name}Constructor(Document* doc, bool createdByParser)\n";
    220221        print F "{\n";
    221         print F "    return new ${ucName}($parameters{'namespace'}Names::${name}Tag, doc);\n";
     222        if ($tags{$name}{'constructorNeedsCreatedByParser'}) {
     223            print F "    return new ${ucName}($parameters{'namespace'}Names::${name}Tag, doc, createdByParser);\n";
     224        } else {
     225            print F "    return new ${ucName}($parameters{'namespace'}Names::${name}Tag, doc);\n";
     226        }
    222227        print F "}\n\n";
    223228    }
  • trunk/WebCore/html/HTMLElementFactory.cpp

    r39007 r39111  
    340340static PassRefPtr<HTMLElement> scriptConstructor(const QualifiedName&, Document* doc, HTMLFormElement*, bool createdByParser)
    341341{
    342     RefPtr<HTMLScriptElement> script = new HTMLScriptElement(scriptTag, doc);
    343     script->setCreatedByParser(createdByParser);
    344     return script.release();
     342    return new HTMLScriptElement(scriptTag, doc, createdByParser);
    345343}
    346344
  • trunk/WebCore/html/HTMLScriptElement.cpp

    r39065 r39111  
    3333using namespace HTMLNames;
    3434
    35 HTMLScriptElement::HTMLScriptElement(const QualifiedName& tagName, Document* doc)
     35HTMLScriptElement::HTMLScriptElement(const QualifiedName& tagName, Document* doc, bool createdByParser)
    3636    : HTMLElement(tagName, doc)
    3737    , m_data(this, this)
    3838{
    3939    ASSERT(hasTagName(scriptTag));
     40    m_data.setCreatedByParser(createdByParser);
    4041}
    4142
     
    4748{
    4849    return attr->name() == sourceAttributeValue();
    49 }
    50 
    51 void HTMLScriptElement::setCreatedByParser(bool createdByParser)
    52 {
    53     m_data.setCreatedByParser(createdByParser);
    5450}
    5551
  • trunk/WebCore/html/HTMLScriptElement.h

    r39065 r39111  
    3333                        , public ScriptElement {
    3434public:
    35     HTMLScriptElement(const QualifiedName&, Document*);
     35    HTMLScriptElement(const QualifiedName&, Document*, bool createdByParser);
    3636    ~HTMLScriptElement();
    3737
    38     void setCreatedByParser(bool);
    3938    bool shouldExecuteAsJavaScript() const;
    4039    virtual String scriptContent() const;
  • trunk/WebCore/html/HTMLTagNames.in

    r38670 r39111  
    8686s JSInterfaceName=HTMLElement
    8787samp JSInterfaceName=HTMLElement
    88 script
     88script constructorNeedsCreatedByParser=1
    8989select
    9090small JSInterfaceName=HTMLElement
  • trunk/WebCore/svg/SVGScriptElement.cpp

    r39065 r39111  
    3232namespace WebCore {
    3333
    34 SVGScriptElement::SVGScriptElement(const QualifiedName& tagName, Document* doc)
     34SVGScriptElement::SVGScriptElement(const QualifiedName& tagName, Document* doc, bool createdByParser)
    3535    : SVGElement(tagName, doc)
    3636    , SVGURIReference()
     
    3838    , m_data(this, this)
    3939{
     40    m_data.setCreatedByParser(createdByParser);
    4041}
    4142
    4243SVGScriptElement::~SVGScriptElement()
    4344{
    44 }
    45 
    46 void SVGScriptElement::setCreatedByParser(bool createdByParser)
    47 {
    48     m_data.setCreatedByParser(createdByParser);
    4945}
    5046
  • trunk/WebCore/svg/SVGScriptElement.h

    r39065 r39111  
    3737                           , public ScriptElement {
    3838    public:
    39         SVGScriptElement(const QualifiedName&, Document*);
     39        SVGScriptElement(const QualifiedName&, Document*, bool createdByParser);
    4040        virtual ~SVGScriptElement();
    4141
    42         void setCreatedByParser(bool);
    4342        virtual String scriptContent() const;
    4443
  • trunk/WebCore/svg/svgtags.in

    r38670 r39111  
    9999radialGradient
    100100rect
    101 script
     101script constructorNeedsCreatedByParser=1
    102102stop
    103103style
Note: See TracChangeset for help on using the changeset viewer.