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