summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/Source/core/css/cssom/StyleValue.h
blob: 726518b06c140ef7dc6b83bbc20838e931f1047b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2015 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 StyleValue_h
#define StyleValue_h

#include "bindings/core/v8/ScriptWrappable.h"
#include "core/CoreExport.h"
#include "core/css/CSSValue.h"
#include "core/css/CSSValuePool.h"

namespace blink {

class ScriptState;
class ScriptValue;

class CORE_EXPORT StyleValue : public GarbageCollectedFinalized<StyleValue>, public ScriptWrappable {
    WTF_MAKE_NONCOPYABLE(StyleValue);
    DEFINE_WRAPPERTYPEINFO();
public:
    enum StyleValueType {
        KeywordType, SimpleLengthType, CalcLengthType, NumberType, TransformValueType, PositionType
    };

    virtual ~StyleValue() { }

    virtual StyleValueType type() const = 0;

    static ScriptValue parse(ScriptState*, const String& property, const String& cssText);

    virtual PassRefPtrWillBeRawPtr<CSSValue> toCSSValue() const = 0;
    virtual String cssString() const
    {
        return toCSSValue()->cssText();
    }

    DEFINE_INLINE_VIRTUAL_TRACE() { }

protected:
    StyleValue() {}
};

} // namespace blink

#endif