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

Side by Side Diff: third_party/WebKit/Source/core/css/cssom/CSSCalcLength.cpp

Issue 2373233002: Add fromCSSValue methods to LengthValue subclasses, remove extra method in CSSSimpleLength. (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/css/cssom/CSSCalcLength.h" 5 #include "core/css/cssom/CSSCalcLength.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h"
rjwright 2016/09/29 05:34:42 Do we need this?
meade_UTC10 2016/09/29 05:53:13 Yep, it was previously included transitively throu
7 #include "core/css/CSSCalculationValue.h" 8 #include "core/css/CSSCalculationValue.h"
8 #include "core/css/CSSPrimitiveValue.h" 9 #include "core/css/CSSPrimitiveValue.h"
9 #include "core/css/cssom/CSSCalcDictionary.h" 10 #include "core/css/cssom/CSSCalcDictionary.h"
10 #include "core/css/cssom/CSSSimpleLength.h" 11 #include "core/css/cssom/CSSSimpleLength.h"
11 #include "wtf/Vector.h" 12 #include "wtf/Vector.h"
12 13
13 namespace blink { 14 namespace blink {
14 15
15 CSSCalcLength::CSSCalcLength() : m_values(CSSLengthValue::kNumSupportedUnits), m _hasValues(CSSLengthValue::kNumSupportedUnits) {} 16 CSSCalcLength::CSSCalcLength() : m_values(CSSLengthValue::kNumSupportedUnits), m _hasValues(CSSLengthValue::kNumSupportedUnits) {}
16 17
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 setFromDictValue(in, In, Inches) 62 setFromDictValue(in, In, Inches)
62 setFromDictValue(pc, Pc, Picas) 63 setFromDictValue(pc, Pc, Picas)
63 setFromDictValue(pt, Pt, Points) 64 setFromDictValue(pt, Pt, Points)
64 65
65 if (numSet == 0) { 66 if (numSet == 0) {
66 exceptionState.throwTypeError("Must specify at least one value in CSSCal cDictionary for creating a CSSCalcLength."); 67 exceptionState.throwTypeError("Must specify at least one value in CSSCal cDictionary for creating a CSSCalcLength.");
67 } 68 }
68 return result; 69 return result;
69 } 70 }
70 71
72 CSSCalcLength* CSSCalcLength::fromCSSValue(const CSSPrimitiveValue&)
73 {
74 // TODO(meade): Implement.
75 return nullptr;
76 }
77
71 bool CSSCalcLength::containsPercent() const 78 bool CSSCalcLength::containsPercent() const
72 { 79 {
73 return has(CSSPrimitiveValue::UnitType::Percentage); 80 return has(CSSPrimitiveValue::UnitType::Percentage);
74 } 81 }
75 82
76 CSSLengthValue* CSSCalcLength::addInternal(const CSSLengthValue* other) 83 CSSLengthValue* CSSCalcLength::addInternal(const CSSLengthValue* other)
77 { 84 {
78 CSSCalcLength* result = CSSCalcLength::create(other); 85 CSSCalcLength* result = CSSCalcLength::create(other);
79 for (int i = 0; i < CSSLengthValue::kNumSupportedUnits; ++i) { 86 for (int i = 0; i < CSSLengthValue::kNumSupportedUnits; ++i) {
80 if (hasAtIndex(i)) { 87 if (hasAtIndex(i)) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 } 150 }
144 return CSSPrimitiveValue::create(CSSCalcValue::create(node)); 151 return CSSPrimitiveValue::create(CSSCalcValue::create(node));
145 } 152 }
146 153
147 int CSSCalcLength::indexForUnit(CSSPrimitiveValue::UnitType unit) 154 int CSSCalcLength::indexForUnit(CSSPrimitiveValue::UnitType unit)
148 { 155 {
149 return (static_cast<int>(unit) - static_cast<int>(CSSPrimitiveValue::UnitTyp e::Percentage)); 156 return (static_cast<int>(unit) - static_cast<int>(CSSPrimitiveValue::UnitTyp e::Percentage));
150 } 157 }
151 158
152 } // namespace blink 159 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698