[webkit-changes] [WebKit/WebKit] a0a37c: Use BorderShape for rounded clips in background pa...

Simon Fraser noreply at github.com
Fri Aug 23 08:23:15 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a0a37cafb8ea4595d6be7fbadb9e64b77718b67c
      https://github.com/WebKit/WebKit/commit/a0a37cafb8ea4595d6be7fbadb9e64b77718b67c
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2024-08-23 (Fri, 23 Aug 2024)

  Changed paths:
    A LayoutTests/fast/borders/border-radius-clip-iframe-content-expected.html
    A LayoutTests/fast/borders/border-radius-clip-iframe-content.html
    M LayoutTests/platform/mac-wk2/TestExpectations
    M Source/WebCore/rendering/BackgroundPainter.cpp
    M Source/WebCore/rendering/BackgroundPainter.h
    M Source/WebCore/rendering/BorderShape.cpp
    M Source/WebCore/rendering/BorderShape.h
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderBox.h
    M Source/WebCore/rendering/RenderBoxModelObject.cpp
    M Source/WebCore/rendering/RenderBoxModelObject.h
    M Source/WebCore/rendering/RenderLayerBacking.cpp
    M Source/WebCore/rendering/RenderReplaced.cpp
    M Source/WebCore/rendering/RenderWidget.cpp
    M Source/WebCore/rendering/shapes/BoxShape.cpp

  Log Message:
  -----------
  Use BorderShape for rounded clips in background painting, and for content area clipping
https://bugs.webkit.org/show_bug.cgi?id=278509
rdar://134465598

Reviewed by Antti Koivisto.

Continue the adoption of BorderShape.

First, replace `RenderBoxModelObject::roundedContentBoxRect()` with a function that returns a BorderShape
that is set up to clip to the content box (potentially with corner-rounding). This is used in
`RenderBox::clipContentForBorderRadius()`, which can be called by RenderWidget and RenderReplaced where
they need to clip to the content area. BoxShape can also use this for `CSSBoxType::ContentBox`,
and RenderLayerBacking also when setting up a content clip.

The second set of changes are in BackgroundPainter, using BorderShape to clip to and fill the inner or outer
shapes when drawing backgrounds. We're able to remove `BackgroundPainter::backgroundRoundedRect()`.

* Source/WebCore/rendering/BackgroundPainter.cpp:
(WebCore::BackgroundPainter::paintFillLayer const):
(WebCore::BackgroundPainter::backgroundRoundedRectAdjustedForBleedAvoidance const): Deleted.
(WebCore::BackgroundPainter::backgroundRoundedRect const): Deleted.
* Source/WebCore/rendering/BackgroundPainter.h:
* Source/WebCore/rendering/BorderShape.cpp:
(WebCore::BorderShape::pathForInnerShape const):
(WebCore::BorderShape::pathForBorderArea const):
(WebCore::BorderShape::clipToInnerShape):
(WebCore::BorderShape::fillOuterShape):
(WebCore::BorderShape::fillInnerShape):
* Source/WebCore/rendering/BorderShape.h:
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::clipContentForBorderRadius):
* Source/WebCore/rendering/RenderBox.h:
* Source/WebCore/rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::borderShapeForContentClipping const):
(WebCore::RenderBoxModelObject::roundedContentBoxRect const): Deleted.
* Source/WebCore/rendering/RenderBoxModelObject.h:
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateContentsRects):
* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::paint):
* Source/WebCore/rendering/RenderWidget.cpp:
(WebCore::RenderWidget::paint):
* Source/WebCore/rendering/shapes/BoxShape.cpp:
(WebCore::computeRoundedRectForBoxShape):

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