[webkit-changes] [WebKit/WebKit] 05e6c0: [WebCore] Background may get the wrong color after...

Tadeu Zagallo noreply at github.com
Mon Jun 19 01:12:09 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 05e6c002f080627580b29faef87b9c188967f2d6
      https://github.com/WebKit/WebKit/commit/05e6c002f080627580b29faef87b9c188967f2d6
  Author: Tadeu Zagallo <tzagallo at apple.com>
  Date:   2023-06-19 (Mon, 19 Jun 2023)

  Changed paths:
    M Source/WebCore/page/LocalFrameView.cpp
    M Tools/TestWebKitAPI/Tests/mac/BackgroundColor.mm

  Log Message:
  -----------
  [WebCore] Background may get the wrong color after toggling dark mode
https://bugs.webkit.org/show_bug.cgi?id=258210
rdar://107385637

Reviewed by Aditya Keerthi.

The background color and style color options can get out of sync between changing
appearance and changing the background color (through drawsBackground).
Consider the following scenario:
1. start from light mode with drawsBackground enabled
2. turn off drawsBackground and switch to dark mode
3. turn on drawsBackground: the compute color of the background becomes dark
4. switch to light mode before any layout happens
5. now, a layour happens, and since styleColorOptions hasn't changed (the last
   layout was still in light mode), the background isn't recomputed, and we draw
   a dark background in light mode.

The source of the issue is that `WebPage::setBackgroundColor` calls `LocalFrameView::updateBackgroundRecursively`
directly, resulting in a change to the background color without changing `m_styleColorOptions`.

* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::setBaseBackgroundColor):

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




More information about the webkit-changes mailing list