| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) | 2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights |
| 4 * reserved. | 4 * reserved. |
| 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. | 5 * Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 float originX, | 1369 float originX, |
| 1370 float originY, | 1370 float originY, |
| 1371 const FloatRect& boundingBox, | 1371 const FloatRect& boundingBox, |
| 1372 TransformationMatrix& transform) const { | 1372 TransformationMatrix& transform) const { |
| 1373 const StyleMotionData& motionData = | 1373 const StyleMotionData& motionData = |
| 1374 m_rareNonInheritedData->m_transform->m_motion; | 1374 m_rareNonInheritedData->m_transform->m_motion; |
| 1375 // TODO(ericwilligers): crbug.com/638055 Apply offset-position. | 1375 // TODO(ericwilligers): crbug.com/638055 Apply offset-position. |
| 1376 if (!motionData.m_path) { | 1376 if (!motionData.m_path) { |
| 1377 return; | 1377 return; |
| 1378 } | 1378 } |
| 1379 const LengthPoint& position = offsetPosition(); |
| 1380 const LengthPoint& anchor = offsetAnchor(); |
| 1379 const StylePath& motionPath = *motionData.m_path; | 1381 const StylePath& motionPath = *motionData.m_path; |
| 1380 float pathLength = motionPath.length(); | 1382 float pathLength = motionPath.length(); |
| 1381 float distance = floatValueForLength(motionData.m_distance, pathLength); | 1383 float distance = floatValueForLength(motionData.m_distance, pathLength); |
| 1382 float computedDistance; | 1384 float computedDistance; |
| 1383 if (motionPath.isClosed() && pathLength > 0) { | 1385 if (motionPath.isClosed() && pathLength > 0) { |
| 1384 computedDistance = fmod(distance, pathLength); | 1386 computedDistance = fmod(distance, pathLength); |
| 1385 if (computedDistance < 0) | 1387 if (computedDistance < 0) |
| 1386 computedDistance += pathLength; | 1388 computedDistance += pathLength; |
| 1387 } else { | 1389 } else { |
| 1388 computedDistance = clampTo<float>(distance, 0, pathLength); | 1390 computedDistance = clampTo<float>(distance, 0, pathLength); |
| 1389 } | 1391 } |
| 1390 | 1392 |
| 1391 FloatPoint point; | 1393 FloatPoint point; |
| 1392 float angle; | 1394 float angle; |
| 1393 motionPath.path().pointAndNormalAtLength(computedDistance, point, angle); | 1395 motionPath.path().pointAndNormalAtLength(computedDistance, point, angle); |
| 1394 | 1396 |
| 1395 if (motionData.m_rotation.type == OffsetRotationFixed) | 1397 if (motionData.m_rotation.type == OffsetRotationFixed) |
| 1396 angle = 0; | 1398 angle = 0; |
| 1397 | 1399 |
| 1398 float originShiftX = 0; | 1400 float originShiftX = 0; |
| 1399 float originShiftY = 0; | 1401 float originShiftY = 0; |
| 1400 if (RuntimeEnabledFeatures::cssOffsetPositionAnchorEnabled()) { | 1402 // If offset-Position and offset-anchor properties are not yet enabled, |
| 1401 // TODO(ericwilligers): crbug.com/638055 Support offset-anchor: auto. | 1403 // they will have the default value, auto. |
| 1402 const LengthPoint& anchor = offsetAnchor(); | 1404 if (position.x() != Length(Auto) || anchor.x() != Length(Auto)) { |
| 1405 // Shift the origin from transform-origin to offset-anchor. |
| 1403 originShiftX = floatValueForLength(anchor.x(), boundingBox.width()) - | 1406 originShiftX = floatValueForLength(anchor.x(), boundingBox.width()) - |
| 1404 floatValueForLength(transformOriginX(), boundingBox.width()); | 1407 floatValueForLength(transformOriginX(), boundingBox.width()); |
| 1405 originShiftY = | 1408 originShiftY = |
| 1406 floatValueForLength(anchor.y(), boundingBox.height()) - | 1409 floatValueForLength(anchor.y(), boundingBox.height()) - |
| 1407 floatValueForLength(transformOriginY(), boundingBox.height()); | 1410 floatValueForLength(transformOriginY(), boundingBox.height()); |
| 1408 } | 1411 } |
| 1409 | 1412 |
| 1410 transform.translate(point.x() - originX + originShiftX, | 1413 transform.translate(point.x() - originX + originShiftX, |
| 1411 point.y() - originY + originShiftY); | 1414 point.y() - originY + originShiftY); |
| 1412 transform.rotate(angle + motionData.m_rotation.angle); | 1415 transform.rotate(angle + motionData.m_rotation.angle); |
| 1413 | 1416 |
| 1414 if (RuntimeEnabledFeatures::cssOffsetPositionAnchorEnabled()) { | 1417 if (position.x() != Length(Auto) || anchor.x() != Length(Auto)) |
| 1418 // Shift the origin back to transform-origin. |
| 1415 transform.translate(-originShiftX, -originShiftY); | 1419 transform.translate(-originShiftX, -originShiftY); |
| 1416 } | |
| 1417 } | 1420 } |
| 1418 | 1421 |
| 1419 void ComputedStyle::setTextShadow(PassRefPtr<ShadowList> s) { | 1422 void ComputedStyle::setTextShadow(PassRefPtr<ShadowList> s) { |
| 1420 m_rareInheritedData.access()->textShadow = s; | 1423 m_rareInheritedData.access()->textShadow = s; |
| 1421 } | 1424 } |
| 1422 | 1425 |
| 1423 void ComputedStyle::setBoxShadow(PassRefPtr<ShadowList> s) { | 1426 void ComputedStyle::setBoxShadow(PassRefPtr<ShadowList> s) { |
| 1424 m_rareNonInheritedData.access()->m_boxShadow = s; | 1427 m_rareNonInheritedData.access()->m_boxShadow = s; |
| 1425 } | 1428 } |
| 1426 | 1429 |
| (...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2462 if (value < 0) | 2465 if (value < 0) |
| 2463 fvalue -= 0.5f; | 2466 fvalue -= 0.5f; |
| 2464 else | 2467 else |
| 2465 fvalue += 0.5f; | 2468 fvalue += 0.5f; |
| 2466 } | 2469 } |
| 2467 | 2470 |
| 2468 return roundForImpreciseConversion<int>(fvalue / zoomFactor); | 2471 return roundForImpreciseConversion<int>(fvalue / zoomFactor); |
| 2469 } | 2472 } |
| 2470 | 2473 |
| 2471 } // namespace blink | 2474 } // namespace blink |
| OLD | NEW |