[webkit-changes] [WebKit/WebKit] 6aa1f6: RenderBox::applyVisualEffectOverflow() and RenderB...

Simon Fraser noreply at github.com
Tue Nov 28 18:35:34 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6aa1f6767674ab7a07f899d2f3a9d338c7c95244
      https://github.com/WebKit/WebKit/commit/6aa1f6767674ab7a07f899d2f3a9d338c7c95244
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2023-11-28 (Tue, 28 Nov 2023)

  Changed paths:
    M LayoutTests/fast/box-shadow/negative-shadow-box-expand-expected.txt
    M LayoutTests/fast/box-shadow/negative-shadow-box-shrink-expected.txt
    A LayoutTests/fast/repaint/outline-and-shadow-repaint-expected.txt
    A LayoutTests/fast/repaint/outline-and-shadow-repaint.html
    M LayoutTests/platform/gtk/fast/repaint/4776765-expected.txt
    M LayoutTests/platform/mac-monterey-wk2/fast/repaint/4776765-expected.txt
    M LayoutTests/platform/mac-ventura-wk2/fast/repaint/4776765-expected.txt
    M LayoutTests/platform/mac-wk1/fast/repaint/4776765-expected.txt
    M LayoutTests/platform/mac/fast/repaint/4776765-expected.txt
    M Source/WebCore/display/css/DisplayBoxModelBox.cpp
    M Source/WebCore/rendering/RenderBox.cpp
    M Source/WebCore/rendering/RenderObject.cpp
    M Source/WebCore/rendering/RenderObject.h
    M Source/WebCore/rendering/style/RenderStyle.cpp
    M Source/WebCore/rendering/style/RenderStyle.h
    M Source/WebCore/rendering/style/RenderStyleInlines.h
    M Source/WebCore/rendering/style/ShadowData.cpp
    M Source/WebCore/rendering/style/ShadowData.h
    M Source/WebCore/rendering/svg/legacy/LegacyRenderSVGModelObject.cpp

  Log Message:
  -----------
  RenderBox::applyVisualEffectOverflow() and RenderBox::outlineBoundsForRepaint() use different ways of computing outline/shadow extent
https://bugs.webkit.org/show_bug.cgi?id=264625
rdar://118582062

Reviewed by Alan Baradlay.

The logic in `ShadowData::adjustRectForShadow()` to compute the impact of box-shadow and outline
on a rect was wrong; the outline is not shadowed, so outline and shadow have independent effects
on the repaint rect. The correct implementation is to just compute their effects separately, and
take the union of the result, which is what `RenderBox::applyVisualEffectOverflow()` already
does.

So remove the outline argument from `ShadowData::adjustRectForShadow()` and delete
`RenderObject::adjustRectForOutlineAndShadow()`. `RenderBox::outlineBoundsForRepaint()` now just
calls `applyVisualEffectOverflow()`, and LegacyRenderSVGModelObject gets its own copy of the old
code because it's not clear how shadows and outlines interact in SVG.

There was also code duplication between `RenderStyle::shadowExtent()` and code in ShadowData, so
remove the RenderStyle code and have it call into ShadowData.

* LayoutTests/fast/box-shadow/negative-shadow-box-expand-expected.txt:
* LayoutTests/fast/box-shadow/negative-shadow-box-shrink-expected.txt:
* LayoutTests/fast/repaint/outline-and-shadow-repaint-expected.txt: Added.
* LayoutTests/fast/repaint/outline-and-shadow-repaint.html: Added.
* LayoutTests/platform/gtk/fast/repaint/4776765-expected.txt:
* LayoutTests/platform/mac-monterey-wk2/fast/repaint/4776765-expected.txt:
* LayoutTests/platform/mac-ventura-wk2/fast/repaint/4776765-expected.txt:
* LayoutTests/platform/mac-wk1/fast/repaint/4776765-expected.txt:
* LayoutTests/platform/mac/fast/repaint/4776765-expected.txt:
* Source/WebCore/display/css/DisplayBoxModelBox.cpp:
(WebCore::Display::BoxModelBox::absolutePaintingExtent const):
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::outlineBoundsForRepaint const):
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::RenderObject::adjustRectForOutlineAndShadow const): Deleted.
* Source/WebCore/rendering/RenderObject.h:
* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::shadowExtent): Deleted.
(WebCore::RenderStyle::shadowInsetExtent): Deleted.
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/RenderStyleInlines.h:
(WebCore::RenderStyle::boxShadowExtent const):
(WebCore::RenderStyle::boxShadowInsetExtent const):
(WebCore::RenderStyle::textShadowExtent const):
* Source/WebCore/rendering/style/ShadowData.cpp:
(WebCore::ShadowData::shadowOutsetExtent const):
(WebCore::ShadowData::shadowInsetExtent const):
(WebCore::ShadowData::adjustRectForShadow const):
(WebCore::calculateShadowExtent): Deleted.
* Source/WebCore/rendering/style/ShadowData.h:
(WebCore::ShadowData::shadowOutsetExtent):
(WebCore::ShadowData::shadowInsetExtent):
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGModelObject.cpp:
(WebCore::adjustRectForOutlineAndShadow):
(WebCore::LegacyRenderSVGModelObject::outlineBoundsForRepaint const):

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




More information about the webkit-changes mailing list