| Index: third_party/WebKit/Source/core/css/cssom/CSSCalcLength.cpp
|
| diff --git a/third_party/WebKit/Source/core/css/cssom/CSSCalcLength.cpp b/third_party/WebKit/Source/core/css/cssom/CSSCalcLength.cpp
|
| index 4d1b56531ffb75d5eccf8ff7a707a615844f0faa..ea0b681c99627cbf3284abed712702f95814f4f9 100644
|
| --- a/third_party/WebKit/Source/core/css/cssom/CSSCalcLength.cpp
|
| +++ b/third_party/WebKit/Source/core/css/cssom/CSSCalcLength.cpp
|
| @@ -68,6 +68,24 @@ CSSCalcLength* CSSCalcLength::create(const CSSCalcDictionary& dictionary, Except
|
| return result;
|
| }
|
|
|
| +CSSCalcLength* CSSCalcLength::fromLength(const Length* length)
|
| +{
|
| + DCHECK(length->isSpecified());
|
| + PixelsAndPercent values = length->getPixelsAndPercent();
|
| + CSSCalcLength* result = new CSSCalcLength();
|
| + if (length->isFixed()) {
|
| + result->set(values.pixels, CSSPrimitiveValue::UnitType::Pixels);
|
| + return result;
|
| + }
|
| + if (length->isPercent()) {
|
| + result->set(values.percent, CSSPrimitiveValue::UnitType::Percentage);
|
| + return result;
|
| + }
|
| + result->set(values.pixels, CSSPrimitiveValue::UnitType::Pixels);
|
| + result->set(values.percent, CSSPrimitiveValue::UnitType::Percentage);
|
| + return result;
|
| +}
|
| +
|
| bool CSSCalcLength::containsPercent() const
|
| {
|
| return has(CSSPrimitiveValue::UnitType::Percentage);
|
|
|