[webkit-reviews] review granted: [Bug 248594] [MQ4] Replace the last uses of legacy media query code : [Attachment 463832] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Dec 1 08:54:39 PST 2022


Darin Adler <darin at apple.com> has granted Antti Koivisto <koivisto at iki.fi>'s
request for review:
Bug 248594: [MQ4] Replace the last uses of legacy media query code
https://bugs.webkit.org/show_bug.cgi?id=248594

Attachment 463832: Patch

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




--- Comment #4 from Darin Adler <darin at apple.com> ---
Comment on attachment 463832
  --> https://bugs.webkit.org/attachment.cgi?id=463832
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.


More information about the webkit-reviews mailing list