Bug 84251 - [shadow] needs style recalculation by changing applyAuthorStyles dynamically
Summary: [shadow] needs style recalculation by changing applyAuthorStyles dynamically
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 63601
  Show dependency treegraph
 
Reported: 2012-04-18 10:05 PDT by Takashi Sakamoto
Modified: 2012-05-20 17:49 PDT (History)
3 users (show)

See Also:


Attachments
Patch (6.01 KB, patch)
2012-05-13 23:34 PDT, Takashi Sakamoto
no flags Details | Formatted Diff | Diff
Patch (5.99 KB, patch)
2012-05-15 23:27 PDT, Takashi Sakamoto
no flags Details | Formatted Diff | Diff
Patch (7.08 KB, patch)
2012-05-18 04:13 PDT, 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-04-18 10:05:12 PDT
Currently applyAuthorStyles API doesn't cause style recalculation. Only when attaching elements (i.e. when creating renderer), applyAuthorStyles works. It should cause style recalculation.
Comment 1 Takashi Sakamoto 2012-05-13 23:34:29 PDT
Created attachment 141647 [details]
Patch
Comment 2 Hajime Morrita 2012-05-15 22:22:28 PDT
Comment on attachment 141647 [details]
Patch

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

In addition to reftests, It would be desired to check style value using widow.getComputedStyle()
before and after the second change. That allows you to ensure that the value is actually changed dynamically.

> Source/WebCore/dom/ShadowRoot.cpp:201
> +            owner()->needsStyleRecalc();

needsStyleRecalc() doesn't have any side effect.
It looks what you want is setNeedsReattachHostChildrenAndShadow().

> LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles.html:94
> +    shadowRoot.applyAuthorStyles = true;

You need to force layout here (using offsetLeft or getComputedStyle like thing)

> LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles.html:108
> +    shadowRoot.applyAuthorStyles = false;

Ditto.
Comment 3 Takashi Sakamoto 2012-05-15 23:27:57 PDT
Created attachment 142162 [details]
Patch
Comment 4 Takashi Sakamoto 2012-05-18 01:35:09 PDT
(In reply to comment #2)
> (From update of attachment 141647 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=141647&action=review
> 
> In addition to reftests, It would be desired to check style value using widow.getComputedStyle()
> before and after the second change. That allows you to ensure that the value is actually changed dynamically.
> 
> > Source/WebCore/dom/ShadowRoot.cpp:201
> > +            owner()->needsStyleRecalc();
> 
> needsStyleRecalc() doesn't have any side effect.
> It looks what you want is setNeedsReattachHostChildrenAndShadow().

Done.

> > LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles.html:94
> > +    shadowRoot.applyAuthorStyles = true;
> 
> You need to force layout here (using offsetLeft or getComputedStyle like thing)
> 
> > LayoutTests/fast/dom/shadow/shadow-root-applyAuthorStyles.html:108
> > +    shadowRoot.applyAuthorStyles = false;
> 
> Ditto.

I see. I added "div.offsetLeft".
Comment 5 Takashi Sakamoto 2012-05-18 04:13:06 PDT
Created attachment 142682 [details]
Patch
Comment 6 Takashi Sakamoto 2012-05-18 05:36:05 PDT
(In reply to comment #2)
> (From update of attachment 141647 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=141647&action=review
> 
> In addition to reftests, It would be desired to check style value using widow.getComputedStyle()
> before and after the second change. That allows you to ensure that the value is actually changed dynamically.

Done.
Comment 7 Hajime Morrita 2012-05-20 17:39:32 PDT
Comment on attachment 142682 [details]
Patch

Looks good.Thanks for the fix!
Comment 8 WebKit Review Bot 2012-05-20 17:49:17 PDT
Comment on attachment 142682 [details]
Patch

Clearing flags on attachment: 142682

Committed r117716: <http://trac.webkit.org/changeset/117716>
Comment 9 WebKit Review Bot 2012-05-20 17:49:22 PDT
All reviewed patches have been landed.  Closing bug.