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

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

Issue 64293008: Wrap CSS length conversion arguments in an object (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: don't make it noncopyable ; clang doesn't do the RVO stuffs? 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
« no previous file with comments | « Source/core/css/CSSCalculationValue.cpp ('k') | Source/core/css/CSSGradientValue.h » ('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 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/css/CSSCalculationValue.h" 32 #include "core/css/CSSCalculationValue.h"
33 33
34 #include "core/css/CSSPrimitiveValue.h" 34 #include "core/css/CSSPrimitiveValue.h"
35 #include "core/css/CSSToLengthConversionData.h"
35 #include "core/rendering/style/RenderStyle.h" 36 #include "core/rendering/style/RenderStyle.h"
36 #include "core/rendering/style/StyleInheritedData.h" 37 #include "core/rendering/style/StyleInheritedData.h"
37 38
38 #include <gtest/gtest.h> 39 #include <gtest/gtest.h>
39 40
40 using namespace WebCore; 41 using namespace WebCore;
41 42
42 namespace { 43 namespace {
43 44
44 void testExpression(PassRefPtr<CSSCalcExpressionNode> expression, const RenderSt yle* style) 45 void testExpression(PassRefPtr<CSSCalcExpressionNode> expression, const RenderSt yle* style)
45 { 46 {
46 EXPECT_TRUE( 47 EXPECT_TRUE(
47 expression->equals( 48 expression->equals(
48 *CSSCalcValue::createExpressionNode( 49 *CSSCalcValue::createExpressionNode(
49 expression->toCalcValue(style, style, style->effectiveZoom()).ge t(), 50 expression->toCalcValue(CSSToLengthConversionData(style, style)) .get(),
50 style->effectiveZoom()).get())); 51 style->effectiveZoom()).get()));
51 } 52 }
52 53
53 TEST(CSSCalculationValue, CreateExpressionNodeFromLength) 54 TEST(CSSCalculationValue, CreateExpressionNodeFromLength)
54 { 55 {
55 RefPtr<RenderStyle> style = RenderStyle::create(); 56 RefPtr<RenderStyle> style = RenderStyle::create();
56 RefPtr<CSSCalcExpressionNode> expected; 57 RefPtr<CSSCalcExpressionNode> expected;
57 RefPtr<CSSCalcExpressionNode> actual; 58 RefPtr<CSSCalcExpressionNode> actual;
58 59
59 expected = CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_PX), true); 60 expected = CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(10, CSSPrimitiveValue::CSS_PX), true);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 CalcMultiply), 139 CalcMultiply),
139 CSSCalcValue::createExpressionNode( 140 CSSCalcValue::createExpressionNode(
140 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(60, CSSPrimitiveValue::CSS_PX), true), 141 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(60, CSSPrimitiveValue::CSS_PX), true),
141 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(0.7 5, CSSPrimitiveValue::CSS_NUMBER), false), 142 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(0.7 5, CSSPrimitiveValue::CSS_NUMBER), false),
142 CalcMultiply), 143 CalcMultiply),
143 CalcAdd), 144 CalcAdd),
144 style.get()); 145 style.get());
145 } 146 }
146 147
147 } 148 }
OLDNEW
« no previous file with comments | « Source/core/css/CSSCalculationValue.cpp ('k') | Source/core/css/CSSGradientValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698