Title: [285839] trunk/Source/WebInspectorUI
Revision
285839
Author
hironori.fu...@sony.com
Date
2021-11-15 16:07:03 -0800 (Mon, 15 Nov 2021)

Log Message

Web Inspector: Layers Tab: the position of composited layer with box-shadow is wrong
https://bugs.webkit.org/show_bug.cgi?id=233026

Reviewed by Devin Rousso.

If an element has box-shadow, Layers Tab showed the composited
layer positioned wrongly. It assumed the composited layer position
was same with its element position. This isn't true. If an element
has box-shadow, its composited layer includes the surrounding
box-shadow.

* UserInterface/Models/Layer.js:
(WI.Layer):
* UserInterface/Views/Layers3DContentView.js:
(WI.Layers3DContentView.prototype._updateLayers):
(WI.Layers3DContentView.prototype._createLayerMesh):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (285838 => 285839)


--- trunk/Source/WebInspectorUI/ChangeLog	2021-11-15 22:44:13 UTC (rev 285838)
+++ trunk/Source/WebInspectorUI/ChangeLog	2021-11-16 00:07:03 UTC (rev 285839)
@@ -1,3 +1,22 @@
+2021-11-15  Fujii Hironori  <hironori.fu...@sony.com>
+
+        Web Inspector: Layers Tab: the position of composited layer with box-shadow is wrong
+        https://bugs.webkit.org/show_bug.cgi?id=233026
+
+        Reviewed by Devin Rousso.
+
+        If an element has box-shadow, Layers Tab showed the composited
+        layer positioned wrongly. It assumed the composited layer position
+        was same with its element position. This isn't true. If an element
+        has box-shadow, its composited layer includes the surrounding
+        box-shadow.
+
+        * UserInterface/Models/Layer.js:
+        (WI.Layer):
+        * UserInterface/Views/Layers3DContentView.js:
+        (WI.Layers3DContentView.prototype._updateLayers):
+        (WI.Layers3DContentView.prototype._createLayerMesh):
+
 2021-11-12  Razvan Caliman  <rcali...@apple.com>
 
         Web Inspector: Extract reusable logic from ResourceQueryController, ResourceQueryResult and ResourceQueryMatch

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Layer.js (285838 => 285839)


--- trunk/Source/WebInspectorUI/UserInterface/Models/Layer.js	2021-11-15 22:44:13 UTC (rev 285838)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Layer.js	2021-11-16 00:07:03 UTC (rev 285839)
@@ -41,9 +41,9 @@
         this._pseudoElementId = pseudoElementId;
         this._pseudoElement = pseudoElement;
 
-        // FIXME: This should probably be moved to the backend.
-        this._compositedBounds.x = this._bounds.x;
-        this._compositedBounds.y = this._bounds.y;
+        // Transform compositedBounds to the global position
+        this._compositedBounds.x += this._bounds.x;
+        this._compositedBounds.y += this._bounds.y;
     }
 
     // Static

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js (285838 => 285839)


--- trunk/Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js	2021-11-15 22:44:13 UTC (rev 285838)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js	2021-11-16 00:07:03 UTC (rev 285839)
@@ -269,7 +269,7 @@
         const zInterval = 25;
         newLayers.forEach((layer, index) => {
             let layerGroup = this._layerGroupsById.get(layer.layerId);
-            layerGroup.position.set(layer.bounds.x, -layer.bounds.y, index * zInterval);
+            layerGroup.position.set(0, 0, index * zInterval);
         });
 
         this._boundingBox.setFromObject(this._scene);
@@ -286,14 +286,14 @@
         return layerGroup;
     }
 
-    _createLayerMesh({width, height}, isOutline = false)
+    _createLayerMesh({x, y, width, height}, isOutline = false)
     {
         let geometry = new THREE.Geometry;
         geometry.vertices.push(
-            new THREE.Vector3(0,     0,       0),
-            new THREE.Vector3(0,     -height, 0),
-            new THREE.Vector3(width, -height, 0),
-            new THREE.Vector3(width, 0,       0),
+            new THREE.Vector3(x, -y, 0),
+            new THREE.Vector3(x, -y - height, 0),
+            new THREE.Vector3(x + width, -y - height, 0),
+            new THREE.Vector3(x + width, -y, 0),
         );
 
         if (isOutline) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to