OLD | NEW |
---|---|
1 /* | 1 /* |
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. |
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 { | 263 { |
264 CSSPrimitiveValue* quirkValue = new CSSPrimitiveValue(value, type); | 264 CSSPrimitiveValue* quirkValue = new CSSPrimitiveValue(value, type); |
265 quirkValue->m_isQuirkValue = true; | 265 quirkValue->m_isQuirkValue = true; |
266 return adoptRefWillBeNoop(quirkValue); | 266 return adoptRefWillBeNoop(quirkValue); |
267 } | 267 } |
268 | 268 |
269 ~CSSPrimitiveValue(); | 269 ~CSSPrimitiveValue(); |
270 | 270 |
271 void cleanup(); | 271 void cleanup(); |
272 | 272 |
273 enum TimeUnit { Seconds, Milliseconds }; | |
alancutter (OOO until 2018)
2014/07/21 14:03:47
Is TimeUnit used anywhere? Can it be removed?
| |
273 UnitType primitiveType() const; | 274 UnitType primitiveType() const; |
275 UnitType calcUnitType() const; | |
alancutter (OOO until 2018)
2014/07/21 14:03:47
This function should be able to live in the CPP fi
| |
274 | 276 |
275 double computeDegrees(); | 277 double computeDegrees(); |
276 | 278 double computeSeconds(); |
277 enum TimeUnit { Seconds, Milliseconds }; | |
278 template <typename T, TimeUnit timeUnit> T computeTime() | |
279 { | |
280 if (timeUnit == Seconds && m_primitiveUnitType == CSS_S) | |
281 return getValue<T>(); | |
282 if (timeUnit == Seconds && m_primitiveUnitType == CSS_MS) | |
283 return getValue<T>() / 1000; | |
284 if (timeUnit == Milliseconds && m_primitiveUnitType == CSS_MS) | |
285 return getValue<T>(); | |
286 if (timeUnit == Milliseconds && m_primitiveUnitType == CSS_S) | |
287 return getValue<T>() * 1000; | |
288 ASSERT_NOT_REACHED(); | |
289 return 0; | |
290 } | |
291 | 279 |
292 /* | 280 /* |
293 * Computes a length in pixels out of the given CSSValue | 281 * Computes a length in pixels out of the given CSSValue |
294 * | 282 * |
295 * The metrics have to be a bit different for screen and printer output. | 283 * The metrics have to be a bit different for screen and printer output. |
296 * For screen output we assume 1 inch == 72 px, for printer we assume 300 dp i | 284 * For screen output we assume 1 inch == 72 px, for printer we assume 300 dp i |
297 * | 285 * |
298 * this is screen/printer dependent, so we probably need a config option for this, | 286 * this is screen/printer dependent, so we probably need a config option for this, |
299 * and some tool to calibrate. | 287 * and some tool to calibrate. |
300 */ | 288 */ |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
425 } m_value; | 413 } m_value; |
426 }; | 414 }; |
427 | 415 |
428 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; | 416 typedef CSSPrimitiveValue::CSSLengthArray CSSLengthArray; |
429 | 417 |
430 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); | 418 DEFINE_CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue, isPrimitiveValue()); |
431 | 419 |
432 } // namespace WebCore | 420 } // namespace WebCore |
433 | 421 |
434 #endif // CSSPrimitiveValue_h | 422 #endif // CSSPrimitiveValue_h |
OLD | NEW |