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

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

Issue 2840723005: Don't always invalidate collapsed borders during table layout (Closed)
Patch Set: Created 3 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 * 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // layout. 95 // layout.
96 if (Style()->IsFixedTableLayout()) 96 if (Style()->IsFixedTableLayout())
97 table_layout_ = WTF::MakeUnique<TableLayoutAlgorithmFixed>(this); 97 table_layout_ = WTF::MakeUnique<TableLayoutAlgorithmFixed>(this);
98 else 98 else
99 table_layout_ = WTF::MakeUnique<TableLayoutAlgorithmAuto>(this); 99 table_layout_ = WTF::MakeUnique<TableLayoutAlgorithmAuto>(this);
100 } 100 }
101 101
102 if (!old_style) 102 if (!old_style)
103 return; 103 return;
104 104
105 LayoutTableBoxComponent::InvalidateCollapsedBordersOnStyleChange( 105 if (old_style->BorderCollapse() != StyleRef().BorderCollapse()) {
106 *this, *this, diff, *old_style); 106 InvalidateCollapsedBorders();
107 } else {
108 LayoutTableBoxComponent::InvalidateCollapsedBordersOnStyleChange(
109 *this, *this, diff, *old_style);
110 }
107 111
108 if (LayoutTableBoxComponent::DoCellsHaveDirtyWidth(*this, *this, diff, 112 if (LayoutTableBoxComponent::DoCellsHaveDirtyWidth(*this, *this, diff,
109 *old_style)) 113 *old_style))
110 MarkAllCellsWidthsDirtyAndOrNeedsLayout(kMarkDirtyAndNeedsLayout); 114 MarkAllCellsWidthsDirtyAndOrNeedsLayout(kMarkDirtyAndNeedsLayout);
111 } 115 }
112 116
113 static inline void ResetSectionPointerIfNotBefore(LayoutTableSection*& ptr, 117 static inline void ResetSectionPointerIfNotBefore(LayoutTableSection*& ptr,
114 LayoutObject* before) { 118 LayoutObject* before) {
115 if (!before || !ptr) 119 if (!before || !ptr)
116 return; 120 return;
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 753
750 UpdateLogicalHeight(); 754 UpdateLogicalHeight();
751 755
752 // table can be containing block of positioned elements. 756 // table can be containing block of positioned elements.
753 bool dimension_changed = old_logical_width != LogicalWidth() || 757 bool dimension_changed = old_logical_width != LogicalWidth() ||
754 old_logical_height != LogicalHeight(); 758 old_logical_height != LogicalHeight();
755 LayoutPositionedObjects(dimension_changed); 759 LayoutPositionedObjects(dimension_changed);
756 760
757 UpdateLayerTransformAfterLayout(); 761 UpdateLayerTransformAfterLayout();
758 762
759 // Layout was changed, so probably borders too.
760 InvalidateCollapsedBorders();
761
762 ComputeOverflow(ClientLogicalBottom()); 763 ComputeOverflow(ClientLogicalBottom());
763 UpdateAfterLayout(); 764 UpdateAfterLayout();
764 765
765 if (state.IsPaginated() && IsPageLogicalHeightKnown()) { 766 if (state.IsPaginated() && IsPageLogicalHeightKnown()) {
766 block_offset_to_first_repeatable_header_ = state.PageLogicalOffset( 767 block_offset_to_first_repeatable_header_ = state.PageLogicalOffset(
767 *this, top_section ? top_section->LogicalTop() : LayoutUnit()); 768 *this, top_section ? top_section->LogicalTop() : LayoutUnit());
768 } 769 }
769 } 770 }
770 771
771 // FIXME: This value isn't the intrinsic content logical height, but we need 772 // FIXME: This value isn't the intrinsic content logical height, but we need
772 // to update the value as its used by flexbox layout. crbug.com/367324 773 // to update the value as its used by flexbox layout. crbug.com/367324
773 SetIntrinsicContentLogicalHeight(ContentLogicalHeight()); 774 SetIntrinsicContentLogicalHeight(ContentLogicalHeight());
774 775
775 column_logical_width_changed_ = false; 776 column_logical_width_changed_ = false;
776 ClearNeedsLayout(); 777 ClearNeedsLayout();
777 } 778 }
778 779
779 void LayoutTable::InvalidateCollapsedBorders() { 780 void LayoutTable::InvalidateCollapsedBorders() {
780 collapsed_borders_.clear(); 781 collapsed_borders_.clear();
781 if (!CollapseBorders())
782 return;
783
784 collapsed_borders_valid_ = false; 782 collapsed_borders_valid_ = false;
785 SetMayNeedPaintInvalidation(); 783 SetMayNeedPaintInvalidation();
786 } 784 }
787 785
788 // Collect all the unique border values that we want to paint in a sorted list. 786 // Collect all the unique border values that we want to paint in a sorted list.
789 // During the collection, each cell saves its recalculated borders into the 787 // During the collection, each cell saves its recalculated borders into the
790 // cache of its containing section, and invalidates itself if any border 788 // cache of its containing section, and invalidates itself if any border
791 // changes. This method doesn't affect layout. 789 // changes. This method doesn't affect layout.
792 void LayoutTable::RecalcCollapsedBordersIfNeeded() { 790 void LayoutTable::RecalcCollapsedBordersIfNeeded() {
793 if (collapsed_borders_valid_ || !CollapseBorders()) 791 if (collapsed_borders_valid_ || !CollapseBorders())
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 } 1738 }
1741 1739
1742 LayoutUnit LayoutTable::PaddingRight() const { 1740 LayoutUnit LayoutTable::PaddingRight() const {
1743 if (CollapseBorders()) 1741 if (CollapseBorders())
1744 return LayoutUnit(); 1742 return LayoutUnit();
1745 1743
1746 return LayoutBlock::PaddingRight(); 1744 return LayoutBlock::PaddingRight();
1747 } 1745 }
1748 1746
1749 } // namespace blink 1747 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698