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