Changeset 155682 in webkit


Ignore:
Timestamp:
Sep 13, 2013 2:48:22 AM (11 years ago)
Author:
akling@apple.com
Message:

[CTTE] Tighter element types for RenderSVGInline and subclasses.
<https://webkit.org/b/121283>

Reviewed by Antti Koivisto.

Codify the following:

  • RenderSVGInline always has an SVGGraphicsElement.
  • RenderSVGTextPath always has an SVGTextPathElement.
  • RenderSVGTSpan always has an SVGTextPositioningElement.

None of these renderers are ever anonymous, so delete element() and provide
strongly typed reference getters instead.

Location:
trunk/Source/WebCore
Files:
1 deleted
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r155631 r155682  
    22772277    rendering/svg/RenderSVGRoot.cpp
    22782278    rendering/svg/RenderSVGShape.cpp
    2279     rendering/svg/RenderSVGTSpan.cpp
    22802279    rendering/svg/RenderSVGText.cpp
    22812280    rendering/svg/RenderSVGTextPath.cpp
  • trunk/Source/WebCore/ChangeLog

    r155681 r155682  
     12013-09-13  Andreas Kling  <akling@apple.com>
     2
     3        [CTTE] Tighter element types for RenderSVGInline and subclasses.
     4        <https://webkit.org/b/121283>
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Codify the following:
     9
     10        - RenderSVGInline always has an SVGGraphicsElement.
     11        - RenderSVGTextPath always has an SVGTextPathElement.
     12        - RenderSVGTSpan always has an SVGTextPositioningElement.
     13
     14        None of these renderers are ever anonymous, so delete element() and provide
     15        strongly typed reference getters instead.
     16
    1172013-09-13  Andreas Kling  <akling@apple.com>
    218
  • trunk/Source/WebCore/GNUmakefile.list.am

    r155631 r155682  
    48794879        Source/WebCore/rendering/svg/RenderSVGShape.cpp \
    48804880        Source/WebCore/rendering/svg/RenderSVGShape.h \
    4881         Source/WebCore/rendering/svg/RenderSVGTSpan.cpp \
    48824881        Source/WebCore/rendering/svg/RenderSVGTSpan.h \
    48834882        Source/WebCore/rendering/svg/RenderSVGText.cpp \
  • trunk/Source/WebCore/Target.pri

    r155631 r155682  
    37013701        rendering/svg/RenderSVGResourceSolidColor.cpp \
    37023702        rendering/svg/RenderSVGRoot.cpp \
    3703         rendering/svg/RenderSVGTSpan.cpp \
    37043703        rendering/svg/RenderSVGText.cpp \
    37053704        rendering/svg/RenderSVGTextPath.cpp \
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

    r155633 r155682  
    1162111621    </ClCompile>
    1162211622    <ClCompile Include="..\rendering\svg\RenderSVGTextPath.cpp">
    11623       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
    11624       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
    11625       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
    11626       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
    11627       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
    11628       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
    11629       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
    11630       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
    11631       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
    11632       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
    11633       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
    11634       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
    11635     </ClCompile>
    11636     <ClCompile Include="..\rendering\svg\RenderSVGTSpan.cpp">
    1163711623      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
    1163811624      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
  • trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters

    r155633 r155682  
    29832983      <Filter>rendering\svg</Filter>
    29842984    </ClCompile>
    2985     <ClCompile Include="..\rendering\svg\RenderSVGTSpan.cpp">
    2986       <Filter>rendering\svg</Filter>
    2987     </ClCompile>
    29882985    <ClCompile Include="..\rendering\svg\SVGInlineFlowBox.cpp">
    29892986      <Filter>rendering\svg</Filter>
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r155631 r155682  
    66546654                0854B0081255E4E600B9CDD0 /* RenderSVGTextPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGTextPath.cpp; sourceTree = "<group>"; };
    66556655                0854B0091255E4E600B9CDD0 /* RenderSVGTextPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGTextPath.h; sourceTree = "<group>"; };
    6656                 0854B00A1255E4E600B9CDD0 /* RenderSVGTSpan.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGTSpan.cpp; sourceTree = "<group>"; };
    66576656                0854B00B1255E4E600B9CDD0 /* RenderSVGTSpan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSVGTSpan.h; sourceTree = "<group>"; };
    66586657                0854B00C1255E4E600B9CDD0 /* SVGInlineFlowBox.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGInlineFlowBox.cpp; sourceTree = "<group>"; };
     
    1357013569                                436708A912D9CA4B00044234 /* RenderSVGTransformableContainer.cpp */,
    1357113570                                436708AA12D9CA4B00044234 /* RenderSVGTransformableContainer.h */,
    13572                                 0854B00A1255E4E600B9CDD0 /* RenderSVGTSpan.cpp */,
    1357313571                                0854B00B1255E4E600B9CDD0 /* RenderSVGTSpan.h */,
    1357413572                                436708AB12D9CA4B00044234 /* RenderSVGViewportContainer.cpp */,
  • trunk/Source/WebCore/rendering/svg/RenderSVGAllInOne.cpp

    r141775 r155682  
    5252#include "RenderSVGRoot.cpp"
    5353#include "RenderSVGShape.cpp"
    54 #include "RenderSVGTSpan.cpp"
    5554#include "RenderSVGText.cpp"
    5655#include "RenderSVGTextPath.cpp"
  • trunk/Source/WebCore/rendering/svg/RenderSVGInline.cpp

    r154931 r155682  
    3333namespace WebCore {
    3434   
    35 RenderSVGInline::RenderSVGInline(Element* element)
    36     : RenderInline(element)
     35RenderSVGInline::RenderSVGInline(SVGGraphicsElement& element)
     36    : RenderInline(&element)
    3737{
    3838    setAlwaysCreateLineBoxes();
  • trunk/Source/WebCore/rendering/svg/RenderSVGInline.h

    r153380 r155682  
    2424#if ENABLE(SVG)
    2525#include "RenderInline.h"
    26 
    27 #include "SVGRenderSupport.h"
     26#include "SVGGraphicsElement.h"
    2827
    2928namespace WebCore {
     
    3130class RenderSVGInline : public RenderInline {
    3231public:
    33     explicit RenderSVGInline(Element*);
     32    explicit RenderSVGInline(SVGGraphicsElement&);
     33
     34    SVGGraphicsElement& graphicsElement() const { return *toSVGGraphicsElement(RenderInline::element()); }
     35
     36private:
     37    void element() const WTF_DELETED_FUNCTION;
    3438
    3539    virtual const char* renderName() const OVERRIDE { return "RenderSVGInline"; }
     
    5256    virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const OVERRIDE FINAL;
    5357
    54 private:
    5558    virtual InlineFlowBox* createInlineFlowBox() OVERRIDE FINAL;
    5659
  • trunk/Source/WebCore/rendering/svg/RenderSVGTSpan.h

    r153380 r155682  
    2525#if ENABLE(SVG)
    2626#include "RenderSVGInline.h"
     27#include "SVGTextPositioningElement.h"
    2728
    2829namespace WebCore {
    2930class RenderSVGTSpan FINAL : public RenderSVGInline {
    3031public:
    31     explicit RenderSVGTSpan(Element*);
     32    explicit RenderSVGTSpan(SVGTextPositioningElement& element)
     33        : RenderSVGInline(element)
     34    {
     35    }
     36
     37    SVGTextPositioningElement& textPositioningElement() const { return static_cast<SVGTextPositioningElement&>(RenderSVGInline::graphicsElement()); }
     38
     39private:
     40    void graphicsElement() const WTF_DELETED_FUNCTION;
    3241    virtual const char* renderName() const { return "RenderSVGTSpan"; }
    3342};
  • trunk/Source/WebCore/rendering/svg/RenderSVGTextPath.cpp

    r155374 r155682  
    3535namespace WebCore {
    3636
    37 RenderSVGTextPath::RenderSVGTextPath(Element* element)
     37RenderSVGTextPath::RenderSVGTextPath(SVGTextPathElement& element)
    3838    : RenderSVGInline(element)
    3939{
    4040}
    4141
     42SVGTextPathElement& RenderSVGTextPath::textPathElement() const
     43{
     44    return toSVGTextPathElement(RenderSVGInline::graphicsElement());
     45}
     46
    4247Path RenderSVGTextPath::layoutPath() const
    4348{
    44     SVGTextPathElement* textPathElement = toSVGTextPathElement(element());
    45     Element* targetElement = SVGURIReference::targetElementFromIRIString(textPathElement->href(), &textPathElement->document());
     49    Element* targetElement = SVGURIReference::targetElementFromIRIString(textPathElement().href(), &document());
    4650    if (!targetElement || !targetElement->hasTagName(SVGNames::pathTag))
    4751        return Path();
     
    6367float RenderSVGTextPath::startOffset() const
    6468{
    65     return toSVGTextPathElement(element())->startOffset().valueAsPercentage();
     69    return textPathElement().startOffset().valueAsPercentage();
    6670}
    6771
    6872bool RenderSVGTextPath::exactAlignment() const
    6973{
    70     return toSVGTextPathElement(element())->spacing() == SVGTextPathSpacingExact;
     74    return textPathElement().spacing() == SVGTextPathSpacingExact;
    7175}
    7276
    7377bool RenderSVGTextPath::stretchMethod() const
    7478{
    75     return toSVGTextPathElement(element())->method() == SVGTextPathMethodStretch;
     79    return textPathElement().method() == SVGTextPathMethodStretch;
    7680}
    7781
  • trunk/Source/WebCore/rendering/svg/RenderSVGTextPath.h

    r153380 r155682  
    2929class RenderSVGTextPath FINAL : public RenderSVGInline {
    3030public:
    31     RenderSVGTextPath(Element*);
     31    explicit RenderSVGTextPath(SVGTextPathElement&);
     32
     33    SVGTextPathElement& textPathElement() const;
    3234
    3335    Path layoutPath() const;
     
    3638    bool stretchMethod() const;
    3739
    38     virtual bool isSVGTextPath() const { return true; }
     40private:
     41    void graphicsElement() const WTF_DELETED_FUNCTION;
    3942
    40 private:
    41     virtual const char* renderName() const { return "RenderSVGTextPath"; }
     43    virtual bool isSVGTextPath() const OVERRIDE { return true; }
     44    virtual const char* renderName() const OVERRIDE { return "RenderSVGTextPath"; }
    4245
    4346    Path m_layoutPath;
  • trunk/Source/WebCore/svg/SVGAElement.cpp

    r154877 r155682  
    143143{
    144144    if (parentNode() && parentNode()->isSVGElement() && toSVGElement(parentNode())->isTextContent())
    145         return new (arena) RenderSVGInline(this);
     145        return new (arena) RenderSVGInline(*this);
    146146
    147147    return new (arena) RenderSVGTransformableContainer(this);
  • trunk/Source/WebCore/svg/SVGAltGlyphElement.cpp

    r155412 r155682  
    8585RenderObject* SVGAltGlyphElement::createRenderer(RenderArena* arena, RenderStyle*)
    8686{
    87     return new (arena) RenderSVGTSpan(this);
     87    return new (arena) RenderSVGTSpan(*this);
    8888}
    8989
  • trunk/Source/WebCore/svg/SVGTRefElement.cpp

    r154877 r155682  
    223223RenderObject* SVGTRefElement::createRenderer(RenderArena* arena, RenderStyle*)
    224224{
    225     return new (arena) RenderSVGInline(this);
     225    return new (arena) RenderSVGInline(*this);
    226226}
    227227
  • trunk/Source/WebCore/svg/SVGTSpanElement.cpp

    r154371 r155682  
    4343RenderObject* SVGTSpanElement::createRenderer(RenderArena* arena, RenderStyle*)
    4444{
    45     return new (arena) RenderSVGTSpan(this);
     45    return new (arena) RenderSVGTSpan(*this);
    4646}
    4747
  • trunk/Source/WebCore/svg/SVGTextPathElement.cpp

    r154877 r155682  
    130130RenderObject* SVGTextPathElement::createRenderer(RenderArena* arena, RenderStyle*)
    131131{
    132     return new (arena) RenderSVGTextPath(this);
     132    return new (arena) RenderSVGTextPath(*this);
    133133}
    134134
Note: See TracChangeset for help on using the changeset viewer.