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

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

Issue 108653006: Assert that convertToLength succeeds instead of returning Length(Undefined) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebased Created 7 years 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 28 matching lines...) Expand all
39 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 39 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
40 if (primitiveValue->isURI()) 40 if (primitiveValue->isURI())
41 return SVGURIReference::fragmentIdentifierFromIRIString(primitiveValue-> getStringValue(), state.document()); 41 return SVGURIReference::fragmentIdentifierFromIRIString(primitiveValue-> getStringValue(), state.document());
42 return String(); 42 return String();
43 } 43 }
44 44
45 Length StyleBuilderConverter::convertLength(StyleResolverState& state, CSSValue* value) 45 Length StyleBuilderConverter::convertLength(StyleResolverState& state, CSSValue* value)
46 { 46 {
47 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 47 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
48 Length result = primitiveValue->convertToLength<FixedConversion | PercentCon version>(state.cssToLengthConversionData()); 48 Length result = primitiveValue->convertToLength<FixedConversion | PercentCon version>(state.cssToLengthConversionData());
49 ASSERT(!result.isUndefined());
50 result.setQuirk(primitiveValue->isQuirkValue()); 49 result.setQuirk(primitiveValue->isQuirkValue());
51 return result; 50 return result;
52 } 51 }
53 52
54 Length StyleBuilderConverter::convertLengthOrAuto(StyleResolverState& state, CSS Value* value) 53 Length StyleBuilderConverter::convertLengthOrAuto(StyleResolverState& state, CSS Value* value)
55 { 54 {
56 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 55 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
57 Length result = primitiveValue->convertToLength<FixedConversion | PercentCon version | AutoConversion>(state.cssToLengthConversionData()); 56 Length result = primitiveValue->convertToLength<FixedConversion | PercentCon version | AutoConversion>(state.cssToLengthConversionData());
58 ASSERT(!result.isUndefined());
59 result.setQuirk(primitiveValue->isQuirkValue()); 57 result.setQuirk(primitiveValue->isQuirkValue());
60 return result; 58 return result;
61 } 59 }
62 60
63 Length StyleBuilderConverter::convertLengthSizing(StyleResolverState& state, CSS Value* value) 61 Length StyleBuilderConverter::convertLengthSizing(StyleResolverState& state, CSS Value* value)
64 { 62 {
65 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value); 63 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
66 switch (primitiveValue->getValueID()) { 64 switch (primitiveValue->getValueID()) {
67 case CSSValueInvalid: 65 case CSSValueInvalid:
68 return convertLength(state, value); 66 return convertLength(state, value);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return primitiveValue->computeLength<float>(state.cssToLengthConversionD ata().copyWithAdjustedZoom(1)); 163 return primitiveValue->computeLength<float>(state.cssToLengthConversionD ata().copyWithAdjustedZoom(1));
166 return primitiveValue->computeLength<float>(state.cssToLengthConversionData( )); 164 return primitiveValue->computeLength<float>(state.cssToLengthConversionData( ));
167 } 165 }
168 166
169 SVGLength StyleBuilderConverter::convertSVGLength(StyleResolverState&, CSSValue* value) 167 SVGLength StyleBuilderConverter::convertSVGLength(StyleResolverState&, CSSValue* value)
170 { 168 {
171 return SVGLength::fromCSSPrimitiveValue(toCSSPrimitiveValue(value)); 169 return SVGLength::fromCSSPrimitiveValue(toCSSPrimitiveValue(value));
172 } 170 }
173 171
174 } // namespace WebCore 172 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/FilterOperationResolver.cpp ('k') | Source/core/css/resolver/StyleBuilderCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698