Make replaced preferred widths independent on available width

Prior to this patch, a replaced element with intrinsic ratio but with
no intrinsic width nor height and with 'width', 'height' both computed
values of 'auto', would have preferred width and preferred minimal
width that depended on the available width of the container.

After this patch, such a replaced element will have zero preferred
width and zero preferred minimal width.

Example:

<!doctype html>
<div style="width: 200px">
  <svg viewBox="0 0 1 1" style="background: blue">
  </svg>
<div>

<svg> becomes a 200x200 blue rectangle, intrinsic ratio (1) comes from
viewBox attribute. Preferred minimal width and preferred width would
be 200px prior to patch.

Changing the width of <div> would require recalculating preferred
widths on <svg>, something we rather not do, and does not currently
do. (See RenderReplaced::needsPreferredWidthsRecalculation()). This
means preferred minimal widths was left with stale values after
changes to the container.

The new behavior matches Firefox but is not yet in spec, possibly
because the sizing of such replaced element is undefined in CSS 2.1,
even though there is a suggestion, followed by Blink, in the spec.

BUG=382922

Review URL: https://codereview.chromium.org/325183002

git-svn-id: svn://svn.chromium.org/blink/trunk@176456 bbb929c8-8fbe-4397-9dbb-9b2b20218538
4 files changed
tree: b22799051c62c165dd75838715d579c5f85e144c
  1. third_party/