Summary: | ShadowRoot needs applyAuthorStyles | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Shinya Kawanaka <shinyak> | ||||||||||||
Component: | DOM | Assignee: | Nobody <webkit-unassigned> | ||||||||||||
Status: | RESOLVED FIXED | ||||||||||||||
Severity: | Normal | CC: | abarth, dglazkov, dominicc, hayato, kaustubh.ra, macpherson, menard, morrita, ojan, shinyak, tasak, webkit.review.bot | ||||||||||||
Priority: | P2 | ||||||||||||||
Version: | 528+ (Nightly build) | ||||||||||||||
Hardware: | Unspecified | ||||||||||||||
OS: | Unspecified | ||||||||||||||
Bug Depends on: | |||||||||||||||
Bug Blocks: | 63601 | ||||||||||||||
Attachments: |
|
Description
Shinya Kawanaka
2012-02-13 01:14:52 PST
See spec: http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#shadow-root-attributes Created attachment 137040 [details]
Patch
Comment on attachment 137040 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=137040&action=review > LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles.html:1 > +<!DOCTYPE html> I guess we can use reftest and which will be much simpler. http://trac.webkit.org/wiki/Writing%20Reftests > LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles.html:17 > + -webkit-appearance: none; Could you use some more trivial element like div and better-known styles? Soem port haven't enabled <progress> element. Created attachment 137553 [details]
Patch
> (From update of attachment 137040 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=137040&action=review > > > LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles.html:1 > > +<!DOCTYPE html> > > I guess we can use reftest and which will be much simpler. > http://trac.webkit.org/wiki/Writing%20Reftests I see. I rewrote the test. > > > LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles.html:17 > > + -webkit-appearance: none; > > Could you use some more trivial element like div and better-known styles? Sure. Now I'm using <span> element for the test. > Soem port haven't enabled <progress> element. I see. Comment on attachment 137553 [details]
Patch
Almost looks good. Could you add another test case for covering the default value of applyAuthorStyles?
(In reply to comment #6) > (From update of attachment 137553 [details]) > Almost looks good. Could you add another test case for covering the default value of applyAuthorStyles? Yet another case we should cover is for dynamic changes, that is - Add a ShadowRoot, - ensuring it laid-out (by accessing something like offsetLeft), - then change the property. Created attachment 137719 [details]
Patch
(In reply to comment #7) > (In reply to comment #6) > > (From update of attachment 137553 [details] [details]) > > Almost looks good. Could you add another test case for covering the default value of applyAuthorStyles? I see. Done. > Yet another case we should cover is for dynamic changes, that is > - Add a ShadowRoot, > - ensuring it laid-out (by accessing something like offsetLeft), > - then change the property. I couldn't find any explanation about whether dynamic change causes style recalculation or not. Anyway, I created a new bug https://bugs.webkit.org/show_bug.cgi?id=84251 for style recalculation. (In reply to comment #9) > (In reply to comment #7) > > (In reply to comment #6) > > > (From update of attachment 137553 [details] [details] [details]) > > > Almost looks good. Could you add another test case for covering the default value of applyAuthorStyles? > > I see. Done. Which one? > > I couldn't find any explanation about whether dynamic change causes style recalculation or not. > Anyway, I created a new bug https://bugs.webkit.org/show_bug.cgi?id=84251 for style recalculation. Thanks for filing it. Comment on attachment 137719 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=137719&action=review > Source/WebCore/ChangeLog:12 > + seems to work in the same way as applyAuthorStyles, just renamed all applyAuthorSheets and > + added applyAuthorStyles to ShadowRoot.idl. Nit: renamed all applyAuthorSheets to applyAuthorStyles, and added applyAuthorStyles to ShadowRoot.idl. > LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles-expected.html:4 > +<head> > +</head> We don't need head for this, do we? > LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles-expected.html:7 > +<div id="apply-author-style"><span style="margin:2px; border:solid"></span></div> > +<div id="no-apply-author-style"><span></span></div> Can we add more test cases like font-size, color, background-color, etc...? Also, you should definitely test cases where the author style is overridden by inline style declaration or cases where it overrides UA rules or when it's overridden by important UA rules. Furthermore, you should test a case where you change the value of applyAuthorStyles dynamically and verify that the change takes place dynamically as expected. r- due to lack of adequate tests. > LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles.html:27 > + var sr = new WebKitShadowRoot(div); Please don't use abbreviations like sr. Also, does this constructor work on ports that don't enable shadow root support yet? > LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles.html:31 > + var span = document.createElement('span'); > + sr.appendChild(span); Since you're not using span elsewhere, you can just do: sr.appendChild(document.createElement('span')); Created attachment 138386 [details]
Patch
(In reply to comment #11) > (From update of attachment 137719 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=137719&action=review > > > Source/WebCore/ChangeLog:12 > > + seems to work in the same way as applyAuthorStyles, just renamed all applyAuthorSheets and > > + added applyAuthorStyles to ShadowRoot.idl. > > Nit: renamed all applyAuthorSheets to applyAuthorStyles, and added applyAuthorStyles to ShadowRoot.idl. Done. > > > LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles-expected.html:4 > > +<head> > > +</head> > > We don't need head for this, do we? I see. Done. > > LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles-expected.html:7 > > +<div id="apply-author-style"><span style="margin:2px; border:solid"></span></div> > > +<div id="no-apply-author-style"><span></span></div> > > Can we add more test cases like font-size, color, background-color, etc...? > Also, you should definitely test cases where the author style is overridden by inline style declaration or > cases where it overrides UA rules or when it's overridden by important UA rules. I see. I added these test cases. > Furthermore, you should test a case where you change the value of applyAuthorStyles dynamically and > verify that the change takes place dynamically as expected. I created a bug, 84215 for fixing "dynamically changing applyAuthorStyles doesn't work" and will fix after finishing this bug. > > r- due to lack of adequate tests. > > > LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles.html:27 > > + var sr = new WebKitShadowRoot(div); > > Please don't use abbreviations like sr. I renamed all sr to shadowRoot. > Also, does this constructor work on ports that don't enable shadow root support yet? I added resources/polyfill.js for the ports. > > > LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles.html:31 > > + var span = document.createElement('span'); > > + sr.appendChild(span); > > Since you're not using span elsewhere, you can just do: > sr.appendChild(document.createElement('span')); I found that shadow root's innerHTML attirbute works. So I rewrote all test cases to use innerHTML, e.g. shadowRoot.innerHTML = '<span></span>'; and so on. Created attachment 139610 [details]
Patch
(In reply to comment #14) > Created an attachment (id=139610) [details] > Patch Since CSSStyleSelector.cpp was renamed to StyleResolver.cpp (and also class CSSStyleSelector was renamed to class StyleResolver), I created a patch again. Comment on attachment 139610 [details]
Patch
Sorry for really late response. Let's move forward.
Comment on attachment 139610 [details] Patch Clearing flags on attachment: 139610 Committed r116521: <http://trac.webkit.org/changeset/116521> All reviewed patches have been landed. Closing bug. |