[meta] Media query emulation
Categories
(DevTools :: General, task, P3)
Tracking
(Not tracked)
People
(Reporter: ntim, Unassigned)
References
(Depends on 9 open bugs, Blocks 1 open bug)
Details
(Keywords: meta)
Updated•8 years ago
|
Updated•7 years ago
|
Updated•3 years ago
|
Comment 2•2 years ago
|
||
I imagine the emulation to work similar across media features, i.e. a shortcut that explicitly sets the value of the feature overwriting its actual value.
As far as I can tell, there is currently no uniform API to add such emulation functionality when implementing new media features.
Would it be possible to create a centralized way for emulations on the platform side, making it easier for the DevTools to add those features?
Sebastian
Comment 3•2 years ago
|
||
How would that look like exactly? Different media features have different requirements: Some should affect only the top browsing context, some should affect only one document, some should affect all the subtree...
In general following the pattern of MediumOverride etc seems like it shouldn't be a lot of code per feature?
Updated•2 years ago
|
Comment 4•2 years ago
|
||
I am turning this into a meta. There is already quite a few dependants and this feature represents significant amount of work on our side.
Honza
Updated•2 years ago
|
Comment 5•2 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #3)
How would that look like exactly? Different media features have different requirements: Some should affect only the top browsing context, some should affect only one document, some should affect all the subtree...
In general following the pattern of MediumOverride etc seems like it shouldn't be a lot of code per feature?
Note that the reasoning behind my suggestion is to make it easier to implement those emulations and allow the implementation of the emulation alongside the implementation of a new media feature. I.e. allow the DevTools to catch up with media feature implementations.
My knowledge of the code is very limited, though I see several places where overrides are defined like MediumOverride and PrefersColorSchemeOverride.
The idea is to have a central mechanism for the different media features that first checks a registry whether there's an explicit value set before their normal evaluation.
There would then be a central way for the DevTools to set and reset media feature overwrites in that registry. I imagine a InspectorUtils.setMediaFeatureOverride() that takes the media feature and an (optional) value, e.g. InspectorUtils.setMediaFeatureOverride('prefers-color-scheme', 'darK'), InspectorUtils.setMediaFeatureOverride('print'), or InspectorUtils.setMediaFeatureOverride('resolution', '150dpi').
To complement that there'd need to be a InspectorUtils.unsetMediaFeatureOverride() and a InspectorUtils.unsetAllMediaFeatureOverrides().
If that sounds reasonable, I'm happy to file bugs for that.
Sebastian
Description
•