• Fredrik Söderquist's avatar
    Use approximate stroke bounding boxes for SVG shapes · e9bd34c6
    Fredrik Söderquist authored
    This moves the stroke approximation code from
    LayoutSVGPath::HitTestStrokeBoundingBox to a helper in LayoutSVGShape,
    and then makes use of it in LayoutSVGShape::CalculateStrokeBoundingBox()
    (which is the generic "stroke bounds" computation for shapes) as well.
    
    This makes stroke bounding box computation O(1) (assuming a fill bbox
    exists), avoiding the generation of a stroke path, which can be
    expensive for the more "complex" parametrizations (primarily dashes.)
    
    The downside is of course lower fidelity, and the approximation will
    always be both larger than the fill bbox and larger than the "exact"
    stroke bbox.
    
    Also fix an issue where a miter-limit < 1 would incorrectly shrink the
    resulting bounding box in some cases.
    
    Bug: 435097
    Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
    Change-Id: Id0228bc78bb7d8db223be082106f3c3d2bcb038a
    Reviewed-on: https://chromium-review.googlesource.com/774746
    Commit-Queue: Fredrik Söderquist <fs@opera.com>
    Reviewed-by: default avatarFlorin Malita <fmalita@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#518392}
    e9bd34c6