-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set intrinsic size for inline SVG earlier
https://bugs.webkit.org/show_bug.cgi?id=257614 rdar://problem/110480382 Reviewed by Simon Fraser. This patch aligns WebKit with Gecko / Firefox and Blink / Chromium. Merge: https://chromium.googlesource.com/chromium/src.git/+/545b2183e1b4ee3eb433537f9a6386b5337d6588 RenderReplaced has a m_intrinsicSize that's updated when computing logical widths and heights (and only if needed; specified style makes it not being set at all). But m_intrinsicSize can be used earlier that that, when computing preferred widths for the container, see RenderReplaced::computeIntrinsicLogicalWidths called from RenderReplaced::computePreferredLogicalWidths(). This patch computes the intrinsic size in the constructor to avoid returning the stale default size. * Source/WebCore/rendering/svg/LegacyRenderSVGRoot.cpp: (1) Add constants for 'defaultWidth' and 'defaultHeight' (2) Add 'intrinsicSize' logic (3) Introduce new function 'calculateIntrinsicSize' (LegacyRenderSVGRoot::computeIntrinsicRatioInformation): Call above function and remove unneeded comments * Source/WebCore/rendering/svg/LegacyRenderSVGRoot.h: Definition of 'calculateIntrinsicSize' * Source/WebCore/rendering/svg/RenderSVGRoot.cpp: Same changes as 'Legacy' for LBSE * Source/WebCore/rendering/svg/RenderSVGRoot.h: Ditto * LayoutTests/svg/in-html/inside-inline-block.html: Add Test Case * LayoutTests/svg/in-html/inside-inline-block-expected.html: Add Test Case Expectation Canonical link: https://commits.webkit.org/266314@main
- Loading branch information
1 parent
c556dfa
commit dbdb89f
Showing
6 changed files
with
100 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!DOCTYPE html> | ||
<title>SVG inside inline block</title> | ||
<style> | ||
body { margin: 0 } | ||
div { | ||
width: 100px; | ||
background: green; | ||
position: absolute; | ||
top: 0; | ||
left: 0 | ||
} | ||
.cover1 { | ||
top: 0; | ||
left: 0; | ||
height: 150px | ||
} | ||
.cover2 { | ||
top: 50px; | ||
left: 100px; | ||
height: 100px | ||
} | ||
</style> | ||
<div class="cover1"></div> | ||
<div class="cover2"></div> |
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,38 @@ | ||
<!DOCTYPE html> | ||
<title>SVG inside inline block</title> | ||
<style> | ||
body { margin: 0 } | ||
span { display: inline-block } | ||
div { | ||
width: 100px; | ||
background: green; | ||
position: absolute; | ||
top: 0; | ||
left: 0 | ||
} | ||
.cover1 { | ||
top: 0; | ||
left: 0; | ||
height: 150px | ||
} | ||
.cover2 { | ||
top: 50px; | ||
left: 100px; | ||
height: 100px | ||
} | ||
svg { | ||
width: 100%; | ||
height: 100% | ||
} | ||
</style> | ||
<span> | ||
<svg width="100"> | ||
<rect width="100%" height="100%" fill="red"/> | ||
</svg> | ||
</span><span> | ||
<svg width="100" height="100" style="width: 100%; height: 100%;"> | ||
<rect width="100%" height="100%" fill="red"/> | ||
</svg> | ||
</span> | ||
<div class="cover1"></div> | ||
<div class="cover2"></div> |
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
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