Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f7f897982b66445d96622a5b67145280e2ba2d81
      
https://github.com/WebKit/WebKit/commit/f7f897982b66445d96622a5b67145280e2ba2d81
  Author: Yusuke Suzuki <ysuz...@apple.com>
  Date:   2023-10-18 (Wed, 18 Oct 2023)

  Changed paths:
    M Source/WebCore/rendering/svg/RenderSVGContainer.cpp
    M Source/WebCore/rendering/svg/RenderSVGEllipse.cpp
    M Source/WebCore/rendering/svg/RenderSVGPath.cpp
    M Source/WebCore/rendering/svg/RenderSVGPath.h
    M Source/WebCore/rendering/svg/RenderSVGRect.cpp
    M Source/WebCore/rendering/svg/RenderSVGRoot.cpp
    M Source/WebCore/rendering/svg/RenderSVGShape.cpp
    M Source/WebCore/rendering/svg/RenderSVGShape.h
    M Source/WebCore/rendering/svg/SVGBoundingBoxComputation.cpp
    M Source/WebCore/rendering/svg/SVGRenderSupport.cpp
    M Source/WebCore/rendering/svg/SVGRenderSupport.h
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGContainer.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGContainer.h
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGPath.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRoot.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRoot.h
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.h

  Log Message:
  -----------
  [SVG] Add approximate stroke-bounding-box computation for repainting
https://bugs.webkit.org/show_bug.cgi?id=263184
rdar://116999242

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 approximate stroke-bounding-box (basically repaint bounding 
box) implementation. The core concept is that, for very compute costly element 
(like, path),
for repaint bounding box, we just report approximate repaint bounding box. This 
can be computed from stroke width etc. Like, let's
assume that stroke exists at the edge of fill bounding box. Then we can compute 
approximate repaint bounding box which is always larger-or-equal
to stroke bounding box.

Important thing in this patch is that we are not using approximate 
stroke-bounding-box computation yet. We will switch
it in the next patch with a few lines of changes. This patch is adding the 
implementation separately from enablement.

One of the hard thing is that our current implementation is relying on the 
computation order of this in the tree because of existence of
recursive / circular references of the repaint bounding box via markers. For 
example, LayoutTests/svg/custom/circular-marker-reference-4.svg
shows how markers can refer to the other marker in a circular manner. And in 
this case, our current implementation is just using stale
repaint bounding box for one of them, so probably the implementation is wrong 
already. But in this patch, we do not want to change the behavior.
As a result, we workaround the issue by eagerly compute stroke bounding box 
when markers exist in LegacyRenderSVGPath. This does not become
a problem in accuracy of stroke bounding box in LBSE since it is implementing 
SVG2, and SVG2 stroke bounding box does not include markers.

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

* Source/WebCore/rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::strokeBoundingBox const):
* Source/WebCore/rendering/svg/RenderSVGEllipse.cpp:
(WebCore::RenderSVGEllipse::updateShapeFromElement):
* Source/WebCore/rendering/svg/RenderSVGPath.cpp:
(WebCore::RenderSVGPath::updateShapeFromElement):
* Source/WebCore/rendering/svg/RenderSVGRect.cpp:
(WebCore::RenderSVGRect::updateShapeFromElement):
* Source/WebCore/rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::strokeBoundingBox const):
* Source/WebCore/rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::strokeBoundingBox const):
(WebCore::RenderSVGShape::approximateStrokeBoundingBox const):
(WebCore::RenderSVGShape::calculateApproximateScalingStrokeBoundingBox const):
(WebCore::RenderSVGShape::calculateApproximateNonScalingStrokeBoundingBox 
const):
(WebCore::RenderSVGShape::calculateApproximateStrokeBoundingBox const):
* Source/WebCore/rendering/svg/RenderSVGShape.h:
* Source/WebCore/rendering/svg/SVGBoundingBoxComputation.cpp:
(WebCore::SVGBoundingBoxComputation::handleShapeOrTextOrInline const):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGContainer.cpp:
(WebCore::LegacyRenderSVGContainer::updateCachedBoundaries):
(WebCore::LegacyRenderSVGContainer::strokeBoundingBox const):
(WebCore::LegacyRenderSVGContainer::repaintRectInLocalCoordinates const):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGContainer.h:
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGPath.cpp:
(WebCore::LegacyRenderSVGPath::updateShapeFromElement):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRoot.cpp:
(WebCore::LegacyRenderSVGRoot::updateCachedBoundaries):
(WebCore::LegacyRenderSVGRoot::strokeBoundingBox const):
(WebCore::LegacyRenderSVGRoot::repaintRectInLocalCoordinates const):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRoot.h:
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.cpp:
(WebCore::LegacyRenderSVGShape::strokeBoundingBox const):
(WebCore::LegacyRenderSVGShape::calculateApproximateScalingStrokeBoundingBox 
const):
(WebCore::LegacyRenderSVGShape::calculateApproximateNonScalingStrokeBoundingBox 
const):
(WebCore::LegacyRenderSVGShape::calculateApproximateStrokeBoundingBox const):
(WebCore::LegacyRenderSVGShape::updateRepaintBoundingBox):
(WebCore::LegacyRenderSVGShape::repaintRectInLocalCoordinates const):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.h:

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


_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to