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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
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 "core/css/CSSLengthData.h" |
34 #include "wtf/Assertions.h" | 35 #include "wtf/Assertions.h" |
35 #include "wtf/Noncopyable.h" | 36 #include "wtf/Noncopyable.h" |
36 | 37 |
37 namespace WebCore { | 38 namespace WebCore { |
38 | 39 |
39 class RenderStyle; | 40 class RenderStyle; |
40 class RenderView; | 41 class RenderView; |
41 | 42 |
42 class CSSToLengthConversionData { | 43 class CSSToLengthConversionData: public CSSLengthData { |
43 public: | 44 public: |
44 CSSToLengthConversionData(const RenderStyle* currStyle, const RenderStyle* r
ootStyle, const RenderView*, float zoom, bool computingFontSize = false); | 45 CSSToLengthConversionData(const RenderStyle* currStyle, const RenderStyle* r
ootStyle, const RenderView*, float zoom, bool computingFontSize = false); |
45 CSSToLengthConversionData(const RenderStyle* currStyle, const RenderStyle* r
ootStyle, const RenderView*, bool computingFontSize = false); | 46 CSSToLengthConversionData(const RenderStyle* currStyle, const RenderStyle* r
ootStyle, const RenderView*, bool computingFontSize = false); |
46 CSSToLengthConversionData(const RenderStyle* currStyle, const RenderStyle* r
ootStyle, float viewportWidth, float viewportHeight, float zoom, bool computingF
ontSize = false); | 47 CSSToLengthConversionData(const RenderStyle* currStyle, const RenderStyle* r
ootStyle, float viewportWidth, float viewportHeight, float zoom, bool computingF
ontSize = false); |
47 | 48 |
48 const RenderStyle& style() const { return *m_style; } | 49 const RenderStyle& style() const { return *m_style; } |
49 const RenderStyle* rootStyle() const { return m_rootStyle; } | 50 const RenderStyle* rootStyle() const { return m_rootStyle; } |
50 float zoom() const; | 51 virtual float zoom() const; |
51 bool computingFontSize() const { return m_computingFontSize; } | 52 virtual bool computingFontSize() const; |
| 53 virtual double fontSpecifiedSize() const; |
| 54 virtual double fontComputedSize() const; |
| 55 virtual double rootFontSpecifiedSize() const; |
| 56 virtual double rootFontComputedSize() const; |
| 57 virtual bool hasXHeight() const; |
| 58 virtual double xHeight() const; |
| 59 virtual double zeroWidth() const; |
| 60 virtual bool hasRoot() const { return !!m_rootStyle; } |
52 | 61 |
53 // Accessing these marks the style as having viewport units | 62 // Accessing these marks the style as having viewport units |
54 double viewportWidthPercent() const; | 63 virtual double viewportWidthPercent() const; |
55 double viewportHeightPercent() const; | 64 virtual double viewportHeightPercent() const; |
56 double viewportMinPercent() const; | 65 virtual double viewportMinPercent() const; |
57 double viewportMaxPercent() const; | 66 virtual double viewportMaxPercent() const; |
58 | 67 |
59 void setStyle(const RenderStyle* style) { m_style = style; } | 68 void setStyle(const RenderStyle* style) { m_style = style; } |
60 void setRootStyle(const RenderStyle* rootStyle) { m_rootStyle = rootStyle; } | 69 void setRootStyle(const RenderStyle* rootStyle) { m_rootStyle = rootStyle; } |
61 | 70 |
62 CSSToLengthConversionData copyWithAdjustedZoom(float newZoom) const | 71 CSSToLengthConversionData copyWithAdjustedZoom(float newZoom) const |
63 { | 72 { |
64 return CSSToLengthConversionData(m_style, m_rootStyle, m_viewportWidth,
m_viewportHeight, newZoom, m_computingFontSize); | 73 return CSSToLengthConversionData(m_style, m_rootStyle, m_viewportWidth,
m_viewportHeight, newZoom, m_computingFontSize); |
65 } | 74 } |
66 | 75 |
67 private: | 76 private: |
68 const RenderStyle* m_style; | 77 const RenderStyle* m_style; |
69 const RenderStyle* m_rootStyle; | 78 const RenderStyle* m_rootStyle; |
70 float m_viewportWidth; | 79 float m_viewportWidth; |
71 float m_viewportHeight; | 80 float m_viewportHeight; |
72 float m_zoom; | 81 float m_zoom; |
73 bool m_useEffectiveZoom; | 82 bool m_useEffectiveZoom; |
74 bool m_computingFontSize; | 83 bool m_computingFontSize; |
75 }; | 84 }; |
76 | 85 |
77 } // namespace WebCore | 86 } // namespace WebCore |
78 | 87 |
79 #endif | 88 #endif |
OLD | NEW |