Chromium Code Reviews| 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( | |
|
chrishtr
2017/04/03 17:10:51
This method is new in this CL, right? I'm not sure
Xianzhu
2017/04/03 17:23:05
Previously for any display item, we either paint i
| |
| 30 PaintResult paintResult, | |
| 31 const CullRect& paintRect) { | |
| 32 // A table row or section may paint large background display item which | |
| 33 // contains paint operations of the background in each contained cell. | |
| 34 // The display item can be clipped by the paint rect to avoid painting | |
| 35 // on areas not interested. If we didn't fully paint and paint rect changes, | |
| 36 // we need to invalidate the display item. | |
| 37 auto& box = static_cast<LayoutTableBoxComponent&>(m_layoutObject); | |
|
chrishtr
2017/04/03 17:53:25
I think you need a setNeedsRepaint also on the pai
| |
| 38 if (box.m_lastPaintResult != FullyPainted && | |
| 39 box.m_lastPaintRect != paintRect) { | |
| 40 ObjectPaintInvalidator(m_layoutObject) | |
| 41 .invalidateDisplayItemClient(m_layoutObject, PaintInvalidationFull); | |
| 42 } | |
| 43 | |
| 44 box.m_lastPaintResult = paintResult; | |
| 45 box.m_lastPaintRect = paintRect; | |
| 46 } | |
| 47 | |
| 28 } // namespace blink | 48 } // namespace blink |
| OLD | NEW |