| 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 24 matching lines...) Expand all Loading... |
| 35 #include "core/css/CSSPrimitiveValue.h" | 35 #include "core/css/CSSPrimitiveValue.h" |
| 36 #include "platform/geometry/DoubleSize.h" | 36 #include "platform/geometry/DoubleSize.h" |
| 37 #include "wtf/Allocator.h" | 37 #include "wtf/Allocator.h" |
| 38 #include "wtf/Assertions.h" | 38 #include "wtf/Assertions.h" |
| 39 #include "wtf/MathExtras.h" | 39 #include "wtf/MathExtras.h" |
| 40 #include <limits> | 40 #include <limits> |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 class ComputedStyle; | 44 class ComputedStyle; |
| 45 class LayoutView; | 45 class LayoutViewItem; |
| 46 class Font; | 46 class Font; |
| 47 | 47 |
| 48 class CORE_EXPORT CSSToLengthConversionData { | 48 class CORE_EXPORT CSSToLengthConversionData { |
| 49 DISALLOW_NEW(); | 49 DISALLOW_NEW(); |
| 50 public: | 50 public: |
| 51 | 51 |
| 52 class FontSizes { | 52 class FontSizes { |
| 53 DISALLOW_NEW(); | 53 DISALLOW_NEW(); |
| 54 public: | 54 public: |
| 55 FontSizes() : m_em(0), m_rem(0), m_font(nullptr) { } | 55 FontSizes() : m_em(0), m_rem(0), m_font(nullptr) { } |
| 56 FontSizes(float em, float rem, const Font*); | 56 FontSizes(float em, float rem, const Font*); |
| 57 FontSizes(const ComputedStyle*, const ComputedStyle* rootStyle); | 57 FontSizes(const ComputedStyle*, const ComputedStyle* rootStyle); |
| 58 | 58 |
| 59 float em() const { return m_em; } | 59 float em() const { return m_em; } |
| 60 float rem() const { return m_rem; } | 60 float rem() const { return m_rem; } |
| 61 float ex() const; | 61 float ex() const; |
| 62 float ch() const; | 62 float ch() const; |
| 63 private: | 63 private: |
| 64 float m_em; | 64 float m_em; |
| 65 float m_rem; | 65 float m_rem; |
| 66 const Font* m_font; | 66 const Font* m_font; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 class ViewportSize { | 69 class ViewportSize { |
| 70 DISALLOW_NEW(); | 70 DISALLOW_NEW(); |
| 71 public: | 71 public: |
| 72 ViewportSize() { } | 72 ViewportSize() { } |
| 73 ViewportSize(double width, double height) : m_size(width, height) { } | 73 ViewportSize(double width, double height) : m_size(width, height) { } |
| 74 explicit ViewportSize(const LayoutView*); | 74 explicit ViewportSize(const LayoutViewItem&); |
| 75 | 75 |
| 76 double width() const { return m_size.width(); } | 76 double width() const { return m_size.width(); } |
| 77 double height() const { return m_size.height(); } | 77 double height() const { return m_size.height(); } |
| 78 private: | 78 private: |
| 79 DoubleSize m_size; | 79 DoubleSize m_size; |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 CSSToLengthConversionData() { } | 82 CSSToLengthConversionData() { } |
| 83 CSSToLengthConversionData(const ComputedStyle*, const FontSizes&, const View
portSize&, float zoom); | 83 CSSToLengthConversionData(const ComputedStyle*, const FontSizes&, const View
portSize&, float zoom); |
| 84 CSSToLengthConversionData(const ComputedStyle* currStyle, const ComputedStyl
e* rootStyle, const LayoutView*, float zoom); | 84 CSSToLengthConversionData(const ComputedStyle* currStyle, const ComputedStyl
e* rootStyle, const LayoutViewItem&, float zoom); |
| 85 | 85 |
| 86 float zoom() const { return m_zoom; } | 86 float zoom() const { return m_zoom; } |
| 87 | 87 |
| 88 float emFontSize() const { return m_fontSizes.em(); } | 88 float emFontSize() const { return m_fontSizes.em(); } |
| 89 float remFontSize() const; | 89 float remFontSize() const; |
| 90 float exFontSize() const { return m_fontSizes.ex(); } | 90 float exFontSize() const { return m_fontSizes.ex(); } |
| 91 float chFontSize() const { return m_fontSizes.ch(); } | 91 float chFontSize() const { return m_fontSizes.ch(); } |
| 92 | 92 |
| 93 // Accessing these marks the style as having viewport units | 93 // Accessing these marks the style as having viewport units |
| 94 double viewportWidthPercent() const; | 94 double viewportWidthPercent() const; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 113 private: | 113 private: |
| 114 const ComputedStyle* m_style; | 114 const ComputedStyle* m_style; |
| 115 FontSizes m_fontSizes; | 115 FontSizes m_fontSizes; |
| 116 ViewportSize m_viewportSize; | 116 ViewportSize m_viewportSize; |
| 117 float m_zoom; | 117 float m_zoom; |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 } // namespace blink | 120 } // namespace blink |
| 121 | 121 |
| 122 #endif | 122 #endif |
| OLD | NEW |