| Index: third_party/WebKit/Source/core/css/cssom/CSSSimpleLength.cpp
|
| diff --git a/third_party/WebKit/Source/core/css/cssom/CSSSimpleLength.cpp b/third_party/WebKit/Source/core/css/cssom/CSSSimpleLength.cpp
|
| index 286446a87e2032af64fdd2ca8c986b0c96888c46..9596121a6671e1aa3a30ff8c3a2279a74a911be8 100644
|
| --- a/third_party/WebKit/Source/core/css/cssom/CSSSimpleLength.cpp
|
| +++ b/third_party/WebKit/Source/core/css/cssom/CSSSimpleLength.cpp
|
| @@ -23,7 +23,9 @@ CSSSimpleLength* CSSSimpleLength::create(double value, const String& type, Excep
|
|
|
| CSSSimpleLength* CSSSimpleLength::fromCSSValue(const CSSPrimitiveValue& value)
|
| {
|
| - DCHECK(value.isLength());
|
| + DCHECK(value.isLength() || value.isPercentage());
|
| + if (value.isPercentage())
|
| + return new CSSSimpleLength(value.getDoubleValue(), CSSPrimitiveValue::UnitType::Percentage);
|
| return new CSSSimpleLength(value.getDoubleValue(), value.typeWithCalcResolved());
|
| }
|
|
|
| @@ -32,6 +34,13 @@ bool CSSSimpleLength::containsPercent() const
|
| return lengthUnit() == CSSPrimitiveValue::UnitType::Percentage;
|
| }
|
|
|
| +String CSSSimpleLength::unit() const
|
| +{
|
| + if (lengthUnit() == CSSPrimitiveValue::UnitType::Percentage)
|
| + return "percent";
|
| + return CSSPrimitiveValue::unitTypeToString(m_unit);
|
| +}
|
| +
|
| CSSLengthValue* CSSSimpleLength::addInternal(const CSSLengthValue* other)
|
| {
|
| const CSSSimpleLength* o = toCSSSimpleLength(other);
|
|
|