| Differences between
and this patch
- a/Source/WebCore/rendering/RenderBlock.cpp -14 / +1 lines
Lines 3005-3024 std::optional<LayoutUnit> RenderBlock::availableLogicalHeightForPercentageComput a/Source/WebCore/rendering/RenderBlock.cpp_sec1
3005
            );
3005
            );
3006
        }
3006
        }
3007
3007
3008
        auto isOutOfFlowPositionedWithDefiniteHeight = [&] {
3008
        if (isOutOfFlowPositioned() && (style.logicalHeight().isSpecified() || hasFullyConstrainedLogicalHeight())) {
3009
            if (!isOutOfFlowPositioned())
3010
                return false;
3011
            // Explicit lengths/percentages are definite (CSS Sizing 3, 3.2.1).
3012
            if (style.logicalHeight().isSpecified())
3013
                return true;
3014
            // Both insets + height:auto -> the constraint equation (CSS2 10.6.4) solves for
3015
            // height from known values (containing block, insets, margins, borders, padding).
3016
            // height:auto is the only non-specified case where this works.
3017
            // Content-dependent values (fit-content, etc.) can't be resolved here - the child is asking for
3018
            // the containig block's height to size itself, but the containing blokc needs the child's size first.
3019
            return !style.logicalTop().isAuto() && !style.logicalBottom().isAuto() && style.logicalHeight().isAuto();
3020
        };
3021
        if (isOutOfFlowPositionedWithDefiniteHeight()) {
3022
            // Don't allow this to affect the block' size() member variable, since this
3009
            // Don't allow this to affect the block' size() member variable, since this
3023
            // can get called while the block is still laying out its kids.
3010
            // can get called while the block is still laying out its kids.
3024
            return std::max(0_lu, computeLogicalHeight(logicalHeight(), 0_lu).extent - borderAndPaddingLogicalHeight() - scrollbarLogicalHeight());
3011
            return std::max(0_lu, computeLogicalHeight(logicalHeight(), 0_lu).extent - borderAndPaddingLogicalHeight() - scrollbarLogicalHeight());
- a/Source/WebCore/rendering/RenderBox.cpp +7 lines
Lines 5226-5231 bool RenderBox::shouldComputeLogicalHeightFromAspectRatio() const a/Source/WebCore/rendering/RenderBox.cpp_sec1
5226
    return h.isAuto() || h.isIntrinsic() || isUnresolveableStretchSize(h) || (!isOutOfFlowPositioned() && h.isPercentOrCalculated() && !percentageLogicalHeightIsResolvable());
5226
    return h.isAuto() || h.isIntrinsic() || isUnresolveableStretchSize(h) || (!isOutOfFlowPositioned() && h.isPercentOrCalculated() && !percentageLogicalHeightIsResolvable());
5227
}
5227
}
5228
5228
5229
bool RenderBox::hasFullyConstrainedLogicalHeight() const
5230
{
5231
    // CSS Sizing 3 section 3.2.1: "If the size is being computed in a context where
5232
    // it is fully constrained (e.g., because both inset properties are specified), the resulting size is definite."
5233
    return isOutOfFlowPositioned() && style().logicalHeight().isAuto() && !style().logicalTop().isAuto() && !style().logicalBottom().isAuto();
5234
}
5235
5229
bool RenderBox::shouldComputeLogicalWidthFromAspectRatio() const
5236
bool RenderBox::shouldComputeLogicalWidthFromAspectRatio() const
5230
{
5237
{
5231
    if (shouldIgnoreAspectRatio())
5238
    if (shouldIgnoreAspectRatio())
- a/Source/WebCore/rendering/RenderBox.h +1 lines
Lines 642-647 public: a/Source/WebCore/rendering/RenderBox.h_sec1
642
    virtual FloatSize preferredAspectRatioAsSize() const;
642
    virtual FloatSize preferredAspectRatioAsSize() const;
643
643
644
    bool shouldComputeLogicalWidthFromAspectRatio() const;
644
    bool shouldComputeLogicalWidthFromAspectRatio() const;
645
    bool hasFullyConstrainedLogicalHeight() const;
645
646
646
protected:
647
protected:
647
    RenderBox(Type, Element&, RenderStyle&&, OptionSet<TypeFlag> = { }, TypeSpecificFlags = { });
648
    RenderBox(Type, Element&, RenderStyle&&, OptionSet<TypeFlag> = { }, TypeSpecificFlags = { });
- a/Source/WebCore/rendering/RenderFlexibleBox.cpp -2 / +10 lines
Lines 1419-1425 bool RenderFlexibleBox::hasDefiniteCrossSizeForFlexItem(const RenderBox& flexIte a/Source/WebCore/rendering/RenderFlexibleBox.cpp_sec1
1419
            return true;
1419
            return true;
1420
        // This must be kept in sync with computeMainSizeFromAspectRatioUsing().
1420
        // This must be kept in sync with computeMainSizeFromAspectRatioUsing().
1421
        auto& crossSize = isHorizontalFlow() ? style().height() : style().width();
1421
        auto& crossSize = isHorizontalFlow() ? style().height() : style().width();
1422
        return crossSize.isFixed() || (crossSize.isPercent() && availableLogicalHeightForPercentageComputation());
1422
        if (crossSize.isFixed())
1423
            return true;
1424
        if (crossSize.isPercent() && availableLogicalHeightForPercentageComputation())
1425
            return true;
1426
        if (hasFullyConstrainedLogicalHeight())
1427
            return true;
1423
    }
1428
    }
1424
    return false;
1429
    return false;
1425
}
1430
}
Lines 2331-2342 LayoutUnit RenderFlexibleBox::innerCrossSizeForFlexItem(const RenderBox& flexIte a/Source/WebCore/rendering/RenderFlexibleBox.cpp_sec2
2331
    auto flexContainerInnerCrossSize = [&] {
2336
    auto flexContainerInnerCrossSize = [&] {
2332
        auto isHorizontal = isHorizontalFlow();
2337
        auto isHorizontal = isHorizontalFlow();
2333
        auto size = isHorizontal ? style().height() : style().width();
2338
        auto size = isHorizontal ? style().height() : style().width();
2334
        ASSERT(size.isFixed() || (size.isPercent() && availableLogicalHeightForPercentageComputation()));
2335
        auto innerCrossSize = LayoutUnit { };
2339
        auto innerCrossSize = LayoutUnit { };
2336
        if (auto fixedSize = size.tryFixed())
2340
        if (auto fixedSize = size.tryFixed())
2337
            innerCrossSize = adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit { fixedSize->resolveZoom(style().usedZoomForLength()) });
2341
            innerCrossSize = adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit { fixedSize->resolveZoom(style().usedZoomForLength()) });
2338
        else if (size.isPercent())
2342
        else if (size.isPercent())
2339
            innerCrossSize = availableLogicalHeightForPercentageComputation().value_or(0_lu);
2343
            innerCrossSize = availableLogicalHeightForPercentageComputation().value_or(0_lu);
2344
        else if (hasFullyConstrainedLogicalHeight())
2345
            innerCrossSize = std::max(0_lu, computeLogicalHeight(logicalHeight(), 0_lu).extent - borderAndPaddingLogicalHeight() - scrollbarLogicalHeight());
2346
        else
2347
            ASSERT_NOT_REACHED();
2340
2348
2341
        auto maximumSize = isHorizontal ? style().maxHeight() : style().maxWidth();
2349
        auto maximumSize = isHorizontal ? style().maxHeight() : style().maxWidth();
2342
        if (auto fixedMaximumSize = maximumSize.tryFixed())
2350
        if (auto fixedMaximumSize = maximumSize.tryFixed())
- a/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-abspos-inset-cross-size-001-expected.html +28 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-abspos-inset-cross-size-001-expected.html_sec1
1
<!DOCTYPE html>
2
<title>Reference</title>
3
<style>
4
.holder {
5
  height: 200px;
6
  position: relative;
7
}
8
9
.flex {
10
  display: flex;
11
  height: 200px;
12
}
13
14
img {
15
  display: block;
16
}
17
</style>
18
<p>Test passes if the two images below are the same size.</p>
19
<div class="holder">
20
  <div class="flex">
21
    <img src="../support/1x1-green.png">
22
  </div>
23
</div>
24
<div class="holder">
25
  <div class="flex">
26
    <img src="../support/1x1-green.png">
27
  </div>
28
</div>
- a/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-abspos-inset-cross-size-001-ref.html +28 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-abspos-inset-cross-size-001-ref.html_sec1
1
<!DOCTYPE html>
2
<title>Reference</title>
3
<style>
4
.holder {
5
  height: 200px;
6
  position: relative;
7
}
8
9
.flex {
10
  display: flex;
11
  height: 200px;
12
}
13
14
img {
15
  display: block;
16
}
17
</style>
18
<p>Test passes if the two images below are the same size.</p>
19
<div class="holder">
20
  <div class="flex">
21
    <img src="../support/1x1-green.png">
22
  </div>
23
</div>
24
<div class="holder">
25
  <div class="flex">
26
    <img src="../support/1x1-green.png">
27
  </div>
28
</div>
- a/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-abspos-inset-cross-size-001.html +32 lines
Line 0 a/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-abspos-inset-cross-size-001.html_sec1
1
<!DOCTYPE html>
2
<title>Abspos flex container with inset-derived height provides definite cross size to flex items</title>
3
<link rel="help" href="https://drafts.csswg.org/css-flexbox-1/#definite-sizes">
4
<link rel="match" href="flex-abspos-inset-cross-size-001-ref.html">
5
<style>
6
.holder {
7
  height: 200px;
8
  position: relative;
9
}
10
11
.flex {
12
  display: flex;
13
  position: absolute;
14
  top: 0;
15
  bottom: 0;
16
}
17
18
img {
19
  display: block;
20
}
21
</style>
22
<p>Test passes if the two images below are the same size.</p>
23
<div class="holder">
24
  <div class="flex">
25
    <img src="../support/1x1-green.png">
26
  </div>
27
</div>
28
<div class="holder">
29
  <div class="flex" style="position: static; height: 200px;">
30
    <img src="../support/1x1-green.png">
31
  </div>
32
</div>

Return to Bug 264043