Commit c90fe20c authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

Use override size if available for generated images.

Walking the ancestry during layout to figure out what size to use
doesn't work in LayoutNG. Use the provided override size instead.

Modified one test so that it would fail without this fix.

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: Iac990aed33355ecd49d68cc51bd355d2139f3dcb
Reviewed-on: https://chromium-review.googlesource.com/c/1307393Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603992}
parent 92c061d0
<!doctype html>
<!DOCTYPE html>
<style>
body { overflow:hidden; } /* Prevent an additional layout pass, which could hide bugs. */
.radial::before { width:150px; height:150px; border:2px solid black;
content: radial-gradient(circle at 45px 45px, #A7D30C, #019F62 40px, rgba(1,159,98,0) 50px);
display: block;
......@@ -16,4 +17,4 @@
if (window.testRunner) {
testRunner.dumpAsTextWithPixelResults();
}
</script>
\ No newline at end of file
</script>
......@@ -441,14 +441,23 @@ void LayoutImage::ComputeIntrinsicSizingInfo(
if (intrinsic_sizing_info.size.IsEmpty() &&
image_resource_->ImageHasRelativeSize() &&
!IsLayoutNGListMarkerImage()) {
LayoutObject* containing_block =
IsOutOfFlowPositioned() ? Container() : ContainingBlock();
if (containing_block->IsBox()) {
LayoutBox* box = ToLayoutBox(containing_block);
if (HasOverrideContainingBlockContentLogicalWidth() &&
HasOverrideContainingBlockContentLogicalHeight()) {
intrinsic_sizing_info.size.SetWidth(
box->AvailableLogicalWidth().ToFloat());
OverrideContainingBlockContentLogicalWidth().ToFloat());
intrinsic_sizing_info.size.SetHeight(
box->AvailableLogicalHeight(kIncludeMarginBorderPadding).ToFloat());
OverrideContainingBlockContentLogicalHeight().ToFloat());
} else {
LayoutObject* containing_block =
IsOutOfFlowPositioned() ? Container() : ContainingBlock();
if (containing_block->IsBox()) {
LayoutBox* box = ToLayoutBox(containing_block);
intrinsic_sizing_info.size.SetWidth(
box->AvailableLogicalWidth().ToFloat());
intrinsic_sizing_info.size.SetHeight(
box->AvailableLogicalHeight(kIncludeMarginBorderPadding)
.ToFloat());
}
}
}
}
......
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