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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 float ViewportStyleResolver::viewportArgumentValue(CSSPropertyID id) const | 126 float ViewportStyleResolver::viewportArgumentValue(CSSPropertyID id) const |
127 { | 127 { |
128 float defaultValue = ViewportDescription::ValueAuto; | 128 float defaultValue = ViewportDescription::ValueAuto; |
129 | 129 |
130 // UserZoom default value is CSSValueZoom, which maps to true, meaning that | 130 // UserZoom default value is CSSValueZoom, which maps to true, meaning that |
131 // yes, it is user scalable. When the value is set to CSSValueFixed, we | 131 // yes, it is user scalable. When the value is set to CSSValueFixed, we |
132 // return false. | 132 // return false. |
133 if (id == CSSPropertyUserZoom) | 133 if (id == CSSPropertyUserZoom) |
134 defaultValue = 1; | 134 defaultValue = 1; |
135 | 135 |
136 RawPtr<CSSValue> value = m_propertySet->getPropertyCSSValue(id); | 136 CSSValue* value = m_propertySet->getPropertyCSSValue(id); |
137 if (!value || !value->isPrimitiveValue()) | 137 if (!value || !value->isPrimitiveValue()) |
138 return defaultValue; | 138 return defaultValue; |
139 | 139 |
140 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value.get()); | 140 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
141 | 141 |
142 if (primitiveValue->isNumber() || primitiveValue->isPx()) | 142 if (primitiveValue->isNumber() || primitiveValue->isPx()) |
143 return primitiveValue->getFloatValue(); | 143 return primitiveValue->getFloatValue(); |
144 | 144 |
145 if (primitiveValue->isFontRelativeLength()) | 145 if (primitiveValue->isFontRelativeLength()) |
146 return primitiveValue->getFloatValue() * m_document->computedStyle()->ge
tFontDescription().computedSize(); | 146 return primitiveValue->getFloatValue() * m_document->computedStyle()->ge
tFontDescription().computedSize(); |
147 | 147 |
148 if (primitiveValue->isPercentage()) { | 148 if (primitiveValue->isPercentage()) { |
149 float percentValue = primitiveValue->getFloatValue() / 100.0f; | 149 float percentValue = primitiveValue->getFloatValue() / 100.0f; |
150 switch (id) { | 150 switch (id) { |
(...skipping 25 matching lines...) Expand all Loading... |
176 } | 176 } |
177 } | 177 } |
178 | 178 |
179 Length ViewportStyleResolver::viewportLengthValue(CSSPropertyID id) const | 179 Length ViewportStyleResolver::viewportLengthValue(CSSPropertyID id) const |
180 { | 180 { |
181 ASSERT(id == CSSPropertyMaxHeight | 181 ASSERT(id == CSSPropertyMaxHeight |
182 || id == CSSPropertyMinHeight | 182 || id == CSSPropertyMinHeight |
183 || id == CSSPropertyMaxWidth | 183 || id == CSSPropertyMaxWidth |
184 || id == CSSPropertyMinWidth); | 184 || id == CSSPropertyMinWidth); |
185 | 185 |
186 RawPtr<CSSValue> value = m_propertySet->getPropertyCSSValue(id); | 186 CSSValue* value = m_propertySet->getPropertyCSSValue(id); |
187 if (!value || !value->isPrimitiveValue()) | 187 if (!value || !value->isPrimitiveValue()) |
188 return Length(); // auto | 188 return Length(); // auto |
189 | 189 |
190 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value.get()); | 190 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
191 | 191 |
192 if (primitiveValue->getValueID() == CSSValueInternalExtendToZoom) | 192 if (primitiveValue->getValueID() == CSSValueInternalExtendToZoom) |
193 return Length(ExtendToZoom); | 193 return Length(ExtendToZoom); |
194 | 194 |
195 ComputedStyle* documentStyle = m_document->mutableComputedStyle(); | 195 ComputedStyle* documentStyle = m_document->mutableComputedStyle(); |
196 | 196 |
197 // If we have viewport units the conversion will mark the document style as
having viewport units. | 197 // If we have viewport units the conversion will mark the document style as
having viewport units. |
198 bool documentStyleHasViewportUnits = documentStyle->hasViewportUnits(); | 198 bool documentStyleHasViewportUnits = documentStyle->hasViewportUnits(); |
199 documentStyle->setHasViewportUnits(false); | 199 documentStyle->setHasViewportUnits(false); |
200 | 200 |
(...skipping 11 matching lines...) Expand all Loading... |
212 return result; | 212 return result; |
213 } | 213 } |
214 | 214 |
215 DEFINE_TRACE(ViewportStyleResolver) | 215 DEFINE_TRACE(ViewportStyleResolver) |
216 { | 216 { |
217 visitor->trace(m_propertySet); | 217 visitor->trace(m_propertySet); |
218 visitor->trace(m_document); | 218 visitor->trace(m_document); |
219 } | 219 } |
220 | 220 |
221 } // namespace blink | 221 } // namespace blink |
OLD | NEW |