OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef MediaValues_h | 5 #ifndef MediaValues_h |
6 #define MediaValues_h | 6 #define MediaValues_h |
7 | 7 |
8 #include "core/css/CSSPrimitiveValue.h" | 8 #include "core/css/CSSPrimitiveValue.h" |
9 #include "core/css/PointerProperties.h" | 9 #include "core/css/PointerProperties.h" |
10 #include "wtf/RefCounted.h" | 10 #include "wtf/RefCounted.h" |
(...skipping 23 matching lines...) Expand all Loading... | |
34 template<typename T> | 34 template<typename T> |
35 static bool computeLength(double value, CSSPrimitiveValue::UnitType type, un signed defaultFontSize, unsigned viewportWidth, unsigned viewportHeight, T& resu lt) | 35 static bool computeLength(double value, CSSPrimitiveValue::UnitType type, un signed defaultFontSize, unsigned viewportWidth, unsigned viewportHeight, T& resu lt) |
36 { | 36 { |
37 double tempResult; | 37 double tempResult; |
38 if (!computeLengthImpl(value, type, defaultFontSize, viewportWidth, view portHeight, tempResult)) | 38 if (!computeLengthImpl(value, type, defaultFontSize, viewportWidth, view portHeight, tempResult)) |
39 return false; | 39 return false; |
40 result = clampTo<T>(tempResult); | 40 result = clampTo<T>(tempResult); |
41 return true; | 41 return true; |
42 } | 42 } |
43 virtual bool computeLength(double value, CSSPrimitiveValue::UnitType, int& r esult) const = 0; | 43 virtual bool computeLength(double value, CSSPrimitiveValue::UnitType, int& r esult) const = 0; |
44 virtual bool computeLength(double value, CSSPrimitiveValue::UnitType, double & result) const = 0; | 44 virtual bool computeLength(double value, CSSPrimitiveValue::UnitType, float& result) const = 0; |
rune
2014/10/10 09:01:46
Why did you start using floats instead of doubles?
| |
45 | 45 |
46 virtual int viewportWidth() const = 0; | 46 virtual int viewportWidth() const = 0; |
47 virtual int viewportHeight() const = 0; | 47 virtual int viewportHeight() const = 0; |
48 virtual int deviceWidth() const = 0; | 48 virtual int deviceWidth() const = 0; |
49 virtual int deviceHeight() const = 0; | 49 virtual int deviceHeight() const = 0; |
50 virtual float devicePixelRatio() const = 0; | 50 virtual float devicePixelRatio() const = 0; |
51 virtual int colorBitsPerComponent() const = 0; | 51 virtual int colorBitsPerComponent() const = 0; |
52 virtual int monochromeBitsPerComponent() const = 0; | 52 virtual int monochromeBitsPerComponent() const = 0; |
53 virtual PointerType primaryPointerType() const = 0; | 53 virtual PointerType primaryPointerType() const = 0; |
54 virtual int availablePointerTypes() const = 0; | 54 virtual int availablePointerTypes() const = 0; |
(...skipping 21 matching lines...) Expand all Loading... | |
76 int calculateAvailablePointerTypes(LocalFrame*) const; | 76 int calculateAvailablePointerTypes(LocalFrame*) const; |
77 HoverType calculatePrimaryHoverType(LocalFrame*) const; | 77 HoverType calculatePrimaryHoverType(LocalFrame*) const; |
78 int calculateAvailableHoverTypes(LocalFrame*) const; | 78 int calculateAvailableHoverTypes(LocalFrame*) const; |
79 static LocalFrame* frameFrom(Document&); | 79 static LocalFrame* frameFrom(Document&); |
80 | 80 |
81 }; | 81 }; |
82 | 82 |
83 } // namespace | 83 } // namespace |
84 | 84 |
85 #endif // MediaValues_h | 85 #endif // MediaValues_h |
OLD | NEW |