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

Side by Side Diff: Source/core/rendering/RenderTable.cpp

Issue 154243002: Optimize RenderTable::colToEffCol() for tables without colspans (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderTable.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 Apple Inc. All r ights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r ights 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 : RenderBlock(element) 55 : RenderBlock(element)
56 , m_head(0) 56 , m_head(0)
57 , m_foot(0) 57 , m_foot(0)
58 , m_firstBody(0) 58 , m_firstBody(0)
59 , m_currentBorder(0) 59 , m_currentBorder(0)
60 , m_collapsedBordersValid(false) 60 , m_collapsedBordersValid(false)
61 , m_hasColElements(false) 61 , m_hasColElements(false)
62 , m_needsSectionRecalc(false) 62 , m_needsSectionRecalc(false)
63 , m_columnLogicalWidthChanged(false) 63 , m_columnLogicalWidthChanged(false)
64 , m_columnRenderersValid(false) 64 , m_columnRenderersValid(false)
65 , m_hasCellColspanThatDeterminesTableWidth(false)
65 , m_hSpacing(0) 66 , m_hSpacing(0)
66 , m_vSpacing(0) 67 , m_vSpacing(0)
67 , m_borderStart(0) 68 , m_borderStart(0)
68 , m_borderEnd(0) 69 , m_borderEnd(0)
69 { 70 {
70 setChildrenInline(false); 71 setChildrenInline(false);
71 m_columnPos.fill(0, 1); 72 m_columnPos.fill(0, 1);
72 73
73 } 74 }
74 75
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 } 829 }
829 830
830 m_columnPos.grow(numEffCols() + 1); 831 m_columnPos.grow(numEffCols() + 1);
831 } 832 }
832 833
833 void RenderTable::appendColumn(unsigned span) 834 void RenderTable::appendColumn(unsigned span)
834 { 835 {
835 unsigned newColumnIndex = m_columns.size(); 836 unsigned newColumnIndex = m_columns.size();
836 m_columns.append(ColumnStruct(span)); 837 m_columns.append(ColumnStruct(span));
837 838
839 // Unless the table has cell(s) with colspan that exceed the number of colum ns afforded
840 // by the other rows in the table we can use the fast path when mapping colu mns to effective columns.
841 m_hasCellColspanThatDeterminesTableWidth = m_hasCellColspanThatDeterminesTab leWidth || span > 1;
842
838 // Propagate the change in our columns representation to the sections that d on't need 843 // Propagate the change in our columns representation to the sections that d on't need
839 // cell recalc. If they do, they will be synced up directly with m_columns l ater. 844 // cell recalc. If they do, they will be synced up directly with m_columns l ater.
840 for (RenderObject* child = firstChild(); child; child = child->nextSibling() ) { 845 for (RenderObject* child = firstChild(); child; child = child->nextSibling() ) {
841 if (!child->isTableSection()) 846 if (!child->isTableSection())
842 continue; 847 continue;
843 848
844 RenderTableSection* section = toRenderTableSection(child); 849 RenderTableSection* section = toRenderTableSection(child);
845 if (section->needsCellRecalc()) 850 if (section->needsCellRecalc())
846 continue; 851 continue;
847 852
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 } 907 }
903 908
904 void RenderTable::recalcSections() const 909 void RenderTable::recalcSections() const
905 { 910 {
906 ASSERT(m_needsSectionRecalc); 911 ASSERT(m_needsSectionRecalc);
907 912
908 m_head = 0; 913 m_head = 0;
909 m_foot = 0; 914 m_foot = 0;
910 m_firstBody = 0; 915 m_firstBody = 0;
911 m_hasColElements = false; 916 m_hasColElements = false;
917 m_hasCellColspanThatDeterminesTableWidth = hasCellColspanThatDeterminesTable Width();
912 918
913 // We need to get valid pointers to caption, head, foot and first body again 919 // We need to get valid pointers to caption, head, foot and first body again
914 RenderObject* nextSibling; 920 RenderObject* nextSibling;
915 for (RenderObject* child = firstChild(); child; child = nextSibling) { 921 for (RenderObject* child = firstChild(); child; child = nextSibling) {
916 nextSibling = child->nextSibling(); 922 nextSibling = child->nextSibling();
917 switch (child->style()->display()) { 923 switch (child->style()->display()) {
918 case TABLE_COLUMN: 924 case TABLE_COLUMN:
919 case TABLE_COLUMN_GROUP: 925 case TABLE_COLUMN_GROUP:
920 m_hasColElements = true; 926 m_hasColElements = true;
921 break; 927 break;
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1450 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const 1456 const BorderValue& RenderTable::tableEndBorderAdjoiningCell(const RenderTableCel l* cell) const
1451 { 1457 {
1452 ASSERT(cell->isFirstOrLastCellInRow()); 1458 ASSERT(cell->isFirstOrLastCellInRow());
1453 if (hasSameDirectionAs(cell->row())) 1459 if (hasSameDirectionAs(cell->row()))
1454 return style()->borderEnd(); 1460 return style()->borderEnd();
1455 1461
1456 return style()->borderStart(); 1462 return style()->borderStart();
1457 } 1463 }
1458 1464
1459 } 1465 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderTable.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698