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

Issue 713263002: Use the viewBox when scaling <svg:image>s non-uniformly w/ pAR=none (Closed)

Created:
6 years, 1 month ago by fs
Modified:
6 years, 1 month ago
Reviewers:
pdr., f(malita)
CC:
blink-reviews, blink-reviews-rendering, krit, eae+blinkwatch, ed+blinkwatch_opera.com, f(malita), fs, gyuyoung.kim_webkit.org, jchaffraix+rendering, kouhei+svg_chromium.org, leviw+renderwatch, pdr+renderingwatchlist_chromium.org, pdr+svgwatchlist_chromium.org, rwlbuis, Stephen Chennney, zoltan1
Project:
blink
Visibility:
Public.

Description

Use the viewBox when scaling <svg:image>s non-uniformly w/ pAR=none When referencing an SVG image from <svg:image> with pAR set to 'none', and said image had no intrinsic size, but a 'viewBox', the use of the intrinsic size (which would be computed as 300x150) as the container size would incorrect. The 'viewBox' would resolve against 300x150, so if it defined a different aspect ratio than that, the image would not appear correctly scaled. For pAR=none there're a number of cases to consider: 1) The referenced image has a 'viewBox'. 2) The referenced image has intrinsic dimensions. 3) The referenced image has none of the above. For cases (1) and (2), we should use the 'viewBox' and intrinsic dimensions (respectively) to define the container size (~= the image's viewport maps to the viewport defined by <svg:image>). In case (3) we try to use whatever is left to use (300x150). (In practice cases (2) and (3) should be equivalent.) This also recognizes that the TC svg/custom/svg-image-par-none-zero-intrinsic-size.html is incorrect, and modifies it. Gecko seem to agree with this change. The TC from the bug also made it obvious that there was a repaint bug at play, which resulted in the updated return value from RenderSVGImage::updateImageViewport. This is covered by the existing TC svg/custom/svg-image-par-resize.html, which now seem to issue more correct repaint rectangles. BUG=428324 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=185226

Patch Set 1 #

Patch Set 2 : Rebase. #

Total comments: 8

Patch Set 3 : Simplify computeNonUniformScalingViewportSize; Document Image::computeIntrinsicDimensions. #

Patch Set 4 : The computeImageViewportSize approach. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+24 lines, -33 lines) Patch
M LayoutTests/TestExpectations View 1 1 chunk +2 lines, -0 lines 0 comments Download
A + LayoutTests/svg/custom/svg-image-par-none-viewbox-no-intrinsic-size.html View 1 chunk +1 line, -1 line 0 comments Download
A + LayoutTests/svg/custom/svg-image-par-none-viewbox-no-intrinsic-size-expected.html View 0 chunks +-1 lines, --1 lines 0 comments Download
A + LayoutTests/svg/custom/svg-image-par-none-viewbox-percentage-size.html View 1 chunk +1 line, -1 line 0 comments Download
A + LayoutTests/svg/custom/svg-image-par-none-viewbox-percentage-size-expected.html View 0 chunks +-1 lines, --1 lines 0 comments Download
M LayoutTests/svg/custom/svg-image-par-none-zero-intrinsic-size.html View 1 chunk +2 lines, -2 lines 0 comments Download
M Source/core/rendering/svg/RenderSVGImage.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M Source/core/rendering/svg/RenderSVGImage.cpp View 1 2 3 1 chunk +15 lines, -30 lines 0 comments Download
M Source/platform/graphics/Image.h View 1 2 1 chunk +4 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (2 generated)
fs
Geez, who would've thought that pAR=none would such a complicated thing to get right... [1] ...
6 years, 1 month ago (2014-11-11 14:32:46 UTC) #2
pdr.
Our old friend PAR :( I think this looks good, mostly minor points below: https://codereview.chromium.org/713263002/diff/20001/Source/core/rendering/svg/RenderSVGImage.cpp ...
6 years, 1 month ago (2014-11-12 00:48:25 UTC) #3
fs
https://codereview.chromium.org/713263002/diff/20001/Source/core/rendering/svg/RenderSVGImage.cpp File Source/core/rendering/svg/RenderSVGImage.cpp (right): https://codereview.chromium.org/713263002/diff/20001/Source/core/rendering/svg/RenderSVGImage.cpp#newcode66 Source/core/rendering/svg/RenderSVGImage.cpp:66: // Note: This assumes that the 'intrinsic ratio' as ...
6 years, 1 month ago (2014-11-12 10:13:45 UTC) #4
fs
Uploaded PS3 and PS4, where the latter is the more radical approach described in comments. ...
6 years, 1 month ago (2014-11-12 13:47:18 UTC) #5
pdr.
PS4 looks great, LGTM
6 years, 1 month ago (2014-11-12 17:39:29 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/713263002/60001
6 years, 1 month ago (2014-11-12 17:40:40 UTC) #8
commit-bot: I haz the power
6 years, 1 month ago (2014-11-12 17:43:10 UTC) #9
Message was sent while issue was closed.
Committed patchset #4 (id:60001) as 185226

Powered by Google App Engine
This is Rietveld 408576698