| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/layout/LayoutTableBoxComponent.h" | 5 #include "core/layout/LayoutTableBoxComponent.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutTable.h" | 7 #include "core/layout/LayoutTable.h" |
| 8 #include "core/paint/ObjectPaintInvalidator.h" |
| 8 #include "core/style/ComputedStyle.h" | 9 #include "core/style/ComputedStyle.h" |
| 9 | 10 |
| 10 namespace blink { | 11 namespace blink { |
| 11 | 12 |
| 12 bool LayoutTableBoxComponent::doCellsHaveDirtyWidth( | 13 bool LayoutTableBoxComponent::doCellsHaveDirtyWidth( |
| 13 const LayoutObject& tablePart, | 14 const LayoutObject& tablePart, |
| 14 const LayoutTable& table, | 15 const LayoutTable& table, |
| 15 const StyleDifference& diff, | 16 const StyleDifference& diff, |
| 16 const ComputedStyle& oldStyle) { | 17 const ComputedStyle& oldStyle) { |
| 17 // ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation sets needsFullLayout | 18 // ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation sets needsFullLayout |
| 18 // when border sizes change: checking diff.needsFullLayout() is an | 19 // when border sizes change: checking diff.needsFullLayout() is an |
| 19 // optimization, not required for correctness. | 20 // optimization, not required for correctness. |
| 20 // TODO(dgrogan): Remove tablePart.needsLayout()? Perhaps it was an old | 21 // TODO(dgrogan): Remove tablePart.needsLayout()? Perhaps it was an old |
| 21 // optimization but now it seems that diff.needsFullLayout() implies | 22 // optimization but now it seems that diff.needsFullLayout() implies |
| 22 // tablePart.needsLayout(). | 23 // tablePart.needsLayout(). |
| 23 return diff.needsFullLayout() && tablePart.needsLayout() && | 24 return diff.needsFullLayout() && tablePart.needsLayout() && |
| 24 table.collapseBorders() && | 25 table.collapseBorders() && |
| 25 !oldStyle.border().sizeEquals(tablePart.style()->border()); | 26 !oldStyle.border().sizeEquals(tablePart.style()->border()); |
| 26 } | 27 } |
| 27 | 28 |
| 29 void LayoutTableBoxComponent::MutableForPainting::updatePaintResult( |
| 30 PaintResult paintResult, |
| 31 const CullRect& paintRect) { |
| 32 DCHECK_EQ(m_layoutObject.document().lifecycle().state(), |
| 33 DocumentLifecycle::LifecycleState::InPaint); |
| 34 |
| 35 // A table row or section may paint large background display item which |
| 36 // contains paint operations of the background in each contained cell. |
| 37 // The display item can be clipped by the paint rect to avoid painting |
| 38 // on areas not interested. If we didn't fully paint and paint rect changes, |
| 39 // we need to invalidate the display item (using setDisplayItemUncached() |
| 40 // because we are already in painting.) |
| 41 auto& box = static_cast<LayoutTableBoxComponent&>(m_layoutObject); |
| 42 if (box.m_lastPaintResult != FullyPainted && box.m_lastPaintRect != paintRect) |
| 43 m_layoutObject.setDisplayItemsUncached(); |
| 44 |
| 45 box.m_lastPaintResult = paintResult; |
| 46 box.m_lastPaintRect = paintRect; |
| 47 } |
| 48 |
| 28 } // namespace blink | 49 } // namespace blink |
| OLD | NEW |