[webkit-changes] [WebKit/WebKit] 456497: REGRESSION (macOS 11): Form controls don't paint w...

Aditya Keerthi noreply at github.com
Fri Dec 23 09:07:03 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 456497bb8c15309d0367d551c5c81d3ea4c62747
      https://github.com/WebKit/WebKit/commit/456497bb8c15309d0367d551c5c81d3ea4c62747
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2022-12-23 (Fri, 23 Dec 2022)

  Changed paths:
    A LayoutTests/fast/forms/select/mac-wk2/inactive-appearance-expected-mismatch.html
    A LayoutTests/fast/forms/select/mac-wk2/inactive-appearance.html
    M Source/WebCore/platform/graphics/mac/controls/ButtonControlMac.mm
    M Source/WebCore/platform/graphics/mac/controls/WebControlView.mm
    M Source/WebCore/platform/mac/ThemeMac.mm

  Log Message:
  -----------
  REGRESSION (macOS 11): Form controls don't paint with an inactive appearance in non-key windows
https://bugs.webkit.org/show_bug.cgi?id=249355
rdar://103379662

Reviewed by Simon Fraser.

Before macOS 11, WebKit was able to paint form controls with an inactive
appearance by overriding `-[NSView window]` on the control view used for
painting, returning an `NSWindow` with custom return values for
`hasKeyAppearance` and `isKeyWindow`.

However, in macOS 11, AppKit began deriving the inactive state using a
"view root", which is not necessarily an `NSWindow`. The "view root" is only
computed when a view is added to the view hierarchy. Since WebKit's control
view used for painting is not a part of the view hierarchy, it ends up having
a `nil` "view root", and AppKit falls back to the active appearance.

To fix, `-[NSView _viewRoot]` is overridden on WebKit's control views to return
an `NSWindow` with the appropriate state. Additionally, a layout test is added
to detect regressions in this behavior.

* LayoutTests/fast/forms/select/mac-wk2/inactive-appearance-expected-mismatch.html: Added.
* LayoutTests/fast/forms/select/mac-wk2/inactive-appearance.html: Added.
* Source/WebCore/platform/graphics/mac/controls/ButtonControlMac.mm:
(WebCore::ButtonControlMac::updateCellStates):

Fix a regression from 258177 at main, where checkboxes and radio buttons stopped
update the window active state before drawing.

* Source/WebCore/platform/graphics/mac/controls/WebControlView.mm:
(-[WebControlView _viewRoot]):
* Source/WebCore/platform/mac/ThemeMac.mm:
(-[WebCoreThemeView _viewRoot]):

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




More information about the webkit-changes mailing list