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

Side by Side Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2527303002: CSS Motion Path: offset-anchor should default to auto (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 float originX, 1361 float originX,
1362 float originY, 1362 float originY,
1363 const FloatRect& boundingBox, 1363 const FloatRect& boundingBox,
1364 TransformationMatrix& transform) const { 1364 TransformationMatrix& transform) const {
1365 const StyleMotionData& motionData = 1365 const StyleMotionData& motionData =
1366 m_rareNonInheritedData->m_transform->m_motion; 1366 m_rareNonInheritedData->m_transform->m_motion;
1367 // TODO(ericwilligers): crbug.com/638055 Apply offset-position. 1367 // TODO(ericwilligers): crbug.com/638055 Apply offset-position.
1368 if (!motionData.m_path) { 1368 if (!motionData.m_path) {
1369 return; 1369 return;
1370 } 1370 }
1371 const LengthPoint& position = offsetPosition();
1372 const LengthPoint& anchor = offsetAnchor();
1371 const StylePath& motionPath = *motionData.m_path; 1373 const StylePath& motionPath = *motionData.m_path;
1372 float pathLength = motionPath.length(); 1374 float pathLength = motionPath.length();
1373 float distance = floatValueForLength(motionData.m_distance, pathLength); 1375 float distance = floatValueForLength(motionData.m_distance, pathLength);
1374 float computedDistance; 1376 float computedDistance;
1375 if (motionPath.isClosed() && pathLength > 0) { 1377 if (motionPath.isClosed() && pathLength > 0) {
1376 computedDistance = fmod(distance, pathLength); 1378 computedDistance = fmod(distance, pathLength);
1377 if (computedDistance < 0) 1379 if (computedDistance < 0)
1378 computedDistance += pathLength; 1380 computedDistance += pathLength;
1379 } else { 1381 } else {
1380 computedDistance = clampTo<float>(distance, 0, pathLength); 1382 computedDistance = clampTo<float>(distance, 0, pathLength);
1381 } 1383 }
1382 1384
1383 FloatPoint point; 1385 FloatPoint point;
1384 float angle; 1386 float angle;
1385 motionPath.path().pointAndNormalAtLength(computedDistance, point, angle); 1387 motionPath.path().pointAndNormalAtLength(computedDistance, point, angle);
1386 1388
1387 if (motionData.m_rotation.type == OffsetRotationFixed) 1389 if (motionData.m_rotation.type == OffsetRotationFixed)
1388 angle = 0; 1390 angle = 0;
1389 1391
1390 float originShiftX = 0; 1392 float originShiftX = 0;
1391 float originShiftY = 0; 1393 float originShiftY = 0;
1392 if (RuntimeEnabledFeatures::cssOffsetPositionAnchorEnabled()) { 1394 if (position.x() != Length(Auto) || anchor.x() != Length(Auto)) {
sashab 2016/12/12 01:11:26 You removed a runtime enabled feature flag? Please
Eric Willigers 2016/12/12 01:57:14 comments added
1393 // TODO(ericwilligers): crbug.com/638055 Support offset-anchor: auto.
1394 const LengthPoint& anchor = offsetAnchor();
1395 originShiftX = floatValueForLength(anchor.x(), boundingBox.width()) - 1395 originShiftX = floatValueForLength(anchor.x(), boundingBox.width()) -
1396 floatValueForLength(transformOriginX(), boundingBox.width()); 1396 floatValueForLength(transformOriginX(), boundingBox.width());
1397 originShiftY = 1397 originShiftY =
1398 floatValueForLength(anchor.y(), boundingBox.height()) - 1398 floatValueForLength(anchor.y(), boundingBox.height()) -
1399 floatValueForLength(transformOriginY(), boundingBox.height()); 1399 floatValueForLength(transformOriginY(), boundingBox.height());
1400 } 1400 }
1401 1401
1402 transform.translate(point.x() - originX + originShiftX, 1402 transform.translate(point.x() - originX + originShiftX,
1403 point.y() - originY + originShiftY); 1403 point.y() - originY + originShiftY);
1404 transform.rotate(angle + motionData.m_rotation.angle); 1404 transform.rotate(angle + motionData.m_rotation.angle);
1405 1405
1406 if (RuntimeEnabledFeatures::cssOffsetPositionAnchorEnabled()) { 1406 if (position.x() != Length(Auto) || anchor.x() != Length(Auto))
sashab 2016/12/12 01:11:26 Why only x() and not y()?
Eric Willigers 2016/12/12 01:57:14 position and anchor are <position> | auto i.e. ei
1407 transform.translate(-originShiftX, -originShiftY); 1407 transform.translate(-originShiftX, -originShiftY);
1408 }
1409 } 1408 }
1410 1409
1411 void ComputedStyle::setTextShadow(PassRefPtr<ShadowList> s) { 1410 void ComputedStyle::setTextShadow(PassRefPtr<ShadowList> s) {
1412 m_rareInheritedData.access()->textShadow = s; 1411 m_rareInheritedData.access()->textShadow = s;
1413 } 1412 }
1414 1413
1415 void ComputedStyle::setBoxShadow(PassRefPtr<ShadowList> s) { 1414 void ComputedStyle::setBoxShadow(PassRefPtr<ShadowList> s) {
1416 m_rareNonInheritedData.access()->m_boxShadow = s; 1415 m_rareNonInheritedData.access()->m_boxShadow = s;
1417 } 1416 }
1418 1417
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after
2446 if (value < 0) 2445 if (value < 0)
2447 fvalue -= 0.5f; 2446 fvalue -= 0.5f;
2448 else 2447 else
2449 fvalue += 0.5f; 2448 fvalue += 0.5f;
2450 } 2449 }
2451 2450
2452 return roundForImpreciseConversion<int>(fvalue / zoomFactor); 2451 return roundForImpreciseConversion<int>(fvalue / zoomFactor);
2453 } 2452 }
2454 2453
2455 } // namespace blink 2454 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698