Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / core / dom / StyleChangeReason.h
blob8ae0a42ec49edbdab631226ea586220d570c9704
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.
5 #ifndef StyleChangeReason_h
6 #define StyleChangeReason_h
8 #include "core/dom/QualifiedName.h"
9 #include "wtf/NullPtr.h"
10 #include "wtf/PassRefPtr.h"
11 #include "wtf/text/AtomicString.h"
12 #include "wtf/text/WTFString.h"
14 namespace blink {
16 class QualifiedName;
18 namespace StyleChangeReason {
19 extern const char ActiveStylesheetsUpdate[];
20 extern const char Animation[];
21 extern const char Attribute[];
22 extern const char CompositorProxy[];
23 extern const char ControlValue[];
24 extern const char Control[];
25 extern const char DesignMode[];
26 extern const char Drag[];
27 extern const char FontSizeChange[];
28 extern const char Fonts[];
29 extern const char FullScreen[];
30 extern const char Inline[];
31 extern const char InlineCSSStyleMutated[];
32 extern const char Inspector[];
33 extern const char Language[];
34 extern const char LinkColorChange[];
35 extern const char PlatformColorChange[];
36 extern const char PropagateInheritChangeToDistributedNodes[];
37 extern const char PseudoClass[];
38 extern const char SVGContainerSizeChange[];
39 extern const char SVGCursor[];
40 extern const char SVGFilterLayerUpdate[];
41 extern const char Shadow[];
42 extern const char SiblingSelector[];
43 extern const char StyleInvalidator[];
44 extern const char StyleSheetChange[];
45 extern const char Validate[];
46 extern const char ViewportUnits[];
47 extern const char VisitedLink[];
48 extern const char VisuallyOrdered[];
49 extern const char WritingModeChange[];
50 extern const char Zoom[];
52 typedef const char StyleChangeReasonString[];
54 namespace StyleChangeExtraData {
55 extern const AtomicString& Active;
56 extern const AtomicString& Disabled;
57 extern const AtomicString& Focus;
58 extern const AtomicString& Hover;
59 extern const AtomicString& Past;
60 extern const AtomicString& Unresolved;
62 void init();
65 // |StyleChangeReasonForTracing| is used to trace the reason a
66 // |Node::setNeedsStyleRecalc| call was made to show it in DevTools or in
67 // about:tracing.
68 // |StyleChangeReasonForTracing| is strictly only for the tracing purpose as
69 // described above. Blink logic must not depend on this value.
70 class StyleChangeReasonForTracing {
71 DISALLOW_ALLOCATION();
72 public:
73 static StyleChangeReasonForTracing create(StyleChangeReasonString reasonString)
75 return StyleChangeReasonForTracing(reasonString, nullAtom);
78 static StyleChangeReasonForTracing createWithExtraData(StyleChangeReasonString reasonString, const AtomicString& extraData)
80 return StyleChangeReasonForTracing(reasonString, extraData);
83 static StyleChangeReasonForTracing fromAttribute(const QualifiedName& attributeName)
85 return StyleChangeReasonForTracing(StyleChangeReason::Attribute, attributeName.localName());
88 String reasonString() const { return String(m_reason); }
89 const AtomicString& extraData() const { return m_extraData; }
91 private:
92 StyleChangeReasonForTracing(StyleChangeReasonString reasonString, const AtomicString& extraData)
93 : m_reason(reasonString)
94 , m_extraData(extraData)
98 // disable comparisons
99 void operator==(const StyleChangeReasonForTracing&) const { }
100 void operator!=(const StyleChangeReasonForTracing&) const { }
102 const char* m_reason;
103 AtomicString m_extraData;
106 } // namespace blink
108 #endif // StyleChangeReason_h