[webkit-changes] [WebKit/WebKit] 95809c: [SVG] Add strokeContains fast path

Yusuke Suzuki noreply at github.com
Tue Oct 24 18:21:44 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 95809c73c52a490f49049917d6b4ccd7e59be56b
      https://github.com/WebKit/WebKit/commit/95809c73c52a490f49049917d6b4ccd7e59be56b
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-10-24 (Tue, 24 Oct 2023)

  Changed paths:
    M Source/WebCore/rendering/svg/RenderSVGRect.cpp
    M Source/WebCore/rendering/svg/RenderSVGRect.h
    M Source/WebCore/rendering/svg/RenderSVGShape.cpp
    M Source/WebCore/rendering/svg/RenderSVGShape.h
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGEllipse.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGPath.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRect.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRect.h
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.h

  Log Message:
  -----------
  [SVG] Add strokeContains fast path
https://bugs.webkit.org/show_bug.cgi?id=263430
rdar://problem/117439322

Reviewed by Cameron McCormack.

This is one step of the patch series implementing approximate repainting rect for SVG path, derived from blink's work[1].

This patch adds strokeContains optimization. The key is that we can use approximateStrokeBoundingBox to filter out the candidates
Instead of strokeBoundingBox since approximateStrokeBoundingBox is always larger than strokeBoundingBox. And approximateStrokeBoundingBox
is incredibly faster than strokeBoundingBox. We also extend our fast path handling for SVG Rect.

[1]: https://bugs.chromium.org/p/chromium/issues/detail?id=435097

* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGEllipse.cpp:
(WebCore::LegacyRenderSVGEllipse::updateShapeFromElement):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGPath.cpp:
(WebCore::LegacyRenderSVGPath::updateShapeFromElement):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRect.cpp:
(WebCore::LegacyRenderSVGRect::updateShapeFromElement):
(WebCore::LegacyRenderSVGRect::canUseStrokeHitTestFastPath const):
(WebCore::LegacyRenderSVGRect::definitelyHasSimpleStroke const):
(WebCore::LegacyRenderSVGRect::shapeDependentStrokeContains):
(WebCore::LegacyRenderSVGRect::shapeDependentFillContains const):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRect.h:
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.cpp:
(WebCore::LegacyRenderSVGShape::strokeContains):
(WebCore::LegacyRenderSVGShape::approximateStrokeBoundingBox const):
(WebCore::LegacyRenderSVGShape::updateRepaintBoundingBox):
(WebCore::LegacyRenderSVGShape::hasSmoothStroke const): Deleted.
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.h:

Canonical link: https://commits.webkit.org/269745@main




More information about the webkit-changes mailing list