Index: Source/core/css/invalidation/DescendantInvalidationSet.cpp |
diff --git a/Source/core/css/invalidation/DescendantInvalidationSet.cpp b/Source/core/css/invalidation/DescendantInvalidationSet.cpp |
index 232f3cfe9b14348d607baf9ee7162d9ea459874d..c4613a76a8f6319152d3e05c00f1e2282ae63d7a 100644 |
--- a/Source/core/css/invalidation/DescendantInvalidationSet.cpp |
+++ b/Source/core/css/invalidation/DescendantInvalidationSet.cpp |
@@ -33,6 +33,8 @@ |
#include "core/css/resolver/StyleResolver.h" |
#include "core/dom/Element.h" |
+#include "core/inspector/InspectorTraceEvents.h" |
+#include "wtf/text/StringBuilder.h" |
namespace blink { |
@@ -48,24 +50,32 @@ bool DescendantInvalidationSet::invalidatesElement(Element& element) const |
if (m_allDescendantsMightBeInvalid) |
return true; |
- if (m_tagNames && m_tagNames->contains(element.tagQName().localName())) |
+ if (m_tagNames && m_tagNames->contains(element.tagQName().localName())) { |
+ TRACE_STYLE_INVALIDATOR_INVALIDATION_SELECTORPART(element, InvalidationSetMatchedTagName, element.tagQName().localName()); |
return true; |
+ } |
- if (element.hasID() && m_ids && m_ids->contains(element.idForStyleResolution())) |
+ if (element.hasID() && m_ids && m_ids->contains(element.idForStyleResolution())) { |
+ TRACE_STYLE_INVALIDATOR_INVALIDATION_SELECTORPART(element, InvalidationSetMatchedId, element.idForStyleResolution()); |
return true; |
+ } |
if (element.hasClass() && m_classes) { |
const SpaceSplitString& classNames = element.classNames(); |
for (WillBeHeapHashSet<AtomicString>::const_iterator it = m_classes->begin(); it != m_classes->end(); ++it) { |
- if (classNames.contains(*it)) |
+ if (classNames.contains(*it)) { |
+ TRACE_STYLE_INVALIDATOR_INVALIDATION_SELECTORPART(element, InvalidationSetMatchedClass, *it); |
return true; |
+ } |
} |
} |
if (element.hasAttributes() && m_attributes) { |
for (WillBeHeapHashSet<AtomicString>::const_iterator it = m_attributes->begin(); it != m_attributes->end(); ++it) { |
- if (element.hasAttribute(*it)) |
+ if (element.hasAttribute(*it)) { |
+ TRACE_STYLE_INVALIDATOR_INVALIDATION_SELECTORPART(element, InvalidationSetMatchedAttribute, *it); |
return true; |
+ } |
} |
} |
@@ -193,33 +203,53 @@ void DescendantInvalidationSet::trace(Visitor* visitor) |
#endif |
} |
-#ifndef NDEBUG |
-void DescendantInvalidationSet::show() const |
+String DescendantInvalidationSet::toDebugString() const |
{ |
- fprintf(stderr, "DescendantInvalidationSet { "); |
+ StringBuilder builder; |
+ builder.append("DescendantInvalidationSet { "); |
if (m_allDescendantsMightBeInvalid) |
- fprintf(stderr, "* "); |
+ builder.append("* "); |
if (m_customPseudoInvalid) |
- fprintf(stderr, "::custom "); |
+ builder.append("::custom "); |
if (m_treeBoundaryCrossing) |
- fprintf(stderr, "::shadow/deep/ "); |
+ builder.append("::shadow/deep/ "); |
if (m_ids) { |
- for (WillBeHeapHashSet<AtomicString>::const_iterator it = m_ids->begin(); it != m_ids->end(); ++it) |
- fprintf(stderr, "#%s ", (*it).ascii().data()); |
+ for (const auto& id : *m_ids) { |
+ builder.append("#"); |
+ builder.append(id); |
+ builder.append(" "); |
+ } |
} |
if (m_classes) { |
- for (WillBeHeapHashSet<AtomicString>::const_iterator it = m_classes->begin(); it != m_classes->end(); ++it) |
- fprintf(stderr, ".%s ", (*it).ascii().data()); |
+ for (const auto& className : *m_classes) { |
+ builder.append("."); |
+ builder.append(className); |
+ builder.append(" "); |
+ } |
} |
if (m_tagNames) { |
- for (WillBeHeapHashSet<AtomicString>::const_iterator it = m_tagNames->begin(); it != m_tagNames->end(); ++it) |
- fprintf(stderr, "<%s> ", (*it).ascii().data()); |
+ for (const auto& tagName : *m_tagNames) { |
+ builder.append("<"); |
+ builder.append(tagName); |
+ builder.append("> "); |
+ } |
} |
if (m_attributes) { |
- for (WillBeHeapHashSet<AtomicString>::const_iterator it = m_attributes->begin(); it != m_attributes->end(); ++it) |
- fprintf(stderr, "[%s] ", (*it).ascii().data()); |
+ for (const auto& attribute : *m_attributes) { |
+ builder.append("["); |
+ builder.append(attribute); |
+ builder.append("] "); |
+ } |
} |
- fprintf(stderr, "}\n"); |
+ builder.append("}"); |
+ |
+ return builder.toString(); |
+} |
+ |
+#ifndef NDEBUG |
+void DescendantInvalidationSet::show() const |
+{ |
+ fprintf(stderr, "%s\n", toString().ascii().data()); |
caseq
2014/09/30 12:24:00
toDebugString() perhaps?
kouhei (in TOK)
2014/10/01 04:16:14
Done.
|
} |
#endif // NDEBUG |