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

Side by Side Diff: Source/core/rendering/RenderTableSection.h

Issue 208263013: Col width is not honored when dynamically updated and it would not make table narrower (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Merged https://codereview.chromium.org/208263012/ to this patch. Created 6 years, 9 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, 2009 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 return style()->borderStart(); 155 return style()->borderStart();
156 } 156 }
157 157
158 const BorderValue& borderAdjoiningStartCell(const RenderTableCell*) const; 158 const BorderValue& borderAdjoiningStartCell(const RenderTableCell*) const;
159 const BorderValue& borderAdjoiningEndCell(const RenderTableCell*) const; 159 const BorderValue& borderAdjoiningEndCell(const RenderTableCell*) const;
160 160
161 const RenderTableCell* firstRowCellAdjoiningTableStart() const; 161 const RenderTableCell* firstRowCellAdjoiningTableStart() const;
162 const RenderTableCell* firstRowCellAdjoiningTableEnd() const; 162 const RenderTableCell* firstRowCellAdjoiningTableEnd() const;
163 163
164 CellStruct& cellAt(unsigned row, unsigned col) { return m_grid[row].row[col ]; } 164 CellStruct& cellAt(unsigned row, unsigned col)
165 const CellStruct& cellAt(unsigned row, unsigned col) const { return m_grid[r ow].row[col]; } 165 {
166 recalcCellsIfNeeded();
167 return m_grid[row].row[col];
168 }
169
170 const CellStruct& cellAt(unsigned row, unsigned col) const
171 {
172 ASSERT(!m_needsCellRecalc);
173 return m_grid[row].row[col];
174 }
166 RenderTableCell* primaryCellAt(unsigned row, unsigned col) 175 RenderTableCell* primaryCellAt(unsigned row, unsigned col)
167 { 176 {
177 recalcCellsIfNeeded();
168 CellStruct& c = m_grid[row].row[col]; 178 CellStruct& c = m_grid[row].row[col];
169 return c.primaryCell(); 179 return c.primaryCell();
170 } 180 }
171 181
172 RenderTableRow* rowRendererAt(unsigned row) const { return m_grid[row].rowRe nderer; } 182 RenderTableRow* rowRendererAt(unsigned row) const
183 {
184 ASSERT(!m_needsCellRecalc);
185 return m_grid[row].rowRenderer;
186 }
173 187
174 void appendColumn(unsigned pos); 188 void appendColumn(unsigned pos);
175 void splitColumn(unsigned pos, unsigned first); 189 void splitColumn(unsigned pos, unsigned first);
176 190
177 enum BlockBorderSide { BorderBefore, BorderAfter }; 191 enum BlockBorderSide { BorderBefore, BorderAfter };
178 int calcBlockDirectionOuterBorder(BlockBorderSide) const; 192 int calcBlockDirectionOuterBorder(BlockBorderSide) const;
179 enum InlineBorderSide { BorderStart, BorderEnd }; 193 enum InlineBorderSide { BorderStart, BorderEnd };
180 int calcInlineDirectionOuterBorder(InlineBorderSide) const; 194 int calcInlineDirectionOuterBorder(InlineBorderSide) const;
181 void recalcOuterBorder(); 195 void recalcOuterBorder();
182 196
183 int outerBorderBefore() const { return m_outerBorderBefore; } 197 int outerBorderBefore() const { return m_outerBorderBefore; }
184 int outerBorderAfter() const { return m_outerBorderAfter; } 198 int outerBorderAfter() const { return m_outerBorderAfter; }
185 int outerBorderStart() const { return m_outerBorderStart; } 199 int outerBorderStart() const { return m_outerBorderStart; }
186 int outerBorderEnd() const { return m_outerBorderEnd; } 200 int outerBorderEnd() const { return m_outerBorderEnd; }
187 201
188 unsigned numRows() const { return m_grid.size(); } 202 unsigned numRows() const
203 {
204 ASSERT(!m_needsCellRecalc);
205 return m_grid.size();
206 }
189 unsigned numColumns() const; 207 unsigned numColumns() const;
190 void recalcCells(); 208 void recalcCells();
191 void recalcCellsIfNeeded() 209 void recalcCellsIfNeeded()
192 { 210 {
193 if (m_needsCellRecalc) 211 if (m_needsCellRecalc)
194 recalcCells(); 212 recalcCells();
195 } 213 }
196 214
197 bool needsCellRecalc() const { return m_needsCellRecalc; } 215 bool needsCellRecalc() const { return m_needsCellRecalc; }
198 void setNeedsCellRecalc(); 216 void setNeedsCellRecalc();
199 217
200 LayoutUnit rowBaseline(unsigned row) { return m_grid[row].baseline; } 218 LayoutUnit rowBaseline(unsigned row)
219 {
220 recalcCellsIfNeeded();
221 return m_grid[row].baseline;
222 }
201 223
202 void rowLogicalHeightChanged(unsigned rowIndex); 224 void rowLogicalHeightChanged(unsigned rowIndex);
203 225
204 void removeCachedCollapsedBorders(const RenderTableCell*); 226 void removeCachedCollapsedBorders(const RenderTableCell*);
205 void setCachedCollapsedBorder(const RenderTableCell*, CollapsedBorderSide, C ollapsedBorderValue); 227 void setCachedCollapsedBorder(const RenderTableCell*, CollapsedBorderSide, C ollapsedBorderValue);
206 CollapsedBorderValue& cachedCollapsedBorder(const RenderTableCell*, Collapse dBorderSide); 228 CollapsedBorderValue& cachedCollapsedBorder(const RenderTableCell*, Collapse dBorderSide);
207 229
208 // distributeExtraLogicalHeightToRows methods return the *consumed* extra lo gical height. 230 // distributeExtraLogicalHeightToRows methods return the *consumed* extra lo gical height.
209 // FIXME: We may want to introduce a structure holding the in-flux layout in formation. 231 // FIXME: We may want to introduce a structure holding the in-flux layout in formation.
210 int distributeExtraLogicalHeightToRows(int extraLogicalHeight); 232 int distributeExtraLogicalHeightToRows(int extraLogicalHeight);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 278
257 void distributeExtraLogicalHeightToPercentRows(int& extraLogicalHeight, int totalPercent); 279 void distributeExtraLogicalHeightToPercentRows(int& extraLogicalHeight, int totalPercent);
258 void distributeExtraLogicalHeightToAutoRows(int& extraLogicalHeight, unsigne d autoRowsCount); 280 void distributeExtraLogicalHeightToAutoRows(int& extraLogicalHeight, unsigne d autoRowsCount);
259 void distributeRemainingExtraLogicalHeight(int& extraLogicalHeight); 281 void distributeRemainingExtraLogicalHeight(int& extraLogicalHeight);
260 282
261 void updateBaselineForCell(RenderTableCell*, unsigned row, LayoutUnit& basel ineDescent); 283 void updateBaselineForCell(RenderTableCell*, unsigned row, LayoutUnit& basel ineDescent);
262 284
263 bool hasOverflowingCell() const { return m_overflowingCells.size() || m_forc eSlowPaintPathWithOverflowingCell; } 285 bool hasOverflowingCell() const { return m_overflowingCells.size() || m_forc eSlowPaintPathWithOverflowingCell; }
264 void computeOverflowFromCells(unsigned totalRows, unsigned nEffCols); 286 void computeOverflowFromCells(unsigned totalRows, unsigned nEffCols);
265 287
266 CellSpan fullTableRowSpan() const { return CellSpan(0, m_grid.size()); } 288 CellSpan fullTableRowSpan() const
289 {
290 ASSERT(!m_needsCellRecalc);
291 return CellSpan(0, m_grid.size());
292 }
267 CellSpan fullTableColumnSpan() const { return CellSpan(0, table()->columns() .size()); } 293 CellSpan fullTableColumnSpan() const { return CellSpan(0, table()->columns() .size()); }
268 294
269 // Flip the rect so it aligns with the coordinates used by the rowPos and co lumnPos vectors. 295 // Flip the rect so it aligns with the coordinates used by the rowPos and co lumnPos vectors.
270 LayoutRect logicalRectForWritingModeAndDirection(const LayoutRect&) const; 296 LayoutRect logicalRectForWritingModeAndDirection(const LayoutRect&) const;
271 297
272 CellSpan dirtiedRows(const LayoutRect& repaintRect) const; 298 CellSpan dirtiedRows(const LayoutRect& repaintRect) const;
273 CellSpan dirtiedColumns(const LayoutRect& repaintRect) const; 299 CellSpan dirtiedColumns(const LayoutRect& repaintRect) const;
274 300
275 // These two functions take a rectangle as input that has been flipped by lo gicalRectForWritingModeAndDirection. 301 // These two functions take a rectangle as input that has been flipped by lo gicalRectForWritingModeAndDirection.
276 // The returned span of rows or columns is end-exclusive, and empty if start ==end. 302 // The returned span of rows or columns is end-exclusive, and empty if start ==end.
(...skipping 29 matching lines...) Expand all
306 // This map holds the collapsed border values for cells with collapsed borde rs. 332 // This map holds the collapsed border values for cells with collapsed borde rs.
307 // It is held at RenderTableSection level to spare memory consumption by tab le cells. 333 // It is held at RenderTableSection level to spare memory consumption by tab le cells.
308 HashMap<pair<const RenderTableCell*, int>, CollapsedBorderValue > m_cellsCol lapsedBorders; 334 HashMap<pair<const RenderTableCell*, int>, CollapsedBorderValue > m_cellsCol lapsedBorders;
309 }; 335 };
310 336
311 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderTableSection, isTableSection()); 337 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderTableSection, isTableSection());
312 338
313 } // namespace WebCore 339 } // namespace WebCore
314 340
315 #endif // RenderTableSection_h 341 #endif // RenderTableSection_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698