Commit e5214927 authored by Vladimir Levin's avatar Vladimir Levin Committed by Commit Bot

[PE] Fix DCHECKs that trigger on a transformed tr with abspos div.

The code in place handles cases where the container is a TableSection
with a transform. Extend this to also work when the container is a
TableRow with a transform. In general, this patch changes IsTableSection
to IsTablePart to handle any part of the table that can be a container.

This also changes the EnclosingIntRect to RoundedIntRect in a DCHECK,
since offsets under EnclosingIntRect are susceptible to int differences
when the source has small floating point changes. For example,
-1.0000028610 offset in one rect becomes -2, but
-1.0000000000 stays -1.

R=chrishtr@chromium.org

Bug: 804952
Change-Id: Ibc1e062953c1c6bc436101705d4842209e6af707
Reviewed-on: https://chromium-review.googlesource.com/884681Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: vmpstr <vmpstr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531977}
parent da6f2f68
...@@ -1312,12 +1312,12 @@ const LayoutObject* LayoutBoxModelObject::PushMappingToContainer( ...@@ -1312,12 +1312,12 @@ const LayoutObject* LayoutBoxModelObject::PushMappingToContainer(
// There can't be a transform between container and ancestor_to_stop_at, // There can't be a transform between container and ancestor_to_stop_at,
// because transforms create containers, so it should be safe to just // because transforms create containers, so it should be safe to just
// subtract the delta between the container and ancestor_to_stop_at. // subtract the delta between the container and ancestor_to_stop_at.
// But if ancestor_to_stop_at is a table section with a transform, we // But if ancestor_to_stop_at is a table section/row with a transform, we
// must apply the transform to the offset because the table section is // must apply the transform to the offset because the table part is
// not the container (it is not a LayoutBlock). // not the container (it is not a LayoutBlock).
LayoutSize ancestor_offset = LayoutSize ancestor_offset =
ancestor_to_stop_at->OffsetFromAncestorContainer(container); ancestor_to_stop_at->OffsetFromAncestorContainer(container);
if (ancestor_to_stop_at->IsTableSection() && if (ancestor_to_stop_at->IsTablePart() &&
ancestor_to_stop_at->StyleRef().HasTransform() && ancestor_to_stop_at->StyleRef().HasTransform() &&
ancestor_to_stop_at->ShouldUseTransformFromContainer(container)) { ancestor_to_stop_at->ShouldUseTransformFromContainer(container)) {
TransformationMatrix t; TransformationMatrix t;
......
...@@ -180,10 +180,14 @@ FloatQuad LayoutGeometryMap::MapToAncestor( ...@@ -180,10 +180,14 @@ FloatQuad LayoutGeometryMap::MapToAncestor(
// Inspector creates layoutObjects with negative width // Inspector creates layoutObjects with negative width
// <https://bugs.webkit.org/show_bug.cgi?id=87194>. // <https://bugs.webkit.org/show_bug.cgi?id=87194>.
// Taking FloatQuad bounds avoids spurious assertions because of that. // Taking FloatQuad bounds avoids spurious assertions because of that.
DCHECK(EnclosingIntRect(layout_object_mapped_result) == DCHECK(RoundedIntRect(layout_object_mapped_result) ==
EnclosingIntRect(result.BoundingBox()) || RoundedIntRect(result.BoundingBox()) ||
layout_object_mapped_result.MayNotHaveExactIntRectRepresentation() || layout_object_mapped_result.MayNotHaveExactIntRectRepresentation() ||
result.BoundingBox().MayNotHaveExactIntRectRepresentation()); result.BoundingBox().MayNotHaveExactIntRectRepresentation())
<< "Rounded: " << RoundedIntRect(layout_object_mapped_result) << " vs "
<< RoundedIntRect(result.BoundingBox())
<< ". Original: " << layout_object_mapped_result << " vs "
<< result.BoundingBox();
} }
#endif #endif
......
...@@ -2409,12 +2409,12 @@ LayoutSize LayoutObject::OffsetFromAncestorContainer( ...@@ -2409,12 +2409,12 @@ LayoutSize LayoutObject::OffsetFromAncestorContainer(
DCHECK(next_container); DCHECK(next_container);
if (!next_container) if (!next_container)
break; break;
// Table sections can have transforms but are not containers (they are // Table sections/rows can have transforms but are not containers (they are
// not derived from LayoutBlock). Allow them here. It is the responsibility // not derived from LayoutBlock). Allow them here. It is the responsibility
// of calling code to correctly handle the fact that the value returned from // of calling code to correctly handle the fact that the value returned from
// this method does not account for the table section transform. // this method does not account for the table part transform.
DCHECK(!curr_container->HasTransformRelatedProperty() || DCHECK(!curr_container->HasTransformRelatedProperty() ||
curr_container->IsTableSection()); curr_container->IsTablePart());
LayoutSize current_offset = LayoutSize current_offset =
curr_container->OffsetFromContainer(next_container); curr_container->OffsetFromContainer(next_container);
offset += current_offset; offset += current_offset;
......
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