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

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

Issue 2786463004: Paint backgrounds of a table section/row in one display item (Closed)
Patch Set: - 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, 2007, 2009, 2013 Apple Inc. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2013 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 LayoutRect visualRect() const; 313 LayoutRect visualRect() const;
314 314
315 private: 315 private:
316 const LayoutTableCell& m_layoutTableCell; 316 const LayoutTableCell& m_layoutTableCell;
317 CollapsedBorderValue m_startBorder; 317 CollapsedBorderValue m_startBorder;
318 CollapsedBorderValue m_endBorder; 318 CollapsedBorderValue m_endBorder;
319 CollapsedBorderValue m_beforeBorder; 319 CollapsedBorderValue m_beforeBorder;
320 CollapsedBorderValue m_afterBorder; 320 CollapsedBorderValue m_afterBorder;
321 }; 321 };
322 322
323 class RowBackgroundDisplayItemClient : public DisplayItemClient {
324 public:
325 RowBackgroundDisplayItemClient(const LayoutTableCell&);
326
327 // DisplayItemClient methods.
328 String debugName() const;
329 LayoutRect visualRect() const;
330
331 private:
332 const LayoutTableCell& m_layoutTableCell;
333 };
334
335 bool usesCompositedCellDisplayItemClients() const; 323 bool usesCompositedCellDisplayItemClients() const;
336 const CollapsedBorderValues* collapsedBorderValues() const { 324 const CollapsedBorderValues* collapsedBorderValues() const {
337 return m_collapsedBorderValues.get(); 325 return m_collapsedBorderValues.get();
338 } 326 }
339 const DisplayItemClient& backgroundDisplayItemClient() const {
340 return (m_rowBackgroundDisplayItemClient &&
341 usesCompositedCellDisplayItemClients())
342 ? static_cast<const DisplayItemClient&>(
343 *m_rowBackgroundDisplayItemClient)
344 : *this;
345 }
346 327
347 LayoutRect debugRect() const override; 328 LayoutRect debugRect() const override;
348 329
349 void adjustChildDebugRect(LayoutRect&) const override; 330 void adjustChildDebugRect(LayoutRect&) const override;
350 331
351 // A table cell's location is relative to its containing section. 332 // A table cell's location is relative to its containing section.
352 LayoutBox* locationContainer() const override { return section(); } 333 LayoutBox* locationContainer() const override { return section(); }
353 334
354 void ensureIsReadyForPaintInvalidation() override;
355
356 bool hasLineIfEmpty() const override; 335 bool hasLineIfEmpty() const override;
357 336
358 protected: 337 protected:
359 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; 338 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override;
360 void computePreferredLogicalWidths() override; 339 void computePreferredLogicalWidths() override;
361 340
362 void addLayerHitTestRects(LayerHitTestRects&, 341 void addLayerHitTestRects(LayerHitTestRects&,
363 const PaintLayer* currentCompositedLayer, 342 const PaintLayer* currentCompositedLayer,
364 const LayoutPoint& layerOffset, 343 const LayoutPoint& layerOffset,
365 const LayoutRect& containerRect) const override; 344 const LayoutRect& containerRect) const override;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 426
448 // The intrinsic padding. 427 // The intrinsic padding.
449 // See class comment for what they are. 428 // See class comment for what they are.
450 // 429 //
451 // Note: Those fields are using non-subpixel units (int) 430 // Note: Those fields are using non-subpixel units (int)
452 // because we don't do fractional arithmetic on tables. 431 // because we don't do fractional arithmetic on tables.
453 int m_intrinsicPaddingBefore; 432 int m_intrinsicPaddingBefore;
454 int m_intrinsicPaddingAfter; 433 int m_intrinsicPaddingAfter;
455 434
456 std::unique_ptr<CollapsedBorderValues> m_collapsedBorderValues; 435 std::unique_ptr<CollapsedBorderValues> m_collapsedBorderValues;
457 std::unique_ptr<RowBackgroundDisplayItemClient>
458 m_rowBackgroundDisplayItemClient;
459 }; 436 };
460 437
461 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableCell, isTableCell()); 438 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableCell, isTableCell());
462 439
463 inline LayoutTableCell* LayoutTableCell::previousCell() const { 440 inline LayoutTableCell* LayoutTableCell::previousCell() const {
464 return toLayoutTableCell(LayoutObject::previousSibling()); 441 return toLayoutTableCell(LayoutObject::previousSibling());
465 } 442 }
466 443
467 inline LayoutTableCell* LayoutTableCell::nextCell() const { 444 inline LayoutTableCell* LayoutTableCell::nextCell() const {
468 return toLayoutTableCell(LayoutObject::nextSibling()); 445 return toLayoutTableCell(LayoutObject::nextSibling());
469 } 446 }
470 447
471 inline LayoutTableCell* LayoutTableRow::firstCell() const { 448 inline LayoutTableCell* LayoutTableRow::firstCell() const {
472 return toLayoutTableCell(firstChild()); 449 return toLayoutTableCell(firstChild());
473 } 450 }
474 451
475 inline LayoutTableCell* LayoutTableRow::lastCell() const { 452 inline LayoutTableCell* LayoutTableRow::lastCell() const {
476 return toLayoutTableCell(lastChild()); 453 return toLayoutTableCell(lastChild());
477 } 454 }
478 455
479 } // namespace blink 456 } // namespace blink
480 457
481 #endif // LayoutTableCell_h 458 #endif // LayoutTableCell_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698