Bug 104181

Summary: [HTMLTemplateElement] make content readonly and cloneNode(deep) clone content
Product: WebKit Reporter: Rafael Weinstein <rafaelw>
Component: DOMAssignee: Adam Klein <adamk>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, adamk, cmarcelo, eric, gyuyoung.kim, haraken, japhet, ojan, rakuco, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 103547    
Attachments:
Description Flags
Patch
none
Patch
none
Patch for landing none

Attachments
Patch (30.54 KB, patch)
2012-12-05 16:07 PST, Rafael Weinstein
no flags
Patch (29.68 KB, patch)
2012-12-06 12:19 PST, Adam Klein
no flags
Patch for landing (29.05 KB, patch)
2012-12-06 15:09 PST, Adam Klein
no flags
Rafael Weinstein
Comment 1 2012-12-05 16:07:53 PST
Adam Barth
Comment 2 2012-12-05 18:31:28 PST
Comment on attachment 177855 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=177855&action=review > Source/WebCore/bindings/v8/custom/V8HTMLTemplateElementCustom.cpp:48 > + v8::Handle<v8::Value> wrapper = v8::Handle<v8::Value>(DOMDataStore::current(info.GetIsolate())->get(content)); > + if (wrapper.IsEmpty()) > + wrapper = toV8(content, info.Holder(), info.GetIsolate()); Why not just call toV8 in the first place? toV8 checks DOMDataStore for you. > Source/WebCore/bindings/v8/custom/V8HTMLTemplateElementCustom.cpp:51 > + V8DOMWrapper::setNamedHiddenReference(info.Holder(), "content", wrapper); We should add an IDL attribute that does this work. The code generator already knows how to do all of this. > Source/WebCore/html/HTMLTemplateElement.cpp:77 > + return clone; clone.release() > Source/WebCore/html/HTMLTemplateElement.idl:34 > - attribute DocumentFragment content setter raises (DOMException); > + [Custom] readonly attribute DocumentFragment content; [CacheAttributeForGC] ? See http://trac.webkit.org/browser/trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm#L1026 for where you'd teach the CodeGenerator to read this attribute.
Adam Barth
Comment 3 2012-12-05 18:32:04 PST
This looks good, but I think we should teach the code generator how to do it since it's a one-line change to the code generator and it avoids the custom bindings.
Adam Klein
Comment 4 2012-12-06 12:19:42 PST
Adam Klein
Comment 5 2012-12-06 12:20:13 PST
Comment on attachment 177855 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=177855&action=review Taking this patch over for raf >> Source/WebCore/html/HTMLTemplateElement.cpp:77 >> + return clone; > > clone.release() Done >> Source/WebCore/html/HTMLTemplateElement.idl:34 >> + [Custom] readonly attribute DocumentFragment content; > > [CacheAttributeForGC] ? See http://trac.webkit.org/browser/trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm#L1026 for where you'd teach the CodeGenerator to read this attribute. Done. That if statement is now completely crazy (since this new attribute is totally disjoint from all the other tests), but you're right that it does saving that code into a custom file. I take it you're ok with the custom approach for JSC? I don't think they have any codegen to handle this, though the normal approach would be to use [JSCustomIsReachable] on the DocumentFragment.
Adam Barth
Comment 6 2012-12-06 12:40:56 PST
Comment on attachment 178058 [details] Patch Great. Thanks.
WebKit Review Bot
Comment 7 2012-12-06 13:35:04 PST
Comment on attachment 178058 [details] Patch Rejecting attachment 178058 [details] from commit-queue. Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 2 Last 500 characters of output: commit-queue/Source/WebKit/chromium/third_party/v8-i18n --revision 159 --non-interactive --force --accept theirs-conflict --ignore-externals' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium' 52>At revision 159. ________ running '/usr/bin/python tools/clang/scripts/update.py --mac-only' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium' ________ running '/usr/bin/python gyp_webkit' in '/mnt/git/webkit-commit-queue/Source/WebKit/chromium' Updating webkit projects from gyp files... Full output: http://queues.webkit.org/results/15170652
Adam Klein
Comment 8 2012-12-06 15:09:22 PST
Created attachment 178088 [details] Patch for landing
WebKit Review Bot
Comment 9 2012-12-06 15:48:53 PST
Comment on attachment 178088 [details] Patch for landing Clearing flags on attachment: 178088 Committed r136903: <http://trac.webkit.org/changeset/136903>
WebKit Review Bot
Comment 10 2012-12-06 15:48:59 PST
All reviewed patches have been landed. Closing bug.
Rafael Weinstein
Comment 11 2012-12-06 19:05:47 PST
Thanks for finishing this.
Note You need to log in before you can comment on or make changes to this bug.