Changeset 257801 in webkit
- Timestamp:
- Mar 3, 2020 2:11:29 PM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r257799 r257801 1 2020-03-03 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: setting the frontend appearance doesn't update the window when undocked 4 https://bugs.webkit.org/show_bug.cgi?id=208503 5 6 Reviewed by Timothy Hatcher. 7 8 Notify the UIProcess when setting the forced appearance so platforms that support dark mode 9 are able to run native code to adjust the appearance of the undocked window. 10 11 * inspector/InspectorFrontendHost.cpp: 12 (WebCore::InspectorFrontendHost::setForcedAppearance): 13 Call through to the `InspectorFrontendClient` to change the forced appearance. 14 15 * inspector/InspectorFrontendClient.h: 16 (WebCore::InspectorFrontendHost::Appearance): Added. 17 Add an `enum class Appearance` so that multiple copies of the same string comparison logic 18 isn't needed. 19 20 * testing/Internals.cpp: 21 (WebCore::InspectorStubFrontend::setForcedAppearance): Added. 22 1 23 2020-03-03 Justin Fan <justin_fan@apple.com> 2 24 -
trunk/Source/WebCore/inspector/InspectorFrontendClient.h
r257759 r257801 72 72 virtual void resetState() = 0; 73 73 74 enum class Appearance { 75 System, 76 Light, 77 Dark, 78 }; 79 WEBCORE_EXPORT virtual void setForcedAppearance(Appearance) = 0; 80 74 81 virtual UserInterfaceLayoutDirection userInterfaceLayoutDirection() const = 0; 75 82 … … 104 111 105 112 } // namespace WebCore 113 114 namespace WTF { 115 116 template<> struct EnumTraits<WebCore::InspectorFrontendClient::Appearance> { 117 using values = EnumValues< 118 WebCore::InspectorFrontendClient::Appearance, 119 WebCore::InspectorFrontendClient::Appearance::System, 120 WebCore::InspectorFrontendClient::Appearance::Light, 121 WebCore::InspectorFrontendClient::Appearance::Dark 122 >; 123 }; 124 125 } // namespace WTF -
trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp
r257759 r257801 235 235 void InspectorFrontendHost::setForcedAppearance(String appearance) 236 236 { 237 if (!m_frontendPage) 238 return; 239 240 if (appearance == "light"_s) 241 m_frontendPage->setUseDarkAppearanceOverride(false); 242 else if (appearance == "dark"_s) 243 m_frontendPage->setUseDarkAppearanceOverride(true); 244 else 237 if (appearance == "light"_s) { 238 if (m_client) 239 m_client->setForcedAppearance(InspectorFrontendClient::Appearance::Light); 240 else if (m_frontendPage) 241 m_frontendPage->setUseDarkAppearanceOverride(false); 242 return; 243 } 244 245 if (appearance == "dark"_s) { 246 if (m_client) 247 m_client->setForcedAppearance(InspectorFrontendClient::Appearance::Dark); 248 else if (m_frontendPage) 249 m_frontendPage->setUseDarkAppearanceOverride(true); 250 return; 251 } 252 253 if (m_client) 254 m_client->setForcedAppearance(InspectorFrontendClient::Appearance::System); 255 else if (m_frontendPage) 245 256 m_frontendPage->setUseDarkAppearanceOverride(WTF::nullopt); 246 257 } -
trunk/Source/WebCore/testing/Internals.cpp
r257777 r257801 350 350 void reopen() final { } 351 351 void bringToFront() final { } 352 void setForcedAppearance(InspectorFrontendClient::Appearance) final { } 352 353 String localizedStringsURL() const final { return String(); } 353 354 DebuggableType debuggableType() const final { return DebuggableType::Page; } -
trunk/Source/WebKit/ChangeLog
r257797 r257801 1 2020-03-03 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: setting the frontend appearance doesn't update the window when undocked 4 https://bugs.webkit.org/show_bug.cgi?id=208503 5 6 Reviewed by Timothy Hatcher. 7 8 Notify the UIProcess when setting the forced appearance so platforms that support dark mode 9 are able to run native code to adjust the appearance of the undocked window. 10 11 * WebProcess/Inspector/WebInspectorUI.h: 12 * WebProcess/Inspector/WebInspectorUI.cpp: 13 (WebKit::WebInspectorUI::setForcedAppearance): Added. 14 * UIProcess/Inspector/WebInspectorProxy.messages.in: 15 * UIProcess/Inspector/WebInspectorProxy.h: 16 * UIProcess/Inspector/WebInspectorProxy.cpp: 17 (WebKit::WebInspectorProxy::setForcedAppearance): Added. 18 (WebKit::WebInspectorProxy::platformSetForcedAppearance): Added. 19 * UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp: 20 (WebKit::WebInspectorProxy::platformSetForcedAppearance): Added. 21 * UIProcess/Inspector/mac/WebInspectorProxyMac.mm: 22 (WebKit::WebInspectorProxy::platformCreateFrontendWindow): Added. 23 (WebKit::WebInspectorProxy::platformSetForcedAppearance): Added. 24 (WebKit::WebInspectorProxy::applyForcedAppearance): Added. 25 * UIProcess/Inspector/win/WebInspectorProxyWin.cpp: 26 (WebKit::WebInspectorProxy::platformSetForcedAppearance): Added. 27 28 * WebProcess/Inspector/RemoteWebInspectorUI.h: 29 * WebProcess/Inspector/RemoteWebInspectorUI.cpp: 30 (WebKit::RemoteWebInspectorUI::setForcedAppearance): Added. 31 * UIProcess/Inspector/RemoteWebInspectorProxy.messages.in: 32 * UIProcess/Inspector/RemoteWebInspectorProxy.h: 33 * UIProcess/Inspector/RemoteWebInspectorProxy.cpp: 34 (WebKit::RemoteWebInspectorProxy::setForcedAppearance): Added. 35 (WebKit::RemoteWebInspectorProxy::platformSetForcedAppearance): Added. 36 * UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp: 37 (WebKit::RemoteWebInspectorProxy::platformSetForcedAppearance): Added. 38 * UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm: 39 (WebKit::RemoteWebInspectorProxy::platformSetForcedAppearance): Added. 40 * UIProcess/Inspector/win/RemoteWebInspectorProxyWin.cpp: 41 (WebKit::RemoteWebInspectorProxy::platformSetForcedAppearance): Added. 42 1 43 2020-03-03 Per Arne Vollan <pvollan@apple.com> 2 44 -
trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorProxy.cpp
r257759 r257801 139 139 } 140 140 141 void RemoteWebInspectorProxy::setForcedAppearance(InspectorFrontendClient::Appearance appearance) 142 { 143 platformSetForcedAppearance(appearance); 144 } 145 141 146 void RemoteWebInspectorProxy::openInNewTab(const String& url) 142 147 { … … 194 199 void RemoteWebInspectorProxy::platformAppend(const String&, const String&) { } 195 200 void RemoteWebInspectorProxy::platformSetSheetRect(const FloatRect&) { } 201 void RemoteWebInspectorProxy::platformSetForcedAppearance(InspectorFrontendClient::Appearance) { } 196 202 void RemoteWebInspectorProxy::platformOpenInNewTab(const String&) { } 197 203 void RemoteWebInspectorProxy::platformShowCertificate(const CertificateInfo&) { } -
trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorProxy.h
r257759 r257801 29 29 #include "MessageReceiver.h" 30 30 #include <WebCore/FloatRect.h> 31 #include <WebCore/InspectorFrontendClient.h> 31 32 #include <wtf/Forward.h> 32 33 #include <wtf/HashMap.h> … … 119 120 void append(const String& filename, const String& content); 120 121 void setSheetRect(const WebCore::FloatRect&); 122 void setForcedAppearance(WebCore::InspectorFrontendClient::Appearance); 121 123 void openInNewTab(const String& url); 122 124 void showCertificate(const WebCore::CertificateInfo&); … … 134 136 void platformAppend(const String& filename, const String& content); 135 137 void platformSetSheetRect(const WebCore::FloatRect&); 138 void platformSetForcedAppearance(WebCore::InspectorFrontendClient::Appearance); 136 139 void platformOpenInNewTab(const String& url); 137 140 void platformShowCertificate(const WebCore::CertificateInfo&); -
trunk/Source/WebKit/UIProcess/Inspector/RemoteWebInspectorProxy.messages.in
r257759 r257801 30 30 Append(String filename, String content) 31 31 32 SetForcedAppearance(WebCore::InspectorFrontendClient::Appearance appearance) 33 32 34 SetSheetRect(WebCore::FloatRect rect) 33 35 -
trunk/Source/WebKit/UIProcess/Inspector/WebInspectorProxy.cpp
r257759 r257801 581 581 } 582 582 583 void WebInspectorProxy::setForcedAppearance(InspectorFrontendClient::Appearance appearance) 584 { 585 platformSetForcedAppearance(appearance); 586 } 587 583 588 void WebInspectorProxy::inspectedURLChanged(const String& urlString) 584 589 { … … 725 730 } 726 731 732 void WebInspectorProxy::platformSetForcedAppearance(InspectorFrontendClient::Appearance) 733 { 734 notImplemented(); 735 } 736 727 737 void WebInspectorProxy::platformInspectedURLChanged(const String&) 728 738 { -
trunk/Source/WebKit/UIProcess/Inspector/WebInspectorProxy.h
r257759 r257801 34 34 #include <JavaScriptCore/InspectorFrontendChannel.h> 35 35 #include <WebCore/FloatRect.h> 36 #include <WebCore/InspectorFrontendClient.h> 36 37 #include <wtf/Forward.h> 37 38 #include <wtf/RefPtr.h> … … 203 204 bool platformIsFront(); 204 205 void platformAttachAvailabilityChanged(bool); 206 void platformSetForcedAppearance(WebCore::InspectorFrontendClient::Appearance); 205 207 void platformInspectedURLChanged(const String&); 206 208 void platformShowCertificate(const WebCore::CertificateInfo&); … … 231 233 void bringInspectedPageToFront(); 232 234 void attachAvailabilityChanged(bool); 235 void setForcedAppearance(WebCore::InspectorFrontendClient::Appearance); 233 236 void inspectedURLChanged(const String&); 234 237 void showCertificate(const WebCore::CertificateInfo&); … … 248 251 249 252 WebPreferences& inspectorPagePreferences() const; 253 254 #if PLATFORM(MAC) 255 void applyForcedAppearance(); 256 #endif 250 257 251 258 #if PLATFORM(GTK) || PLATFORM(WPE) … … 284 291 String m_urlString; 285 292 WebCore::FloatRect m_sheetRect; 293 WebCore::InspectorFrontendClient::Appearance m_frontendAppearance { WebCore::InspectorFrontendClient::Appearance::System }; 286 294 bool m_isObservingContentLayoutRect { false }; 287 295 #elif PLATFORM(GTK) -
trunk/Source/WebKit/UIProcess/Inspector/WebInspectorProxy.messages.in
r257759 r257801 34 34 ResetState() 35 35 36 SetForcedAppearance(WebCore::InspectorFrontendClient::Appearance appearance) 37 36 38 InspectedURLChanged(String urlString) 37 39 ShowCertificate(WebCore::CertificateInfo certificateInfo) -
trunk/Source/WebKit/UIProcess/Inspector/gtk/RemoteWebInspectorProxyGtk.cpp
r257759 r257801 158 158 } 159 159 160 void RemoteWebInspectorProxy::platformSetForcedAppearance(InspectorFrontendClient::Appearance) 161 { 162 } 163 160 164 void RemoteWebInspectorProxy::platformOpenInNewTab(const String&) 161 165 { -
trunk/Source/WebKit/UIProcess/Inspector/gtk/WebInspectorProxyGtk.cpp
r257759 r257801 333 333 } 334 334 335 void WebInspectorProxy::platformSetForcedAppearance(InspectorFrontendClient::Appearance) 336 { 337 notImplemented(); 338 } 339 335 340 void WebInspectorProxy::platformInspectedURLChanged(const String& url) 336 341 { -
trunk/Source/WebKit/UIProcess/Inspector/mac/RemoteWebInspectorProxyMac.mm
r257759 r257801 226 226 } 227 227 228 void RemoteWebInspectorProxy::platformSetForcedAppearance(InspectorFrontendClient::Appearance appearance) 229 { 230 NSWindow *window = m_window.get(); 231 ASSERT(window); 232 233 switch (appearance) { 234 case InspectorFrontendClient::Appearance::System: 235 window.appearance = nil; 236 break; 237 238 case InspectorFrontendClient::Appearance::Light: 239 window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; 240 break; 241 242 case InspectorFrontendClient::Appearance::Dark: 243 window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua]; 244 break; 245 } 246 } 247 228 248 void RemoteWebInspectorProxy::platformOpenInNewTab(const String& url) 229 249 { -
trunk/Source/WebKit/UIProcess/Inspector/mac/WebInspectorProxyMac.mm
r257759 r257801 299 299 300 300 updateInspectorWindowTitle(); 301 applyForcedAppearance(); 301 302 } 302 303 … … 412 413 { 413 414 // Do nothing. 415 } 416 417 void WebInspectorProxy::platformSetForcedAppearance(InspectorFrontendClient::Appearance appearance) 418 { 419 m_frontendAppearance = appearance; 420 421 applyForcedAppearance(); 414 422 } 415 423 … … 797 805 } 798 806 807 void WebInspectorProxy::applyForcedAppearance() 808 { 809 NSWindow *window = m_inspectorWindow.get(); 810 if (!window) 811 return; 812 813 switch (m_frontendAppearance) { 814 case InspectorFrontendClient::Appearance::System: 815 window.appearance = nil; 816 break; 817 818 case InspectorFrontendClient::Appearance::Light: 819 window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; 820 break; 821 822 case InspectorFrontendClient::Appearance::Dark: 823 window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua]; 824 break; 825 } 826 } 827 799 828 } // namespace WebKit 800 829 -
trunk/Source/WebKit/UIProcess/Inspector/win/RemoteWebInspectorProxyWin.cpp
r257759 r257801 135 135 void RemoteWebInspectorProxy::platformAppend(const String&, const String&) { } 136 136 void RemoteWebInspectorProxy::platformSetSheetRect(const WebCore::FloatRect&) { } 137 void RemoteWebInspectorProxy::platformSetForcedAppearance(InspectorFrontendClient::Appearance) { } 137 138 void RemoteWebInspectorProxy::platformOpenInNewTab(const String&) { } 138 139 void RemoteWebInspectorProxy::platformShowCertificate(const WebCore::CertificateInfo&) { } -
trunk/Source/WebKit/UIProcess/Inspector/win/WebInspectorProxyWin.cpp
r257759 r257801 411 411 } 412 412 413 void WebInspectorProxy::platformSetForcedAppearance(InspectorFrontendClient::Appearance) 414 { 415 notImplemented(); 416 } 417 413 418 void WebInspectorProxy::platformInspectedURLChanged(const String& /* url */) 414 419 { -
trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.cpp
r257759 r257801 111 111 } 112 112 113 void RemoteWebInspectorUI::setForcedAppearance(WebCore::InspectorFrontendClient::Appearance appearance) 114 { 115 WebProcess::singleton().parentProcessConnection()->send(Messages::RemoteWebInspectorProxy::SetForcedAppearance(appearance), m_page.identifier()); 116 } 117 113 118 WebCore::UserInterfaceLayoutDirection RemoteWebInspectorUI::userInterfaceLayoutDirection() const 114 119 { -
trunk/Source/WebKit/WebProcess/Inspector/RemoteWebInspectorUI.h
r257759 r257801 73 73 bool targetIsSimulator() const override; 74 74 75 void setForcedAppearance(WebCore::InspectorFrontendClient::Appearance) override; 76 75 77 WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() const override; 76 78 -
trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.cpp
r257759 r257801 174 174 } 175 175 176 void WebInspectorUI::setForcedAppearance(WebCore::InspectorFrontendClient::Appearance appearance) 177 { 178 WebProcess::singleton().parentProcessConnection()->send(Messages::WebInspectorProxy::SetForcedAppearance(appearance), m_inspectedPageIdentifier); 179 } 180 176 181 WebCore::UserInterfaceLayoutDirection WebInspectorUI::userInterfaceLayoutDirection() const 177 182 { -
trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.h
r257759 r257801 108 108 void resetState() override; 109 109 110 void setForcedAppearance(WebCore::InspectorFrontendClient::Appearance) override; 111 110 112 WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() const override; 111 113 -
trunk/Source/WebKitLegacy/ios/ChangeLog
r257759 r257801 1 2020-03-03 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: setting the frontend appearance doesn't update the window when undocked 4 https://bugs.webkit.org/show_bug.cgi?id=208503 5 6 Reviewed by Timothy Hatcher. 7 8 Notify the UIProcess when setting the forced appearance so platforms that support dark mode 9 are able to run native code to adjust the appearance of the undocked window. 10 11 * WebCoreSupport/WebInspectorClientIOS.mm: 12 (WebInspectorFrontendClient::setForcedAppearance): Added. 13 1 14 2020-03-02 Devin Rousso <drousso@apple.com> 2 15 -
trunk/Source/WebKitLegacy/ios/WebCoreSupport/WebInspectorClientIOS.mm
r257759 r257801 129 129 void WebInspectorFrontendClient::reopen() { } 130 130 void WebInspectorFrontendClient::resetState() { } 131 void WebInspectorFrontendClient::setForcedAppearance(InspectorFrontendClient::Appearance) { } 131 132 void WebInspectorFrontendClient::attachWindow(DockSide) { } 132 133 void WebInspectorFrontendClient::detachWindow() { } -
trunk/Source/WebKitLegacy/mac/ChangeLog
r257759 r257801 1 2020-03-03 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: setting the frontend appearance doesn't update the window when undocked 4 https://bugs.webkit.org/show_bug.cgi?id=208503 5 6 Reviewed by Timothy Hatcher. 7 8 Notify the UIProcess when setting the forced appearance so platforms that support dark mode 9 are able to run native code to adjust the appearance of the undocked window. 10 11 * WebCoreSupport/WebInspectorClient.h: 12 * WebCoreSupport/WebInspectorClient.mm: 13 (WebInspectorFrontendClient::setForcedAppearance): Added. 14 1 15 2020-03-02 Devin Rousso <drousso@apple.com> 2 16 -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebInspectorClient.h
r257759 r257801 130 130 void resetState() override; 131 131 132 void setForcedAppearance(InspectorFrontendClient::Appearance) override; 133 132 134 void attachWindow(DockSide) override; 133 135 void detachWindow() override; -
trunk/Source/WebKitLegacy/mac/WebCoreSupport/WebInspectorClient.mm
r257759 r257801 265 265 } 266 266 267 void WebInspectorFrontendClient::setForcedAppearance(InspectorFrontendClient::Appearance appearance) 268 { 269 NSWindow *window = [m_frontendWindowController window]; 270 ASSERT(window); 271 272 switch (appearance) { 273 case InspectorFrontendClient::Appearance::System: 274 window.appearance = nil; 275 break; 276 277 case InspectorFrontendClient::Appearance::Light: 278 window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua]; 279 break; 280 281 case InspectorFrontendClient::Appearance::Dark: 282 window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua]; 283 break; 284 } 285 } 286 267 287 void WebInspectorFrontendClient::attachWindow(DockSide) 268 288 { -
trunk/Source/WebKitLegacy/win/ChangeLog
r257707 r257801 1 2020-03-03 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: setting the frontend appearance doesn't update the window when undocked 4 https://bugs.webkit.org/show_bug.cgi?id=208503 5 6 Reviewed by Timothy Hatcher. 7 8 Notify the UIProcess when setting the forced appearance so platforms that support dark mode 9 are able to run native code to adjust the appearance of the undocked window. 10 11 * WebCoreSupport/WebInspectorClient.h: 12 * WebCoreSupport/WebInspectorClient.cpp: 13 (WebInspectorFrontendClient::setForcedAppearance): Added. 14 1 15 2020-03-02 Rob Buis <rbuis@igalia.com> 2 16 -
trunk/Source/WebKitLegacy/win/WebCoreSupport/WebInspectorClient.cpp
r253837 r257801 287 287 } 288 288 289 void WebInspectorFrontendClient::setForcedAppearance(InspectorFrontendClient::Appearance) 290 { 291 notImplemented(); 292 } 293 289 294 void WebInspectorFrontendClient::attachWindow(DockSide) 290 295 { -
trunk/Source/WebKitLegacy/win/WebCoreSupport/WebInspectorClient.h
r253868 r257801 117 117 void resetState() override; 118 118 119 void setForcedAppearance(InspectorFrontendClient::Appearance) override; 120 119 121 void setAttachedWindowHeight(unsigned) override; 120 122 void setAttachedWindowWidth(unsigned) override;
Note: See TracChangeset
for help on using the changeset viewer.