Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web Inspector: “Inspect Element” doesn’t reveal element in DOM tree if the element is hidden behind the "Show All Nodes" button #8502

Conversation

patrickangle
Copy link
Contributor

@patrickangle patrickangle commented Jan 11, 2023

93e9322

Web Inspector: “Inspect Element” doesn’t reveal element in DOM tree if the element is hidden behind the "Show All Nodes" button
https://bugs.webkit.org/show_bug.cgi?id=250430
rdar://102669246

Reviewed by Devin Rousso.

Revealing a TreeElement currently makes sure to traverse up through parent elements to expand each element to make sure
the element is visible. This doesn't necessilary work for DOMTreeElements, though, since they may additionally have
hidden elements behind a "Show All Nodes" button. This means we need to provide each parent element an opportunity to
fill in these hidden elements so that the entire chain of tree elements is actually loaded, otherwise we won't actually
reveal the element we wanted to.

* Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js:
(WI.DOMTreeElement.prototype.reveal):
- Tree elements should call to each ancestor to make sure the entire chain of elements is actually revealed by providing
the parent elements an opportunity to fill in missing elements that they are not currently displaying.

(WI.DOMTreeElement.prototype.onexpand):
* Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js:
(WI.DOMTreeOutline.prototype._onmousemove):
- Related fixes: The element will not always be a DOMTreeElement (namely the button for showing more elements).

* Source/WebInspectorUI/UserInterface/Views/TreeElement.js:
(WI.TreeElement.prototype.reveal):
- Provide a way for to bypass expanding the ancestor tree. This is used by DOMTreeElement which overrides this method,
and expands the tree itself before calling here.

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

f562e09

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 🧪 win
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🛠 gtk ✅ 🛠 wincairo
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 🧪 api-mac ✅ 🧪 gtk-wk2
🧪 api-ios ✅ 🧪 mac-wk1 🧪 api-gtk
✅ 🛠 tv ✅ 🧪 mac-wk2
✅ 🛠 tv-sim ✅ 🧪 mac-AS-debug-wk2
✅ 🛠 watch ✅ 🧪 mac-wk2-stress
❌ 🛠 🧪 merge ✅ 🛠 watch-sim

@patrickangle patrickangle self-assigned this Jan 11, 2023
@patrickangle patrickangle added the Web Inspector Bugs related to the WebKit Web Inspector. label Jan 11, 2023
@@ -647,6 +647,12 @@ WI.DOMTreeElement = class DOMTreeElement extends WI.TreeElement
this.expandedChildrenLimit = Math.max(visibleChildren.length, this.expandedChildrenLimit + WI.DOMTreeElement.InitialChildrenLimit);
}

createElementsToRevealChildElement(childElement)
{
let indexOfChild = this.children.indexOf(childElement);
Copy link
Member

Choose a reason for hiding this comment

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

should we use _visibleChildren() instead? seems like other spots do


// Some subclasses may hide elements by default to avoid showing too many items initially, but to reveal an
// element we must load that element and previous sibilings as well.
currentElement.parent.createElementsToRevealChildElement(currentElement);
Copy link
Member

Choose a reason for hiding this comment

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

instead of having this be on the parent, could we maybe have WI.DOMTreeElement override reveal to do this logic instead? IMO no reason to have a protected method if we can handle this just within WI.DOMTreeElement instead. FYI it looks like showChildNode already does something kinda like this

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jan 11, 2023
@patrickangle patrickangle removed the merging-blocked Applied to prevent a change from being merged label Jan 11, 2023
@patrickangle patrickangle force-pushed the eng/b250430-inspect-element-doesnt-reveal-nodes-behind-show-all-nodes-button branch from 546ffac to f562e09 Compare January 11, 2023 17:51
@patrickangle patrickangle added the merge-queue Applied to send a pull request to merge-queue label Jan 11, 2023
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/b250430-inspect-element-doesnt-reveal-nodes-behind-show-all-nodes-button branch from f562e09 to 43eef4d Compare January 11, 2023 22:21
…f the element is hidden behind the "Show All Nodes" button

https://bugs.webkit.org/show_bug.cgi?id=250430
rdar://102669246

Reviewed by Devin Rousso.

Revealing a TreeElement currently makes sure to traverse up through parent elements to expand each element to make sure
the element is visible. This doesn't necessilary work for DOMTreeElements, though, since they may additionally have
hidden elements behind a "Show All Nodes" button. This means we need to provide each parent element an opportunity to
fill in these hidden elements so that the entire chain of tree elements is actually loaded, otherwise we won't actually
reveal the element we wanted to.

* Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js:
(WI.DOMTreeElement.prototype.reveal):
- Tree elements should call to each ancestor to make sure the entire chain of elements is actually revealed by providing
the parent elements an opportunity to fill in missing elements that they are not currently displaying.

(WI.DOMTreeElement.prototype.onexpand):
* Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js:
(WI.DOMTreeOutline.prototype._onmousemove):
- Related fixes: The element will not always be a DOMTreeElement (namely the button for showing more elements).

* Source/WebInspectorUI/UserInterface/Views/TreeElement.js:
(WI.TreeElement.prototype.reveal):
- Provide a way for to bypass expanding the ancestor tree. This is used by DOMTreeElement which overrides this method,
and expands the tree itself before calling here.

Canonical link: https://commits.webkit.org/258805@main
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/b250430-inspect-element-doesnt-reveal-nodes-behind-show-all-nodes-button branch from 43eef4d to 93e9322 Compare January 11, 2023 22:23
@webkit-commit-queue
Copy link
Collaborator

Committed 258805@main (93e9322): https://commits.webkit.org/258805@main

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

@webkit-early-warning-system webkit-early-warning-system merged commit 93e9322 into WebKit:main Jan 11, 2023
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Jan 11, 2023
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
5 participants