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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 return m_font->fontMetrics().xHeight(); | 61 return m_font->fontMetrics().xHeight(); |
62 } | 62 } |
63 | 63 |
64 float CSSToLengthConversionData::FontSizes::ch() const | 64 float CSSToLengthConversionData::FontSizes::ch() const |
65 { | 65 { |
66 ASSERT(m_font); | 66 ASSERT(m_font); |
67 return m_font->fontMetrics().zeroWidth(); | 67 return m_font->fontMetrics().zeroWidth(); |
68 } | 68 } |
69 | 69 |
70 CSSToLengthConversionData::ViewportSize::ViewportSize(const LayoutView* layoutVi
ew) | 70 CSSToLengthConversionData::ViewportSize::ViewportSize(const LayoutView* layoutVi
ew) |
71 : m_width(layoutView ? layoutView->layoutViewportWidth() : 0) | 71 : m_width(layoutView ? layoutView->viewportSizeForViewportUnits().width() :
0) |
72 , m_height(layoutView ? layoutView->layoutViewportHeight() : 0) | 72 , m_height(layoutView ? layoutView->viewportSizeForViewportUnits().height()
: 0) |
73 { | 73 { |
74 } | 74 } |
75 | 75 |
76 CSSToLengthConversionData::CSSToLengthConversionData(const ComputedStyle* style,
const FontSizes& fontSizes, const ViewportSize& viewportSize, float zoom) | 76 CSSToLengthConversionData::CSSToLengthConversionData(const ComputedStyle* style,
const FontSizes& fontSizes, const ViewportSize& viewportSize, float zoom) |
77 : m_style(style) | 77 : m_style(style) |
78 , m_fontSizes(fontSizes) | 78 , m_fontSizes(fontSizes) |
79 , m_viewportSize(viewportSize) | 79 , m_viewportSize(viewportSize) |
80 , m_zoom(clampTo<float>(zoom, std::numeric_limits<float>::denorm_min())) | 80 , m_zoom(clampTo<float>(zoom, std::numeric_limits<float>::denorm_min())) |
81 { | 81 { |
82 ASSERT(m_style); | 82 ASSERT(m_style); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 case CSSPrimitiveValue::UnitType::Chs: | 167 case CSSPrimitiveValue::UnitType::Chs: |
168 return value * chFontSize(); | 168 return value * chFontSize(); |
169 | 169 |
170 default: | 170 default: |
171 ASSERT_NOT_REACHED(); | 171 ASSERT_NOT_REACHED(); |
172 return 0; | 172 return 0; |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 } // namespace blink | 176 } // namespace blink |
OLD | NEW |