Changeset 109702 in webkit


Ignore:
Timestamp:
Mar 4, 2012 8:09:39 PM (12 years ago)
Author:
morrita@google.com
Message:

WebKit needs toHTMLUnknownElement() and isUnknown() for sanity check.
https://bugs.webkit.org/show_bug.cgi?id=80229

Reviewed by Kent Tamura.

The code generator has naked static_cast<> which could be unsafe.
We can turn it into toHTMLUnknownElement() and the like.

No new tests. Just added a sanity check.

  • dom/make_names.pl:

(printWrapperFactoryCppFile):

  • html/HTMLElement.h:

(HTMLElement):
(WebCore::HTMLElement::isHTMLUnknownElement):

  • html/HTMLUnknownElement.h:

(HTMLUnknownElement):
(WebCore::toHTMLUnknownElement):
(WebCore):

  • mathml/MathMLElement.h:

(toMathMLElement):

  • svg/SVGElement.h:

(WebCore::toSVGElement):
(WebCore):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r109699 r109702  
     12012-03-04  MORITA Hajime  <morrita@google.com>
     2
     3        WebKit needs toHTMLUnknownElement() and isUnknown() for sanity check.
     4        https://bugs.webkit.org/show_bug.cgi?id=80229
     5
     6        Reviewed by Kent Tamura.
     7
     8        The code generator has naked static_cast<> which could be unsafe.
     9        We can turn it into toHTMLUnknownElement() and the like.
     10
     11        No new tests. Just added a sanity check.
     12
     13        * dom/make_names.pl:
     14        (printWrapperFactoryCppFile):
     15        * html/HTMLElement.h:
     16        (HTMLElement):
     17        (WebCore::HTMLElement::isHTMLUnknownElement):
     18        * html/HTMLUnknownElement.h:
     19        (HTMLUnknownElement):
     20        (WebCore::toHTMLUnknownElement):
     21        (WebCore):
     22        * mathml/MathMLElement.h:
     23        (toMathMLElement):
     24        * svg/SVGElement.h:
     25        (WebCore::toSVGElement):
     26        (WebCore):
     27
    1282012-03-04  Luke Macpherson   <macpherson@chromium.org>
    229
  • trunk/Source/WebCore/dom/make_names.pl

    r108832 r109702  
    11621162        print F <<END
    11631163        return createWrapperFunction(element);
    1164     return V8$parameters{fallbackInterfaceName}::wrap(static_cast<$parameters{fallbackInterfaceName}*>(element), forceNewObject);
     1164    return V8$parameters{fallbackInterfaceName}::wrap(to$parameters{fallbackInterfaceName}(element), forceNewObject);
    11651165END
    11661166;
  • trunk/Source/WebCore/html/HTMLElement.h

    r109149 r109702  
    9898#endif
    9999
     100#ifndef NDEBUG
     101    virtual bool isHTMLUnknownElement() const { return false; }
     102#endif
     103
    100104protected:
    101105    HTMLElement(const QualifiedName& tagName, Document*);
  • trunk/Source/WebCore/html/HTMLUnknownElement.h

    r95901 r109702  
    4242    }
    4343
     44#ifndef NDEBUG
     45    virtual bool isHTMLUnknownElement() const OVERRIDE { return true; }
     46#endif
     47
    4448private:
    4549    HTMLUnknownElement(const QualifiedName& tagName, Document* document)
     
    4953};
    5054
     55inline HTMLUnknownElement* toHTMLUnknownElement(HTMLElement* element)
     56{
     57    ASSERT(!element || element->isHTMLUnknownElement());
     58    return static_cast<HTMLUnknownElement*>(element);
     59}
     60
    5161} // namespace
    5262
  • trunk/Source/WebCore/mathml/MathMLElement.h

    r109149 r109702  
    4949}
    5050
     51inline MathMLElement* toMathMLElement(Element* element)
     52{
     53    ASSERT(!element || element->isMathMLElement());
     54    return static_cast<MathMLElement*>(element);
     55}
     56
    5157#endif // ENABLE(MATHML)
    5258#endif // MathMLElement_h
  • trunk/Source/WebCore/svg/SVGElement.h

    r109342 r109702  
    149149};
    150150
     151inline SVGElement* toSVGElement(Element* element)
     152{
     153    ASSERT(!element || element->isSVGElement());
     154    return static_cast<SVGElement*>(element);
     155}
     156
    151157}
    152158
Note: See TracChangeset for help on using the changeset viewer.