Bug 247118 - [MQ4] Add schemas for resolution and -webkit-device-pixel-ratio features
Summary: [MQ4] Add schemas for resolution and -webkit-device-pixel-ratio features
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: 247124
Blocks: 180234
  Show dependency treegraph
 
Reported: 2022-10-27 02:11 PDT by Antti Koivisto
Modified: 2022-10-27 07:49 PDT (History)
18 users (show)

See Also:


Attachments
Patch (10.06 KB, patch)
2022-10-27 02:22 PDT, 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-10-27 02:11:50 PDT
Support resolution features
Comment 1 Radar WebKit Bug Importer 2022-10-27 02:13:03 PDT
<rdar://problem/101625468>
Comment 2 Antti Koivisto 2022-10-27 02:22:57 PDT
Created attachment 463270 [details]
Patch
Comment 3 Tim Nguyen (:ntim) 2022-10-27 07:04:13 PDT
Comment on attachment 463270 [details]
Patch

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

> Source/WebCore/css/query/GenericMediaQueryParser.cpp:64
> +        if (name.startsWith("-webkit-min-"_s))
> +            return { "-webkit-"_s + StringView(name).substring(12), ComparisonOperator::GreaterThanOrEqual };
> +        if (name.startsWith("-webkit-max-"_s))
> +            return { "-webkit-"_s + StringView(name).substring(12), ComparisonOperator::LessThanOrEqual };

Does this make us support -webkit-min/max for _all_ the range based media queries? If so, I think we should just check specific names here.

Also, how does this even work? As implemented, it sounds like this would just work for `-webkit-min--webkit-device-pixel-ratio` as opposed to `-webkit-min-device-pixel-ratio`.
Comment 4 Antti Koivisto 2022-10-27 07:08:44 PDT
> Does this make us support -webkit-min/max for _all_ the range based media
> queries? If so, I think we should just check specific names here.

The generated name contains -webkit- prefix which won't match any known feature and the parsing will fail during validation.

> Also, how does this even work? As implemented, it sounds like this would
> just work for `-webkit-min--webkit-device-pixel-ratio` as opposed to
> `-webkit-min-device-pixel-ratio`.

I don't understand.
Comment 5 Tim Nguyen (:ntim) 2022-10-27 07:11:47 PDT
(In reply to Antti Koivisto from comment #4)
> > Also, how does this even work? As implemented, it sounds like this would
> > just work for `-webkit-min--webkit-device-pixel-ratio` as opposed to
> > `-webkit-min-device-pixel-ratio`.
> 
> I don't understand.

Isn't the schema name `-webkit-device-pixel-ratio`, how does it match `device-pixel-ratio` (e.g. without the -webkit- prefix)?
Comment 6 Antti Koivisto 2022-10-27 07:12:54 PDT
The idea here is to replace -webkit-max- prefix with -webkit- prefix to get the actual feature name. This is equivalent to stripping away min-/max- prefix in the usual case.
Comment 7 EWS 2022-10-27 07:49:11 PDT
Committed 256064@main (b0723e965bf6): <https://commits.webkit.org/256064@main>

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