Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Unified Diff: third_party/WebKit/Source/core/css/cssom/StyleCalcLength.h

Issue 2011833002: Typed CSSOM: Rename CalcLength and StyleCalcLength to CSSCalcLength (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/cssom/StyleCalcLength.h
diff --git a/third_party/WebKit/Source/core/css/cssom/StyleCalcLength.h b/third_party/WebKit/Source/core/css/cssom/StyleCalcLength.h
deleted file mode 100644
index 1bfa6e3c62eb1be855cff9c264211d9744ee5b09..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/core/css/cssom/StyleCalcLength.h
+++ /dev/null
@@ -1,108 +0,0 @@
-// 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.
-
-#ifndef StyleCalcLength_h
-#define StyleCalcLength_h
-
-#include "core/css/cssom/CSSLengthValue.h"
-#include "wtf/BitVector.h"
-
-namespace blink {
-
-class CalcDictionary;
-class CSSSimpleLength;
-
-class CORE_EXPORT StyleCalcLength final : public CSSLengthValue {
- DEFINE_WRAPPERTYPEINFO();
-public:
- static StyleCalcLength* create(const CSSLengthValue*);
- static StyleCalcLength* create(const CalcDictionary&, ExceptionState&);
- static StyleCalcLength* create(const CSSLengthValue* length, ExceptionState&)
- {
- return create(length);
- }
-
-#define GETTER_MACRO(name, type) \
- double name(bool& isNull) \
- { \
- isNull = !hasAtIndex(indexForUnit(type)); \
- return get(type); \
- }
-
- GETTER_MACRO(px, CSSPrimitiveValue::UnitType::Pixels)
- GETTER_MACRO(percent, CSSPrimitiveValue::UnitType::Percentage)
- GETTER_MACRO(em, CSSPrimitiveValue::UnitType::Ems)
- GETTER_MACRO(ex, CSSPrimitiveValue::UnitType::Exs)
- GETTER_MACRO(ch, CSSPrimitiveValue::UnitType::Chs)
- GETTER_MACRO(rem, CSSPrimitiveValue::UnitType::Rems)
- GETTER_MACRO(vw, CSSPrimitiveValue::UnitType::ViewportWidth)
- GETTER_MACRO(vh, CSSPrimitiveValue::UnitType::ViewportHeight)
- GETTER_MACRO(vmin, CSSPrimitiveValue::UnitType::ViewportMin)
- GETTER_MACRO(vmax, CSSPrimitiveValue::UnitType::ViewportMax)
- GETTER_MACRO(cm, CSSPrimitiveValue::UnitType::Centimeters)
- GETTER_MACRO(mm, CSSPrimitiveValue::UnitType::Millimeters)
- GETTER_MACRO(in, CSSPrimitiveValue::UnitType::Inches)
- GETTER_MACRO(pc, CSSPrimitiveValue::UnitType::Picas)
- GETTER_MACRO(pt, CSSPrimitiveValue::UnitType::Points)
-
-#undef GETTER_MACRO
-
- bool containsPercent() const override;
-
- CSSValue* toCSSValue() const override;
-
- StyleValueType type() const override { return CalcLengthType; }
-protected:
- CSSLengthValue* addInternal(const CSSLengthValue* other, ExceptionState&) override;
- CSSLengthValue* subtractInternal(const CSSLengthValue* other, ExceptionState&) override;
- CSSLengthValue* multiplyInternal(double, ExceptionState&) override;
- CSSLengthValue* divideInternal(double, ExceptionState&) override;
-
-private:
- StyleCalcLength();
- StyleCalcLength(const StyleCalcLength& other);
- StyleCalcLength(const CSSSimpleLength& other);
-
- static int indexForUnit(CSSPrimitiveValue::UnitType);
- static CSSPrimitiveValue::UnitType unitFromIndex(int index)
- {
- DCHECK(index < CSSLengthValue::kNumSupportedUnits);
- int lowestValue = static_cast<int>(CSSPrimitiveValue::UnitType::Percentage);
- return static_cast<CSSPrimitiveValue::UnitType>(index + lowestValue);
- }
-
- bool hasAtIndex(int index) const
- {
- DCHECK(index < CSSLengthValue::kNumSupportedUnits);
- return m_hasValues.quickGet(index);
- }
- bool has(CSSPrimitiveValue::UnitType unit) const { return hasAtIndex(indexForUnit(unit)); }
- void setAtIndex(double value, int index)
- {
- DCHECK(index < CSSLengthValue::kNumSupportedUnits);
- m_hasValues.quickSet(index);
- m_values[index] = value;
- }
- void set(double value, CSSPrimitiveValue::UnitType unit) { setAtIndex(value, indexForUnit(unit)); }
- double getAtIndex(int index) const
- {
- DCHECK(index < CSSLengthValue::kNumSupportedUnits);
- return m_values[index];
- }
- double get(CSSPrimitiveValue::UnitType unit) const { return getAtIndex(indexForUnit(unit)); }
-
- Vector<double, CSSLengthValue::kNumSupportedUnits> m_values;
- BitVector m_hasValues;
-};
-
-#define DEFINE_CALC_LENGTH_TYPE_CASTS(argumentType) \
- DEFINE_TYPE_CASTS(StyleCalcLength, argumentType, value, \
- value->type() == CSSLengthValue::StyleValueType::CalcLengthType, \
- value.type() == CSSLengthValue::StyleValueType::CalcLengthType)
-
-DEFINE_CALC_LENGTH_TYPE_CASTS(StyleValue);
-
-} // namespace blink
-
-#endif
« no previous file with comments | « third_party/WebKit/Source/core/css/cssom/CalcLength.idl ('k') | third_party/WebKit/Source/core/css/cssom/StyleCalcLength.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698