Changeset 252716 in webkit
- Timestamp:
- Nov 20, 2019, 3:52:40 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/repaint/align-items-change-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/rendering/RenderBlock.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderBlockFlow.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderBlockFlow.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderBox.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderBox.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderFlexibleBox.cpp (modified) (2 diffs)
-
Source/WebCore/rendering/RenderFlexibleBox.h (modified) (2 diffs)
-
Source/WebCore/rendering/RenderGrid.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderGrid.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderTable.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderTable.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r252715 r252716 1 2019-11-20 Zalan Bujtas <zalan@apple.com> 2 3 Flexbox sizing logic triggers full repaint on the flex items. 4 https://bugs.webkit.org/show_bug.cgi?id=204380 5 <rdar://problem/57236404> 6 7 Reviewed by Simon Fraser. 8 9 * fast/repaint/align-items-change-expected.txt: progression. 10 1 11 2019-11-20 Justin Fan <justin_fan@apple.com> 2 12 -
trunk/LayoutTests/fast/repaint/align-items-change-expected.txt
r219315 r252716 2 2 3 3 (repaint rects 4 (rect 0 52 100 300)5 (rect 0 51100 1)6 (rect 100 52 100 300)7 (rect 100 51100 1)4 (rect 0 154 100 198) 5 (rect 0 153 100 1) 6 (rect 100 204 100 148) 7 (rect 100 203 100 1) 8 8 (rect 0 52 200 300) 9 9 ) -
trunk/Source/WebCore/ChangeLog
r252710 r252716 1 2019-11-20 Zalan Bujtas <zalan@apple.com> 2 3 Flexbox sizing logic triggers full repaint on the flex items. 4 https://bugs.webkit.org/show_bug.cgi?id=204380 5 <rdar://problem/57236404> 6 7 Reviewed by Simon Fraser. 8 9 RenderFlexibleBox::applyStretchAlignmentToChild explicitly sets the child renderer's height to 0 before issuing layout on it. 10 This confuses the child's repaint logic and could trigger unnecessary repaints on complete subtrees. 11 12 Many ::layout functions plant a LayoutRepainter stack object to track and report paint invalidations. 13 It works as long as the renderer's geometry change happens within the scope of this LayoutRepainter. 14 When the parent (RenderFlexibleBox) mutates the renderer's geometry, the LayoutRepainter object sees 15 this already mutated state as the initial state and will happily issue repaints even when the final 16 geometry remains the same. 17 18 This patch addresses the redundant repaint by pushing the height reset from the parent down to the child, inside the LayoutRepainter scope. 19 20 * rendering/RenderBlock.h: Restrict it to RenderBlock level for now. It might need to go all the way up to RenderBox. 21 (WebCore::RenderBlock::shouldResetChildLogicalHeightBeforeLayout const): 22 * rendering/RenderBlockFlow.cpp: 23 (WebCore::RenderBlockFlow::layoutBlock): 24 * rendering/RenderBlockFlow.h: 25 * rendering/RenderBox.cpp: 26 (WebCore::RenderBox::resetLogicalHeightBeforeLayoutIfNeeded): 27 * rendering/RenderBox.h: 28 (WebCore::RenderBox::shouldResetLogicalHeightBeforeLayout const): 29 * rendering/RenderDeprecatedFlexibleBox.cpp: 30 (WebCore::RenderDeprecatedFlexibleBox::layoutBlock): 31 * rendering/RenderFlexibleBox.cpp: 32 (WebCore::RenderFlexibleBox::layoutBlock): 33 (WebCore::RenderFlexibleBox::applyStretchAlignmentToChild): 34 * rendering/RenderFlexibleBox.h: 35 * rendering/RenderGrid.cpp: 36 (WebCore::RenderGrid::layoutBlock): 37 * rendering/RenderGrid.h: 38 * rendering/RenderTable.cpp: 39 (WebCore::RenderTable::layout): 40 * rendering/RenderTable.h: 41 1 42 2019-11-20 Myles C. Maxfield <mmaxfield@apple.com> 2 43 -
trunk/Source/WebCore/rendering/RenderBlock.h
r248517 r252716 316 316 Optional<LayoutUnit> availableLogicalHeightForPercentageComputation() const; 317 317 bool hasDefiniteLogicalHeight() const; 318 318 319 virtual bool shouldResetChildLogicalHeightBeforeLayout(const RenderBox&) const { return false; } 320 319 321 protected: 320 322 RenderFragmentedFlow* locateEnclosingFragmentedFlow() const override; -
trunk/Source/WebCore/rendering/RenderBlockFlow.cpp
r250341 r252716 473 473 // FIXME: should this start out as borderAndPaddingLogicalHeight() + scrollbarLogicalHeight(), 474 474 // for consistency with other render classes? 475 setLogicalHeight(0);475 resetLogicalHeightBeforeLayoutIfNeeded(); 476 476 477 477 bool pageLogicalHeightChanged = false; -
trunk/Source/WebCore/rendering/RenderBlockFlow.h
r250234 r252716 392 392 393 393 protected: 394 bool shouldResetLogicalHeightBeforeLayout() const override { return true; } 395 394 396 void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override; 395 397 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r252161 r252716 568 568 } 569 569 570 void RenderBox::resetLogicalHeightBeforeLayoutIfNeeded() 571 { 572 if (shouldResetLogicalHeightBeforeLayout() || (is<RenderBlock>(parent()) && downcast<RenderBlock>(*parent()).shouldResetChildLogicalHeightBeforeLayout(*this))) 573 setLogicalHeight(0_lu); 574 } 575 570 576 static void setupWheelEventMonitor(RenderLayer& layer) 571 577 { -
trunk/Source/WebCore/rendering/RenderBox.h
r249222 r252716 655 655 bool createsNewFormattingContext() const; 656 656 657 virtual bool shouldResetLogicalHeightBeforeLayout() const { return false; } 658 void resetLogicalHeightBeforeLayoutIfNeeded(); 659 657 660 virtual ItemPosition selfAlignmentNormalBehavior(const RenderBox* = nullptr) const { return ItemPosition::Stretch; } 658 661 -
trunk/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
r246490 r252716 286 286 LayoutStateMaintainer statePusher(*this, locationOffset(), hasTransform() || hasReflection() || style().isFlippedBlocksWritingMode()); 287 287 288 resetLogicalHeightBeforeLayoutIfNeeded(); 288 289 preparePaginationBeforeBlockLayout(relayoutChildren); 289 290 -
trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp
r252620 r252716 263 263 LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); 264 264 265 resetLogicalHeightBeforeLayoutIfNeeded(); 265 266 m_relaidOutChildren.clear(); 266 267 … … 1840 1841 child.setOverrideContentLogicalHeight(desiredLogicalHeight - child.borderAndPaddingLogicalHeight()); 1841 1842 if (childNeedsRelayout) { 1842 child.setLogicalHeight(0_lu);1843 SetForScope<bool> resetChildLogicalHeight(m_shouldResetChildLogicalHeightBeforeLayout, true); 1843 1844 // We cache the child's intrinsic content logical height to avoid it being 1844 1845 // reset to the stretched height. 1845 // FIXME: This is fragile. Render tBoxes should be smart enough to1846 // FIXME: This is fragile. RenderBoxes should be smart enough to 1846 1847 // determine their intrinsic content logical height correctly even when 1847 1848 // there's an overrideHeight. -
trunk/Source/WebCore/rendering/RenderFlexibleBox.h
r252620 r252716 92 92 void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override; 93 93 void computePreferredLogicalWidths() override; 94 95 bool shouldResetChildLogicalHeightBeforeLayout(const RenderBox&) const override { return m_shouldResetChildLogicalHeightBeforeLayout; } 94 96 95 97 private: … … 212 214 mutable SizeDefiniteness m_hasDefiniteHeight { SizeDefiniteness::Unknown }; 213 215 bool m_inLayout { false }; 216 bool m_shouldResetChildLogicalHeightBeforeLayout { false }; 214 217 }; 215 218 -
trunk/Source/WebCore/rendering/RenderGrid.cpp
r248846 r252716 220 220 } 221 221 m_baselineItemsCached = true; 222 setLogicalHeight(0);222 resetLogicalHeightBeforeLayoutIfNeeded(); 223 223 updateLogicalWidth(); 224 224 -
trunk/Source/WebCore/rendering/RenderGrid.h
r240333 r252716 187 187 LayoutUnit translateRTLCoordinate(LayoutUnit) const; 188 188 189 bool shouldResetLogicalHeightBeforeLayout() const override { return true; } 190 189 191 Grid m_grid; 190 192 -
trunk/Source/WebCore/rendering/RenderTable.cpp
r252161 r252716 434 434 LayoutUnit oldLogicalWidth = logicalWidth(); 435 435 LayoutUnit oldLogicalHeight = logicalHeight(); 436 setLogicalHeight(0);436 resetLogicalHeightBeforeLayoutIfNeeded(); 437 437 updateLogicalWidth(); 438 438 -
trunk/Source/WebCore/rendering/RenderTable.h
r245868 r252716 362 362 } 363 363 364 bool shouldResetLogicalHeightBeforeLayout() const override { return true; } 365 364 366 LayoutUnit m_hSpacing; 365 367 LayoutUnit m_vSpacing;
Note:
See TracChangeset
for help on using the changeset viewer.