Skip to content

Work in progress: Web Inspector: Layers 3D view does not re-snapshot preserved layers after repaint#62306

Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
AnujPanta1:eng/174358757
Apr 10, 2026
Merged

Work in progress: Web Inspector: Layers 3D view does not re-snapshot preserved layers after repaint#62306
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
AnujPanta1:eng/174358757

Conversation

@AnujPanta1
Copy link
Copy Markdown
Contributor

@AnujPanta1 AnujPanta1 commented Apr 8, 2026

787ecfc

Work in progress: Web Inspector: Layers 3D view does not re-snapshot preserved layers after repaint
https://bugs.webkit.org/show_bug.cgi?id=311767
rdar://174358757

Reviewed by Devin Rousso.

When layerTreeDidChange fires and layers have the same IDs as before,
they are classified as "preserved" and keep their existing textures
indefinitely — even if their content has been repainted. Compare each
preserved layer's paintCount to detect repaints and re-snapshot when
it changes.

Toggling the layer contents setting rebuilds meshes but does not
reposition layer groups at the new z-interval (10 for textured, 25
for non-textured). Add z-position update and bounding box
recalculation after refresh.

* Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js:
(WI.Layers3DContentView.prototype._updateLayers):
(WI.Layers3DContentView.prototype._disposeLayerGroupChildren):
(WI.Layers3DContentView.prototype._handleLayerContentsSettingChanged):

Canonical link: https://commits.webkit.org/310892@main

650714f

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe 🛠 win ❌ 🛠 ios-apple
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 🧪 win-tests ❌ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ❌ 🛠 vision-apple
✅ 🧪 ios-wk2-wpt 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress 🛠 playstation
✅ 🧪 vision-wk2 🧪 mac-intel-wk2
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
🛠 watch
✅ 🛠 watch-sim

@AnujPanta1 AnujPanta1 self-assigned this Apr 8, 2026
@AnujPanta1 AnujPanta1 added the Web Inspector Bugs related to the WebKit Web Inspector. label Apr 8, 2026
@AnujPanta1 AnujPanta1 requested a review from the-chenergy April 9, 2026 01:44
Comment on lines +291 to +297
for (let child of layerGroup.children) {
child.geometry?.dispose();
child.material?.map?.dispose();
child.material?.dispose();
}
while (layerGroup.children.length > 0)
layerGroup.remove(layerGroup.children[0]);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +555 to +556
if (layerGroup)
layerGroup.position.set(0, 0, index * zInterval);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: we could use optional chaining here

Suggested change
if (layerGroup)
layerGroup.position.set(0, 0, index * zInterval);
layerGroup?.position.set(0, 0, index * zInterval);

Comment on lines +559 to +560
this._boundingBox.setFromObject(this._scene);
this._controls.maxDistance = this._boundingBox.max.z + WI.Layers3DContentView._zPadding;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you elaborate why these are needed?

@AnujPanta1 AnujPanta1 added the merge-queue Applied to send a pull request to merge-queue label Apr 10, 2026
…preserved layers after repaint

https://bugs.webkit.org/show_bug.cgi?id=311767
rdar://174358757

Reviewed by Devin Rousso.

When layerTreeDidChange fires and layers have the same IDs as before,
they are classified as "preserved" and keep their existing textures
indefinitely — even if their content has been repainted. Compare each
preserved layer's paintCount to detect repaints and re-snapshot when
it changes.

Toggling the layer contents setting rebuilds meshes but does not
reposition layer groups at the new z-interval (10 for textured, 25
for non-textured). Add z-position update and bounding box
recalculation after refresh.

* Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js:
(WI.Layers3DContentView.prototype._updateLayers):
(WI.Layers3DContentView.prototype._disposeLayerGroupChildren):
(WI.Layers3DContentView.prototype._handleLayerContentsSettingChanged):

Canonical link: https://commits.webkit.org/310892@main
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 310892@main (787ecfc): https://commits.webkit.org/310892@main

Reviewed commits have been landed. Closing PR #62306 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 787ecfc into WebKit:main Apr 10, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Web Inspector Bugs related to the WebKit Web Inspector.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants