OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef CSSToLengthConversionData_h | 31 #ifndef CSSToLengthConversionData_h |
32 #define CSSToLengthConversionData_h | 32 #define CSSToLengthConversionData_h |
33 | 33 |
34 #include "wtf/Assertions.h" | 34 #include "wtf/Assertions.h" |
| 35 #include "wtf/MathExtras.h" |
35 #include "wtf/Noncopyable.h" | 36 #include "wtf/Noncopyable.h" |
| 37 #include <limits> |
36 | 38 |
37 namespace blink { | 39 namespace blink { |
38 | 40 |
39 class RenderStyle; | 41 class RenderStyle; |
40 class RenderView; | 42 class RenderView; |
41 class Font; | 43 class Font; |
42 | 44 |
43 class CSSToLengthConversionData { | 45 class CSSToLengthConversionData { |
44 public: | 46 public: |
45 | 47 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 float exFontSize() const { return m_fontSizes.ex(); } | 85 float exFontSize() const { return m_fontSizes.ex(); } |
84 float chFontSize() const { return m_fontSizes.ch(); } | 86 float chFontSize() const { return m_fontSizes.ch(); } |
85 | 87 |
86 // Accessing these marks the style as having viewport units | 88 // Accessing these marks the style as having viewport units |
87 double viewportWidthPercent() const; | 89 double viewportWidthPercent() const; |
88 double viewportHeightPercent() const; | 90 double viewportHeightPercent() const; |
89 double viewportMinPercent() const; | 91 double viewportMinPercent() const; |
90 double viewportMaxPercent() const; | 92 double viewportMaxPercent() const; |
91 | 93 |
92 void setFontSizes(const FontSizes& fontSizes) { m_fontSizes = fontSizes; } | 94 void setFontSizes(const FontSizes& fontSizes) { m_fontSizes = fontSizes; } |
93 void setZoom(float zoom) { m_zoom = zoom; } | 95 void setZoom(float zoom) { m_zoom = clampTo<float>(zoom, std::numeric_limits
<float>::denorm_min()); } |
94 | 96 |
95 CSSToLengthConversionData copyWithAdjustedZoom(float newZoom) const | 97 CSSToLengthConversionData copyWithAdjustedZoom(float newZoom) const |
96 { | 98 { |
97 return CSSToLengthConversionData(m_style, m_fontSizes, m_viewportSize, n
ewZoom); | 99 return CSSToLengthConversionData(m_style, m_fontSizes, m_viewportSize, n
ewZoom); |
98 } | 100 } |
99 | 101 |
100 private: | 102 private: |
101 const RenderStyle* m_style; | 103 const RenderStyle* m_style; |
102 FontSizes m_fontSizes; | 104 FontSizes m_fontSizes; |
103 ViewportSize m_viewportSize; | 105 ViewportSize m_viewportSize; |
104 float m_zoom; | 106 float m_zoom; |
105 }; | 107 }; |
106 | 108 |
107 } // namespace blink | 109 } // namespace blink |
108 | 110 |
109 #endif | 111 #endif |
OLD | NEW |