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/style/ComputedStyle.h" | 8 #include "core/style/ComputedStyle.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 bool LayoutTableBoxComponent::doCellsHaveDirtyWidth( | 12 bool LayoutTableBoxComponent::doCellsHaveDirtyWidth( |
| 13 const LayoutObject& tablePart, | 13 const LayoutObject& tablePart, |
| 14 const LayoutTable& table, | 14 const LayoutTable& table, |
| 15 const StyleDifference& diff, | 15 const StyleDifference& diff, |
| 16 const ComputedStyle& oldStyle) { | 16 const ComputedStyle& oldStyle) { |
| 17 // ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation sets needsFullLayout | 17 // ComputedStyle::diffNeedsFullLayoutAndPaintInvalidation sets needsFullLayout |
| 18 // when border sizes change: checking diff.needsFullLayout() is an | 18 // when border sizes change: checking diff.needsFullLayout() is an |
| 19 // optimization, not required for correctness. | 19 // optimization, not required for correctness. |
| 20 // TODO(dgrogan): Remove tablePart.needsLayout()? Perhaps it was an old | 20 // TODO(dgrogan): Remove tablePart.needsLayout()? Perhaps it was an old |
| 21 // optimization but now it seems that diff.needsFullLayout() implies | 21 // optimization but now it seems that diff.needsFullLayout() implies |
| 22 // tablePart.needsLayout(). | 22 // tablePart.needsLayout(). |
| 23 return diff.needsFullLayout() && tablePart.needsLayout() && | 23 return diff.needsFullLayout() && tablePart.needsLayout() && |
| 24 table.collapseBorders() && | 24 table.collapseBorders() && |
| 25 !oldStyle.border().sizeEquals(tablePart.style()->border()); | 25 !oldStyle.border().sizeEquals(tablePart.style()->border()); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void LayoutTableBoxComponent::MutableForPainting::updatePaintResult( | |
| 29 PaintResult paintResult, | |
| 30 const CullRect& paintRect) { | |
| 31 // A table row or section may paint large background display item which | |
| 32 // contains paint operations of the background in each contained cell. | |
| 33 // The display item can be clipped by the paint rect to avoid painting | |
| 34 // on areas not interested. If we didn't fully paint and paint rect changes, | |
| 35 // we need to invalidate the display item. | |
| 36 auto& box = static_cast<LayoutTableBoxComponent&>(m_layoutObject); | |
| 37 if (box.m_lastPaintResult != FullyPainted && box.m_lastPaintRect != paintRect) | |
| 38 box.setDisplayItemsUncached(); | |
|
wkorman
2017/03/31 22:15:41
Why this vs invalidateDisplayItemClient?
Xianzhu
2017/03/31 23:26:30
It should be invalidateDisplayItemClient. Done.
| |
| 39 | |
| 40 box.m_lastPaintResult = paintResult; | |
| 41 box.m_lastPaintRect = paintRect; | |
| 42 } | |
| 43 | |
| 28 } // namespace blink | 44 } // namespace blink |
| OLD | NEW |