Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(842)

Issue 1649983003: Remove the forced layout in getComputedStyle for elements in Shadow DOM (Closed)

Created:
4 years, 10 months ago by esprehn
Modified:
3 years, 7 months ago
Reviewers:
hayato, rune
CC:
darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, blink-reviews-style_chromium.org, chromium-reviews, dglazkov+blink, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Remove isInShadowTree special case in Remove the forced layout in getComputedStyle for elements in Shadow DOM This came from https://bugs.webkit.org/show_bug.cgi?id=97760 because the patch walked the parentNode() chain looking for ancestors that need a recalc, which didn't respect distributions, and the patch also didn't call updateDistribution so a dirty distribution would cause incorrect results. In blink the updateLayoutTreeForNodeIfNeeded method does respect shadow dom and checks the distribution bits so we don't need to unconditionally force a layout. Removing this exposed a bug in updateLayoutTreeForNodeIfNeeded where it was using the composed tree looking for ancestor dirty bits, but the composed tree skips over ShadowRoots, and those too can have dirty bits. To fix this we extend the ParentTraversalDetails object to have the ShadowRoot that is crossed when traversing.

Patch Set 1 #

Patch Set 2 : Look at ShadowRoots when walking up the tree in updateLayoutTreeForNodeIfNeeded. #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+38 lines, -28 lines) Patch
M third_party/WebKit/Source/core/css/CSSComputedStyleDeclaration.cpp View 1 chunk +0 lines, -1 line 0 comments Download
M third_party/WebKit/Source/core/css/resolver/ElementResolveContext.cpp View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/dom/Document.cpp View 1 2 chunks +18 lines, -2 lines 2 comments Download
M third_party/WebKit/Source/core/dom/LayoutTreeBuilderTraversal.h View 1 1 chunk +9 lines, -9 lines 2 comments Download
M third_party/WebKit/Source/core/dom/LayoutTreeBuilderTraversal.cpp View 1 1 chunk +0 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/core/dom/shadow/ComposedTreeTraversal.h View 1 1 chunk +2 lines, -2 lines 1 comment Download
M third_party/WebKit/Source/core/dom/shadow/ComposedTreeTraversal.cpp View 1 4 chunks +8 lines, -6 lines 0 comments Download

Messages

Total messages: 23 (10 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1649983003/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1649983003/1
4 years, 10 months ago (2016-01-29 05:58:20 UTC) #5
esprehn
unexpected_failures: fast/dom/shadow/sibling-rules-dynamic-changes.html fast/dom/shadow/sibling-rules-under-shadow-root.html Looks like there's some issue with the sibling invalidator?
4 years, 10 months ago (2016-01-29 06:46:40 UTC) #6
esprehn
Any idea why this would be rune@ ?
4 years, 10 months ago (2016-01-29 06:50:09 UTC) #8
esprehn
On 2016/01/29 at 06:50:09, esprehn wrote: > Any idea why this would be rune@ ? ...
4 years, 10 months ago (2016-01-29 06:51:40 UTC) #9
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/172192)
4 years, 10 months ago (2016-01-29 06:57:37 UTC) #11
rune
On 2016/01/29 06:51:40, esprehn wrote: > On 2016/01/29 at 06:50:09, esprehn wrote: > > Any ...
4 years, 10 months ago (2016-01-29 10:35:58 UTC) #12
esprehn
On 2016/01/29 at 10:35:58, rune wrote: > On 2016/01/29 06:51:40, esprehn wrote: > > On ...
4 years, 10 months ago (2016-01-29 23:32:55 UTC) #13
esprehn
On 2016/01/29 at 23:32:55, esprehn wrote: > On 2016/01/29 at 10:35:58, rune wrote: > > ...
4 years, 10 months ago (2016-01-29 23:35:31 UTC) #14
esprehn
This bug is specific to Shadow DOM, the problem is that we mark the parent ...
4 years, 10 months ago (2016-01-30 01:38:37 UTC) #15
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1649983003/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1649983003/20001
4 years, 10 months ago (2016-01-30 05:27:13 UTC) #17
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 10 months ago (2016-01-30 06:47:19 UTC) #19
esprehn
Okay I fixed it, we need to check ShadowRoots when walking ancestors. This patch should ...
4 years, 10 months ago (2016-01-30 23:13:00 UTC) #22
rune
4 years, 10 months ago (2016-02-01 09:24:23 UTC) #23
You're adding no tests. Could you add TEST lines for the failing tests of patch
set 1?

https://codereview.chromium.org/1649983003/diff/20001/third_party/WebKit/Sour...
File third_party/WebKit/Source/core/dom/Document.cpp (right):

https://codereview.chromium.org/1649983003/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/dom/Document.cpp:1905: static bool
nodeMayNeedStyleRecalc(const ContainerNode& node)
Should we now use anonymous namespace instead of static functions? I couldn't
find anything about it in the Blink coding standard or in "C++11 use in
Chromium".

https://codereview.chromium.org/1649983003/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/dom/Document.cpp:1935: needsRecalc = needsRecalc
|| nodeMayNeedStyleRecalc(parentDetails.shadowRoot());
How could that happen? Won't every shadow root have a shadow host parent so that
the when we record a shadow root, the ancestor will be the shadow host?

https://codereview.chromium.org/1649983003/diff/20001/third_party/WebKit/Sour...
File third_party/WebKit/Source/core/dom/LayoutTreeBuilderTraversal.h (left):

https://codereview.chromium.org/1649983003/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/dom/LayoutTreeBuilderTraversal.h:41:
STACK_ALLOCATED();
Is this also WTF_MAKE_NONCOPYABLE? Not that I think it needs to be, just to
express the current use pattern?

https://codereview.chromium.org/1649983003/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/dom/LayoutTreeBuilderTraversal.h:51: bool
operator==(const ParentDetails& other)
Are objects of this class ever being compared? Does it make sense to make
operator== delete?

https://codereview.chromium.org/1649983003/diff/20001/third_party/WebKit/Sour...
File third_party/WebKit/Source/core/dom/shadow/ComposedTreeTraversal.h (right):

https://codereview.chromium.org/1649983003/diff/20001/third_party/WebKit/Sour...
third_party/WebKit/Source/core/dom/shadow/ComposedTreeTraversal.h:157: static
ContainerNode* traverseParentOrHost(const Node&, ParentTraversalDetails* = 0);
0 -> nullptr?

Powered by Google App Engine
This is Rietveld 408576698