Title: [292597] trunk/Source
Revision
292597
Author
[email protected]
Date
2022-04-08 03:23:46 -0700 (Fri, 08 Apr 2022)

Log Message

Web Inspector: Use computedStyleMap() instead of deprecated getPropertyCSSValue()
https://bugs.webkit.org/show_bug.cgi?id=238661

Reviewed by Devin Rousso.

Source/WebInspectorUI:

Add Element.getComputedCSSPropertyNumberValue() instead of using computedStyleMap() directly to have a fallback
in case CSS_TYPED_OM is disabled in build.

* UserInterface/Base/Utilities.js:
(get return):
* UserInterface/Views/DataGridNode.js:
(WI.DataGridNode.prototype.isEventWithinDisclosureTriangle):
* UserInterface/Views/TabBar.js:
(WI.TabBar.prototype._handleMouseMoved.inlineStyleValue):
(WI.TabBar.prototype._handleMouseMoved):
* UserInterface/Views/TreeElement.js:
(WI.TreeElement.prototype.isEventWithinDisclosureTriangle):

Source/WebKit:

Ensure CSS Type OM is enabled in inspector frontend page.

* WebProcess/Inspector/WebInspectorUI.cpp:
(WebKit::WebInspectorUI::enableFrontendFeatures):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (292596 => 292597)


--- trunk/Source/WebInspectorUI/ChangeLog	2022-04-08 09:59:15 UTC (rev 292596)
+++ trunk/Source/WebInspectorUI/ChangeLog	2022-04-08 10:23:46 UTC (rev 292597)
@@ -1,3 +1,23 @@
+2022-04-08  Carlos Garcia Campos  <[email protected]>
+
+        Web Inspector: Use computedStyleMap() instead of deprecated getPropertyCSSValue()
+        https://bugs.webkit.org/show_bug.cgi?id=238661
+
+        Reviewed by Devin Rousso.
+
+        Add Element.getComputedCSSPropertyNumberValue() instead of using computedStyleMap() directly to have a fallback
+        in case CSS_TYPED_OM is disabled in build.
+
+        * UserInterface/Base/Utilities.js:
+        (get return):
+        * UserInterface/Views/DataGridNode.js:
+        (WI.DataGridNode.prototype.isEventWithinDisclosureTriangle):
+        * UserInterface/Views/TabBar.js:
+        (WI.TabBar.prototype._handleMouseMoved.inlineStyleValue):
+        (WI.TabBar.prototype._handleMouseMoved):
+        * UserInterface/Views/TreeElement.js:
+        (WI.TreeElement.prototype.isEventWithinDisclosureTriangle):
+
 2022-04-07  Elliott Williams  <[email protected]>
 
         [XCBuild] Enable dependency validation by default

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js (292596 => 292597)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js	2022-04-08 09:59:15 UTC (rev 292596)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js	2022-04-08 10:23:46 UTC (rev 292597)
@@ -488,6 +488,15 @@
     }
 });
 
+Object.defineProperty(Element.prototype, "getComputedCSSPropertyNumberValue", {
+    value(property) {
+        let result = undefined;
+        result ??= this.computedStyleMap?.().get(property)?.value;
+        result ??= window.getComputedStyle(this).getPropertyCSSValue(property)?.getFloatValue(CSSPrimitiveValue.CSS_PX);
+        return result;
+    },
+});
+
 Object.defineProperty(DocumentFragment.prototype, "createChild",
 {
     value: Element.prototype.createChild

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DataGridNode.js (292596 => 292597)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DataGridNode.js	2022-04-08 09:59:15 UTC (rev 292596)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DataGridNode.js	2022-04-08 10:23:46 UTC (rev 292597)
@@ -655,12 +655,11 @@
         if (!cell || !cell.classList.contains("disclosure"))
             return false;
 
-        let computedStyle = window.getComputedStyle(cell);
         let start = 0;
         if (WI.resolvedLayoutDirection() === WI.LayoutDirection.RTL)
-            start += cell.totalOffsetRight - computedStyle.getPropertyCSSValue("padding-right").getFloatValue(CSSPrimitiveValue.CSS_PX) - this.disclosureToggleWidth;
+            start += cell.totalOffsetRight - cell.getComputedCSSPropertyNumberValue("padding-right") - this.disclosureToggleWidth;
         else
-            start += cell.totalOffsetLeft + computedStyle.getPropertyCSSValue("padding-left").getFloatValue(CSSPrimitiveValue.CSS_PX);
+            start += cell.totalOffsetLeft + cell.getComputedCSSPropertyNumberValue("padding-left");
         return event.pageX >= start && event.pageX <= start + this.disclosureToggleWidth;
     }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js (292596 => 292597)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js	2022-04-08 09:59:15 UTC (rev 292596)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js	2022-04-08 10:23:46 UTC (rev 292597)
@@ -856,7 +856,7 @@
         // FIXME: Animate the tabs that move to make room for the selected tab. This was causing me trouble when I tried.
 
         function inlineStyleValue(element, property) {
-            return element.style.getPropertyCSSValue(property).getFloatValue(CSSPrimitiveValue.CSS_PX) || 0;
+            return element.getComputedCSSPropertyNumberValue(property) || 0;
         }
 
         let accumulatedLeft = 0;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TreeElement.js (292596 => 292597)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TreeElement.js	2022-04-08 09:59:15 UTC (rev 292596)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TreeElement.js	2022-04-08 10:23:46 UTC (rev 292597)
@@ -660,9 +660,9 @@
         let computedStyle = window.getComputedStyle(this._listItemNode);
         let start = 0;
         if (computedStyle.direction === WI.LayoutDirection.RTL)
-            start += this._listItemNode.totalOffsetRight - computedStyle.getPropertyCSSValue("padding-right").getFloatValue(CSSPrimitiveValue.CSS_PX) - this.arrowToggleWidth;
+            start += this._listItemNode.totalOffsetRight - this._listItemNode.getComputedCSSPropertyNumberValue("padding-right") - this.arrowToggleWidth;
         else
-            start += this._listItemNode.totalOffsetLeft + computedStyle.getPropertyCSSValue("padding-left").getFloatValue(CSSPrimitiveValue.CSS_PX);
+            start += this._listItemNode.totalOffsetLeft + this._listItemNode.getComputedCSSPropertyNumberValue("padding-left");
 
         return event.pageX >= start && event.pageX <= start + this.arrowToggleWidth && this.hasChildren;
     }

Modified: trunk/Source/WebKit/ChangeLog (292596 => 292597)


--- trunk/Source/WebKit/ChangeLog	2022-04-08 09:59:15 UTC (rev 292596)
+++ trunk/Source/WebKit/ChangeLog	2022-04-08 10:23:46 UTC (rev 292597)
@@ -1,5 +1,17 @@
 2022-04-08  Carlos Garcia Campos  <[email protected]>
 
+        Web Inspector: Use computedStyleMap() instead of deprecated getPropertyCSSValue()
+        https://bugs.webkit.org/show_bug.cgi?id=238661
+
+        Reviewed by Devin Rousso.
+
+        Ensure CSS Type OM is enabled in inspector frontend page.
+
+        * WebProcess/Inspector/WebInspectorUI.cpp:
+        (WebKit::WebInspectorUI::enableFrontendFeatures):
+
+2022-04-08  Carlos Garcia Campos  <[email protected]>
+
         Incorrect CORP/COEP check in 304 responses
         https://bugs.webkit.org/show_bug.cgi?id=238238
         <rdar://problem/90706510>

Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.cpp (292596 => 292597)


--- trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.cpp	2022-04-08 09:59:15 UTC (rev 292596)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspectorUI.cpp	2022-04-08 10:23:46 UTC (rev 292597)
@@ -61,6 +61,9 @@
 #if ENABLE(WEBGL2)
     page.corePage()->settings().setWebGL2Enabled(true);
 #endif
+#if ENABLE(CSS_TYPED_OM)
+    page.corePage()->settings().setCSSTypedOMEnabled(true);
+#endif
 }
 
 WebInspectorUI::WebInspectorUI(WebPage& page)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to