Changeset 231894 in webkit
- Timestamp:
- May 17, 2018 7:07:49 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r231891 r231894 1 2018-05-17 Zalan Bujtas <zalan@apple.com> 2 3 [LFC] Implement width computation for replaced out if flow elements. 4 https://bugs.webkit.org/show_bug.cgi?id=185701 5 6 Reviewed by Antti Koivisto. 7 8 The used value of 'width' is determined as for inline replaced elements. 9 10 * layout/FormattingContext.cpp: 11 (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedHeight const): 12 (WebCore::Layout::FormattingContext::computeOutOfFlowNonReplacedWidth const): 13 (WebCore::Layout::FormattingContext::computeOutOfFlowReplacedWidth const): 14 * layout/FormattingContext.h: 15 1 16 2018-05-17 Thibault Saunier <tsaunier@igalia.com> 2 17 -
trunk/Source/WebCore/layout/FormattingContext.cpp
r231847 r231894 94 94 return; 95 95 } 96 compute InFlowReplacedWidth(layoutContext, layoutBox, displayBox);96 computeReplacedWidth(layoutContext, layoutBox, displayBox); 97 97 } 98 98 … … 155 155 void FormattingContext::computeOutOfFlowNonReplacedHeight(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const 156 156 { 157 ASSERT(layoutBox.isOutOfFlowPositioned() && !layoutBox.isReplaced()); 158 159 // 10.6.4 Absolutely positioned, non-replaced elements 160 // 157 161 // For absolutely positioned elements, the used values of the vertical dimensions must satisfy this constraint: 158 162 // 'top' + 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' + 'bottom' … … 209 213 } 210 214 211 void FormattingContext::computeInFlowReplacedWidth(LayoutContext&, const Box& layoutBox, Display::Box& displayBox) const 212 { 213 // 10.3.4 Block-level, replaced elements in normal flow: The used value of 'width' is determined as for inline replaced elements 214 // 10.3.6 Floating, replaced elements: The used value of 'width' is determined as for inline replaced elements. 215 void FormattingContext::computeReplacedWidth(LayoutContext&, const Box& layoutBox, Display::Box& displayBox) const 216 { 217 ASSERT((layoutBox.isOutOfFlowPositioned() || layoutBox.isFloatingPositioned() || layoutBox.isInFlow()) && layoutBox.isReplaced()); 218 219 // 10.3.4 Block-level, replaced elements in normal flow: The used value of 'width' is determined as for inline replaced elements. 220 // 10.3.6 Floating, replaced elements: The used value of 'width' is determined as for inline replaced elements. 221 // 10.3.8 Absolutely positioned, replaced elements: The used value of 'width' is determined as for inline replaced elements. 215 222 216 223 // 10.3.2 Inline, replaced elements … … 261 268 { 262 269 ASSERT(layoutBox.style().logicalHeight().isAuto()); 270 263 271 if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowOrFloatingChild()) 264 272 return 0; … … 288 296 void FormattingContext::computeOutOfFlowNonReplacedWidth(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const 289 297 { 298 ASSERT(layoutBox.isOutOfFlowPositioned() && !layoutBox.isReplaced()); 299 300 // 10.3.7 Absolutely positioned, non-replaced elements 301 // 290 302 // 'left' + 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' + 'right' 291 303 // = width of containing block … … 336 348 } 337 349 350 void FormattingContext::computeOutOfFlowReplacedWidth(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const 351 { 352 ASSERT(layoutBox.isOutOfFlowPositioned() && layoutBox.isReplaced()); 353 // 10.3.8 Absolutely positioned, replaced elements 354 // 355 // The used value of 'width' is determined as for inline replaced elements. 356 computeReplacedWidth(layoutContext, layoutBox, displayBox); 357 } 358 338 359 LayoutUnit FormattingContext::shrinkToFitWidth(LayoutContext&, const Box&) const 339 360 { -
trunk/Source/WebCore/layout/FormattingContext.h
r231847 r231894 88 88 void layoutOutOfFlowDescendants(LayoutContext&s) const; 89 89 90 void compute InFlowReplacedWidth(LayoutContext&, const Box&, Display::Box&) const;90 void computeReplacedWidth(LayoutContext&, const Box&, Display::Box&) const; 91 91 92 92 private: 93 93 void computeOutOfFlowNonReplacedHeight(LayoutContext&, const Box&, Display::Box&) const; 94 94 void computeOutOfFlowNonReplacedWidth(LayoutContext&, const Box&, Display::Box&) const; 95 void computeOutOfFlowReplacedWidth(LayoutContext&, const Box&, Display::Box&) const; 95 96 96 97 LayoutUnit contentHeightForFormattingContextRoot(LayoutContext&, const Box&) const; -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp
r231847 r231894 150 150 return; 151 151 } 152 compute InFlowReplacedWidth(layoutContext, layoutBox, displayBox);152 computeReplacedWidth(layoutContext, layoutBox, displayBox); 153 153 } 154 154 155 155 void BlockFormattingContext::computeInFlowNonReplacedWidth(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const 156 156 { 157 ASSERT(layoutBox.isInFlow() && !layoutBox.isReplaced()); 158 157 159 // 10.3.3 Block-level, non-replaced elements in normal flow 158 160 // The following constraints must hold among the used values of the other properties: … … 203 205 void BlockFormattingContext::computeInFlowNonReplacedHeight(LayoutContext& layoutContext, const Box& layoutBox, Display::Box& displayBox) const 204 206 { 207 ASSERT(layoutBox.isInFlow() && !layoutBox.isReplaced()); 208 205 209 // https://www.w3.org/TR/CSS22/visudet.html 206 210 // If 'height' is 'auto', the height depends on whether the element has any block-level children and whether it has padding or borders:
Note: See TracChangeset
for help on using the changeset viewer.