| OLD | NEW |
| 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 #include "core/inspector/InspectorTraceEvents.h" | 6 #include "core/inspector/InspectorTraceEvents.h" |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptCallStackFactory.h" | 8 #include "bindings/core/v8/ScriptCallStackFactory.h" |
| 9 #include "core/animation/Animation.h" | 9 #include "core/animation/Animation.h" |
| 10 #include "core/animation/KeyframeEffect.h" | 10 #include "core/animation/KeyframeEffect.h" |
| 11 #include "core/css/invalidation/DescendantInvalidationSet.h" | 11 #include "core/css/invalidation/InvalidationSet.h" |
| 12 #include "core/dom/DOMNodeIds.h" | 12 #include "core/dom/DOMNodeIds.h" |
| 13 #include "core/dom/StyleChangeReason.h" | 13 #include "core/dom/StyleChangeReason.h" |
| 14 #include "core/events/Event.h" | 14 #include "core/events/Event.h" |
| 15 #include "core/fetch/CSSStyleSheetResource.h" | 15 #include "core/fetch/CSSStyleSheetResource.h" |
| 16 #include "core/frame/FrameView.h" | 16 #include "core/frame/FrameView.h" |
| 17 #include "core/frame/LocalFrame.h" | 17 #include "core/frame/LocalFrame.h" |
| 18 #include "core/inspector/IdentifiersFactory.h" | 18 #include "core/inspector/IdentifiersFactory.h" |
| 19 #include "core/inspector/ScriptCallStack.h" | 19 #include "core/inspector/ScriptCallStack.h" |
| 20 #include "core/layout/HitTestResult.h" | 20 #include "core/layout/HitTestResult.h" |
| 21 #include "core/layout/LayoutImage.h" | 21 #include "core/layout/LayoutImage.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 DEFINE_STRING_MAPPING(PseudoListBox) | 152 DEFINE_STRING_MAPPING(PseudoListBox) |
| 153 #undef DEFINE_STRING_MAPPING | 153 #undef DEFINE_STRING_MAPPING |
| 154 } | 154 } |
| 155 | 155 |
| 156 ASSERT_NOT_REACHED(); | 156 ASSERT_NOT_REACHED(); |
| 157 return ""; | 157 return ""; |
| 158 } | 158 } |
| 159 | 159 |
| 160 } | 160 } |
| 161 | 161 |
| 162 PassRefPtr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::fillCom
monPart(Element& element, const DescendantInvalidationSet& invalidationSet, cons
t char* invalidatedSelector) | 162 PassRefPtr<TracedValue> InspectorScheduleStyleInvalidationTrackingEvent::fillCom
monPart(Element& element, const InvalidationSet& invalidationSet, const char* in
validatedSelector) |
| 163 { | 163 { |
| 164 RefPtr<TracedValue> value = TracedValue::create(); | 164 RefPtr<TracedValue> value = TracedValue::create(); |
| 165 value->setString("frame", toHexString(element.document().frame())); | 165 value->setString("frame", toHexString(element.document().frame())); |
| 166 setNodeInfo(value.get(), &element, "nodeId", "nodeName"); | 166 setNodeInfo(value.get(), &element, "nodeId", "nodeName"); |
| 167 value->setString("invalidationSet", descendantInvalidationSetToIdString(inva
lidationSet)); | 167 value->setString("invalidationSet", descendantInvalidationSetToIdString(inva
lidationSet)); |
| 168 value->setString("invalidatedSelectorId", invalidatedSelector); | 168 value->setString("invalidatedSelectorId", invalidatedSelector); |
| 169 if (RefPtrWillBeRawPtr<ScriptCallStack> stackTrace = createScriptCallStack(m
axInvalidationTrackingCallstackSize, true)) | 169 if (RefPtrWillBeRawPtr<ScriptCallStack> stackTrace = createScriptCallStack(m
axInvalidationTrackingCallstackSize, true)) |
| 170 stackTrace->toTracedValue(value.get(), "stackTrace"); | 170 stackTrace->toTracedValue(value.get(), "stackTrace"); |
| 171 return value.release(); | 171 return value.release(); |
| 172 } | 172 } |
| 173 | 173 |
| 174 const char InspectorScheduleStyleInvalidationTrackingEvent::Attribute[] = "attri
bute"; | 174 const char InspectorScheduleStyleInvalidationTrackingEvent::Attribute[] = "attri
bute"; |
| 175 const char InspectorScheduleStyleInvalidationTrackingEvent::Class[] = "class"; | 175 const char InspectorScheduleStyleInvalidationTrackingEvent::Class[] = "class"; |
| 176 const char InspectorScheduleStyleInvalidationTrackingEvent::Id[] = "id"; | 176 const char InspectorScheduleStyleInvalidationTrackingEvent::Id[] = "id"; |
| 177 const char InspectorScheduleStyleInvalidationTrackingEvent::Pseudo[] = "pseudo"; | 177 const char InspectorScheduleStyleInvalidationTrackingEvent::Pseudo[] = "pseudo"; |
| 178 | 178 |
| 179 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorScheduleStyleInvalidat
ionTrackingEvent::idChange(Element& element, const DescendantInvalidationSet& in
validationSet, const AtomicString& id) | 179 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorScheduleStyleInvalidat
ionTrackingEvent::idChange(Element& element, const InvalidationSet& invalidation
Set, const AtomicString& id) |
| 180 { | 180 { |
| 181 RefPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Id); | 181 RefPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Id); |
| 182 value->setString("changedId", id); | 182 value->setString("changedId", id); |
| 183 return value.release(); | 183 return value.release(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorScheduleStyleInvalidat
ionTrackingEvent::classChange(Element& element, const DescendantInvalidationSet&
invalidationSet, const AtomicString& className) | 186 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorScheduleStyleInvalidat
ionTrackingEvent::classChange(Element& element, const InvalidationSet& invalidat
ionSet, const AtomicString& className) |
| 187 { | 187 { |
| 188 RefPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Class); | 188 RefPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Class); |
| 189 value->setString("changedClass", className); | 189 value->setString("changedClass", className); |
| 190 return value.release(); | 190 return value.release(); |
| 191 } | 191 } |
| 192 | 192 |
| 193 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorScheduleStyleInvalidat
ionTrackingEvent::attributeChange(Element& element, const DescendantInvalidation
Set& invalidationSet, const QualifiedName& attributeName) | 193 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorScheduleStyleInvalidat
ionTrackingEvent::attributeChange(Element& element, const InvalidationSet& inval
idationSet, const QualifiedName& attributeName) |
| 194 { | 194 { |
| 195 RefPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Attribu
te); | 195 RefPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Attribu
te); |
| 196 value->setString("changedAttribute", attributeName.toString()); | 196 value->setString("changedAttribute", attributeName.toString()); |
| 197 return value.release(); | 197 return value.release(); |
| 198 } | 198 } |
| 199 | 199 |
| 200 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorScheduleStyleInvalidat
ionTrackingEvent::pseudoChange(Element& element, const DescendantInvalidationSet
& invalidationSet, CSSSelector::PseudoType pseudoType) | 200 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorScheduleStyleInvalidat
ionTrackingEvent::pseudoChange(Element& element, const InvalidationSet& invalida
tionSet, CSSSelector::PseudoType pseudoType) |
| 201 { | 201 { |
| 202 RefPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Attribu
te); | 202 RefPtr<TracedValue> value = fillCommonPart(element, invalidationSet, Attribu
te); |
| 203 value->setString("changedPseudo", pseudoTypeToString(pseudoType)); | 203 value->setString("changedPseudo", pseudoTypeToString(pseudoType)); |
| 204 return value.release(); | 204 return value.release(); |
| 205 } | 205 } |
| 206 | 206 |
| 207 String descendantInvalidationSetToIdString(const DescendantInvalidationSet& set) | 207 String descendantInvalidationSetToIdString(const InvalidationSet& set) |
| 208 { | 208 { |
| 209 return toHexString(&set); | 209 return toHexString(&set); |
| 210 } | 210 } |
| 211 | 211 |
| 212 const char InspectorStyleInvalidatorInvalidateEvent::ElementHasPendingInvalidati
onList[] = "Element has pending invalidation list"; | 212 const char InspectorStyleInvalidatorInvalidateEvent::ElementHasPendingInvalidati
onList[] = "Element has pending invalidation list"; |
| 213 const char InspectorStyleInvalidatorInvalidateEvent::InvalidateCustomPseudo[] =
"Invalidate custom pseudo element"; | 213 const char InspectorStyleInvalidatorInvalidateEvent::InvalidateCustomPseudo[] =
"Invalidate custom pseudo element"; |
| 214 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedAttri
bute[] = "Invalidation set matched attribute"; | 214 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedAttri
bute[] = "Invalidation set matched attribute"; |
| 215 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedClass
[] = "Invalidation set matched class"; | 215 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedClass
[] = "Invalidation set matched class"; |
| 216 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedId[]
= "Invalidation set matched id"; | 216 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedId[]
= "Invalidation set matched id"; |
| 217 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedTagNa
me[] = "Invalidation set matched tagName"; | 217 const char InspectorStyleInvalidatorInvalidateEvent::InvalidationSetMatchedTagNa
me[] = "Invalidation set matched tagName"; |
| 218 const char InspectorStyleInvalidatorInvalidateEvent::PreventStyleSharingForParen
t[] = "Prevent style sharing for parent"; | 218 const char InspectorStyleInvalidatorInvalidateEvent::PreventStyleSharingForParen
t[] = "Prevent style sharing for parent"; |
| 219 | 219 |
| 220 PassRefPtr<TracedValue> InspectorStyleInvalidatorInvalidateEvent::fillCommonPart
(Element& element, const char* reason) | 220 PassRefPtr<TracedValue> InspectorStyleInvalidatorInvalidateEvent::fillCommonPart
(Element& element, const char* reason) |
| 221 { | 221 { |
| 222 RefPtr<TracedValue> value = TracedValue::create(); | 222 RefPtr<TracedValue> value = TracedValue::create(); |
| 223 value->setString("frame", toHexString(element.document().frame())); | 223 value->setString("frame", toHexString(element.document().frame())); |
| 224 setNodeInfo(value.get(), &element, "nodeId", "nodeName"); | 224 setNodeInfo(value.get(), &element, "nodeId", "nodeName"); |
| 225 value->setString("reason", reason); | 225 value->setString("reason", reason); |
| 226 return value.release(); | 226 return value.release(); |
| 227 } | 227 } |
| 228 | 228 |
| 229 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleInvalidatorInvali
dateEvent::data(Element& element, const char* reason) | 229 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleInvalidatorInvali
dateEvent::data(Element& element, const char* reason) |
| 230 { | 230 { |
| 231 return fillCommonPart(element, reason); | 231 return fillCommonPart(element, reason); |
| 232 } | 232 } |
| 233 | 233 |
| 234 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleInvalidatorInvali
dateEvent::selectorPart(Element& element, const char* reason, const DescendantIn
validationSet& invalidationSet, const String& selectorPart) | 234 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleInvalidatorInvali
dateEvent::selectorPart(Element& element, const char* reason, const Invalidation
Set& invalidationSet, const String& selectorPart) |
| 235 { | 235 { |
| 236 RefPtr<TracedValue> value = fillCommonPart(element, reason); | 236 RefPtr<TracedValue> value = fillCommonPart(element, reason); |
| 237 value->beginArray("invalidationList"); | 237 value->beginArray("invalidationList"); |
| 238 invalidationSet.toTracedValue(value.get()); | 238 invalidationSet.toTracedValue(value.get()); |
| 239 value->endArray(); | 239 value->endArray(); |
| 240 value->setString("selectorPart", selectorPart); | 240 value->setString("selectorPart", selectorPart); |
| 241 return value.release(); | 241 return value.release(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleInvalidatorInvali
dateEvent::invalidationList(Element& element, const WillBeHeapVector<RefPtrWillB
eMember<DescendantInvalidationSet> >& invalidationList) | 244 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleInvalidatorInvali
dateEvent::invalidationList(Element& element, const InvalidationSetVector& inval
idationList) |
| 245 { | 245 { |
| 246 RefPtr<TracedValue> value = fillCommonPart(element, ElementHasPendingInvalid
ationList); | 246 RefPtr<TracedValue> value = fillCommonPart(element, ElementHasPendingInvalid
ationList); |
| 247 value->beginArray("invalidationList"); | 247 value->beginArray("invalidationList"); |
| 248 for (const auto& invalidationSet : invalidationList) | 248 for (const auto& invalidationSet : invalidationList) |
| 249 invalidationSet->toTracedValue(value.get()); | 249 invalidationSet->toTracedValue(value.get()); |
| 250 value->endArray(); | 250 value->endArray(); |
| 251 return value.release(); | 251 return value.release(); |
| 252 } | 252 } |
| 253 | 253 |
| 254 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleRecalcInvalidatio
nTrackingEvent::data(Node* node, const StyleChangeReasonForTracing& reason) | 254 PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorStyleRecalcInvalidatio
nTrackingEvent::data(Node* node, const StyleChangeReasonForTracing& reason) |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 if (request.move()) | 772 if (request.move()) |
| 773 value->setBoolean("move", true); | 773 value->setBoolean("move", true); |
| 774 if (request.listBased()) | 774 if (request.listBased()) |
| 775 value->setBoolean("listBased", true); | 775 value->setBoolean("listBased", true); |
| 776 else if (Node* node = result.innerNode()) | 776 else if (Node* node = result.innerNode()) |
| 777 setNodeInfo(value.get(), node, "nodeId", "nodeName"); | 777 setNodeInfo(value.get(), node, "nodeId", "nodeName"); |
| 778 return value; | 778 return value; |
| 779 } | 779 } |
| 780 | 780 |
| 781 } | 781 } |
| OLD | NEW |