Use viewBox for SVG as intrinsic size when all else fails

In http://crrev.com/308643002 the use of viewBox for intrinsicSize was
removed (which means this is a partial revert of that change). The
reason for the removal was that there wasn't a known cases where it
would be useful.

But then crbug.com/441862 surfaced and showed that using the viewBox
for intrinsic size can indeed be useful and necessary for SVG inside
an image through a relatively complex chain. What in the end happens
is that the intrinsic size is used not as a size but as a ratio when
doing scaling to accommodate for object-fit:cover (see
LayoutReplaced::replacedContentRect).

Ideally, we should only allow use of the ratio from the viewBox, but
we currently have no way of expressing just the ratio for an Image. So
there is potential for the viewBox being misused as size. Putting the
code back should be relatively safe though, since we've had it before.

BUG=441862

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

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