Changeset 130698 in webkit
- Timestamp:
- Oct 8, 2012 3:59:36 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r130694 r130698 1 2012-10-08 Eric Seidel <eric@webkit.org> 2 3 Make no-column table-layout cases a little faster with inlining 4 https://bugs.webkit.org/show_bug.cgi?id=98566 5 6 Reviewed by Julien Chaffraix. 7 8 This change is almost not worth it at only a couple percent boost on 9 http://www.robohornet.org/tests/resizecol.html 10 However, I think the logicalWidthFromTableColumn split it kinda nice 11 so I've decided to post it anyway. 12 13 * rendering/RenderTable.cpp: 14 (WebCore::RenderTable::slowColElement): 15 * rendering/RenderTable.h: 16 (WebCore::RenderTable::colElement): 17 (RenderTable): 18 * rendering/RenderTableCell.cpp: 19 (WebCore::RenderTableCell::logicalWidthFromTableColumn): 20 * rendering/RenderTableCell.h: 21 (WebCore::RenderTableCell::styleOrColLogicalWidth): 22 (RenderTableCell): 23 1 24 2012-10-08 Arpita Bahuguna <arpitabahuguna@gmail.com> 2 25 -
trunk/Source/WebCore/rendering/RenderTable.cpp
r129078 r130698 755 755 } 756 756 757 RenderTableCol* RenderTable::colElement(unsigned col, bool* startEdge, bool* endEdge) const 758 { 759 if (!m_hasColElements) 760 return 0; 757 RenderTableCol* RenderTable::slowColElement(unsigned col, bool* startEdge, bool* endEdge) const 758 { 759 ASSERT(m_hasColElements); 761 760 762 761 unsigned columnCount = 0; -
trunk/Source/WebCore/rendering/RenderTable.h
r128906 r130698 199 199 RenderTableCol* firstColumn() const; 200 200 201 RenderTableCol* colElement(unsigned col, bool* startEdge = 0, bool* endEdge = 0) const; 201 RenderTableCol* colElement(unsigned col, bool* startEdge = 0, bool* endEdge = 0) const 202 { 203 // The common case is to not have columns, make that case fast. 204 if (!m_hasColElements) 205 return 0; 206 return slowColElement(col, startEdge, endEdge); 207 } 202 208 203 209 bool needsSectionRecalc() const { return m_needsSectionRecalc; } … … 267 273 virtual LayoutUnit firstLineBoxBaseline() const OVERRIDE; 268 274 virtual LayoutUnit lastLineBoxBaseline() const OVERRIDE; 275 276 RenderTableCol* slowColElement(unsigned col, bool* startEdge, bool* endEdge) const; 269 277 270 278 virtual RenderBlock* firstLineBlock() const; -
trunk/Source/WebCore/rendering/RenderTableCell.cpp
r130548 r130698 145 145 } 146 146 147 Length RenderTableCell::styleOrColLogicalWidth() const 148 { 149 Length w = style()->logicalWidth(); 150 if (!w.isAuto()) 151 return w; 152 153 if (RenderTableCol* tableCol = table()->colElement(col())) { 154 unsigned colSpanCount = colSpan(); 155 156 Length colWidthSum = Length(0, Fixed); 157 for (unsigned i = 1; i <= colSpanCount; i++) { 158 Length colWidth = tableCol->style()->logicalWidth(); 159 160 // Percentage value should be returned only for colSpan == 1. 161 // Otherwise we return original width for the cell. 162 if (!colWidth.isFixed()) { 163 if (colSpanCount > 1) 164 return w; 165 return colWidth; 166 } 167 168 colWidthSum = Length(colWidthSum.value() + colWidth.value(), Fixed); 169 170 tableCol = tableCol->nextColumn(); 171 // If no next <col> tag found for the span we just return what we have for now. 172 if (!tableCol) 173 break; 174 } 175 176 // Column widths specified on <col> apply to the border box of the cell. 177 // Percentages don't need to be handled since they're always treated this way (even when specified on the cells). 178 // See Bugzilla bug 8126 for details. 179 if (colWidthSum.isFixed() && colWidthSum.value() > 0) 180 colWidthSum = Length(max(0.0f, colWidthSum.value() - borderAndPaddingLogicalWidth()), Fixed); 181 return colWidthSum; 182 } 183 184 return w; 147 Length RenderTableCell::logicalWidthFromColumns(RenderTableCol* firstColForThisCell, Length widthFromStyle) const 148 { 149 ASSERT(firstColForThisCell && firstColForThisCell == table()->colElement(col())); 150 RenderTableCol* tableCol = firstColForThisCell; 151 152 unsigned colSpanCount = colSpan(); 153 int colWidthSum = 0; 154 for (unsigned i = 1; i <= colSpanCount; i++) { 155 Length colWidth = tableCol->style()->logicalWidth(); 156 157 // Percentage value should be returned only for colSpan == 1. 158 // Otherwise we return original width for the cell. 159 if (!colWidth.isFixed()) { 160 if (colSpanCount > 1) 161 return widthFromStyle; 162 return colWidth; 163 } 164 165 colWidthSum += colWidth.value(); 166 tableCol = tableCol->nextColumn(); 167 // If no next <col> tag found for the span we just return what we have for now. 168 if (!tableCol) 169 break; 170 } 171 172 // Column widths specified on <col> apply to the border box of the cell, see bug 8126. 173 // FIXME: Why is border/padding ignored in the negative width case? 174 if (colWidthSum > 0) 175 return Length(max(0, colWidthSum - borderAndPaddingLogicalWidth().ceil()), Fixed); 176 return Length(colWidthSum, Fixed); 185 177 } 186 178 -
trunk/Source/WebCore/rendering/RenderTableCell.h
r130548 r130698 81 81 } 82 82 83 Length styleOrColLogicalWidth() const; 83 Length styleOrColLogicalWidth() const 84 { 85 Length styleWidth = style()->logicalWidth(); 86 if (!styleWidth.isAuto()) 87 return styleWidth; 88 if (RenderTableCol* firstColumn = table()->colElement(col())) 89 return logicalWidthFromColumns(firstColumn, styleWidth); 90 return styleWidth; 91 } 84 92 85 93 LayoutUnit logicalHeightForRowSizing() const; … … 238 246 CollapsedBorderValue computeCollapsedAfterBorder(IncludeBorderColorOrNot = IncludeBorderColor) const; 239 247 248 Length logicalWidthFromColumns(RenderTableCol* firstColForThisCell, Length widthFromStyle) const; 249 240 250 void updateColAndRowSpanFlags(); 241 251
Note: See TracChangeset
for help on using the changeset viewer.