| 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 * * Redistributions of source code must retain the above copyright | 4 * * Redistributions of source code must retain the above copyright |
| 5 * notice, this list of conditions and the following disclaimer. | 5 * notice, this list of conditions and the following disclaimer. |
| 6 * * Redistributions in binary form must reproduce the above | 6 * * Redistributions in binary form must reproduce the above |
| 7 * copyright notice, this list of conditions and the following disclaimer | 7 * copyright notice, this list of conditions and the following disclaimer |
| 8 * in the documentation and/or other materials provided with the | 8 * in the documentation and/or other materials provided with the |
| 9 * distribution. | 9 * distribution. |
| 10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 202 |
| 203 float StyleBuilderConverter::convertNumberOrPercentage(StyleResolverState& state
, CSSValue* value) | 203 float StyleBuilderConverter::convertNumberOrPercentage(StyleResolverState& state
, CSSValue* value) |
| 204 { | 204 { |
| 205 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 205 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 206 ASSERT(primitiveValue->isNumber() || primitiveValue->isPercentage()); | 206 ASSERT(primitiveValue->isNumber() || primitiveValue->isPercentage()); |
| 207 if (primitiveValue->isNumber()) | 207 if (primitiveValue->isNumber()) |
| 208 return primitiveValue->getFloatValue(); | 208 return primitiveValue->getFloatValue(); |
| 209 return primitiveValue->getFloatValue() / 100.0f; | 209 return primitiveValue->getFloatValue() / 100.0f; |
| 210 } | 210 } |
| 211 | 211 |
| 212 PassRefPtr<QuotesData> StyleBuilderConverter::convertQuotes(StyleResolverState&,
CSSValue* value) | |
| 213 { | |
| 214 if (value->isValueList()) { | |
| 215 CSSValueList* list = toCSSValueList(value); | |
| 216 RefPtr<QuotesData> quotes = QuotesData::create(); | |
| 217 for (size_t i = 0; i < list->length(); i += 2) { | |
| 218 CSSValue* first = list->item(i); | |
| 219 CSSValue* second = list->item(i + 1); | |
| 220 String startQuote = toCSSPrimitiveValue(first)->getStringValue(); | |
| 221 String endQuote = toCSSPrimitiveValue(second)->getStringValue(); | |
| 222 quotes->addPair(std::make_pair(startQuote, endQuote)); | |
| 223 } | |
| 224 return quotes.release(); | |
| 225 } | |
| 226 // FIXME: We should assert we're a primitive value with valueID = CSSValueNo
ne | |
| 227 return QuotesData::create(); | |
| 228 } | |
| 229 | |
| 230 LengthSize StyleBuilderConverter::convertRadius(StyleResolverState& state, CSSVa
lue* value) | 212 LengthSize StyleBuilderConverter::convertRadius(StyleResolverState& state, CSSVa
lue* value) |
| 231 { | 213 { |
| 232 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 214 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 233 Pair* pair = primitiveValue->getPairValue(); | 215 Pair* pair = primitiveValue->getPairValue(); |
| 234 Length radiusWidth = pair->first()->convertToLength<FixedConversion | Percen
tConversion>(state.cssToLengthConversionData()); | 216 Length radiusWidth = pair->first()->convertToLength<FixedConversion | Percen
tConversion>(state.cssToLengthConversionData()); |
| 235 Length radiusHeight = pair->second()->convertToLength<FixedConversion | Perc
entConversion>(state.cssToLengthConversionData()); | 217 Length radiusHeight = pair->second()->convertToLength<FixedConversion | Perc
entConversion>(state.cssToLengthConversionData()); |
| 236 float width = radiusWidth.value(); | 218 float width = radiusWidth.value(); |
| 237 float height = radiusHeight.value(); | 219 float height = radiusHeight.value(); |
| 238 ASSERT(width >= 0 && height >= 0); | 220 ASSERT(width >= 0 && height >= 0); |
| 239 if (width <= 0 || height <= 0) | 221 if (width <= 0 || height <= 0) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 { | 262 { |
| 281 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 263 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
| 282 if (primitiveValue->getValueID()) { | 264 if (primitiveValue->getValueID()) { |
| 283 float multiplier = convertLineWidth<float>(state, value); | 265 float multiplier = convertLineWidth<float>(state, value); |
| 284 return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::CSS
_EMS)->computeLength<float>(state.cssToLengthConversionData()); | 266 return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::CSS
_EMS)->computeLength<float>(state.cssToLengthConversionData()); |
| 285 } | 267 } |
| 286 return primitiveValue->computeLength<float>(state.cssToLengthConversionData(
)); | 268 return primitiveValue->computeLength<float>(state.cssToLengthConversionData(
)); |
| 287 } | 269 } |
| 288 | 270 |
| 289 } // namespace blink | 271 } // namespace blink |
| OLD | NEW |