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

Side by Side Diff: Source/core/dom/StyleChangeReason.h

Issue 547823002: Track reasons for |Node::SetNeedsStyleRecalc| (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix compile Created 6 years, 2 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef StyleChangeReason_h
6 #define StyleChangeReason_h
7
8 #include "core/dom/QualifiedName.h"
9 #include "wtf/NullPtr.h"
10 #include "wtf/PassRefPtr.h"
11 #include "wtf/text/WTFString.h"
12
13 namespace blink {
14
15 class QualifiedName;
16 namespace TraceEvent {
17 class ConvertableToTraceFormat;
18 }
19
20 namespace StyleChangeReason {
21 extern const char ActiveStylesheetsUpdate[];
22 extern const char Animation[];
23 extern const char Attribute[];
24 extern const char ControlValue[];
25 extern const char Control[];
26 extern const char DesignMode[];
27 extern const char Drag[];
28 extern const char FontSizeChange[];
29 extern const char Fonts[];
30 extern const char FullScreen[];
31 extern const char Inline[];
32 extern const char Inspector[];
33 extern const char Language[];
34 extern const char LinkColorChange[];
35 extern const char PlatformColorChange[];
36 extern const char Plugin[];
37 extern const char PropagateInheritChangeToDistributedNodes[];
38 extern const char PseudoClass[];
39 extern const char SVGContainerSizeChange[];
40 extern const char SVGCursor[];
41 extern const char SVGFilterLayerUpdate[];
42 extern const char Shadow[];
43 extern const char SiblingSelector[];
44 extern const char StyleInvalidator[];
45 extern const char StyleSheetChange[];
46 extern const char Validate[];
47 extern const char ViewportUnits[];
48 extern const char VisitedLink[];
49 extern const char VisuallyOrdered[];
50 extern const char WritingModeChange[];
51 extern const char Zoom[];
52 }
53 typedef const char StyleChangeReasonString[];
54
55 namespace StyleChangeExtraData {
56 WTF_EXPORT extern const String& Active;
57 WTF_EXPORT extern const String& Disabled;
58 WTF_EXPORT extern const String& Focus;
59 WTF_EXPORT extern const String& Hover;
60 WTF_EXPORT extern const String& Invalid;
61 WTF_EXPORT extern const String& Unresolved;
62
63 void init();
64 }
65
66 // |StyleChangeReasonForTracing| is used to trace the reason a
67 // |Node::setNeedsStyleRecalc| call was made to show it in DevTools or in
68 // about:tracing.
69 // |StyleChangeReasonForTracing| is strictly only for the tracing purpose as
70 // described above. Blink logic must not depend on this value.
71 class StyleChangeReasonForTracing {
72 public:
73 static StyleChangeReasonForTracing create(StyleChangeReasonString reasonStri ng)
74 {
75 return StyleChangeReasonForTracing(reasonString, String());
76 }
77
78 static StyleChangeReasonForTracing createWithExtraData(StyleChangeReasonStri ng reasonString, const String& extraData)
79 {
80 return StyleChangeReasonForTracing(reasonString, extraData);
81 }
82
83 static StyleChangeReasonForTracing fromAttribute(const QualifiedName& attrib uteName)
84 {
85 return StyleChangeReasonForTracing(StyleChangeReason::Attribute, attribu teName.localName().string());
86 }
87
88 String reasonString() const { return String(m_reason); }
89 const String& extraDataString() const { return m_extraData; }
90
91 private:
92 StyleChangeReasonForTracing(StyleChangeReasonString reasonString, const Stri ng& extraData)
93 : m_reason(reasonString)
94 , m_extraData(extraData)
95 {
96 }
97
98 // disable comparisons
99 void operator==(const StyleChangeReasonForTracing&) const { }
100 void operator!=(const StyleChangeReasonForTracing&) const { }
101
102 const char* m_reason;
103 String m_extraData;
104 };
105
106 } // namespace blink
107
108 #endif // StyleChangeReason_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698