OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> | 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. |
4 * All rights reserved. | 4 * All rights reserved. |
5 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 5 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
7 * Copyright (C) 2011 Sencha, Inc. All rights reserved. | 7 * Copyright (C) 2011 Sencha, Inc. All rights reserved. |
8 * Copyright (C) 2015 Google Inc. All rights reserved. | 8 * Copyright (C) 2015 Google Inc. All rights reserved. |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 83 } |
84 | 84 |
85 inline static CSSValue* zoomAdjustedPixelValueOrAuto( | 85 inline static CSSValue* zoomAdjustedPixelValueOrAuto( |
86 const Length& length, | 86 const Length& length, |
87 const ComputedStyle& style) { | 87 const ComputedStyle& style) { |
88 if (length.isAuto()) | 88 if (length.isAuto()) |
89 return CSSIdentifierValue::create(CSSValueAuto); | 89 return CSSIdentifierValue::create(CSSValueAuto); |
90 return zoomAdjustedPixelValue(length.value(), style); | 90 return zoomAdjustedPixelValue(length.value(), style); |
91 } | 91 } |
92 | 92 |
93 inline static CSSPrimitiveValue* zoomAdjustedNumberValue( | |
94 double value, | |
95 const ComputedStyle& style) { | |
96 return CSSPrimitiveValue::create(value / style.effectiveZoom(), | |
97 CSSPrimitiveValue::UnitType::Number); | |
98 } | |
99 | |
100 static CSSValue* zoomAdjustedPixelValueForLength(const Length& length, | 93 static CSSValue* zoomAdjustedPixelValueForLength(const Length& length, |
101 const ComputedStyle& style) { | 94 const ComputedStyle& style) { |
102 if (length.isFixed()) | 95 if (length.isFixed()) |
103 return zoomAdjustedPixelValue(length.value(), style); | 96 return zoomAdjustedPixelValue(length.value(), style); |
104 return CSSValue::create(length, style.effectiveZoom()); | 97 return CSSValue::create(length, style.effectiveZoom()); |
105 } | 98 } |
106 | 99 |
107 static CSSValue* pixelValueForUnzoomedLength( | 100 static CSSValue* pixelValueForUnzoomedLength( |
108 const UnzoomedLength& unzoomedLength, | 101 const UnzoomedLength& unzoomedLength, |
109 const ComputedStyle& style) { | 102 const ComputedStyle& style) { |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1345 } | 1338 } |
1346 | 1339 |
1347 static const CSSValue& valueForBorderRadiusCorner(LengthSize radius, | 1340 static const CSSValue& valueForBorderRadiusCorner(LengthSize radius, |
1348 const ComputedStyle& style) { | 1341 const ComputedStyle& style) { |
1349 CSSValueList& list = *valuesForBorderRadiusCorner(radius, style); | 1342 CSSValueList& list = *valuesForBorderRadiusCorner(radius, style); |
1350 if (list.item(0).equals(list.item(1))) | 1343 if (list.item(0).equals(list.item(1))) |
1351 return list.item(0); | 1344 return list.item(0); |
1352 return list; | 1345 return list; |
1353 } | 1346 } |
1354 | 1347 |
1355 static CSSFunctionValue* valueForMatrixTransform( | 1348 static CSSFunctionValue* valueForMatrixTransform(TransformationMatrix transform, |
1356 const TransformationMatrix& transform, | 1349 const ComputedStyle& style) { |
1357 const ComputedStyle& style) { | |
1358 CSSFunctionValue* transformValue = nullptr; | 1350 CSSFunctionValue* transformValue = nullptr; |
| 1351 transform.zoom(1 / style.effectiveZoom()); |
1359 if (transform.isAffine()) { | 1352 if (transform.isAffine()) { |
1360 transformValue = CSSFunctionValue::create(CSSValueMatrix); | 1353 transformValue = CSSFunctionValue::create(CSSValueMatrix); |
1361 | 1354 |
1362 transformValue->append(*CSSPrimitiveValue::create( | 1355 transformValue->append(*CSSPrimitiveValue::create( |
1363 transform.a(), CSSPrimitiveValue::UnitType::Number)); | 1356 transform.a(), CSSPrimitiveValue::UnitType::Number)); |
1364 transformValue->append(*CSSPrimitiveValue::create( | 1357 transformValue->append(*CSSPrimitiveValue::create( |
1365 transform.b(), CSSPrimitiveValue::UnitType::Number)); | 1358 transform.b(), CSSPrimitiveValue::UnitType::Number)); |
1366 transformValue->append(*CSSPrimitiveValue::create( | 1359 transformValue->append(*CSSPrimitiveValue::create( |
1367 transform.c(), CSSPrimitiveValue::UnitType::Number)); | 1360 transform.c(), CSSPrimitiveValue::UnitType::Number)); |
1368 transformValue->append(*CSSPrimitiveValue::create( | 1361 transformValue->append(*CSSPrimitiveValue::create( |
1369 transform.d(), CSSPrimitiveValue::UnitType::Number)); | 1362 transform.d(), CSSPrimitiveValue::UnitType::Number)); |
1370 transformValue->append(*zoomAdjustedNumberValue(transform.e(), style)); | 1363 transformValue->append(*CSSPrimitiveValue::create( |
1371 transformValue->append(*zoomAdjustedNumberValue(transform.f(), style)); | 1364 transform.e(), CSSPrimitiveValue::UnitType::Number)); |
| 1365 transformValue->append(*CSSPrimitiveValue::create( |
| 1366 transform.f(), CSSPrimitiveValue::UnitType::Number)); |
1372 } else { | 1367 } else { |
1373 transformValue = CSSFunctionValue::create(CSSValueMatrix3d); | 1368 transformValue = CSSFunctionValue::create(CSSValueMatrix3d); |
1374 | 1369 |
1375 transformValue->append(*CSSPrimitiveValue::create( | 1370 transformValue->append(*CSSPrimitiveValue::create( |
1376 transform.m11(), CSSPrimitiveValue::UnitType::Number)); | 1371 transform.m11(), CSSPrimitiveValue::UnitType::Number)); |
1377 transformValue->append(*CSSPrimitiveValue::create( | 1372 transformValue->append(*CSSPrimitiveValue::create( |
1378 transform.m12(), CSSPrimitiveValue::UnitType::Number)); | 1373 transform.m12(), CSSPrimitiveValue::UnitType::Number)); |
1379 transformValue->append(*CSSPrimitiveValue::create( | 1374 transformValue->append(*CSSPrimitiveValue::create( |
1380 transform.m13(), CSSPrimitiveValue::UnitType::Number)); | 1375 transform.m13(), CSSPrimitiveValue::UnitType::Number)); |
1381 transformValue->append(*CSSPrimitiveValue::create( | 1376 transformValue->append(*CSSPrimitiveValue::create( |
(...skipping 10 matching lines...) Expand all Loading... |
1392 | 1387 |
1393 transformValue->append(*CSSPrimitiveValue::create( | 1388 transformValue->append(*CSSPrimitiveValue::create( |
1394 transform.m31(), CSSPrimitiveValue::UnitType::Number)); | 1389 transform.m31(), CSSPrimitiveValue::UnitType::Number)); |
1395 transformValue->append(*CSSPrimitiveValue::create( | 1390 transformValue->append(*CSSPrimitiveValue::create( |
1396 transform.m32(), CSSPrimitiveValue::UnitType::Number)); | 1391 transform.m32(), CSSPrimitiveValue::UnitType::Number)); |
1397 transformValue->append(*CSSPrimitiveValue::create( | 1392 transformValue->append(*CSSPrimitiveValue::create( |
1398 transform.m33(), CSSPrimitiveValue::UnitType::Number)); | 1393 transform.m33(), CSSPrimitiveValue::UnitType::Number)); |
1399 transformValue->append(*CSSPrimitiveValue::create( | 1394 transformValue->append(*CSSPrimitiveValue::create( |
1400 transform.m34(), CSSPrimitiveValue::UnitType::Number)); | 1395 transform.m34(), CSSPrimitiveValue::UnitType::Number)); |
1401 | 1396 |
1402 transformValue->append(*zoomAdjustedNumberValue(transform.m41(), style)); | 1397 transformValue->append(*CSSPrimitiveValue::create( |
1403 transformValue->append(*zoomAdjustedNumberValue(transform.m42(), style)); | 1398 transform.m41(), CSSPrimitiveValue::UnitType::Number)); |
1404 transformValue->append(*zoomAdjustedNumberValue(transform.m43(), style)); | 1399 transformValue->append(*CSSPrimitiveValue::create( |
| 1400 transform.m42(), CSSPrimitiveValue::UnitType::Number)); |
| 1401 transformValue->append(*CSSPrimitiveValue::create( |
| 1402 transform.m43(), CSSPrimitiveValue::UnitType::Number)); |
1405 transformValue->append(*CSSPrimitiveValue::create( | 1403 transformValue->append(*CSSPrimitiveValue::create( |
1406 transform.m44(), CSSPrimitiveValue::UnitType::Number)); | 1404 transform.m44(), CSSPrimitiveValue::UnitType::Number)); |
1407 } | 1405 } |
1408 | 1406 |
1409 return transformValue; | 1407 return transformValue; |
1410 } | 1408 } |
1411 | 1409 |
1412 static CSSValue* computedTransform(const LayoutObject* layoutObject, | 1410 static CSSValue* computedTransform(const LayoutObject* layoutObject, |
1413 const ComputedStyle& style) { | 1411 const ComputedStyle& style) { |
1414 if (!layoutObject || !style.hasTransform()) | 1412 if (!layoutObject || !style.hasTransform()) |
(...skipping 2204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3619 case CSSPropertyAll: | 3617 case CSSPropertyAll: |
3620 return nullptr; | 3618 return nullptr; |
3621 default: | 3619 default: |
3622 break; | 3620 break; |
3623 } | 3621 } |
3624 ASSERT_NOT_REACHED(); | 3622 ASSERT_NOT_REACHED(); |
3625 return nullptr; | 3623 return nullptr; |
3626 } | 3624 } |
3627 | 3625 |
3628 } // namespace blink | 3626 } // namespace blink |
OLD | NEW |