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

Unified Diff: third_party/WebKit/Source/core/style/ComputedStyle.cpp

Issue 2527303002: CSS Motion Path: offset-anchor should default to auto (Closed)
Patch Set: comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/style/ComputedStyle.h ('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/style/ComputedStyle.cpp
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.cpp b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
index a83f2f2f56f4c9d035a0d680131a294630494cf4..816a0f8a8bbb5cd717bc06174c7475d0f84f0de6 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -1376,6 +1376,8 @@ void ComputedStyle::applyMotionPathTransform(
if (!motionData.m_path) {
return;
}
+ const LengthPoint& position = offsetPosition();
+ const LengthPoint& anchor = offsetAnchor();
const StylePath& motionPath = *motionData.m_path;
float pathLength = motionPath.length();
float distance = floatValueForLength(motionData.m_distance, pathLength);
@@ -1397,9 +1399,10 @@ void ComputedStyle::applyMotionPathTransform(
float originShiftX = 0;
float originShiftY = 0;
- if (RuntimeEnabledFeatures::cssOffsetPositionAnchorEnabled()) {
- // TODO(ericwilligers): crbug.com/638055 Support offset-anchor: auto.
- const LengthPoint& anchor = offsetAnchor();
+ // If offset-Position and offset-anchor properties are not yet enabled,
+ // they will have the default value, auto.
+ if (position.x() != Length(Auto) || anchor.x() != Length(Auto)) {
+ // Shift the origin from transform-origin to offset-anchor.
originShiftX = floatValueForLength(anchor.x(), boundingBox.width()) -
floatValueForLength(transformOriginX(), boundingBox.width());
originShiftY =
@@ -1411,9 +1414,9 @@ void ComputedStyle::applyMotionPathTransform(
point.y() - originY + originShiftY);
transform.rotate(angle + motionData.m_rotation.angle);
- if (RuntimeEnabledFeatures::cssOffsetPositionAnchorEnabled()) {
+ if (position.x() != Length(Auto) || anchor.x() != Length(Auto))
+ // Shift the origin back to transform-origin.
transform.translate(-originShiftX, -originShiftY);
- }
}
void ComputedStyle::setTextShadow(PassRefPtr<ShadowList> s) {
« 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