Changeset 238668 in webkit
- Timestamp:
- Nov 29, 2018, 7:30:27 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
layout/blockformatting/BlockFormattingContext.h (modified) (1 diff)
-
layout/blockformatting/BlockFormattingContextGeometry.cpp (modified) (2 diffs)
-
layout/blockformatting/BlockFormattingContextQuirks.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r238667 r238668 1 2018-11-29 Zalan Bujtas <zalan@apple.com> 2 3 [LFC][BFC][Quirk] Width does not need stretching quirk. 4 https://bugs.webkit.org/show_bug.cgi?id=192135 5 6 Reviewed by Antti Koivisto. 7 8 In BFC the block box's width (auto) always streches to the content width of the containing block. 9 10 * layout/blockformatting/BlockFormattingContext.h: 11 * layout/blockformatting/BlockFormattingContextGeometry.cpp: 12 (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin): 13 (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin): 14 * layout/blockformatting/BlockFormattingContextQuirks.cpp: 15 (WebCore::Layout::BlockFormattingContext::Quirks::needsStretching): 16 (WebCore::Layout::BlockFormattingContext::Quirks::isStretchedToInitialContainingBlock): Deleted. 17 (WebCore::Layout::BlockFormattingContext::Quirks::stretchedWidth): Deleted. 18 1 19 2018-11-29 Zalan Bujtas <zalan@apple.com> 2 20 -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h
r238667 r238668 113 113 class Quirks { 114 114 public: 115 static bool isStretchedToInitialContainingBlock(const LayoutState&, const Box&);115 static bool needsStretching(const LayoutState&, const Box&); 116 116 static HeightAndMargin stretchedHeight(const LayoutState&, const Box&, HeightAndMargin); 117 static WidthAndMargin stretchedWidth(const LayoutState&, const Box&, WidthAndMargin); 117 118 118 static bool shouldIgnoreMarginTop(const LayoutState&, const Box&); 119 119 }; -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp
r238667 r238668 196 196 197 197 auto widthAndMargin = compute(); 198 if (!Quirks::isStretchedToInitialContainingBlock(layoutState, layoutBox)) { 199 LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow non-replaced -> width(" << widthAndMargin.width << "px) margin(" << widthAndMargin.margin.left << "px, " << widthAndMargin.margin.right << "px) -> layoutBox(" << &layoutBox << ")"); 200 return widthAndMargin; 201 } 202 203 widthAndMargin = Quirks::stretchedWidth(layoutState, layoutBox, widthAndMargin); 204 205 LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow non-replaced -> streched to viewport-> width(" << widthAndMargin.width << "px) margin(" << widthAndMargin.margin.left << "px, " << widthAndMargin.margin.right << "px) -> layoutBox(" << &layoutBox << ")"); 198 LOG_WITH_STREAM(FormattingContextLayout, stream << "[Width][Margin] -> inflow non-replaced -> width(" << widthAndMargin.width << "px) margin(" << widthAndMargin.margin.left << "px, " << widthAndMargin.margin.right << "px) -> layoutBox(" << &layoutBox << ")"); 206 199 return widthAndMargin; 207 200 } … … 265 258 } 266 259 267 if (!Quirks:: isStretchedToInitialContainingBlock(layoutState, layoutBox))260 if (!Quirks::needsStretching(layoutState, layoutBox)) 268 261 return heightAndMargin; 269 262 -
trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextQuirks.cpp
r238667 r238668 54 54 } 55 55 56 bool BlockFormattingContext::Quirks:: isStretchedToInitialContainingBlock(const LayoutState& layoutState, const Box& layoutBox)56 bool BlockFormattingContext::Quirks::needsStretching(const LayoutState& layoutState, const Box& layoutBox) 57 57 { 58 58 ASSERT(layoutBox.isInFlow()); 59 // In quirks mode, body and html stretch to the viewport.59 // In quirks mode, body stretches to html and html to the initial containing block (height: auto only). 60 60 if (!layoutState.inQuirksMode()) 61 61 return false; … … 82 82 } 83 83 84 WidthAndMargin BlockFormattingContext::Quirks::stretchedWidth(const LayoutState& layoutState, const Box& layoutBox, WidthAndMargin widthAndMargin)85 {86 auto initialContainingBlockWidth = layoutState.displayBoxForLayoutBox(initialContainingBlock(layoutBox)).contentBoxWidth();87 auto horizontalMargins = widthAndMargin.margin.left + widthAndMargin.margin.right;88 // Stretch but never overstretch with the margins.89 if (widthAndMargin.width + horizontalMargins < initialContainingBlockWidth)90 widthAndMargin.width = initialContainingBlockWidth - horizontalMargins;91 92 return widthAndMargin;93 }94 95 84 bool BlockFormattingContext::Quirks::shouldIgnoreMarginTop(const LayoutState& layoutState, const Box& layoutBox) 96 85 {
Note:
See TracChangeset
for help on using the changeset viewer.