Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix SVGGraphicsElement.getBBox() when width or height is negative
- For <rect>, if one of width and height is negative, clamp the value to 0, but keep the valid value of the other instead of 0 in getBBox(). Also keep valid x and y instead of 0. - Similarly for <ellipse> when rx or ry is negative, and <circle> when r is negative. - Fix negative sized getBBox() for <image> and <foreignObject>. - For <image>, treat negative width/height as auto instead of 0 directly when intrinsic size is available. This applies to <image> only because for other elements, auto is the same as 0. Also use gfx::RectF for the bounding boxes in the layout classes for the above elements. The underlying C++ functions ObjectBoundingBox() are changed to follow the rule. StrokeBoundingBox() is also changed in the same way, but we don't think that will have an effect anywhere (we don't propagate the bounds if the shape is empty). Bug: 738465, 1264473 Change-Id: Id6afda3c7981c6151e2b8f36a41c18aac6e06d9e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3248891 Commit-Queue: Xianzhu Wang <[email protected]> Reviewed-by: Fredrik Söderquist <[email protected]> Cr-Commit-Position: refs/heads/main@{#936491}
- Loading branch information