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 Review URL: https://codereview.chromium.org/713263002 git-svn-id: svn://svn.chromium.org/blink/trunk@185226 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Showing
Please register or sign in to comment