Title: [295124] trunk
- Revision
- 295124
- Author
- za...@apple.com
- Date
- 2022-06-02 05:52:52 -0700 (Thu, 02 Jun 2022)
Log Message
Do not assume that an absolute positioned block box's height is always resolvable
https://bugs.webkit.org/show_bug.cgi?id=241213
Reviewed by Simon Fraser.
1. While the ICB (RenderView) always has fixed height/width, the RenderStyle values are set to auto.
2. It's incorrect to assume that we can always resolve the height for an absolute positioned box (e.g. it may have a "height: auto" relative positioned containing block)
* LayoutTests/fast/block/fill-available-with-absolute-position-expected.html: Added.
* LayoutTests/fast/block/fill-available-with-absolute-position.html: Added.
* Source/WebCore/rendering/RenderBox.cpp:
(WebCore::RenderBox::computeIntrinsicLogicalContentHeightUsing const):
(WebCore::RenderBox::computePositionedLogicalHeightUsing const):
Canonical link: https://commits.webkit.org/251215@main
Modified Paths
Added Paths
Diff
Added: trunk/LayoutTests/fast/block/fill-available-with-absolute-position-expected.html (0 => 295124)
--- trunk/LayoutTests/fast/block/fill-available-with-absolute-position-expected.html (rev 0)
+++ trunk/LayoutTests/fast/block/fill-available-with-absolute-position-expected.html 2022-06-02 12:52:52 UTC (rev 295124)
@@ -0,0 +1,9 @@
+<style>
+div {
+ width: 10px;
+ height: 100%;
+ background-color: green;
+ position: absolute;
+}
+</style>
+<div></div>
Added: trunk/LayoutTests/fast/block/fill-available-with-absolute-position.html (0 => 295124)
--- trunk/LayoutTests/fast/block/fill-available-with-absolute-position.html (rev 0)
+++ trunk/LayoutTests/fast/block/fill-available-with-absolute-position.html 2022-06-02 12:52:52 UTC (rev 295124)
@@ -0,0 +1,15 @@
+<style>
+.fill {
+ width: 10px;
+ background-color: green;
+ height: -webkit-fill-available;
+ position: absolute;
+}
+.relative-containing-block {
+ position: relative;
+}
+</style>
+<div class=fill></div>
+<div class=relative-containing-block>
+ <div class=fill style="background-color: red"></div>
+</div>
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (295123 => 295124)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2022-06-02 08:47:49 UTC (rev 295123)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2022-06-02 12:52:52 UTC (rev 295124)
@@ -3281,6 +3281,8 @@
// Until then, this is mostly just guesswork.
if (!containingBlock)
return false;
+ if (is<RenderView>(containingBlock))
+ return true;
auto containingBlockHasSpecifiedSpace = [&] {
auto isOrthogonal = WebCore::isOrthogonal(*this, *containingBlock);
auto& style = containingBlock->style();
@@ -4478,7 +4480,7 @@
logicalHeightIsAuto = false;
} else {
if (logicalHeightLength.isIntrinsic())
- resolvedLogicalHeight = adjustContentBoxLogicalHeightForBoxSizing(computeIntrinsicLogicalContentHeightUsing(logicalHeightLength, contentLogicalHeight, bordersPlusPadding).value());
+ resolvedLogicalHeight = adjustContentBoxLogicalHeightForBoxSizing(computeIntrinsicLogicalContentHeightUsing(logicalHeightLength, contentLogicalHeight, bordersPlusPadding).value_or(0_lu));
else if (fromAspectRatio) {
resolvedLogicalHeight = blockSizeFromAspectRatio(horizontalBorderAndPaddingExtent(), verticalBorderAndPaddingExtent(), style().logicalAspectRatio(), style().boxSizingForAspectRatio(), logicalWidth());
resolvedLogicalHeight = std::max(LayoutUnit(), resolvedLogicalHeight - bordersPlusPadding);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes