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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutDeprecatedFlexibleBox.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 * This file is part of the layout object implementation for KHTML. 2 * This file is part of the layout object implementation for KHTML.
3 * 3 *
4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
5 * (C) 1999 Antti Koivisto (koivisto@kde.org) 5 * (C) 1999 Antti Koivisto (koivisto@kde.org)
6 * Copyright (C) 2003 Apple Computer, Inc. 6 * Copyright (C) 2003 Apple Computer, Inc.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 302
303 LayoutUnit remainingSpace; 303 LayoutUnit remainingSpace;
304 304
305 305
306 FlexBoxIterator iterator(this); 306 FlexBoxIterator iterator(this);
307 unsigned highestFlexGroup = 0; 307 unsigned highestFlexGroup = 0;
308 unsigned lowestFlexGroup = 0; 308 unsigned lowestFlexGroup = 0;
309 bool haveFlex = false, flexingChildren = false; 309 bool haveFlex = false, flexingChildren = false;
310 gatherFlexChildrenInfo(iterator, relayoutChildren, highestFlexGroup, lowestF lexGroup, haveFlex); 310 gatherFlexChildrenInfo(iterator, relayoutChildren, highestFlexGroup, lowestF lexGroup, haveFlex);
311 311
312 LayoutBlock::startDelayUpdateScrollInfo(); 312 PaintLayerScrollableArea::DelayScrollPositionClampScope delayClampScope;
leviw_travelin_and_unemployed 2016/04/28 22:50:04 Grumble grumble DeprecatedFlexBox :( We have test
szager1 2016/05/12 20:44:50 I have no idea, and I'm not sure I should give a c
cbiesinger 2016/05/13 19:52:48 Yeah I wouldn't worry about this
313 313
314 // We do 2 passes. The first pass is simply to lay everyone out at 314 // We do 2 passes. The first pass is simply to lay everyone out at
315 // their preferred widths. The second pass handles flexing the children. 315 // their preferred widths. The second pass handles flexing the children.
316 do { 316 do {
317 // Reset our height. 317 // Reset our height.
318 setHeight(yPos); 318 setHeight(yPos);
319 319
320 xPos = borderLeft() + paddingLeft(); 320 xPos = borderLeft() + paddingLeft();
321 321
322 // Our first pass is done without flexing. We simply lay the children 322 // Our first pass is done without flexing. We simply lay the children
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 } 525 }
526 } while (absoluteValue(groupRemainingSpace) >= 1); 526 } while (absoluteValue(groupRemainingSpace) >= 1);
527 } 527 }
528 528
529 // We didn't find any children that could grow. 529 // We didn't find any children that could grow.
530 if (haveFlex && !flexingChildren) 530 if (haveFlex && !flexingChildren)
531 haveFlex = false; 531 haveFlex = false;
532 } 532 }
533 } while (haveFlex); 533 } while (haveFlex);
534 534
535 LayoutBlock::finishDelayUpdateScrollInfo(nullptr, nullptr);
536
537 if (remainingSpace > 0 && ((style()->isLeftToRightDirection() && style()->bo xPack() != Start) 535 if (remainingSpace > 0 && ((style()->isLeftToRightDirection() && style()->bo xPack() != Start)
538 || (!style()->isLeftToRightDirection() && style()->boxPack() != End))) { 536 || (!style()->isLeftToRightDirection() && style()->boxPack() != End))) {
539 // Children must be repositioned. 537 // Children must be repositioned.
540 LayoutUnit offset; 538 LayoutUnit offset;
541 if (style()->boxPack() == Justify) { 539 if (style()->boxPack() == Justify) {
542 // Determine the total number of children. 540 // Determine the total number of children.
543 int totalChildren = 0; 541 int totalChildren = 0;
544 for (LayoutBox* child = iterator.first(); child; child = iterator.ne xt()) { 542 for (LayoutBox* child = iterator.first(); child; child = iterator.ne xt()) {
545 if (childDoesNotAffectWidthOrFlexing(child)) 543 if (childDoesNotAffectWidthOrFlexing(child))
546 continue; 544 continue;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 unsigned lowestFlexGroup = 0; 600 unsigned lowestFlexGroup = 0;
603 bool haveFlex = false, flexingChildren = false; 601 bool haveFlex = false, flexingChildren = false;
604 gatherFlexChildrenInfo(iterator, relayoutChildren, highestFlexGroup, lowestF lexGroup, haveFlex); 602 gatherFlexChildrenInfo(iterator, relayoutChildren, highestFlexGroup, lowestF lexGroup, haveFlex);
605 603
606 // We confine the line clamp ugliness to vertical flexible boxes (thus keepi ng it out of 604 // We confine the line clamp ugliness to vertical flexible boxes (thus keepi ng it out of
607 // mainstream block layout); this is not really part of the XUL box model. 605 // mainstream block layout); this is not really part of the XUL box model.
608 bool haveLineClamp = !style()->lineClamp().isNone(); 606 bool haveLineClamp = !style()->lineClamp().isNone();
609 if (haveLineClamp) 607 if (haveLineClamp)
610 applyLineClamp(iterator, relayoutChildren); 608 applyLineClamp(iterator, relayoutChildren);
611 609
612 LayoutBlock::startDelayUpdateScrollInfo(); 610 PaintLayerScrollableArea::DelayScrollPositionClampScope delayClampScope;
613 611
614 // We do 2 passes. The first pass is simply to lay everyone out at 612 // We do 2 passes. The first pass is simply to lay everyone out at
615 // their preferred widths. The second pass handles flexing the children. 613 // their preferred widths. The second pass handles flexing the children.
616 // Our first pass is done without flexing. We simply lay the children 614 // Our first pass is done without flexing. We simply lay the children
617 // out within the box. 615 // out within the box.
618 do { 616 do {
619 setHeight(borderTop() + paddingTop()); 617 setHeight(borderTop() + paddingTop());
620 LayoutUnit minHeight = size().height() + toAdd; 618 LayoutUnit minHeight = size().height() + toAdd;
621 619
622 for (LayoutBox* child = iterator.first(); child; child = iterator.next() ) { 620 for (LayoutBox* child = iterator.first(); child; child = iterator.next() ) {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 } 774 }
777 } while (absoluteValue(groupRemainingSpace) >= 1); 775 } while (absoluteValue(groupRemainingSpace) >= 1);
778 } 776 }
779 777
780 // We didn't find any children that could grow. 778 // We didn't find any children that could grow.
781 if (haveFlex && !flexingChildren) 779 if (haveFlex && !flexingChildren)
782 haveFlex = false; 780 haveFlex = false;
783 } 781 }
784 } while (haveFlex); 782 } while (haveFlex);
785 783
786 LayoutBlock::finishDelayUpdateScrollInfo(nullptr, nullptr);
787
788 if (style()->boxPack() != Start && remainingSpace > 0) { 784 if (style()->boxPack() != Start && remainingSpace > 0) {
789 // Children must be repositioned. 785 // Children must be repositioned.
790 LayoutUnit offset; 786 LayoutUnit offset;
791 if (style()->boxPack() == Justify) { 787 if (style()->boxPack() == Justify) {
792 // Determine the total number of children. 788 // Determine the total number of children.
793 int totalChildren = 0; 789 int totalChildren = 0;
794 for (LayoutBox* child = iterator.first(); child; child = iterator.ne xt()) { 790 for (LayoutBox* child = iterator.first(); child; child = iterator.ne xt()) {
795 if (childDoesNotAffectWidthOrFlexing(child)) 791 if (childDoesNotAffectWidthOrFlexing(child))
796 continue; 792 continue;
797 793
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 if (minHeight.isFixed() || minHeight.isAuto()) { 993 if (minHeight.isFixed() || minHeight.isAuto()) {
998 LayoutUnit minHeight(child->style()->minHeight().value()); 994 LayoutUnit minHeight(child->style()->minHeight().value());
999 LayoutUnit height = contentHeightForChild(child); 995 LayoutUnit height = contentHeightForChild(child);
1000 LayoutUnit allowedShrinkage = (minHeight - height).clampPositiveToZero() ; 996 LayoutUnit allowedShrinkage = (minHeight - height).clampPositiveToZero() ;
1001 return allowedShrinkage; 997 return allowedShrinkage;
1002 } 998 }
1003 return LayoutUnit(); 999 return LayoutUnit();
1004 } 1000 }
1005 1001
1006 } // namespace blink 1002 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698