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 19 matching lines...) Expand all Loading... |
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/Noncopyable.h" | 35 #include "wtf/Noncopyable.h" |
36 | 36 |
37 namespace WebCore { | 37 namespace WebCore { |
38 | 38 |
39 class RenderStyle; | 39 class RenderStyle; |
| 40 class RenderView; |
40 | 41 |
41 class CSSToLengthConversionData { | 42 class CSSToLengthConversionData { |
42 public: | 43 public: |
43 CSSToLengthConversionData(const RenderStyle* style, const RenderStyle* rootS
tyle, float zoom, bool computingFontSize = false) | 44 CSSToLengthConversionData(const RenderStyle* currStyle, const RenderStyle* r
ootStyle, const RenderView*, float zoom, bool computingFontSize = false); |
44 : m_style(style) | 45 CSSToLengthConversionData(const RenderStyle* currStyle, const RenderStyle* r
ootStyle, const RenderView*, bool computingFontSize = false); |
45 , m_rootStyle(rootStyle) | 46 CSSToLengthConversionData(const RenderStyle* currStyle, const RenderStyle* r
ootStyle, float viewportWidth, float viewportHeight, float zoom, bool computingF
ontSize = false); |
46 , m_zoom(zoom) | 47 |
47 , m_useEffectiveZoom(false) | |
48 , m_computingFontSize(computingFontSize) | |
49 { | |
50 ASSERT(zoom > 0); | |
51 } | |
52 CSSToLengthConversionData(const RenderStyle* style, const RenderStyle* rootS
tyle, bool computingFontSize = false) | |
53 : m_style(style) | |
54 , m_rootStyle(rootStyle) | |
55 , m_useEffectiveZoom(true) | |
56 , m_computingFontSize(computingFontSize) | |
57 { | |
58 } | |
59 const RenderStyle& style() const { return *m_style; } | 48 const RenderStyle& style() const { return *m_style; } |
60 const RenderStyle& rootStyle() const { return *m_rootStyle; } | 49 const RenderStyle& rootStyle() const { return *m_rootStyle; } |
61 float zoom() const; | 50 float zoom() const; |
62 bool computingFontSize() const { return m_computingFontSize; } | 51 bool computingFontSize() const { return m_computingFontSize; } |
63 | 52 |
| 53 // Accessing these marks the style as having viewport units |
| 54 double viewportWidthPercent() const; |
| 55 double viewportHeightPercent() const; |
| 56 double viewportMinPercent() const; |
| 57 double viewportMaxPercent() const; |
| 58 |
64 void setStyle(const RenderStyle* style) { m_style = style; } | 59 void setStyle(const RenderStyle* style) { m_style = style; } |
65 void setRootStyle(const RenderStyle* rootStyle) { m_rootStyle = rootStyle; } | 60 void setRootStyle(const RenderStyle* rootStyle) { m_rootStyle = rootStyle; } |
66 | 61 |
67 CSSToLengthConversionData copyWithAdjustedZoom(float newZoom) const | 62 CSSToLengthConversionData copyWithAdjustedZoom(float newZoom) const |
68 { | 63 { |
69 return CSSToLengthConversionData(m_style, m_rootStyle, newZoom, m_comput
ingFontSize); | 64 return CSSToLengthConversionData(m_style, m_rootStyle, m_viewportWidth,
m_viewportHeight, newZoom, m_computingFontSize); |
70 } | 65 } |
71 | 66 |
72 private: | 67 private: |
73 const RenderStyle* m_style; | 68 const RenderStyle* m_style; |
74 const RenderStyle* m_rootStyle; | 69 const RenderStyle* m_rootStyle; |
| 70 float m_viewportWidth; |
| 71 float m_viewportHeight; |
75 float m_zoom; | 72 float m_zoom; |
76 bool m_useEffectiveZoom; | 73 bool m_useEffectiveZoom; |
77 bool m_computingFontSize; | 74 bool m_computingFontSize; |
78 }; | 75 }; |
79 | 76 |
80 } // namespace WebCore | 77 } // namespace WebCore |
81 | 78 |
82 #endif | 79 #endif |
OLD | NEW |