Changeset 294638 in webkit
- Timestamp:
- May 23, 2022 6:49:05 AM (2 years ago)
- Location:
- trunk/Source/WebCore/layout
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/layout/formattingContexts/FormattingConstraints.h
r294623 r294638 67 67 OptionSet<BaseTypeFlag> baseTypeFlags() const { return OptionSet<BaseTypeFlag>::fromRaw(m_baseTypeFlags); } 68 68 69 unsigned m_baseTypeFlags : 2; // OptionSet<BaseTypeFlag>69 unsigned m_baseTypeFlags : 3; // OptionSet<BaseTypeFlag> 70 70 HorizontalConstraints m_horizontal; 71 71 LayoutUnit m_logicalTop; -
trunk/Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp
r294623 r294638 210 210 211 211 auto totalGrowth = 0.f; 212 auto totalFixed Width= LayoutUnit { };212 auto totalFixedSpace = LayoutUnit { }; 213 213 214 214 for (auto& logicalFlexItem : logicalFlexItemList) { 215 215 totalGrowth += logicalFlexItem.layoutBox->style().flexGrow(); 216 216 // FIXME: Use min/max here. 217 totalFixedWidth += logicalFlexItem.rect.width(); 218 } 219 217 totalFixedSpace += logicalFlexItem.rect.width(); 218 } 219 220 auto flexConstraints = downcast<ConstraintsForFlexContent>(constraints); 220 221 auto logicalLeft = LayoutUnit { }; 221 222 auto logicalTop = LayoutUnit { }; 222 auto availableWidth = constraints.horizontal().logicalWidth; 223 auto flexibleWidth = availableWidth - totalFixedWidth; 223 auto flexDirection = root().style().flexDirection(); 224 auto flexDirectionIsInlineAxis = flexDirection == FlexDirection::Row || flexDirection == FlexDirection::RowReverse; 225 auto availableSpace = std::optional<LayoutUnit> { flexDirectionIsInlineAxis ? std::make_optional(flexConstraints.horizontal().logicalWidth) : flexConstraints.availableVerticalSpace() }; 226 auto flexibleSpace = availableSpace.value_or(0_lu) - totalFixedSpace; 224 227 225 228 for (auto& logicalFlexItem : logicalFlexItemList) { … … 227 230 logicalLeft = logicalFlexItem.rect.right(); 228 231 auto growFlexItemIfApplicable = [&] { 229 if (flexible Width<= 0)232 if (flexibleSpace <= 0) 230 233 return; 231 234 auto grow = logicalFlexItem.layoutBox->style().flexGrow(); … … 234 237 // This value specifies the flex grow factor, which determines how much the flex item will grow relative to the 235 238 // rest of the flex items in the flex container when positive free space is distributed. 236 logicalFlexItem.rect.setWidth(LayoutUnit { availableWidth * grow / totalGrowth }); 239 ASSERT(availableSpace.has_value()); 240 logicalFlexItem.rect.setWidth(LayoutUnit { *availableSpace * grow / totalGrowth }); 237 241 // FIXME: constrain logical width on min width. 238 242 }; 239 243 growFlexItemIfApplicable(); 240 244 } 241 setFlexItemsGeometry(logicalFlexItemList, downcast<ConstraintsForFlexContent>(constraints));245 setFlexItemsGeometry(logicalFlexItemList, flexConstraints); 242 246 } 243 247 -
trunk/Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp
r294623 r294638 140 140 renderer.setLocation(borderBox.topLeft()); 141 141 renderer.setWidth(borderBox.width()); 142 renderer.setHeight(borderBox.height()); 142 143 } 143 144 }
Note: See TracChangeset
for help on using the changeset viewer.