summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/Source/core/css/cssom/StyleValueFactory.cpp
blob: 2a0a0a7cb7af1aee499ed8f9fa2c21f2e2244ecb (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
// Copyright 2016 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.

#include "core/css/cssom/StyleValueFactory.h"

#include "core/css/CSSValue.h"
#include "core/css/cssom/SimpleLength.h"
#include "core/css/cssom/StyleValue.h"

namespace blink {

StyleValue* StyleValueFactory::create(CSSPropertyID propertyID, const CSSValue& value)
{
    if (value.isPrimitiveValue()) {
        const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(value);
        if (primitiveValue.isLength() && !primitiveValue.isCalculated()) {
            return SimpleLength::create(primitiveValue.getDoubleValue(), primitiveValue.typeWithCalcResolved());
        }
    }
    // TODO(meade): Implement the rest.
    return nullptr;
}

} // namespace blink