Chromium Code Reviews| 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 dcaaded2cb2bb7fc24beab8c511e0551c0a2adf1..75b54b579df1e88c6ba276a8010f454e11e2f951 100644 |
| --- a/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
| +++ b/third_party/WebKit/Source/core/style/ComputedStyle.cpp |
| @@ -45,6 +45,7 @@ |
| #include "core/style/StyleInheritedData.h" |
| #include "core/style/StyleInheritedVariables.h" |
| #include "core/style/StyleNonInheritedVariables.h" |
| +#include "core/style/StyleRay.h" |
| #include "platform/LengthFunctions.h" |
| #include "platform/RuntimeEnabledFeatures.h" |
| #include "platform/fonts/Font.h" |
| @@ -1331,25 +1332,32 @@ void ComputedStyle::ApplyMotionPathTransform( |
| } |
| const LengthPoint& position = OffsetPosition(); |
| const LengthPoint& anchor = OffsetAnchor(); |
| - if (motion_data.path_->GetType() == BasicShape::kStyleRayType) { |
| - // TODO(ericwilligers): crbug.com/641245 Support ray paths. |
| - return; |
| - } |
| - const StylePath& motion_path = ToStylePath(*motion_data.path_); |
| - float path_length = motion_path.length(); |
| - float distance = FloatValueForLength(motion_data.distance_, path_length); |
| - float computed_distance; |
| - if (motion_path.IsClosed() && path_length > 0) { |
| - computed_distance = fmod(distance, path_length); |
| - if (computed_distance < 0) |
| - computed_distance += path_length; |
| - } else { |
| - computed_distance = clampTo<float>(distance, 0, path_length); |
| - } |
| FloatPoint point; |
| float angle; |
| - motion_path.GetPath().PointAndNormalAtLength(computed_distance, point, angle); |
| + if (motion_data.path_->GetType() == BasicShape::kStyleRayType) { |
| + // TODO(ericwilligers): crbug.com/641245 Support <size> for ray paths. |
| + float distance = FloatValueForLength(motion_data.distance_, 0); |
| + |
| + angle = ToStyleRay(*motion_data.path_).Angle() - 90; |
| + point.SetX(distance * cos(deg2rad(angle))); |
| + point.SetY(distance * sin(deg2rad(angle))); |
| + } else { |
| + const StylePath& motion_path = ToStylePath(*motion_data.path_); |
|
pdr.
2017/05/16 22:51:19
Would it be useful to add the following?
DCHECK(mo
Eric Willigers
2017/05/17 05:47:00
ToStylePath is already a debug checked cast, just
|
| + float path_length = motion_path.length(); |
| + float distance = FloatValueForLength(motion_data.distance_, path_length); |
| + float computed_distance; |
| + if (motion_path.IsClosed() && path_length > 0) { |
| + computed_distance = fmod(distance, path_length); |
| + if (computed_distance < 0) |
| + computed_distance += path_length; |
| + } else { |
| + computed_distance = clampTo<float>(distance, 0, path_length); |
| + } |
| + |
| + motion_path.GetPath().PointAndNormalAtLength(computed_distance, point, |
| + angle); |
| + } |
| if (motion_data.rotation_.type == kOffsetRotationFixed) |
| angle = 0; |