Title: [268832] branches/safari-610-branch/Source
Revision
268832
Author
[email protected]
Date
2020-10-21 15:15:52 -0700 (Wed, 21 Oct 2020)

Log Message

Cherry-pick r268473. rdar://problem/70541789

    Web Inspector: REGRESSION(r267148): new Big Sur styles are not used
    https://bugs.webkit.org/show_bug.cgi?id=217682
    <rdar://problem/70269030>

    Reviewed by Brian Burg.

    r267148 changed `navigator.userAgent` from `11_0` to `10_15_7`. This breaks Web Inspector
    styling, which relied on this value to know what OS version it was running on in order to
    know which styles to use.

    Source/WebCore:

    * inspector/InspectorFrontendHost.idl:
    * inspector/InspectorFrontendHost.h:
    * inspector/InspectorFrontendHost.cpp:
    (WebCore::InspectorFrontendHost::platformVersionName const): Added.
    Derive a lowercased kekab-cased platform version name from `__MAC_OS_X_VERSION_MIN_REQUIRED`.

    Source/WebInspectorUI:

    * UserInterface/Base/Platform.js:
    * UserInterface/Views/Variables.css:
    (body.mac-platform): Added.
    (body.mac-platform:not(.sierra, .high-sierra)): Deleted.
    Use `InspectorFrontendHost.platformVersionName` instead of `navigator.userAgent`. Remove
    unnecessary platform version names and other unused data.

    * UserInterface/Base/Main.js:
    (WI.contentLoaded):
    (WI.undockedTitleAreaHeight): Added.
    * UserInterface/Views/Popover.js:
    (WI.Popover.prototype._update):
    Provide a way to get the undocked title area height for use in _javascript_ calculations.

    * UserInterface/Controllers/HARBuilder.js:
    (WI.HARBuilder.creator):
    The `WI.Platform.version.build` hasn't changed in a long time, so just remove it.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268473 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-610-branch/Source/WebCore/ChangeLog (268831 => 268832)


--- branches/safari-610-branch/Source/WebCore/ChangeLog	2020-10-21 22:15:49 UTC (rev 268831)
+++ branches/safari-610-branch/Source/WebCore/ChangeLog	2020-10-21 22:15:52 UTC (rev 268832)
@@ -1,5 +1,68 @@
 2020-10-21  Russell Epstein  <[email protected]>
 
+        Cherry-pick r268473. rdar://problem/70541789
+
+    Web Inspector: REGRESSION(r267148): new Big Sur styles are not used
+    https://bugs.webkit.org/show_bug.cgi?id=217682
+    <rdar://problem/70269030>
+    
+    Reviewed by Brian Burg.
+    
+    r267148 changed `navigator.userAgent` from `11_0` to `10_15_7`. This breaks Web Inspector
+    styling, which relied on this value to know what OS version it was running on in order to
+    know which styles to use.
+    
+    Source/WebCore:
+    
+    * inspector/InspectorFrontendHost.idl:
+    * inspector/InspectorFrontendHost.h:
+    * inspector/InspectorFrontendHost.cpp:
+    (WebCore::InspectorFrontendHost::platformVersionName const): Added.
+    Derive a lowercased kekab-cased platform version name from `__MAC_OS_X_VERSION_MIN_REQUIRED`.
+    
+    Source/WebInspectorUI:
+    
+    * UserInterface/Base/Platform.js:
+    * UserInterface/Views/Variables.css:
+    (body.mac-platform): Added.
+    (body.mac-platform:not(.sierra, .high-sierra)): Deleted.
+    Use `InspectorFrontendHost.platformVersionName` instead of `navigator.userAgent`. Remove
+    unnecessary platform version names and other unused data.
+    
+    * UserInterface/Base/Main.js:
+    (WI.contentLoaded):
+    (WI.undockedTitleAreaHeight): Added.
+    * UserInterface/Views/Popover.js:
+    (WI.Popover.prototype._update):
+    Provide a way to get the undocked title area height for use in _javascript_ calculations.
+    
+    * UserInterface/Controllers/HARBuilder.js:
+    (WI.HARBuilder.creator):
+    The `WI.Platform.version.build` hasn't changed in a long time, so just remove it.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268473 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-10-14  Devin Rousso  <[email protected]>
+
+            Web Inspector: REGRESSION(r267148): new Big Sur styles are not used
+            https://bugs.webkit.org/show_bug.cgi?id=217682
+            <rdar://problem/70269030>
+
+            Reviewed by Brian Burg.
+
+            r267148 changed `navigator.userAgent` from `11_0` to `10_15_7`. This breaks Web Inspector
+            styling, which relied on this value to know what OS version it was running on in order to
+            know which styles to use.
+
+            * inspector/InspectorFrontendHost.idl:
+            * inspector/InspectorFrontendHost.h:
+            * inspector/InspectorFrontendHost.cpp:
+            (WebCore::InspectorFrontendHost::platformVersionName const): Added.
+            Derive a lowercased kekab-cased platform version name from `__MAC_OS_X_VERSION_MIN_REQUIRED`.
+
+2020-10-21  Russell Epstein  <[email protected]>
+
         Cherry-pick r268084. rdar://problem/70541921
 
     AX: Expose lineRangeForPosition for iOS Accessibility code

Modified: branches/safari-610-branch/Source/WebCore/inspector/InspectorFrontendHost.cpp (268831 => 268832)


--- branches/safari-610-branch/Source/WebCore/inspector/InspectorFrontendHost.cpp	2020-10-21 22:15:49 UTC (rev 268831)
+++ branches/safari-610-branch/Source/WebCore/inspector/InspectorFrontendHost.cpp	2020-10-21 22:15:52 UTC (rev 268832)
@@ -388,6 +388,19 @@
 #endif
 }
 
+String InspectorFrontendHost::platformVersionName() const
+{
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000
+    return "big-sur"_s;
+#elif PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500
+    return "catalina"_s;
+#elif PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+    return "mojave"_s;
+#else
+    return emptyString();
+#endif
+}
+
 String InspectorFrontendHost::port() const
 {
 #if PLATFORM(GTK)

Modified: branches/safari-610-branch/Source/WebCore/inspector/InspectorFrontendHost.h (268831 => 268832)


--- branches/safari-610-branch/Source/WebCore/inspector/InspectorFrontendHost.h	2020-10-21 22:15:49 UTC (rev 268831)
+++ branches/safari-610-branch/Source/WebCore/inspector/InspectorFrontendHost.h	2020-10-21 22:15:52 UTC (rev 268832)
@@ -89,6 +89,7 @@
     unsigned inspectionLevel() const;
 
     String platform() const;
+    String platformVersionName() const;
     String port() const;
 
     struct DebuggableInfo {

Modified: branches/safari-610-branch/Source/WebCore/inspector/InspectorFrontendHost.idl (268831 => 268832)


--- branches/safari-610-branch/Source/WebCore/inspector/InspectorFrontendHost.idl	2020-10-21 22:15:49 UTC (rev 268831)
+++ branches/safari-610-branch/Source/WebCore/inspector/InspectorFrontendHost.idl	2020-10-21 22:15:52 UTC (rev 268832)
@@ -79,6 +79,7 @@
 
     readonly attribute DOMString port;
     readonly attribute DOMString platform;
+    readonly attribute DOMString platformVersionName;
 
     void showContextMenu(Event event, sequence<ContextMenuItem> items);
     void dispatchEventAsContextMenuEvent(Event event);

Modified: branches/safari-610-branch/Source/WebInspectorUI/ChangeLog (268831 => 268832)


--- branches/safari-610-branch/Source/WebInspectorUI/ChangeLog	2020-10-21 22:15:49 UTC (rev 268831)
+++ branches/safari-610-branch/Source/WebInspectorUI/ChangeLog	2020-10-21 22:15:52 UTC (rev 268832)
@@ -1,3 +1,78 @@
+2020-10-21  Russell Epstein  <[email protected]>
+
+        Cherry-pick r268473. rdar://problem/70541789
+
+    Web Inspector: REGRESSION(r267148): new Big Sur styles are not used
+    https://bugs.webkit.org/show_bug.cgi?id=217682
+    <rdar://problem/70269030>
+    
+    Reviewed by Brian Burg.
+    
+    r267148 changed `navigator.userAgent` from `11_0` to `10_15_7`. This breaks Web Inspector
+    styling, which relied on this value to know what OS version it was running on in order to
+    know which styles to use.
+    
+    Source/WebCore:
+    
+    * inspector/InspectorFrontendHost.idl:
+    * inspector/InspectorFrontendHost.h:
+    * inspector/InspectorFrontendHost.cpp:
+    (WebCore::InspectorFrontendHost::platformVersionName const): Added.
+    Derive a lowercased kekab-cased platform version name from `__MAC_OS_X_VERSION_MIN_REQUIRED`.
+    
+    Source/WebInspectorUI:
+    
+    * UserInterface/Base/Platform.js:
+    * UserInterface/Views/Variables.css:
+    (body.mac-platform): Added.
+    (body.mac-platform:not(.sierra, .high-sierra)): Deleted.
+    Use `InspectorFrontendHost.platformVersionName` instead of `navigator.userAgent`. Remove
+    unnecessary platform version names and other unused data.
+    
+    * UserInterface/Base/Main.js:
+    (WI.contentLoaded):
+    (WI.undockedTitleAreaHeight): Added.
+    * UserInterface/Views/Popover.js:
+    (WI.Popover.prototype._update):
+    Provide a way to get the undocked title area height for use in _javascript_ calculations.
+    
+    * UserInterface/Controllers/HARBuilder.js:
+    (WI.HARBuilder.creator):
+    The `WI.Platform.version.build` hasn't changed in a long time, so just remove it.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268473 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-10-14  Devin Rousso  <[email protected]>
+
+            Web Inspector: REGRESSION(r267148): new Big Sur styles are not used
+            https://bugs.webkit.org/show_bug.cgi?id=217682
+            <rdar://problem/70269030>
+
+            Reviewed by Brian Burg.
+
+            r267148 changed `navigator.userAgent` from `11_0` to `10_15_7`. This breaks Web Inspector
+            styling, which relied on this value to know what OS version it was running on in order to
+            know which styles to use.
+
+            * UserInterface/Base/Platform.js:
+            * UserInterface/Views/Variables.css:
+            (body.mac-platform): Added.
+            (body.mac-platform:not(.sierra, .high-sierra)): Deleted.
+            Use `InspectorFrontendHost.platformVersionName` instead of `navigator.userAgent`. Remove
+            unnecessary platform version names and other unused data.
+
+            * UserInterface/Base/Main.js:
+            (WI.contentLoaded):
+            (WI.undockedTitleAreaHeight): Added.
+            * UserInterface/Views/Popover.js:
+            (WI.Popover.prototype._update):
+            Provide a way to get the undocked title area height for use in _javascript_ calculations.
+
+            * UserInterface/Controllers/HARBuilder.js:
+            (WI.HARBuilder.creator):
+            The `WI.Platform.version.build` hasn't changed in a long time, so just remove it.
+
 2020-10-14  Alan Coon  <[email protected]>
 
         Cherry-pick r268371. rdar://problem/70267767

Modified: branches/safari-610-branch/Source/WebInspectorUI/UserInterface/Base/Main.js (268831 => 268832)


--- branches/safari-610-branch/Source/WebInspectorUI/UserInterface/Base/Main.js	2020-10-21 22:15:49 UTC (rev 268831)
+++ branches/safari-610-branch/Source/WebInspectorUI/UserInterface/Base/Main.js	2020-10-21 22:15:52 UTC (rev 268832)
@@ -247,10 +247,7 @@
 
     // Add platform style classes so the UI can be tweaked per-platform.
     document.body.classList.add(WI.Platform.name + "-platform");
-    if (WI.Platform.isNightlyBuild)
-        document.body.classList.add("nightly-build");
-
-    if (WI.Platform.name === "mac")
+    if (WI.Platform.version.name)
         document.body.classList.add(WI.Platform.version.name);
 
     document.body.classList.add(WI.sharedApp.debuggableType);
@@ -2800,6 +2797,27 @@
     InspectorFrontendHost.reopen();
 };
 
+WI.undockedTitleAreaHeight = function()
+{
+    if (WI.dockConfiguration !== WI.DockConfiguration.Undocked)
+        return 0;
+
+    if (WI.Platform.name === "mac") {
+        switch (WI.Platform.version.name) {
+        case "big-sur":
+            /* keep in sync with `body.mac-platform.big-sur:not(.docked)` */
+            return 27 / WI.getZoomFactor();
+
+        case "catalina":
+        case "mojave":
+            /* keep in sync with `body.mac-platform:not(.big-sur):not(.docked)` */
+            return 22 / WI.getZoomFactor();
+        }
+    }
+
+    return 0;
+};
+
 WI._showTabAtIndexFromShortcut = function(i)
 {
     if (i <= WI.tabBar.tabCount) {

Modified: branches/safari-610-branch/Source/WebInspectorUI/UserInterface/Base/Platform.js (268831 => 268832)


--- branches/safari-610-branch/Source/WebInspectorUI/UserInterface/Base/Platform.js	2020-10-21 22:15:49 UTC (rev 268831)
+++ branches/safari-610-branch/Source/WebInspectorUI/UserInterface/Base/Platform.js	2020-10-21 22:15:52 UTC (rev 268832)
@@ -25,61 +25,7 @@
 
 WI.Platform = {
     name: InspectorFrontendHost.platform,
-    isNightlyBuild: false,
     version: {
-        base: 0,
-        release: 0,
-        name: "",
-        build: "",
+        name: InspectorFrontendHost.platformVersionName,
     }
 };
-
-(function () {
-    let versionMatch = / AppleWebKit\/([^ ]+)/.exec(navigator.userAgent);
-    if (versionMatch) {
-        WI.Platform.version.build = versionMatch[1];
-
-        // Check for a nightly build by looking for a plus in the version number and a small number of stylesheets (indicating combined resources).
-        if (versionMatch[1].indexOf("+") !== -1 && document.styleSheets.length < 10)
-            WI.Platform.isNightlyBuild = true;
-    }
-
-    let osVersionMatch = / Mac OS X (\d+)_(\d+)/.exec(navigator.appVersion);
-    if (osVersionMatch) {
-        WI.Platform.version.base = parseInt(osVersionMatch[1]);
-        WI.Platform.version.release = parseInt(osVersionMatch[2]);
-
-        switch (WI.Platform.version.base) {
-        case 10:
-            switch (WI.Platform.version.release) {
-            case 15:
-                WI.Platform.version.name = "catalina";
-                break;
-            case 14:
-                WI.Platform.version.name = "mojave";
-                break;
-            case 13:
-                WI.Platform.version.name = "high-sierra";
-                break;
-            case 12:
-                WI.Platform.version.name = "sierra";
-                break;
-            default:
-                WI.Platform.version.name = "unknown-mac";
-                break;
-            }
-            break;
-
-        case 11:
-            switch (WI.Platform.version.release) {
-            case 0:
-                WI.Platform.version.name = "big-sur";
-                break;
-            default:
-                WI.Platform.version.name = "unknown-mac";
-                break;
-            }
-            break;
-        }
-    }
-})();

Modified: branches/safari-610-branch/Source/WebInspectorUI/UserInterface/Controllers/HARBuilder.js (268831 => 268832)


--- branches/safari-610-branch/Source/WebInspectorUI/UserInterface/Controllers/HARBuilder.js	2020-10-21 22:15:49 UTC (rev 268831)
+++ branches/safari-610-branch/Source/WebInspectorUI/UserInterface/Controllers/HARBuilder.js	2020-10-21 22:15:52 UTC (rev 268832)
@@ -60,7 +60,7 @@
     {
         return {
             name: "WebKit Web Inspector",
-            version: WI.Platform.version.build || "1.0",
+            version: "1.0",
         };
     }
 

Modified: branches/safari-610-branch/Source/WebInspectorUI/UserInterface/Views/Popover.js (268831 => 268832)


--- branches/safari-610-branch/Source/WebInspectorUI/UserInterface/Views/Popover.js	2020-10-21 22:15:49 UTC (rev 268831)
+++ branches/safari-610-branch/Source/WebInspectorUI/UserInterface/Views/Popover.js	2020-10-21 22:15:52 UTC (rev 268832)
@@ -235,7 +235,7 @@
             this._preferredSize = new WI.Size(Math.ceil(popoverBounds.width), Math.ceil(popoverBounds.height));
         }
 
-        var titleBarOffset = WI.Platform.name === "mac" ? 22 : 0;
+        var titleBarOffset = WI.undockedTitleAreaHeight();
         var containerFrame = new WI.Rect(0, titleBarOffset, window.innerWidth, window.innerHeight - titleBarOffset);
         // The frame of the window with a little inset to make sure we have room for shadows.
         containerFrame = containerFrame.inset(WI.Popover.ShadowEdgeInsets);

Modified: branches/safari-610-branch/Source/WebInspectorUI/UserInterface/Views/Variables.css (268831 => 268832)


--- branches/safari-610-branch/Source/WebInspectorUI/UserInterface/Views/Variables.css	2020-10-21 22:15:49 UTC (rev 268831)
+++ branches/safari-610-branch/Source/WebInspectorUI/UserInterface/Views/Variables.css	2020-10-21 22:15:52 UTC (rev 268832)
@@ -238,10 +238,12 @@
 }
 
 body.mac-platform:not(.big-sur):not(.docked) {
+    /* keep in sync with `WI.undockedTitleAreaHeight` */
     --undocked-title-area-height: calc(22px / var(--zoom-factor));
 }
 
 body.mac-platform.big-sur:not(.docked) {
+    /* keep in sync with `WI.undockedTitleAreaHeight` */
     --undocked-title-area-height: calc(27px / var(--zoom-factor));
 }
 
@@ -408,7 +410,7 @@
     }
 }
 
-body.mac-platform:not(.sierra, .high-sierra) {
+body.mac-platform {
     --selected-foreground-color: -apple-system-alternate-selected-text;
     --selected-background-color: -apple-system-selected-content-background;
     --selected-text-background-color: -apple-system-selected-text-background;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to