Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTableSection.h

Issue 2786463004: Paint backgrounds of a table section/row in one display item (Closed)
Patch Set: First round of rebaseline-cl Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 7 * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2013 Apple Inc. All rights
8 * reserved. 8 * 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 void decreaseStart() { --m_start; } 50 void decreaseStart() { --m_start; }
51 void increaseEnd() { ++m_end; } 51 void increaseEnd() { ++m_end; }
52 52
53 void ensureConsistency(const unsigned); 53 void ensureConsistency(const unsigned);
54 54
55 private: 55 private:
56 unsigned m_start; 56 unsigned m_start;
57 unsigned m_end; 57 unsigned m_end;
58 }; 58 };
59 59
60 inline bool operator==(const CellSpan& s1, const CellSpan& s2) {
61 return s1.start() == s2.start() && s1.end() == s2.end();
62 }
63 inline bool operator!=(const CellSpan& s1, const CellSpan& s2) {
64 return !(s1 == s2);
65 }
66
60 class LayoutTableCell; 67 class LayoutTableCell;
61 class LayoutTableRow; 68 class LayoutTableRow;
62 69
63 // LayoutTableSection is used to represent table row group (display: 70 // LayoutTableSection is used to represent table row group (display:
64 // table-row-group), header group (display: table-header-group) and footer group 71 // table-row-group), header group (display: table-header-group) and footer group
65 // (display: table-footer-group). 72 // (display: table-footer-group).
66 // 73 //
67 // The object holds the internal representation of the rows (m_grid). See 74 // The object holds the internal representation of the rows (m_grid). See
68 // recalcCells() below for some extra explanation. 75 // recalcCells() below for some extra explanation.
69 // 76 //
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 312
306 // Flip the rect so it aligns with the coordinates used by the rowPos and 313 // Flip the rect so it aligns with the coordinates used by the rowPos and
307 // columnPos vectors. 314 // columnPos vectors.
308 LayoutRect logicalRectForWritingModeAndDirection(const LayoutRect&) const; 315 LayoutRect logicalRectForWritingModeAndDirection(const LayoutRect&) const;
309 316
310 // Returns a row or column span covering all grid slots from each of which 317 // Returns a row or column span covering all grid slots from each of which
311 // a primary cell intersecting |visualRect| originates. 318 // a primary cell intersecting |visualRect| originates.
312 CellSpan dirtiedRows(const LayoutRect& visualRect) const; 319 CellSpan dirtiedRows(const LayoutRect& visualRect) const;
313 CellSpan dirtiedEffectiveColumns(const LayoutRect& visualRect) const; 320 CellSpan dirtiedEffectiveColumns(const LayoutRect& visualRect) const;
314 321
315 const HashSet<LayoutTableCell*>& overflowingCells() const { 322 const HashSet<const LayoutTableCell*>& overflowingCells() const {
316 return m_overflowingCells; 323 return m_overflowingCells;
317 } 324 }
318 bool hasMultipleCellLevels() const { return m_hasMultipleCellLevels; } 325 bool hasMultipleCellLevels() const { return m_hasMultipleCellLevels; }
319 326
320 const char* name() const override { return "LayoutTableSection"; } 327 const char* name() const override { return "LayoutTableSection"; }
321 328
322 // Whether a section has opaque background depends on many factors, e.g. 329 // Whether a section has opaque background depends on many factors, e.g.
323 // border spacing, border collapsing, missing cells, etc. For simplicity, 330 // border spacing, border collapsing, missing cells, etc. For simplicity,
324 // just conservatively assume all table sections are not opaque. 331 // just conservatively assume all table sections are not opaque.
325 bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect&, 332 bool foregroundIsKnownToBeOpaqueInRect(const LayoutRect&,
326 unsigned) const override { 333 unsigned) const override {
327 return false; 334 return false;
328 } 335 }
329 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const override { 336 bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const override {
330 return false; 337 return false;
331 } 338 }
332 339
333 int paginationStrutForRow(LayoutTableRow*, LayoutUnit logicalOffset) const; 340 int paginationStrutForRow(LayoutTableRow*, LayoutUnit logicalOffset) const;
334 341
335 bool mapToVisualRectInAncestorSpaceInternal( 342 bool mapToVisualRectInAncestorSpaceInternal(
336 const LayoutBoxModelObject* ancestor, 343 const LayoutBoxModelObject* ancestor,
337 TransformState&, 344 TransformState&,
338 VisualRectFlags = DefaultVisualRectFlags) const override; 345 VisualRectFlags = DefaultVisualRectFlags) const override;
339 346
340 bool isRepeatingHeaderGroup() const; 347 bool isRepeatingHeaderGroup() const;
341 348
342 void layout() override; 349 void layout() override;
343 350
351 CellSpan fullSectionRowSpan() const { return CellSpan(0, m_grid.size()); }
352 CellSpan fullTableEffectiveColumnSpan() const {
353 return CellSpan(0, table()->numEffectiveColumns());
354 }
355
344 protected: 356 protected:
345 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; 357 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override;
346 bool nodeAtPoint(HitTestResult&, 358 bool nodeAtPoint(HitTestResult&,
347 const HitTestLocation& locationInContainer, 359 const HitTestLocation& locationInContainer,
348 const LayoutPoint& accumulatedOffset, 360 const LayoutPoint& accumulatedOffset,
349 HitTestAction) override; 361 HitTestAction) override;
350 362
351 private: 363 private:
352 bool isOfType(LayoutObjectType type) const override { 364 bool isOfType(LayoutObjectType type) const override {
353 return type == LayoutObjectTableSection || LayoutBox::isOfType(type); 365 return type == LayoutObjectTableSection || LayoutBox::isOfType(type);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 void updateBaselineForCell(LayoutTableCell*, 421 void updateBaselineForCell(LayoutTableCell*,
410 unsigned row, 422 unsigned row,
411 int& baselineDescent); 423 int& baselineDescent);
412 424
413 bool hasOverflowingCell() const { 425 bool hasOverflowingCell() const {
414 return m_overflowingCells.size() || m_forceSlowPaintPathWithOverflowingCell; 426 return m_overflowingCells.size() || m_forceSlowPaintPathWithOverflowingCell;
415 } 427 }
416 428
417 void computeOverflowFromCells(unsigned totalRows, unsigned nEffCols); 429 void computeOverflowFromCells(unsigned totalRows, unsigned nEffCols);
418 430
419 CellSpan fullTableRowSpan() const { return CellSpan(0, m_grid.size()); }
420 CellSpan fullTableEffectiveColumnSpan() const {
421 return CellSpan(0, table()->numEffectiveColumns());
422 }
423
424 // These two functions take a rectangle as input that has been flipped by 431 // These two functions take a rectangle as input that has been flipped by
425 // logicalRectForWritingModeAndDirection. 432 // logicalRectForWritingModeAndDirection.
426 // The returned span of rows or columns is end-exclusive, and empty if 433 // The returned span of rows or columns is end-exclusive, and empty if
427 // start==end. 434 // start==end.
428 CellSpan spannedRows(const LayoutRect& flippedRect) const; 435 CellSpan spannedRows(const LayoutRect& flippedRect) const;
429 CellSpan spannedEffectiveColumns(const LayoutRect& flippedRect) const; 436 CellSpan spannedEffectiveColumns(const LayoutRect& flippedRect) const;
430 437
431 void setLogicalPositionForCell(LayoutTableCell*, 438 void setLogicalPositionForCell(LayoutTableCell*,
432 unsigned effectiveColumn) const; 439 unsigned effectiveColumn) const;
433 440
434 void relayoutCellIfFlexed(LayoutTableCell&, int rowIndex, int rowHeight); 441 void relayoutCellIfFlexed(LayoutTableCell&, int rowIndex, int rowHeight);
435 442
436 int logicalHeightForRow(const LayoutTableRow&) const; 443 int logicalHeightForRow(const LayoutTableRow&) const;
437 444
438 // Honor breaking restrictions inside the table row, and adjust position and 445 // Honor breaking restrictions inside the table row, and adjust position and
439 // size accordingly. 446 // size accordingly.
440 void adjustRowForPagination(LayoutTableRow&, SubtreeLayoutScope&); 447 void adjustRowForPagination(LayoutTableRow&, SubtreeLayoutScope&);
441 448
449 bool paintedOutputOfObjectHasNoEffectRegardlessOfSize() const override;
450
442 // The representation of the rows and their cells (CellStruct). 451 // The representation of the rows and their cells (CellStruct).
443 Vector<RowStruct> m_grid; 452 Vector<RowStruct> m_grid;
444 453
445 // The logical offset of each row from the top of the section. 454 // The logical offset of each row from the top of the section.
446 // 455 //
447 // Note that this Vector has one more entry than the number of rows so that 456 // Note that this Vector has one more entry than the number of rows so that
448 // we can keep track of the final size of the section. That is, 457 // we can keep track of the final size of the section. That is,
449 // m_rowPos[m_grid.size()] is a valid entry. 458 // m_rowPos[m_grid.size()] is a valid entry.
450 // 459 //
451 // To know a row's height at |rowIndex|, use the formula: 460 // To know a row's height at |rowIndex|, use the formula:
(...skipping 17 matching lines...) Expand all
469 int m_outerBorderEnd; 478 int m_outerBorderEnd;
470 int m_outerBorderBefore; 479 int m_outerBorderBefore;
471 int m_outerBorderAfter; 480 int m_outerBorderAfter;
472 481
473 bool m_needsCellRecalc; 482 bool m_needsCellRecalc;
474 483
475 // This HashSet holds the overflowing cells for faster painting. 484 // This HashSet holds the overflowing cells for faster painting.
476 // If we have more than gMaxAllowedOverflowingCellRatio * total cells, it will 485 // If we have more than gMaxAllowedOverflowingCellRatio * total cells, it will
477 // be empty and m_forceSlowPaintPathWithOverflowingCell will be set to save 486 // be empty and m_forceSlowPaintPathWithOverflowingCell will be set to save
478 // memory. 487 // memory.
479 HashSet<LayoutTableCell*> m_overflowingCells; 488 HashSet<const LayoutTableCell*> m_overflowingCells;
480 bool m_forceSlowPaintPathWithOverflowingCell; 489 bool m_forceSlowPaintPathWithOverflowingCell;
481 490
482 // This boolean tracks if we have cells overlapping due to rowspan / colspan 491 // This boolean tracks if we have cells overlapping due to rowspan / colspan
483 // (see class comment above about when it could appear). 492 // (see class comment above about when it could appear).
484 // 493 //
485 // The use is to disable a painting optimization where we just paint the 494 // The use is to disable a painting optimization where we just paint the
486 // invalidated cells. 495 // invalidated cells.
487 bool m_hasMultipleCellLevels; 496 bool m_hasMultipleCellLevels;
488 497
489 // Whether any cell spans multiple rows or cols. 498 // Whether any cell spans multiple rows or cols.
490 bool m_hasSpanningCells; 499 bool m_hasSpanningCells;
491 }; 500 };
492 501
493 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableSection, isTableSection()); 502 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableSection, isTableSection());
494 503
495 } // namespace blink 504 } // namespace blink
496 505
497 #endif // LayoutTableSection_h 506 #endif // LayoutTableSection_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698