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

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

Issue 2462643002: Be more restrictive about forcing relayout of children for pagination. (Closed)
Patch Set: No need to call updateFragmentationInfoForChild() when not paginated. Created 4 years, 1 month 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 relayoutChildren = true; 397 relayoutChildren = true;
398 398
399 layoutPositionedObjects(relayoutChildren || isDocumentElement()); 399 layoutPositionedObjects(relayoutChildren || isDocumentElement());
400 400
401 computeOverflow(oldClientAfterEdge); 401 computeOverflow(oldClientAfterEdge);
402 } 402 }
403 403
404 updateLayerTransformAfterLayout(); 404 updateLayerTransformAfterLayout();
405 updateAfterLayout(); 405 updateAfterLayout();
406 406
407 if (view()->layoutState()->pageLogicalHeight())
408 setPageLogicalOffset(
409 view()->layoutState()->pageLogicalOffset(*this, logicalTop()));
410
411 clearNeedsLayout(); 407 clearNeedsLayout();
412 } 408 }
413 409
414 // The first walk over our kids is to find out if we have any flexible children. 410 // The first walk over our kids is to find out if we have any flexible children.
415 static void gatherFlexChildrenInfo(FlexBoxIterator& iterator, 411 static void gatherFlexChildrenInfo(FlexBoxIterator& iterator,
416 bool relayoutChildren, 412 bool relayoutChildren,
417 unsigned& highestFlexGroup, 413 unsigned& highestFlexGroup,
418 unsigned& lowestFlexGroup, 414 unsigned& lowestFlexGroup,
419 bool& haveFlex) { 415 bool& haveFlex) {
420 for (LayoutBox* child = iterator.first(); child; child = iterator.next()) { 416 for (LayoutBox* child = iterator.first(); child; child = iterator.next()) {
(...skipping 17 matching lines...) Expand all
438 } 434 }
439 } 435 }
440 } 436 }
441 437
442 void LayoutDeprecatedFlexibleBox::layoutHorizontalBox(bool relayoutChildren) { 438 void LayoutDeprecatedFlexibleBox::layoutHorizontalBox(bool relayoutChildren) {
443 LayoutUnit toAdd = 439 LayoutUnit toAdd =
444 borderBottom() + paddingBottom() + horizontalScrollbarHeight(); 440 borderBottom() + paddingBottom() + horizontalScrollbarHeight();
445 LayoutUnit yPos = borderTop() + paddingTop(); 441 LayoutUnit yPos = borderTop() + paddingTop();
446 LayoutUnit xPos = borderLeft() + paddingLeft(); 442 LayoutUnit xPos = borderLeft() + paddingLeft();
447 bool heightSpecified = false; 443 bool heightSpecified = false;
444 bool paginated = view()->layoutState()->isPaginated();
448 LayoutUnit oldHeight; 445 LayoutUnit oldHeight;
449 446
450 LayoutUnit remainingSpace; 447 LayoutUnit remainingSpace;
451 448
452 FlexBoxIterator iterator(this); 449 FlexBoxIterator iterator(this);
453 unsigned highestFlexGroup = 0; 450 unsigned highestFlexGroup = 0;
454 unsigned lowestFlexGroup = 0; 451 unsigned lowestFlexGroup = 0;
455 bool haveFlex = false, flexingChildren = false; 452 bool haveFlex = false, flexingChildren = false;
456 gatherFlexChildrenInfo(iterator, relayoutChildren, highestFlexGroup, 453 gatherFlexChildrenInfo(iterator, relayoutChildren, highestFlexGroup,
457 lowestFlexGroup, haveFlex); 454 lowestFlexGroup, haveFlex);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 504
508 // Update our maximum descent. 505 // Update our maximum descent.
509 maxDescent = std::max(maxDescent, descent); 506 maxDescent = std::max(maxDescent, descent);
510 507
511 // Now update our height. 508 // Now update our height.
512 setHeight(std::max(yPos + maxAscent + maxDescent, size().height())); 509 setHeight(std::max(yPos + maxAscent + maxDescent, size().height()));
513 } else { 510 } else {
514 setHeight(std::max(size().height(), yPos + child->size().height() + 511 setHeight(std::max(size().height(), yPos + child->size().height() +
515 child->marginHeight())); 512 child->marginHeight()));
516 } 513 }
514
515 if (paginated)
516 updateFragmentationInfoForChild(*child);
517 } 517 }
518 518
519 if (!iterator.first() && hasLineIfEmpty()) 519 if (!iterator.first() && hasLineIfEmpty())
520 setHeight(size().height() + lineHeight(true, 520 setHeight(size().height() + lineHeight(true,
521 style()->isHorizontalWritingMode() 521 style()->isHorizontalWritingMode()
522 ? HorizontalLine 522 ? HorizontalLine
523 : VerticalLine, 523 : VerticalLine,
524 PositionOfInteriorLineBoxes)); 524 PositionOfInteriorLineBoxes));
525 525
526 setHeight(size().height() + toAdd); 526 setHeight(size().height() + toAdd);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 // to the intrinsic height before returning. 777 // to the intrinsic height before returning.
778 if (heightSpecified) 778 if (heightSpecified)
779 setHeight(oldHeight); 779 setHeight(oldHeight);
780 } 780 }
781 781
782 void LayoutDeprecatedFlexibleBox::layoutVerticalBox(bool relayoutChildren) { 782 void LayoutDeprecatedFlexibleBox::layoutVerticalBox(bool relayoutChildren) {
783 LayoutUnit yPos = borderTop() + paddingTop(); 783 LayoutUnit yPos = borderTop() + paddingTop();
784 LayoutUnit toAdd = 784 LayoutUnit toAdd =
785 borderBottom() + paddingBottom() + horizontalScrollbarHeight(); 785 borderBottom() + paddingBottom() + horizontalScrollbarHeight();
786 bool heightSpecified = false; 786 bool heightSpecified = false;
787 bool paginated = view()->layoutState()->isPaginated();
787 LayoutUnit oldHeight; 788 LayoutUnit oldHeight;
788 789
789 LayoutUnit remainingSpace; 790 LayoutUnit remainingSpace;
790 791
791 FlexBoxIterator iterator(this); 792 FlexBoxIterator iterator(this);
792 unsigned highestFlexGroup = 0; 793 unsigned highestFlexGroup = 0;
793 unsigned lowestFlexGroup = 0; 794 unsigned lowestFlexGroup = 0;
794 bool haveFlex = false, flexingChildren = false; 795 bool haveFlex = false, flexingChildren = false;
795 gatherFlexChildrenInfo(iterator, relayoutChildren, highestFlexGroup, 796 gatherFlexChildrenInfo(iterator, relayoutChildren, highestFlexGroup,
796 lowestFlexGroup, haveFlex); 797 lowestFlexGroup, haveFlex);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 else 876 else
876 childX += 877 childX +=
877 contentWidth() - child->marginRight() - child->size().width(); 878 contentWidth() - child->marginRight() - child->size().width();
878 break; 879 break;
879 } 880 }
880 881
881 // Place the child. 882 // Place the child.
882 placeChild(child, LayoutPoint(childX, size().height())); 883 placeChild(child, LayoutPoint(childX, size().height()));
883 setHeight(size().height() + child->size().height() + 884 setHeight(size().height() + child->size().height() +
884 child->marginBottom()); 885 child->marginBottom());
886
887 if (paginated)
888 updateFragmentationInfoForChild(*child);
885 } 889 }
886 890
887 yPos = size().height(); 891 yPos = size().height();
888 892
889 if (!iterator.first() && hasLineIfEmpty()) 893 if (!iterator.first() && hasLineIfEmpty())
890 setHeight(size().height() + lineHeight(true, 894 setHeight(size().height() + lineHeight(true,
891 style()->isHorizontalWritingMode() 895 style()->isHorizontalWritingMode()
892 ? HorizontalLine 896 ? HorizontalLine
893 : VerticalLine, 897 : VerticalLine,
894 PositionOfInteriorLineBoxes)); 898 PositionOfInteriorLineBoxes));
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 if (minHeight.isFixed() || minHeight.isAuto()) { 1265 if (minHeight.isFixed() || minHeight.isAuto()) {
1262 LayoutUnit minHeight(child->style()->minHeight().value()); 1266 LayoutUnit minHeight(child->style()->minHeight().value());
1263 LayoutUnit height = contentHeightForChild(child); 1267 LayoutUnit height = contentHeightForChild(child);
1264 LayoutUnit allowedShrinkage = (minHeight - height).clampPositiveToZero(); 1268 LayoutUnit allowedShrinkage = (minHeight - height).clampPositiveToZero();
1265 return allowedShrinkage; 1269 return allowedShrinkage;
1266 } 1270 }
1267 return LayoutUnit(); 1271 return LayoutUnit();
1268 } 1272 }
1269 1273
1270 } // namespace blink 1274 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.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