Title: [212272] trunk/Source
Revision
212272
Author
bb...@apple.com
Date
2017-02-13 18:28:55 -0800 (Mon, 13 Feb 2017)

Log Message

Web Inspector: expose system user interface layout direction through InspectorFrontendHost
https://bugs.webkit.org/show_bug.cgi?id=168209
<rdar://problem/11573736>

Reviewed by Joseph Pecoraro.

Forward the UserInterfaceLayoutDirection of the inspector page. If the WebKit client has
properly set the UI directionality from system settings in PageClient, this will get inherited
automatically by the Inspector's WebPage instance.

Source/WebCore:

* inspector/InspectorFrontendClient.h:
* inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::userInterfaceLayoutDirection):
* inspector/InspectorFrontendClientLocal.h:

* inspector/InspectorFrontendHost.h:
* inspector/InspectorFrontendHost.idl:
* inspector/InspectorFrontendHost.cpp:
(WebCore::InspectorFrontendHost::userInterfaceLayoutDirection):
Expose the directionality to the frontend as "ltr" or "rtl" strings.

Source/WebKit2:

* WebProcess/WebPage/RemoteWebInspectorUI.cpp:
(WebKit::RemoteWebInspectorUI::userInterfaceLayoutDirection):
* WebProcess/WebPage/RemoteWebInspectorUI.h:
* WebProcess/WebPage/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::userInterfaceLayoutDirection):
* WebProcess/WebPage/WebInspectorUI.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (212271 => 212272)


--- trunk/Source/WebCore/ChangeLog	2017-02-14 02:20:50 UTC (rev 212271)
+++ trunk/Source/WebCore/ChangeLog	2017-02-14 02:28:55 UTC (rev 212272)
@@ -1,3 +1,26 @@
+2017-02-12  Brian Burg  <bb...@apple.com>
+
+        Web Inspector: expose system user interface layout direction through InspectorFrontendHost
+        https://bugs.webkit.org/show_bug.cgi?id=168209
+        <rdar://problem/11573736>
+
+        Reviewed by Joseph Pecoraro.
+
+        Forward the UserInterfaceLayoutDirection of the inspector page. If the WebKit client has
+        properly set the UI directionality from system settings in PageClient, this will get inherited
+        automatically by the Inspector's WebPage instance.
+
+        * inspector/InspectorFrontendClient.h:
+        * inspector/InspectorFrontendClientLocal.cpp:
+        (WebCore::InspectorFrontendClientLocal::userInterfaceLayoutDirection):
+        * inspector/InspectorFrontendClientLocal.h:
+
+        * inspector/InspectorFrontendHost.h:
+        * inspector/InspectorFrontendHost.idl:
+        * inspector/InspectorFrontendHost.cpp:
+        (WebCore::InspectorFrontendHost::userInterfaceLayoutDirection):
+        Expose the directionality to the frontend as "ltr" or "rtl" strings.
+
 2017-02-13  Zalan Bujtas  <za...@apple.com>
 
         Simple line layout: Do not measure runs with trailing whitespace when kerning and ligatures are off.

Modified: trunk/Source/WebCore/inspector/InspectorFrontendClient.h (212271 => 212272)


--- trunk/Source/WebCore/inspector/InspectorFrontendClient.h	2017-02-14 02:20:50 UTC (rev 212271)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClient.h	2017-02-14 02:28:55 UTC (rev 212272)
@@ -30,6 +30,7 @@
 
 #pragma once
 
+#include "UserInterfaceLayoutDirection.h"
 #include <wtf/Forward.h>
 #include <wtf/text/WTFString.h>
 
@@ -59,6 +60,8 @@
     virtual void bringToFront() = 0;
     virtual void closeWindow() = 0;
 
+    virtual UserInterfaceLayoutDirection userInterfaceLayoutDirection() const = 0;
+
     WEBCORE_EXPORT virtual void requestSetDockSide(DockSide) = 0;
     WEBCORE_EXPORT virtual void changeAttachedWindowHeight(unsigned) = 0;
     WEBCORE_EXPORT virtual void changeAttachedWindowWidth(unsigned) = 0;

Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp (212271 => 212272)


--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp	2017-02-14 02:20:50 UTC (rev 212271)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp	2017-02-14 02:28:55 UTC (rev 212272)
@@ -169,6 +169,11 @@
     m_evaluateOnLoad.clear();
 }
 
+UserInterfaceLayoutDirection InspectorFrontendClientLocal::userInterfaceLayoutDirection() const
+{
+    return m_frontendPage->userInterfaceLayoutDirection();
+}
+
 void InspectorFrontendClientLocal::requestSetDockSide(DockSide dockSide)
 {
     if (dockSide == DockSide::Undocked) {

Modified: trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h (212271 => 212272)


--- trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h	2017-02-14 02:20:50 UTC (rev 212271)
+++ trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.h	2017-02-14 02:28:55 UTC (rev 212272)
@@ -64,6 +64,8 @@
     void startWindowDrag() override { }
     WEBCORE_EXPORT void moveWindowBy(float x, float y) final;
 
+    WEBCORE_EXPORT UserInterfaceLayoutDirection userInterfaceLayoutDirection() const final;
+
     WEBCORE_EXPORT void requestSetDockSide(DockSide) final;
     WEBCORE_EXPORT void changeAttachedWindowHeight(unsigned) final;
     WEBCORE_EXPORT void changeAttachedWindowWidth(unsigned) final;

Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp (212271 => 212272)


--- trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp	2017-02-14 02:20:50 UTC (rev 212271)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.cpp	2017-02-14 02:28:55 UTC (rev 212272)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2017 Apple Inc. All rights reserved.
  * Copyright (C) 2008 Matt Lilek <web...@mattlilek.com>
  *
  * Redistribution and use in source and binary forms, with or without
@@ -196,6 +196,14 @@
     return 1.0;
 }
 
+String InspectorFrontendHost::userInterfaceLayoutDirection()
+{
+    if (m_client && m_client->userInterfaceLayoutDirection() == UserInterfaceLayoutDirection::RTL)
+        return ASCIILiteral("rtl");
+
+    return ASCIILiteral("ltr");
+}
+
 void InspectorFrontendHost::setAttachedWindowHeight(unsigned height)
 {
     if (m_client)

Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.h (212271 => 212272)


--- trunk/Source/WebCore/inspector/InspectorFrontendHost.h	2017-02-14 02:20:50 UTC (rev 212271)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.h	2017-02-14 02:28:55 UTC (rev 212272)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -61,6 +61,8 @@
     void setZoomFactor(float);
     float zoomFactor();
 
+    String userInterfaceLayoutDirection();
+
     void setAttachedWindowHeight(unsigned);
     void setAttachedWindowWidth(unsigned);
 

Modified: trunk/Source/WebCore/inspector/InspectorFrontendHost.idl (212271 => 212272)


--- trunk/Source/WebCore/inspector/InspectorFrontendHost.idl	2017-02-14 02:20:50 UTC (rev 212271)
+++ trunk/Source/WebCore/inspector/InspectorFrontendHost.idl	2017-02-14 02:28:55 UTC (rev 212272)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2017 Apple Inc. All rights reserved.
  * Copyright (C) 2008 Matt Lilek <web...@mattlilek.com>
  * Copyright (C) 2009 Google Inc. All rights reserved.
  *
@@ -42,6 +42,8 @@
     void setZoomFactor(unrestricted float zoom);
     float zoomFactor();
 
+    DOMString userInterfaceLayoutDirection();
+
     void requestSetDockSide(DOMString side);
 
     void setAttachedWindowHeight(unsigned long height);

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/InspectorFrontendHostStub.js (212271 => 212272)


--- trunk/Source/WebInspectorUI/UserInterface/Base/InspectorFrontendHostStub.js	2017-02-14 02:20:50 UTC (rev 212271)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/InspectorFrontendHostStub.js	2017-02-14 02:28:55 UTC (rev 212272)
@@ -64,6 +64,11 @@
             this._windowVisible = false;
         },
 
+        userInterfaceLayoutDirection: function()
+        {
+            return "ltr";
+        },
+
         requestSetDockSide: function(side)
         {
             InspectorFrontendAPI.setDockSide(side);

Modified: trunk/Source/WebKit2/ChangeLog (212271 => 212272)


--- trunk/Source/WebKit2/ChangeLog	2017-02-14 02:20:50 UTC (rev 212271)
+++ trunk/Source/WebKit2/ChangeLog	2017-02-14 02:28:55 UTC (rev 212272)
@@ -1,3 +1,22 @@
+2017-02-12  Brian Burg  <bb...@apple.com>
+
+        Web Inspector: expose system user interface layout direction through InspectorFrontendHost
+        https://bugs.webkit.org/show_bug.cgi?id=168209
+        <rdar://problem/11573736>
+
+        Reviewed by Joseph Pecoraro.
+
+        Forward the UserInterfaceLayoutDirection of the inspector page. If the WebKit client has
+        properly set the UI directionality from system settings in PageClient, this will get inherited
+        automatically by the Inspector's WebPage instance.
+
+        * WebProcess/WebPage/RemoteWebInspectorUI.cpp:
+        (WebKit::RemoteWebInspectorUI::userInterfaceLayoutDirection):
+        * WebProcess/WebPage/RemoteWebInspectorUI.h:
+        * WebProcess/WebPage/WebInspectorUI.cpp:
+        (WebKit::WebInspectorUI::userInterfaceLayoutDirection):
+        * WebProcess/WebPage/WebInspectorUI.h:
+
 2017-02-13  Youenn Fablet  <youe...@gmail.com>
 
         [WebRTC] Creating RTCPeerConnection with libwebrtc backend is crashing on rwt

Modified: trunk/Source/WebKit2/WebProcess/WebPage/RemoteWebInspectorUI.cpp (212271 => 212272)


--- trunk/Source/WebKit2/WebProcess/WebPage/RemoteWebInspectorUI.cpp	2017-02-14 02:20:50 UTC (rev 212271)
+++ trunk/Source/WebKit2/WebProcess/WebPage/RemoteWebInspectorUI.cpp	2017-02-14 02:28:55 UTC (rev 212272)
@@ -112,6 +112,11 @@
     m_page.corePage()->chrome().setWindowRect(frameRect);
 }
 
+WebCore::UserInterfaceLayoutDirection RemoteWebInspectorUI::userInterfaceLayoutDirection() const
+{
+    return m_page.corePage()->userInterfaceLayoutDirection();
+}
+
 void RemoteWebInspectorUI::bringToFront()
 {
     WebProcess::singleton().parentProcessConnection()->send(Messages::RemoteWebInspectorProxy::BringToFront(), m_page.pageID());

Modified: trunk/Source/WebKit2/WebProcess/WebPage/RemoteWebInspectorUI.h (212271 => 212272)


--- trunk/Source/WebKit2/WebProcess/WebPage/RemoteWebInspectorUI.h	2017-02-14 02:20:50 UTC (rev 212271)
+++ trunk/Source/WebKit2/WebProcess/WebPage/RemoteWebInspectorUI.h	2017-02-14 02:28:55 UTC (rev 212272)
@@ -58,6 +58,8 @@
     String backendCommandsURL() override { return m_backendCommandsURL; }
     String debuggableType() override { return m_debuggableType; }
 
+    WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() const override;
+
     void bringToFront() override;
     void closeWindow() override;
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp (212271 => 212272)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp	2017-02-14 02:20:50 UTC (rev 212271)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.cpp	2017-02-14 02:28:55 UTC (rev 212272)
@@ -138,6 +138,11 @@
     m_underTest = false;
 }
 
+WebCore::UserInterfaceLayoutDirection WebInspectorUI::userInterfaceLayoutDirection() const
+{
+    return m_page.corePage()->userInterfaceLayoutDirection();
+}
+
 void WebInspectorUI::requestSetDockSide(DockSide side)
 {
     auto& webProcess = WebProcess::singleton();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h (212271 => 212272)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h	2017-02-14 02:20:50 UTC (rev 212271)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspectorUI.h	2017-02-14 02:28:55 UTC (rev 212272)
@@ -90,6 +90,8 @@
     void bringToFront() override;
     void closeWindow() override;
 
+    WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() const override;
+
     void requestSetDockSide(DockSide) override;
     void changeAttachedWindowHeight(unsigned) override;
     void changeAttachedWindowWidth(unsigned) override;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to