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

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: Address esprehn's comments Created 4 years 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // ShadowRoot doesn't support custom callbacks. 122 // ShadowRoot doesn't support custom callbacks.
123 DCHECK(!hasCustomStyleCallbacks()); 123 DCHECK(!hasCustomStyleCallbacks());
124 124
125 StyleSharingDepthScope sharingScope(*this); 125 StyleSharingDepthScope sharingScope(*this);
126 126
127 if (getStyleChangeType() >= SubtreeStyleChange) 127 if (getStyleChangeType() >= SubtreeStyleChange)
128 change = Force; 128 change = Force;
129 129
130 // There's no style to update so just calling recalcStyle means we're updated. 130 // There's no style to update so just calling recalcStyle means we're updated.
131 clearNeedsStyleRecalc(); 131 clearNeedsStyleRecalc();
132 clearNeedsReattachLayoutTree();
133 132
134 recalcDescendantStyles(change); 133 recalcDescendantStyles(change);
135 clearChildNeedsStyleRecalc(); 134 clearChildNeedsStyleRecalc();
135 setNeedsReattachLayoutTree();
esprehn 2016/12/14 04:30:48 Hmm wait this doesn't seem right, why are you forc
nainar 2016/12/14 22:21:54 So in the following test case: <script> onload =
136 }
137
138 void ShadowRoot::rebuildLayoutTree() {
139 DCHECK(!needsStyleRecalc());
140 // ShadowRoot doesn't support custom callbacks.
141 DCHECK(!hasCustomStyleCallbacks());
142
143 clearNeedsReattachLayoutTree();
144 rebuildChildrenLayoutTrees();
136 clearChildNeedsReattachLayoutTree(); 145 clearChildNeedsReattachLayoutTree();
esprehn 2016/12/14 04:30:48 This bit is cleared inside rebuildChildrenLayoutTr
nainar 2016/12/14 22:21:54 ShadowRoot::rebuildLayoutTree() also gets called b
137 } 146 }
138 147
139 void ShadowRoot::attachLayoutTree(const AttachContext& context) { 148 void ShadowRoot::attachLayoutTree(const AttachContext& context) {
140 StyleSharingDepthScope sharingScope(*this); 149 StyleSharingDepthScope sharingScope(*this);
141 DocumentFragment::attachLayoutTree(context); 150 DocumentFragment::attachLayoutTree(context);
142 } 151 }
143 152
144 void ShadowRoot::detachLayoutTree(const AttachContext& context) { 153 void ShadowRoot::detachLayoutTree(const AttachContext& context) {
145 if (context.clearInvalidation) 154 if (context.clearInvalidation)
146 document().styleEngine().styleInvalidator().clearInvalidation(*this); 155 document().styleEngine().styleInvalidator().clearInvalidation(*this);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 ostream << "ShadowRootType::Open"; 325 ostream << "ShadowRootType::Open";
317 break; 326 break;
318 case ShadowRootType::Closed: 327 case ShadowRootType::Closed:
319 ostream << "ShadowRootType::Closed"; 328 ostream << "ShadowRootType::Closed";
320 break; 329 break;
321 } 330 }
322 return ostream; 331 return ostream;
323 } 332 }
324 333
325 } // namespace blink 334 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698