[webkit-changes] [WebKit/WebKit] dd8b5e: Use BorderShape for rendering inner box shadows

Simon Fraser noreply at github.com
Tue Feb 25 13:43:50 PST 2025


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

  Changed paths:
    M Source/WebCore/rendering/BackgroundPainter.cpp
    M Source/WebCore/rendering/BorderShape.cpp
    M Source/WebCore/rendering/BorderShape.h

  Log Message:
  -----------
  Use BorderShape for rendering inner box shadows
https://bugs.webkit.org/show_bug.cgi?id=288443
rdar://145532909

Reviewed by Antti Koivisto.

Inset box-shadow painting had some assumptions about shapes being rounded rects that get broken
with `corner-shape`, so migrate it to using BorderShape.

The code computes a new BorderShape where the outer rect is the border box, and the inner rect
represents the size of the shadow "hole" (i.e. the edge of the blurred area). It expands out
the non-present edges so that shadows on those edges get clipped out (this expanding used to
be done on the hole rect, but we can equivalently do it on the outer rect).

Finally we add BorderShape::fillRectWithRoundedHole() in preparation to later deal with
non-rounded-rect holes.

* Source/WebCore/rendering/BackgroundPainter.cpp:
(WebCore::BackgroundPainter::paintBoxShadow const):
(WebCore::areaCastingShadowInHole): Deleted.
* Source/WebCore/rendering/BorderShape.cpp:
(WebCore::BorderShape::move): Drive-by fix: if we move the outer rect, we need to move the cached inner rect.
(WebCore::BorderShape::inflate): Drive-by fix: if we inflate the outer rect, we need to recompute the inner rect.
(WebCore::BorderShape::fillRectWithInnerHoleShape const):
(WebCore::BorderShape::innerEdgeRect const): Deleted.
* Source/WebCore/rendering/BorderShape.h:
(WebCore::BorderShape::innerEdgeRect const):

Canonical link: https://commits.webkit.org/291055@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