Bug 248594 - [MQ4] Replace the last uses of legacy media query code
Summary: [MQ4] Replace the last uses of legacy media query code
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antti Koivisto
URL:
Keywords: InRadar
Depends on:
Blocks: 180234 248619
  Show dependency treegraph
 
Reported: 2022-12-01 03:23 PST by Antti Koivisto
Modified: 2022-12-01 12:54 PST (History)
17 users (show)

See Also:


Attachments
Patch (13.23 KB, patch)
2022-12-01 08:28 PST, Antti Koivisto
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (13.30 KB, patch)
2022-12-01 08:48 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff
Patch for landing (13.33 KB, patch)
2022-12-01 09:20 PST, Antti Koivisto
koivisto: commit-queue+
Details | Formatted Diff | Diff
Patch (132.42 KB, patch)
2022-12-01 09:30 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff
Patch for landing (13.18 KB, patch)
2022-12-01 09:49 PST, Antti Koivisto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2022-12-01 03:23:52 PST
In preloader etc.
Comment 1 Radar WebKit Bug Importer 2022-12-01 03:25:06 PST
<rdar://problem/102853711>
Comment 2 Antti Koivisto 2022-12-01 08:28:00 PST
Created attachment 463831 [details]
Patch
Comment 3 Antti Koivisto 2022-12-01 08:48:37 PST
Created attachment 463832 [details]
Patch
Comment 4 Darin Adler 2022-12-01 08:54:39 PST
Comment on attachment 463832 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=463832&action=review

What a great moment!

> Source/WebCore/style/StyleScope.cpp:702
>  
> +

Extra blank line here.

> Source/WebKitLegacy/mac/DOM/DOM.mm:710
>      HTMLLinkElement& link = *static_cast<HTMLLinkElement*>(core(self));
> -
> -    auto& media = link.attributeWithoutSynchronization(HTMLNames::mediaAttr);
> -    if (media.isEmpty())
> -        return true;
> -
> -    Document& document = link.document();
> -    auto mediaQuerySet = MediaQuerySet::create(media, MediaQueryParserContext(document));
> -    return LegacyMediaQueryEvaluator { "screen"_s, document, document.renderView() ? &document.renderView()->style() : nullptr }.evaluate(mediaQuerySet.get());
> +    return link.mediaAttributeMatches();

I think we should just one-line this:

    return static_cast<HTMLLinkElement*>(core(self))->mediaAttributeMatches();

Also wondering why we need static_cast here, maybe it should be downcast, or maybe we need to overload core so we don’t need a typecast. But since this is legacy WebKit, I guess we can just leave it as-is.
Comment 5 Antti Koivisto 2022-12-01 09:20:54 PST
Created attachment 463833 [details]
Patch for landing
Comment 6 Antti Koivisto 2022-12-01 09:30:20 PST
Created attachment 463834 [details]
Patch
Comment 7 Antti Koivisto 2022-12-01 09:49:46 PST
Created attachment 463836 [details]
Patch for landing
Comment 8 EWS 2022-12-01 12:54:23 PST
Committed 257252@main (be64fdb44bd3): <https://commits.webkit.org/257252@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 463836 [details].