<?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>283140</bug_id>
          
          <creation_ts>2024-11-14 15:19:31 -0800</creation_ts>
          <short_desc>Switching light/dark modes doesn&apos;t update the base background color if the root has `color` set explicitly</short_desc>
          <delta_ts>2024-11-19 19:20:58 -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>CSS</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=267252</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Simon Fraser (smfr)">simon.fraser</reporter>
          <assigned_to name="Simon Fraser (smfr)">simon.fraser</assigned_to>
          <cc>akeerthi</cc>
    
    <cc>koivisto</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2075207</commentid>
    <comment_count>0</comment_count>
      <attachid>473231</attachid>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2024-11-14 15:19:31 -0800</bug_when>
    <thetext>Created attachment 473231
Test case

Load the attached test file in MiniBrowser. Switch between light and dark modes either via Web Inspector, or by changing system settings; the page background color should update, but does not.

For some reason, the bug does not reproduce in Safari.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2075208</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2024-11-14 15:22:36 -0800</bug_when>
    <thetext>The issue here is that the base background color, which is set via `LocalFrameView::updateBackgroundRecursively()`, isn&apos;t really represented in the render tree, so there&apos;s no render that sees the style change and knows to trigger `updateBackgroundRecursively`.

`RenderBox::styleDidChange()` does call `frameView().recalculateBaseBackgroundColor()` when it sees a style change for the document element or body renderers, but on light/dark mode switches, that is triggered by chance because the `color` property (which is inherited) changes, and we get a RepaintForText diff. If the content sets an explicit color on the root, as the test case does, then the bug occurs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2075224</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2024-11-14 15:53:53 -0800</bug_when>
    <thetext>&lt;rdar://problem/139917332&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2075246</commentid>
    <comment_count>3</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2024-11-14 16:53:31 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/36673</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2076307</commentid>
    <comment_count>4</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2024-11-19 19:20:56 -0800</bug_when>
    <thetext>Committed 286833@main (060793dcd586): &lt;https://commits.webkit.org/286833@main&gt;

Reviewed commits have been landed. Closing PR #36673 and removing active labels.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>473231</attachid>
            <date>2024-11-14 15:19:31 -0800</date>
            <delta_ts>2024-11-14 15:19:31 -0800</delta_ts>
            <desc>Test case</desc>
            <filename>light-dark-switch-with-root-color.html</filename>
            <type>text/html</type>
            <size>295</size>
            <attacher name="Simon Fraser (smfr)">simon.fraser</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8aGVhZD4KICAgIDxzdHlsZT4KICAgICAgICA6cm9vdCB7
CiAgICAgICAgICBjb2xvci1zY2hlbWU6IGxpZ2h0IGRhcms7CiAgICAgICAgICBjb2xvcjogYmx1
ZTsKICAgICAgICB9CiAgICA8L3N0eWxlPgo8L2hlYWQ+Cjxib2R5PgogICAgPHA+VXNlIHdlYiBp
bnNwZWN0b3Igb3Igc3lzdGVtIHNldHRpbmdzIHRvIHN3aXRjaCBiZXR3ZWVuIGxpZ2h0IGFuZCBk
YXJrIG1vZGVzLiBUaGUgYmFja2dyb3VuZCBjb2xvciBzaG91bGQgdXBkYXRlLjwvcD4KPC9ib2R5
Pgo8L2h0bWw+Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>