Bug 279033
| Summary: | Refactor `computePositionedLogicalWidthUsing` to use shrink-to-fit in one step | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Ahmad Saleem <ahmad.saleem792> |
| Component: | Layout and Rendering | Assignee: | Ahmad Saleem <ahmad.saleem792> |
| Status: | RESOLVED WONTFIX | ||
| Severity: | Normal | CC: | bfulgham, commit-queue, simon.fraser, webkit-bug-importer, zalan |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Safari Technology Preview | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Bug Depends on: | 282213 | ||
| Bug Blocks: | |||
Ahmad Saleem
Hi Team,
This is just refactoring in `computePositionedLogicalWidthUsing` by reduce reuse of variables:
auto shrinkToFitLogicalWidth = [this](LayoutUnit availableLogicalWidth, LayoutUnit bordersPlusPadding) -> LayoutUnit {
LayoutUnit preferredLogicalWidth = maxPreferredLogicalWidth() - bordersPlusPadding;
LayoutUnit preferredMinLogicalWidth = minPreferredLogicalWidth() - bordersPlusPadding;
return std::min(std::max(preferredMinLogicalWidth, availableLogicalWidth), preferredLogicalWidth);
};
and
then changing from:
computedValues.m_extent = std::min(std::max(preferredMinWidth, availableWidth), preferredWidth);
to:
computedValues.m_extent = shrinkToFitLogicalWidth(availableSpace - logicalLeftValue, bordersPlusPadding);
___
It is here: https://github.com/WebKit/WebKit/blob/12aaa71a5803d48572e89111e28771be7969119b/Source/WebCore/rendering/RenderBox.cpp#L4284
Thanks!
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Ahmad Saleem
We can even use std:clamp here - return std::clamp(availableLogicalWidth, preferredMinLogicalWidth, preferredLogicalWidth);
Radar WebKit Bug Importer
<rdar://problem/135156089>
Ahmad Saleem
Pull request: https://github.com/WebKit/WebKit/pull/33042
EWS
Committed 283073@main (6b0b9db9aa93): <https://commits.webkit.org/283073@main>
Reviewed commits have been landed. Closing PR #33042 and removing active labels.
WebKit Commit Bot
Re-opened since this is blocked by bug 282213
Ahmad Saleem
can't seems to find this code, so it might be gone, so it is not applicable anymore.