Bug 88748 - Use window.WebKitShadowRoot for checking whether a node is shadow root or not.
Summary: Use window.WebKitShadowRoot for checking whether a node is shadow root or not.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Takashi Sakamoto
URL:
Keywords:
Depends on:
Blocks: 104995
  Show dependency treegraph
 
Reported: 2012-06-10 21:25 PDT by Takashi Sakamoto
Modified: 2013-01-08 23:43 PST (History)
4 users (show)

See Also:


Attachments
Patch (5.15 KB, patch)
2012-06-10 22:04 PDT, Takashi Sakamoto
no flags Details | Formatted Diff | Diff
Patch (1.52 KB, patch)
2012-06-14 03:42 PDT, Takashi Sakamoto
no flags Details | Formatted Diff | Diff
Patch (1.50 KB, patch)
2012-06-15 01:02 PDT, Takashi Sakamoto
no flags Details | Formatted Diff | Diff
Patch (1.48 KB, patch)
2012-08-01 00:23 PDT, Takashi Sakamoto
no flags Details | Formatted Diff | Diff
Patch (4.94 KB, patch)
2012-12-16 22:15 PST, Takashi Sakamoto
no flags Details | Formatted Diff | Diff
Patch (5.41 KB, patch)
2013-01-07 00:15 PST, Takashi Sakamoto
no flags Details | Formatted Diff | Diff
Patch (5.24 KB, patch)
2013-01-08 21:36 PST, Takashi Sakamoto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Takashi Sakamoto 2012-06-10 21:25:47 PDT
Since ShadowRoot.host will be gone (because of shadow dom spec update), it is not possible to know whether some node is a shadow root or not by using "node.host".
So internals should have a method, isShadowRoot.
Comment 1 Takashi Sakamoto 2012-06-10 22:04:28 PDT
Created attachment 146781 [details]
Patch
Comment 2 Hajime Morrita 2012-06-11 02:12:32 PDT
Comment on attachment 146781 [details]
Patch

Cannot we use resetStyleInheritance of something?
Comment 3 Hajime Morrita 2012-06-11 02:12:57 PDT
(In reply to comment #2)
> (From update of attachment 146781 [details])
> Cannot we use resetStyleInheritance of something?
s/of/or/
Comment 4 Hajime Morrita 2012-06-11 02:13:53 PDT
(In reply to comment #3)
> (In reply to comment #2)
> > (From update of attachment 146781 [details] [details])
> > Cannot we use resetStyleInheritance of something?
> s/of/or/
Actually, we can just check node.constructor.
Comment 5 Takashi Sakamoto 2012-06-14 02:54:06 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > (In reply to comment #2)
> > > (From update of attachment 146781 [details] [details] [details])
> > > Cannot we use resetStyleInheritance of something?
> > s/of/or/
> Actually, we can just check node.constructor.

I see. 
I quickly checked node.constructor for shadow roots. 
The result was "function ShadowRoot() { [native code] }".

I think, node.constructor looks good enough and we don't need isShadowRoot.
So I will change shadow-dom.js's isShadowRoot() to use "node.constructor".

Best regards,
Takashi Sakamoto
Comment 6 Takashi Sakamoto 2012-06-14 03:42:13 PDT
Created attachment 147549 [details]
Patch
Comment 7 Hajime Morrita 2012-06-14 17:02:28 PDT
Comment on attachment 147549 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=147549&action=review

> LayoutTests/fast/dom/shadow/resources/shadow-dom.js:44
> +    return node && node.constructor == 'function ShadowRoot() { [native code] }';

This should be node.constructor === window.WebKitShadowRoot.
string representation of the native function is different between jsc and v8.
Comment 8 Takashi Sakamoto 2012-06-15 01:02:29 PDT
Created attachment 147769 [details]
Patch
Comment 9 Takashi Sakamoto 2012-06-15 01:03:42 PDT
(In reply to comment #7)
> (From update of attachment 147549 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=147549&action=review
> 
> > LayoutTests/fast/dom/shadow/resources/shadow-dom.js:44
> > +    return node && node.constructor == 'function ShadowRoot() { [native code] }';
> 
> This should be node.constructor === window.WebKitShadowRoot.
> string representation of the native function is different between jsc and v8.

I see.
I updated the patch.

Best regards,
Takashi Sakamoto
Comment 10 Takashi Sakamoto 2012-08-01 00:23:00 PDT
Created attachment 155733 [details]
Patch
Comment 11 WebKit Review Bot 2012-08-01 00:35:52 PDT
Comment on attachment 155733 [details]
Patch

Rejecting attachment 155733 [details] from review queue.

tasak@google.com does not have reviewer permissions according to http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/committers.py.

- If you do not have reviewer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags.

- If you have reviewer rights please correct the error in Tools/Scripts/webkitpy/common/config/committers.py by adding yourself to the file (no review needed).  The commit-queue restarts itself every 2 hours.  After restart the commit-queue will correctly respect your reviewer rights.
Comment 12 Hajime Morrita 2012-08-01 00:37:59 PDT
Comment on attachment 155733 [details]
Patch

- You cannot set r+. It can be left as a blank. What you need is just to set only cq?.
- You need to "Reviewed by" line manually. "(OOPS!)" prevents the patch from landing.
Comment 13 Takashi Sakamoto 2012-12-16 22:15:18 PST
Created attachment 179689 [details]
Patch
Comment 14 Takashi Sakamoto 2012-12-16 22:17:27 PST
Would you review this patch again?

I'm sorry. Before I fix and land this patch, window.webkitShadowRoot is gone (or will be gone soon).
So I returned to the first one, i.e. implementing internals.isShadowRoot().

Best regards,
Takashi Sakamoto
Comment 15 Hajime Morrita 2013-01-06 17:10:54 PST
Comment on attachment 179689 [details]
Patch

and it came back again...
Comment 16 Shinya Kawanaka 2013-01-06 21:49:02 PST
Besides shadow-dom.js, we also should fix resources/dump-as-markup.js.
We are inspecting nodeType of ShadowRoot In this file.
Comment 17 Takashi Sakamoto 2013-01-07 00:15:23 PST
Created attachment 181481 [details]
Patch
Comment 18 Takashi Sakamoto 2013-01-07 00:17:39 PST
I fixed wrong bug description and added LayoutTests/resources/dump-as-markup.js's change.

Best regards,
Takashi Sakamoto
Comment 19 Takashi Sakamoto 2013-01-08 21:36:48 PST
Created attachment 181841 [details]
Patch
Comment 20 Takashi Sakamoto 2013-01-08 21:38:40 PST
I modified dump-as-markup.js not to use internals.isShadowRoot and reverted internals' code.

Best regards,
Takashi Sakamoto
Comment 21 WebKit Review Bot 2013-01-08 23:43:00 PST
Comment on attachment 181841 [details]
Patch

Clearing flags on attachment: 181841

Committed r139169: <http://trac.webkit.org/changeset/139169>
Comment 22 WebKit Review Bot 2013-01-08 23:43:04 PST
All reviewed patches have been landed.  Closing bug.