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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 CSSToLengthConversionData::FontSizes::FontSizes(const ComputedStyle* style, cons
t ComputedStyle* rootStyle) | 48 CSSToLengthConversionData::FontSizes::FontSizes(const ComputedStyle* style, cons
t ComputedStyle* rootStyle) |
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 rendering font. | 58 // our actual constructed layoutObject font. |
59 if (!m_font->fontMetrics().hasXHeight()) | 59 if (!m_font->fontMetrics().hasXHeight()) |
60 return m_em / 2.0f; | 60 return m_em / 2.0f; |
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 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 m_style->setHasViewportUnits(); | 102 m_style->setHasViewportUnits(); |
103 return std::min(m_viewportSize.width(), m_viewportSize.height()) / 100; | 103 return std::min(m_viewportSize.width(), m_viewportSize.height()) / 100; |
104 } | 104 } |
105 double CSSToLengthConversionData::viewportMaxPercent() const | 105 double CSSToLengthConversionData::viewportMaxPercent() const |
106 { | 106 { |
107 m_style->setHasViewportUnits(); | 107 m_style->setHasViewportUnits(); |
108 return std::max(m_viewportSize.width(), m_viewportSize.height()) / 100; | 108 return std::max(m_viewportSize.width(), m_viewportSize.height()) / 100; |
109 } | 109 } |
110 | 110 |
111 } // namespace blink | 111 } // namespace blink |
OLD | NEW |