Changeset 295094 in webkit


Ignore:
Timestamp:
Jun 1, 2022 10:26:14 AM (2 years ago)
Author:
Alan Bujtas
Message:

Spacing after some posts is too large on Dead by Daylight forums
https://bugs.webkit.org/show_bug.cgi?id=241104
<rdar://88110302>

Reviewed by Antti Koivisto.

Do not cross containing block boundary while resolving fill-available. If the containing block does not specify the constraint value for the fill-available descendant, we should just return "can't resolve" instead of climbing the containing block tree and potentially hit the ICB as the first container with fixed height(width).

  • LayoutTests/fast/block/fill-available-with-no-specified-containing-block-height-expected.html: Added.
  • LayoutTests/fast/block/fill-available-with-no-specified-containing-block-height.html: Added.
  • Source/WebCore/rendering/RenderBox.cpp:

(WebCore::isOrthogonal):
(WebCore::RenderBox::computeIntrinsicLogicalContentHeightUsing const):

Canonical link: https://commits.webkit.org/251189@main

Location:
trunk
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r294744 r295094  
    32603260}
    32613261
     3262static inline bool isOrthogonal(const RenderBox& renderer, const RenderElement& ancestor)
     3263{
     3264    return renderer.isHorizontalWritingMode() != ancestor.isHorizontalWritingMode();
     3265}
     3266
    32623267std::optional<LayoutUnit> RenderBox::computeIntrinsicLogicalContentHeightUsing(Length logicalHeightLength, std::optional<LayoutUnit> intrinsicContentHeight, LayoutUnit borderAndPadding) const
    32633268{
     
    32673272        if (intrinsicContentHeight)
    32683273            return adjustIntrinsicLogicalHeightForBoxSizing(intrinsicContentHeight.value());
    3269         return std::nullopt;
    3270     }
    3271     if (logicalHeightLength.isFillAvailable())
    3272         return containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadding) - borderAndPadding;
     3274        return { };
     3275    }
     3276    if (logicalHeightLength.isFillAvailable()) {
     3277        auto* containingBlock = this->containingBlock();
     3278
     3279        auto canResolveAvailableSpace = [&] {
     3280            // FIXME: We need to find a way to say: yes, the constraint value is set and we can resolve height against it.
     3281            // Until then, this is mostly just guesswork.
     3282            if (!containingBlock)
     3283                return false;
     3284            auto containingBlockHasSpecifiedSpace = [&] {
     3285                auto isOrthogonal = WebCore::isOrthogonal(*this, *containingBlock);
     3286                auto& style = containingBlock->style();
     3287                if ((!isOrthogonal && style.height().isSpecified()) || (isOrthogonal && style.width().isSpecified()))
     3288                    return true;
     3289                if (containingBlock->isOutOfFlowPositioned()) {
     3290                    if ((!isOrthogonal && !style.top().isAuto() && !style.bottom().isAuto()) || (isOrthogonal && !style.left().isAuto() && !style.right().isAuto()))
     3291                        return true;
     3292                }
     3293                return false;
     3294            };
     3295            return containingBlockHasSpecifiedSpace() || containingBlock->hasOverridingLogicalHeight();
     3296        };
     3297        if (canResolveAvailableSpace())
     3298            return containingBlock->availableLogicalHeight(ExcludeMarginBorderPadding) - borderAndPadding;
     3299        return { };
     3300    }
    32733301    ASSERT_NOT_REACHED();
    32743302    return 0_lu;
     
    36313659}
    36323660
    3633 // FIXME: evaluate whether this should be a method of RenderObject instead.
    3634 static inline bool isOrthogonal(const RenderObject& renderer, const RenderObject& ancestor)
    3635 {
    3636     return renderer.isHorizontalWritingMode() != ancestor.isHorizontalWritingMode();
    3637 }
    3638 
    36393661LayoutUnit RenderBox::availableLogicalHeightUsing(const Length& h, AvailableLogicalHeightType heightType) const
    36403662{
     
    38203842        return;
    38213843
    3822     RenderObject* parent = child->parent();
     3844    auto* parent = child->parent();
    38233845    TextDirection parentDirection = parent->style().direction();
    38243846
     
    42574279        return;
    42584280   
    4259     RenderObject* parent = child->parent();
     4281    auto* parent = child->parent();
    42604282
    42614283    // The static positions from the child's layer are relative to the container block's coordinate space (which is determined
Note: See TracChangeset for help on using the changeset viewer.