Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 95664cfd77a025b5154b8fc6dd52a6cbd9c0f544
      
https://github.com/WebKit/WebKit/commit/95664cfd77a025b5154b8fc6dd52a6cbd9c0f544
  Author: Yusuke Suzuki <[email protected]>
  Date:   2023-10-12 (Thu, 12 Oct 2023)

  Changed paths:
    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/RenderSVGShape.cpp
    M Source/WebCore/rendering/svg/RenderSVGShape.h
    M Source/WebCore/rendering/svg/SVGBoundingBoxComputation.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGEllipse.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGPath.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGPath.h
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRect.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.cpp
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.h

  Log Message:
  -----------
  [SVG] Move marker related code from LegacyRenderSVGShape to 
LegacyRenderSVGPath
https://bugs.webkit.org/show_bug.cgi?id=262756
rdar://116557017

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 change moves marker related code from LegacyRenderSVGShape to 
LegacyRenderSVGPath
because only LegacyRenderSVGPath can have markers. `<path>`, `<line>`, 
`<polyline>` and `<polygon>`
can have that and all creates LegacyRenderSVGPath.

1. This makes LegacyRenderSVGShape::updateShapeFromElement more concise. This 
now only creates path, and computes two bounding boxes.
2. Previously we were calling LegacyRenderSVGShape::updateShapeFromElement from 
various places to update path. But this is not a good
   way since it updates m_fillBoundingBox and m_strokeBoundingBox while the 
class' updateShapeFromElement already filled that.
   Since now LegacyRenderSVGShape::updateShapeFromElement is just creating a 
path and computing these two bounding boxes, we introduce
   ensurePath and use it in the places which is not overriding 
LegacyRenderSVGShape::updateShapeFromElement. This avoids accidentally
   updating already computed m_fillBoundingBox / m_strokeBoundingBox computing 
again. If they gets different, then it becomes a bug.
   (If newly path-based computed m_strokeBoundingBox is different from 
m_strokeBoundingBox computed in the class's updateShapeFromElement,
   getBBox etc. can return different value at different timing). This change 
makes m_strokeBoundingBox and m_fillBoundingBox more consistent.
3. We duplicate the change in LBSE.

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

* Source/WebCore/rendering/svg/RenderSVGEllipse.cpp:
(WebCore::RenderSVGEllipse::updateShapeFromElement):
(WebCore::RenderSVGEllipse::shapeDependentStrokeContains):
* Source/WebCore/rendering/svg/RenderSVGPath.cpp:
(WebCore::RenderSVGPath::updateShapeFromElement):
(WebCore::RenderSVGPath::calculateUpdatedStrokeBoundingBox const):
(WebCore::markerForType):
(WebCore::RenderSVGPath::shouldGenerateMarkerPositions const):
(WebCore::RenderSVGPath::drawMarkers):
(WebCore::RenderSVGPath::computeMarkerBoundingBox const):
(WebCore::RenderSVGPath::processMarkerPositions):
* Source/WebCore/rendering/svg/RenderSVGPath.h:
* Source/WebCore/rendering/svg/RenderSVGRect.cpp:
(WebCore::RenderSVGRect::updateShapeFromElement):
(WebCore::RenderSVGRect::shapeDependentStrokeContains):
* Source/WebCore/rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::updateShapeFromElement):
(WebCore::RenderSVGShape::fillStrokeMarkers):
(WebCore::RenderSVGShape::ensurePath):
(WebCore::RenderSVGShape::shouldGenerateMarkerPositions const): Deleted.
(WebCore::markerForType): Deleted.
(WebCore::RenderSVGShape::computeMarkerBoundingBox const): Deleted.
(WebCore::RenderSVGShape::drawMarkers): Deleted.
(WebCore::RenderSVGShape::processMarkerPositions): Deleted.
* Source/WebCore/rendering/svg/RenderSVGShape.h:
(WebCore::RenderSVGShape::shapeType const):
(WebCore::RenderSVGShape::drawMarkers):
* Source/WebCore/rendering/svg/SVGBoundingBoxComputation.cpp:
(WebCore::SVGBoundingBoxComputation::handleShapeOrTextOrInline const):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGEllipse.cpp:
(WebCore::LegacyRenderSVGEllipse::updateShapeFromElement):
(WebCore::LegacyRenderSVGEllipse::shapeDependentStrokeContains):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGPath.cpp:
(WebCore::LegacyRenderSVGPath::updateShapeFromElement):
(WebCore::LegacyRenderSVGPath::calculateUpdatedStrokeBoundingBox const):
(WebCore::markerForType):
(WebCore::LegacyRenderSVGPath::shouldGenerateMarkerPositions const):
(WebCore::LegacyRenderSVGPath::drawMarkers):
(WebCore::LegacyRenderSVGPath::markerRect const):
(WebCore::LegacyRenderSVGPath::processMarkerPositions):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGPath.h:
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGRect.cpp:
(WebCore::LegacyRenderSVGRect::updateShapeFromElement):
(WebCore::LegacyRenderSVGRect::shapeDependentStrokeContains):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.cpp:
(WebCore::LegacyRenderSVGShape::updateShapeFromElement):
(WebCore::LegacyRenderSVGShape::layout):
(WebCore::LegacyRenderSVGShape::fillStrokeMarkers):
(WebCore::LegacyRenderSVGShape::calculateStrokeBoundingBox const):
(WebCore::LegacyRenderSVGShape::ensurePath):
(WebCore::LegacyRenderSVGShape::shouldGenerateMarkerPositions const): Deleted.
(WebCore::markerForType): Deleted.
(WebCore::LegacyRenderSVGShape::markerRect const): Deleted.
(WebCore::LegacyRenderSVGShape::drawMarkers): Deleted.
(WebCore::LegacyRenderSVGShape::processMarkerPositions): Deleted.
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGShape.h:
(WebCore::LegacyRenderSVGShape::drawMarkers):

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to