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

Side by Side Diff: Source/core/css/parser/SizesCalcParserTest.cpp

Issue 1303173007: Oilpan: Unship Oilpan from CSSValues Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/css/parser/SizesCalcParser.h" 6 #include "core/css/parser/SizesCalcParser.h"
7 7
8 #include "core/MediaTypeNames.h" 8 #include "core/MediaTypeNames.h"
9 #include "core/css/CSSPrimitiveValue.h" 9 #include "core/css/CSSPrimitiveValue.h"
10 #include "core/css/MediaValuesCached.h" 10 #include "core/css/MediaValuesCached.h"
(...skipping 15 matching lines...) Expand all
26 { 26 {
27 lengthArray.resize(CSSPrimitiveValue::LengthUnitTypeCount); 27 lengthArray.resize(CSSPrimitiveValue::LengthUnitTypeCount);
28 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) 28 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i)
29 lengthArray.at(i) = 0; 29 lengthArray.at(i) = 0;
30 } 30 }
31 31
32 static void verifyCSSCalc(String text, double value, bool valid, unsigned fontSi ze, unsigned viewportWidth, unsigned viewportHeight) 32 static void verifyCSSCalc(String text, double value, bool valid, unsigned fontSi ze, unsigned viewportWidth, unsigned viewportHeight)
33 { 33 {
34 CSSLengthArray lengthArray; 34 CSSLengthArray lengthArray;
35 initLengthArray(lengthArray); 35 initLengthArray(lengthArray);
36 RefPtrWillBeRawPtr<CSSValue> cssValue = CSSParser::parseSingleValue(CSSPrope rtyLeft, text); 36 RefPtr<CSSValue> cssValue = CSSParser::parseSingleValue(CSSPropertyLeft, tex t);
37 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(cssValue.get()); 37 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(cssValue.get());
38 if (primitiveValue) 38 if (primitiveValue)
39 primitiveValue->accumulateLengthArray(lengthArray); 39 primitiveValue->accumulateLengthArray(lengthArray);
40 else 40 else
41 ASSERT_EQ(valid, false); 41 ASSERT_EQ(valid, false);
42 float length = lengthArray.at(CSSPrimitiveValue::UnitTypePixels); 42 float length = lengthArray.at(CSSPrimitiveValue::UnitTypePixels);
43 length += lengthArray.at(CSSPrimitiveValue::UnitTypeFontSize) * fontSize; 43 length += lengthArray.at(CSSPrimitiveValue::UnitTypeFontSize) * fontSize;
44 length += lengthArray.at(CSSPrimitiveValue::UnitTypeViewportWidth) * viewpor tWidth / 100.0; 44 length += lengthArray.at(CSSPrimitiveValue::UnitTypeViewportWidth) * viewpor tWidth / 100.0;
45 length += lengthArray.at(CSSPrimitiveValue::UnitTypeViewportHeight) * viewpo rtHeight / 100.0; 45 length += lengthArray.at(CSSPrimitiveValue::UnitTypeViewportHeight) * viewpo rtHeight / 100.0;
46 ASSERT_EQ(value, length); 46 ASSERT_EQ(value, length);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 124 }
125 125
126 for (unsigned i = 0; testCases[i].input; ++i) { 126 for (unsigned i = 0; testCases[i].input; ++i) {
127 if (testCases[i].dontRunInCSSCalc) 127 if (testCases[i].dontRunInCSSCalc)
128 continue; 128 continue;
129 verifyCSSCalc(testCases[i].input, testCases[i].output, testCases[i].vali d, data.defaultFontSize, data.viewportWidth, data.viewportHeight); 129 verifyCSSCalc(testCases[i].input, testCases[i].output, testCases[i].vali d, data.defaultFontSize, data.viewportWidth, data.viewportHeight);
130 } 130 }
131 } 131 }
132 132
133 } // namespace 133 } // namespace
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSPropertyParserTest.cpp ('k') | Source/core/css/resolver/ElementStyleResources.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698