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

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: 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 * 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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 416
417 LayoutUnit remainingSpace; 417 LayoutUnit remainingSpace;
418 418
419 419
420 FlexBoxIterator iterator(this); 420 FlexBoxIterator iterator(this);
421 unsigned highestFlexGroup = 0; 421 unsigned highestFlexGroup = 0;
422 unsigned lowestFlexGroup = 0; 422 unsigned lowestFlexGroup = 0;
423 bool haveFlex = false, flexingChildren = false; 423 bool haveFlex = false, flexingChildren = false;
424 gatherFlexChildrenInfo(iterator, relayoutChildren, highestFlexGroup, lowestF lexGroup, haveFlex); 424 gatherFlexChildrenInfo(iterator, relayoutChildren, highestFlexGroup, lowestF lexGroup, haveFlex);
425 425
426 LayoutBlock::startDelayUpdateScrollInfo(); 426 PaintLayerScrollableArea::DelayScrollPositionClampScope delayClampScope;
427 427
428 // We do 2 passes. The first pass is simply to lay everyone out at 428 // We do 2 passes. The first pass is simply to lay everyone out at
429 // their preferred widths. The second pass handles flexing the children. 429 // their preferred widths. The second pass handles flexing the children.
430 do { 430 do {
431 // Reset our height. 431 // Reset our height.
432 setHeight(yPos); 432 setHeight(yPos);
433 433
434 xPos = borderLeft() + paddingLeft(); 434 xPos = borderLeft() + paddingLeft();
435 435
436 // Our first pass is done without flexing. We simply lay the children 436 // Our first pass is done without flexing. We simply lay the children
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 } 639 }
640 } while (absoluteValue(groupRemainingSpace) >= 1); 640 } while (absoluteValue(groupRemainingSpace) >= 1);
641 } 641 }
642 642
643 // We didn't find any children that could grow. 643 // We didn't find any children that could grow.
644 if (haveFlex && !flexingChildren) 644 if (haveFlex && !flexingChildren)
645 haveFlex = false; 645 haveFlex = false;
646 } 646 }
647 } while (haveFlex); 647 } while (haveFlex);
648 648
649 LayoutBlock::finishDelayUpdateScrollInfo(nullptr, nullptr);
650
651 if (remainingSpace > 0 && ((style()->isLeftToRightDirection() && style()->bo xPack() != BoxPackStart) 649 if (remainingSpace > 0 && ((style()->isLeftToRightDirection() && style()->bo xPack() != BoxPackStart)
652 || (!style()->isLeftToRightDirection() && style()->boxPack() != BoxPackE nd))) { 650 || (!style()->isLeftToRightDirection() && style()->boxPack() != BoxPackE nd))) {
653 // Children must be repositioned. 651 // Children must be repositioned.
654 LayoutUnit offset; 652 LayoutUnit offset;
655 if (style()->boxPack() == BoxPackJustify) { 653 if (style()->boxPack() == BoxPackJustify) {
656 // Determine the total number of children. 654 // Determine the total number of children.
657 int totalChildren = 0; 655 int totalChildren = 0;
658 for (LayoutBox* child = iterator.first(); child; child = iterator.ne xt()) { 656 for (LayoutBox* child = iterator.first(); child; child = iterator.ne xt()) {
659 if (childDoesNotAffectWidthOrFlexing(child)) 657 if (childDoesNotAffectWidthOrFlexing(child))
660 continue; 658 continue;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 unsigned lowestFlexGroup = 0; 714 unsigned lowestFlexGroup = 0;
717 bool haveFlex = false, flexingChildren = false; 715 bool haveFlex = false, flexingChildren = false;
718 gatherFlexChildrenInfo(iterator, relayoutChildren, highestFlexGroup, lowestF lexGroup, haveFlex); 716 gatherFlexChildrenInfo(iterator, relayoutChildren, highestFlexGroup, lowestF lexGroup, haveFlex);
719 717
720 // We confine the line clamp ugliness to vertical flexible boxes (thus keepi ng it out of 718 // We confine the line clamp ugliness to vertical flexible boxes (thus keepi ng it out of
721 // mainstream block layout); this is not really part of the XUL box model. 719 // mainstream block layout); this is not really part of the XUL box model.
722 bool haveLineClamp = !style()->lineClamp().isNone(); 720 bool haveLineClamp = !style()->lineClamp().isNone();
723 if (haveLineClamp) 721 if (haveLineClamp)
724 applyLineClamp(iterator, relayoutChildren); 722 applyLineClamp(iterator, relayoutChildren);
725 723
726 LayoutBlock::startDelayUpdateScrollInfo(); 724 PaintLayerScrollableArea::DelayScrollPositionClampScope delayClampScope;
727 725
728 // We do 2 passes. The first pass is simply to lay everyone out at 726 // We do 2 passes. The first pass is simply to lay everyone out at
729 // their preferred widths. The second pass handles flexing the children. 727 // their preferred widths. The second pass handles flexing the children.
730 // Our first pass is done without flexing. We simply lay the children 728 // Our first pass is done without flexing. We simply lay the children
731 // out within the box. 729 // out within the box.
732 do { 730 do {
733 setHeight(borderTop() + paddingTop()); 731 setHeight(borderTop() + paddingTop());
734 LayoutUnit minHeight = size().height() + toAdd; 732 LayoutUnit minHeight = size().height() + toAdd;
735 733
736 for (LayoutBox* child = iterator.first(); child; child = iterator.next() ) { 734 for (LayoutBox* child = iterator.first(); child; child = iterator.next() ) {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 } 888 }
891 } while (absoluteValue(groupRemainingSpace) >= 1); 889 } while (absoluteValue(groupRemainingSpace) >= 1);
892 } 890 }
893 891
894 // We didn't find any children that could grow. 892 // We didn't find any children that could grow.
895 if (haveFlex && !flexingChildren) 893 if (haveFlex && !flexingChildren)
896 haveFlex = false; 894 haveFlex = false;
897 } 895 }
898 } while (haveFlex); 896 } while (haveFlex);
899 897
900 LayoutBlock::finishDelayUpdateScrollInfo(nullptr, nullptr);
901
902 if (style()->boxPack() != BoxPackStart && remainingSpace > 0) { 898 if (style()->boxPack() != BoxPackStart && remainingSpace > 0) {
903 // Children must be repositioned. 899 // Children must be repositioned.
904 LayoutUnit offset; 900 LayoutUnit offset;
905 if (style()->boxPack() == BoxPackJustify) { 901 if (style()->boxPack() == BoxPackJustify) {
906 // Determine the total number of children. 902 // Determine the total number of children.
907 int totalChildren = 0; 903 int totalChildren = 0;
908 for (LayoutBox* child = iterator.first(); child; child = iterator.ne xt()) { 904 for (LayoutBox* child = iterator.first(); child; child = iterator.ne xt()) {
909 if (childDoesNotAffectWidthOrFlexing(child)) 905 if (childDoesNotAffectWidthOrFlexing(child))
910 continue; 906 continue;
911 907
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 if (minHeight.isFixed() || minHeight.isAuto()) { 1108 if (minHeight.isFixed() || minHeight.isAuto()) {
1113 LayoutUnit minHeight(child->style()->minHeight().value()); 1109 LayoutUnit minHeight(child->style()->minHeight().value());
1114 LayoutUnit height = contentHeightForChild(child); 1110 LayoutUnit height = contentHeightForChild(child);
1115 LayoutUnit allowedShrinkage = (minHeight - height).clampPositiveToZero() ; 1111 LayoutUnit allowedShrinkage = (minHeight - height).clampPositiveToZero() ;
1116 return allowedShrinkage; 1112 return allowedShrinkage;
1117 } 1113 }
1118 return LayoutUnit(); 1114 return LayoutUnit();
1119 } 1115 }
1120 1116
1121 } // namespace blink 1117 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlock.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698