Source/WebCore/ChangeLog

 12021-11-02 Antti Koivisto <antti@apple.com>
 2
 3 [LFC][Integration] Use IFC for preferred width computation in simple cases
 4 https://bugs.webkit.org/show_bug.cgi?id=232616
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * layout/formattingContexts/inline/InlineFormattingContext.cpp:
 9 (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthConstraints):
 10 * layout/formattingContexts/inline/InlineFormattingContext.h:
 11 * layout/integration/LayoutIntegrationLineLayout.cpp:
 12 (WebCore::LayoutIntegration::LineLayout::computeIntrinsicWidthConstraints):
 13 * layout/integration/LayoutIntegrationLineLayout.h:
 14 * rendering/RenderBlockFlow.cpp:
 15 (WebCore::RenderBlockFlow::computeAndSetLineLayoutPath):
 16 (WebCore::RenderBlockFlow::layoutInlineChildren):
 17 (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
 18 (WebCore::RenderBlockFlow::tryComputePreferredWidthsUsingModernPath):
 19 * rendering/RenderBlockFlow.h:
 20
1212021-11-01 Daniel Kolesa <dkolesa@igalia.com>
222
323 Fix build with GCC 8.4 on Ubuntu 18.04

Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp

@@void InlineFormattingContext::computeStaticPositionForOutOfFlowContent(const For
359359IntrinsicWidthConstraints InlineFormattingContext::computedIntrinsicWidthConstraints()
360360{
361361 auto& layoutState = this->layoutState();
362  ASSERT(!formattingState().intrinsicWidthConstraints());
 362 if (formattingState().intrinsicWidthConstraints())
 363 return *formattingState().intrinsicWidthConstraints();
363364
364365 if (!root().hasInFlowOrFloatingChild()) {
365366 auto constraints = formattingGeometry().constrainByMinMaxWidth(root(), { });

Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h

@@public:
5858 const InlineFormattingGeometry& formattingGeometry() const final { return m_inlineFormattingGeometry; }
5959 const InlineFormattingQuirks& formattingQuirks() const final { return m_inlineFormattingQuirks; }
6060
61 private:
6261 IntrinsicWidthConstraints computedIntrinsicWidthConstraints() override;
6362
 63private:
6464 void lineLayout(InlineItems&, LineBuilder::InlineItemRange, const ConstraintsForInFlowContent&);
6565 void computeStaticPositionForOutOfFlowContent(const FormattingState::OutOfFlowBoxList&);
6666

Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp

@@void LineLayout::updateStyle(const RenderBoxModelObject& renderer, const RenderS
217217 m_boxTree.updateStyle(renderer);
218218}
219219
 220std::pair<LayoutUnit, LayoutUnit> LineLayout::computeIntrinsicWidthConstraints()
 221{
 222 auto inlineFormattingContext = Layout::InlineFormattingContext { rootLayoutBox(), m_inlineFormattingState, nullptr };
 223 auto constraints = inlineFormattingContext.computedIntrinsicWidthConstraints();
 224
 225 return { constraints.minimum, constraints.maximum };
 226}
 227
220228void LineLayout::layout()
221229{
222230 auto& rootLayoutBox = this->rootLayoutBox();

Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h

@@public:
7979 void updateLineBreakBoxDimensions(const RenderLineBreak&);
8080 void updateInlineBoxDimensions(const RenderInline&);
8181 void updateStyle(const RenderBoxModelObject&, const RenderStyle& oldStyle);
 82
 83 std::pair<LayoutUnit, LayoutUnit> computeIntrinsicWidthConstraints();
 84
8285 void layout();
8386
8487 LayoutUnit contentLogicalHeight() const;

Source/WebCore/rendering/RenderBlockFlow.cpp

6969
7070namespace WebCore {
7171
 72#define ENABLE_MODERN_PREFERRED_WIDTH_COMPUTATION 1
 73#define ENABLE_MODERN_PREFERRED_WIDTH_COMPUTATION_FOR_INLINE_BOXES 1
 74
7275WTF_MAKE_ISO_ALLOCATED_IMPL(RenderBlockFlow);
7376
7477bool RenderBlock::s_canPropagateFloatIntoSibling = false;

@@void RenderBlockFlow::layoutBlockChildren(bool relayoutChildren, LayoutUnit& max
683686 handleAfterSideOfBlock(beforeEdge, afterEdge, marginInfo);
684687}
685688
686 void RenderBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom)
 689void RenderBlockFlow::computeAndSetLineLayoutPath()
687690{
688  auto computeLineLayoutPath = [&] {
 691 if (lineLayoutPath() != UndeterminedPath)
 692 return;
 693
 694 auto compute = [&] {
689695#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
690696 if (LayoutIntegration::LineLayout::canUseFor(*this))
691697 return ModernPath;

@@void RenderBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& re
693699 return LegacyPath;
694700 };
695701
696  if (lineLayoutPath() == UndeterminedPath)
697  setLineLayoutPath(computeLineLayoutPath());
 702 setLineLayoutPath(compute());
 703}
 704
 705void RenderBlockFlow::layoutInlineChildren(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom)
 706{
 707 computeAndSetLineLayoutPath();
698708
699709#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
700710 if (lineLayoutPath() == ModernPath) {

@@static inline LayoutUnit preferredWidth(LayoutUnit preferredWidth, float result)
42614271
42624272void RenderBlockFlow::computeInlinePreferredLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
42634273{
 4274#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
 4275 if (const_cast<RenderBlockFlow&>(*this).tryComputePreferredWidthsUsingModernPath(minLogicalWidth, maxLogicalWidth))
 4276 return;
 4277#endif
 4278
42644279 float inlineMax = 0;
42654280 float inlineMin = 0;
42664281

@@void RenderBlockFlow::computeInlinePreferredLogicalWidths(LayoutUnit& minLogical
45994614 maxLogicalWidth = preferredWidth(maxLogicalWidth, inlineMax);
46004615}
46014616
 4617#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
 4618bool RenderBlockFlow::tryComputePreferredWidthsUsingModernPath(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth)
 4619{
 4620#if ENABLE_MODERN_PREFERRED_WIDTH_COMPUTATION
 4621 computeAndSetLineLayoutPath();
 4622
 4623 // FIXME: Allow inline boxes.
 4624 // FIXME: Pass the replaced and inline block constrainst to IFC.
 4625 auto canUseModernPathForPreferredWidthComputation = [&] {
 4626 if (lineLayoutPath() != ModernPath)
 4627 return false;
 4628 for (auto walker = InlineWalker(*this); !walker.atEnd(); walker.advance()) {
 4629 auto& renderer = *walker.current();
 4630 if (renderer.isText())
 4631 continue;
 4632 if (is<RenderLineBreak>(renderer))
 4633 continue;
 4634#if ENABLE_MODERN_PREFERRED_WIDTH_COMPUTATION_FOR_INLINE_BOXES
 4635 if (is<RenderInline>(renderer))
 4636 continue;
 4637#endif
 4638 return false;
 4639 }
 4640 return true;
 4641 };
 4642
 4643 if (!canUseModernPathForPreferredWidthComputation())
 4644 return false;
 4645
 4646 if (!modernLineLayout())
 4647 m_lineLayout = makeUnique<LayoutIntegration::LineLayout>(*this);
 4648
 4649 std::tie(minLogicalWidth, maxLogicalWidth) = modernLineLayout()->computeIntrinsicWidthConstraints();
 4650 return true;
 4651#else
 4652 UNUSED_PARAM(minLogicalWidth);
 4653 UNUSED_PARAM(maxLogicalWidth);
 4654 return false;
 4655#endif
 4656}
 4657#endif
 4658
46024659}
46034660// namespace WebCore

Source/WebCore/rendering/RenderBlockFlow.h

@@public:
344344
345345 bool hasLines() const;
346346 void invalidateLineLayoutPath() final;
 347 void computeAndSetLineLayoutPath();
347348
348349 enum LineLayoutPath { UndeterminedPath = 0, ModernPath, LegacyPath, ForcedLegacyPath };
349350 LineLayoutPath lineLayoutPath() const { return static_cast<LineLayoutPath>(renderBlockFlowLineLayoutPath()); }
350351 void setLineLayoutPath(LineLayoutPath path) { setRenderBlockFlowLineLayoutPath(path); }
 352 void computeLineLayoutPath();
351353
352354 int lineCount() const;
353355 void clearTruncation();

@@private:
545547#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
546548 bool hasModernLineLayout() const;
547549 void layoutModernLines(bool relayoutChildren, LayoutUnit& repaintLogicalTop, LayoutUnit& repaintLogicalBottom);
 550 bool tryComputePreferredWidthsUsingModernPath(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth);
548551#endif
549552
550553 void adjustIntrinsicLogicalWidthsForColumns(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const;

Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py

@@class LayoutTestRunner(object):
203203 run_results.add(result, expected=False)
204204
205205 def _interrupt_if_at_failure_limits(self, run_results):
 206 self._options.exit_after_n_failures = None
206207 # Note: The messages in this method are constructed to match old-run-webkit-tests
207208 # so that existing buildbot grep rules work.
208209 def interrupt_if_at_failure_limit(limit, failure_count, run_results, message):