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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 float exFontSize() const { return m_fontSizes.ex(); } | 85 float exFontSize() const { return m_fontSizes.ex(); } |
86 float chFontSize() const { return m_fontSizes.ch(); } | 86 float chFontSize() const { return m_fontSizes.ch(); } |
87 | 87 |
88 // Accessing these marks the style as having viewport units | 88 // Accessing these marks the style as having viewport units |
89 double viewportWidthPercent() const; | 89 double viewportWidthPercent() const; |
90 double viewportHeightPercent() const; | 90 double viewportHeightPercent() const; |
91 double viewportMinPercent() const; | 91 double viewportMinPercent() const; |
92 double viewportMaxPercent() const; | 92 double viewportMaxPercent() const; |
93 | 93 |
94 void setFontSizes(const FontSizes& fontSizes) { m_fontSizes = fontSizes; } | 94 void setFontSizes(const FontSizes& fontSizes) { m_fontSizes = fontSizes; } |
95 void setZoom(float zoom) { m_zoom = clampTo<float>(zoom, std::numeric_limits
<float>::denorm_min()); } | 95 void setZoom(float zoom) |
| 96 { |
| 97 ASSERT(std::isfinite(zoom) && zoom > 0); |
| 98 m_zoom = zoom; |
| 99 } |
96 | 100 |
97 CSSToLengthConversionData copyWithAdjustedZoom(float newZoom) const | 101 CSSToLengthConversionData copyWithAdjustedZoom(float newZoom) const |
98 { | 102 { |
99 return CSSToLengthConversionData(m_style, m_fontSizes, m_viewportSize, n
ewZoom); | 103 return CSSToLengthConversionData(m_style, m_fontSizes, m_viewportSize, n
ewZoom); |
100 } | 104 } |
101 | 105 |
102 private: | 106 private: |
103 const ComputedStyle* m_style; | 107 const ComputedStyle* m_style; |
104 FontSizes m_fontSizes; | 108 FontSizes m_fontSizes; |
105 ViewportSize m_viewportSize; | 109 ViewportSize m_viewportSize; |
106 float m_zoom; | 110 float m_zoom; |
107 }; | 111 }; |
108 | 112 |
109 } // namespace blink | 113 } // namespace blink |
110 | 114 |
111 #endif | 115 #endif |
OLD | NEW |