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

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

Issue 2325953002: LayoutTable: gracefully degrade in the presence of collspan > 1. (Closed)
Patch Set: CL for src perf tryjob to run blink_perf.layout benchmark on linux platform(s) Created 4 years, 3 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/LayoutTable.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, 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 LayoutTable::LayoutTable(Element* element) 54 LayoutTable::LayoutTable(Element* element)
55 : LayoutBlock(element) 55 : LayoutBlock(element)
56 , m_head(nullptr) 56 , m_head(nullptr)
57 , m_foot(nullptr) 57 , m_foot(nullptr)
58 , m_firstBody(nullptr) 58 , m_firstBody(nullptr)
59 , m_collapsedBordersValid(false) 59 , m_collapsedBordersValid(false)
60 , m_hasColElements(false) 60 , m_hasColElements(false)
61 , m_needsSectionRecalc(false) 61 , m_needsSectionRecalc(false)
62 , m_columnLogicalWidthChanged(false) 62 , m_columnLogicalWidthChanged(false)
63 , m_columnLayoutObjectsValid(false) 63 , m_columnLayoutObjectsValid(false)
64 , m_hasCellColspanThatDeterminesTableWidth(false) 64 , m_noCellColspanAtLeast(0)
65 , m_hSpacing(0) 65 , m_hSpacing(0)
66 , m_vSpacing(0) 66 , m_vSpacing(0)
67 , m_borderStart(0) 67 , m_borderStart(0)
68 , m_borderEnd(0) 68 , m_borderEnd(0)
69 { 69 {
70 ASSERT(!childrenInline()); 70 ASSERT(!childrenInline());
71 m_effectiveColumnPositions.fill(0, 1); 71 m_effectiveColumnPositions.fill(0, 1);
72 } 72 }
73 73
74 LayoutTable::~LayoutTable() 74 LayoutTable::~LayoutTable()
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 m_effectiveColumnPositions.grow(numEffectiveColumns() + 1); 790 m_effectiveColumnPositions.grow(numEffectiveColumns() + 1);
791 } 791 }
792 792
793 void LayoutTable::appendEffectiveColumn(unsigned span) 793 void LayoutTable::appendEffectiveColumn(unsigned span)
794 { 794 {
795 unsigned newColumnIndex = m_effectiveColumns.size(); 795 unsigned newColumnIndex = m_effectiveColumns.size();
796 m_effectiveColumns.append(span); 796 m_effectiveColumns.append(span);
797 797
798 // Unless the table has cell(s) with colspan that exceed the number of colum ns afforded 798 // Unless the table has cell(s) with colspan that exceed the number of colum ns afforded
799 // by the other rows in the table we can use the fast path when mapping colu mns to effective columns. 799 // by the other rows in the table we can use the fast path when mapping colu mns to effective columns.
800 m_hasCellColspanThatDeterminesTableWidth = m_hasCellColspanThatDeterminesTab leWidth || span > 1; 800 if (span == 1 && m_noCellColspanAtLeast + 1 == numEffectiveColumns()) {
801 m_noCellColspanAtLeast++;
802 }
801 803
802 // Propagate the change in our columns representation to the sections that d on't need 804 // Propagate the change in our columns representation to the sections that d on't need
803 // cell recalc. If they do, they will be synced up directly with m_columns l ater. 805 // cell recalc. If they do, they will be synced up directly with m_columns l ater.
804 for (LayoutObject* child = firstChild(); child; child = child->nextSibling() ) { 806 for (LayoutObject* child = firstChild(); child; child = child->nextSibling() ) {
805 if (!child->isTableSection()) 807 if (!child->isTableSection())
806 continue; 808 continue;
807 809
808 LayoutTableSection* section = toLayoutTableSection(child); 810 LayoutTableSection* section = toLayoutTableSection(child);
809 if (section->needsCellRecalc()) 811 if (section->needsCellRecalc())
810 continue; 812 continue;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 } 880 }
879 881
880 void LayoutTable::recalcSections() const 882 void LayoutTable::recalcSections() const
881 { 883 {
882 ASSERT(m_needsSectionRecalc); 884 ASSERT(m_needsSectionRecalc);
883 885
884 m_head = nullptr; 886 m_head = nullptr;
885 m_foot = nullptr; 887 m_foot = nullptr;
886 m_firstBody = nullptr; 888 m_firstBody = nullptr;
887 m_hasColElements = false; 889 m_hasColElements = false;
888 m_hasCellColspanThatDeterminesTableWidth = hasCellColspanThatDeterminesTable Width(); 890 m_noCellColspanAtLeast = calcNoCellColspanAtLeast();
889 891
890 // We need to get valid pointers to caption, head, foot and first body again 892 // We need to get valid pointers to caption, head, foot and first body again
891 LayoutObject* nextSibling; 893 LayoutObject* nextSibling;
892 for (LayoutObject* child = firstChild(); child; child = nextSibling) { 894 for (LayoutObject* child = firstChild(); child; child = nextSibling) {
893 nextSibling = child->nextSibling(); 895 nextSibling = child->nextSibling();
894 switch (child->style()->display()) { 896 switch (child->style()->display()) {
895 case TABLE_COLUMN: 897 case TABLE_COLUMN:
896 case TABLE_COLUMN_GROUP: 898 case TABLE_COLUMN_GROUP:
897 m_hasColElements = true; 899 m_hasColElements = true;
898 break; 900 break;
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 1476
1475 LayoutUnit LayoutTable::paddingRight() const 1477 LayoutUnit LayoutTable::paddingRight() const
1476 { 1478 {
1477 if (collapseBorders()) 1479 if (collapseBorders())
1478 return LayoutUnit(); 1480 return LayoutUnit();
1479 1481
1480 return LayoutBlock::paddingRight(); 1482 return LayoutBlock::paddingRight();
1481 } 1483 }
1482 1484
1483 } // namespace blink 1485 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTable.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698