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

Issue 1456813002: Calculate Background Image Geometries using sub-pixel values (Closed)

Created:
5 years, 1 month ago by leviw_travelin_and_unemployed
Modified:
5 years ago
Reviewers:
davve, pdr., eae
CC:
blink-reviews, blink-reviews-layout_chromium.org, blink-reviews-paint_chromium.org, blink-reviews-platform-graphics_chromium.org, Rik, chromium-reviews, danakj, dshwang, drott+blinkwatch_chromium.org, krit, eae+blinkwatch, f(malita), fs, gyuyoung2, jbroman, jchaffraix+rendering, Justin Novosad, kouhei+svg_chromium.org, leviw+renderwatch, pdr+svgwatchlist_chromium.org, pdr+renderingwatchlist_chromium.org, pdr+graphicswatchlist_chromium.org, rwlbuis, Stephen Chennney, slimming-paint-reviews_chromium.org, szager+layoutwatch_chromium.org, vmpstr+blinkwatch_chromium.org, zoltan1
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Calculate Background Image Geometries using sub-pixel values We've long had horrible issues with zooming and background images with offsets (spriting). This is because we calculated these offsets using integers greedily instead of snapping them directly before paint like we do with other sub-pixel values in the layout tree. With this change, BackgroundImageGeometry is converted entirely to LayoutUnits, with snapping occurring after calculation in a new pixelSnapGeometry() method. The old sub-pixel tile size heuristic was thrown out, but replaced by a new one that puts in extra effort for background images that fully cover the fill layer. A number of reference tests needed to be updated to account for new rounding values on tests with -webkit-mask-repeat or background-repeat: round. It's worth noting that the references for these tests don't render the same in Firefox with or without the changes made in this patch. The change to repeatSpacing in drawPattern and drawTiled is for consistency only and can happily be postponed to a subsequent patch. This patch influenced by the following changes in WebKit: https://bugs.webkit.org/attachment.cgi?id=228591 https://bugs.webkit.org/attachment.cgi?id=222911 So mad props to Zalan Bujtas <zalan@apple.com>;, Apple's 1337 sub-pixel h4x0r. BUG=66498 Committed: https://crrev.com/b216e38c1a1812d5761b0e78d8975c807c7f3837 Cr-Commit-Position: refs/heads/master@{#362569}

Patch Set 1 #

Patch Set 2 : Fix modding and some LayoutUnit conversions #

Patch Set 3 : Round 2: FIGHT! #

Patch Set 4 : Avoid using new snap methods #

Patch Set 5 : ToT and add h4x #

Patch Set 6 : Check expectations #

Patch Set 7 : Patch without test expectations #

Patch Set 8 : Unit fix and moar ref test corrections. Still no expected results. #

Total comments: 8

Patch Set 9 : Fix contain-and-cover #

Patch Set 10 : Add comment to applySubPixelHeuristicToImageSize #

Total comments: 1

Patch Set 11 : Remove borked test and add test expectations #

Patch Set 12 : Fix Lint #

Patch Set 13 : Moar test expectations #

Patch Set 14 : MOAR expectations #

Unified diffs Side-by-side diffs Delta from patch set Stats (+227 lines, -170 lines) Patch
M third_party/WebKit/LayoutTests/TestExpectations View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +27 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/css3/background/background-repeat-round-border-expected.html View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/css3/background/background-repeat-round-content-expected.html View 1 2 3 4 5 6 1 chunk +6 lines, -3 lines 0 comments Download
M third_party/WebKit/LayoutTests/css3/masking/mask-repeat-round-border-expected.html View 1 2 3 4 5 6 7 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/css3/masking/mask-repeat-round-content-expected.html View 1 2 3 4 5 6 7 1 chunk +5 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/backgrounds/size/contain-and-cover-zoomed.html View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -2 lines 0 comments Download
M third_party/WebKit/LayoutTests/fast/sub-pixel/scaled-background-image.html View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/fast/sub-pixel/scaled-background-image-expected.html View 1 2 3 4 5 6 7 8 9 10 1 chunk +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +24 lines, -23 lines 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutListMarker.h View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/layout/LayoutListMarker.cpp View 1 2 3 4 5 6 3 chunks +5 lines, -5 lines 0 comments Download
M third_party/WebKit/Source/core/layout/shapes/ShapeOutsideInfo.cpp View 1 2 3 4 2 chunks +4 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/core/paint/BackgroundImageGeometry.h View 1 2 3 4 2 chunks +26 lines, -24 lines 0 comments Download
M third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp View 1 2 3 4 5 6 7 8 9 13 chunks +91 lines, -81 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 1 chunk +3 lines, -3 lines 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 13 1 chunk +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/svg/graphics/SVGImage.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp View 1 2 3 4 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 13 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/core/svg/graphics/SVGImageForContainer.cpp View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/graphics/GeneratedImage.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/graphics/GeneratedImage.cpp View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/platform/graphics/GraphicsContext.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +8 lines, -1 line 0 comments Download
M third_party/WebKit/Source/platform/graphics/Image.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/platform/graphics/Image.cpp View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download

Messages

Total messages: 30 (14 generated)
leviw_travelin_and_unemployed
PTAL. The current patch uploaded *without* new test expectations to demonstrate the pixel differences. A ...
5 years ago (2015-11-25 00:12:04 UTC) #3
eae
So. much. better! Thanks for doing this levi! https://codereview.chromium.org/1456813002/diff/140001/third_party/WebKit/LayoutTests/fast/backgrounds/size/contain-and-cover-zoomed.html File third_party/WebKit/LayoutTests/fast/backgrounds/size/contain-and-cover-zoomed.html (right): https://codereview.chromium.org/1456813002/diff/140001/third_party/WebKit/LayoutTests/fast/backgrounds/size/contain-and-cover-zoomed.html#newcode62 third_party/WebKit/LayoutTests/fast/backgrounds/size/contain-and-cover-zoomed.html:62: document.styleSheets[0].insertRule("body ...
5 years ago (2015-11-25 00:21:06 UTC) #4
leviw_travelin_and_unemployed
https://codereview.chromium.org/1456813002/diff/140001/third_party/WebKit/LayoutTests/fast/backgrounds/size/contain-and-cover-zoomed.html File third_party/WebKit/LayoutTests/fast/backgrounds/size/contain-and-cover-zoomed.html (right): https://codereview.chromium.org/1456813002/diff/140001/third_party/WebKit/LayoutTests/fast/backgrounds/size/contain-and-cover-zoomed.html#newcode62 third_party/WebKit/LayoutTests/fast/backgrounds/size/contain-and-cover-zoomed.html:62: document.styleSheets[0].insertRule("body { zoom: 0.666666667; }", 0); Fair enough. This ...
5 years ago (2015-11-25 00:31:56 UTC) #5
eae
On 2015/11/25 00:31:56, leviw wrote: > https://codereview.chromium.org/1456813002/diff/140001/third_party/WebKit/LayoutTests/fast/backgrounds/size/contain-and-cover-zoomed.html > File > third_party/WebKit/LayoutTests/fast/backgrounds/size/contain-and-cover-zoomed.html > (right): > > ...
5 years ago (2015-11-25 00:33:21 UTC) #6
leviw_travelin_and_unemployed
On 2015/11/25 at 00:33:21, eae wrote: > On 2015/11/25 00:31:56, leviw wrote: > > https://codereview.chromium.org/1456813002/diff/140001/third_party/WebKit/LayoutTests/fast/backgrounds/size/contain-and-cover-zoomed.html ...
5 years ago (2015-11-25 00:34:19 UTC) #7
davve
Obviously I like this CL. https://codereview.chromium.org/1456813002/diff/180001/third_party/WebKit/Source/core/paint/NinePieceImagePainter.cpp File third_party/WebKit/Source/core/paint/NinePieceImagePainter.cpp (right): https://codereview.chromium.org/1456813002/diff/180001/third_party/WebKit/Source/core/paint/NinePieceImagePainter.cpp#newcode58 third_party/WebKit/Source/core/paint/NinePieceImagePainter.cpp:58: NinePieceImageGrid grid(ninePieceImage, imageSize, pixelSnappedIntRect(borderImageRect), ...
5 years ago (2015-11-25 15:47:59 UTC) #9
leviw_travelin_and_unemployed
On 2015/11/25 at 15:47:59, davve wrote: > Obviously I like this CL. Well then obviously ...
5 years ago (2015-11-25 18:15:11 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1456813002/210001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1456813002/210001
5 years ago (2015-11-25 22:24:31 UTC) #13
commit-bot: I haz the power
Try jobs failed on following builders: linux_android_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_android_rel_ng/builds/101605)
5 years ago (2015-11-25 23:50:58 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1456813002/230001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1456813002/230001
5 years ago (2015-11-26 00:19:31 UTC) #18
commit-bot: I haz the power
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/146351)
5 years ago (2015-11-26 01:58:58 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1456813002/250001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1456813002/250001
5 years ago (2015-12-01 18:06:15 UTC) #23
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/148205)
5 years ago (2015-12-01 20:51:44 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1456813002/250001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1456813002/250001
5 years ago (2015-12-01 21:55:26 UTC) #27
commit-bot: I haz the power
Committed patchset #14 (id:250001)
5 years ago (2015-12-02 01:30:52 UTC) #28
commit-bot: I haz the power
5 years ago (2015-12-02 01:32:27 UTC) #30
Message was sent while issue was closed.
Patchset 14 (id:??) landed as
https://crrev.com/b216e38c1a1812d5761b0e78d8975c807c7f3837
Cr-Commit-Position: refs/heads/master@{#362569}

Powered by Google App Engine
This is Rietveld 408576698