[webkit-changes] [WebKit/WebKit] fb08c7: Plumb BorderShape through BorderPainter

Simon Fraser noreply at github.com
Mon Feb 24 08:14:41 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fb08c78d67df648e6aef52eb2f8065c2495e1137
      https://github.com/WebKit/WebKit/commit/fb08c78d67df648e6aef52eb2f8065c2495e1137
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2025-02-24 (Mon, 24 Feb 2025)

  Changed paths:
    M LayoutTests/fast/borders/hidpi-outline-hairline-painting-expected.html
    M Source/WebCore/platform/graphics/Path.cpp
    M Source/WebCore/rendering/BorderEdge.cpp
    M Source/WebCore/rendering/BorderEdge.h
    M Source/WebCore/rendering/BorderPainter.cpp
    M Source/WebCore/rendering/BorderPainter.h
    M Source/WebCore/rendering/BorderShape.cpp
    M Source/WebCore/rendering/BorderShape.h

  Log Message:
  -----------
  Plumb BorderShape through BorderPainter
https://bugs.webkit.org/show_bug.cgi?id=288200
rdar://145296466

Reviewed by Antti Koivisto.

In preparation for supporting `corner-shape` which introduces non-rounded
corners, we need to reduce the amount of code in `BorderPainter` that assumes
that the border is a rect or rounded rect.

Do this by plumbing BorderShape in deeper; it can replace much of the data
that's currently stored in `BorderPainter::Sides`. Code is also simplified because
BorderShape internally does much of the rect vs. rounded-rect handling.

There's some complexity with `BleedAvoidance::BackgroundOverBorder` where we
shrink the inner border edge by a device pixel; previously this was accounted
for by `innerBorderAdjustment` when painting individual edges, but we can instead
just retrieve the original border widths from the BorderShape.

* LayoutTests/fast/borders/hidpi-outline-hairline-painting-expected.html:
* Source/WebCore/platform/graphics/Path.cpp:
(WebCore::Path::addPath):
* Source/WebCore/rendering/BorderEdge.cpp:
(WebCore::borderEdges):
* Source/WebCore/rendering/BorderEdge.h:
(WebCore::BorderEdge::width const):
(WebCore::BorderEdge::widthForPainting const):
(WebCore::borderEdges):
* Source/WebCore/rendering/BorderPainter.cpp:
(WebCore::BorderPainter::BorderPainter):
(WebCore::calculateSideRect):
(WebCore::sizeForDevicePixel):
(WebCore::shrinkRectByOneDevicePixel):
(WebCore::BorderPainter::paintBorder const):
(WebCore::BorderPainter::paintOutline const):
(WebCore::BorderPainter::paintSides const):
(WebCore::BorderPainter::paintTranslucentBorderSides const):
(WebCore::BorderPainter::paintBorderSides const):
(WebCore::BorderPainter::paintOneBorderSide const):
(WebCore::BorderPainter::clipBorderSidePolygon const):
(WebCore::BorderPainter::allCornersClippedOut): Deleted.
* Source/WebCore/rendering/BorderPainter.h:
* Source/WebCore/rendering/BorderShape.cpp:
(WebCore::BorderShape::shapeForOutlineRect):
(WebCore::BorderShape::BorderShape): Precompute the inner rounded rect since it's used more.
(WebCore::BorderShape::deprecatedInnerRoundedRect const):
(WebCore::BorderShape::deprecatedPixelSnappedInnerRoundedRect const):
(WebCore::BorderShape::innerShapeContains const):
(WebCore::BorderShape::outerShapeIsRectangular const):
(WebCore::BorderShape::innerShapeIsRectangular const):
(WebCore::BorderShape::pathForInnerShape const):
(WebCore::BorderShape::addOuterShapeToPath const):
(WebCore::BorderShape::addInnerShapeToPath const):
(WebCore::BorderShape::pathForBorderArea const):
(WebCore::BorderShape::clipToOuterShape const):
(WebCore::BorderShape::clipToInnerShape const):
(WebCore::BorderShape::clipOutOuterShape const):
(WebCore::BorderShape::clipOutInnerShape const):
(WebCore::BorderShape::fillOuterShape const):
(WebCore::BorderShape::fillInnerShape const):
(WebCore::BorderShape::computeInnerEdgeRoundedRect):
(WebCore::BorderShape::innerEdgeRect const):
(WebCore::BorderShape::clipToOuterShape): Deleted.
(WebCore::BorderShape::clipToInnerShape): Deleted.
(WebCore::BorderShape::clipOutOuterShape): Deleted.
(WebCore::BorderShape::clipOutInnerShape): Deleted.
(WebCore::BorderShape::fillOuterShape): Deleted.
(WebCore::BorderShape::fillInnerShape): Deleted.
(WebCore::BorderShape::innerEdgeRoundedRect const): Deleted.
* Source/WebCore/rendering/BorderShape.h:
(WebCore::BorderShape::shapeForOutlineRect):
(WebCore::BorderShape::borderWidths const):
(WebCore::BorderShape::BorderShape): Deleted.

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list