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

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

Issue 576823004: Move painting code for tables into *Paint classes. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix Created 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderTableRow.cpp ('k') | Source/core/rendering/RenderTableSection.cpp » ('j') | 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, 2009, 2013 Apple Inc. All rights reserv ed. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2013 Apple Inc. All rights reserv ed.
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 12 matching lines...) Expand all
23 */ 23 */
24 24
25 #ifndef RenderTableSection_h 25 #ifndef RenderTableSection_h
26 #define RenderTableSection_h 26 #define RenderTableSection_h
27 27
28 #include "core/rendering/RenderTable.h" 28 #include "core/rendering/RenderTable.h"
29 #include "wtf/Vector.h" 29 #include "wtf/Vector.h"
30 30
31 namespace blink { 31 namespace blink {
32 32
33 extern float gMaxAllowedOverflowingCellRatioForFastPaintPath;
pdr. 2014/09/19 20:51:37 I think this can be: const float gMaxAllowedOverfl
chrishtr 2014/09/19 20:59:43 Done.
34
33 enum CollapsedBorderSide { 35 enum CollapsedBorderSide {
34 CBSBefore, 36 CBSBefore,
35 CBSAfter, 37 CBSAfter,
36 CBSStart, 38 CBSStart,
37 CBSEnd 39 CBSEnd
38 }; 40 };
39 41
40 // Helper class for paintObject. 42 // Helper class for paintObject.
41 class CellSpan { 43 class CellSpan {
42 public: 44 public:
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 int distributeExtraLogicalHeightToRows(int extraLogicalHeight); 219 int distributeExtraLogicalHeightToRows(int extraLogicalHeight);
218 220
219 static RenderTableSection* createAnonymousWithParentRenderer(const RenderObj ect*); 221 static RenderTableSection* createAnonymousWithParentRenderer(const RenderObj ect*);
220 virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* pare nt) const OVERRIDE 222 virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* pare nt) const OVERRIDE
221 { 223 {
222 return createAnonymousWithParentRenderer(parent); 224 return createAnonymousWithParentRenderer(parent);
223 } 225 }
224 226
225 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE; 227 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE;
226 228
229 // Flip the rect so it aligns with the coordinates used by the rowPos and co lumnPos vectors.
230 LayoutRect logicalRectForWritingModeAndDirection(const LayoutRect&) const;
231
232 CellSpan dirtiedRows(const LayoutRect& paintInvalidationRect) const;
233 CellSpan dirtiedColumns(const LayoutRect& paintInvalidationRect) const;
234 WillBeHeapHashSet<RawPtrWillBeMember<RenderTableCell> >& overflowingCells() { return m_overflowingCells; }
235 bool hasMultipleCellLevels() { return m_hasMultipleCellLevels; }
236
227 protected: 237 protected:
228 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV ERRIDE; 238 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV ERRIDE;
229 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct ion) OVERRIDE; 239 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct ion) OVERRIDE;
230 240
231 private: 241 private:
232 virtual RenderObjectChildList* virtualChildren() OVERRIDE { return children( ); } 242 virtual RenderObjectChildList* virtualChildren() OVERRIDE { return children( ); }
233 virtual const RenderObjectChildList* virtualChildren() const OVERRIDE { retu rn children(); } 243 virtual const RenderObjectChildList* virtualChildren() const OVERRIDE { retu rn children(); }
234 244
235 virtual const char* renderName() const OVERRIDE { return (isAnonymous() || i sPseudoElement()) ? "RenderTableSection (anonymous)" : "RenderTableSection"; } 245 virtual const char* renderName() const OVERRIDE { return (isAnonymous() || i sPseudoElement()) ? "RenderTableSection (anonymous)" : "RenderTableSection"; }
236 246
237 virtual bool isTableSection() const OVERRIDE { return true; } 247 virtual bool isTableSection() const OVERRIDE { return true; }
238 248
239 virtual void willBeRemovedFromTree() OVERRIDE; 249 virtual void willBeRemovedFromTree() OVERRIDE;
240 250
241 virtual void layout() OVERRIDE; 251 virtual void layout() OVERRIDE;
242 252
243 void paintCell(RenderTableCell*, PaintInfo&, const LayoutPoint&);
244 virtual void paintObject(PaintInfo&, const LayoutPoint&) OVERRIDE; 253 virtual void paintObject(PaintInfo&, const LayoutPoint&) OVERRIDE;
245 254
246 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE; 255 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE;
247 256
248 int borderSpacingForRow(unsigned row) const { return m_grid[row].rowRenderer ? table()->vBorderSpacing() : 0; } 257 int borderSpacingForRow(unsigned row) const { return m_grid[row].rowRenderer ? table()->vBorderSpacing() : 0; }
249 258
250 void ensureRows(unsigned); 259 void ensureRows(unsigned);
251 260
252 bool rowHasOnlySpanningCells(unsigned); 261 bool rowHasOnlySpanningCells(unsigned);
253 unsigned calcRowHeightHavingOnlySpanningCells(unsigned); 262 unsigned calcRowHeightHavingOnlySpanningCells(unsigned);
254 void updateRowsHeightHavingOnlySpanningCells(RenderTableCell*, struct Spanni ngRowsHeight&); 263 void updateRowsHeightHavingOnlySpanningCells(RenderTableCell*, struct Spanni ngRowsHeight&);
255 bool isHeightNeededForRowHavingOnlySpanningCells(unsigned); 264 bool isHeightNeededForRowHavingOnlySpanningCells(unsigned);
256 265
257 void populateSpanningRowsHeightFromCell(RenderTableCell*, struct SpanningRow sHeight&); 266 void populateSpanningRowsHeightFromCell(RenderTableCell*, struct SpanningRow sHeight&);
258 void distributeExtraRowSpanHeightToPercentRows(RenderTableCell*, int, int&, Vector<int>&); 267 void distributeExtraRowSpanHeightToPercentRows(RenderTableCell*, int, int&, Vector<int>&);
259 void distributeWholeExtraRowSpanHeightToPercentRows(RenderTableCell*, int, i nt&, Vector<int>&); 268 void distributeWholeExtraRowSpanHeightToPercentRows(RenderTableCell*, int, i nt&, Vector<int>&);
260 void distributeExtraRowSpanHeightToAutoRows(RenderTableCell*, int, int&, Vec tor<int>&); 269 void distributeExtraRowSpanHeightToAutoRows(RenderTableCell*, int, int&, Vec tor<int>&);
261 void distributeExtraRowSpanHeightToRemainingRows(RenderTableCell*, int, int& , Vector<int>&); 270 void distributeExtraRowSpanHeightToRemainingRows(RenderTableCell*, int, int& , Vector<int>&);
262 void distributeRowSpanHeightToRows(SpanningRenderTableCells& rowSpanCells); 271 void distributeRowSpanHeightToRows(SpanningRenderTableCells& rowSpanCells);
263 272
264 void distributeExtraLogicalHeightToPercentRows(int& extraLogicalHeight, int totalPercent); 273 void distributeExtraLogicalHeightToPercentRows(int& extraLogicalHeight, int totalPercent);
265 void distributeExtraLogicalHeightToAutoRows(int& extraLogicalHeight, unsigne d autoRowsCount); 274 void distributeExtraLogicalHeightToAutoRows(int& extraLogicalHeight, unsigne d autoRowsCount);
266 void distributeRemainingExtraLogicalHeight(int& extraLogicalHeight); 275 void distributeRemainingExtraLogicalHeight(int& extraLogicalHeight);
267 276
268 void updateBaselineForCell(RenderTableCell*, unsigned row, LayoutUnit& basel ineDescent); 277 void updateBaselineForCell(RenderTableCell*, unsigned row, LayoutUnit& basel ineDescent);
269 278
270 bool hasOverflowingCell() const { return m_overflowingCells.size() || m_forc eSlowPaintPathWithOverflowingCell; } 279 bool hasOverflowingCell() const { return m_overflowingCells.size() || m_forc eSlowPaintPathWithOverflowingCell; }
280
271 void computeOverflowFromCells(unsigned totalRows, unsigned nEffCols); 281 void computeOverflowFromCells(unsigned totalRows, unsigned nEffCols);
272 282
273 CellSpan fullTableRowSpan() const { return CellSpan(0, m_grid.size()); } 283 CellSpan fullTableRowSpan() const { return CellSpan(0, m_grid.size()); }
274 CellSpan fullTableColumnSpan() const { return CellSpan(0, table()->columns() .size()); } 284 CellSpan fullTableColumnSpan() const { return CellSpan(0, table()->columns() .size()); }
275 285
276 // Flip the rect so it aligns with the coordinates used by the rowPos and co lumnPos vectors.
277 LayoutRect logicalRectForWritingModeAndDirection(const LayoutRect&) const;
278
279 CellSpan dirtiedRows(const LayoutRect& paintInvalidationRect) const;
280 CellSpan dirtiedColumns(const LayoutRect& paintInvalidationRect) const;
281
282 // These two functions take a rectangle as input that has been flipped by lo gicalRectForWritingModeAndDirection. 286 // These two functions take a rectangle as input that has been flipped by lo gicalRectForWritingModeAndDirection.
283 // The returned span of rows or columns is end-exclusive, and empty if start ==end. 287 // The returned span of rows or columns is end-exclusive, and empty if start ==end.
284 CellSpan spannedRows(const LayoutRect& flippedRect) const; 288 CellSpan spannedRows(const LayoutRect& flippedRect) const;
285 CellSpan spannedColumns(const LayoutRect& flippedRect) const; 289 CellSpan spannedColumns(const LayoutRect& flippedRect) const;
286 290
287 void setLogicalPositionForCell(RenderTableCell*, unsigned effectiveColumn) c onst; 291 void setLogicalPositionForCell(RenderTableCell*, unsigned effectiveColumn) c onst;
288 292
289 RenderObjectChildList m_children; 293 RenderObjectChildList m_children;
290 294
291 WillBeHeapVector<RowStruct> m_grid; 295 WillBeHeapVector<RowStruct> m_grid;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 static const bool needsDestruction = false; 330 static const bool needsDestruction = false;
327 }; 331 };
328 template<> struct VectorTraits<blink::RenderTableSection::RowStruct> : VectorTra itsBase<blink::RenderTableSection::RowStruct> { 332 template<> struct VectorTraits<blink::RenderTableSection::RowStruct> : VectorTra itsBase<blink::RenderTableSection::RowStruct> {
329 static const bool needsDestruction = false; 333 static const bool needsDestruction = false;
330 }; 334 };
331 #endif 335 #endif
332 336
333 } 337 }
334 338
335 #endif // RenderTableSection_h 339 #endif // RenderTableSection_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderTableRow.cpp ('k') | Source/core/rendering/RenderTableSection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698