[webkit-changes] [WebKit/WebKit] 808a9c: Web Inspector: Add emulation toggles for prefers-r...

Razvan Caliman - Apple noreply at github.com
Mon Dec 5 14:42:23 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 808a9c220b48e53a2a49a93b2560d33eb481d1bc
      https://github.com/WebKit/WebKit/commit/808a9c220b48e53a2a49a93b2560d33eb481d1bc
  Author: Razvan Caliman <rcaliman at apple.com>
  Date:   2022-12-05 (Mon, 05 Dec 2022)

  Changed paths:
    A LayoutTests/inspector/page/overrideUserPreference-expected.txt
    A LayoutTests/inspector/page/overrideUserPreference.html
    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
    A Source/WebInspectorUI/UserInterface/Images/AppearanceOverride.svg
    M Source/WebInspectorUI/UserInterface/Main.html
    M Source/WebInspectorUI/UserInterface/Protocol/PageObserver.js
    M Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js
    A Source/WebInspectorUI/UserInterface/Views/OverrideUserPreferencesPopover.css
    A Source/WebInspectorUI/UserInterface/Views/OverrideUserPreferencesPopover.js

  Log Message:
  -----------
  Web Inspector: Add emulation toggles for prefers-reduced-motion and prefers-contrast
https://bugs.webkit.org/show_bug.cgi?id=246882

Reviewed by Patrick Angle.

This was previously reviewed in https://github.com/WebKit/WebKit/pull/5650 then reverted by https://github.com/WebKit/WebKit/commit/f306cbbce4236cc5d9b40dd6d5816dacbc9ddf44

Adds controls in Web Inspector to override preferences
for reduced motion and increased contrast for the inspected page.

These correspond to CSS media features `prefers-reduced-motion: reduce | no-preference`
and `prefers-contrast: more | no-preference`.

The UI in Web Inspector starts off with preference values set to `System`
meaning there is no override applied. A user can pick `On` or `Off` to
force a value for the preference on the inspected page for the duration of
the Web Inspector session.

When a preference is overriden in Web Inspector, changes after the fact to
corresponding settings in System Settings > Accessibility > Display
have no effect on the inspected page until Web Inspector is closed or
the preference values are returned to `System`.

* LayoutTests/inspector/page/overrideUserPreference-expected.txt: Added.
* LayoutTests/inspector/page/overrideUserPreference.html: Added.
* Source/JavaScriptCore/inspector/protocol/Page.json:
* Source/WebCore/inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::accessibilitySettingsDidChangeImpl):
* Source/WebCore/inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::accessibilitySettingsDidChange):
* Source/WebCore/inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::enable):
(WebCore::InspectorPageAgent::disable):
(WebCore::InspectorPageAgent::overrideUserPreference):
(WebCore::InspectorPageAgent::overridePrefersReducedMotion):
(WebCore::InspectorPageAgent::overridePrefersContrast):
(WebCore::InspectorPageAgent::accessibilitySettingsDidChange):
(WebCore::InspectorPageAgent::defaultUserPreferencesDidChange):
* Source/WebCore/inspector/agents/InspectorPageAgent.h:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::accessibilitySettingsDidChange):
* Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js:
* Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js:
(WI.CSSManager):
(WI.CSSManager.prototype.get overridenUserPreferences):
(WI.CSSManager.prototype.get defaultUserPreferences):
(WI.CSSManager.prototype.overrideUserPreference):
(WI.CSSManager.prototype.defaultUserPreferencesDidChange):
* Source/WebInspectorUI/UserInterface/Images/AppearanceOverride.svg: Added.
* Source/WebInspectorUI/UserInterface/Main.html:
* Source/WebInspectorUI/UserInterface/Protocol/PageObserver.js:
(WI.PageObserver.prototype.defaultUserPreferencesDidChange):
* Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js:
(WI.DOMTreeContentView):
(WI.DOMTreeContentView.prototype.get navigationItems):
(WI.DOMTreeContentView.prototype._handleOverrideUserPreferencesButtonClicked):
(WI.DOMTreeContentView.prototype._overridenUserPreferencesDidChange):
(WI.DOMTreeContentView.prototype.didDismissPopover):
* Source/WebInspectorUI/UserInterface/Views/OverrideUserPreferencesPopover.css: Added.
(.popover .user-preferences-content):
(.popover .user-preferences-content > h1):
(.popover .user-preferences-content > label):
(.popover .user-preferences-content > select):
* Source/WebInspectorUI/UserInterface/Views/OverrideUserPreferencesPopover.js: Added.
(WI.OverrideUserPreferencesPopover):
(WI.OverrideUserPreferencesPopover.prototype.show):
(WI.OverrideUserPreferencesPopover.prototype.dismiss):
(WI.OverrideUserPreferencesPopover.prototype._presentOverTargetElement):
(WI.OverrideUserPreferencesPopover.prototype._createSelectElement):
(WI.OverrideUserPreferencesPopover.prototype._createContentElement):
(WI.OverrideUserPreferencesPopover.prototype._userPreferenceValueLabel):
(WI.OverrideUserPreferencesPopover.prototype._defaultUserPreferencesDidChange):

Canonical link: https://commits.webkit.org/257383@main




More information about the webkit-changes mailing list