[Webkit-unassigned] [Bug 259538] Potential Optimization - Avoid multiple recursions through the tree when calculating percent height

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 26 17:36:26 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=259538

--- Comment #1 from Ahmad Saleem <ahmad.saleem792 at gmail.com> ---
LayoutUnit RenderBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logicalHeight, std::optional<LayoutUnit> intrinsicContentHeight) const
{
    const RenderStyle& styleToUse = style();
    if (!styleToUse.logicalMaxHeight().isUndefined()) {
        if (styleToUse.logicalMaxHeight().isPercent() && styleToUse.logicalHeight().isPercent()) {
            LayoutUnit availableLogicalHeight = Layout::toLayoutUnit(logicalHeight / (styleToUse.logicalHeight().value() * 100));
            logicalHeight = std::min<LayoutUnit>(logicalHeight, valueForLength(styleToUse.logicalMaxHeight(), availableLogicalHeight));
        } else {
            std::optional<LayoutUnit> maxHeight = computeContentLogicalHeight(MaxSize, styleToUse.logicalMaxHeight(), -1);
            if (maxHeight != -1)
                LayoutUnit logicalHeight = std::min<LayoutUnit>(logicalHeight, maxHeight);
        }
    }

    if (styleToUse.logicalMinHeight().isPercent() && styleToUse.logicalHeight().isPercent()) {
        LayoutUnit availableLogicalHeight = Layout::toLayoutUnit(logicalHeight / (styleToUse.logicalHeight().value() * 100));
        logicalHeight = std::max<LayoutUnit>(logicalHeight, valueForLength(styleToUse.logicalMinHeight(), availableLogicalHeight));
    } else {
        logicalHeight = std::max<LayoutUnit>(logicalHeight, computeContentLogicalHeight(MinSize, styleToUse.logicalMinHeight(), intrinsicContentHeight));
    }
    return logicalHeight;
}

____________

^ Something along these lines (not compile and give error on std::min and std::max).

no matching function for call to 'max'..

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230727/db437952/attachment.htm>


More information about the webkit-unassigned mailing list