[webkit-changes] [WebKit/WebKit] ef951d: [leading-trim][IFC] Add support for nested block c...

Alan Baradlay noreply at github.com
Tue Dec 6 08:08:54 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ef951d1b818e5d8b33dd21c63437da3b93a6eb59
      https://github.com/WebKit/WebKit/commit/ef951d1b818e5d8b33dd21c63437da3b93a6eb59
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2022-12-06 (Tue, 06 Dec 2022)

  Changed paths:
    M Source/WebCore/layout/formattingContexts/block/BlockLayoutState.h
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.h
    M Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp
    M Source/WebCore/page/FrameViewLayoutContext.cpp
    M Source/WebCore/rendering/RenderBlockFlow.cpp
    M Source/WebCore/rendering/RenderBlockFlow.h
    M Source/WebCore/rendering/RenderLayoutState.cpp
    M Source/WebCore/rendering/RenderLayoutState.h

  Log Message:
  -----------
  [leading-trim][IFC] Add support for nested block containers with leading-trim: start
https://bugs.webkit.org/show_bug.cgi?id=248806

Reviewed by Antti Koivisto.

While leading-trim is a non-inherited property, the trimming behavior is propagated down on the block container subtree (similar to e.g. line-clamp).
<div style="leading-trim: start">
  <div>
    <div>This first formatted line should be trimmed</div>
  </div>
</div>

This patch adds initial support for propagating this leading-trim (start) value across multiple IFCs.

1. Use RenderLayerState to propagate leading-trim value inside render tree from ancestor block container to descendants.
2. Use BlockLayoutState.h inside IFC to indicate whether the first/last/both lines should be trimmed.

* Source/WebCore/layout/formattingContexts/block/BlockLayoutState.h: This and the RenderLayerStates may look redundant, but eventually this is all be in BlockLayoutState (full LFC)

(WebCore::Layout::BlockLayoutState::BlockLayoutState):
(WebCore::Layout::BlockLayoutState::leadingTrim const):
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::lineLayout):
(WebCore::Layout::InlineFormattingContext::createDisplayContentForLine):
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.h:
* Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:
(WebCore::Layout::LineBoxBuilder::LineBoxBuilder):
(WebCore::Layout::LineBoxBuilder::computeLineBoxGeometry const): Use the propagated leading-trim value instead of the root's. This enables line box trimming on nested IFCs.
* Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.h:
* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::leadingTrim):
(WebCore::LayoutIntegration::LineLayout::layout):
* Source/WebCore/page/FrameViewLayoutContext.cpp:
(WebCore::FrameViewLayoutContext::pushLayoutState):
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::setLeadingTrimForSubtree):
(WebCore::RenderBlockFlow::resetLeadingTrim):
(WebCore::RenderBlockFlow::layoutBlock):
* Source/WebCore/rendering/RenderBlockFlow.h:
* Source/WebCore/rendering/RenderLayoutState.cpp:
(WebCore::RenderLayoutState::RenderLayoutState):
* Source/WebCore/rendering/RenderLayoutState.h:
(WebCore::RenderLayoutState::hasLeadingTrim const):
(WebCore::RenderLayoutState::leadingTrim const):
(WebCore::RenderLayoutState::addLeadingTrim):
(WebCore::RenderLayoutState::removeLeadingTrim):
(WebCore::RenderLayoutState::resetLeadingTrim):

Canonical link: https://commits.webkit.org/257411@main




More information about the webkit-changes mailing list