Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 1307673003: Made CSSPrimitiveValue::getString() only work for String types (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@split_out_pair
Patch Set: Small fix Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 { 463 {
464 if (value->isPrimitiveValue()) { 464 if (value->isPrimitiveValue()) {
465 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone); 465 ASSERT(toCSSPrimitiveValue(value)->getValueID() == CSSValueNone);
466 return; 466 return;
467 } 467 }
468 468
469 size_t currentNamedGridLine = 0; 469 size_t currentNamedGridLine = 0;
470 for (auto& currValue : *toCSSValueList(value)) { 470 for (auto& currValue : *toCSSValueList(value)) {
471 if (currValue->isGridLineNamesValue()) { 471 if (currValue->isGridLineNamesValue()) {
472 for (auto& namedGridLineValue : toCSSGridLineNamesValue(*currValue)) { 472 for (auto& namedGridLineValue : toCSSGridLineNamesValue(*currValue)) {
473 ASSERT(toCSSPrimitiveValue(namedGridLineValue.get())->isCustomId ent());
473 String namedGridLine = toCSSPrimitiveValue(namedGridLineValue.ge t())->getStringValue(); 474 String namedGridLine = toCSSPrimitiveValue(namedGridLineValue.ge t())->getStringValue();
474 NamedGridLinesMap::AddResult result = namedGridLines.add(namedGr idLine, Vector<size_t>()); 475 NamedGridLinesMap::AddResult result = namedGridLines.add(namedGr idLine, Vector<size_t>());
475 result.storedValue->value.append(currentNamedGridLine); 476 result.storedValue->value.append(currentNamedGridLine);
476 OrderedNamedGridLines::AddResult orderedInsertionResult = ordere dNamedGridLines.add(currentNamedGridLine, Vector<String>()); 477 OrderedNamedGridLines::AddResult orderedInsertionResult = ordere dNamedGridLines.add(currentNamedGridLine, Vector<String>());
477 orderedInsertionResult.storedValue->value.append(namedGridLine); 478 orderedInsertionResult.storedValue->value.append(namedGridLine);
478 } 479 }
479 continue; 480 continue;
480 } 481 }
481 482
482 ++currentNamedGridLine; 483 ++currentNamedGridLine;
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 } 736 }
736 737
737 PassRefPtr<QuotesData> StyleBuilderConverter::convertQuotes(StyleResolverState&, CSSValue* value) 738 PassRefPtr<QuotesData> StyleBuilderConverter::convertQuotes(StyleResolverState&, CSSValue* value)
738 { 739 {
739 if (value->isValueList()) { 740 if (value->isValueList()) {
740 CSSValueList* list = toCSSValueList(value); 741 CSSValueList* list = toCSSValueList(value);
741 RefPtr<QuotesData> quotes = QuotesData::create(); 742 RefPtr<QuotesData> quotes = QuotesData::create();
742 for (size_t i = 0; i < list->length(); i += 2) { 743 for (size_t i = 0; i < list->length(); i += 2) {
743 CSSValue* first = list->item(i); 744 CSSValue* first = list->item(i);
744 CSSValue* second = list->item(i + 1); 745 CSSValue* second = list->item(i + 1);
746 ASSERT(toCSSPrimitiveValue(first)->isString());
747 ASSERT(toCSSPrimitiveValue(second)->isString());
745 String startQuote = toCSSPrimitiveValue(first)->getStringValue(); 748 String startQuote = toCSSPrimitiveValue(first)->getStringValue();
746 String endQuote = toCSSPrimitiveValue(second)->getStringValue(); 749 String endQuote = toCSSPrimitiveValue(second)->getStringValue();
747 quotes->addPair(std::make_pair(startQuote, endQuote)); 750 quotes->addPair(std::make_pair(startQuote, endQuote));
748 } 751 }
749 return quotes.release(); 752 return quotes.release();
750 } 753 }
751 // FIXME: We should assert we're a primitive value with valueID = CSSValueNo ne 754 ASSERT(value->isPrimitiveValue() && toCSSPrimitiveValue(value)->getValueID() == CSSValueNone);
752 return QuotesData::create(); 755 return QuotesData::create();
753 } 756 }
754 757
755 LengthSize StyleBuilderConverter::convertRadius(StyleResolverState& state, CSSVa lue* value) 758 LengthSize StyleBuilderConverter::convertRadius(StyleResolverState& state, CSSVa lue* value)
756 { 759 {
757 const CSSValuePair* pair = toCSSValuePair(value); 760 const CSSValuePair* pair = toCSSValuePair(value);
758 Length radiusWidth = toCSSPrimitiveValue(pair->first())->convertToLength(sta te.cssToLengthConversionData()); 761 Length radiusWidth = toCSSPrimitiveValue(pair->first())->convertToLength(sta te.cssToLengthConversionData());
759 Length radiusHeight = toCSSPrimitiveValue(pair->second())->convertToLength(s tate.cssToLengthConversionData()); 762 Length radiusHeight = toCSSPrimitiveValue(pair->second())->convertToLength(s tate.cssToLengthConversionData());
760 float width = radiusWidth.value(); 763 float width = radiusWidth.value();
761 float height = radiusHeight.value(); 764 float height = radiusHeight.value();
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 return ScaleTransformOperation::create(sx, sy, sz, TransformOperation::Scale 3D); 961 return ScaleTransformOperation::create(sx, sy, sz, TransformOperation::Scale 3D);
959 } 962 }
960 963
961 RespectImageOrientationEnum StyleBuilderConverter::convertImageOrientation(Style ResolverState& state, CSSValue* value) 964 RespectImageOrientationEnum StyleBuilderConverter::convertImageOrientation(Style ResolverState& state, CSSValue* value)
962 { 965 {
963 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 966 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
964 return primitiveValue->getValueID() == CSSValueFromImage ? RespectImageOrien tation : DoNotRespectImageOrientation; 967 return primitiveValue->getValueID() == CSSValueFromImage ? RespectImageOrien tation : DoNotRespectImageOrientation;
965 } 968 }
966 969
967 } // namespace blink 970 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698