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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/TransformBuilder.cpp

Issue 2758153002: calc() should not take Relative unit in transform-function of setMatrixValue() (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 100 }
101 } 101 }
102 102
103 bool TransformBuilder::hasRelativeLengths(const CSSValueList& valueList) { 103 bool TransformBuilder::hasRelativeLengths(const CSSValueList& valueList) {
104 for (auto& value : valueList) { 104 for (auto& value : valueList) {
105 const CSSFunctionValue* transformValue = toCSSFunctionValue(value.get()); 105 const CSSFunctionValue* transformValue = toCSSFunctionValue(value.get());
106 106
107 for (const CSSValue* item : *transformValue) { 107 for (const CSSValue* item : *transformValue) {
108 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(*item); 108 const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(*item);
109 109
110 // TODO(hs1217.lee) : to prevent relative unit like calc(10px + 1em).
111 // but when calc() not take parameter of ralative unit like calc(1px +1
112 // px),
113 // shoud be return false;
114 if (primitiveValue.isCalculated()) { 110 if (primitiveValue.isCalculated()) {
115 return true; 111 CSSCalcValue* cssCalcValue = primitiveValue.cssCalcValue();
112 CSSPrimitiveValue::UnitType resolvedType =
113 cssCalcValue->expressionNode()->typeWithCalcResolved();
114 if (CSSPrimitiveValue::isRelativeUnit(resolvedType) ||
115 resolvedType == CSSPrimitiveValue::UnitType::Unknown) {
alancutter (OOO until 2018) 2017/03/20 00:56:19 Add test coverage for non-px non-relative lengths
Hwanseung Lee 2017/03/20 14:10:06 Done.
116 return true;
117 }
116 } 118 }
117 119
118 if (CSSPrimitiveValue::isRelativeUnit( 120 if (CSSPrimitiveValue::isRelativeUnit(
119 primitiveValue.typeWithCalcResolved())) { 121 primitiveValue.typeWithCalcResolved())) {
120 return true; 122 return true;
121 } 123 }
122 } 124 }
123 } 125 }
124 return false; 126 return false;
125 } 127 }
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 } 337 }
336 default: 338 default:
337 ASSERT_NOT_REACHED(); 339 ASSERT_NOT_REACHED();
338 break; 340 break;
339 } 341 }
340 } 342 }
341 return operations; 343 return operations;
342 } 344 }
343 345
344 } // namespace blink 346 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698