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* style, const RenderStyle* rootS tyle, const RenderView* renderView, float zoom, bool computingFontSize = false) |
44 : m_style(style) | 45 : m_style(style) |
45 , m_rootStyle(rootStyle) | 46 , m_rootStyle(rootStyle) |
47 , m_renderView(renderView) | |
46 , m_zoom(zoom) | 48 , m_zoom(zoom) |
47 , m_useEffectiveZoom(false) | 49 , m_useEffectiveZoom(false) |
48 , m_computingFontSize(computingFontSize) | 50 , m_computingFontSize(computingFontSize) |
49 { | 51 { |
50 ASSERT(zoom > 0); | 52 ASSERT(zoom > 0); |
51 } | 53 } |
52 CSSToLengthConversionData(const RenderStyle* style, const RenderStyle* rootS tyle, bool computingFontSize = false) | 54 CSSToLengthConversionData(const RenderStyle* style, const RenderStyle* rootS tyle, const RenderView* renderView, bool computingFontSize = false) |
53 : m_style(style) | 55 : m_style(style) |
54 , m_rootStyle(rootStyle) | 56 , m_rootStyle(rootStyle) |
57 , m_renderView(renderView) | |
55 , m_useEffectiveZoom(true) | 58 , m_useEffectiveZoom(true) |
56 , m_computingFontSize(computingFontSize) | 59 , m_computingFontSize(computingFontSize) |
57 { | 60 { |
58 } | 61 } |
59 const RenderStyle& style() const { return *m_style; } | 62 const RenderStyle& style() const { return *m_style; } |
60 const RenderStyle& rootStyle() const { return *m_rootStyle; } | 63 const RenderStyle& rootStyle() const { return *m_rootStyle; } |
61 float zoom() const; | 64 float zoom() const; |
62 bool computingFontSize() const { return m_computingFontSize; } | 65 bool computingFontSize() const { return m_computingFontSize; } |
63 | 66 |
67 // Accessing these marks the style as having viewport units | |
johnme
2013/12/18 12:04:15
Do any other accessors mutate the object like this
Timothy Loh
2013/12/23 06:28:16
I could move marking the style out into the conver
| |
68 double viewportWidthPercent() const; | |
69 double viewportHeightPercent() const; | |
70 double viewportMinPercent() const; | |
71 double viewportMaxPercent() const; | |
72 | |
64 void setStyle(const RenderStyle* style) { m_style = style; } | 73 void setStyle(const RenderStyle* style) { m_style = style; } |
65 void setRootStyle(const RenderStyle* rootStyle) { m_rootStyle = rootStyle; } | 74 void setRootStyle(const RenderStyle* rootStyle) { m_rootStyle = rootStyle; } |
66 | 75 |
67 CSSToLengthConversionData copyWithAdjustedZoom(float newZoom) const | 76 CSSToLengthConversionData copyWithAdjustedZoom(float newZoom) const |
68 { | 77 { |
69 return CSSToLengthConversionData(m_style, m_rootStyle, newZoom, m_comput ingFontSize); | 78 return CSSToLengthConversionData(m_style, m_rootStyle, m_renderView, new Zoom, m_computingFontSize); |
70 } | 79 } |
71 | 80 |
72 private: | 81 private: |
73 const RenderStyle* m_style; | 82 const RenderStyle* m_style; |
74 const RenderStyle* m_rootStyle; | 83 const RenderStyle* m_rootStyle; |
84 const RenderView* m_renderView; | |
75 float m_zoom; | 85 float m_zoom; |
76 bool m_useEffectiveZoom; | 86 bool m_useEffectiveZoom; |
77 bool m_computingFontSize; | 87 bool m_computingFontSize; |
78 }; | 88 }; |
79 | 89 |
80 } // namespace WebCore | 90 } // namespace WebCore |
81 | 91 |
82 #endif | 92 #endif |
OLD | NEW |