[webkit-changes] [WebKit/WebKit] 8c75d0: Media-query sensitive meta tags may not get update...

Simon Fraser noreply at github.com
Thu Jan 11 16:41:41 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8c75d0ea90cef0785d346b3839295dda8aa857d3
      https://github.com/WebKit/WebKit/commit/8c75d0ea90cef0785d346b3839295dda8aa857d3
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2024-01-11 (Thu, 11 Jan 2024)

  Changed paths:
    M Source/WebCore/html/HTMLMetaElement.cpp
    M Source/WebCore/page/LocalFrameViewLayoutContext.cpp
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/Page.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp

  Log Message:
  -----------
  Media-query sensitive meta tags may not get updated after some style changes
https://bugs.webkit.org/show_bug.cgi?id=267423
rdar://120854167

Reviewed by Antti Koivisto.

https://github.com/WebKit/WebKit/pull/22531 caused the TestWebKitAPI.WKWebViewThemeColor.KVO
API test to break, when changing the to the `print` media type failed to cause a change of
theme color when the theme meta tag had `media=screen`.

That PR reduces the frequency of style diffs caused by FontCascade differences. In the API
test, this results in a change to the `print` media type no longer triggering a layout on
the (empty) document. Since the layout no longer occurs, we never hit
`updateStyleForLayout()`, so don't end up calling `updateElementsAffectedByMediaQueries()`.

Fix by calling `document.updateElementsAffectedByMediaQueries()` from
`Page::updateStyleAfterChangeInEnvironment()`, and have `WebPage::setOverriddenMediaType()`
call `updateStyleAfterChangeInEnvironment()` which seems like the right thing to do.

* Source/WebCore/html/HTMLMetaElement.cpp: Whitespace.
* Source/WebCore/page/LocalFrameViewLayoutContext.cpp: Whitespace.
* Source/WebCore/page/Page.cpp:
(WebCore::Page::updateStyleAfterChangeInEnvironment):
* Source/WebCore/page/Page.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setOverriddenMediaType):

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




More information about the webkit-changes mailing list