Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 "wtf/NullPtr.h" | |
| 9 #include "wtf/PassRefPtr.h" | |
| 10 #include "wtf/text/WTFString.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 class QualifiedName; | |
| 15 namespace TraceEvent { | |
| 16 class ConvertableToTraceFormat; | |
| 17 } | |
| 18 | |
| 19 namespace StyleChangeReason { | |
| 20 extern const char ActiveStylesheetsUpdate[]; | |
| 21 extern const char Animation[]; | |
| 22 extern const char Attribute[]; | |
| 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 Inspector[]; | |
| 32 extern const char Language[]; | |
| 33 extern const char LinkColorChange[]; | |
| 34 extern const char PlatformColorChange[]; | |
| 35 extern const char Plugin[]; | |
| 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[]; | |
| 51 } | |
| 52 typedef const char StyleChangeReasonString[]; | |
| 53 | |
| 54 namespace StyleChangeExtraData { | |
| 55 extern const char Active[]; | |
| 56 extern const char Checked[]; | |
| 57 extern const char Disabled[]; | |
| 58 extern const char Focus[]; | |
| 59 extern const char Hover[]; | |
| 60 extern const char Indeterminate[]; | |
| 61 extern const char Invalid[]; | |
| 62 extern const char LinkVisitedEnabled[]; | |
| 63 extern const char Target[]; | |
| 64 extern const char Unresolved[]; | |
| 65 } | |
| 66 typedef const char StyleChangeExtraDataString[]; | |
| 67 | |
| 68 // |StyleChangeReasonForTracing| is used to trace the reason a | |
| 69 // |Node::setNeedsStyleRecalc| call was made to show it in DevTools or in | |
| 70 // about:tracing. | |
| 71 // |StyleChangeReasonForTracing| is strictly only for the tracing purpose as | |
| 72 // described above. Blink logic must not depend on this value. | |
| 73 class StyleChangeReasonForTracing { | |
| 74 public: | |
| 75 static StyleChangeReasonForTracing create(StyleChangeReasonString reasonStri ng) | |
| 76 { | |
| 77 StyleChangeReasonForTracing reason; | |
| 78 reason.m_reason = reasonString; | |
| 79 reason.m_extraData = nullptr; | |
| 80 reason.m_attributeName = nullptr; | |
| 81 return reason; | |
| 82 } | |
| 83 | |
| 84 static StyleChangeReasonForTracing createWithExtraData(StyleChangeReasonStri ng reasonString, StyleChangeExtraDataString extraData) | |
| 85 { | |
| 86 StyleChangeReasonForTracing reason; | |
| 87 reason.m_reason = reasonString; | |
| 88 reason.m_extraData = extraData; | |
| 89 reason.m_attributeName = nullptr; | |
| 90 return reason; | |
| 91 } | |
| 92 | |
| 93 static StyleChangeReasonForTracing fromAttribute(const QualifiedName& attrib uteName) | |
|
esprehn
2014/09/26 03:53:01
qualified name is just namespace and a string, I'd
kouhei (in TOK)
2014/09/29 02:05:32
Done.
| |
| 94 { | |
| 95 StyleChangeReasonForTracing reason; | |
| 96 reason.m_reason = StyleChangeReason::Attribute; | |
| 97 reason.m_extraData = nullptr; | |
| 98 reason.m_attributeName = &attributeName; | |
| 99 return reason; | |
| 100 } | |
| 101 | |
| 102 String getReasonString() const; | |
| 103 String getExtraDataString() const; | |
|
esprehn
2014/09/26 03:53:01
no get* on getters.
kouhei (in TOK)
2014/09/29 02:05:32
Done.
| |
| 104 | |
| 105 private: | |
| 106 StyleChangeReasonForTracing() { } | |
| 107 | |
| 108 // disable comparisons | |
| 109 const void operator==(const StyleChangeReasonForTracing&) { } | |
| 110 const void operator!=(const StyleChangeReasonForTracing&) { } | |
| 111 | |
| 112 const char* m_reason; | |
| 113 const char* m_extraData; | |
| 114 const QualifiedName* m_attributeName; | |
|
esprehn
2014/09/26 03:53:01
remove this. Also QualifiedName is not safe to sto
kouhei (in TOK)
2014/09/29 02:05:32
Done.
| |
| 115 }; | |
| 116 | |
| 117 } // namespace blink | |
| 118 | |
| 119 #endif // StyleChangeReason_h | |
| OLD | NEW |