Chromium Code Reviews| 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 20 matching lines...) Expand all Loading... | |
| 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 class RenderView; |
| 41 class MediaValues; | |
| 41 | 42 |
| 42 class CSSToLengthConversionData { | 43 class CSSToLengthConversionData { |
| 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); |
| 48 CSSToLengthConversionData(const MediaValues*, float zoom, bool computingFont Size = false); | |
| 47 | 49 |
| 48 const RenderStyle& style() const { return *m_style; } | 50 const RenderStyle& style() const { return *m_style; } |
| 49 const RenderStyle* rootStyle() const { return m_rootStyle; } | 51 const RenderStyle* rootStyle() const { return m_rootStyle; } |
| 50 float zoom() const; | 52 float zoom() const; |
| 51 bool computingFontSize() const { return m_computingFontSize; } | 53 bool computingFontSize() const; |
| 54 double fontSpecifiedSize() const; | |
| 55 double fontComputedSize() const; | |
| 56 double rootFontSpecifiedSize() const; | |
| 57 double rootFontComputedSize() const; | |
| 58 bool hasXHeight() const; | |
| 59 double xHeight() const; | |
| 60 double zeroWidth() const; | |
| 61 bool hasRoot() const { return !!m_rootStyle; } | |
| 52 | 62 |
| 53 // Accessing these marks the style as having viewport units | 63 // Accessing these marks the style as having viewport units |
| 54 double viewportWidthPercent() const; | 64 double viewportWidthPercent() const; |
| 55 double viewportHeightPercent() const; | 65 double viewportHeightPercent() const; |
| 56 double viewportMinPercent() const; | 66 double viewportMinPercent() const; |
| 57 double viewportMaxPercent() const; | 67 double viewportMaxPercent() const; |
| 58 | 68 |
| 59 void setStyle(const RenderStyle* style) { m_style = style; } | 69 void setStyle(const RenderStyle* style) { m_style = style; } |
| 60 void setRootStyle(const RenderStyle* rootStyle) { m_rootStyle = rootStyle; } | 70 void setRootStyle(const RenderStyle* rootStyle) { m_rootStyle = rootStyle; } |
| 61 | 71 |
| 62 CSSToLengthConversionData copyWithAdjustedZoom(float newZoom) const | 72 CSSToLengthConversionData copyWithAdjustedZoom(float newZoom) const |
| 63 { | 73 { |
| 64 return CSSToLengthConversionData(m_style, m_rootStyle, m_viewportWidth, m_viewportHeight, newZoom, m_computingFontSize); | 74 return CSSToLengthConversionData(m_style, m_rootStyle, m_viewportWidth, m_viewportHeight, newZoom, m_computingFontSize); |
| 65 } | 75 } |
| 66 | 76 |
| 67 private: | 77 private: |
| 68 const RenderStyle* m_style; | 78 const RenderStyle* m_style; |
| 69 const RenderStyle* m_rootStyle; | 79 const RenderStyle* m_rootStyle; |
| 80 const MediaValues* m_mediaValues; // Can't be a RefPtr since it would create a dependency cycle. | |
|
eseidel
2014/04/08 16:51:28
Could you elaborate more on the cycle?
esprehn
2014/04/08 17:40:39
CSSLengthToConversionData should only be created o
| |
| 70 float m_viewportWidth; | 81 float m_viewportWidth; |
| 71 float m_viewportHeight; | 82 float m_viewportHeight; |
| 72 float m_zoom; | 83 float m_zoom; |
| 73 bool m_useEffectiveZoom; | 84 bool m_useEffectiveZoom; |
| 74 bool m_computingFontSize; | 85 bool m_computingFontSize; |
| 75 }; | 86 }; |
| 76 | 87 |
| 77 } // namespace WebCore | 88 } // namespace WebCore |
| 78 | 89 |
| 79 #endif | 90 #endif |
| OLD | NEW |