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

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: nits Created 4 years, 6 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 329
330 m_relaidOutChildren.clear(); 330 m_relaidOutChildren.clear();
331 331
332 if (updateLogicalWidthAndColumnWidth()) 332 if (updateLogicalWidthAndColumnWidth())
333 relayoutChildren = true; 333 relayoutChildren = true;
334 334
335 SubtreeLayoutScope layoutScope(*this); 335 SubtreeLayoutScope layoutScope(*this);
336 LayoutUnit previousHeight = logicalHeight(); 336 LayoutUnit previousHeight = logicalHeight();
337 setLogicalHeight(borderAndPaddingLogicalHeight() + scrollbarLogicalHeight()) ; 337 setLogicalHeight(borderAndPaddingLogicalHeight() + scrollbarLogicalHeight()) ;
338 338
339 PaintLayerScrollableArea::DelayScrollPositionClampScope delayClampScope;
340
339 { 341 {
340 TextAutosizer::LayoutScope textAutosizerLayoutScope(this, &layoutScope); 342 TextAutosizer::LayoutScope textAutosizerLayoutScope(this, &layoutScope);
341 LayoutState state(*this, locationOffset()); 343 LayoutState state(*this, locationOffset());
342 344
343 m_numberOfInFlowChildrenOnFirstLine = -1; 345 m_numberOfInFlowChildrenOnFirstLine = -1;
344 346
345 LayoutBlock::startDelayUpdateScrollInfo();
346
347 prepareOrderIteratorAndMargins(); 347 prepareOrderIteratorAndMargins();
348 348
349 layoutFlexItems(relayoutChildren, layoutScope); 349 layoutFlexItems(relayoutChildren, layoutScope);
350 350 if (PaintLayerScrollableArea::PreventRelayoutScope::relayoutNeeded()) {
351 ScrollPositionMap scrollMap; 351 PaintLayerScrollableArea::FreezeScrollbarsScope freezeScrollbarsScop e;
352 if (LayoutBlock::finishDelayUpdateScrollInfo(&layoutScope, &scrollMap)) {
353 prepareOrderIteratorAndMargins(); 352 prepareOrderIteratorAndMargins();
354 layoutFlexItems(false, layoutScope); 353 layoutFlexItems(true, layoutScope);
355 for (auto& entry : scrollMap) { 354 PaintLayerScrollableArea::PreventRelayoutScope::resetRelayoutNeeded( );
356 entry.key->scrollToPosition(entry.value, ScrollOffsetClamped);
357 }
358 } 355 }
359 356
360 if (logicalHeight() != previousHeight) 357 if (logicalHeight() != previousHeight)
361 relayoutChildren = true; 358 relayoutChildren = true;
362 359
363 layoutPositionedObjects(relayoutChildren || isDocumentElement()); 360 layoutPositionedObjects(relayoutChildren || isDocumentElement());
364 361
365 // FIXME: css3/flexbox/repaint-rtl-column.html seems to issue paint inva lidations for more overflow than it needs to. 362 // FIXME: css3/flexbox/repaint-rtl-column.html seems to issue paint inva lidations for more overflow than it needs to.
366 computeOverflow(clientLogicalBottomAfterRepositioning()); 363 computeOverflow(clientLogicalBottomAfterRepositioning());
367 } 364 }
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 Vector<LineContext> lineContexts; 841 Vector<LineContext> lineContexts;
845 OrderedFlexItemList orderedChildren; 842 OrderedFlexItemList orderedChildren;
846 LayoutUnit sumFlexBaseSize; 843 LayoutUnit sumFlexBaseSize;
847 double totalFlexGrow; 844 double totalFlexGrow;
848 double totalFlexShrink; 845 double totalFlexShrink;
849 double totalWeightedFlexShrink; 846 double totalWeightedFlexShrink;
850 LayoutUnit sumHypotheticalMainSize; 847 LayoutUnit sumHypotheticalMainSize;
851 848
852 Vector<LayoutUnit, 16> childSizes; 849 Vector<LayoutUnit, 16> childSizes;
853 850
851 PaintLayerScrollableArea::PreventRelayoutScope preventRelayoutScope(layoutSc ope);
852
854 dirtyForLayoutFromPercentageHeightDescendants(layoutScope); 853 dirtyForLayoutFromPercentageHeightDescendants(layoutScope);
855 854
856 m_orderIterator.first(); 855 m_orderIterator.first();
857 LayoutUnit crossAxisOffset = flowAwareBorderBefore() + flowAwarePaddingBefor e(); 856 LayoutUnit crossAxisOffset = flowAwareBorderBefore() + flowAwarePaddingBefor e();
858 while (computeNextFlexLine(orderedChildren, sumFlexBaseSize, totalFlexGrow, totalFlexShrink, totalWeightedFlexShrink, sumHypotheticalMainSize, relayoutChild ren)) { 857 while (computeNextFlexLine(orderedChildren, sumFlexBaseSize, totalFlexGrow, totalFlexShrink, totalWeightedFlexShrink, sumHypotheticalMainSize, relayoutChild ren)) {
859 LayoutUnit containerMainInnerSize = mainAxisContentExtent(sumHypothetica lMainSize); 858 LayoutUnit containerMainInnerSize = mainAxisContentExtent(sumHypothetica lMainSize);
860 // availableFreeSpace is the initial amount of free space in this flexbo x. 859 // availableFreeSpace is the initial amount of free space in this flexbo x.
861 // remainingFreeSpace starts out at the same value but as we place and l ay out 860 // remainingFreeSpace starts out at the same value but as we place and l ay out
862 // flex items we subtract from it. Note that both values can be negative . 861 // flex items we subtract from it. Note that both values can be negative .
863 const LayoutUnit availableFreeSpace = containerMainInnerSize - sumFlexBa seSize; 862 const LayoutUnit availableFreeSpace = containerMainInnerSize - sumFlexBa seSize;
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 ASSERT(child); 1861 ASSERT(child);
1863 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1862 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1864 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1863 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1865 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1864 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1866 adjustAlignmentForChild(*child, newOffset - originalOffset); 1865 adjustAlignmentForChild(*child, newOffset - originalOffset);
1867 } 1866 }
1868 } 1867 }
1869 } 1868 }
1870 1869
1871 } // namespace blink 1870 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698