Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Implement contain flag for ray() in offset path
https://bugs.webkit.org/show_bug.cgi?id=240259 <rdar://93374029> Reviewed by Simon Fraser. Implement contain flag for ray(). Contains purpose is to have the entire box being animated be contained within the path. "Contained within the path" is defined as having the box remain within a circle with the radius of the path length and positioned at the offset anchor. This solution is adapted from the repository of the spec writer: https://github.com/ewilligers/petrogale-purpureicollis. The way this solution works is that you construct a coordinate system with the origin being the offset anchor. You then calculate the position of each vertex of the box. Then, rotate the vertices based on the angles difference from the x-axis. Next, using the circle equation, we want to find an offset such that (x + offset)^2 + y^2 = r^2. This results in a lower and upper bound for offset: -x - sqrt(r^2 - y^2) <= offset <= -x + sqrt(r^2 + y^2). Finally we choose the minimal value of these upper and lower bounds to get the final clamped offset. This patch currently doesn't take into account if it is not possible to fit the box within the path, as this will be completed in a seperate patch. Currently, test 4 is failing due to rounding error, and test 5 is failing due to the unimplemented part. * Source/WebCore/platform/graphics/GeometryUtilities.cpp: (WebCore::toRelatedAcuteAngle): (WebCore::distanceOfPointToSidesOfRect): (WebCore::verticesForBox): * Source/WebCore/platform/graphics/GeometryUtilities.h: * Source/WebCore/rendering/PathOperation.cpp: (WebCore::RayPathOperation::lengthForContainPath const): (WebCore::RayPathOperation::pathForReferenceRect const): * Source/WebCore/rendering/PathOperation.h: * Source/WebCore/rendering/style/RenderStyle.cpp: (WebCore::getPathFromPathOperation): (WebCore::RenderStyle::applyMotionPathTransform const): * LayoutTests/TestExpectations: Canonical link: https://commits.webkit.org/250776@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294520 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
6 changed files
with
83 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters