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

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

Issue 1560693002: Avoid unnecessary invalidation scheduling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile fix Created 4 years, 11 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 // 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 "core/css/invalidation/StyleInvalidator.h" 5 #include "core/css/invalidation/StyleInvalidator.h"
6 6
7 #include "core/css/invalidation/InvalidationSet.h" 7 #include "core/css/invalidation/InvalidationSet.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/Element.h" 9 #include "core/dom/Element.h"
10 #include "core/dom/ElementTraversal.h" 10 #include "core/dom/ElementTraversal.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 return; 53 return;
54 } 54 }
55 55
56 if (invalidationSet->invalidatesSelf()) 56 if (invalidationSet->invalidatesSelf())
57 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTr acing::create(StyleChangeReason::StyleInvalidator)); 57 element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTr acing::create(StyleChangeReason::StyleInvalidator));
58 58
59 if (!invalidationSet->isEmpty()) 59 if (!invalidationSet->isEmpty())
60 requiresDescendantInvalidation = true; 60 requiresDescendantInvalidation = true;
61 } 61 }
62 62
63 if (invalidationLists.siblings.isEmpty() && !requiresDescendantInvalidation) 63 if (!requiresDescendantInvalidation && (invalidationLists.siblings.isEmpty() || !element.nextSibling()))
64 return; 64 return;
65 65
66 element.setNeedsStyleInvalidation(); 66 element.setNeedsStyleInvalidation();
67
67 PendingInvalidations& pendingInvalidations = ensurePendingInvalidations(elem ent); 68 PendingInvalidations& pendingInvalidations = ensurePendingInvalidations(elem ent);
68 for (auto& invalidationSet : invalidationLists.siblings) { 69 if (element.nextSibling()) {
69 if (pendingInvalidations.siblings().contains(invalidationSet)) 70 for (auto& invalidationSet : invalidationLists.siblings) {
70 continue; 71 if (pendingInvalidations.siblings().contains(invalidationSet))
71 pendingInvalidations.siblings().append(invalidationSet); 72 continue;
73 pendingInvalidations.siblings().append(invalidationSet);
74 }
72 } 75 }
73 76
74 if (!requiresDescendantInvalidation) 77 if (!requiresDescendantInvalidation)
75 return; 78 return;
76 79
77 for (auto& invalidationSet : invalidationLists.descendants) { 80 for (auto& invalidationSet : invalidationLists.descendants) {
78 ASSERT(!invalidationSet->wholeSubtreeInvalid()); 81 ASSERT(!invalidationSet->wholeSubtreeInvalid());
79 if (invalidationSet->isEmpty()) 82 if (invalidationSet->isEmpty())
80 continue; 83 continue;
81 if (pendingInvalidations.descendants().contains(invalidationSet)) 84 if (pendingInvalidations.descendants().contains(invalidationSet))
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 296 }
294 297
295 DEFINE_TRACE(StyleInvalidator) 298 DEFINE_TRACE(StyleInvalidator)
296 { 299 {
297 #if ENABLE(OILPAN) 300 #if ENABLE(OILPAN)
298 visitor->trace(m_pendingInvalidationMap); 301 visitor->trace(m_pendingInvalidationMap);
299 #endif 302 #endif
300 } 303 }
301 304
302 } // namespace blink 305 } // 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