[webkit-changes] [WebKit/WebKit] 5e2eb2: [FFC] FlexLayout::layout should follow the spec la...

Alan Baradlay noreply at github.com
Sun Jun 18 12:00:41 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5e2eb2d121b95cad021cb34c4c12a916332e8137
      https://github.com/WebKit/WebKit/commit/5e2eb2d121b95cad021cb34c4c12a916332e8137
  Author: Alan Baradlay <zalan at apple.com>
  Date:   2023-06-18 (Sun, 18 Jun 2023)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
    M Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp
    M Source/WebCore/layout/formattingContexts/flex/FlexLayout.h
    M Source/WebCore/layout/formattingContexts/flex/FlexRect.h
    A Source/WebCore/layout/formattingContexts/flex/LogicalFlexItem.h

  Log Message:
  -----------
  [FFC] FlexLayout::layout should follow the spec language
https://bugs.webkit.org/show_bug.cgi?id=258236

Reviewed by Antti Koivisto.

In this patch
1, remove exiting flex layout logic (it will gradually come back through the series of upcoming patches)
2, add a skeleton implementation based on https://www.w3.org/TR/css-flexbox-1/#layout-algorithm language

while (needs layout) {
  9.2. Line Length Determination
  9.3. Main Size Determination
  9.4. Cross Size Determination
  9.5. Main-Axis Alignment
  9.6. Cross-Axis Alignment
}

* Source/WebCore/Headers.cmake:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp:
(WebCore::Layout::FlexFormattingContext::convertFlexItemsToLogicalSpace):
(WebCore::Layout::horizontalMargin):
(WebCore::Layout::verticalMargin):
(WebCore::Layout::FlexFormattingContext::setFlexItemsGeometry):
(WebCore::Layout::FlexFormattingContext::layoutInFlowContentForIntegration):
* Source/WebCore/layout/formattingContexts/flex/FlexLayout.cpp:
(WebCore::Layout::FlexLayout::FlexLayout):
(WebCore::Layout::FlexLayout::layout):
(WebCore::Layout::FlexLayout::computeAvailableMainAndCrossSpace):
(WebCore::Layout::FlexLayout::flexBaseAndHypotheticalMainSizeForFlexItems const):
(WebCore::Layout::FlexLayout::flexContainerMainSize const):
(WebCore::Layout::FlexLayout::computeFlexLines const):
(WebCore::Layout::FlexLayout::computeMainSizeForFlexItems const):
(WebCore::Layout::FlexLayout::hypotheticalCrossSizeForFlexItems const):
(WebCore::Layout::FlexLayout::crossSizeForFlexLines const):
(WebCore::Layout::FlexLayout::stretchFlexLines const):
(WebCore::Layout::FlexLayout::collapseNonVisibleFlexItems):
(WebCore::Layout::FlexLayout::computeCrossSizeForFlexItems const):
(WebCore::Layout::FlexLayout::handleMainAxisAlignment const):
(WebCore::Layout::FlexLayout::handleCrossAxisAlignmentForFlexItems const):
(WebCore::Layout::FlexLayout::handleCrossAxisAlignmentForFlexLines const):
(WebCore::Layout::FlexLayout::computeAvailableLogicalVerticalSpace const): Deleted.
(WebCore::Layout::FlexLayout::computeAvailableLogicalHorizontalSpace const): Deleted.
(WebCore::Layout::FlexLayout::computeWrappingPositions const): Deleted.
(WebCore::Layout::FlexLayout::computeLogicalWidthForShrinkingFlexItems): Deleted.
(WebCore::Layout::FlexLayout::computeLogicalWidthForStretchingFlexItems): Deleted.
(WebCore::Layout::FlexLayout::computeLogicalWidthForFlexItems): Deleted.
(WebCore::Layout::FlexLayout::computeLogicalHeightForFlexItems): Deleted.
(WebCore::Layout::FlexLayout::distributeMarginAutoInMainAxis): Deleted.
(WebCore::Layout::FlexLayout::distributeMarginAutoInCrossAxis): Deleted.
(WebCore::Layout::FlexLayout::alignFlexItems): Deleted.
(WebCore::Layout::FlexLayout::justifyFlexItems): Deleted.
* Source/WebCore/layout/formattingContexts/flex/FlexLayout.h:
(WebCore::Layout::FlexLayout::isSingleLineFlexContainer const):
(WebCore::Layout::FlexLayout::flexContainer const):
(WebCore::Layout::FlexLayout::rootStyle const):
(): Deleted.
(WebCore::Layout::FlexLayout::LogicalFlexItem::flexBasis const): Deleted.
(WebCore::Layout::FlexLayout::LogicalFlexItem::width const): Deleted.
(WebCore::Layout::FlexLayout::LogicalFlexItem::height const): Deleted.
(WebCore::Layout::FlexLayout::LogicalFlexItem::isHeightAuto const): Deleted.
(WebCore::Layout::FlexLayout::LogicalFlexItem::hasAutoMarginLeft const): Deleted.
(WebCore::Layout::FlexLayout::LogicalFlexItem::hasAutoMarginRight const): Deleted.
(WebCore::Layout::FlexLayout::LogicalFlexItem::hasAutoMarginTop const): Deleted.
(WebCore::Layout::FlexLayout::LogicalFlexItem::hasAutoMarginBottom const): Deleted.
(WebCore::Layout::FlexLayout::LogicalFlexItem::minimumSize const): Deleted.
(WebCore::Layout::FlexLayout::LogicalFlexItem::maximumSize const): Deleted.
(WebCore::Layout::FlexLayout::LogicalFlexItem::style const): Deleted.
(WebCore::Layout::FlexLayout::LogicalFlexItem::layoutBox const): Deleted.
(WebCore::Layout::FlexLayout::FlexItemRect::operator()): Deleted.
(WebCore::Layout::FlexLayout::flexBox const): Deleted.
(WebCore::Layout::FlexLayout::flexBoxStyle const): Deleted.
(WebCore::Layout::FlexLayout::LogicalFlexItem::LogicalFlexItem): Deleted.
* Source/WebCore/layout/formattingContexts/flex/FlexRect.h:
(WebCore::Layout::FlexRect::marginTop const):
(WebCore::Layout::FlexRect::marginBottom const):
(WebCore::Layout::FlexRect::marginLeft const):
(WebCore::Layout::FlexRect::marginRight const):
(WebCore::Layout::FlexRect::setMarginTop):
(WebCore::Layout::FlexRect::setMarginBottom):
(WebCore::Layout::FlexRect::setMarginLeft):
(WebCore::Layout::FlexRect::setMarginRight):
(WebCore::Layout::FlexRect::FlexRect):

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




More information about the webkit-changes mailing list