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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 161 } |
162 | 162 |
163 GridTrackSize StyleBuilderConverter::convertGridTrackSize(StyleResolverState& st
ate, CSSValue* value) | 163 GridTrackSize StyleBuilderConverter::convertGridTrackSize(StyleResolverState& st
ate, CSSValue* value) |
164 { | 164 { |
165 if (value->isPrimitiveValue()) | 165 if (value->isPrimitiveValue()) |
166 return GridTrackSize(convertGridTrackBreadth(state, toCSSPrimitiveValue(
value))); | 166 return GridTrackSize(convertGridTrackBreadth(state, toCSSPrimitiveValue(
value))); |
167 | 167 |
168 CSSFunctionValue* minmaxFunction = toCSSFunctionValue(value); | 168 CSSFunctionValue* minmaxFunction = toCSSFunctionValue(value); |
169 CSSValueList* arguments = minmaxFunction->arguments(); | 169 CSSValueList* arguments = minmaxFunction->arguments(); |
170 ASSERT_WITH_SECURITY_IMPLICATION(arguments->length() == 2); | 170 ASSERT_WITH_SECURITY_IMPLICATION(arguments->length() == 2); |
171 GridLength minTrackBreadth(convertGridTrackBreadth(state, toCSSPrimitiveValu
e(arguments->itemWithoutBoundsCheck(0)))); | 171 GridLength minTrackBreadth(convertGridTrackBreadth(state, toCSSPrimitiveValu
e(arguments->item(0)))); |
172 GridLength maxTrackBreadth(convertGridTrackBreadth(state, toCSSPrimitiveValu
e(arguments->itemWithoutBoundsCheck(1)))); | 172 GridLength maxTrackBreadth(convertGridTrackBreadth(state, toCSSPrimitiveValu
e(arguments->item(1)))); |
173 return GridTrackSize(minTrackBreadth, maxTrackBreadth); | 173 return GridTrackSize(minTrackBreadth, maxTrackBreadth); |
174 } | 174 } |
175 | 175 |
176 bool StyleBuilderConverter::convertGridTrackList(CSSValue* value, Vector<GridTra
ckSize>& trackSizes, NamedGridLinesMap& namedGridLines, OrderedNamedGridLines& o
rderedNamedGridLines, StyleResolverState& state) | 176 bool StyleBuilderConverter::convertGridTrackList(CSSValue* value, Vector<GridTra
ckSize>& trackSizes, NamedGridLinesMap& namedGridLines, OrderedNamedGridLines& o
rderedNamedGridLines, StyleResolverState& state) |
177 { | 177 { |
178 // Handle 'none'. | 178 // Handle 'none'. |
179 if (value->isPrimitiveValue()) { | 179 if (value->isPrimitiveValue()) { |
180 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 180 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
181 return primitiveValue->getValueID() == CSSValueNone; | 181 return primitiveValue->getValueID() == CSSValueNone; |
182 } | 182 } |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 336 |
337 return PO_NORMAL; | 337 return PO_NORMAL; |
338 } | 338 } |
339 | 339 |
340 PassRefPtr<QuotesData> StyleBuilderConverter::convertQuotes(StyleResolverState&,
CSSValue* value) | 340 PassRefPtr<QuotesData> StyleBuilderConverter::convertQuotes(StyleResolverState&,
CSSValue* value) |
341 { | 341 { |
342 if (value->isValueList()) { | 342 if (value->isValueList()) { |
343 CSSValueList* list = toCSSValueList(value); | 343 CSSValueList* list = toCSSValueList(value); |
344 RefPtr<QuotesData> quotes = QuotesData::create(); | 344 RefPtr<QuotesData> quotes = QuotesData::create(); |
345 for (size_t i = 0; i < list->length(); i += 2) { | 345 for (size_t i = 0; i < list->length(); i += 2) { |
346 CSSValue* first = list->itemWithoutBoundsCheck(i); | 346 CSSValue* first = list->item(i); |
347 // item() returns null if out of bounds so this is safe. | 347 // item() returns null if out of bounds so this is safe. |
348 CSSValue* second = list->item(i + 1); | 348 CSSValue* second = list->item(i + 1); |
349 if (!second) | 349 if (!second) |
350 continue; | 350 continue; |
351 String startQuote = toCSSPrimitiveValue(first)->getStringValue(); | 351 String startQuote = toCSSPrimitiveValue(first)->getStringValue(); |
352 String endQuote = toCSSPrimitiveValue(second)->getStringValue(); | 352 String endQuote = toCSSPrimitiveValue(second)->getStringValue(); |
353 quotes->addPair(std::make_pair(startQuote, endQuote)); | 353 quotes->addPair(std::make_pair(startQuote, endQuote)); |
354 } | 354 } |
355 return quotes.release(); | 355 return quotes.release(); |
356 } | 356 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 { | 411 { |
412 if (!value->isValueList()) { | 412 if (!value->isValueList()) { |
413 return SVGRenderStyle::initialStrokeDashArray(); | 413 return SVGRenderStyle::initialStrokeDashArray(); |
414 } | 414 } |
415 | 415 |
416 CSSValueList* dashes = toCSSValueList(value); | 416 CSSValueList* dashes = toCSSValueList(value); |
417 | 417 |
418 RefPtr<SVGLengthList> array = SVGLengthList::create(); | 418 RefPtr<SVGLengthList> array = SVGLengthList::create(); |
419 size_t length = dashes->length(); | 419 size_t length = dashes->length(); |
420 for (size_t i = 0; i < length; ++i) { | 420 for (size_t i = 0; i < length; ++i) { |
421 CSSValue* currValue = dashes->itemWithoutBoundsCheck(i); | 421 CSSValue* currValue = dashes->item(i); |
422 if (!currValue->isPrimitiveValue()) | 422 if (!currValue->isPrimitiveValue()) |
423 continue; | 423 continue; |
424 | 424 |
425 CSSPrimitiveValue* dash = toCSSPrimitiveValue(dashes->itemWithoutBoundsC
heck(i)); | 425 CSSPrimitiveValue* dash = toCSSPrimitiveValue(dashes->item(i)); |
426 array->append(SVGLength::fromCSSPrimitiveValue(dash)); | 426 array->append(SVGLength::fromCSSPrimitiveValue(dash)); |
427 } | 427 } |
428 | 428 |
429 return array.release(); | 429 return array.release(); |
430 } | 430 } |
431 | 431 |
432 Color StyleBuilderConverter::convertSVGColor(StyleResolverState& state, CSSValue
* value) | 432 Color StyleBuilderConverter::convertSVGColor(StyleResolverState& state, CSSValue
* value) |
433 { | 433 { |
434 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 434 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
435 if (primitiveValue->isRGBColor()) | 435 if (primitiveValue->isRGBColor()) |
(...skipping 11 matching lines...) Expand all Loading... |
447 { | 447 { |
448 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); | 448 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); |
449 if (primitiveValue->getValueID()) { | 449 if (primitiveValue->getValueID()) { |
450 float multiplier = convertLineWidth<float>(state, value); | 450 float multiplier = convertLineWidth<float>(state, value); |
451 return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::CSS
_EMS)->computeLength<float>(state.cssToLengthConversionData()); | 451 return CSSPrimitiveValue::create(multiplier / 48, CSSPrimitiveValue::CSS
_EMS)->computeLength<float>(state.cssToLengthConversionData()); |
452 } | 452 } |
453 return primitiveValue->computeLength<float>(state.cssToLengthConversionData(
)); | 453 return primitiveValue->computeLength<float>(state.cssToLengthConversionData(
)); |
454 } | 454 } |
455 | 455 |
456 } // namespace WebCore | 456 } // namespace WebCore |
OLD | NEW |