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

Unified Diff: Source/core/css/invalidation/StyleInvalidator.cpp

Issue 580373002: [Invalidation Tracking] Trace StyleInvalidator setNeedsStyleRecalc (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/css/invalidation/StyleInvalidator.cpp
diff --git a/Source/core/css/invalidation/StyleInvalidator.cpp b/Source/core/css/invalidation/StyleInvalidator.cpp
index cefc3d7b17650398f523f56d1e6adc0d4ec46b8d..9343d14e46f38c76573db3c000f068fb1b8b2ede 100644
--- a/Source/core/css/invalidation/StyleInvalidator.cpp
+++ b/Source/core/css/invalidation/StyleInvalidator.cpp
@@ -13,6 +13,7 @@
#include "core/dom/ElementTraversal.h"
#include "core/dom/shadow/ElementShadow.h"
#include "core/dom/shadow/ShadowRoot.h"
+#include "core/inspector/InspectorTraceEvents.h"
#include "core/rendering/RenderObject.h"
namespace blink {
@@ -86,8 +87,10 @@ bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSets(Element& el
{
ASSERT(!m_wholeSubtreeInvalid);
- if (m_invalidateCustomPseudo && element.shadowPseudoId() != nullAtom)
+ if (m_invalidateCustomPseudo && element.shadowPseudoId() != nullAtom) {
+ TRACE_STYLE_INVALIDATOR_INVALIDATION(element, InvalidateCustomPseudo);
return true;
+ }
for (InvalidationSets::iterator it = m_invalidationSets.begin(); it != m_invalidationSets.end(); ++it) {
if ((*it)->invalidatesElement(element))
@@ -108,9 +111,13 @@ bool StyleInvalidator::checkInvalidationSetsAgainstElement(Element& element, Sty
for (InvalidationList::const_iterator it = invalidationList->begin(); it != invalidationList->end(); ++it)
recursionData.pushInvalidationSet(**it);
// FIXME: It's really only necessary to clone the render style for this element, not full style recalc.
+ TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.invalidationTracking"),
+ "StyleInvalidatorInvalidationTracking",
+ "data", InspectorStyleInvalidatorInvalidateEvent::invalidationList(element, *invalidationList));
return true;
}
}
+
return recursionData.matchesCurrentInvalidationSets(element);
}
@@ -148,10 +155,12 @@ bool StyleInvalidator::invalidate(Element& element, StyleInvalidator::RecursionD
element.setNeedsStyleRecalc(recursionData.wholeSubtreeInvalid() ? SubtreeStyleChange : LocalStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::StyleInvalidator));
} else if (recursionData.hasInvalidationSets() && someChildrenNeedStyleRecalc) {
// Clone the RenderStyle in order to preserve correct style sharing, if possible. Otherwise recalc style.
- if (RenderObject* renderer = element.renderer())
+ if (RenderObject* renderer = element.renderer()) {
renderer->setStyleInternal(RenderStyle::clone(renderer->style()));
- else
+ } else {
+ TRACE_STYLE_INVALIDATOR_INVALIDATION(element, PreventStyleSharingForParent);
element.setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::StyleInvalidator));
+ }
}
element.clearChildNeedsStyleInvalidation();

Powered by Google App Engine
This is Rietveld 408576698