OLD | NEW |
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 29 matching lines...) Expand all Loading... |
40 | 40 |
41 using namespace WebCore; | 41 using namespace WebCore; |
42 | 42 |
43 namespace { | 43 namespace { |
44 | 44 |
45 void testExpression(PassRefPtr<CSSCalcExpressionNode> expression, const RenderSt
yle* style) | 45 void testExpression(PassRefPtr<CSSCalcExpressionNode> expression, const RenderSt
yle* style) |
46 { | 46 { |
47 EXPECT_TRUE( | 47 EXPECT_TRUE( |
48 expression->equals( | 48 expression->equals( |
49 *CSSCalcValue::createExpressionNode( | 49 *CSSCalcValue::createExpressionNode( |
50 expression->toCalcValue(CSSToLengthConversionData(style, style))
.get(), | 50 expression->toCalcValue(CSSToLengthConversionData(style, style,
0)).get(), |
51 style->effectiveZoom()).get())); | 51 style->effectiveZoom()).get())); |
52 } | 52 } |
53 | 53 |
54 TEST(CSSCalculationValue, CreateExpressionNodeFromLength) | 54 TEST(CSSCalculationValue, CreateExpressionNodeFromLength) |
55 { | 55 { |
56 RefPtr<RenderStyle> style = RenderStyle::create(); | 56 RefPtr<RenderStyle> style = RenderStyle::create(); |
57 RefPtr<CSSCalcExpressionNode> expected; | 57 RefPtr<CSSCalcExpressionNode> expected; |
58 RefPtr<CSSCalcExpressionNode> actual; | 58 RefPtr<CSSCalcExpressionNode> actual; |
59 | 59 |
60 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 Loading... |
139 CalcMultiply), | 139 CalcMultiply), |
140 CSSCalcValue::createExpressionNode( | 140 CSSCalcValue::createExpressionNode( |
141 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(60,
CSSPrimitiveValue::CSS_PX), true), | 141 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(60,
CSSPrimitiveValue::CSS_PX), true), |
142 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(0.7
5, CSSPrimitiveValue::CSS_NUMBER), false), | 142 CSSCalcValue::createExpressionNode(CSSPrimitiveValue::create(0.7
5, CSSPrimitiveValue::CSS_NUMBER), false), |
143 CalcMultiply), | 143 CalcMultiply), |
144 CalcAdd), | 144 CalcAdd), |
145 style.get()); | 145 style.get()); |
146 } | 146 } |
147 | 147 |
148 } | 148 } |
OLD | NEW |