Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Issue 1427943002: Wrap SVGImage for container during paint (Closed)

Created:
5 years, 1 month ago by davve
Modified:
5 years, 1 month ago
CC:
darktears, apavlov+blink_chromium.org, blink-reviews, blink-reviews-css, blink-reviews-html_chromium.org, blink-reviews-layout_chromium.org, blink-reviews-paint_chromium.org, blink-reviews-style_chromium.org, chromium-reviews, dcheng, dglazkov+blink, dshwang, krit, eae+blinkwatch, f(malita), gavinp+loader_chromium.org, gyuyoung2, Nate Chapin, jchaffraix+rendering, kouhei+svg_chromium.org, leviw+renderwatch, loading-reviews+fetch_chromium.org, pdr+renderingwatchlist_chromium.org, pdr+svgwatchlist_chromium.org, rwlbuis, Stephen Chennney, slimming-paint-reviews_chromium.org, szager+layoutwatch_chromium.org, tyoshino+watch_chromium.org, Yoav Weiss, zoltan1
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

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}

Patch Set 1 #

Patch Set 2 : A little float token got dropped on the floor #

Patch Set 3 : Put back old URL hack (was in ImageResource::svgImageForLayoutObject) #

Patch Set 4 : Remove redundant LayoutImageResource::intrinsicSize; it's the same as imageSize #

Patch Set 5 : Bring back old behavior for background SVGs inside background-repeat: round #

Patch Set 6 : Add test and don't prematurely add a RefPtr to SVGImageForContainer #

Patch Set 7 : Rebase (TestExpectations hit again) #

Patch Set 8 : Test title fix #

Patch Set 9 : Broken out ListItem change and LayoutImageResource::image() parameter change #

Patch Set 10 : Rebase #

Total comments: 9

Patch Set 11 : Move viewport check back to SVGImagePainter::paintForeground() #

Patch Set 12 : Rename beforeRound -> imageContainerSize #

Patch Set 13 : Use IntSize for SVGImageForContainer #

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

Messages

Total messages: 76 (38 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1427943002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1427943002/1
5 years, 1 month ago (2015-10-30 11:03:56 UTC) #2
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: android_chromium_gn_compile_rel on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/android_chromium_gn_compile_rel/builds/151389)
5 years, 1 month ago (2015-10-30 11:22:56 UTC) #4
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1427943002/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1427943002/20001
5 years, 1 month ago (2015-10-30 14:49:15 UTC) #6
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: win_chromium_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/128211)
5 years, 1 month ago (2015-10-30 15:49:43 UTC) #8
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1427943002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1427943002/40001
5 years, 1 month ago (2015-11-02 08:22:13 UTC) #10
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 1 month ago (2015-11-02 09:35:41 UTC) #12
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1427943002/60001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1427943002/60001
5 years, 1 month ago (2015-11-02 13:41:47 UTC) #16
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 1 month ago (2015-11-02 14:59:07 UTC) #19
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1427943002/80001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1427943002/80001
5 years, 1 month ago (2015-11-03 09:47:20 UTC) #21
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/135128)
5 years, 1 month ago (2015-11-03 12:08:40 UTC) #23
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1427943002/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1427943002/100001
5 years, 1 month ago (2015-11-04 13:13:43 UTC) #25
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/135865)
5 years, 1 month ago (2015-11-04 13:15:38 UTC) #28
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1427943002/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1427943002/140001
5 years, 1 month ago (2015-11-04 14:27:48 UTC) #31
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 1 month ago (2015-11-04 15:28:30 UTC) #35
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1427943002/180001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1427943002/180001
5 years, 1 month ago (2015-11-11 08:40:32 UTC) #37
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 1 month ago (2015-11-11 09:59:42 UTC) #40
davve
fs, something to gently nudge forward the coming week, you think? I add pdr@ and ...
5 years, 1 month ago (2015-11-13 14:43:06 UTC) #42
fs
On 2015/11/13 at 14:43:06, davve wrote: > fs, something to gently nudge forward the coming ...
5 years, 1 month ago (2015-11-13 18:09:32 UTC) #43
fs
Looks mostly ok to me (see question in SVGImagePainter). There's still things that could be ...
5 years, 1 month ago (2015-11-16 15:08:07 UTC) #44
davve
Input on how to handle the wrapping are very much welcome. I agree the way ...
5 years, 1 month ago (2015-11-16 16:32:40 UTC) #45
f(malita)
I really like the direction of this CL. A bit concerned about all the state ...
5 years, 1 month ago (2015-11-16 16:36:15 UTC) #46
fs
LGTM https://codereview.chromium.org/1427943002/diff/180001/third_party/WebKit/Source/core/paint/SVGImagePainter.cpp File third_party/WebKit/Source/core/paint/SVGImagePainter.cpp (right): https://codereview.chromium.org/1427943002/diff/180001/third_party/WebKit/Source/core/paint/SVGImagePainter.cpp#newcode36 third_party/WebKit/Source/core/paint/SVGImagePainter.cpp:36: return; On 2015/11/16 at 16:32:40, David Vest wrote: ...
5 years, 1 month ago (2015-11-16 16:43:21 UTC) #47
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1427943002/220001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1427943002/220001
5 years, 1 month ago (2015-11-17 12:14:27 UTC) #49
davve
> A bit concerned about all the state micromanagement going on (setURL, > setTileSize, etc.) ...
5 years, 1 month ago (2015-11-17 13:08:29 UTC) #51
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 1 month ago (2015-11-17 13:34:41 UTC) #53
f(malita)
Thanks, LGTM!
5 years, 1 month ago (2015-11-18 04:12:59 UTC) #54
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1427943002/220001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1427943002/220001
5 years, 1 month ago (2015-11-18 13:08:06 UTC) #57
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/119738)
5 years, 1 month ago (2015-11-18 13:16:02 UTC) #59
davve
Ken, can you review modules/webgl/ when you have a moment?
5 years, 1 month ago (2015-11-18 13:34:29 UTC) #61
Ken Russell (switch to Gerrit)
modules/webgl lgtm as long as the webgl_conformance tests pass.
5 years, 1 month ago (2015-11-18 17:43:58 UTC) #62
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1427943002/220001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1427943002/220001
5 years, 1 month ago (2015-11-19 07:49:36 UTC) #64
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/142981)
5 years, 1 month ago (2015-11-19 08:18:29 UTC) #66
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1427943002/240001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1427943002/240001
5 years, 1 month ago (2015-11-19 08:52:52 UTC) #68
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
5 years, 1 month ago (2015-11-19 10:34:22 UTC) #70
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1427943002/240001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1427943002/240001
5 years, 1 month ago (2015-11-19 10:45:03 UTC) #73
davve
On 2015/11/18 17:43:58, Ken Russell wrote: > modules/webgl lgtm as long as the webgl_conformance tests ...
5 years, 1 month ago (2015-11-19 10:46:19 UTC) #74
commit-bot: I haz the power
Committed patchset #13 (id:240001)
5 years, 1 month ago (2015-11-19 10:49:55 UTC) #75
commit-bot: I haz the power
5 years, 1 month ago (2015-11-19 10:50:55 UTC) #76
Message was sent while issue was closed.
Patchset 13 (id:??) landed as
https://crrev.com/6546ae27e63ffbcca7c35da35eddae9f092ca35b
Cr-Commit-Position: refs/heads/master@{#360558}

Powered by Google App Engine
This is Rietveld 408576698