| Summary: | Potential Optimization - Avoid multiple recursions through the tree when calculating percent height | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ahmad Saleem <ahmad.saleem792> |
| Component: | Layout and Rendering | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW --- | ||
| Severity: | Normal | CC: | bfulgham, simon.fraser, webkit-bug-importer, zalan |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | https://jsfiddle.net/stwre9j6/show | ||
|
Description
Ahmad Saleem
2023-07-26 16:56:41 PDT
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'..
This compiles:
LayoutUnit RenderBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logicalHeight, std::optional<LayoutUnit> intrinsicContentHeight) const
{
// If the min/max height and logical height are both percentages we take advantage of already knowing the current resolved percentage height
// to avoid recursing up through our containing blocks again to determine it.
const RenderStyle& styleToUse = style();
if (!styleToUse.logicalMaxHeight().isUndefined()) {
if (styleToUse.logicalMaxHeight().isPercent() && styleToUse.logicalHeight().isPercent()) {
auto availableLogicalHeight = logicalHeight / (styleToUse.logicalHeight().value() * 100);
logicalHeight = std::min(logicalHeight, valueForLength(styleToUse.logicalMaxHeight(), availableLogicalHeight));
} else {
std::optional<LayoutUnit> maxH = computeContentLogicalHeight(MaxSize, styleToUse.logicalMaxHeight(), intrinsicContentHeight);
logicalHeight = std::min(logicalHeight, maxH.value());
}
}
if (styleToUse.logicalMinHeight().isPercent() && styleToUse.logicalHeight().isPercent()) {
auto availableLogicalHeight = logicalHeight / (styleToUse.logicalHeight().value() * 100);
logicalHeight = std::max(logicalHeight, valueForLength(styleToUse.logicalMinHeight(), availableLogicalHeight));
} else {
if (std::optional<LayoutUnit> computedContentLogicalHeight = computeContentLogicalHeight(MinSize, styleToUse.logicalMinHeight(), intrinsicContentHeight))
return std::max(logicalHeight, computedContentLogicalHeight.value());
}
return logicalHeight;
}
__
Plus with this I get following in JSFiddle:
Running 20 times
Ignoring warm-up run (4405.269761606022 runs/s)
4416.562107904646 runs/s
4416.56210790464 runs/s
4400.000000000003 runs/s
4433.249370277081 runs/s
4383.561643835616 runs/s
4422.110552763819 runs/s
4444.44444444445 runs/s
4438.839848675909 runs/s
4416.562107904652 runs/s
4405.506883604496 runs/s
4422.110552763819 runs/s
4438.839848675914 runs/s
4394.5068664169785 runs/s
4433.249370277088 runs/s
4416.562107904622 runs/s
4433.249370277088 runs/s
4438.839848675914 runs/s
4422.110552763819 runs/s
4427.672955974843 runs/s
4405.506883604486 runs/s
Description: Measures performance of nested divs with percent values for height and max-height.
Time:
values 4416.562107904646, 4416.56210790464, 4400.000000000003, 4433.249370277081, 4383.561643835616, 4422.110552763819, 4444.44444444445, 4438.839848675909, 4416.562107904652, 4405.506883604496, 4422.110552763819, 4438.839848675914, 4394.5068664169785, 4433.249370277088, 4416.562107904622, 4433.249370277088, 4438.839848675914, 4422.110552763819, 4427.672955974843, 4405.506883604486 runs/s
avg 4420.502371232495 runs/s
median 4422.110552763819 runs/s
stdev 16.38550213770903 runs/s
min 4383.561643835616 runs/s
max 4444.44444444445 runs/s
(In reply to Ahmad Saleem from comment #3) > This compiles: > > LayoutUnit RenderBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit > logicalHeight, std::optional<LayoutUnit> intrinsicContentHeight) const > { > // If the min/max height and logical height are both percentages we take > advantage of already knowing the current resolved percentage height > // to avoid recursing up through our containing blocks again to > determine it. > const RenderStyle& styleToUse = style(); > if (!styleToUse.logicalMaxHeight().isUndefined()) { > if (styleToUse.logicalMaxHeight().isPercent() && > styleToUse.logicalHeight().isPercent()) { > auto availableLogicalHeight = logicalHeight / > (styleToUse.logicalHeight().value() * 100); > logicalHeight = std::min(logicalHeight, > valueForLength(styleToUse.logicalMaxHeight(), availableLogicalHeight)); > } else { > std::optional<LayoutUnit> maxH = > computeContentLogicalHeight(MaxSize, styleToUse.logicalMaxHeight(), > intrinsicContentHeight); > logicalHeight = std::min(logicalHeight, maxH.value()); > } > } > > if (styleToUse.logicalMinHeight().isPercent() && > styleToUse.logicalHeight().isPercent()) { > auto availableLogicalHeight = logicalHeight / > (styleToUse.logicalHeight().value() * 100); > logicalHeight = std::max(logicalHeight, > valueForLength(styleToUse.logicalMinHeight(), availableLogicalHeight)); > } else { > if (std::optional<LayoutUnit> computedContentLogicalHeight = > computeContentLogicalHeight(MinSize, styleToUse.logicalMinHeight(), > intrinsicContentHeight)) > return std::max(logicalHeight, > computedContentLogicalHeight.value()); > } > > return logicalHeight; > } > > __ > > Plus with this I get following in JSFiddle: > > Running 20 times > Ignoring warm-up run (4405.269761606022 runs/s) > 4416.562107904646 runs/s > 4416.56210790464 runs/s > 4400.000000000003 runs/s > 4433.249370277081 runs/s > 4383.561643835616 runs/s > 4422.110552763819 runs/s > 4444.44444444445 runs/s > 4438.839848675909 runs/s > 4416.562107904652 runs/s > 4405.506883604496 runs/s > 4422.110552763819 runs/s > 4438.839848675914 runs/s > 4394.5068664169785 runs/s > 4433.249370277088 runs/s > 4416.562107904622 runs/s > 4433.249370277088 runs/s > 4438.839848675914 runs/s > 4422.110552763819 runs/s > 4427.672955974843 runs/s > 4405.506883604486 runs/s > Description: Measures performance of nested divs with percent values for > height and max-height. > > Time: > values 4416.562107904646, 4416.56210790464, 4400.000000000003, > 4433.249370277081, 4383.561643835616, 4422.110552763819, 4444.44444444445, > 4438.839848675909, 4416.562107904652, 4405.506883604496, 4422.110552763819, > 4438.839848675914, 4394.5068664169785, 4433.249370277088, 4416.562107904622, > 4433.249370277088, 4438.839848675914, 4422.110552763819, 4427.672955974843, > 4405.506883604486 runs/s > avg 4420.502371232495 runs/s > median 4422.110552763819 runs/s > stdev 16.38550213770903 runs/s > min 4383.561643835616 runs/s > max 4444.44444444445 runs/s This will lead to crashes on https://pakgamers.com/index.php while 'run-mini browser --release' (Partial Output): Translated Report (Full Report Below) ------------------------------------- Process: com.apple.WebKit.WebContent.Development [17645] Path: /Users/USER/Documents/*/com.apple.WebKit.WebContent.Development Identifier: com.apple.WebKit.WebContent Version: 619+ (619.1.1+) Code Type: ARM-64 (Native) Parent Process: launchd [1] Responsible: MiniBrowser [17530] User ID: 501 Date/Time: 2024-01-26 14:20:23.8730 +0000 OS Version: macOS 14.3 (23D56) Report Version: 12 Anonymous UUID: 0DA56C0F-DBEC-AF95-3B04-AC72B10B438B Sleep/Wake UUID: 51EEEA82-157D-4342-892A-6D2868A13E8C Time Awake Since Boot: 160000 seconds Time Since Wake: 1343 seconds System Integrity Protection: enabled Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6 Terminating Process: com.apple.WebKit.WebContent.Deve [17645] Application Specific Information: abort() called Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x181a360dc __pthread_kill + 8 1 libsystem_pthread.dylib 0x181a6dcc0 pthread_kill + 288 2 libsystem_c.dylib 0x181979a40 abort + 180 3 WebCore 0x115b72f28 std::__1::__throw_bad_optional_access[abi:v160006]() + 12 (optional:214) 4 WebCore 0x1179182ec std::__1::optional<WebCore::LayoutUnit>::value[abi:v160006]() & + 4 (optional:1004) [inlined] 5 WebCore 0x1179182ec WebCore::RenderBox::constrainContentBoxLogicalHeightByMinMax(WebCore::LayoutUnit, std::__1::optional<WebCore::LayoutUnit>) const + 608 (RenderBox.cpp:766) 6 WebCore 0x117948058 WebCore::RenderBox::availableLogicalHeightUsing(WebCore::Length const&, WebCore::AvailableLogicalHeightType) const + 1452 (RenderBox.cpp:3826) 7 WebCore 0x117947a94 WebCore::RenderBox::availableLogicalHeight(WebCore::AvailableLogicalHeightType) const + 64 (RenderBox.cpp:3785) 8 WebCore 0x117948058 WebCore::RenderBox::availableLogicalHeightUsing(WebCore::Length const&, WebCore::AvailableLogicalHeightType) const + 1452 (RenderBox.cpp:3826) 9 WebCore 0x117947a94 WebCore::RenderBox::availableLogicalHeight(WebCore::AvailableLogicalHeightType) const + 64 (RenderBox.cpp:3785) 10 WebCore 0x117948058 WebCore::RenderBox::availableLogicalHeightUsing(WebCore::Length const&, WebCore::AvailableLogicalHeightType) const + 1452 (RenderBox.cpp:3826) 11 WebCore 0x117947a94 WebCore::RenderBox::availableLogicalHeight(WebCore::AvailableLogicalHeightType) const + 64 (RenderBox.cpp:3785) 12 WebCore 0x117948058 WebCore::RenderBox::availableLogicalHeightUsing(WebCore::Length const&, WebCore::AvailableLogicalHeightType) const + 1452 (RenderBox.cpp:3826) 13 WebCore 0x117947a94 WebCore::RenderBox::availableLogicalHeight(WebCore::AvailableLogicalHeightType) const + 64 (RenderBox.cpp:3785) 14 WebCore 0x117948058 WebCore::RenderBox::availableLogicalHeightUsing(WebCore::Length const&, WebCore::AvailableLogicalHeightType) const + 1452 (RenderBox.cpp:3826) 15 WebCore 0x117947a94 WebCore::RenderBox::availableLogicalHeight(WebCore::AvailableLogicalHeightType) const + 64 (RenderBox.cpp:3785) 16 WebCore 0x117948058 WebCore::RenderBox::availableLogicalHeightUsing(WebCore::Length const&, WebCore::AvailableLogicalHeightType) const + 1452 (RenderBox.cpp:3826) 17 WebCore 0x117947a94 WebCore::RenderBox::availableLogicalHeight(WebCore::AvailableLogicalHeightType) const + 64 (RenderBox.cpp:3785) 18 WebCore 0x11793da00 WebCore::RenderBox::containingBlockAvailableLineWidthInFragment(WebCore::RenderFragmentContainer*) const + 192 (RenderBox.cpp:2362) 19 WebCore 0x117a1c2a4 WebCore::RenderTable::updateLogicalWidth() + 1712 (RenderTable.cpp:326) 20 WebCore 0x117a1d6fc WebCore::RenderTable::layout() + 348 (RenderTable.cpp:468) 21 WebCore 0x117922a24 WebCore::RenderBlockFlow::layoutBlockChild(WebCore::RenderBox&, WebCore::RenderBlockFlow::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 1044 (RenderBlockFlow.cpp:1116) 22 WebCore 0x117921f2c WebCore::RenderBlockFlow::layoutBlockChildren(bool, WebCore::LayoutUnit&) + 1056 (RenderBlockFlow.cpp:934) 23 WebCore 0x11792064c WebCore::RenderBlockFlow::layoutInFlowChildren(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 116 (RenderBlockFlow.cpp:829) 24 WebCore 0x11791f618 WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit) + 1340 (RenderBlockFlow.cpp:551) 25 WebCore 0x117905b64 WebCore::RenderBlock::layout() + 56 (RenderBlock.cpp:582) 26 WebCore 0x117922a24 WebCore::RenderBlockFlow::layoutBlockChild(WebCore::RenderBox&, WebCore::RenderBlockFlow::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 1044 (RenderBlockFlow.cpp:1116) 27 WebCore 0x117921f2c WebCore::RenderBlockFlow::layoutBlockChildren(bool, WebCore::LayoutUnit&) + 1056 (RenderBlockFlow.cpp:934) 28 WebCore 0x11792064c WebCore::RenderBlockFlow::layoutInFlowChildren(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 116 (RenderBlockFlow.cpp:829) 29 WebCore 0x11791f618 WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit) + 1340 (RenderBlockFlow.cpp:551) 30 WebCore 0x117905b64 WebCore::RenderBlock::layout() + 56 (RenderBlock.cpp:582) 31 WebCore 0x117922a24 WebCore::RenderBlockFlow::layoutBlockChild(WebCore::RenderBox&, WebCore::RenderBlockFlow::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 1044 (RenderBlockFlow.cpp:1116) 32 WebCore 0x117921f2c WebCore::RenderBlockFlow::layoutBlockChildren(bool, WebCore::LayoutUnit&) + 1056 (RenderBlockFlow.cpp:934) 33 WebCore 0x11792064c WebCore::RenderBlockFlow::layoutInFlowChildren(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 116 (RenderBlockFlow.cpp:829) 34 WebCore 0x11791f618 WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit) + 1340 (RenderBlockFlow.cpp:551) 35 WebCore 0x117905b64 WebCore::RenderBlock::layout() + 56 (RenderBlock.cpp:582) 36 WebCore 0x117922a24 WebCore::RenderBlockFlow::layoutBlockChild(WebCore::RenderBox&, WebCore::RenderBlockFlow::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 1044 (RenderBlockFlow.cpp:1116) 37 WebCore 0x117921f2c WebCore::RenderBlockFlow::layoutBlockChildren(bool, WebCore::LayoutUnit&) + 1056 (RenderBlockFlow.cpp:934) 38 WebCore 0x11792064c WebCore::RenderBlockFlow::layoutInFlowChildren(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 116 (RenderBlockFlow.cpp:829) 39 WebCore 0x11791f618 WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit) + 1340 (RenderBlockFlow.cpp:551) 40 WebCore 0x117905b64 WebCore::RenderBlock::layout() + 56 (RenderBlock.cpp:582) 41 WebCore 0x117922a24 WebCore::RenderBlockFlow::layoutBlockChild(WebCore::RenderBox&, WebCore::RenderBlockFlow::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 1044 (RenderBlockFlow.cpp:1116) 42 WebCore 0x117921f2c WebCore::RenderBlockFlow::layoutBlockChildren(bool, WebCore::LayoutUnit&) + 1056 (RenderBlockFlow.cpp:934) 43 WebCore 0x11792064c WebCore::RenderBlockFlow::layoutInFlowChildren(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 116 (RenderBlockFlow.cpp:829) 44 WebCore 0x11791f618 WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit) + 1340 (RenderBlockFlow.cpp:551) 45 WebCore 0x117905b64 WebCore::RenderBlock::layout() + 56 (RenderBlock.cpp:582) 46 WebCore 0x117922a24 WebCore::RenderBlockFlow::layoutBlockChild(WebCore::RenderBox&, WebCore::RenderBlockFlow::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 1044 (RenderBlockFlow.cpp:1116) 47 WebCore 0x117921f2c WebCore::RenderBlockFlow::layoutBlockChildren(bool, WebCore::LayoutUnit&) + 1056 (RenderBlockFlow.cpp:934) 48 WebCore 0x11792064c WebCore::RenderBlockFlow::layoutInFlowChildren(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 116 (RenderBlockFlow.cpp:829) 49 WebCore 0x11791f618 WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit) + 1340 (RenderBlockFlow.cpp:551) 50 WebCore 0x117905b64 WebCore::RenderBlock::layout() + 56 (RenderBlock.cpp:582) 51 WebCore 0x11797b134 WebCore::RenderElement::layoutIfNeeded() + 60 (RenderElement.cpp:2443) [inlined] 52 WebCore 0x11797b134 WebCore::RenderFlexibleBox::layoutAndPlaceChildren(WebCore::LayoutUnit&, WTF::Vector<WebCore::FlexItem, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>&, WebCore::LayoutUnit, bool, WTF::Vector<WebCore::RenderFlexibleBox::LineState, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>&, WebCore::LayoutUnit) + 1756 (RenderFlexibleBox.cpp:2229) 53 WebCore 0x117975050 WebCore::RenderFlexibleBox::layoutFlexItems(bool) + 1084 (RenderFlexibleBox.cpp:1377) 54 WebCore 0x11797464c WebCore::RenderFlexibleBox::layoutBlock(bool, WebCore::LayoutUnit) + 912 (RenderFlexibleBox.cpp:462) 55 WebCore 0x117905b64 WebCore::RenderBlock::layout() + 56 (RenderBlock.cpp:582) 56 WebCore 0x117922a24 WebCore::RenderBlockFlow::layoutBlockChild(WebCore::RenderBox&, WebCore::RenderBlockFlow::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 1044 (RenderBlockFlow.cpp:1116) 57 WebCore 0x117921f2c WebCore::RenderBlockFlow::layoutBlockChildren(bool, WebCore::LayoutUnit&) + 1056 (RenderBlockFlow.cpp:934) 58 WebCore 0x11792064c WebCore::RenderBlockFlow::layoutInFlowChildren(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 116 (RenderBlockFlow.cpp:829) 59 WebCore 0x11791f618 WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit) + 1340 (RenderBlockFlow.cpp:551) 60 WebCore 0x117905b64 WebCore::RenderBlock::layout() + 56 (RenderBlock.cpp:582) 61 WebCore 0x117979694 WebCore::RenderElement::layoutIfNeeded() + 16 (RenderElement.cpp:2443) [inlined] 62 WebCore 0x117979694 WebCore::RenderFlexibleBox::maybeCacheChildMainIntrinsicSize(WebCore::RenderBox&, bool) + 328 (RenderFlexibleBox.cpp:1696) 63 WebCore 0x117979268 WebCore::RenderFlexibleBox::computeFlexBaseSizeForChild(WebCore::RenderBox&, WebCore::LayoutUnit, bool) + 284 (RenderFlexibleBox.cpp:1269) 64 WebCore 0x11797a284 WebCore::RenderFlexibleBox::constructFlexItem(WebCore::RenderBox&, bool) + 324 (RenderFlexibleBox.cpp:1713) 65 WebCore 0x117974cf8 WebCore::RenderFlexibleBox::layoutFlexItems(bool) + 228 (RenderFlexibleBox.cpp:1322) 66 WebCore 0x11797464c WebCore::RenderFlexibleBox::layoutBlock(bool, WebCore::LayoutUnit) + 912 (RenderFlexibleBox.cpp:462) 67 WebCore 0x117905b64 WebCore::RenderBlock::layout() + 56 (RenderBlock.cpp:582) 68 WebCore 0x11797b134 WebCore::RenderElement::layoutIfNeeded() + 60 (RenderElement.cpp:2443) [inlined] 69 WebCore 0x11797b134 WebCore::RenderFlexibleBox::layoutAndPlaceChildren(WebCore::LayoutUnit&, WTF::Vector<WebCore::FlexItem, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>&, WebCore::LayoutUnit, bool, WTF::Vector<WebCore::RenderFlexibleBox::LineState, 0ul, WTF::CrashOnOverflow, 16ul, WTF::FastMalloc>&, WebCore::LayoutUnit) + 1756 (RenderFlexibleBox.cpp:2229) 70 WebCore 0x117975050 WebCore::RenderFlexibleBox::layoutFlexItems(bool) + 1084 (RenderFlexibleBox.cpp:1377) 71 WebCore 0x11797464c WebCore::RenderFlexibleBox::layoutBlock(bool, WebCore::LayoutUnit) + 912 (RenderFlexibleBox.cpp:462) 72 WebCore 0x117905b64 WebCore::RenderBlock::layout() + 56 (RenderBlock.cpp:582) 73 WebCore 0x117979694 WebCore::RenderElement::layoutIfNeeded() + 16 (RenderElement.cpp:2443) [inlined] 74 WebCore 0x117979694 WebCore::RenderFlexibleBox::maybeCacheChildMainIntrinsicSize(WebCore::RenderBox&, bool) + 328 (RenderFlexibleBox.cpp:1696) 75 WebCore 0x117979268 WebCore::RenderFlexibleBox::computeFlexBaseSizeForChild(WebCore::RenderBox&, WebCore::LayoutUnit, bool) + 284 (RenderFlexibleBox.cpp:1269) 76 WebCore 0x11797a284 WebCore::RenderFlexibleBox::constructFlexItem(WebCore::RenderBox&, bool) + 324 (RenderFlexibleBox.cpp:1713) 77 WebCore 0x117974cf8 WebCore::RenderFlexibleBox::layoutFlexItems(bool) + 228 (RenderFlexibleBox.cpp:1322) 78 WebCore 0x11797464c WebCore::RenderFlexibleBox::layoutBlock(bool, WebCore::LayoutUnit) + 912 (RenderFlexibleBox.cpp:462) 79 WebCore 0x117905b64 WebCore::RenderBlock::layout() + 56 (RenderBlock.cpp:582) 80 WebCore 0x117922a24 WebCore::RenderBlockFlow::layoutBlockChild(WebCore::RenderBox&, WebCore::RenderBlockFlow::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 1044 (RenderBlockFlow.cpp:1116) 81 WebCore 0x117921f2c WebCore::RenderBlockFlow::layoutBlockChildren(bool, WebCore::LayoutUnit&) + 1056 (RenderBlockFlow.cpp:934) 82 WebCore 0x11792064c WebCore::RenderBlockFlow::layoutInFlowChildren(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 116 (RenderBlockFlow.cpp:829) 83 WebCore 0x11791f618 WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit) + 1340 (RenderBlockFlow.cpp:551) 84 WebCore 0x117905b64 WebCore::RenderBlock::layout() + 56 (RenderBlock.cpp:582) 85 WebCore 0x117922a24 WebCore::RenderBlockFlow::layoutBlockChild(WebCore::RenderBox&, WebCore::RenderBlockFlow::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 1044 (RenderBlockFlow.cpp:1116) 86 WebCore 0x117921f2c WebCore::RenderBlockFlow::layoutBlockChildren(bool, WebCore::LayoutUnit&) + 1056 (RenderBlockFlow.cpp:934) 87 WebCore 0x11792064c WebCore::RenderBlockFlow::layoutInFlowChildren(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 116 (RenderBlockFlow.cpp:829) 88 WebCore 0x11791f618 WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit) + 1340 (RenderBlockFlow.cpp:551) 89 WebCore 0x117905b64 WebCore::RenderBlock::layout() + 56 (RenderBlock.cpp:582) 90 WebCore 0x117922a24 WebCore::RenderBlockFlow::layoutBlockChild(WebCore::RenderBox&, WebCore::RenderBlockFlow::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 1044 (RenderBlockFlow.cpp:1116) 91 WebCore 0x117921f2c WebCore::RenderBlockFlow::layoutBlockChildren(bool, WebCore::LayoutUnit&) + 1056 (RenderBlockFlow.cpp:934) 92 WebCore 0x11792064c WebCore::RenderBlockFlow::layoutInFlowChildren(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 116 (RenderBlockFlow.cpp:829) 93 WebCore 0x11791f618 WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit) + 1340 (RenderBlockFlow.cpp:551) 94 WebCore 0x117905b64 WebCore::RenderBlock::layout() + 56 (RenderBlock.cpp:582) 95 WebCore 0x117922a24 WebCore::RenderBlockFlow::layoutBlockChild(WebCore::RenderBox&, WebCore::RenderBlockFlow::MarginInfo&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 1044 (RenderBlockFlow.cpp:1116) 96 WebCore 0x117921f2c WebCore::RenderBlockFlow::layoutBlockChildren(bool, WebCore::LayoutUnit&) + 1056 (RenderBlockFlow.cpp:934) 97 WebCore 0x11792064c WebCore::RenderBlockFlow::layoutInFlowChildren(bool, WebCore::LayoutUnit&, WebCore::LayoutUnit&, WebCore::LayoutUnit&) + 116 (RenderBlockFlow.cpp:829) 98 WebCore 0x11791f618 WebCore::RenderBlockFlow::layoutBlock(bool, WebCore::LayoutUnit) + 1340 (RenderBlockFlow.cpp:551) 99 WebCore 0x117905b64 WebCore::RenderBlock::layout() + 56 (RenderBlock.cpp:582) 100 WebCore 0x117a5ee30 WebCore::RenderView::layout() + 700 (RenderView.cpp:199) 101 WebCore 0x11751e848 WebCore::LocalFrameViewLayoutContext::performLayout() + 856 (LocalFrameViewLayoutContext.cpp:236) 102 WebCore 0x117508a90 WebCore::LocalFrameViewLayoutContext::layout() + 40 (LocalFrameViewLayoutContext.cpp:151) 103 WebCore 0x116ec98d0 WebCore::Document::updateLayout(WTF::OptionSet<WebCore::LayoutOptions>, WebCore::Element const*) + 640 (Document.cpp:2710) 104 WebCore 0x116ef1d6c WebCore::Document::hitTest(WebCore::HitTestRequest const&, WebCore::HitTestLocation const&, WebCore::HitTestResult&) + 128 (Document.cpp:9910) 105 WebCore 0x116ed7fc4 WebCore::Document::hitTest(WebCore::HitTestRequest const&, WebCore::HitTestResult&) + 20 (Document.cpp:9893) [inlined] 106 WebCore 0x116ed7fc4 WebCore::Document::prepareMouseEvent(WebCore::HitTestRequest const&, WebCore::LayoutPoint const&, WebCore::PlatformMouseEvent const&) + 160 (Document.cpp:4785) 107 WebCore 0x1174d0bb8 WebCore::EventHandler::prepareMouseEvent(WebCore::HitTestRequest const&, WebCore::PlatformMouseEvent const&) + 316 (EventHandler.cpp:2679) 108 WebCore 0x1174d12e0 WebCore::EventHandler::handleMouseMoveEvent(WebCore::PlatformMouseEvent const&, WebCore::HitTestResult*, bool) + 840 (EventHandler.cpp:2137) 109 WebCore 0x1174d0e5c WebCore::EventHandler::mouseMoved(WebCore::PlatformMouseEvent const&) + 220 (EventHandler.cpp:2033) 110 WebKit 0x108a70894 WebKit::WebFrame::handleMouseEvent(WebKit::WebMouseEvent const&) + 456 (WebFrame.cpp:1269) 111 WebKit 0x108bdc928 This compiles and does not seems to crash:
LayoutUnit RenderBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logicalHeight, std::optional<LayoutUnit> intrinsicContentHeight) const
{
// If the min/max height and logical height are both percentages we take advantage of already knowing the current resolved percentage height
// to avoid recursing up through our containing blocks again to determine it.
const RenderStyle& styleToUse = style();
if (!styleToUse.logicalMaxHeight().isUndefined()) {
if (styleToUse.logicalMaxHeight().isPercent() && styleToUse.logicalHeight().isPercent()) {
auto availableLogicalHeight = logicalHeight / (styleToUse.logicalHeight().value() * 100);
logicalHeight = std::min(logicalHeight, valueForLength(styleToUse.logicalMaxHeight(), availableLogicalHeight));
} else {
if (std::optional<LayoutUnit> maxH = computeContentLogicalHeight(MaxSize, styleToUse.logicalMaxHeight(), intrinsicContentHeight))
logicalHeight = std::min(logicalHeight, maxH.value());
}
}
if (styleToUse.logicalMinHeight().isPercent() && styleToUse.logicalHeight().isPercent()) {
auto availableLogicalHeight = logicalHeight / (styleToUse.logicalHeight().value() * 100);
logicalHeight = std::max(logicalHeight, valueForLength(styleToUse.logicalMinHeight(), availableLogicalHeight));
} else {
if (std::optional<LayoutUnit> computedContentLogicalHeight = computeContentLogicalHeight(MinSize, styleToUse.logicalMinHeight(), intrinsicContentHeight))
return std::max(logicalHeight, computedContentLogicalHeight.value());
}
return logicalHeight;
}
|