[webkit-changes] [WebKit/WebKit] 79dfe2: [LFC][IFC] Add support for floats coming from IFCs...

alan noreply at github.com
Sat Sep 24 16:32:48 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 79dfe2e0a3bcbd3425ebe869eebb3384ed2627e9
      https://github.com/WebKit/WebKit/commit/79dfe2e0a3bcbd3425ebe869eebb3384ed2627e9
  Author: Alan Bujtas <zalan at apple.com>
  Date:   2022-09-24 (Sat, 24 Sep 2022)

  Changed paths:
    M Source/WebCore/layout/floats/FloatingContext.cpp
    M Source/WebCore/layout/floats/FloatingContext.h
    M Source/WebCore/layout/floats/FloatingState.h
    M Source/WebCore/layout/formattingContexts/inline/InlineFormattingGeometry.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp
    M Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp

  Log Message:
  -----------
  [LFC][IFC] Add support for floats coming from IFCs with different inline directions.
https://bugs.webkit.org/show_bug.cgi?id=245602

Reviewed by Antti Koivisto.

This patch adds support for mixing floating boxes with different inline directions.
e.g.
<div id=outer style="direction: rtl">
  <img style="float: right">right to left
  <div id=inner style="direction: ltr">
    <img style="float: inline-end">left to right
  </div>
  right to left
</div>

1. "outer" div initiates a FloatingState with rtl inline direction.
2. append the "float: right" box as logically left positioned float to the FloatingState.
3. "inner" div inherits the FloatingState from the parent BFC.
4. construct a FloatingContext with _ltr_ direction using an _rtl_ FloatingState.
5. "float: inline-end" is logically right for 'inner" layout but it is logically left for the inherited FloatingState.
6. Coming back to the parent BFC, the FloatingState now has 2 logically left (visually right) floating boxes.

(Alternatively, we could re-create a FloatingState for each mismatching nested IFCs and
1. copy/translate boxes from the parent FloatingState.
2. any floating boxes added by the nested IFC needs to be translated back to the parent BFC's FloatingState.
It would ensure that the FloatingState's direction always matches the IFC's direction, but it would require copying float boxes back and forth between FloatingStates.)

* Source/WebCore/layout/floats/FloatingContext.cpp:
(WebCore::Layout::FloatingContext::positionForFloat const):
(WebCore::Layout::FloatingContext::positionForNonFloatingFloatAvoider const):
(WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
(WebCore::Layout::FloatingContext::toFloatItem const):
(WebCore::Layout::FloatingContext::isFloaingCandidateLogicallyLeftPositioned const):
(WebCore::Layout::FloatingContext::logicalClear const):
* Source/WebCore/layout/floats/FloatingContext.h:
(WebCore::Layout::FloatingContext::isLeftToRightDirection const): Deleted.
(WebCore::Layout::FloatingContext::isLeftFloatingPositioned const): Deleted.
* Source/WebCore/layout/floats/FloatingState.h:
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
(WebCore::Layout::InlineFormattingGeometry::floatConstraintsForLine const):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::tryPlacingFloatBox):
* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::constructContent):
(WebCore::LayoutIntegration::LineLayout::prepareFloatingState):

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




More information about the webkit-changes mailing list