forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1340715 - Change SVG max-content size for webcompat. r=emilio
The goal of this patch is to change the SVG max-content size to match blink and webkit to fix the webcompat issues in bug 1521882 and bug 1651754. If a percentage width/height attribute on inline axis is explicitly set, we fall back to the default replaced element size to avoid regressing bug 1162418. Otherwise, we use 0 as SVG's max-content size in order to be compatible with blink and webkit. When computing replaced elements's max-content inline-size, its preferred aspect-ratio and block-size can transfer to inline axis. The logic is the same as if the element has an 'auto' inline-size. Hence the modification in ComputeSizeWithIntrinsicDimensions(). This patch also removes the SVG's intrinsic size dependency on an arbitrary container from the previous layout result in `SVGOuterSVGFrame::GetPrefISize()`. bug 1340715 comment 1 explains why the code is unsound. Differential Revision: https://phabricator.services.mozilla.com/D155998
- Loading branch information
Showing
5 changed files
with
71 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 0 additions & 2 deletions
2
testing/web-platform/meta/css/css-sizing/replaced-aspect-ratio-intrinsic-size-001.html.ini
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
testing/web-platform/meta/css/css-sizing/svg-intrinsic-size-003.html.ini
This file was deleted.
Oops, something went wrong.
55 changes: 55 additions & 0 deletions
55
testing/web-platform/tests/css/css-sizing/svg-intrinsic-size-004.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<link rel="author" title="Daniel Holbert" href="mailto:[email protected]"> | ||
<link rel="author" title="Ting-Yu Lin" href="mailto:[email protected]"> | ||
<link rel="author" title="Mozilla" href="https://www.mozilla.org/"> | ||
<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#intrinsic-sizes"> | ||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1638937"> | ||
|
||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/check-layout-th.js"></script> | ||
|
||
<style> | ||
.block { | ||
display: block; | ||
width: max-content; | ||
border: 2px solid black; | ||
line-height: 0; | ||
} | ||
svg { | ||
background: teal; | ||
} | ||
</style> | ||
|
||
<body onload="checkLayout('svg')"> | ||
No intrinsic attributes: | ||
<div class="block"> | ||
<svg data-expected-client-width="300" data-expected-client-height="150"></svg> | ||
</div> | ||
|
||
viewBox and height: | ||
<div class="block"> | ||
<svg height="40" viewBox="0 0 4 1" | ||
data-expected-client-width="160" data-expected-client-height="40"></svg> | ||
</div> | ||
|
||
viewBox and width: | ||
<div class="block"> | ||
<svg width="40" viewBox="0 0 4 1" | ||
data-expected-client-width="40" data-expected-client-height="10"></svg> | ||
</div> | ||
|
||
viewBox, width, height: | ||
<div class="block"> | ||
<svg width="40" height="40" viewBox="0 0 4 1" | ||
data-expected-client-width="40" data-expected-client-height="40"></svg> | ||
</div> | ||
|
||
Just viewBox: | ||
<div class="block"> | ||
<!-- Google Chrome 107 and Safari 16.0 both render this SVG as size 0x0. --> | ||
<svg viewBox="0 0 4 1" | ||
data-expected-client-width="0" data-expected-client-height="0"></svg> | ||
</div> | ||
</body> |