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

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

Issue 2495343002: Revert of Paint collapsed borders of a table as one display item (Closed)
Patch Set: 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 * 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 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 745
746 // FIXME: This value isn't the intrinsic content logical height, but we need 746 // FIXME: This value isn't the intrinsic content logical height, but we need
747 // to update the value as its used by flexbox layout. crbug.com/367324 747 // to update the value as its used by flexbox layout. crbug.com/367324
748 setIntrinsicContentLogicalHeight(contentLogicalHeight()); 748 setIntrinsicContentLogicalHeight(contentLogicalHeight());
749 749
750 m_columnLogicalWidthChanged = false; 750 m_columnLogicalWidthChanged = false;
751 clearNeedsLayout(); 751 clearNeedsLayout();
752 } 752 }
753 753
754 void LayoutTable::invalidateCollapsedBorders() { 754 void LayoutTable::invalidateCollapsedBorders() {
755 m_collapsedBordersInfo = nullptr; 755 m_collapsedBorders.clear();
756 if (!collapseBorders()) 756 if (!collapseBorders())
757 return; 757 return;
758 758
759 m_collapsedBordersValid = false; 759 m_collapsedBordersValid = false;
760 setMayNeedPaintInvalidation(); 760 setMayNeedPaintInvalidation();
761 } 761 }
762 762
763 // Collect all the unique border values that we want to paint in a sorted list. 763 // Collect all the unique border values that we want to paint in a sorted list.
764 // During the collection, each cell saves its recalculated borders into the 764 // During the collection, each cell saves its recalculated borders into the
765 // cache of its containing section, and invalidates itself if any border 765 // cache of its containing section, and invalidates itself if any border
766 // changes. This method doesn't affect layout. 766 // changes. This method doesn't affect layout.
767 void LayoutTable::recalcCollapsedBordersIfNeeded() { 767 void LayoutTable::recalcCollapsedBordersIfNeeded() {
768 if (m_collapsedBordersValid) 768 if (m_collapsedBordersValid || !collapseBorders())
769 return; 769 return;
770 m_collapsedBordersValid = true; 770 m_collapsedBordersValid = true;
771 m_collapsedBordersInfo = nullptr; 771 m_collapsedBorders.clear();
772 if (!collapseBorders())
773 return;
774
775 LayoutRect boundsOfChangedCells;
776 Vector<CollapsedBorderValue> values;
777 for (LayoutObject* section = firstChild(); section; 772 for (LayoutObject* section = firstChild(); section;
778 section = section->nextSibling()) { 773 section = section->nextSibling()) {
779 if (!section->isTableSection()) 774 if (!section->isTableSection())
780 continue; 775 continue;
781 for (LayoutTableRow* row = toLayoutTableSection(section)->firstRow(); row; 776 for (LayoutTableRow* row = toLayoutTableSection(section)->firstRow(); row;
782 row = row->nextRow()) { 777 row = row->nextRow()) {
783 for (LayoutTableCell* cell = row->firstCell(); cell; 778 for (LayoutTableCell* cell = row->firstCell(); cell;
784 cell = cell->nextCell()) { 779 cell = cell->nextCell()) {
785 DCHECK(cell->table() == this); 780 ASSERT(cell->table() == this);
786 if (cell->collectBorderValues(values) && 781 cell->collectBorderValues(m_collapsedBorders);
787 !shouldDoFullPaintInvalidation()) {
788 LayoutRect cellRect = cell->localVisualRect();
789 cell->mapToVisualRectInAncestorSpace(this, cellRect);
790 boundsOfChangedCells.unite(cellRect);
791 }
792 } 782 }
793 } 783 }
794 } 784 }
795 if (!values.isEmpty()) { 785 LayoutTableCell::sortBorderValues(m_collapsedBorders);
796 LayoutTableCell::sortBorderValues(values);
797 m_collapsedBordersInfo =
798 wrapUnique(new CollapsedBordersInfo(std::move(values)));
799 }
800
801 invalidatePaintRectangle(boundsOfChangedCells);
802 } 786 }
803 787
804 void LayoutTable::addOverflowFromChildren() { 788 void LayoutTable::addOverflowFromChildren() {
805 // Add overflow from borders. 789 // Add overflow from borders.
806 // Technically it's odd that we are incorporating the borders into layout 790 // Technically it's odd that we are incorporating the borders into layout
807 // overflow, which is only supposed to be about overflow from our 791 // overflow, which is only supposed to be about overflow from our
808 // descendant objects, but since tables don't support overflow:auto, this 792 // descendant objects, but since tables don't support overflow:auto, this
809 // works out fine. 793 // works out fine.
810 if (collapseBorders()) { 794 if (collapseBorders()) {
811 int rightBorderOverflow = 795 int rightBorderOverflow =
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 return style()->borderStart(); 1655 return style()->borderStart();
1672 } 1656 }
1673 1657
1674 void LayoutTable::ensureIsReadyForPaintInvalidation() { 1658 void LayoutTable::ensureIsReadyForPaintInvalidation() {
1675 LayoutBlock::ensureIsReadyForPaintInvalidation(); 1659 LayoutBlock::ensureIsReadyForPaintInvalidation();
1676 recalcCollapsedBordersIfNeeded(); 1660 recalcCollapsedBordersIfNeeded();
1677 } 1661 }
1678 1662
1679 PaintInvalidationReason LayoutTable::invalidatePaintIfNeeded( 1663 PaintInvalidationReason LayoutTable::invalidatePaintIfNeeded(
1680 const PaintInvalidationState& paintInvalidationState) { 1664 const PaintInvalidationState& paintInvalidationState) {
1681 if (hasCollapsedBorders()) { 1665 if (collapseBorders() && !m_collapsedBorders.isEmpty())
1682 paintInvalidationState.paintingLayer() 1666 paintInvalidationState.paintingLayer()
1683 .setNeedsPaintPhaseDescendantBlockBackgrounds(); 1667 .setNeedsPaintPhaseDescendantBlockBackgrounds();
1684 } 1668
1685 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState); 1669 return LayoutBlock::invalidatePaintIfNeeded(paintInvalidationState);
1686 } 1670 }
1687 1671
1688 PaintInvalidationReason LayoutTable::invalidatePaintIfNeeded( 1672 PaintInvalidationReason LayoutTable::invalidatePaintIfNeeded(
1689 const PaintInvalidatorContext& context) const { 1673 const PaintInvalidatorContext& context) const {
1690 return TablePaintInvalidator(*this, context).invalidatePaintIfNeeded(); 1674 return TablePaintInvalidator(*this, context).invalidatePaintIfNeeded();
1691 } 1675 }
1692 1676
1693 LayoutUnit LayoutTable::paddingTop() const { 1677 LayoutUnit LayoutTable::paddingTop() const {
1694 if (collapseBorders()) 1678 if (collapseBorders())
(...skipping 17 matching lines...) Expand all
1712 } 1696 }
1713 1697
1714 LayoutUnit LayoutTable::paddingRight() const { 1698 LayoutUnit LayoutTable::paddingRight() const {
1715 if (collapseBorders()) 1699 if (collapseBorders())
1716 return LayoutUnit(); 1700 return LayoutUnit();
1717 1701
1718 return LayoutBlock::paddingRight(); 1702 return LayoutBlock::paddingRight();
1719 } 1703 }
1720 1704
1721 } // namespace blink 1705 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTable.h ('k') | third_party/WebKit/Source/core/layout/LayoutTableCell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698