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

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

Issue 2473743003: Call Element::rebuildLayoutTree from Document::updateStyle directly (Closed)
Patch Set: Final patch - make sure to retain information needed to determine whether to call detachLayoutTree() Created 3 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // ShadowRoot doesn't support custom callbacks. 140 // ShadowRoot doesn't support custom callbacks.
141 DCHECK(!hasCustomStyleCallbacks()); 141 DCHECK(!hasCustomStyleCallbacks());
142 142
143 StyleSharingDepthScope sharingScope(*this); 143 StyleSharingDepthScope sharingScope(*this);
144 144
145 if (getStyleChangeType() >= SubtreeStyleChange) 145 if (getStyleChangeType() >= SubtreeStyleChange)
146 change = Force; 146 change = Force;
147 147
148 // There's no style to update so just calling recalcStyle means we're updated. 148 // There's no style to update so just calling recalcStyle means we're updated.
149 clearNeedsStyleRecalc(); 149 clearNeedsStyleRecalc();
150 clearNeedsReattachLayoutTree();
151 150
152 recalcDescendantStyles(change); 151 recalcDescendantStyles(change);
153 clearChildNeedsStyleRecalc(); 152 clearChildNeedsStyleRecalc();
153 // Currently only the NeedsReattachLayoutTree flag is set on the ShadowRoot.
154 // Need to tell the ancestor nodes that this one needs reattach as well
155 // otherwise we will never rebuild the LayoutTree.
156 setNeedsReattachLayoutTree();
esprehn 2017/02/02 08:37:10 This is setting reattach unconditionally on every
nainar 2017/02/02 23:13:06 When we call ShadowRoot::recalcStyle() we have no
157 }
158
159 void ShadowRoot::rebuildLayoutTree() {
160 // ShadowRoot doesn't support custom callbacks.
161 DCHECK(!hasCustomStyleCallbacks());
162
163 StyleSharingDepthScope sharingScope(*this);
164
165 clearNeedsReattachLayoutTree();
166 rebuildChildrenLayoutTrees();
154 clearChildNeedsReattachLayoutTree(); 167 clearChildNeedsReattachLayoutTree();
155 } 168 }
156 169
157 void ShadowRoot::attachLayoutTree(const AttachContext& context) { 170 void ShadowRoot::attachLayoutTree(const AttachContext& context) {
158 StyleSharingDepthScope sharingScope(*this); 171 StyleSharingDepthScope sharingScope(*this);
159 DocumentFragment::attachLayoutTree(context); 172 DocumentFragment::attachLayoutTree(context);
160 } 173 }
161 174
162 void ShadowRoot::detachLayoutTree(const AttachContext& context) { 175 void ShadowRoot::detachLayoutTree(const AttachContext& context) {
163 if (context.clearInvalidation) 176 if (context.clearInvalidation)
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 ostream << "ShadowRootType::Open"; 347 ostream << "ShadowRootType::Open";
335 break; 348 break;
336 case ShadowRootType::Closed: 349 case ShadowRootType::Closed:
337 ostream << "ShadowRootType::Closed"; 350 ostream << "ShadowRootType::Closed";
338 break; 351 break;
339 } 352 }
340 return ostream; 353 return ostream;
341 } 354 }
342 355
343 } // namespace blink 356 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698