| 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, 2010 Apple Inc. All rights reserv
ed. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010 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 22 matching lines...) Expand all Loading... |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 class RenderTableCol; | 35 class RenderTableCol; |
| 36 class RenderTableCaption; | 36 class RenderTableCaption; |
| 37 class RenderTableCell; | 37 class RenderTableCell; |
| 38 class RenderTableSection; | 38 class RenderTableSection; |
| 39 class TableLayout; | 39 class TableLayout; |
| 40 | 40 |
| 41 enum SkipEmptySectionsValue { DoNotSkipEmptySections, SkipEmptySections }; | 41 enum SkipEmptySectionsValue { DoNotSkipEmptySections, SkipEmptySections }; |
| 42 | 42 |
| 43 class RenderTable FINAL : public RenderBlock { | 43 class RenderTable final : public RenderBlock { |
| 44 public: | 44 public: |
| 45 explicit RenderTable(Element*); | 45 explicit RenderTable(Element*); |
| 46 virtual ~RenderTable(); | 46 virtual ~RenderTable(); |
| 47 | 47 |
| 48 // Per CSS 3 writing-mode: "The first and second values of the 'border-spaci
ng' property represent spacing between columns | 48 // Per CSS 3 writing-mode: "The first and second values of the 'border-spaci
ng' property represent spacing between columns |
| 49 // and rows respectively, not necessarily the horizontal and vertical spacin
g respectively". | 49 // and rows respectively, not necessarily the horizontal and vertical spacin
g respectively". |
| 50 int hBorderSpacing() const { return m_hSpacing; } | 50 int hBorderSpacing() const { return m_hSpacing; } |
| 51 int vBorderSpacing() const { return m_vSpacing; } | 51 int vBorderSpacing() const { return m_vSpacing; } |
| 52 | 52 |
| 53 bool collapseBorders() const { return style()->borderCollapse(); } | 53 bool collapseBorders() const { return style()->borderCollapse(); } |
| 54 | 54 |
| 55 virtual int borderStart() const OVERRIDE { return m_borderStart; } | 55 virtual int borderStart() const override { return m_borderStart; } |
| 56 virtual int borderEnd() const OVERRIDE { return m_borderEnd; } | 56 virtual int borderEnd() const override { return m_borderEnd; } |
| 57 virtual int borderBefore() const OVERRIDE; | 57 virtual int borderBefore() const override; |
| 58 virtual int borderAfter() const OVERRIDE; | 58 virtual int borderAfter() const override; |
| 59 | 59 |
| 60 virtual int borderLeft() const OVERRIDE | 60 virtual int borderLeft() const override |
| 61 { | 61 { |
| 62 if (style()->isHorizontalWritingMode()) | 62 if (style()->isHorizontalWritingMode()) |
| 63 return style()->isLeftToRightDirection() ? borderStart() : borderEnd
(); | 63 return style()->isLeftToRightDirection() ? borderStart() : borderEnd
(); |
| 64 return style()->isFlippedBlocksWritingMode() ? borderAfter() : borderBef
ore(); | 64 return style()->isFlippedBlocksWritingMode() ? borderAfter() : borderBef
ore(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual int borderRight() const OVERRIDE | 67 virtual int borderRight() const override |
| 68 { | 68 { |
| 69 if (style()->isHorizontalWritingMode()) | 69 if (style()->isHorizontalWritingMode()) |
| 70 return style()->isLeftToRightDirection() ? borderEnd() : borderStart
(); | 70 return style()->isLeftToRightDirection() ? borderEnd() : borderStart
(); |
| 71 return style()->isFlippedBlocksWritingMode() ? borderBefore() : borderAf
ter(); | 71 return style()->isFlippedBlocksWritingMode() ? borderBefore() : borderAf
ter(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 virtual int borderTop() const OVERRIDE | 74 virtual int borderTop() const override |
| 75 { | 75 { |
| 76 if (style()->isHorizontalWritingMode()) | 76 if (style()->isHorizontalWritingMode()) |
| 77 return style()->isFlippedBlocksWritingMode() ? borderAfter() : borde
rBefore(); | 77 return style()->isFlippedBlocksWritingMode() ? borderAfter() : borde
rBefore(); |
| 78 return style()->isLeftToRightDirection() ? borderStart() : borderEnd(); | 78 return style()->isLeftToRightDirection() ? borderStart() : borderEnd(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 virtual int borderBottom() const OVERRIDE | 81 virtual int borderBottom() const override |
| 82 { | 82 { |
| 83 if (style()->isHorizontalWritingMode()) | 83 if (style()->isHorizontalWritingMode()) |
| 84 return style()->isFlippedBlocksWritingMode() ? borderBefore() : bord
erAfter(); | 84 return style()->isFlippedBlocksWritingMode() ? borderBefore() : bord
erAfter(); |
| 85 return style()->isLeftToRightDirection() ? borderEnd() : borderStart(); | 85 return style()->isLeftToRightDirection() ? borderEnd() : borderStart(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 int outerBorderBefore() const; | 88 int outerBorderBefore() const; |
| 89 int outerBorderAfter() const; | 89 int outerBorderAfter() const; |
| 90 int outerBorderStart() const; | 90 int outerBorderStart() const; |
| 91 int outerBorderEnd() const; | 91 int outerBorderEnd() const; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 115 { | 115 { |
| 116 if (style()->isHorizontalWritingMode()) | 116 if (style()->isHorizontalWritingMode()) |
| 117 return style()->isFlippedBlocksWritingMode() ? outerBorderBefore() :
outerBorderAfter(); | 117 return style()->isFlippedBlocksWritingMode() ? outerBorderBefore() :
outerBorderAfter(); |
| 118 return style()->isLeftToRightDirection() ? outerBorderEnd() : outerBorde
rStart(); | 118 return style()->isLeftToRightDirection() ? outerBorderEnd() : outerBorde
rStart(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 int calcBorderStart() const; | 121 int calcBorderStart() const; |
| 122 int calcBorderEnd() const; | 122 int calcBorderEnd() const; |
| 123 void recalcBordersInRowDirection(); | 123 void recalcBordersInRowDirection(); |
| 124 | 124 |
| 125 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) OV
ERRIDE; | 125 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) ov
erride; |
| 126 | 126 |
| 127 struct ColumnStruct { | 127 struct ColumnStruct { |
| 128 explicit ColumnStruct(unsigned initialSpan = 1) | 128 explicit ColumnStruct(unsigned initialSpan = 1) |
| 129 : span(initialSpan) | 129 : span(initialSpan) |
| 130 { | 130 { |
| 131 } | 131 } |
| 132 | 132 |
| 133 unsigned span; | 133 unsigned span; |
| 134 }; | 134 }; |
| 135 | 135 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 LayoutUnit borderSpacingInRowDirection() const | 193 LayoutUnit borderSpacingInRowDirection() const |
| 194 { | 194 { |
| 195 if (unsigned effectiveColumnCount = numEffCols()) | 195 if (unsigned effectiveColumnCount = numEffCols()) |
| 196 return static_cast<LayoutUnit>(effectiveColumnCount + 1) * hBorderSp
acing(); | 196 return static_cast<LayoutUnit>(effectiveColumnCount + 1) * hBorderSp
acing(); |
| 197 | 197 |
| 198 return 0; | 198 return 0; |
| 199 } | 199 } |
| 200 | 200 |
| 201 // Override paddingStart/End to return pixel values to match behavor of Rend
erTableCell. | 201 // Override paddingStart/End to return pixel values to match behavor of Rend
erTableCell. |
| 202 virtual LayoutUnit paddingEnd() const OVERRIDE { return static_cast<int>(Ren
derBlock::paddingEnd()); } | 202 virtual LayoutUnit paddingEnd() const override { return static_cast<int>(Ren
derBlock::paddingEnd()); } |
| 203 virtual LayoutUnit paddingStart() const OVERRIDE { return static_cast<int>(R
enderBlock::paddingStart()); } | 203 virtual LayoutUnit paddingStart() const override { return static_cast<int>(R
enderBlock::paddingStart()); } |
| 204 | 204 |
| 205 LayoutUnit bordersPaddingAndSpacingInRowDirection() const | 205 LayoutUnit bordersPaddingAndSpacingInRowDirection() const |
| 206 { | 206 { |
| 207 // 'border-spacing' only applies to separate borders (see 17.6.1 The sep
arated borders model). | 207 // 'border-spacing' only applies to separate borders (see 17.6.1 The sep
arated borders model). |
| 208 return borderStart() + borderEnd() + (collapseBorders() ? LayoutUnit() :
(paddingStart() + paddingEnd() + borderSpacingInRowDirection())); | 208 return borderStart() + borderEnd() + (collapseBorders() ? LayoutUnit() :
(paddingStart() + paddingEnd() + borderSpacingInRowDirection())); |
| 209 } | 209 } |
| 210 | 210 |
| 211 // Return the first column or column-group. | 211 // Return the first column or column-group. |
| 212 RenderTableCol* firstColumn() const; | 212 RenderTableCol* firstColumn() const; |
| 213 | 213 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 249 |
| 250 bool hasSections() const { return m_head || m_foot || m_firstBody; } | 250 bool hasSections() const { return m_head || m_foot || m_firstBody; } |
| 251 | 251 |
| 252 void recalcSectionsIfNeeded() const | 252 void recalcSectionsIfNeeded() const |
| 253 { | 253 { |
| 254 if (m_needsSectionRecalc) | 254 if (m_needsSectionRecalc) |
| 255 recalcSections(); | 255 recalcSections(); |
| 256 } | 256 } |
| 257 | 257 |
| 258 static RenderTable* createAnonymousWithParentRenderer(const RenderObject*); | 258 static RenderTable* createAnonymousWithParentRenderer(const RenderObject*); |
| 259 virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* pare
nt) const OVERRIDE | 259 virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* pare
nt) const override |
| 260 { | 260 { |
| 261 return createAnonymousWithParentRenderer(parent); | 261 return createAnonymousWithParentRenderer(parent); |
| 262 } | 262 } |
| 263 | 263 |
| 264 const BorderValue& tableStartBorderAdjoiningCell(const RenderTableCell*) con
st; | 264 const BorderValue& tableStartBorderAdjoiningCell(const RenderTableCell*) con
st; |
| 265 const BorderValue& tableEndBorderAdjoiningCell(const RenderTableCell*) const
; | 265 const BorderValue& tableEndBorderAdjoiningCell(const RenderTableCell*) const
; |
| 266 | 266 |
| 267 void addCaption(const RenderTableCaption*); | 267 void addCaption(const RenderTableCaption*); |
| 268 void removeCaption(const RenderTableCaption*); | 268 void removeCaption(const RenderTableCaption*); |
| 269 void addColumn(const RenderTableCol*); | 269 void addColumn(const RenderTableCol*); |
| 270 void removeColumn(const RenderTableCol*); | 270 void removeColumn(const RenderTableCol*); |
| 271 | 271 |
| 272 // FIXME: this method should be moved into TablePainter. | 272 // FIXME: this method should be moved into TablePainter. |
| 273 virtual void paintBoxDecorationBackground(PaintInfo&, const LayoutPoint&) OV
ERRIDE; | 273 virtual void paintBoxDecorationBackground(PaintInfo&, const LayoutPoint&) ov
erride; |
| 274 | 274 |
| 275 virtual void paintMask(PaintInfo&, const LayoutPoint&) OVERRIDE; | 275 virtual void paintMask(PaintInfo&, const LayoutPoint&) override; |
| 276 | 276 |
| 277 const CollapsedBorderValues& collapsedBorders() { return m_collapsedBorders;
} | 277 const CollapsedBorderValues& collapsedBorders() { return m_collapsedBorders;
} |
| 278 void subtractCaptionRect(LayoutRect&) const; | 278 void subtractCaptionRect(LayoutRect&) const; |
| 279 void recalcCollapsedBorders(); | 279 void recalcCollapsedBorders(); |
| 280 | 280 |
| 281 protected: | 281 protected: |
| 282 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV
ERRIDE; | 282 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov
erride; |
| 283 virtual void simplifiedNormalFlowLayout() OVERRIDE; | 283 virtual void simplifiedNormalFlowLayout() override; |
| 284 | 284 |
| 285 private: | 285 private: |
| 286 virtual const char* renderName() const OVERRIDE { return "RenderTable"; } | 286 virtual const char* renderName() const override { return "RenderTable"; } |
| 287 | 287 |
| 288 virtual bool isTable() const OVERRIDE { return true; } | 288 virtual bool isTable() const override { return true; } |
| 289 | 289 |
| 290 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE; | 290 virtual void paint(PaintInfo&, const LayoutPoint&) override; |
| 291 virtual void paintObject(PaintInfo&, const LayoutPoint&) OVERRIDE; | 291 virtual void paintObject(PaintInfo&, const LayoutPoint&) override; |
| 292 virtual void layout() OVERRIDE; | 292 virtual void layout() override; |
| 293 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minWidth, LayoutUnit&
maxWidth) const OVERRIDE; | 293 virtual void computeIntrinsicLogicalWidths(LayoutUnit& minWidth, LayoutUnit&
maxWidth) const override; |
| 294 virtual void computePreferredLogicalWidths() OVERRIDE; | 294 virtual void computePreferredLogicalWidths() override; |
| 295 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct
ion) OVERRIDE; | 295 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct
ion) override; |
| 296 | 296 |
| 297 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode
, LinePositionMode = PositionOnContainingLine) const OVERRIDE; | 297 virtual int baselinePosition(FontBaseline, bool firstLine, LineDirectionMode
, LinePositionMode = PositionOnContainingLine) const override; |
| 298 virtual int firstLineBoxBaseline() const OVERRIDE; | 298 virtual int firstLineBoxBaseline() const override; |
| 299 virtual int inlineBlockBaseline(LineDirectionMode) const OVERRIDE; | 299 virtual int inlineBlockBaseline(LineDirectionMode) const override; |
| 300 | 300 |
| 301 RenderTableCol* slowColElement(unsigned col, bool* startEdge, bool* endEdge)
const; | 301 RenderTableCol* slowColElement(unsigned col, bool* startEdge, bool* endEdge)
const; |
| 302 | 302 |
| 303 void updateColumnCache() const; | 303 void updateColumnCache() const; |
| 304 void invalidateCachedColumns(); | 304 void invalidateCachedColumns(); |
| 305 | 305 |
| 306 virtual void updateLogicalWidth() OVERRIDE; | 306 virtual void updateLogicalWidth() override; |
| 307 | 307 |
| 308 LayoutUnit convertStyleLogicalWidthToComputedWidth(const Length& styleLogica
lWidth, LayoutUnit availableWidth); | 308 LayoutUnit convertStyleLogicalWidthToComputedWidth(const Length& styleLogica
lWidth, LayoutUnit availableWidth); |
| 309 LayoutUnit convertStyleLogicalHeightToComputedHeight(const Length& styleLogi
calHeight); | 309 LayoutUnit convertStyleLogicalHeightToComputedHeight(const Length& styleLogi
calHeight); |
| 310 | 310 |
| 311 virtual LayoutRect overflowClipRect(const LayoutPoint& location, OverlayScro
llbarSizeRelevancy = IgnoreOverlayScrollbarSize) OVERRIDE; | 311 virtual LayoutRect overflowClipRect(const LayoutPoint& location, OverlayScro
llbarSizeRelevancy = IgnoreOverlayScrollbarSize) override; |
| 312 | 312 |
| 313 virtual void addOverflowFromChildren() OVERRIDE; | 313 virtual void addOverflowFromChildren() override; |
| 314 | 314 |
| 315 void recalcSections() const; | 315 void recalcSections() const; |
| 316 void layoutCaption(RenderTableCaption*); | 316 void layoutCaption(RenderTableCaption*); |
| 317 | 317 |
| 318 void distributeExtraLogicalHeight(int extraLogicalHeight); | 318 void distributeExtraLogicalHeight(int extraLogicalHeight); |
| 319 | 319 |
| 320 mutable Vector<int> m_columnPos; | 320 mutable Vector<int> m_columnPos; |
| 321 mutable Vector<ColumnStruct> m_columns; | 321 mutable Vector<ColumnStruct> m_columns; |
| 322 mutable Vector<RenderTableCaption*> m_captions; | 322 mutable Vector<RenderTableCaption*> m_captions; |
| 323 mutable Vector<RenderTableCol*> m_columnRenderers; | 323 mutable Vector<RenderTableCol*> m_columnRenderers; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 if (m_firstBody) | 361 if (m_firstBody) |
| 362 return m_firstBody; | 362 return m_firstBody; |
| 363 return m_foot; | 363 return m_foot; |
| 364 } | 364 } |
| 365 | 365 |
| 366 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderTable, isTable()); | 366 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderTable, isTable()); |
| 367 | 367 |
| 368 } // namespace blink | 368 } // namespace blink |
| 369 | 369 |
| 370 #endif // RenderTable_h | 370 #endif // RenderTable_h |
| OLD | NEW |