Commit 859079e8 authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

Remove LayoutBox::AbsoluteContentBox*().

AbsoluteContentBox() used to cast directly from float to int, and if
the float value was sufficiently large, we'd end up with a negative
integer value.
Changed the two former callsites to using PhysicalContentBoxRect() +
LocalToAbsolute() instead.

AbsoluteContentBoxOffset() was unused.

Bug: 888510
Change-Id: Id1447973f23cabf40a45180aa95a69ba402688c6
Reviewed-on: https://chromium-review.googlesource.com/1245782Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595758}
parent a166dc7a
......@@ -872,21 +872,6 @@ void LayoutBox::SetLocationAndUpdateOverflowControlsIfNeeded(
}
}
IntRect LayoutBox::AbsoluteContentBox() const {
// This is wrong with transforms and flipped writing modes.
IntRect rect = PixelSnappedIntRect(PhysicalContentBoxRect());
FloatPoint abs_pos = LocalToAbsolute();
rect.Move(abs_pos.X(), abs_pos.Y());
return rect;
}
IntSize LayoutBox::AbsoluteContentBoxOffset() const {
IntPoint offset = RoundedIntPoint(PhysicalContentBoxOffset());
FloatPoint abs_pos = LocalToAbsolute();
offset.Move(abs_pos.X(), abs_pos.Y());
return ToIntSize(offset);
}
FloatQuad LayoutBox::AbsoluteContentQuad(MapCoordinatesFlags flags) const {
LayoutRect rect = PhysicalContentBoxRect();
return LocalToAbsoluteQuad(FloatRect(rect), flags);
......@@ -1890,7 +1875,8 @@ void LayoutBox::ImageChanged(WrappedImagePtr image,
ResourcePriority LayoutBox::ComputeResourcePriority() const {
LayoutRect view_bounds = ViewRect();
LayoutRect object_bounds = LayoutRect(AbsoluteContentBox());
LayoutRect object_bounds = PhysicalContentBoxRect();
object_bounds.MoveBy(LayoutPoint(LocalToAbsolute()));
// The object bounds might be empty right now, so intersects will fail since
// it doesn't deal with empty rects. Use LayoutRect::contains in that case.
......
......@@ -433,10 +433,6 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject {
LayoutSize PhysicalContentBoxOffset() const {
return LayoutSize(ContentLeft(), ContentTop());
}
// The content box in absolute coords. Ignores transforms.
IntRect AbsoluteContentBox() const;
// The offset of the content box in absolute coords, ignoring transforms.
IntSize AbsoluteContentBoxOffset() const;
// The content box converted to absolute coords (taking transforms into
// account).
FloatQuad AbsoluteContentQuad(MapCoordinatesFlags = 0) const;
......
......@@ -356,7 +356,8 @@ void CanvasRenderingContext2D::ScrollPathIntoViewInternal(const Path& path) {
// We first map canvas coordinates to layout coordinates.
LayoutRect path_rect(bounding_rect);
IntRect canvas_rect = layout_box->AbsoluteContentBox();
LayoutRect canvas_rect = layout_box->PhysicalContentBoxRect();
canvas_rect.MoveBy(LayoutPoint(layout_box->LocalToAbsolute()));
path_rect.SetX(
(canvas_rect.X() + path_rect.X() * canvas_rect.Width() / Width()));
path_rect.SetY(
......@@ -365,7 +366,7 @@ void CanvasRenderingContext2D::ScrollPathIntoViewInternal(const Path& path) {
path_rect.SetHeight((path_rect.Height() * canvas_rect.Height() / Height()));
// Then we clip the bounding box to the canvas visible range.
path_rect.Intersect(LayoutRect(canvas_rect));
path_rect.Intersect(canvas_rect);
bool is_horizontal_writing_mode =
canvas()->EnsureComputedStyle()->IsHorizontalWritingMode();
......
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