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

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

Issue 1676933004: Table cell background painting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: colgroup paint bug125336 fix Created 4 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. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved.
8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 } 721 }
722 722
723 LayoutTableSection* LayoutTable::topNonEmptySection() const 723 LayoutTableSection* LayoutTable::topNonEmptySection() const
724 { 724 {
725 LayoutTableSection* section = topSection(); 725 LayoutTableSection* section = topSection();
726 if (section && !section->numRows()) 726 if (section && !section->numRows())
727 section = sectionBelow(section, SkipEmptySections); 727 section = sectionBelow(section, SkipEmptySections);
728 return section; 728 return section;
729 } 729 }
730 730
731 LayoutTableSection* LayoutTable::bottomNonEmptySection() const
732 {
733 LayoutTableSection* section = bottomSection();
734 if (section && !section->numRows())
735 section = sectionAbove(section, SkipEmptySections);
736 return section;
737 }
738
731 void LayoutTable::splitColumn(unsigned position, unsigned firstSpan) 739 void LayoutTable::splitColumn(unsigned position, unsigned firstSpan)
732 { 740 {
733 // We split the column at "position", taking "firstSpan" cells from the span . 741 // We split the column at "position", taking "firstSpan" cells from the span .
734 ASSERT(m_columns[position].span > firstSpan); 742 ASSERT(m_columns[position].span > firstSpan);
735 m_columns.insert(position, ColumnStruct(firstSpan)); 743 m_columns.insert(position, ColumnStruct(firstSpan));
736 m_columns[position + 1].span -= firstSpan; 744 m_columns[position + 1].span -= firstSpan;
737 745
738 // Propagate the change in our columns representation to the sections that d on't need 746 // Propagate the change in our columns representation to the sections that d on't need
739 // cell recalc. If they do, they will be synced up directly with m_columns l ater. 747 // cell recalc. If they do, they will be synced up directly with m_columns l ater.
740 for (LayoutObject* child = firstChild(); child; child = child->nextSibling() ) { 748 for (LayoutObject* child = firstChild(); child; child = child->nextSibling() ) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 colAndColGroup.adjoinsStartBorderOfColGroup = isAtStartEdge && !colAndColGroup.col->previousSibling(); 839 colAndColGroup.adjoinsStartBorderOfColGroup = isAtStartEdge && !colAndColGroup.col->previousSibling();
832 colAndColGroup.adjoinsEndBorderOfColGroup = isAtEndEdge && ! colAndColGroup.col->nextSibling(); 840 colAndColGroup.adjoinsEndBorderOfColGroup = isAtEndEdge && ! colAndColGroup.col->nextSibling();
833 } 841 }
834 } 842 }
835 return colAndColGroup; 843 return colAndColGroup;
836 } 844 }
837 } 845 }
838 return ColAndColGroup(); 846 return ColAndColGroup();
839 } 847 }
840 848
849 // Inverse of slowColElement:
850 // maps LayoutTableCol to columnIndex useful for columnPositions
851 unsigned LayoutTable::colElementToCol(const LayoutTableCol * colElement) const
Xianzhu 2016/02/23 22:58:27 Nit: extra space before '*'.
atotic1 2016/03/15 16:50:47 Done.
852 {
853 unsigned col = 0;
854 unsigned i;
855 for (i = 0; i < m_columnLayoutObjects.size() && col < m_columns.size(); i++) {
Xianzhu 2016/02/23 22:58:27 The col < m_columns.size() seems incorrect. m_colu
Xianzhu 2016/02/23 22:58:27 The following style is preferred: for (const Layou
856 if (colElement == m_columnLayoutObjects[i]) {
857 return col;
858 }
859 if (!m_columnLayoutObjects[i]->isTableColumnGroup())
Xianzhu 2016/02/23 22:58:27 Is this condition correct? It seems different from
860 col += m_columnLayoutObjects[i]->span();
861 }
862
863 return m_columns.size() - 1;
864 }
865
841 void LayoutTable::recalcSections() const 866 void LayoutTable::recalcSections() const
842 { 867 {
843 ASSERT(m_needsSectionRecalc); 868 ASSERT(m_needsSectionRecalc);
844 869
845 m_head = nullptr; 870 m_head = nullptr;
846 m_foot = nullptr; 871 m_foot = nullptr;
847 m_firstBody = nullptr; 872 m_firstBody = nullptr;
848 m_hasColElements = false; 873 m_hasColElements = false;
849 m_hasCellColspanThatDeterminesTableWidth = hasCellColspanThatDeterminesTable Width(); 874 m_hasCellColspanThatDeterminesTableWidth = hasCellColspanThatDeterminesTable Width();
850 875
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 1480
1456 LayoutUnit LayoutTable::paddingRight() const 1481 LayoutUnit LayoutTable::paddingRight() const
1457 { 1482 {
1458 if (collapseBorders()) 1483 if (collapseBorders())
1459 return LayoutUnit(); 1484 return LayoutUnit();
1460 1485
1461 return LayoutBlock::paddingRight(); 1486 return LayoutBlock::paddingRight();
1462 } 1487 }
1463 1488
1464 } // namespace blink 1489 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698