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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 : FontSizes(style->computedFontSize(), rootStyle ? rootStyle->computedFontSi
ze() : 1.0f, &style->font()) | 49 : FontSizes(style->computedFontSize(), rootStyle ? rootStyle->computedFontSi
ze() : 1.0f, &style->font()) |
50 { | 50 { |
51 } | 51 } |
52 | 52 |
53 float CSSToLengthConversionData::FontSizes::ex() const | 53 float CSSToLengthConversionData::FontSizes::ex() const |
54 { | 54 { |
55 ASSERT(m_font); | 55 ASSERT(m_font); |
56 // FIXME: We have a bug right now where the zoom will be applied twice to EX
units. | 56 // FIXME: We have a bug right now where the zoom will be applied twice to EX
units. |
57 // We really need to compute EX using fontMetrics for the original specified
Size and not use | 57 // We really need to compute EX using fontMetrics for the original specified
Size and not use |
58 // our actual constructed layoutObject font. | 58 // our actual constructed layoutObject font. |
59 if (!m_font->fontMetrics().hasXHeight()) | 59 if (!m_font->getFontMetrics().hasXHeight()) |
60 return m_em / 2.0f; | 60 return m_em / 2.0f; |
61 return m_font->fontMetrics().xHeight(); | 61 return m_font->getFontMetrics().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->getFontMetrics().zeroWidth(); |
68 } | 68 } |
69 | 69 |
70 CSSToLengthConversionData::ViewportSize::ViewportSize(const LayoutView* layoutVi
ew) | 70 CSSToLengthConversionData::ViewportSize::ViewportSize(const LayoutView* layoutVi
ew) |
71 : m_size(layoutView ? layoutView->viewportSizeForViewportUnits() : DoubleSiz
e()) | 71 : m_size(layoutView ? layoutView->viewportSizeForViewportUnits() : DoubleSiz
e()) |
72 { | 72 { |
73 } | 73 } |
74 | 74 |
75 CSSToLengthConversionData::CSSToLengthConversionData(const ComputedStyle* style,
const FontSizes& fontSizes, const ViewportSize& viewportSize, float zoom) | 75 CSSToLengthConversionData::CSSToLengthConversionData(const ComputedStyle* style,
const FontSizes& fontSizes, const ViewportSize& viewportSize, float zoom) |
76 : m_style(style) | 76 : m_style(style) |
77 , m_fontSizes(fontSizes) | 77 , m_fontSizes(fontSizes) |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 case CSSPrimitiveValue::UnitType::Chs: | 166 case CSSPrimitiveValue::UnitType::Chs: |
167 return value * chFontSize(); | 167 return value * chFontSize(); |
168 | 168 |
169 default: | 169 default: |
170 ASSERT_NOT_REACHED(); | 170 ASSERT_NOT_REACHED(); |
171 return 0; | 171 return 0; |
172 } | 172 } |
173 } | 173 } |
174 | 174 |
175 } // namespace blink | 175 } // namespace blink |
OLD | NEW |