Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ad64b3613b50fc83fb7146411c21da788f36ea46
      
https://github.com/WebKit/WebKit/commit/ad64b3613b50fc83fb7146411c21da788f36ea46
  Author: Alan Baradlay <[email protected]>
  Date:   2023-05-04 (Thu, 04 May 2023)

  Changed paths:
    M Source/WebCore/layout/floats/FloatingContext.cpp
    M Source/WebCore/layout/floats/FloatingContext.h
    M Source/WebCore/layout/formattingContexts/block/BlockFormattingContext.cpp
    M 
Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp
    M 
Source/WebCore/layout/formattingContexts/inline/InlineFormattingGeometry.cpp
    M Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp

  Log Message:
  -----------
  [LFC][Floating] Pass in the float candidate geometry to FloatingContext 
functions
https://bugs.webkit.org/show_bug.cgi?id=256256

Reviewed by Antti Koivisto.

This patch is in preparation for synchronizing float box geometry handling with 
the rest of the layout boxes.

Currently what we do in LineBuilder is as follows:

auto& boxGeometry = formattingState()->boxGeometry(floatBox)                 
(grab a _mutable_ box geometry)
boxGeometry.setLogicalTopLeft(staticPosition)                                
(set the initial top/left position)
boxGeometry.setLogicalTopLeft(floatingContext.positionForFloat(floatBox))    
(run float layout and set the final position on the box geometry)
placedFloats.append(floatingContext.toFloatItem(floatBox))                   
(let the caller (InlineFormattingContext) know about the placed floats)

What we aim to do is just make a copy of the BoxGeometry and pass it in to 
FloatingContext functions (we don't do the copy part yet in this patch)

auto boxGeometry = boxGeometry(floatBox)
boxGeometry.setLogicalTopLeft(staticPosition)
...

and let the caller (InlineFormattingContext) deal with setting the final box 
geometry on the float boxes similar to other layout boxes as part of the 
display content creation.

Passing in BoxGeometry to FloatingContext ensures that we don't need to mutate 
the BoxGeometry state in order to run float layout.
This would enable us to use LineBuilder to run inline layout with different 
constraints (min/max) without getting any state mutated when floats are present.

* 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::absoluteCoordinates const):
(WebCore::Layout::FloatingContext::mapTopLeftToFloatingStateRoot const):
* Source/WebCore/layout/floats/FloatingContext.h:
* Source/WebCore/layout/formattingContexts/block/BlockFormattingContext.cpp:
(WebCore::Layout::BlockFormattingContext::layoutInFlowContent):
(WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats):
(WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear):
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::layoutFloatContentOnly):
* Source/WebCore/layout/formattingContexts/inline/InlineFormattingGeometry.cpp:
(WebCore::Layout::InlineFormattingGeometry::logicalTopForNextLine const):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::tryPlacingFloatBox):

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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to