| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012-2013 Intel Corporation. All rights reserved. | 2 * Copyright (C) 2012-2013 Intel Corporation. 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
| 9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
| 10 * disclaimer. | 10 * disclaimer. |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 float ViewportStyleResolver::viewportArgumentValue(CSSPropertyID id) const | 130 float ViewportStyleResolver::viewportArgumentValue(CSSPropertyID id) const |
| 131 { | 131 { |
| 132 float defaultValue = ViewportDescription::ValueAuto; | 132 float defaultValue = ViewportDescription::ValueAuto; |
| 133 | 133 |
| 134 // UserZoom default value is CSSValueZoom, which maps to true, meaning that | 134 // UserZoom default value is CSSValueZoom, which maps to true, meaning that |
| 135 // yes, it is user scalable. When the value is set to CSSValueFixed, we | 135 // yes, it is user scalable. When the value is set to CSSValueFixed, we |
| 136 // return false. | 136 // return false. |
| 137 if (id == CSSPropertyUserZoom) | 137 if (id == CSSPropertyUserZoom) |
| 138 defaultValue = 1; | 138 defaultValue = 1; |
| 139 | 139 |
| 140 RefPtrWillBeRawPtr<CSSValue> value = m_propertySet->getPropertyCSSValue(id); | 140 NullableCSSValue value = m_propertySet->getPropertyCSSValue(id); |
| 141 if (!value || !value->isPrimitiveValue()) | 141 if (!value || !value->isPrimitiveValue()) |
| 142 return defaultValue; | 142 return defaultValue; |
| 143 | 143 |
| 144 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value.get()); | 144 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 145 | 145 |
| 146 if (primitiveValue->isNumber() || primitiveValue->isPx()) | 146 if (primitiveValue->isNumber() || primitiveValue->isPx()) |
| 147 return primitiveValue->getFloatValue(); | 147 return primitiveValue->getFloatValue(); |
| 148 | 148 |
| 149 if (primitiveValue->isFontRelativeLength()) | 149 if (primitiveValue->isFontRelativeLength()) |
| 150 return primitiveValue->getFloatValue() * m_document->computedStyle()->fo
ntDescription().computedSize(); | 150 return primitiveValue->getFloatValue() * m_document->computedStyle()->fo
ntDescription().computedSize(); |
| 151 | 151 |
| 152 if (primitiveValue->isPercentage()) { | 152 if (primitiveValue->isPercentage()) { |
| 153 float percentValue = primitiveValue->getFloatValue() / 100.0f; | 153 float percentValue = primitiveValue->getFloatValue() / 100.0f; |
| 154 switch (id) { | 154 switch (id) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 Length ViewportStyleResolver::viewportLengthValue(CSSPropertyID id) const | 183 Length ViewportStyleResolver::viewportLengthValue(CSSPropertyID id) const |
| 184 { | 184 { |
| 185 ASSERT(id == CSSPropertyMaxHeight | 185 ASSERT(id == CSSPropertyMaxHeight |
| 186 || id == CSSPropertyMinHeight | 186 || id == CSSPropertyMinHeight |
| 187 || id == CSSPropertyMaxWidth | 187 || id == CSSPropertyMaxWidth |
| 188 || id == CSSPropertyMinWidth); | 188 || id == CSSPropertyMinWidth); |
| 189 | 189 |
| 190 RefPtrWillBeRawPtr<CSSValue> value = m_propertySet->getPropertyCSSValue(id); | 190 NullableCSSValue value = m_propertySet->getPropertyCSSValue(id); |
| 191 if (!value || !value->isPrimitiveValue()) | 191 if (!value || !value->isPrimitiveValue()) |
| 192 return Length(); // auto | 192 return Length(); // auto |
| 193 | 193 |
| 194 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value.get()); | 194 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 195 | 195 |
| 196 if (primitiveValue->getValueID() == CSSValueInternalExtendToZoom) | 196 if (primitiveValue->getValueID() == CSSValueInternalExtendToZoom) |
| 197 return Length(ExtendToZoom); | 197 return Length(ExtendToZoom); |
| 198 | 198 |
| 199 ComputedStyle* documentStyle = m_document->mutableComputedStyle(); | 199 ComputedStyle* documentStyle = m_document->mutableComputedStyle(); |
| 200 | 200 |
| 201 // If we have viewport units the conversion will mark the document style as
having viewport units. | 201 // If we have viewport units the conversion will mark the document style as
having viewport units. |
| 202 bool documentStyleHasViewportUnits = documentStyle->hasViewportUnits(); | 202 bool documentStyleHasViewportUnits = documentStyle->hasViewportUnits(); |
| 203 documentStyle->setHasViewportUnits(false); | 203 documentStyle->setHasViewportUnits(false); |
| 204 | 204 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 220 return result; | 220 return result; |
| 221 } | 221 } |
| 222 | 222 |
| 223 DEFINE_TRACE(ViewportStyleResolver) | 223 DEFINE_TRACE(ViewportStyleResolver) |
| 224 { | 224 { |
| 225 visitor->trace(m_propertySet); | 225 visitor->trace(m_propertySet); |
| 226 visitor->trace(m_document); | 226 visitor->trace(m_document); |
| 227 } | 227 } |
| 228 | 228 |
| 229 } // namespace blink | 229 } // namespace blink |
| OLD | NEW |