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

Unified 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: add test case 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-setMatrixValue.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/resolver/TransformBuilder.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/TransformBuilder.cpp b/third_party/WebKit/Source/core/css/resolver/TransformBuilder.cpp
index ad887b340c610805921112b092eee62ed433f95b..8d7b4c46ea9a66981fece3302b8b68325f67296f 100644
--- a/third_party/WebKit/Source/core/css/resolver/TransformBuilder.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/TransformBuilder.cpp
@@ -107,12 +107,14 @@ bool TransformBuilder::hasRelativeLengths(const CSSValueList& valueList) {
for (const CSSValue* item : *transformValue) {
const CSSPrimitiveValue& primitiveValue = toCSSPrimitiveValue(*item);
- // TODO(hs1217.lee) : to prevent relative unit like calc(10px + 1em).
- // but when calc() not take parameter of ralative unit like calc(1px +1
- // px),
- // shoud be return false;
if (primitiveValue.isCalculated()) {
- return true;
+ CSSCalcValue* cssCalcValue = primitiveValue.cssCalcValue();
+ CSSPrimitiveValue::UnitType resolvedType =
+ cssCalcValue->expressionNode()->typeWithCalcResolved();
+ if (CSSPrimitiveValue::isRelativeUnit(resolvedType) ||
+ resolvedType == CSSPrimitiveValue::UnitType::Unknown) {
+ return true;
+ }
}
if (CSSPrimitiveValue::isRelativeUnit(
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-setMatrixValue.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698