Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp

Issue 1930183002: Refactor scroll updates during flexbox layout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@rtl-scroll-origin
Patch Set: Fix layout invalidation reason Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 271
272 m_relaidOutChildren.clear(); 272 m_relaidOutChildren.clear();
273 273
274 if (updateLogicalWidthAndColumnWidth()) 274 if (updateLogicalWidthAndColumnWidth())
275 relayoutChildren = true; 275 relayoutChildren = true;
276 276
277 SubtreeLayoutScope layoutScope(*this); 277 SubtreeLayoutScope layoutScope(*this);
278 LayoutUnit previousHeight = logicalHeight(); 278 LayoutUnit previousHeight = logicalHeight();
279 setLogicalHeight(borderAndPaddingLogicalHeight() + scrollbarLogicalHeight()) ; 279 setLogicalHeight(borderAndPaddingLogicalHeight() + scrollbarLogicalHeight()) ;
280 280
281 PaintLayerScrollableArea::DelayScrollPositionClampScope delayClampScope;
282
281 { 283 {
282 TextAutosizer::LayoutScope textAutosizerLayoutScope(this, &layoutScope); 284 TextAutosizer::LayoutScope textAutosizerLayoutScope(this, &layoutScope);
283 LayoutState state(*this, locationOffset()); 285 LayoutState state(*this, locationOffset());
284 286
285 m_numberOfInFlowChildrenOnFirstLine = -1; 287 m_numberOfInFlowChildrenOnFirstLine = -1;
286 288
287 LayoutBlock::startDelayUpdateScrollInfo();
288
289 prepareOrderIteratorAndMargins(); 289 prepareOrderIteratorAndMargins();
290 290
291 layoutFlexItems(relayoutChildren, layoutScope); 291 layoutFlexItems(relayoutChildren, layoutScope);
292 292 if (PaintLayerScrollableArea::PreventRelayoutScope::relayoutNeeded()) {
293 ScrollPositionMap scrollMap; 293 PaintLayerScrollableArea::FreezeScrollbarsScope freezeScrollbarsScop e;
294 if (LayoutBlock::finishDelayUpdateScrollInfo(&layoutScope, &scrollMap)) { 294 layoutFlexItems(true, layoutScope);
295 layoutFlexItems(false, layoutScope); 295 PaintLayerScrollableArea::PreventRelayoutScope::resetRelayoutNeeded( );
296 for (auto& entry : scrollMap) {
297 entry.key->scrollToPosition(entry.value, ScrollOffsetClamped);
298 }
299 } 296 }
300 297
301 if (logicalHeight() != previousHeight) 298 if (logicalHeight() != previousHeight)
302 relayoutChildren = true; 299 relayoutChildren = true;
303 300
304 layoutPositionedObjects(relayoutChildren || isDocumentElement()); 301 layoutPositionedObjects(relayoutChildren || isDocumentElement());
305 302
306 // FIXME: css3/flexbox/repaint-rtl-column.html seems to issue paint inva lidations for more overflow than it needs to. 303 // FIXME: css3/flexbox/repaint-rtl-column.html seems to issue paint inva lidations for more overflow than it needs to.
307 computeOverflow(clientLogicalBottomAfterRepositioning()); 304 computeOverflow(clientLogicalBottomAfterRepositioning());
308 } 305 }
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 Vector<LineContext> lineContexts; 780 Vector<LineContext> lineContexts;
784 OrderedFlexItemList orderedChildren; 781 OrderedFlexItemList orderedChildren;
785 LayoutUnit sumFlexBaseSize; 782 LayoutUnit sumFlexBaseSize;
786 double totalFlexGrow; 783 double totalFlexGrow;
787 double totalFlexShrink; 784 double totalFlexShrink;
788 double totalWeightedFlexShrink; 785 double totalWeightedFlexShrink;
789 LayoutUnit sumHypotheticalMainSize; 786 LayoutUnit sumHypotheticalMainSize;
790 787
791 Vector<LayoutUnit, 16> childSizes; 788 Vector<LayoutUnit, 16> childSizes;
792 789
790 PaintLayerScrollableArea::PreventRelayoutScope preventRelayoutScope(layoutSc ope);
791
793 dirtyForLayoutFromPercentageHeightDescendants(layoutScope); 792 dirtyForLayoutFromPercentageHeightDescendants(layoutScope);
794 793
795 m_orderIterator.first(); 794 m_orderIterator.first();
796 LayoutUnit crossAxisOffset = flowAwareBorderBefore() + flowAwarePaddingBefor e(); 795 LayoutUnit crossAxisOffset = flowAwareBorderBefore() + flowAwarePaddingBefor e();
797 while (computeNextFlexLine(orderedChildren, sumFlexBaseSize, totalFlexGrow, totalFlexShrink, totalWeightedFlexShrink, sumHypotheticalMainSize, relayoutChild ren)) { 796 while (computeNextFlexLine(orderedChildren, sumFlexBaseSize, totalFlexGrow, totalFlexShrink, totalWeightedFlexShrink, sumHypotheticalMainSize, relayoutChild ren)) {
798 LayoutUnit containerMainInnerSize = mainAxisContentExtent(sumHypothetica lMainSize); 797 LayoutUnit containerMainInnerSize = mainAxisContentExtent(sumHypothetica lMainSize);
799 // availableFreeSpace is the initial amount of free space in this flexbo x. 798 // availableFreeSpace is the initial amount of free space in this flexbo x.
800 // remainingFreeSpace starts out at the same value but as we place and l ay out 799 // remainingFreeSpace starts out at the same value but as we place and l ay out
801 // flex items we subtract from it. Note that both values can be negative . 800 // flex items we subtract from it. Note that both values can be negative .
802 const LayoutUnit availableFreeSpace = containerMainInnerSize - sumFlexBa seSize; 801 const LayoutUnit availableFreeSpace = containerMainInnerSize - sumFlexBa seSize;
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 ASSERT(child); 1790 ASSERT(child);
1792 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1791 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1793 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1792 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1794 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1793 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1795 adjustAlignmentForChild(*child, newOffset - originalOffset); 1794 adjustAlignmentForChild(*child, newOffset - originalOffset);
1796 } 1795 }
1797 } 1796 }
1798 } 1797 }
1799 1798
1800 } // namespace blink 1799 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698