| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 float zoom) | 94 float zoom) |
| 95 : CSSToLengthConversionData(style, | 95 : CSSToLengthConversionData(style, |
| 96 FontSizes(style, rootStyle), | 96 FontSizes(style, rootStyle), |
| 97 ViewportSize(layoutViewItem), | 97 ViewportSize(layoutViewItem), |
| 98 zoom) {} | 98 zoom) {} |
| 99 | 99 |
| 100 double CSSToLengthConversionData::viewportWidthPercent() const { | 100 double CSSToLengthConversionData::viewportWidthPercent() const { |
| 101 // FIXME: Remove m_style from this class. Plumb viewport and rem unit | 101 // FIXME: Remove m_style from this class. Plumb viewport and rem unit |
| 102 // information through as output parameters on functions involved in length | 102 // information through as output parameters on functions involved in length |
| 103 // resolution. | 103 // resolution. |
| 104 const_cast<ComputedStyle*>(m_style)->setHasViewportUnits(); | 104 const_cast<ComputedStyle*>(m_style)->setHasViewportUnits(true); |
| 105 return m_viewportSize.width() / 100; | 105 return m_viewportSize.width() / 100; |
| 106 } | 106 } |
| 107 double CSSToLengthConversionData::viewportHeightPercent() const { | 107 double CSSToLengthConversionData::viewportHeightPercent() const { |
| 108 const_cast<ComputedStyle*>(m_style)->setHasViewportUnits(); | 108 const_cast<ComputedStyle*>(m_style)->setHasViewportUnits(true); |
| 109 return m_viewportSize.height() / 100; | 109 return m_viewportSize.height() / 100; |
| 110 } | 110 } |
| 111 double CSSToLengthConversionData::viewportMinPercent() const { | 111 double CSSToLengthConversionData::viewportMinPercent() const { |
| 112 const_cast<ComputedStyle*>(m_style)->setHasViewportUnits(); | 112 const_cast<ComputedStyle*>(m_style)->setHasViewportUnits(true); |
| 113 return std::min(m_viewportSize.width(), m_viewportSize.height()) / 100; | 113 return std::min(m_viewportSize.width(), m_viewportSize.height()) / 100; |
| 114 } | 114 } |
| 115 double CSSToLengthConversionData::viewportMaxPercent() const { | 115 double CSSToLengthConversionData::viewportMaxPercent() const { |
| 116 const_cast<ComputedStyle*>(m_style)->setHasViewportUnits(); | 116 const_cast<ComputedStyle*>(m_style)->setHasViewportUnits(true); |
| 117 return std::max(m_viewportSize.width(), m_viewportSize.height()) / 100; | 117 return std::max(m_viewportSize.width(), m_viewportSize.height()) / 100; |
| 118 } | 118 } |
| 119 | 119 |
| 120 float CSSToLengthConversionData::remFontSize() const { | 120 float CSSToLengthConversionData::remFontSize() const { |
| 121 const_cast<ComputedStyle*>(m_style)->setHasRemUnits(); | 121 const_cast<ComputedStyle*>(m_style)->setHasRemUnits(); |
| 122 return m_fontSizes.rem(); | 122 return m_fontSizes.rem(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 double CSSToLengthConversionData::zoomedComputedPixels( | 125 double CSSToLengthConversionData::zoomedComputedPixels( |
| 126 double value, | 126 double value, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 case CSSPrimitiveValue::UnitType::Chs: | 178 case CSSPrimitiveValue::UnitType::Chs: |
| 179 return value * chFontSize(); | 179 return value * chFontSize(); |
| 180 | 180 |
| 181 default: | 181 default: |
| 182 NOTREACHED(); | 182 NOTREACHED(); |
| 183 return 0; | 183 return 0; |
| 184 } | 184 } |
| 185 } | 185 } |
| 186 | 186 |
| 187 } // namespace blink | 187 } // namespace blink |
| OLD | NEW |