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

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

Issue 2469903002: Use appropriate background object visual rect for composited table cell backgrounds. (Closed)
Patch Set: Explicitly create special clients if needed in TablePaintInvalidator. Add initally-empty test varia… Created 4 years, 1 month 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 LayoutRect visualRect() const; 310 LayoutRect visualRect() const;
311 311
312 private: 312 private:
313 const LayoutTable& m_layoutTable; 313 const LayoutTable& m_layoutTable;
314 CollapsedBorderValue m_startBorder; 314 CollapsedBorderValue m_startBorder;
315 CollapsedBorderValue m_endBorder; 315 CollapsedBorderValue m_endBorder;
316 CollapsedBorderValue m_beforeBorder; 316 CollapsedBorderValue m_beforeBorder;
317 CollapsedBorderValue m_afterBorder; 317 CollapsedBorderValue m_afterBorder;
318 }; 318 };
319 319
320 bool usesTableAsAdditionalDisplayItemClient() const; 320 class RowBackgroundDisplayItemClient : public DisplayItemClient {
wkorman 2016/11/15 02:30:14 This class and the two others below are essentiall
321 public:
322 RowBackgroundDisplayItemClient(const LayoutTableRow&);
323
324 // DisplayItemClient methods.
325 String debugName() const;
326 LayoutRect visualRect() const;
327
328 private:
329 const LayoutTableRow& m_layoutTableRow;
330 };
331
332 class ColBackgroundDisplayItemClient : public DisplayItemClient {
333 public:
334 ColBackgroundDisplayItemClient(const LayoutTableCol&);
335
336 // DisplayItemClient methods.
337 String debugName() const;
338 LayoutRect visualRect() const;
339
340 private:
341 const LayoutTableCol& m_layoutTableCol;
342 };
343
344 class SectionBackgroundDisplayItemClient : public DisplayItemClient {
345 public:
346 SectionBackgroundDisplayItemClient(const LayoutTableSection&);
347
348 // DisplayItemClient methods.
349 String debugName() const;
350 LayoutRect visualRect() const;
351
352 private:
353 const LayoutTableSection& m_layoutTableSection;
354 };
355
356 bool usesCompositedCellDisplayItemClients() const;
357 void createCompositedCellDisplayItemClients();
358 // The special background display item client instances below are only created
359 // for composited table cells when their associated styling warrants per
360 // createCompositedCellDisplayItemClients().
361 const RowBackgroundDisplayItemClient* rowBackgroundDisplayItemClient() const {
362 return m_rowBackgroundDisplayItemClient.get();
363 }
364 const ColBackgroundDisplayItemClient* colBackgroundDisplayItemClient() const {
365 return m_colBackgroundDisplayItemClient.get();
366 }
367 const ColBackgroundDisplayItemClient* colGroupBackgroundDisplayItemClient()
368 const {
369 return m_colGroupBackgroundDisplayItemClient.get();
370 }
371 const SectionBackgroundDisplayItemClient* sectionBackgroundDisplayItemClient()
372 const {
373 return m_sectionBackgroundDisplayItemClient.get();
374 }
321 const CollapsedBorderValues* collapsedBorderValues() const { 375 const CollapsedBorderValues* collapsedBorderValues() const {
322 return m_collapsedBorderValues.get(); 376 return m_collapsedBorderValues.get();
323 } 377 }
324 378
325 LayoutRect debugRect() const override; 379 LayoutRect debugRect() const override;
326 380
327 void adjustChildDebugRect(LayoutRect&) const override; 381 void adjustChildDebugRect(LayoutRect&) const override;
328 382
329 // A table cell's location is relative to its containing section. 383 // A table cell's location is relative to its containing section.
330 LayoutBox* locationContainer() const override { return section(); } 384 LayoutBox* locationContainer() const override { return section(); }
331 385
332 protected: 386 protected:
387 void ensureIsReadyForPaintInvalidation() override;
333 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override; 388 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override;
334 void computePreferredLogicalWidths() override; 389 void computePreferredLogicalWidths() override;
335 390
336 void addLayerHitTestRects(LayerHitTestRects&, 391 void addLayerHitTestRects(LayerHitTestRects&,
337 const PaintLayer* currentCompositedLayer, 392 const PaintLayer* currentCompositedLayer,
338 const LayoutPoint& layerOffset, 393 const LayoutPoint& layerOffset,
339 const LayoutRect& containerRect) const override; 394 const LayoutRect& containerRect) const override;
340 395
341 private: 396 private:
342 bool isOfType(LayoutObjectType type) const override { 397 bool isOfType(LayoutObjectType type) const override {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 476
422 // The intrinsic padding. 477 // The intrinsic padding.
423 // See class comment for what they are. 478 // See class comment for what they are.
424 // 479 //
425 // Note: Those fields are using non-subpixel units (int) 480 // Note: Those fields are using non-subpixel units (int)
426 // because we don't do fractional arithmetic on tables. 481 // because we don't do fractional arithmetic on tables.
427 int m_intrinsicPaddingBefore; 482 int m_intrinsicPaddingBefore;
428 int m_intrinsicPaddingAfter; 483 int m_intrinsicPaddingAfter;
429 484
430 std::unique_ptr<CollapsedBorderValues> m_collapsedBorderValues; 485 std::unique_ptr<CollapsedBorderValues> m_collapsedBorderValues;
486 std::unique_ptr<RowBackgroundDisplayItemClient>
wkorman 2016/11/15 01:05:33 We could use RareData to turn this batch of pointe
487 m_rowBackgroundDisplayItemClient;
488 std::unique_ptr<ColBackgroundDisplayItemClient>
489 m_colBackgroundDisplayItemClient;
490 std::unique_ptr<ColBackgroundDisplayItemClient>
491 m_colGroupBackgroundDisplayItemClient;
492 std::unique_ptr<SectionBackgroundDisplayItemClient>
493 m_sectionBackgroundDisplayItemClient;
431 }; 494 };
432 495
433 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableCell, isTableCell()); 496 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTableCell, isTableCell());
434 497
435 inline LayoutTableCell* LayoutTableCell::previousCell() const { 498 inline LayoutTableCell* LayoutTableCell::previousCell() const {
436 return toLayoutTableCell(LayoutObject::previousSibling()); 499 return toLayoutTableCell(LayoutObject::previousSibling());
437 } 500 }
438 501
439 inline LayoutTableCell* LayoutTableCell::nextCell() const { 502 inline LayoutTableCell* LayoutTableCell::nextCell() const {
440 return toLayoutTableCell(LayoutObject::nextSibling()); 503 return toLayoutTableCell(LayoutObject::nextSibling());
441 } 504 }
442 505
443 inline LayoutTableCell* LayoutTableRow::firstCell() const { 506 inline LayoutTableCell* LayoutTableRow::firstCell() const {
444 return toLayoutTableCell(firstChild()); 507 return toLayoutTableCell(firstChild());
445 } 508 }
446 509
447 inline LayoutTableCell* LayoutTableRow::lastCell() const { 510 inline LayoutTableCell* LayoutTableRow::lastCell() const {
448 return toLayoutTableCell(lastChild()); 511 return toLayoutTableCell(lastChild());
449 } 512 }
450 513
451 } // namespace blink 514 } // namespace blink
452 515
453 #endif // LayoutTableCell_h 516 #endif // LayoutTableCell_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698