| 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 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 translate()->apply(result, boundingBox.size()); | 1317 translate()->apply(result, boundingBox.size()); |
| 1318 | 1318 |
| 1319 if (rotate()) | 1319 if (rotate()) |
| 1320 rotate()->apply(result, boundingBox.size()); | 1320 rotate()->apply(result, boundingBox.size()); |
| 1321 | 1321 |
| 1322 if (scale()) | 1322 if (scale()) |
| 1323 scale()->apply(result, boundingBox.size()); | 1323 scale()->apply(result, boundingBox.size()); |
| 1324 } | 1324 } |
| 1325 | 1325 |
| 1326 if (applyMotionPath == ComputedStyle::IncludeMotionPath) | 1326 if (applyMotionPath == ComputedStyle::IncludeMotionPath) |
| 1327 applyMotionPathTransform(originX, originY, result); | 1327 applyMotionPathTransform(boundingBox, result); |
| 1328 | 1328 |
| 1329 const Vector<RefPtr<TransformOperation>>& transformOperations = | 1329 const Vector<RefPtr<TransformOperation>>& transformOperations = |
| 1330 transform().operations(); | 1330 transform().operations(); |
| 1331 unsigned size = transformOperations.size(); | 1331 unsigned size = transformOperations.size(); |
| 1332 for (unsigned i = 0; i < size; ++i) | 1332 for (unsigned i = 0; i < size; ++i) |
| 1333 transformOperations[i]->apply(result, boundingBox.size()); | 1333 transformOperations[i]->apply(result, boundingBox.size()); |
| 1334 | 1334 |
| 1335 if (applyTransformOrigin) { | 1335 if (applyTransformOrigin) { |
| 1336 result.translate3d(-originX, -originY, -originZ); | 1336 result.translate3d(-originX, -originY, -originZ); |
| 1337 } | 1337 } |
| 1338 } | 1338 } |
| 1339 | 1339 |
| 1340 void ComputedStyle::applyMotionPathTransform( | 1340 void ComputedStyle::applyMotionPathTransform( |
| 1341 float originX, | 1341 const FloatRect& boundingBox, |
| 1342 float originY, | |
| 1343 TransformationMatrix& transform) const { | 1342 TransformationMatrix& transform) const { |
| 1344 const StyleMotionData& motionData = | 1343 const StyleMotionData& motionData = |
| 1345 m_rareNonInheritedData->m_transform->m_motion; | 1344 m_rareNonInheritedData->m_transform->m_motion; |
| 1346 // TODO(ericwilligers): crbug.com/638055 Apply offset-position and | 1345 // TODO(ericwilligers): crbug.com/638055 Apply offset-position. |
| 1347 // offset-anchor. | |
| 1348 if (!motionData.m_path) { | 1346 if (!motionData.m_path) { |
| 1349 return; | 1347 return; |
| 1350 } | 1348 } |
| 1351 const StylePath& motionPath = *motionData.m_path; | 1349 const StylePath& motionPath = *motionData.m_path; |
| 1352 float pathLength = motionPath.length(); | 1350 float pathLength = motionPath.length(); |
| 1353 float distance = floatValueForLength(motionData.m_distance, pathLength); | 1351 float distance = floatValueForLength(motionData.m_distance, pathLength); |
| 1354 float computedDistance; | 1352 float computedDistance; |
| 1355 if (motionPath.isClosed() && pathLength > 0) { | 1353 if (motionPath.isClosed() && pathLength > 0) { |
| 1356 computedDistance = fmod(distance, pathLength); | 1354 computedDistance = fmod(distance, pathLength); |
| 1357 if (computedDistance < 0) | 1355 if (computedDistance < 0) |
| 1358 computedDistance += pathLength; | 1356 computedDistance += pathLength; |
| 1359 } else { | 1357 } else { |
| 1360 computedDistance = clampTo<float>(distance, 0, pathLength); | 1358 computedDistance = clampTo<float>(distance, 0, pathLength); |
| 1361 } | 1359 } |
| 1362 | 1360 |
| 1363 FloatPoint point; | 1361 FloatPoint point; |
| 1364 float angle; | 1362 float angle; |
| 1365 motionPath.path().pointAndNormalAtLength(computedDistance, point, angle); | 1363 motionPath.path().pointAndNormalAtLength(computedDistance, point, angle); |
| 1366 | 1364 |
| 1367 if (motionData.m_rotation.type == OffsetRotationFixed) | 1365 if (motionData.m_rotation.type == OffsetRotationFixed) |
| 1368 angle = 0; | 1366 angle = 0; |
| 1369 | 1367 |
| 1370 transform.translate(point.x() - originX, point.y() - originY); | 1368 float offsetX = transformOriginX().type() == Percent ? boundingBox.x() : 0; |
| 1369 float offsetY = transformOriginY().type() == Percent ? boundingBox.y() : 0; |
| 1370 |
| 1371 float originShiftX = 0; |
| 1372 float originShiftY = 0; |
| 1373 if (RuntimeEnabledFeatures::cssOffsetPositionAnchorEnabled()) { |
| 1374 const LengthPoint& anchor = offsetAnchor(); |
| 1375 originShiftX = floatValueForLength(anchor.x(), boundingBox.width()) - |
| 1376 floatValueForLength(transformOriginX(), boundingBox.width()); |
| 1377 originShiftY = |
| 1378 floatValueForLength(anchor.y(), boundingBox.height()) - |
| 1379 floatValueForLength(transformOriginY(), boundingBox.height()); |
| 1380 } |
| 1381 |
| 1382 transform.translate(point.x() - offsetX + originShiftX, |
| 1383 point.y() - offsetY + originShiftY); |
| 1371 transform.rotate(angle + motionData.m_rotation.angle); | 1384 transform.rotate(angle + motionData.m_rotation.angle); |
| 1385 |
| 1386 if (RuntimeEnabledFeatures::cssOffsetPositionAnchorEnabled()) { |
| 1387 transform.translate(-originShiftX, -originShiftY); |
| 1388 } |
| 1372 } | 1389 } |
| 1373 | 1390 |
| 1374 void ComputedStyle::setTextShadow(PassRefPtr<ShadowList> s) { | 1391 void ComputedStyle::setTextShadow(PassRefPtr<ShadowList> s) { |
| 1375 m_rareInheritedData.access()->textShadow = s; | 1392 m_rareInheritedData.access()->textShadow = s; |
| 1376 } | 1393 } |
| 1377 | 1394 |
| 1378 void ComputedStyle::setBoxShadow(PassRefPtr<ShadowList> s) { | 1395 void ComputedStyle::setBoxShadow(PassRefPtr<ShadowList> s) { |
| 1379 m_rareNonInheritedData.access()->m_boxShadow = s; | 1396 m_rareNonInheritedData.access()->m_boxShadow = s; |
| 1380 } | 1397 } |
| 1381 | 1398 |
| (...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2368 if (value < 0) | 2385 if (value < 0) |
| 2369 fvalue -= 0.5f; | 2386 fvalue -= 0.5f; |
| 2370 else | 2387 else |
| 2371 fvalue += 0.5f; | 2388 fvalue += 0.5f; |
| 2372 } | 2389 } |
| 2373 | 2390 |
| 2374 return roundForImpreciseConversion<int>(fvalue / zoomFactor); | 2391 return roundForImpreciseConversion<int>(fvalue / zoomFactor); |
| 2375 } | 2392 } |
| 2376 | 2393 |
| 2377 } // namespace blink | 2394 } // namespace blink |
| OLD | NEW |