Skip to content

Commit

Permalink
[IFC][Intrinsic width] Add support for content with fixed (logical) w…
Browse files Browse the repository at this point in the history
…idth

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

Reviewed by Antti Koivisto.

* Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp:
(WebCore::LayoutIntegration::canUseForPreferredWidthComputation):
* Source/WebCore/layout/integration/inline/LayoutIntegrationBoxGeometryUpdater.cpp:
(WebCore::LayoutIntegration::BoxGeometryUpdater::updateLayoutBoxDimensions):
(WebCore::LayoutIntegration::BoxGeometryUpdater::setGeometriesForIntrinsicWidth):

Canonical link: https://commits.webkit.org/276250@main
  • Loading branch information
alanbaradlay committed Mar 17, 2024
1 parent e31e176 commit 2e16d71
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ bool canUseForPreferredWidthComputation(const RenderBlockFlow& blockContainer)
continue;
if (is<RenderInline>(renderer))
continue;
if (renderer.isInFlow() && renderer.style().isHorizontalWritingMode() && renderer.style().logicalWidth().isFixed()) {
// FIXME: Implement this image special in line builder.
auto allowImagesToBreak = !blockContainer.document().inQuirksMode() || !blockContainer.isRenderTableCell();
if (!allowImagesToBreak)
return false;
continue;
}
return false;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,11 @@ void BoxGeometryUpdater::updateLayoutBoxDimensions(const RenderBox& renderBox, s

if (intrinsicWidthMode) {
boxGeometry.setHorizontalSpaceForScrollbar(scrollbarSize.width());
boxGeometry.setContentBoxWidth(*intrinsicWidthMode == Layout::IntrinsicWidthMode::Minimum ? renderBox.minPreferredLogicalWidth() : renderBox.maxPreferredLogicalWidth());
auto contentBoxLogicalWidth = [&] {
auto preferredWidth = *intrinsicWidthMode == Layout::IntrinsicWidthMode::Minimum ? renderBox.minPreferredLogicalWidth() : renderBox.maxPreferredLogicalWidth();
return preferredWidth - (border.horizontal.start + border.horizontal.end + padding.horizontal.start + padding.horizontal.end);
};
boxGeometry.setContentBoxWidth(contentBoxLogicalWidth());
boxGeometry.setHorizontalMargin(inlineMargin);
boxGeometry.setHorizontalBorder(border.horizontal);
boxGeometry.setHorizontalPadding(padding.horizontal);
Expand Down Expand Up @@ -372,6 +376,11 @@ void BoxGeometryUpdater::setGeometriesForIntrinsicWidth(Layout::IntrinsicWidthMo
updateInlineBoxDimensions(*renderInline, intrinsicWidthMode);
continue;
}
if (auto* renderBox = dynamicDowncast<RenderBox>(renderer)) {
// FIXME: Add support for flexing boxes.
ASSERT(renderBox->style().logicalWidth().isFixed());
updateLayoutBoxDimensions(*renderBox, intrinsicWidthMode);
}
}
}

Expand Down

0 comments on commit 2e16d71

Please sign in to comment.