Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 60dff96f744e06b88277d5035aa145ea000e6bb4
      
https://github.com/WebKit/WebKit/commit/60dff96f744e06b88277d5035aa145ea000e6bb4
  Author: Alan Baradlay <[email protected]>
  Date:   2026-08-31 (Mon, 31 Aug 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-clipped-to-padding-box-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-clipped-to-padding-box-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-clipped-to-padding-box.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-cloned-inline-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-cloned-inline-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-cloned-inline.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-fragmented-inline-expected.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-fragmented-inline-ref.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-fragmented-inline.html
    M Source/WebCore/rendering/BackgroundPainter.cpp

  Log Message:
  -----------
  Inset box-shadow with a large spread paints outside the box on an inline box
https://bugs.webkit.org/show_bug.cgi?id=322214
<rdar://problem/185651318>

Reviewed by Simon Fraser.

  <div style="width: 200px">
    before
    <span style="box-shadow: inset 0 0 0 400px blue">
      first <br>
      second
    </span>
  </div>

The blue _inset_ shadow should stop at the end of each line's fragment. Instead 
it ran 400px past it to the containing block.
When an inline box is split across lines, the incoming edge value (where it 
breaks) is "open" and the box keeps growing to the next line.
(Note inset shadows are clipped to the padding box)

  paintRect                      expansion = blur extent + spread
  +--------------------------+- - - - - - - - - - - - - - - - -+
  |##########################|                                 |
  |###+----------------------+- - - - - - - - - - - - - - -+   |
  |###|  hole, reaching the break edge                     |   |
  |###+----------------------+- - - - - - - - - - - - - - -+   |
  |##########################|                                 |
  +--------------------------+- - - - - - - - - - - - - - - - -+
  |<--- clip: padding box -->|  everything past here is clipped

On trunk we call shapeForInnerHole.fillOuterShape() when shapeForInnerHole is 
empty (i.e. inset shadow covers the box).
With no hole left, we just call fill on the "grown" rect before any clip is 
applied.

  +-----------+- - - - - - - - - - - - - -+
  |###########|###########################|
  +-----------+- - - - - - - - - - - - - -+
   fragment     spread carries it 400px
                past the line break

but what we should do instead is this:

  +-----------+
  |###########|
  +-----------+
    fragment

So let's call borderShape.fillInnerShape() instead. borderShape is the box 
itself, not the "grown" rect, and its inner shape is the padding box.

It also fixes blocks: on trunk a block with a transparent border paints the 
shadow under the border (the outer shape is the border box),
now it stops at the padding box.

Tests: 
imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-clipped-to-padding-box.html
       
imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-cloned-inline.html
       
imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-fragmented-inline.html

* Source/WebCore/rendering/BackgroundPainter.cpp:
(WebCore::BackgroundPainter::paintBoxShadow const):
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-clipped-to-padding-box-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-clipped-to-padding-box-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-clipped-to-padding-box.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-cloned-inline-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-cloned-inline-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-cloned-inline.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-fragmented-inline-expected.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-fragmented-inline-ref.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-backgrounds/box-shadow/inset-shadow-large-spread-fragmented-inline.html:
 Added.

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



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

Reply via email to