<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>250882</bug_id>
          
          <creation_ts>2023-01-19 17:49:38 -0800</creation_ts>
          <short_desc>BackgroundPainter::paintFillLayers should check box-shadow when finding  an opaque layer.</short_desc>
          <delta_ts>2024-03-06 02:10:08 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Layout and Rendering</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BrowserCompat, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ahmad Saleem">ahmad.saleem792</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>karlcow</cc>
    
    <cc>koivisto</cc>
    
    <cc>ntim</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1926783</commentid>
    <comment_count>0</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2023-01-19 17:49:38 -0800</bug_when>
    <thetext>Hi Team,

While going through Blink&apos;s commit, I came across another failing test case in Safari 16.2 and STP161:

Test Case - https://jsfiddle.net/hL9bj0q7/show

^ It does not have any shadow in Safari but does in Chrome Canary 111 and Firefox Nightly 111.

Blink Commit - https://chromium.googlesource.com/chromium/blink/+/a48f4540763c24adff42b9b77d719597f51482f6

WebKit Source - https://searchfox.org/wubkat/source/Source/WebCore/rendering/BackgroundPainter.cpp#131

Need to add below or equivalent:

!boxShadowShouldBeAppliedToBackground(bleedAvoidance) 

OR

!boxShadowShouldBeAppliedToBackground(m_renderer, paintRect.location(), bleedAvoidance, { })

____

Just wanted to raise so we can fix it.

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1926806</commentid>
    <comment_count>1</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2023-01-19 20:43:19 -0800</bug_when>
    <thetext>There is a FIXME in the source code. 
https://searchfox.org/wubkat/rev/5b1acc527ab5b10c9d9e4dd21fcec68e315790c2/Source/WebCore/rendering/BackgroundPainter.cpp#122-132

And the code was last edited by antti
but the FIXME predates this 

Adding occlusion detection to reduce overdraw in RenderBox background rendering 
Justin Novosad, Fri, 23 Nov 2012 18:43:51 +0000
added in https://searchfox.org/wubkat/commit/71cbe979b543bafb933abdd82a03d72df95c7e0e

// Stop traversal when an opaque layer is encountered.
// FIXME: It would be possible for the following occlusion culling test to be more aggressive
// on layers with no repeat by testing whether the image covers the layout rect.
// Testing that here would imply duplicating a lot of calculations that are currently done in
// BackgroundPainter::paintFillLayer. A more efficient solution might be to move
// the layer recursion into paintFillLayer, or to compute the layer geometry here
// and pass it down.

// The clipOccludesNextLayers condition must be evaluated first to avoid short-circuiting.
if (layer-&gt;clipOccludesNextLayers(layer == &amp;fillLayer) &amp;&amp; layer-&gt;hasOpaqueImage(m_renderer) &amp;&amp; layer-&gt;image()-&gt;canRender(&amp;m_renderer, m_renderer.style().effectiveZoom()) &amp;&amp; layer-&gt;hasRepeatXY() &amp;&amp; layer-&gt;blendMode() == BlendMode::Normal)
	break;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1928772</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-01-26 17:50:17 -0800</bug_when>
    <thetext>&lt;rdar://problem/104722307&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2018501</commentid>
    <comment_count>3</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-03-04 11:12:54 -0800</bug_when>
    <thetext>This compiles and fixes the bug:

&amp;&amp; !boxShadowShouldBeAppliedToBackground(m_renderer, rect.location(), bleedAvoidance, { })

___

Just wanted to share.

(Draft) PR - https://github.com/WebKit/WebKit/pull/25436</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2019028</commentid>
    <comment_count>4</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-03-06 02:10:05 -0800</bug_when>
    <thetext>Committed 275735@main (b6231f750f4e): &lt;https://commits.webkit.org/275735@main&gt;

Reviewed commits have been landed. Closing PR #25436 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>