|
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
Committed: https://crrev.com/6546ae27e63ffbcca7c35da35eddae9f092ca35b
Cr-Commit-Position: refs/heads/master@{#360558}
Total comments: 9
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+140 lines, -278 lines) |
Patch |
|
M |
third_party/WebKit/LayoutTests/TestExpectations
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/svg/canvas/image-svg-intrinsic-size.html
|
View
|
1
2
3
4
5
|
1 chunk |
+19 lines, -0 lines |
0 comments
|
Download
|
|
A |
third_party/WebKit/LayoutTests/svg/canvas/image-svg-intrinsic-size-expected.html
|
View
|
1
2
3
4
5
6
7
|
1 chunk |
+3 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/clipboard/DataTransfer.cpp
|
View
|
1
2
3
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/css/CSSCrossfadeValue.cpp
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/editing/Editor.cpp
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/fetch/DEPS
|
View
|
|
1 chunk |
+0 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/fetch/ImageResource.h
|
View
|
1
2
3
4
5
6
7
|
5 chunks |
+2 lines, -11 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/fetch/ImageResource.cpp
|
View
|
|
7 chunks |
+1 line, -88 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/html/HTMLImageElement.cpp
|
View
|
1
2
3
4
5
6
7
8
9
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/input/EventHandler.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/layout/HitTestResult.cpp
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/layout/LayoutImage.h
|
View
|
|
2 chunks |
+0 lines, -4 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/layout/LayoutImage.cpp
|
View
|
1
2
3
4
5
6
7
8
|
3 chunks |
+1 line, -25 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/layout/LayoutImageResource.h
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+2 lines, -10 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/layout/LayoutImageResource.cpp
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+20 lines, -9 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/layout/LayoutImageResourceStyleImage.h
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -3 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/layout/LayoutImageResourceStyleImage.cpp
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+2 lines, -8 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.cpp
|
View
|
1
2
3
|
2 chunks |
+1 line, -3 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.h
|
View
|
1
2
3
4
5
6
7
8
9
|
1 chunk |
+0 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp
|
View
|
1
2
3
4
5
6
7
8
9
|
3 chunks |
+0 lines, -42 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/page/PageSerializer.h
|
View
|
1
2
3
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/page/PageSerializer.cpp
|
View
|
1
2
3
4
5
6
7
8
9
|
5 chunks |
+6 lines, -9 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/paint/BackgroundImageGeometry.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
|
3 chunks |
+4 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
2 chunks |
+2 lines, -4 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/paint/BoxPainter.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/paint/ImagePainter.cpp
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/paint/ListMarkerPainter.cpp
|
View
|
1
2
3
4
5
6
7
|
1 chunk |
+2 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/paint/NinePieceImagePainter.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
1 chunk |
+1 line, -4 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/paint/SVGImagePainter.h
|
View
|
1
2
3
4
5
6
7
8
9
10
|
2 chunks |
+2 lines, -0 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/paint/SVGImagePainter.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
|
2 chunks |
+26 lines, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/style/StyleFetchedImage.h
|
View
|
1
2
3
4
5
6
7
8
9
|
1 chunk |
+1 line, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/style/StyleFetchedImage.cpp
|
View
|
|
3 chunks |
+6 lines, -7 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/style/StyleFetchedImageSet.h
|
View
|
1
2
3
4
5
6
7
8
9
|
1 chunk |
+1 line, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/style/StyleFetchedImageSet.cpp
|
View
|
|
3 chunks |
+6 lines, -7 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/style/StyleGeneratedImage.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
2 chunks |
+1 line, -3 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/style/StyleGeneratedImage.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/style/StyleImage.h
|
View
|
|
1 chunk |
+1 line, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/style/StylePendingImage.h
|
View
|
|
1 chunk |
+1 line, -2 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/svg/SVGFEImageElement.cpp
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/core/svg/graphics/SVGImageForContainer.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
1 chunk |
+5 lines, -5 lines |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
M |
third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
Total messages: 76 (38 generated)
|