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

Side by Side Diff: Source/core/css/CSSCalculationValueTest.cpp

Issue 1320013005: Make CSSParserMode parameter not optional for MutableStylePropertySet::create() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased 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
« no previous file with comments | « Source/core/animation/StringKeyframe.h ('k') | Source/core/css/DOMWindowCSS.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 void initLengthArray(CSSLengthArray& lengthArray) 61 void initLengthArray(CSSLengthArray& lengthArray)
62 { 62 {
63 lengthArray.resize(CSSPrimitiveValue::LengthUnitTypeCount); 63 lengthArray.resize(CSSPrimitiveValue::LengthUnitTypeCount);
64 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) 64 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i)
65 lengthArray.at(i) = 0; 65 lengthArray.at(i) = 0;
66 } 66 }
67 67
68 CSSLengthArray& setLengthArray(CSSLengthArray& lengthArray, String text) 68 CSSLengthArray& setLengthArray(CSSLengthArray& lengthArray, String text)
69 { 69 {
70 initLengthArray(lengthArray); 70 initLengthArray(lengthArray);
71 RefPtrWillBeRawPtr<MutableStylePropertySet> propertySet = MutableStyleProper tySet::create(); 71 RefPtrWillBeRawPtr<MutableStylePropertySet> propertySet = MutableStyleProper tySet::create(HTMLQuirksMode);
72 propertySet->setProperty(CSSPropertyLeft, text); 72 propertySet->setProperty(CSSPropertyLeft, text);
73 toCSSPrimitiveValue(propertySet->getPropertyCSSValue(CSSPropertyLeft).get()) ->accumulateLengthArray(lengthArray); 73 toCSSPrimitiveValue(propertySet->getPropertyCSSValue(CSSPropertyLeft).get()) ->accumulateLengthArray(lengthArray);
74 return lengthArray; 74 return lengthArray;
75 } 75 }
76 76
77 bool lengthArraysEqual(CSSLengthArray& a, CSSLengthArray& b) 77 bool lengthArraysEqual(CSSLengthArray& a, CSSLengthArray& b)
78 { 78 {
79 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) { 79 for (size_t i = 0; i < CSSPrimitiveValue::LengthUnitTypeCount; ++i) {
80 if (a.at(i) != b.at(i)) 80 if (a.at(i) != b.at(i))
81 return false; 81 return false;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 187
188 expectation.at(CSSPrimitiveValue::UnitTypePixels) = 15; 188 expectation.at(CSSPrimitiveValue::UnitTypePixels) = 15;
189 expectation.at(CSSPrimitiveValue::UnitTypeFontSize) = 20; 189 expectation.at(CSSPrimitiveValue::UnitTypeFontSize) = 20;
190 expectation.at(CSSPrimitiveValue::UnitTypePercentage) = -40; 190 expectation.at(CSSPrimitiveValue::UnitTypePercentage) = -40;
191 EXPECT_TRUE(lengthArraysEqual(expectation, setLengthArray(actual, "calc((1 * 2) * (5px + 20em / 2) - 80% / (3 - 1) + 5px)"))); 191 EXPECT_TRUE(lengthArraysEqual(expectation, setLengthArray(actual, "calc((1 * 2) * (5px + 20em / 2) - 80% / (3 - 1) + 5px)")));
192 } 192 }
193 193
194 } // anonymous namespace 194 } // anonymous namespace
195 195
196 } // namespace blink 196 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/animation/StringKeyframe.h ('k') | Source/core/css/DOMWindowCSS.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698