Skip to content
  • weinig@apple.com's avatar
    Shrink SVGPathStringBuilder · 0456b7c6
    weinig@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=121536
    
    Reviewed by Anders Carlsson.
    
    - Use StringBuilder everywhere to avoid unnecessary temporary
      String objects and code size bloat.
    - Also did a drive by FINAL / OVERRIDE pass.
    
    As an example of the win, the function SVGPathStringBuilder::arcTo
    went from being 6120 bytes down to just 378 bytes.
    
    * svg/SVGPathStringBuilder.cpp:
    (WebCore::SVGPathStringBuilder::SVGPathStringBuilder):
    (WebCore::SVGPathStringBuilder::~SVGPathStringBuilder):
    (WebCore::SVGPathStringBuilder::cleanup):
    (WebCore::SVGPathStringBuilder::incrementPathSegmentCount):
    (WebCore::SVGPathStringBuilder::continueConsuming):
    It wasn't helpful for these to be inlined, so move them to
    the implementation file.
    
    (WebCore::appendFlag):
    (WebCore::appendNumber):
    (WebCore::appendPoint):
    Added helpers.
    
    (WebCore::SVGPathStringBuilder::moveTo):
    (WebCore::SVGPathStringBuilder::lineTo):
    (WebCore::SVGPathStringBuilder::lineToHorizontal):
    (WebCore::SVGPathStringBuilder::lineToVertical):
    (WebCore::SVGPathStringBuilder::curveToCubic):
    (WebCore::SVGPathStringBuilder::curveToCubicSmooth):
    (WebCore::SVGPathStringBuilder::curveToQuadratic):
    (WebCore::SVGPathStringBuilder::curveToQuadraticSmooth):
    (WebCore::SVGPathStringBuilder::arcTo):
    (WebCore::SVGPathStringBuilder::closePath):
    * svg/SVGPathStringBuilder.h:
    Stopped using operator+ and removed duplicate string building logic in each build
    type (e.g. both sides of the PathCoordinateMode condition were doing almost identical
    work).
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156024 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    0456b7c6