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

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

Issue 2803383002: The first table row is pushed down by border-spacing. (Closed)
Patch Set: break-inside:avoid on a row shouldn't prevent breaking inside adjacent border spacing 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTableSection.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, 2008, 2009, 2010, 2013 Apple Inc. 7 * Copyright (C) 2003, 2004, 2005, 2006, 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 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 std::max(baseline_descent, 821 std::max(baseline_descent,
822 cell->LogicalHeightForRowSizing() - baseline_position); 822 cell->LogicalHeightForRowSizing() - baseline_position);
823 cell_start_row_baseline_descent = baseline_descent; 823 cell_start_row_baseline_descent = baseline_descent;
824 } 824 }
825 row_pos_[row + 1] = 825 row_pos_[row + 1] =
826 std::max<int>(row_pos_[row + 1], row_pos_[row] + grid_[row].baseline + 826 std::max<int>(row_pos_[row + 1], row_pos_[row] + grid_[row].baseline +
827 cell_start_row_baseline_descent); 827 cell_start_row_baseline_descent);
828 } 828 }
829 } 829 }
830 830
831 int LayoutTableSection::VBorderSpacingBeforeFirstRow() const {
832 // We ignore the border-spacing on any non-top section, as it is already
833 // included in the previous section's last row position.
834 if (this != Table()->TopSection())
835 return 0;
836 return Table()->VBorderSpacing();
837 }
838
831 int LayoutTableSection::CalcRowLogicalHeight() { 839 int LayoutTableSection::CalcRowLogicalHeight() {
832 #if DCHECK_IS_ON() 840 #if DCHECK_IS_ON()
833 SetLayoutNeededForbiddenScope layout_forbidden_scope(*this); 841 SetLayoutNeededForbiddenScope layout_forbidden_scope(*this);
834 #endif 842 #endif
835 843
836 DCHECK(!NeedsLayout()); 844 DCHECK(!NeedsLayout());
837 845
838 LayoutTableCell* cell; 846 LayoutTableCell* cell;
839 847
840 // We may have to forcefully lay out cells here, in which case we need a 848 // We may have to forcefully lay out cells here, in which case we need a
841 // layout state. 849 // layout state.
842 LayoutState state(*this); 850 LayoutState state(*this);
843 851
844 row_pos_.resize(grid_.size() + 1); 852 row_pos_.resize(grid_.size() + 1);
845 853 row_pos_[0] = VBorderSpacingBeforeFirstRow();
846 // We ignore the border-spacing on any non-top section as it is already
847 // included in the previous section's last row position.
848 if (this == Table()->TopSection())
849 row_pos_[0] = Table()->VBorderSpacing();
850 else
851 row_pos_[0] = 0;
852 854
853 SpanningLayoutTableCells row_span_cells; 855 SpanningLayoutTableCells row_span_cells;
854 856
855 // At fragmentainer breaks we need to prevent rowspanned cells (and whatever 857 // At fragmentainer breaks we need to prevent rowspanned cells (and whatever
856 // else) from distributing their extra height requirements over the rows that 858 // else) from distributing their extra height requirements over the rows that
857 // it spans. Otherwise we'd need to refragment afterwards. 859 // it spans. Otherwise we'd need to refragment afterwards.
858 unsigned index_of_first_stretchable_row = 0; 860 unsigned index_of_first_stretchable_row = 0;
859 861
860 for (unsigned r = 0; r < grid_.size(); r++) { 862 for (unsigned r = 0; r < grid_.size(); r++) {
861 grid_[r].baseline = -1; 863 grid_[r].baseline = -1;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 DCHECK(!Table()->NeedsSectionRecalc()); 957 DCHECK(!Table()->NeedsSectionRecalc());
956 958
957 // addChild may over-grow m_grid but we don't want to throw away the memory 959 // addChild may over-grow m_grid but we don't want to throw away the memory
958 // too early as addChild can be called in a loop (e.g during parsing). Doing 960 // too early as addChild can be called in a loop (e.g during parsing). Doing
959 // it now ensures we have a stable-enough structure. 961 // it now ensures we have a stable-enough structure.
960 grid_.ShrinkToFit(); 962 grid_.ShrinkToFit();
961 963
962 LayoutState state(*this); 964 LayoutState state(*this);
963 965
964 const Vector<int>& column_pos = Table()->EffectiveColumnPositions(); 966 const Vector<int>& column_pos = Table()->EffectiveColumnPositions();
965 LayoutUnit row_logical_top; 967 LayoutUnit row_logical_top(VBorderSpacingBeforeFirstRow());
966 968
967 SubtreeLayoutScope layouter(*this); 969 SubtreeLayoutScope layouter(*this);
968 for (unsigned r = 0; r < grid_.size(); ++r) { 970 for (unsigned r = 0; r < grid_.size(); ++r) {
969 Row& row = grid_[r].row; 971 Row& row = grid_[r].row;
970 unsigned cols = row.size(); 972 unsigned cols = row.size();
971 // First, propagate our table layout's information to the cells. This will 973 // First, propagate our table layout's information to the cells. This will
972 // mark the row as needing layout if there was a column logical width 974 // mark the row as needing layout if there was a column logical width
973 // change. 975 // change.
974 for (unsigned start_column = 0; start_column < cols; ++start_column) { 976 for (unsigned start_column = 0; start_column < cols; ++start_column) {
975 CellStruct& current = row[start_column]; 977 CellStruct& current = row[start_column];
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
2166 bool LayoutTableSection::PaintedOutputOfObjectHasNoEffectRegardlessOfSize() 2168 bool LayoutTableSection::PaintedOutputOfObjectHasNoEffectRegardlessOfSize()
2167 const { 2169 const {
2168 // LayoutTableSection paints background from columns. 2170 // LayoutTableSection paints background from columns.
2169 if (Table()->HasColElements()) 2171 if (Table()->HasColElements())
2170 return false; 2172 return false;
2171 return LayoutTableBoxComponent:: 2173 return LayoutTableBoxComponent::
2172 PaintedOutputOfObjectHasNoEffectRegardlessOfSize(); 2174 PaintedOutputOfObjectHasNoEffectRegardlessOfSize();
2173 } 2175 }
2174 2176
2175 } // namespace blink 2177 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTableSection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698