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

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

Issue 2692083002: Avoid unnecessary cell layout on nested percent height tables (Closed)
Patch Set: Created 3 years, 10 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) 1997 Martin Jones (mjones@kde.org) 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org) 3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org) 4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org) 5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 9 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
10 * 10 *
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 } 444 }
445 445
446 void LayoutTable::layoutSection(LayoutTableSection& section, 446 void LayoutTable::layoutSection(LayoutTableSection& section,
447 SubtreeLayoutScope& layouter, 447 SubtreeLayoutScope& layouter,
448 LayoutUnit logicalLeft) { 448 LayoutUnit logicalLeft) {
449 section.setLogicalLocation(LayoutPoint(logicalLeft, logicalHeight())); 449 section.setLogicalLocation(LayoutPoint(logicalLeft, logicalHeight()));
450 if (m_columnLogicalWidthChanged) 450 if (m_columnLogicalWidthChanged)
451 layouter.setChildNeedsLayout(&section); 451 layouter.setChildNeedsLayout(&section);
452 if (!section.needsLayout()) 452 if (!section.needsLayout())
453 markChildForPaginationRelayoutIfNeeded(section, layouter); 453 markChildForPaginationRelayoutIfNeeded(section, layouter);
454 section.layoutIfNeeded(); 454 if (section.needsLayout()) {
455 int sectionLogicalHeight = section.calcRowLogicalHeight(); 455 section.layout();
456 section.setLogicalHeight(LayoutUnit(sectionLogicalHeight)); 456 section.setLogicalHeight(LayoutUnit(section.calcRowLogicalHeight()));
457 }
457 if (view()->layoutState()->isPaginated()) 458 if (view()->layoutState()->isPaginated())
458 updateFragmentationInfoForChild(section); 459 updateFragmentationInfoForChild(section);
459 setLogicalHeight(logicalHeight() + sectionLogicalHeight); 460 setLogicalHeight(logicalHeight() + section.logicalHeight());
460 } 461 }
461 462
462 LayoutUnit LayoutTable::logicalHeightFromStyle() const { 463 LayoutUnit LayoutTable::logicalHeightFromStyle() const {
463 LayoutUnit computedLogicalHeight; 464 LayoutUnit computedLogicalHeight;
464 Length logicalHeightLength = style()->logicalHeight(); 465 Length logicalHeightLength = style()->logicalHeight();
465 if (logicalHeightLength.isIntrinsic() || 466 if (logicalHeightLength.isIntrinsic() ||
466 (logicalHeightLength.isSpecified() && logicalHeightLength.isPositive())) { 467 (logicalHeightLength.isSpecified() && logicalHeightLength.isPositive())) {
467 computedLogicalHeight = 468 computedLogicalHeight =
468 convertStyleLogicalHeightToComputedHeight(logicalHeightLength); 469 convertStyleLogicalHeightToComputedHeight(logicalHeightLength);
469 } 470 }
(...skipping 24 matching lines...) Expand all
494 void LayoutTable::distributeExtraLogicalHeight(int extraLogicalHeight) { 495 void LayoutTable::distributeExtraLogicalHeight(int extraLogicalHeight) {
495 if (extraLogicalHeight <= 0) 496 if (extraLogicalHeight <= 0)
496 return; 497 return;
497 498
498 // FIXME: Distribute the extra logical height between all table sections 499 // FIXME: Distribute the extra logical height between all table sections
499 // instead of giving it all to the first one. 500 // instead of giving it all to the first one.
500 if (LayoutTableSection* section = firstBody()) 501 if (LayoutTableSection* section = firstBody())
501 extraLogicalHeight -= 502 extraLogicalHeight -=
502 section->distributeExtraLogicalHeightToRows(extraLogicalHeight); 503 section->distributeExtraLogicalHeightToRows(extraLogicalHeight);
503 504
504 // FIXME: We really would like to enable this ASSERT to ensure that all the 505 // crbug.com/690087: We really would like to enable this ASSERT to ensure that
505 // extra space has been distributed. 506 // all the extra space has been distributed.
506 // However our current distribution algorithm does not round properly and thus 507 // However our current distribution algorithm does not round properly and thus
507 // we can have some remaining height. 508 // we can have some remaining height.
508 // ASSERT(!topSection() || !extraLogicalHeight); 509 // ASSERT(!topSection() || !extraLogicalHeight);
509 } 510 }
510 511
511 void LayoutTable::simplifiedNormalFlowLayout() { 512 void LayoutTable::simplifiedNormalFlowLayout() {
512 // FIXME: We should walk through the items in the tree in tree order to do the 513 // FIXME: We should walk through the items in the tree in tree order to do the
513 // layout here instead of walking through individual parts of the tree. 514 // layout here instead of walking through individual parts of the tree.
514 // crbug.com/442737 515 // crbug.com/442737
515 for (auto& caption : m_captions) 516 for (auto& caption : m_captions)
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 } 1689 }
1689 1690
1690 LayoutUnit LayoutTable::paddingRight() const { 1691 LayoutUnit LayoutTable::paddingRight() const {
1691 if (collapseBorders()) 1692 if (collapseBorders())
1692 return LayoutUnit(); 1693 return LayoutUnit();
1693 1694
1694 return LayoutBlock::paddingRight(); 1695 return LayoutBlock::paddingRight();
1695 } 1696 }
1696 1697
1697 } // namespace blink 1698 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698