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

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

Issue 2461603003: CSS Motion Path: Place offset-anchor on the path (Closed)
Patch Set: rebase Created 4 years, 1 month 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 8ca1a83167e409a6a83a66c913c9cad7ca06b06d..10aa6df78fc240a6ffca850be4fb234be7119956 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp
@@ -1346,7 +1346,7 @@ void ComputedStyle::applyTransform(
}
if (applyMotionPath == IncludeMotionPath)
- applyMotionPathTransform(originX, originY, result);
+ applyMotionPathTransform(originX, originY, boundingBox, result);
for (const auto& operation : transform().operations())
operation->apply(result, boxSize);
@@ -1359,11 +1359,11 @@ void ComputedStyle::applyTransform(
void ComputedStyle::applyMotionPathTransform(
float originX,
float originY,
+ const FloatRect& boundingBox,
TransformationMatrix& transform) const {
const StyleMotionData& motionData =
m_rareNonInheritedData->m_transform->m_motion;
- // TODO(ericwilligers): crbug.com/638055 Apply offset-position and
- // offset-anchor.
+ // TODO(ericwilligers): crbug.com/638055 Apply offset-position.
if (!motionData.m_path) {
return;
}
@@ -1386,8 +1386,25 @@ void ComputedStyle::applyMotionPathTransform(
if (motionData.m_rotation.type == OffsetRotationFixed)
angle = 0;
- transform.translate(point.x() - originX, point.y() - originY);
+ float originShiftX = 0;
+ float originShiftY = 0;
+ if (RuntimeEnabledFeatures::cssOffsetPositionAnchorEnabled()) {
+ // TODO(ericwilligers): crbug.com/638055 Support offset-anchor: auto.
+ const LengthPoint& anchor = offsetAnchor();
+ originShiftX = floatValueForLength(anchor.x(), boundingBox.width()) -
+ floatValueForLength(transformOriginX(), boundingBox.width());
+ originShiftY =
+ floatValueForLength(anchor.y(), boundingBox.height()) -
+ floatValueForLength(transformOriginY(), boundingBox.height());
+ }
+
+ transform.translate(point.x() - originX + originShiftX,
+ point.y() - originY + originShiftY);
transform.rotate(angle + motionData.m_rotation.angle);
+
+ if (RuntimeEnabledFeatures::cssOffsetPositionAnchorEnabled()) {
+ 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