| OLD | NEW |
| 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 Loading... |
| 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 // This variable is used to balance the memory consumption vs the paint invalida
tion time on big tables. |
| 34 const float gMaxAllowedOverflowingCellRatioForFastPaintPath = 0.1f; |
| 35 |
| 33 enum CollapsedBorderSide { | 36 enum CollapsedBorderSide { |
| 34 CBSBefore, | 37 CBSBefore, |
| 35 CBSAfter, | 38 CBSAfter, |
| 36 CBSStart, | 39 CBSStart, |
| 37 CBSEnd | 40 CBSEnd |
| 38 }; | 41 }; |
| 39 | 42 |
| 40 // Helper class for paintObject. | 43 // Helper class for paintObject. |
| 41 class CellSpan { | 44 class CellSpan { |
| 42 public: | 45 public: |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 int distributeExtraLogicalHeightToRows(int extraLogicalHeight); | 220 int distributeExtraLogicalHeightToRows(int extraLogicalHeight); |
| 218 | 221 |
| 219 static RenderTableSection* createAnonymousWithParentRenderer(const RenderObj
ect*); | 222 static RenderTableSection* createAnonymousWithParentRenderer(const RenderObj
ect*); |
| 220 virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* pare
nt) const OVERRIDE | 223 virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* pare
nt) const OVERRIDE |
| 221 { | 224 { |
| 222 return createAnonymousWithParentRenderer(parent); | 225 return createAnonymousWithParentRenderer(parent); |
| 223 } | 226 } |
| 224 | 227 |
| 225 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE; | 228 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE; |
| 226 | 229 |
| 230 // Flip the rect so it aligns with the coordinates used by the rowPos and co
lumnPos vectors. |
| 231 LayoutRect logicalRectForWritingModeAndDirection(const LayoutRect&) const; |
| 232 |
| 233 CellSpan dirtiedRows(const LayoutRect& paintInvalidationRect) const; |
| 234 CellSpan dirtiedColumns(const LayoutRect& paintInvalidationRect) const; |
| 235 WillBeHeapHashSet<RawPtrWillBeMember<RenderTableCell> >& overflowingCells()
{ return m_overflowingCells; } |
| 236 bool hasMultipleCellLevels() { return m_hasMultipleCellLevels; } |
| 237 |
| 227 protected: | 238 protected: |
| 228 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV
ERRIDE; | 239 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; | 240 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct
ion) OVERRIDE; |
| 230 | 241 |
| 231 private: | 242 private: |
| 232 virtual RenderObjectChildList* virtualChildren() OVERRIDE { return children(
); } | 243 virtual RenderObjectChildList* virtualChildren() OVERRIDE { return children(
); } |
| 233 virtual const RenderObjectChildList* virtualChildren() const OVERRIDE { retu
rn children(); } | 244 virtual const RenderObjectChildList* virtualChildren() const OVERRIDE { retu
rn children(); } |
| 234 | 245 |
| 235 virtual const char* renderName() const OVERRIDE { return (isAnonymous() || i
sPseudoElement()) ? "RenderTableSection (anonymous)" : "RenderTableSection"; } | 246 virtual const char* renderName() const OVERRIDE { return (isAnonymous() || i
sPseudoElement()) ? "RenderTableSection (anonymous)" : "RenderTableSection"; } |
| 236 | 247 |
| 237 virtual bool isTableSection() const OVERRIDE { return true; } | 248 virtual bool isTableSection() const OVERRIDE { return true; } |
| 238 | 249 |
| 239 virtual void willBeRemovedFromTree() OVERRIDE; | 250 virtual void willBeRemovedFromTree() OVERRIDE; |
| 240 | 251 |
| 241 virtual void layout() OVERRIDE; | 252 virtual void layout() OVERRIDE; |
| 242 | 253 |
| 243 void paintCell(RenderTableCell*, PaintInfo&, const LayoutPoint&); | |
| 244 virtual void paintObject(PaintInfo&, const LayoutPoint&) OVERRIDE; | 254 virtual void paintObject(PaintInfo&, const LayoutPoint&) OVERRIDE; |
| 245 | 255 |
| 246 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE; | 256 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE; |
| 247 | 257 |
| 248 int borderSpacingForRow(unsigned row) const { return m_grid[row].rowRenderer
? table()->vBorderSpacing() : 0; } | 258 int borderSpacingForRow(unsigned row) const { return m_grid[row].rowRenderer
? table()->vBorderSpacing() : 0; } |
| 249 | 259 |
| 250 void ensureRows(unsigned); | 260 void ensureRows(unsigned); |
| 251 | 261 |
| 252 bool rowHasOnlySpanningCells(unsigned); | 262 bool rowHasOnlySpanningCells(unsigned); |
| 253 unsigned calcRowHeightHavingOnlySpanningCells(unsigned); | 263 unsigned calcRowHeightHavingOnlySpanningCells(unsigned); |
| 254 void updateRowsHeightHavingOnlySpanningCells(RenderTableCell*, struct Spanni
ngRowsHeight&); | 264 void updateRowsHeightHavingOnlySpanningCells(RenderTableCell*, struct Spanni
ngRowsHeight&); |
| 255 bool isHeightNeededForRowHavingOnlySpanningCells(unsigned); | 265 bool isHeightNeededForRowHavingOnlySpanningCells(unsigned); |
| 256 | 266 |
| 257 void populateSpanningRowsHeightFromCell(RenderTableCell*, struct SpanningRow
sHeight&); | 267 void populateSpanningRowsHeightFromCell(RenderTableCell*, struct SpanningRow
sHeight&); |
| 258 void distributeExtraRowSpanHeightToPercentRows(RenderTableCell*, int, int&,
Vector<int>&); | 268 void distributeExtraRowSpanHeightToPercentRows(RenderTableCell*, int, int&,
Vector<int>&); |
| 259 void distributeWholeExtraRowSpanHeightToPercentRows(RenderTableCell*, int, i
nt&, Vector<int>&); | 269 void distributeWholeExtraRowSpanHeightToPercentRows(RenderTableCell*, int, i
nt&, Vector<int>&); |
| 260 void distributeExtraRowSpanHeightToAutoRows(RenderTableCell*, int, int&, Vec
tor<int>&); | 270 void distributeExtraRowSpanHeightToAutoRows(RenderTableCell*, int, int&, Vec
tor<int>&); |
| 261 void distributeExtraRowSpanHeightToRemainingRows(RenderTableCell*, int, int&
, Vector<int>&); | 271 void distributeExtraRowSpanHeightToRemainingRows(RenderTableCell*, int, int&
, Vector<int>&); |
| 262 void distributeRowSpanHeightToRows(SpanningRenderTableCells& rowSpanCells); | 272 void distributeRowSpanHeightToRows(SpanningRenderTableCells& rowSpanCells); |
| 263 | 273 |
| 264 void distributeExtraLogicalHeightToPercentRows(int& extraLogicalHeight, int
totalPercent); | 274 void distributeExtraLogicalHeightToPercentRows(int& extraLogicalHeight, int
totalPercent); |
| 265 void distributeExtraLogicalHeightToAutoRows(int& extraLogicalHeight, unsigne
d autoRowsCount); | 275 void distributeExtraLogicalHeightToAutoRows(int& extraLogicalHeight, unsigne
d autoRowsCount); |
| 266 void distributeRemainingExtraLogicalHeight(int& extraLogicalHeight); | 276 void distributeRemainingExtraLogicalHeight(int& extraLogicalHeight); |
| 267 | 277 |
| 268 void updateBaselineForCell(RenderTableCell*, unsigned row, LayoutUnit& basel
ineDescent); | 278 void updateBaselineForCell(RenderTableCell*, unsigned row, LayoutUnit& basel
ineDescent); |
| 269 | 279 |
| 270 bool hasOverflowingCell() const { return m_overflowingCells.size() || m_forc
eSlowPaintPathWithOverflowingCell; } | 280 bool hasOverflowingCell() const { return m_overflowingCells.size() || m_forc
eSlowPaintPathWithOverflowingCell; } |
| 281 |
| 271 void computeOverflowFromCells(unsigned totalRows, unsigned nEffCols); | 282 void computeOverflowFromCells(unsigned totalRows, unsigned nEffCols); |
| 272 | 283 |
| 273 CellSpan fullTableRowSpan() const { return CellSpan(0, m_grid.size()); } | 284 CellSpan fullTableRowSpan() const { return CellSpan(0, m_grid.size()); } |
| 274 CellSpan fullTableColumnSpan() const { return CellSpan(0, table()->columns()
.size()); } | 285 CellSpan fullTableColumnSpan() const { return CellSpan(0, table()->columns()
.size()); } |
| 275 | 286 |
| 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. | 287 // 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. | 288 // The returned span of rows or columns is end-exclusive, and empty if start
==end. |
| 284 CellSpan spannedRows(const LayoutRect& flippedRect) const; | 289 CellSpan spannedRows(const LayoutRect& flippedRect) const; |
| 285 CellSpan spannedColumns(const LayoutRect& flippedRect) const; | 290 CellSpan spannedColumns(const LayoutRect& flippedRect) const; |
| 286 | 291 |
| 287 void setLogicalPositionForCell(RenderTableCell*, unsigned effectiveColumn) c
onst; | 292 void setLogicalPositionForCell(RenderTableCell*, unsigned effectiveColumn) c
onst; |
| 288 | 293 |
| 289 RenderObjectChildList m_children; | 294 RenderObjectChildList m_children; |
| 290 | 295 |
| 291 WillBeHeapVector<RowStruct> m_grid; | 296 WillBeHeapVector<RowStruct> m_grid; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 static const bool needsDestruction = false; | 331 static const bool needsDestruction = false; |
| 327 }; | 332 }; |
| 328 template<> struct VectorTraits<blink::RenderTableSection::RowStruct> : VectorTra
itsBase<blink::RenderTableSection::RowStruct> { | 333 template<> struct VectorTraits<blink::RenderTableSection::RowStruct> : VectorTra
itsBase<blink::RenderTableSection::RowStruct> { |
| 329 static const bool needsDestruction = false; | 334 static const bool needsDestruction = false; |
| 330 }; | 335 }; |
| 331 #endif | 336 #endif |
| 332 | 337 |
| 333 } | 338 } |
| 334 | 339 |
| 335 #endif // RenderTableSection_h | 340 #endif // RenderTableSection_h |
| OLD | NEW |