Commit 94e9a605 authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[LayoutNG] Switch LineSegment to using LayoutUnit's instead of floats.

There should be no behaviour change. This is done so we can modify the
LineSegment in LayoutNG to be in the correct coordinate system.

Bug: 635619
Change-Id: I4be2b099fc0731e0927b8a548a960ff00d9ddf9c
Reviewed-on: https://chromium-review.googlesource.com/1050487
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557607}
parent 20982801
......@@ -4,11 +4,8 @@ X
X
X
PASS elementRect('s1').top is 0
FAIL elementRect('s1').left should be 347. Was 347.09375.
PASS elementRect('s2').top is 20
FAIL elementRect('s2').left should be 390. Was 389.984375.
PASS elementRect('s3').top is 40
FAIL elementRect('s3').left should be 417. Was 417.1875.
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -74,13 +74,13 @@ function marginEllipseLeftXIntercept(y, cx, rx, ry)
var quiet = true; // PASS output depends on SubPixelLayout.isEnabled()
shouldBe("elementRect('s1').top", "0");
shouldBe("elementRect('s1').left", marginEllipseLeftXIntercept(20, 225, 225, 125), quiet);
shouldBe("elementRect('s1').left", marginEllipseLeftXIntercept(20, 225, 225, 125), quiet, 1);
shouldBe("elementRect('s2').top", "20");
shouldBe("elementRect('s2').left", marginEllipseLeftXIntercept(40, 225, 225, 125), quiet);
shouldBe("elementRect('s2').left", marginEllipseLeftXIntercept(40, 225, 225, 125), quiet, 1);
shouldBe("elementRect('s3').top", "40");
shouldBe("elementRect('s3').left", marginEllipseLeftXIntercept(60, 225, 225, 125), quiet);
shouldBe("elementRect('s3').left", marginEllipseLeftXIntercept(60, 225, 225, 125), quiet, 1);
</script>
</html>
......
......@@ -4,11 +4,8 @@ X
X
X
PASS elementRect('s1').top is 0
FAIL elementRect('s1').right should be 152. Was 152.90625.
PASS elementRect('s2').top is 20
FAIL elementRect('s2').right should be 110. Was 110.015625.
PASS elementRect('s3').top is 40
FAIL elementRect('s3').right should be 82. Was 82.8125.
PASS successfullyParsed is true
TEST COMPLETE
......
......@@ -76,13 +76,13 @@ function marginEllipseRightXIntercept(y, cx, rx, ry)
var quiet = true; // PASS output depends on SubPixelLayout.isEnabled()
shouldBe("elementRect('s1').top", "0");
shouldBe("elementRect('s1').right", marginEllipseRightXIntercept(20, 225, 225, 125), quiet);
shouldBe("elementRect('s1').right", marginEllipseRightXIntercept(20, 225, 225, 125), quiet, 1);
shouldBe("elementRect('s2').top", "20");
shouldBe("elementRect('s2').right", marginEllipseRightXIntercept(40, 225, 225, 125), quiet);
shouldBe("elementRect('s2').right", marginEllipseRightXIntercept(40, 225, 225, 125), quiet, 1);
shouldBe("elementRect('s3').top", "40");
shouldBe("elementRect('s3').right", marginEllipseRightXIntercept(60, 225, 225, 125), quiet);
shouldBe("elementRect('s3').right", marginEllipseRightXIntercept(60, 225, 225, 125), quiet, 1);
</script>
</html>
......
......@@ -143,7 +143,7 @@ TEST_F(BoxShapeTest, getIntervals) {
TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(15), LayoutUnit(6), 0, 100);
TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(20), LayoutUnit(50), 0, 100);
TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(69), LayoutUnit(5), 0, 100);
TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(85), LayoutUnit(10), 0, 97.320511f);
TEST_EXCLUDED_INTERVAL(shape, LayoutUnit(85), LayoutUnit(10), 0, 97.3125f);
}
} // anonymous namespace
......
......@@ -51,8 +51,8 @@ struct LineSegment {
logical_right(logical_right),
is_valid(true) {}
float logical_left;
float logical_right;
LayoutUnit logical_left;
LayoutUnit logical_right;
bool is_valid;
};
......
......@@ -371,8 +371,8 @@ ShapeOutsideDeltas ShapeOutsideInfo::ComputeDeltasForContainingBlockLine(
containing_block.Style()->IsLeftToRightDirection()
? containing_block.MarginStartForChild(layout_box_)
: containing_block.MarginEndForChild(layout_box_);
LayoutUnit raw_left_margin_box_delta(
segment.logical_left + LogicalLeftOffset() + logical_left_margin);
LayoutUnit raw_left_margin_box_delta =
segment.logical_left + LogicalLeftOffset() + logical_left_margin;
LayoutUnit left_margin_box_delta = clampTo<LayoutUnit>(
raw_left_margin_box_delta, LayoutUnit(), float_margin_box_width);
......@@ -380,10 +380,10 @@ ShapeOutsideDeltas ShapeOutsideInfo::ComputeDeltasForContainingBlockLine(
containing_block.Style()->IsLeftToRightDirection()
? containing_block.MarginEndForChild(layout_box_)
: containing_block.MarginStartForChild(layout_box_);
LayoutUnit raw_right_margin_box_delta(
LayoutUnit raw_right_margin_box_delta =
segment.logical_right + LogicalLeftOffset() -
containing_block.LogicalWidthForChild(layout_box_) -
logical_right_margin);
logical_right_margin;
LayoutUnit right_margin_box_delta = clampTo<LayoutUnit>(
raw_right_margin_box_delta, -float_margin_box_width, LayoutUnit());
......
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