[Webkit-unassigned] [Bug 60160] Web Inspector: expose shadow DOM in the Elements panel
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed May 4 06:45:35 PDT 2011
https://bugs.webkit.org/show_bug.cgi?id=60160
--- Comment #6 from Andrey Kosyakov <caseq at chromium.org> 2011-05-04 06:45:34 PST ---
(From update of attachment 92223)
View in context: https://bugs.webkit.org/attachment.cgi?id=92223&action=review
>> LayoutTests/inspector/elements/shadow-dom-expected.txt:20
>> + - <div>
>
> Would be nice if the test used our own element with simpler shadow tree and would depend on the internal structure of <video> element.
We can't do that unless we do it in DumpRenderTree -- shadow DOM is not accessible from JavaScript. I don't think this is worth the hassle, given this would have to be implemented for multiple platforms.
>> Source/WebCore/dom/Element.cpp:1188
>> + InspectorInstrumentation::willInsertDOMNode(document(), newRoot.get(), this);
>
> Should it be willInsertShadowRoot?
It _may_ -- I was just trying to keep instrumentation interface narrow. That is, I don't think we have to distinguish between adding a new node as a child or as a shadow root here. I can add a separate method, though, if you think it's worth it.
>> Source/WebCore/inspector/front-end/DOMAgent.js:321
>> + child._inShadowTree = this._inShadowTree;
>
> This way all child nodes including non-shadow ones will be considered as shadow elements. We should support the case when an element with shadow tree contains non-shadow elements.
That's the intent, everything under shadow root belongs to shadow tree, there's no elements exposed via normal DOM interfaces under shadow root. This property in particular mirrors Node::inShadowTree() (we need this to visually distinguish entire contents of the shadow tree in the UI)
>>> Source/WebCore/inspector/front-end/ElementsTreeOutline.js:570
>>> + // If we ever had shadow root child, it's going to be second to last (before closing tag)
>>
>> Line contains tab character. [whitespace/tab] [5]
>
> Why is this? Can we check for the shadow root in a more clear way?
The intent here is to find a shadow root node within the existing children. We can probably scan the children (see how it happens above within the loop in updateChildrenOfNode()), but I don't think it's going to be any more clear (but definitely less efficient). Alternatively, we can store a separate reference to a particular child, but this way we should be careful to drop it when children are removed. I agree this code stinks, but any alternatives I see don't seem to be much better :)
>>> Source/WebCore/inspector/front-end/ElementsTreeOutline.js:571
>>> + var shadowRootChild = treeElement.children[treeElement.children.length - 2];
>>
>> Line contains tab character. [whitespace/tab] [5]
>
> This will throw if children.length < 2.
Nope, it's JavaScript. ([])[-1] === undefined
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list