Chromium Code Reviews| Index: Source/core/dom/StyleChangeReason.h |
| diff --git a/Source/core/dom/StyleChangeReason.h b/Source/core/dom/StyleChangeReason.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b77750d2c7ea9874ca215cde308f9fdf65aa9131 |
| --- /dev/null |
| +++ b/Source/core/dom/StyleChangeReason.h |
| @@ -0,0 +1,119 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef StyleChangeReason_h |
| +#define StyleChangeReason_h |
| + |
| +#include "wtf/NullPtr.h" |
| +#include "wtf/PassRefPtr.h" |
| +#include "wtf/text/WTFString.h" |
| + |
| +namespace blink { |
| + |
| +class QualifiedName; |
| +namespace TraceEvent { |
| +class ConvertableToTraceFormat; |
| +} |
| + |
| +namespace StyleChangeReason { |
| +extern const char ActiveStylesheetsUpdate[]; |
| +extern const char Animation[]; |
| +extern const char Attribute[]; |
| +extern const char ControlValue[]; |
| +extern const char Control[]; |
| +extern const char DesignMode[]; |
| +extern const char Drag[]; |
| +extern const char FontSizeChange[]; |
| +extern const char Fonts[]; |
| +extern const char FullScreen[]; |
| +extern const char Inline[]; |
| +extern const char Inspector[]; |
| +extern const char Language[]; |
| +extern const char LinkColorChange[]; |
| +extern const char PlatformColorChange[]; |
| +extern const char Plugin[]; |
| +extern const char PropagateInheritChangeToDistributedNodes[]; |
| +extern const char PseudoClass[]; |
| +extern const char SVGContainerSizeChange[]; |
| +extern const char SVGCursor[]; |
| +extern const char SVGFilterLayerUpdate[]; |
| +extern const char Shadow[]; |
| +extern const char SiblingSelector[]; |
| +extern const char StyleInvalidator[]; |
| +extern const char StyleSheetChange[]; |
| +extern const char Validate[]; |
| +extern const char ViewportUnits[]; |
| +extern const char VisitedLink[]; |
| +extern const char VisuallyOrdered[]; |
| +extern const char WritingModeChange[]; |
| +extern const char Zoom[]; |
| +} |
| +typedef const char StyleChangeReasonString[]; |
| + |
| +namespace StyleChangeExtraData { |
| +extern const char Active[]; |
| +extern const char Checked[]; |
| +extern const char Disabled[]; |
| +extern const char Focus[]; |
| +extern const char Hover[]; |
| +extern const char Indeterminate[]; |
| +extern const char Invalid[]; |
| +extern const char LinkVisitedEnabled[]; |
| +extern const char Target[]; |
| +extern const char Unresolved[]; |
| +} |
| +typedef const char StyleChangeExtraDataString[]; |
| + |
| +// |StyleChangeReasonForTracing| is used to trace the reason a |
| +// |Node::setNeedsStyleRecalc| call was made to show it in DevTools or in |
| +// about:tracing. |
| +// |StyleChangeReasonForTracing| is strictly only for the tracing purpose as |
| +// described above. Blink logic must not depend on this value. |
| +class StyleChangeReasonForTracing { |
| +public: |
| + static StyleChangeReasonForTracing create(StyleChangeReasonString reasonString) |
| + { |
| + StyleChangeReasonForTracing reason; |
| + reason.m_reason = reasonString; |
| + reason.m_extraData = nullptr; |
| + reason.m_attributeName = nullptr; |
| + return reason; |
| + } |
| + |
| + static StyleChangeReasonForTracing createWithExtraData(StyleChangeReasonString reasonString, StyleChangeExtraDataString extraData) |
| + { |
| + StyleChangeReasonForTracing reason; |
| + reason.m_reason = reasonString; |
| + reason.m_extraData = extraData; |
| + reason.m_attributeName = nullptr; |
| + return reason; |
| + } |
| + |
| + static StyleChangeReasonForTracing fromAttribute(const QualifiedName& attributeName) |
|
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.
|
| + { |
| + StyleChangeReasonForTracing reason; |
| + reason.m_reason = StyleChangeReason::Attribute; |
| + reason.m_extraData = nullptr; |
| + reason.m_attributeName = &attributeName; |
| + return reason; |
| + } |
| + |
| + String getReasonString() const; |
| + String getExtraDataString() const; |
|
esprehn
2014/09/26 03:53:01
no get* on getters.
kouhei (in TOK)
2014/09/29 02:05:32
Done.
|
| + |
| +private: |
| + StyleChangeReasonForTracing() { } |
| + |
| + // disable comparisons |
| + const void operator==(const StyleChangeReasonForTracing&) { } |
| + const void operator!=(const StyleChangeReasonForTracing&) { } |
| + |
| + const char* m_reason; |
| + const char* m_extraData; |
| + 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.
|
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // StyleChangeReason_h |