DescriptionUse 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. #Messages
Total messages: 9 (2 generated)
|