Title: [286096] trunk/Source/WebCore
- Revision
- 286096
- Author
- [email protected]
- Date
- 2021-11-20 06:43:28 -0800 (Sat, 20 Nov 2021)
Log Message
[IFC][Integration] Initialize layout box geometries for preferred width computation
https://bugs.webkit.org/show_bug.cgi?id=233386
Reviewed by Antti Koivisto.
Initializing certain geometries (e.g. inline box margin/border/padding) is required for the integration
codepath the same way we do it for the actual line layout.
* layout/formattingContexts/inline/InlineFormattingContext.cpp: Add a dedicated integration codepath for preferred width
computation using the preset geometry values.
(WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraintsForIntegration):
* layout/formattingContexts/inline/InlineFormattingContext.h:
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::tryComputePreferredWidthsUsingModernPath):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (286095 => 286096)
--- trunk/Source/WebCore/ChangeLog 2021-11-20 08:34:59 UTC (rev 286095)
+++ trunk/Source/WebCore/ChangeLog 2021-11-20 14:43:28 UTC (rev 286096)
@@ -1,3 +1,20 @@
+2021-11-20 Alan Bujtas <[email protected]>
+
+ [IFC][Integration] Initialize layout box geometries for preferred width computation
+ https://bugs.webkit.org/show_bug.cgi?id=233386
+
+ Reviewed by Antti Koivisto.
+
+ Initializing certain geometries (e.g. inline box margin/border/padding) is required for the integration
+ codepath the same way we do it for the actual line layout.
+
+ * layout/formattingContexts/inline/InlineFormattingContext.cpp: Add a dedicated integration codepath for preferred width
+ computation using the preset geometry values.
+ (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraintsForIntegration):
+ * layout/formattingContexts/inline/InlineFormattingContext.h:
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::tryComputePreferredWidthsUsingModernPath):
+
2021-11-20 Carlos Garcia Campos <[email protected]>
Report the initiating url instead of the redirected one
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp (286095 => 286096)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp 2021-11-20 08:34:59 UTC (rev 286095)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp 2021-11-20 14:43:28 UTC (rev 286096)
@@ -157,6 +157,20 @@
computeStaticPositionForOutOfFlowContent(formattingState().outOfFlowBoxes());
}
+IntrinsicWidthConstraints InlineFormattingContext::computedIntrinsicWidthConstraintsForIntegration()
+{
+ if (formattingState().intrinsicWidthConstraints())
+ return *formattingState().intrinsicWidthConstraints();
+
+ collectContentIfNeeded();
+
+ auto constraints = formattingGeometry().constrainByMinMaxWidth(root(),
+ { ceiledLayoutUnit(computedIntrinsicWidthForConstraint(IntrinsicWidthMode::Minimum))
+ , ceiledLayoutUnit(computedIntrinsicWidthForConstraint(IntrinsicWidthMode::Maximum)) });
+ formattingState().setIntrinsicWidthConstraints(constraints);
+ return constraints;
+}
+
LayoutUnit InlineFormattingContext::usedContentHeight() const
{
// 10.6.7 'Auto' heights for block formatting context roots
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h (286095 => 286096)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h 2021-11-20 08:34:59 UTC (rev 286095)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h 2021-11-20 14:43:28 UTC (rev 286096)
@@ -54,6 +54,7 @@
InlineFormattingState& formattingState() { return downcast<InlineFormattingState>(FormattingContext::formattingState()); }
void lineLayoutForIntergration(const ConstraintsForInFlowContent&);
+ IntrinsicWidthConstraints computedIntrinsicWidthConstraintsForIntegration();
const InlineFormattingGeometry& formattingGeometry() const final { return m_inlineFormattingGeometry; }
const InlineFormattingQuirks& formattingQuirks() const final { return m_inlineFormattingQuirks; }
Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (286095 => 286096)
--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2021-11-20 08:34:59 UTC (rev 286095)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp 2021-11-20 14:43:28 UTC (rev 286096)
@@ -220,7 +220,7 @@
std::pair<LayoutUnit, LayoutUnit> LineLayout::computeIntrinsicWidthConstraints()
{
auto inlineFormattingContext = Layout::InlineFormattingContext { rootLayoutBox(), m_inlineFormattingState, nullptr };
- auto constraints = inlineFormattingContext.computedIntrinsicWidthConstraints();
+ auto constraints = inlineFormattingContext.computedIntrinsicWidthConstraintsForIntegration();
return { constraints.minimum, constraints.maximum };
}
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (286095 => 286096)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2021-11-20 08:34:59 UTC (rev 286095)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2021-11-20 14:43:28 UTC (rev 286096)
@@ -4580,6 +4580,21 @@
if (!modernLineLayout())
m_lineLayout = makeUnique<LayoutIntegration::LineLayout>(*this);
+#if ENABLE_MODERN_PREFERRED_WIDTH_COMPUTATION_FOR_INLINE_BOXES
+ auto& layoutFormattingContextLineLayout = *this->modernLineLayout();
+ for (auto walker = InlineWalker(*this); !walker.atEnd(); walker.advance()) {
+ auto& renderer = *walker.current();
+ if (renderer.isText() || is<RenderLineBreak>(renderer))
+ continue;
+ if (is<RenderInline>(renderer)) {
+ layoutFormattingContextLineLayout.updateInlineBoxDimensions(downcast<RenderInline>(renderer));
+ continue;
+ }
+ // FIXME: Add other, inline level box cases.
+ ASSERT_NOT_IMPLEMENTED_YET();
+ }
+#endif
+
std::tie(minLogicalWidth, maxLogicalWidth) = modernLineLayout()->computeIntrinsicWidthConstraints();
for (auto walker = InlineWalker(*this); !walker.atEnd(); walker.advance())
walker.current()->setPreferredLogicalWidthsDirty(false);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes