| Index: third_party/WebKit/Source/core/css/cssom/CSSStyleCalcLength.cpp
|
| diff --git a/third_party/WebKit/Source/core/css/cssom/StyleCalcLength.cpp b/third_party/WebKit/Source/core/css/cssom/CSSStyleCalcLength.cpp
|
| similarity index 57%
|
| rename from third_party/WebKit/Source/core/css/cssom/StyleCalcLength.cpp
|
| rename to third_party/WebKit/Source/core/css/cssom/CSSStyleCalcLength.cpp
|
| index fc2c5500af9a4fd78a80d42388fbc4664dd093a5..d20492c80949a95928aaf4f6ca7a136a6ddf4ef6 100644
|
| --- a/third_party/WebKit/Source/core/css/cssom/StyleCalcLength.cpp
|
| +++ b/third_party/WebKit/Source/core/css/cssom/CSSStyleCalcLength.cpp
|
| @@ -2,42 +2,42 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "core/css/cssom/StyleCalcLength.h"
|
| +#include "core/css/cssom/CSSStyleCalcLength.h"
|
|
|
| #include "core/css/CSSCalculationValue.h"
|
| #include "core/css/CSSPrimitiveValue.h"
|
| +#include "core/css/cssom/CSSSimpleLength.h"
|
| #include "core/css/cssom/CalcDictionary.h"
|
| -#include "core/css/cssom/SimpleLength.h"
|
| #include "wtf/Vector.h"
|
|
|
| namespace blink {
|
|
|
| -StyleCalcLength::StyleCalcLength() : m_values(LengthValue::kNumSupportedUnits), m_hasValues(LengthValue::kNumSupportedUnits) {}
|
| +CSSStyleCalcLength::CSSStyleCalcLength() : m_values(CSSLengthValue::kNumSupportedUnits), m_hasValues(CSSLengthValue::kNumSupportedUnits) {}
|
|
|
| -StyleCalcLength::StyleCalcLength(const StyleCalcLength& other) :
|
| +CSSStyleCalcLength::CSSStyleCalcLength(const CSSStyleCalcLength& other) :
|
| m_values(other.m_values),
|
| m_hasValues(other.m_hasValues)
|
| {}
|
|
|
| -StyleCalcLength::StyleCalcLength(const SimpleLength& other) :
|
| - m_values(LengthValue::kNumSupportedUnits), m_hasValues(LengthValue::kNumSupportedUnits)
|
| +CSSStyleCalcLength::CSSStyleCalcLength(const CSSSimpleLength& other) :
|
| + m_values(CSSLengthValue::kNumSupportedUnits), m_hasValues(CSSLengthValue::kNumSupportedUnits)
|
| {
|
| set(other.value(), other.lengthUnit());
|
| }
|
|
|
| -StyleCalcLength* StyleCalcLength::create(const LengthValue* length)
|
| +CSSStyleCalcLength* CSSStyleCalcLength::create(const CSSLengthValue* length)
|
| {
|
| if (length->type() == SimpleLengthType) {
|
| - const SimpleLength* simpleLength = toSimpleLength(length);
|
| - return new StyleCalcLength(*simpleLength);
|
| + const CSSSimpleLength* simpleLength = toCSSSimpleLength(length);
|
| + return new CSSStyleCalcLength(*simpleLength);
|
| }
|
|
|
| - return new StyleCalcLength(*toStyleCalcLength(length));
|
| + return new CSSStyleCalcLength(*toCSSStyleCalcLength(length));
|
| }
|
|
|
| -StyleCalcLength* StyleCalcLength::create(const CalcDictionary& dictionary, ExceptionState& exceptionState)
|
| +CSSStyleCalcLength* CSSStyleCalcLength::create(const CalcDictionary& dictionary, ExceptionState& exceptionState)
|
| {
|
| - StyleCalcLength* result = new StyleCalcLength();
|
| + CSSStyleCalcLength* result = new CSSStyleCalcLength();
|
| int numSet = 0;
|
|
|
| #define setFromDictValue(name, camelName, primitiveName) \
|
| @@ -68,15 +68,15 @@ StyleCalcLength* StyleCalcLength::create(const CalcDictionary& dictionary, Excep
|
| return result;
|
| }
|
|
|
| -bool StyleCalcLength::containsPercent() const
|
| +bool CSSStyleCalcLength::containsPercent() const
|
| {
|
| return has(CSSPrimitiveValue::UnitType::Percentage);
|
| }
|
|
|
| -LengthValue* StyleCalcLength::addInternal(const LengthValue* other, ExceptionState& exceptionState)
|
| +CSSLengthValue* CSSStyleCalcLength::addInternal(const CSSLengthValue* other, ExceptionState& exceptionState)
|
| {
|
| - StyleCalcLength* result = StyleCalcLength::create(other, exceptionState);
|
| - for (int i = 0; i < LengthValue::kNumSupportedUnits; ++i) {
|
| + CSSStyleCalcLength* result = CSSStyleCalcLength::create(other, exceptionState);
|
| + for (int i = 0; i < CSSLengthValue::kNumSupportedUnits; ++i) {
|
| if (hasAtIndex(i)) {
|
| result->setAtIndex(getAtIndex(i) + result->getAtIndex(i), i);
|
| }
|
| @@ -84,27 +84,27 @@ LengthValue* StyleCalcLength::addInternal(const LengthValue* other, ExceptionSta
|
| return result;
|
| }
|
|
|
| -LengthValue* StyleCalcLength::subtractInternal(const LengthValue* other, ExceptionState& exceptionState)
|
| +CSSLengthValue* CSSStyleCalcLength::subtractInternal(const CSSLengthValue* other, ExceptionState& exceptionState)
|
| {
|
| - StyleCalcLength* result = StyleCalcLength::create(this, exceptionState);
|
| + CSSStyleCalcLength* result = CSSStyleCalcLength::create(this, exceptionState);
|
| if (other->type() == CalcLengthType) {
|
| - const StyleCalcLength* o = toStyleCalcLength(other);
|
| - for (unsigned i = 0; i < LengthValue::kNumSupportedUnits; ++i) {
|
| + const CSSStyleCalcLength* o = toCSSStyleCalcLength(other);
|
| + for (unsigned i = 0; i < CSSLengthValue::kNumSupportedUnits; ++i) {
|
| if (o->hasAtIndex(i)) {
|
| result->setAtIndex(getAtIndex(i) - o->getAtIndex(i), i);
|
| }
|
| }
|
| } else {
|
| - const SimpleLength* o = toSimpleLength(other);
|
| + const CSSSimpleLength* o = toCSSSimpleLength(other);
|
| result->set(get(o->lengthUnit()) - o->value(), o->lengthUnit());
|
| }
|
| return result;
|
| }
|
|
|
| -LengthValue* StyleCalcLength::multiplyInternal(double x, ExceptionState& exceptionState)
|
| +CSSLengthValue* CSSStyleCalcLength::multiplyInternal(double x, ExceptionState& exceptionState)
|
| {
|
| - StyleCalcLength* result = StyleCalcLength::create(this, exceptionState);
|
| - for (unsigned i = 0; i < LengthValue::kNumSupportedUnits; ++i) {
|
| + CSSStyleCalcLength* result = CSSStyleCalcLength::create(this, exceptionState);
|
| + for (unsigned i = 0; i < CSSLengthValue::kNumSupportedUnits; ++i) {
|
| if (hasAtIndex(i)) {
|
| result->setAtIndex(getAtIndex(i) * x, i);
|
| }
|
| @@ -112,10 +112,10 @@ LengthValue* StyleCalcLength::multiplyInternal(double x, ExceptionState& excepti
|
| return result;
|
| }
|
|
|
| -LengthValue* StyleCalcLength::divideInternal(double x, ExceptionState& exceptionState)
|
| +CSSLengthValue* CSSStyleCalcLength::divideInternal(double x, ExceptionState& exceptionState)
|
| {
|
| - StyleCalcLength* result = StyleCalcLength::create(this, exceptionState);
|
| - for (unsigned i = 0; i < LengthValue::kNumSupportedUnits; ++i) {
|
| + CSSStyleCalcLength* result = CSSStyleCalcLength::create(this, exceptionState);
|
| + for (unsigned i = 0; i < CSSLengthValue::kNumSupportedUnits; ++i) {
|
| if (hasAtIndex(i)) {
|
| result->setAtIndex(getAtIndex(i) / x, i);
|
| }
|
| @@ -123,11 +123,11 @@ LengthValue* StyleCalcLength::divideInternal(double x, ExceptionState& exception
|
| return result;
|
| }
|
|
|
| -CSSValue* StyleCalcLength::toCSSValue() const
|
| +CSSValue* CSSStyleCalcLength::toCSSValue() const
|
| {
|
| // Create a CSS Calc Value, then put it into a CSSPrimitiveValue
|
| CSSCalcExpressionNode* node = nullptr;
|
| - for (unsigned i = 0; i < LengthValue::kNumSupportedUnits; ++i) {
|
| + for (unsigned i = 0; i < CSSLengthValue::kNumSupportedUnits; ++i) {
|
| if (!hasAtIndex(i))
|
| continue;
|
| double value = getAtIndex(i);
|
| @@ -143,7 +143,7 @@ CSSValue* StyleCalcLength::toCSSValue() const
|
| return CSSPrimitiveValue::create(CSSCalcValue::create(node));
|
| }
|
|
|
| -int StyleCalcLength::indexForUnit(CSSPrimitiveValue::UnitType unit)
|
| +int CSSStyleCalcLength::indexForUnit(CSSPrimitiveValue::UnitType unit)
|
| {
|
| return (static_cast<int>(unit) - static_cast<int>(CSSPrimitiveValue::UnitType::Percentage));
|
| }
|
|
|