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

Side by Side Diff: third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp

Issue 1514733002: Avoid unnecessary invalidation scheduling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed unnecessary isMaster check Created 5 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 6
7 #include "core/css/invalidation/StyleInvalidator.h" 7 #include "core/css/invalidation/StyleInvalidator.h"
8 8
9 #include "core/css/invalidation/InvalidationSet.h" 9 #include "core/css/invalidation/InvalidationSet.h"
10 #include "core/dom/Document.h" 10 #include "core/dom/Document.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 54 }
55 55
56 if (invalidationSet->invalidatesSelf()) 56 if (invalidationSet->invalidatesSelf())
57 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonF orTracing::create(StyleChangeReason::StyleInvalidator)); 57 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonF orTracing::create(StyleChangeReason::StyleInvalidator));
58 58
59 if (!invalidationSet->isEmpty()) 59 if (!invalidationSet->isEmpty())
60 requiresDescendantInvalidation = true; 60 requiresDescendantInvalidation = true;
61 } 61 }
62 } 62 }
63 63
64 if (invalidationLists.siblings.isEmpty() && !requiresDescendantInvalidation) 64 if (!requiresDescendantInvalidation && (invalidationLists.siblings.isEmpty() || !element.nextSibling()))
65 return; 65 return;
66 66
67 element.setNeedsStyleInvalidation(); 67 element.setNeedsStyleInvalidation();
68
68 PendingInvalidations& pendingInvalidations = ensurePendingInvalidations(elem ent); 69 PendingInvalidations& pendingInvalidations = ensurePendingInvalidations(elem ent);
69 for (auto& invalidationSet : invalidationLists.siblings) 70 if (element.nextSibling()) {
70 pendingInvalidations.siblings().append(invalidationSet); 71 for (auto& invalidationSet : invalidationLists.siblings)
72 pendingInvalidations.siblings().append(invalidationSet);
73 }
71 74
72 if (!requiresDescendantInvalidation) 75 if (!requiresDescendantInvalidation)
73 return; 76 return;
74 77
75 for (auto& invalidationSet : invalidationLists.descendants) { 78 for (auto& invalidationSet : invalidationLists.descendants) {
76 ASSERT(!invalidationSet->wholeSubtreeInvalid()); 79 ASSERT(!invalidationSet->wholeSubtreeInvalid());
77 if (!invalidationSet->isEmpty()) 80 if (!invalidationSet->isEmpty())
78 pendingInvalidations.descendants().append(invalidationSet); 81 pendingInvalidations.descendants().append(invalidationSet);
79 } 82 }
80 } 83 }
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 } 291 }
289 292
290 DEFINE_TRACE(StyleInvalidator) 293 DEFINE_TRACE(StyleInvalidator)
291 { 294 {
292 #if ENABLE(OILPAN) 295 #if ENABLE(OILPAN)
293 visitor->trace(m_pendingInvalidationMap); 296 visitor->trace(m_pendingInvalidationMap);
294 #endif 297 #endif
295 } 298 }
296 299
297 } // namespace blink 300 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/PropertySetCSSStyleDeclaration.cpp ('k') | third_party/WebKit/Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698