| 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. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010 Apple Inc. |
| 8 * All rights reserved. | 8 * All rights reserved. |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 23 * Boston, MA 02110-1301, USA. | 23 * Boston, MA 02110-1301, USA. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef LayoutTable_h | 26 #ifndef LayoutTable_h |
| 27 #define LayoutTable_h | 27 #define LayoutTable_h |
| 28 | 28 |
| 29 #include "core/CSSPropertyNames.h" | 29 #include "core/CSSPropertyNames.h" |
| 30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
| 31 #include "core/layout/LayoutBlock.h" | 31 #include "core/layout/LayoutBlock.h" |
| 32 #include "core/paint/PaintResult.h" |
| 32 #include "core/style/CollapsedBorderValue.h" | 33 #include "core/style/CollapsedBorderValue.h" |
| 34 #include "platform/graphics/paint/CullRect.h" |
| 33 #include "wtf/Vector.h" | 35 #include "wtf/Vector.h" |
| 34 #include <memory> | 36 #include <memory> |
| 35 | 37 |
| 36 namespace blink { | 38 namespace blink { |
| 37 | 39 |
| 38 class LayoutTableCol; | 40 class LayoutTableCol; |
| 39 class LayoutTableCaption; | 41 class LayoutTableCaption; |
| 40 class LayoutTableCell; | 42 class LayoutTableCell; |
| 41 class LayoutTableSection; | 43 class LayoutTableSection; |
| 42 class TableLayoutAlgorithm; | 44 class TableLayoutAlgorithm; |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 SkipEmptySectionsValue = DoNotSkipEmptySections) const; | 372 SkipEmptySectionsValue = DoNotSkipEmptySections) const; |
| 371 LayoutTableSection* sectionBelow( | 373 LayoutTableSection* sectionBelow( |
| 372 const LayoutTableSection*, | 374 const LayoutTableSection*, |
| 373 SkipEmptySectionsValue = DoNotSkipEmptySections) const; | 375 SkipEmptySectionsValue = DoNotSkipEmptySections) const; |
| 374 | 376 |
| 375 LayoutTableCell* cellAbove(const LayoutTableCell*) const; | 377 LayoutTableCell* cellAbove(const LayoutTableCell*) const; |
| 376 LayoutTableCell* cellBelow(const LayoutTableCell*) const; | 378 LayoutTableCell* cellBelow(const LayoutTableCell*) const; |
| 377 LayoutTableCell* cellBefore(const LayoutTableCell*) const; | 379 LayoutTableCell* cellBefore(const LayoutTableCell*) const; |
| 378 LayoutTableCell* cellAfter(const LayoutTableCell*) const; | 380 LayoutTableCell* cellAfter(const LayoutTableCell*) const; |
| 379 | 381 |
| 380 typedef Vector<CollapsedBorderValue> CollapsedBorderValues; | 382 void invalidateCollapsedBorders(PaintInvalidationReason); |
| 381 void invalidateCollapsedBorders(); | |
| 382 | 383 |
| 383 bool hasSections() const { return m_head || m_foot || m_firstBody; } | 384 bool hasSections() const { return m_head || m_foot || m_firstBody; } |
| 384 | 385 |
| 385 void recalcSectionsIfNeeded() const { | 386 void recalcSectionsIfNeeded() const { |
| 386 if (m_needsSectionRecalc) | 387 if (m_needsSectionRecalc) |
| 387 recalcSections(); | 388 recalcSections(); |
| 388 } | 389 } |
| 389 | 390 |
| 390 static LayoutTable* createAnonymousWithParent(const LayoutObject*); | 391 static LayoutTable* createAnonymousWithParent(const LayoutObject*); |
| 391 LayoutBox* createAnonymousBoxWithSameTypeAs( | 392 LayoutBox* createAnonymousBoxWithSameTypeAs( |
| 392 const LayoutObject* parent) const override { | 393 const LayoutObject* parent) const override { |
| 393 return createAnonymousWithParent(parent); | 394 return createAnonymousWithParent(parent); |
| 394 } | 395 } |
| 395 | 396 |
| 396 const BorderValue& tableStartBorderAdjoiningCell( | 397 const BorderValue& tableStartBorderAdjoiningCell( |
| 397 const LayoutTableCell*) const; | 398 const LayoutTableCell*) const; |
| 398 const BorderValue& tableEndBorderAdjoiningCell(const LayoutTableCell*) const; | 399 const BorderValue& tableEndBorderAdjoiningCell(const LayoutTableCell*) const; |
| 399 | 400 |
| 400 void addCaption(const LayoutTableCaption*); | 401 void addCaption(const LayoutTableCaption*); |
| 401 void removeCaption(const LayoutTableCaption*); | 402 void removeCaption(const LayoutTableCaption*); |
| 402 void addColumn(const LayoutTableCol*); | 403 void addColumn(const LayoutTableCol*); |
| 403 void removeColumn(const LayoutTableCol*); | 404 void removeColumn(const LayoutTableCol*); |
| 404 | 405 |
| 405 void paintBoxDecorationBackground(const PaintInfo&, | 406 void paintBoxDecorationBackground(const PaintInfo&, |
| 406 const LayoutPoint&) const final; | 407 const LayoutPoint&) const final; |
| 407 | 408 |
| 408 void paintMask(const PaintInfo&, const LayoutPoint&) const final; | 409 void paintMask(const PaintInfo&, const LayoutPoint&) const final; |
| 409 | 410 |
| 410 const CollapsedBorderValues& collapsedBorders() const { | 411 struct CollapsedBordersInfo { |
| 411 ASSERT(m_collapsedBordersValid); | 412 explicit CollapsedBordersInfo(const Vector<CollapsedBorderValue>& values) |
| 412 return m_collapsedBorders; | 413 : values(std::move(values)) {} |
| 414 |
| 415 PaintResult lastPaintResult = FullyPainted; |
| 416 CullRect lastPaintRect; |
| 417 const Vector<CollapsedBorderValue> values; |
| 418 }; |
| 419 |
| 420 bool hasCollapsedBorders() const { |
| 421 DCHECK(m_collapsedBordersValid); |
| 422 DCHECK(!m_collapsedBordersInfo || collapseBorders()); |
| 423 return !!m_collapsedBordersInfo; |
| 424 } |
| 425 CollapsedBordersInfo& getCollapsedBordersInfo() const { |
| 426 DCHECK(hasCollapsedBorders()); |
| 427 return *m_collapsedBordersInfo; |
| 413 } | 428 } |
| 414 | 429 |
| 415 void subtractCaptionRect(LayoutRect&) const; | 430 void subtractCaptionRect(LayoutRect&) const; |
| 416 | 431 |
| 417 bool isLogicalWidthAuto() const; | 432 bool isLogicalWidthAuto() const; |
| 418 | 433 |
| 419 // When table headers are repeated, we need to know the offset from the block | 434 // When table headers are repeated, we need to know the offset from the block |
| 420 // start of the fragmentation context to the first occurrence of the table | 435 // start of the fragmentation context to the first occurrence of the table |
| 421 // header. | 436 // header. |
| 422 LayoutUnit blockOffsetToFirstRepeatableHeader() const { | 437 LayoutUnit blockOffsetToFirstRepeatableHeader() const { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 // As the algorithm is dependent on the style, this field is nullptr before | 560 // As the algorithm is dependent on the style, this field is nullptr before |
| 546 // the first style is applied in styleDidChange(). | 561 // the first style is applied in styleDidChange(). |
| 547 std::unique_ptr<TableLayoutAlgorithm> m_tableLayout; | 562 std::unique_ptr<TableLayoutAlgorithm> m_tableLayout; |
| 548 | 563 |
| 549 // A sorted list of all unique border values that we want to paint. | 564 // A sorted list of all unique border values that we want to paint. |
| 550 // | 565 // |
| 551 // Collapsed borders are SUPER EXPENSIVE to compute. The reason is that we | 566 // Collapsed borders are SUPER EXPENSIVE to compute. The reason is that we |
| 552 // need to compare a cells border against all the adjoining cells, rows, | 567 // need to compare a cells border against all the adjoining cells, rows, |
| 553 // row groups, column, column groups and table. Thus we cache them in this | 568 // row groups, column, column groups and table. Thus we cache them in this |
| 554 // field. | 569 // field. |
| 555 CollapsedBorderValues m_collapsedBorders; | 570 std::unique_ptr<CollapsedBordersInfo> m_collapsedBordersInfo; |
| 556 bool m_collapsedBordersValid : 1; | 571 bool m_collapsedBordersValid : 1; |
| 557 | 572 |
| 558 mutable bool m_hasColElements : 1; | 573 mutable bool m_hasColElements : 1; |
| 559 mutable bool m_needsSectionRecalc : 1; | 574 mutable bool m_needsSectionRecalc : 1; |
| 560 | 575 |
| 561 bool m_columnLogicalWidthChanged : 1; | 576 bool m_columnLogicalWidthChanged : 1; |
| 562 mutable bool m_columnLayoutObjectsValid : 1; | 577 mutable bool m_columnLayoutObjectsValid : 1; |
| 563 mutable unsigned m_noCellColspanAtLeast; | 578 mutable unsigned m_noCellColspanAtLeast; |
| 564 unsigned calcNoCellColspanAtLeast() const { | 579 unsigned calcNoCellColspanAtLeast() const { |
| 565 for (unsigned c = 0; c < numEffectiveColumns(); c++) { | 580 for (unsigned c = 0; c < numEffectiveColumns(); c++) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 584 if (m_firstBody) | 599 if (m_firstBody) |
| 585 return m_firstBody; | 600 return m_firstBody; |
| 586 return m_foot; | 601 return m_foot; |
| 587 } | 602 } |
| 588 | 603 |
| 589 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, isTable()); | 604 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, isTable()); |
| 590 | 605 |
| 591 } // namespace blink | 606 } // namespace blink |
| 592 | 607 |
| 593 #endif // LayoutTable_h | 608 #endif // LayoutTable_h |
| OLD | NEW |