Wrap SVGImage for container during paint

Before this patch, one SVGImageForContainer object is saved in
ImageResource for each corresponding use of SVGImage.

<img style="width: 1000px" src="image.svg">
...
<img style="width: 500px" src="image.svg">

This example would give one ImageResource (for image.svg) and within
it two SVGImageForContainer, one for each <img>. SVGImageForContainer
contains the unzoomed container size along with the zoom level,
indexed on the layout object of the container in
SVGImageFor*Container*.

There were at least three problems with this approach:

1. It's racy. setContainerSizeForLayoutObject is called sometimes from
   layout(), sometimes during paint(). Users of APIs such as
   imageForLayoutObject or imageSizeForLayoutObject that depend on
   setContainerSizeForLayoutObject would get different results
   depending on when they are called. Basically the only "safe" time
   to call these methods are right before paint.

2. It limits the number of associations between layout object and
   SVGImage to one. Consider an element/layout object having one
   SVGImage as content and another SVGImage as background. The
   container size for those two SVGImages in this case isn't
   necessarily the same and strictly speaking we should need two
   SVGImageForContainer objects. Only one SVGImageForContainer can be
   stored per layout object.

3. It breaks layering. ImageResource lives in fetch and having fetch/
   depend on svg code is undesirable. DEPS for fetch/ states
   "core/fetch/ shouldn't depend on anything else in core/".

After this patch, these three problems have been
addressed. SVGImageForContainer is now only allocated when it's
needed, to be passed through the GraphicsContext layer as a wrapper to
get the correct size and zoom level to avoid pixelated rasterization.

There are risks with this patch. In some cases code may rely on having
the container size saved inside ImageResource.cpp. However, such code
is most often already brittle and unreliable due to (1) above.

One quirk is the added BackgroundImageGeometry::imageContainerSize()
containing the tile size before 'background-repeat: round' has been
applied. Before this patch, this size was the one kept for the
respective container in ImageResource (since
setContainerSizeForLayoutObject were called before tile size
adjustments for background-repeat: round). It turns out this is
important to get the stretching correct, i.e. makes the underlying
drawing code ignore the intrinsic ratio of the background
image. svg/as-background-image/background-repeat.html exercises this
behavior.

BUG=128055, 306222

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

Cr-Commit-Position: refs/heads/master@{#360558}
44 files changed