RESOLVED FIXED Bug 105839
[HTMLTemplateElement] Allow <template> content to be inspected
https://bugs.webkit.org/show_bug.cgi?id=105839
Summary [HTMLTemplateElement] Allow <template> content to be inspected
Rafael Weinstein
Reported 2012-12-28 14:34:55 PST
<template> should be expandable in the 'elements' tab and it should contain a single '#document-fragment' child whose children are expandable.
Attachments
Patch (5.45 KB, patch)
2012-12-28 14:36 PST, Rafael Weinstein
no flags
Patch (11.10 KB, patch)
2013-01-02 17:39 PST, Rafael Weinstein
no flags
Patch (11.13 KB, patch)
2013-01-02 20:45 PST, Rafael Weinstein
no flags
Patch (11.20 KB, patch)
2013-01-03 09:48 PST, Rafael Weinstein
no flags
Patch (12.77 KB, patch)
2013-01-04 15:04 PST, Rafael Weinstein
no flags
Patch for landing (13.03 KB, patch)
2013-01-08 14:59 PST, Rafael Weinstein
no flags
Rafael Weinstein
Comment 1 2012-12-28 14:36:51 PST
Rafael Weinstein
Comment 2 2012-12-28 14:40:09 PST
Here is the start of a patch for this. The main problem is that when anything in the templateContent changes, it is not updated in the UI. I believe this is because there isn't an associated instrumenting agent with the owner document of the content or its children. Pavel, a little background: The template element's content document fragment is "inert" (images don't load, script doesn't run, etc...). The way this is accomplished is that it is owned by a different document which doesn't have a browsing context (frame). Unfortunately. this means that instrumentingAgentsForDocument() currently always returns 0; What's the best way to approach this?
Early Warning System Bot
Comment 3 2012-12-28 14:50:33 PST
Early Warning System Bot
Comment 4 2012-12-28 14:51:44 PST
EFL EWS Bot
Comment 5 2012-12-28 14:54:56 PST
Build Bot
Comment 6 2012-12-28 15:27:15 PST
Pavel Feldman
Comment 7 2012-12-29 03:05:25 PST
Comment on attachment 180901 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=180901&action=review > Source/WebCore/inspector/InspectorDOMAgent.cpp:1300 > + if (element->hasTagName(HTMLNames::templateTag)) #if ENABLE(TEMPLATE_ELEMENT) > Source/WebCore/inspector/front-end/DOMAgent.js:78 > + if (payload.templateContent) { No need for {} around one line block.
Pavel Feldman
Comment 8 2012-12-29 03:16:17 PST
> Pavel, a little background: The template element's content document fragment is "inert" (images don't load, script doesn't run, etc...). The way this is accomplished is that it is owned by a different document which doesn't have a browsing context (frame). > > Unfortunately. this means that instrumentingAgentsForDocument() currently always returns 0; > > What's the best way to approach this? Could we do something like m_templateContentsOwnerDocument->setTemplateContentsOwnerDocumentParent(this); in modify Document::templateContentsOwnerDocument()? Then instrumentingAgentsForDocument would follow that link and fetch appropriate page.
Rafael Weinstein
Comment 9 2013-01-02 17:36:28 PST
Comment on attachment 180901 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=180901&action=review >> Source/WebCore/inspector/InspectorDOMAgent.cpp:1300 >> + if (element->hasTagName(HTMLNames::templateTag)) > > #if ENABLE(TEMPLATE_ELEMENT) done >> Source/WebCore/inspector/front-end/DOMAgent.js:78 >> + if (payload.templateContent) { > > No need for {} around one line block. done
Rafael Weinstein
Comment 10 2013-01-02 17:39:00 PST
Rafael Weinstein
Comment 11 2013-01-02 17:40:36 PST
Ok, trying Pavel's suggestion.
Early Warning System Bot
Comment 12 2013-01-02 17:50:51 PST
Early Warning System Bot
Comment 13 2013-01-02 17:52:29 PST
Build Bot
Comment 14 2013-01-02 18:47:43 PST
Build Bot
Comment 15 2013-01-02 19:24:42 PST
Rafael Weinstein
Comment 16 2013-01-02 20:45:32 PST
Pavel Feldman
Comment 17 2013-01-03 00:46:32 PST
Comment on attachment 181141 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=181141&action=review > Source/WebCore/dom/Document.cpp:616 > + m_inertDocument.clear(); This will happen on its own. > Source/WebCore/dom/Document.cpp:5949 > +Document* Document::inertDocument() I don't find the new name self-explanatory, I'd rather leave it as is. r- is for this, otherwise lgtm.
Rafael Weinstein
Comment 18 2013-01-03 06:48:09 PST
Comment on attachment 181141 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=181141&action=review >> Source/WebCore/dom/Document.cpp:616 >> + m_inertDocument.clear(); > > This will happen on its own. done >> Source/WebCore/dom/Document.cpp:5949 >> +Document* Document::inertDocument() > > I don't find the new name self-explanatory, I'd rather leave it as is. r- is for this, otherwise lgtm. I renamed this one to avoid having to call the back pointer "templateContentsOwnerDocumentOwner" (what is currently "inertDocumentCreator"). I suppose I could go with "templateContentsOwner" and "templateContentsOwnerCreator"? ("Document" is implied in the type). Thoughts?
Rafael Weinstein
Comment 19 2013-01-03 09:48:41 PST
Rafael Weinstein
Comment 20 2013-01-03 09:48:55 PST
How ya like me now?
Rafael Weinstein
Comment 21 2013-01-04 15:04:57 PST
Rafael Weinstein
Comment 22 2013-01-04 15:05:19 PST
New patch resolves merge conflicts. Pavel: ping?
Rafael Weinstein
Comment 23 2013-01-08 14:59:34 PST
Created attachment 181776 [details] Patch for landing
WebKit Review Bot
Comment 24 2013-01-08 16:44:14 PST
Comment on attachment 181776 [details] Patch for landing Clearing flags on attachment: 181776 Committed r139132: <http://trac.webkit.org/changeset/139132>
WebKit Review Bot
Comment 25 2013-01-08 16:44:19 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.