[webkit-changes] [WebKit/WebKit] 0cb414: Use BorderShape to render outset box-shadows

Simon Fraser noreply at github.com
Mon Sep 16 12:36:28 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0cb414c8ee44853f705400dad8e1a9ae7de8cb7f
      https://github.com/WebKit/WebKit/commit/0cb414c8ee44853f705400dad8e1a9ae7de8cb7f
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2024-09-16 (Mon, 16 Sep 2024)

  Changed paths:
    M LayoutTests/fast/box-shadow/box-shadow-with-zero-radius.html
    M Source/WebCore/platform/graphics/RoundedRect.cpp
    M Source/WebCore/platform/graphics/RoundedRect.h
    M Source/WebCore/rendering/BackgroundPainter.cpp
    M Source/WebCore/rendering/BorderShape.cpp
    M Source/WebCore/rendering/BorderShape.h

  Log Message:
  -----------
  Use BorderShape to render outset box-shadows
https://bugs.webkit.org/show_bug.cgi?id=278626
rdar://134654586

Reviewed by Antti Koivisto.

Adopt BorderShape in `BackgroundPainter::paintBoxShadow()` for outset shadows.

Since BorderShape knows about inside and outside shapes, we create one for both inset
and outset shadows, then later fill the inner or outer shape as appropriate.

Add `BorderShape::inflate()` which is needed by shadow code.

* LayoutTests/fast/box-shadow/box-shadow-with-zero-radius.html:
* Source/WebCore/platform/graphics/RoundedRect.cpp:
(WebCore::RoundedRect::Radii::expand):
(WebCore::RoundedRect::inflateWithRadii):
(WebCore::RoundedRect::RoundedRect):
* Source/WebCore/platform/graphics/RoundedRect.h:
(WebCore::RoundedRectRadii::expand):
(WebCore::RoundedRectRadii::shrink):
(WebCore::RoundedRect::inflate): Ensure we don't shrink below zero with negative amounts.
(WebCore::RoundedRect::expandRadii):
(WebCore::RoundedRect::shrinkRadii):
* Source/WebCore/rendering/BackgroundPainter.cpp:
(WebCore::BackgroundPainter::paintBoxShadow const):
* Source/WebCore/rendering/BorderShape.cpp:
(WebCore::BorderShape::outerShapeContains const):
(WebCore::BorderShape::move):
(WebCore::BorderShape::inflate):
(WebCore::BorderShape::clipOutOuterShape): Don't clip out empty rects.
(WebCore::BorderShape::clipOutInnerShape): Don't clip out empty rects.
* Source/WebCore/rendering/BorderShape.h:
(WebCore::BorderShape::BorderShape):
(WebCore::BorderShape::borderRect const):
(WebCore::BorderShape::isEmpty const):

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