[webkit-changes] [WebKit/WebKit] 963f14: Web Inspector: Relocate toggle for media feature p...
Razvan Caliman - Apple
noreply at github.com
Mon Dec 12 11:21:14 PST 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 963f144d283f1da6959d15bbd102d766a47f7375
https://github.com/WebKit/WebKit/commit/963f144d283f1da6959d15bbd102d766a47f7375
Author: Razvan Caliman <rcaliman at apple.com>
Date: 2022-12-12 (Mon, 12 Dec 2022)
Changed paths:
M LayoutTests/TestExpectations
R LayoutTests/inspector/css/force-page-appearance-expected.txt
R LayoutTests/inspector/css/force-page-appearance.html
A LayoutTests/inspector/css/overrideUserPreferenceMatchedStyles-expected.txt
A LayoutTests/inspector/css/overrideUserPreferenceMatchedStyles.html
M LayoutTests/inspector/page/overrideUserPreference-expected.txt
M LayoutTests/inspector/page/overrideUserPreference.html
M LayoutTests/platform/mac/TestExpectations
M Source/JavaScriptCore/inspector/protocol/Page.json
M Source/WebCore/inspector/InspectorInstrumentation.cpp
M Source/WebCore/inspector/InspectorInstrumentation.h
M Source/WebCore/inspector/agents/InspectorPageAgent.cpp
M Source/WebCore/inspector/agents/InspectorPageAgent.h
M Source/WebCore/page/Page.cpp
M Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
M Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js
R Source/WebInspectorUI/UserInterface/Images/Appearance.svg
M Source/WebInspectorUI/UserInterface/Protocol/PageObserver.js
M Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js
M Source/WebInspectorUI/UserInterface/Views/OverrideUserPreferencesPopover.css
M Source/WebInspectorUI/UserInterface/Views/OverrideUserPreferencesPopover.js
Log Message:
-----------
Web Inspector: Relocate toggle for media feature prefers-color-scheme / appearance
https://bugs.webkit.org/show_bug.cgi?id=248393
Reviewed by Patrick Angle.
Adds a new way to override the color scheme user preference
for the inspected page.
Replaces the mechanism that used `Page.setForcedAppearance()` with
`Page.overrideUserPreference()` which takes a new property/value pair:
`PrefersColorScheme: Light | Dark`.
The `Page.defaultUserPreferencesDidChange` event payload is augmented with
the default system value of the color scheme preference. The event is now
also dispatched whenever the default system color scheme changes.
This replaces the `Page.defaultAppearanceDidChange` event.
The new UI lives within the User Preferences Overrides popover implemented in 257383 at main.
It supports backwards compatibility with older backends:
- the old `Page.defaultAppearanceDidChange` event payload is mapped to
`WI.CSSManager._defaultUserPreferences[PrefersColorScheme]`;
- the action to set the override invokes `Page.setForcedAppearance()` where available.
* LayoutTests/inspector/css/force-page-appearance-expected.txt: Removed.
* LayoutTests/inspector/css/force-page-appearance.html: Removed.
* LayoutTests/inspector/css/overrideUserPreferenceMatchedStyles-expected.txt: Added.
* LayoutTests/inspector/css/overrideUserPreferenceMatchedStyles.html: Added.
Replaces the old test which used the `Page.setForcedAppearance()` call
with a new test that exercises `Page.overrideUserPreference()` and
checks that the expected node styles match whenever the color scheme override is in force.
* LayoutTests/inspector/page/overrideUserPreference-expected.txt:
* LayoutTests/inspector/page/overrideUserPreference.html:
* Source/JavaScriptCore/inspector/protocol/Page.json:
* Source/WebCore/inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::enable):
(WebCore::InspectorPageAgent::disable):
(WebCore::InspectorPageAgent::overrideUserPreference):
(WebCore::InspectorPageAgent::overridePrefersColorScheme):
(WebCore::InspectorPageAgent::defaultUserPreferencesDidChange):
(WebCore::InspectorPageAgent::defaultAppearanceDidChange):
(WebCore::InspectorPageAgent::setForcedAppearance): Deleted.
* Source/WebCore/inspector/agents/InspectorPageAgent.h:
* Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js:
* Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js:
(WI.CSSManager):
(WI.CSSManager.prototype.get defaultUserPreferences):
(WI.CSSManager.prototype.set defaultUserPreferences):
(WI.CSSManager.prototype.get overridenUserPreferences):
(WI.CSSManager.prototype.setForcedAppearance):
(WI.CSSManager.prototype.overrideUserPreference):
(WI.CSSManager.prototype.defaultAppearanceDidChange):
(WI.CSSManager.prototype._mainResourceDidChange):
(WI.CSSManager.prototype.get defaultAppearance): Deleted.
(WI.CSSManager.prototype.get forcedAppearance): Deleted.
(WI.CSSManager.prototype.set forcedAppearance): Deleted.
(WI.CSSManager.prototype.canForceAppearance): Deleted.
* Source/WebInspectorUI/UserInterface/Images/Appearance.svg: Removed.
* Source/WebInspectorUI/UserInterface/Protocol/PageObserver.js:
* Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js:
(WI.DOMTreeContentView):
(WI.DOMTreeContentView.prototype.get navigationItems):
(WI.DOMTreeContentView.prototype.closed):
(WI.DOMTreeContentView.prototype._defaultAppearanceDidChange): Deleted.
(WI.DOMTreeContentView.prototype._toggleAppearance): Deleted.
* Source/WebInspectorUI/UserInterface/Views/OverrideUserPreferencesPopover.css:
(.popover .user-preferences-content > h1:not(:first-of-type)):
* Source/WebInspectorUI/UserInterface/Views/OverrideUserPreferencesPopover.js:
(WI.OverrideUserPreferencesPopover.prototype._createContentElement):
(WI.OverrideUserPreferencesPopover.prototype._userPreferenceValueLabel):
Canonical link: https://commits.webkit.org/257744@main
More information about the webkit-changes
mailing list