| 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 | |
| 203 LengthValue* LengthValue::addInternal(const LengthValue*, ExceptionState&) | 164 LengthValue* LengthValue::addInternal(const LengthValue*, ExceptionState&) |
| 204 { | 165 { |
| 205 ASSERT_NOT_REACHED(); | 166 ASSERT_NOT_REACHED(); |
| 206 return nullptr; | 167 return nullptr; |
| 207 } | 168 } |
| 208 | 169 |
| 209 LengthValue* LengthValue::subtractInternal(const LengthValue*, ExceptionState&) | 170 LengthValue* LengthValue::subtractInternal(const LengthValue*, ExceptionState&) |
| 210 { | 171 { |
| 211 ASSERT_NOT_REACHED(); | 172 ASSERT_NOT_REACHED(); |
| 212 return nullptr; | 173 return nullptr; |
| 213 } | 174 } |
| 214 | 175 |
| 215 LengthValue* LengthValue::multiplyInternal(double, ExceptionState&) | 176 LengthValue* LengthValue::multiplyInternal(double, ExceptionState&) |
| 216 { | 177 { |
| 217 ASSERT_NOT_REACHED(); | 178 ASSERT_NOT_REACHED(); |
| 218 return nullptr; | 179 return nullptr; |
| 219 } | 180 } |
| 220 | 181 |
| 221 LengthValue* LengthValue::divideInternal(double, ExceptionState&) | 182 LengthValue* LengthValue::divideInternal(double, ExceptionState&) |
| 222 { | 183 { |
| 223 ASSERT_NOT_REACHED(); | 184 ASSERT_NOT_REACHED(); |
| 224 return nullptr; | 185 return nullptr; |
| 225 } | 186 } |
| 226 | 187 |
| 227 } // namespace blink | 188 } // namespace blink |
| OLD | NEW |