OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/LengthValue.h" | 5 #include "core/css/cssom/LengthValue.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "core/css/cssom/CalcDictionary.h" | 8 #include "core/css/cssom/CalcDictionary.h" |
9 #include "core/css/cssom/SimpleLength.h" | 9 #include "core/css/cssom/SimpleLength.h" |
10 #include "core/css/cssom/StyleCalcLength.h" | 10 #include "core/css/cssom/StyleCalcLength.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 case Pc: | 154 case Pc: |
155 return PcStr; | 155 return PcStr; |
156 case Pt: | 156 case Pt: |
157 return PtStr; | 157 return PtStr; |
158 default: | 158 default: |
159 ASSERT_NOT_REACHED(); | 159 ASSERT_NOT_REACHED(); |
160 return emptyString(); | 160 return emptyString(); |
161 } | 161 } |
162 } | 162 } |
163 | 163 |
| 164 CSSPrimitiveValue::UnitType LengthValue::lengthTypeToPrimitiveType(LengthValue::
LengthUnit unit) |
| 165 { |
| 166 switch (unit) { |
| 167 case Px: |
| 168 return CSSPrimitiveValue::UnitType::Pixels; |
| 169 case Percent: |
| 170 return CSSPrimitiveValue::UnitType::Percentage; |
| 171 case Em: |
| 172 return CSSPrimitiveValue::UnitType::Ems; |
| 173 case Ex: |
| 174 return CSSPrimitiveValue::UnitType::Exs; |
| 175 case Ch: |
| 176 return CSSPrimitiveValue::UnitType::Chs; |
| 177 case Rem: |
| 178 return CSSPrimitiveValue::UnitType::Rems; |
| 179 case Vw: |
| 180 return CSSPrimitiveValue::UnitType::ViewportWidth; |
| 181 case Vh: |
| 182 return CSSPrimitiveValue::UnitType::ViewportHeight; |
| 183 case Vmin: |
| 184 return CSSPrimitiveValue::UnitType::ViewportMin; |
| 185 case Vmax: |
| 186 return CSSPrimitiveValue::UnitType::ViewportMax; |
| 187 case Cm: |
| 188 return CSSPrimitiveValue::UnitType::Centimeters; |
| 189 case Mm: |
| 190 return CSSPrimitiveValue::UnitType::Millimeters; |
| 191 case In: |
| 192 return CSSPrimitiveValue::UnitType::Inches; |
| 193 case Pc: |
| 194 return CSSPrimitiveValue::UnitType::Picas; |
| 195 case Pt: |
| 196 return CSSPrimitiveValue::UnitType::Points; |
| 197 default: |
| 198 ASSERT_NOT_REACHED(); |
| 199 return CSSPrimitiveValue::UnitType::Pixels; |
| 200 } |
| 201 } |
| 202 |
164 LengthValue* LengthValue::addInternal(const LengthValue*, ExceptionState&) | 203 LengthValue* LengthValue::addInternal(const LengthValue*, ExceptionState&) |
165 { | 204 { |
166 ASSERT_NOT_REACHED(); | 205 ASSERT_NOT_REACHED(); |
167 return nullptr; | 206 return nullptr; |
168 } | 207 } |
169 | 208 |
170 LengthValue* LengthValue::subtractInternal(const LengthValue*, ExceptionState&) | 209 LengthValue* LengthValue::subtractInternal(const LengthValue*, ExceptionState&) |
171 { | 210 { |
172 ASSERT_NOT_REACHED(); | 211 ASSERT_NOT_REACHED(); |
173 return nullptr; | 212 return nullptr; |
174 } | 213 } |
175 | 214 |
176 LengthValue* LengthValue::multiplyInternal(double, ExceptionState&) | 215 LengthValue* LengthValue::multiplyInternal(double, ExceptionState&) |
177 { | 216 { |
178 ASSERT_NOT_REACHED(); | 217 ASSERT_NOT_REACHED(); |
179 return nullptr; | 218 return nullptr; |
180 } | 219 } |
181 | 220 |
182 LengthValue* LengthValue::divideInternal(double, ExceptionState&) | 221 LengthValue* LengthValue::divideInternal(double, ExceptionState&) |
183 { | 222 { |
184 ASSERT_NOT_REACHED(); | 223 ASSERT_NOT_REACHED(); |
185 return nullptr; | 224 return nullptr; |
186 } | 225 } |
187 | 226 |
188 } // namespace blink | 227 } // namespace blink |
OLD | NEW |