Commit 4ac1bca2 authored by Eric Willigers's avatar Eric Willigers Committed by Commit Bot

CSS Paths: fix horizontal/vertical commands

The coordinates after H and V commands were being calculated
incorrectly during path serialization.

BUG=887871

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ia2f55213c4a4837d82f9783d1ad1af29de9937ae
Reviewed-on: https://chromium-review.googlesource.com/1252229Reviewed-by: default avatarFredrik Söderquist <fs@opera.com>
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595422}
parent c268bbf6
......@@ -36,6 +36,10 @@ test(function() {
target.style.offsetPath = ' path( "m 10 20 a 10 20 30 1 0 40 50 a 110 120 30 1 1 140 50" ) ';
assert_equals(target.style.offsetPath, 'path("m 10 20 a 10 20 30 1 0 40 50 a 110 120 30 1 1 140 50")');
assert_equals(getComputedStyle(target).offsetPath, 'path("M 10 20 A 10 20 30 1 0 50 70 A 110 120 30 1 1 190 120")');
target.style.offsetPath = 'path("M 1 2 H 3 v 4 h 5 V 6 h 7 v 8")';
assert_equals(target.style.offsetPath, 'path("M 1 2 H 3 v 4 h 5 V 6 h 7 v 8")');
assert_equals(getComputedStyle(target).offsetPath, 'path("M 1 2 H 3 V 6 H 8 V 6 H 15 V 14")');
});
</script>
</body>
......
......@@ -291,6 +291,10 @@ void SVGPathAbsolutizer::EmitSegment(const PathSegmentData& segment) {
if (absolute_segment.command == kPathSegClosePath) {
current_point_ = sub_path_point_;
} else if (absolute_segment.command == kPathSegLineToHorizontalAbs) {
current_point_.SetX(absolute_segment.target_point.X());
} else if (absolute_segment.command == kPathSegLineToVerticalAbs) {
current_point_.SetY(absolute_segment.target_point.Y());
} else {
current_point_ = absolute_segment.target_point;
if (absolute_segment.command == kPathSegMoveToAbs) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment