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

Side by Side Diff: third_party/WebKit/Source/core/dom/shadow/ElementShadow.cpp

Issue 2822113002: Do not set a distribution recalc flag when v1 shadow tree is added (Closed)
Patch Set: try Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/shadow-dom/layout-1-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 10 matching lines...) Expand all
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #include "core/dom/shadow/ElementShadow.h" 27 #include "core/dom/shadow/ElementShadow.h"
28 28
29 #include "core/css/StyleSheetList.h" 29 #include "core/css/StyleSheetList.h"
30 #include "core/css/resolver/ScopedStyleResolver.h" 30 #include "core/css/resolver/ScopedStyleResolver.h"
31 #include "core/dom/NodeTraversal.h"
31 #include "core/dom/StyleChangeReason.h" 32 #include "core/dom/StyleChangeReason.h"
32 #include "core/dom/shadow/ElementShadowV0.h" 33 #include "core/dom/shadow/ElementShadowV0.h"
33 #include "core/frame/Deprecation.h" 34 #include "core/frame/Deprecation.h"
34 #include "core/probe/CoreProbes.h" 35 #include "core/probe/CoreProbes.h"
35 #include "platform/EventDispatchForbiddenScope.h" 36 #include "platform/EventDispatchForbiddenScope.h"
36 #include "platform/ScriptForbiddenScope.h" 37 #include "platform/ScriptForbiddenScope.h"
37 38
38 namespace blink { 39 namespace blink {
39 40
40 ElementShadow* ElementShadow::Create() { 41 ElementShadow* ElementShadow::Create() {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 root->LazyReattachIfAttached(); 73 root->LazyReattachIfAttached();
73 } else if (type == ShadowRootType::V0 || type == ShadowRootType::kUserAgent) { 74 } else if (type == ShadowRootType::V0 || type == ShadowRootType::kUserAgent) {
74 DCHECK(!element_shadow_v0_); 75 DCHECK(!element_shadow_v0_);
75 element_shadow_v0_ = ElementShadowV0::Create(*this); 76 element_shadow_v0_ = ElementShadowV0::Create(*this);
76 } 77 }
77 78
78 ShadowRoot* shadow_root = ShadowRoot::Create(shadow_host.GetDocument(), type); 79 ShadowRoot* shadow_root = ShadowRoot::Create(shadow_host.GetDocument(), type);
79 shadow_root->SetParentOrShadowHostNode(&shadow_host); 80 shadow_root->SetParentOrShadowHostNode(&shadow_host);
80 shadow_root->SetParentTreeScope(shadow_host.GetTreeScope()); 81 shadow_root->SetParentTreeScope(shadow_host.GetTreeScope());
81 AppendShadowRoot(*shadow_root); 82 AppendShadowRoot(*shadow_root);
82 SetNeedsDistributionRecalc(); 83 if (type == ShadowRootType::V0) {
84 SetNeedsDistributionRecalc();
85 } else {
86 for (Node& child : NodeTraversal::ChildrenOf(shadow_host))
87 child.LazyReattachIfAttached();
88 }
83 89
84 shadow_root->InsertedInto(&shadow_host); 90 shadow_root->InsertedInto(&shadow_host);
85 shadow_host.SetChildNeedsStyleRecalc(); 91 shadow_host.SetChildNeedsStyleRecalc();
86 shadow_host.SetNeedsStyleRecalc( 92 shadow_host.SetNeedsStyleRecalc(
87 kSubtreeStyleChange, 93 kSubtreeStyleChange,
88 StyleChangeReasonForTracing::Create(StyleChangeReason::kShadow)); 94 StyleChangeReasonForTracing::Create(StyleChangeReason::kShadow));
89 95
90 probe::didPushShadowRoot(&shadow_host, shadow_root); 96 probe::didPushShadowRoot(&shadow_host, shadow_root);
91 97
92 return *shadow_root; 98 return *shadow_root;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 visitor->Trace(element_shadow_v0_); 170 visitor->Trace(element_shadow_v0_);
165 visitor->Trace(shadow_root_); 171 visitor->Trace(shadow_root_);
166 } 172 }
167 173
168 DEFINE_TRACE_WRAPPERS(ElementShadow) { 174 DEFINE_TRACE_WRAPPERS(ElementShadow) {
169 visitor->TraceWrappers(element_shadow_v0_); 175 visitor->TraceWrappers(element_shadow_v0_);
170 visitor->TraceWrappers(shadow_root_); 176 visitor->TraceWrappers(shadow_root_);
171 } 177 }
172 178
173 } // namespace blink 179 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/shadow-dom/layout-1-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698