Changeset 182864 in webkit


Ignore:
Timestamp:
Apr 15, 2015 3:35:42 PM (9 years ago)
Author:
dbates@webkit.org
Message:

Clean up: Have SVGTextLayoutEngine::beginTextPathLayout() take a reference to a
RenderSVGTextPath instead of a pointer
https://bugs.webkit.org/show_bug.cgi?id=143787

Reviewed by Andreas Kling.

SVGTextLayoutEngine::beginTextPathLayout() assumes that the passed RenderObject is a
non-null pointer to a RenderSVGTextPath object. Instead we should have this function take a
reference to a RenderSVGTextPath object to help callers catch bad usage and better document
the expectation of a valid RenderSVGTextPath object.

  • rendering/svg/SVGRootInlineBox.cpp:

(WebCore::SVGRootInlineBox::layoutCharactersInTextBoxes): Downcast the renderer of the
inline box to a RenderSVGTextPath object and pass it to SVGTextLayoutEngine::beginTextPathLayout().
We ensured that this cast is safe earlier in this function.
SVGTextLayoutEngine::beginTextPathLayout().

  • rendering/svg/SVGTextLayoutEngine.cpp:

(WebCore::SVGTextLayoutEngine::beginTextPathLayout): Change type of first parameter from
RenderObject* to RenderSVGTextPath. Remove ASSERT() that was checking for a non-null
RenderObject pointer since we are passing the renderer by reference and a well-formed
reference must refer to a valid object.

  • rendering/svg/SVGTextLayoutEngine.h: Substitute RenderSVGTextPath& for RenderObject*.
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r182860 r182864  
     12015-04-15  Daniel Bates  <dabates@apple.com>
     2
     3        Clean up: Have SVGTextLayoutEngine::beginTextPathLayout() take a reference to a
     4        RenderSVGTextPath instead of a pointer
     5        https://bugs.webkit.org/show_bug.cgi?id=143787
     6
     7        Reviewed by Andreas Kling.
     8
     9        SVGTextLayoutEngine::beginTextPathLayout() assumes that the passed RenderObject is a
     10        non-null pointer to a RenderSVGTextPath object. Instead we should have this function take a
     11        reference to a RenderSVGTextPath object to help callers catch bad usage and better document
     12        the expectation of a valid RenderSVGTextPath object.
     13
     14        * rendering/svg/SVGRootInlineBox.cpp:
     15        (WebCore::SVGRootInlineBox::layoutCharactersInTextBoxes): Downcast the renderer of the
     16        inline box to a RenderSVGTextPath object and pass it to SVGTextLayoutEngine::beginTextPathLayout().
     17        We ensured that this cast is safe earlier in this function.
     18        SVGTextLayoutEngine::beginTextPathLayout().
     19        * rendering/svg/SVGTextLayoutEngine.cpp:
     20        (WebCore::SVGTextLayoutEngine::beginTextPathLayout): Change type of first parameter from
     21        RenderObject* to RenderSVGTextPath. Remove ASSERT() that was checking for a non-null
     22        RenderObject pointer since we are passing the renderer by reference and a well-formed
     23        reference must refer to a valid object.
     24        * rendering/svg/SVGTextLayoutEngine.h: Substitute RenderSVGTextPath& for RenderObject*.
     25
    1262015-04-13  Jer Noble  <jer.noble@apple.com>
    227
  • trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp

    r182111 r182864  
    2727#include "GraphicsContext.h"
    2828#include "RenderSVGText.h"
     29#include "RenderSVGTextPath.h"
    2930#include "SVGInlineFlowBox.h"
    3031#include "SVGInlineTextBox.h"
     
    120121                layoutCharactersInTextBoxes(&flowBox, lineLayout);
    121122
    122                 characterLayout.beginTextPathLayout(&child->renderer(), lineLayout);
     123                characterLayout.beginTextPathLayout(downcast<RenderSVGTextPath>(child->renderer()), lineLayout);
    123124            }
    124125
  • trunk/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp

    r182828 r182864  
    162162}
    163163
    164 void SVGTextLayoutEngine::beginTextPathLayout(RenderObject* object, SVGTextLayoutEngine& lineLayout)
    165 {
    166     ASSERT(object);
    167 
     164void SVGTextLayoutEngine::beginTextPathLayout(RenderSVGTextPath& textPath, SVGTextLayoutEngine& lineLayout)
     165{
    168166    m_inPathLayout = true;
    169     RenderSVGTextPath& textPath = downcast<RenderSVGTextPath>(*object);
    170167
    171168    m_textPath = textPath.layoutPath();
  • trunk/Source/WebCore/rendering/svg/SVGTextLayoutEngine.h

    r163440 r182864  
    3131class RenderStyle;
    3232class RenderSVGInlineText;
     33class RenderSVGTextPath;
    3334class SVGElement;
    3435class SVGInlineTextBox;
     
    5152    SVGTextChunkBuilder& chunkLayoutBuilder() { return m_chunkLayoutBuilder; }
    5253
    53     void beginTextPathLayout(RenderObject*, SVGTextLayoutEngine& lineLayout);
     54    void beginTextPathLayout(RenderSVGTextPath&, SVGTextLayoutEngine& lineLayout);
    5455    void endTextPathLayout();
    5556
Note: See TracChangeset for help on using the changeset viewer.