Chromium Code Reviews| Index: third_party/WebKit/Source/core/paint/BoxPaintInvalidator.cpp |
| diff --git a/third_party/WebKit/Source/core/paint/BoxPaintInvalidator.cpp b/third_party/WebKit/Source/core/paint/BoxPaintInvalidator.cpp |
| index 9e797d492e1dd2ef7483f973342a2050e26a5fb3..1fec9c176c5744a83ed07ae834daff3d09f3bd49 100644 |
| --- a/third_party/WebKit/Source/core/paint/BoxPaintInvalidator.cpp |
| +++ b/third_party/WebKit/Source/core/paint/BoxPaintInvalidator.cpp |
| @@ -312,13 +312,18 @@ PaintInvalidationReason BoxPaintInvalidator::invalidatePaintIfNeeded() { |
| bool BoxPaintInvalidator::needsToSavePreviousBoxGeometries() { |
| LayoutSize paintInvalidationSize = m_context.newVisualRect.size(); |
| - // Don't save old box Geometries if the paint rect is empty because we'll |
| - // full invalidate once the paint rect becomes non-empty. |
| - if (paintInvalidationSize.isEmpty()) |
| - return false; |
| - if (m_box.paintedOutputOfObjectHasNoEffectRegardlessOfSize()) |
| - return false; |
| + // The shortcuts doesn't apply to HTML element. ViewPaintInvalidator needs to |
| + // know its previous border box size. |
|
chrishtr
2017/02/16 21:11:14
Even if empty? I wonder in which case.
Xianzhu
2017/02/16 22:01:58
The size of HTML element affects viewport backgrou
|
| + if (!m_box.node() || !m_box.node()->isHTMLElement()) { |
| + // Don't save old box Geometries if the paint rect is empty because we'll |
| + // full invalidate once the paint rect becomes non-empty. |
|
chrishtr
2017/02/16 21:11:14
drive-by nit: s/full/fully/. also "geometries" ins
Xianzhu
2017/02/16 22:01:58
Done.
|
| + if (paintInvalidationSize.isEmpty()) |
| + return false; |
| + |
| + if (m_box.paintedOutputOfObjectHasNoEffectRegardlessOfSize()) |
| + return false; |
| + } |
| const ComputedStyle& style = m_box.styleRef(); |
| @@ -360,15 +365,21 @@ void BoxPaintInvalidator::savePreviousBoxGeometriesIfNeeded() { |
| m_box.getMutableForPainting().setHasPreviousBoxGeometries(true); |
| } |
| -LayoutSize BoxPaintInvalidator::previousBorderBoxSize() { |
| - DCHECK(m_box.hasPreviousBoxGeometries() == |
| - previousBoxGeometriesMap().contains(&m_box)); |
| - if (m_box.hasPreviousBoxGeometries()) |
| - return previousBoxGeometriesMap().get(&m_box).borderBoxSize; |
| +static LayoutSize previousBorderBoxSizeInternal(const LayoutBox& box, |
| + const LayoutSize& defaultSize) { |
| + DCHECK(box.hasPreviousBoxGeometries() == |
| + previousBoxGeometriesMap().contains(&box)); |
| + if (box.hasPreviousBoxGeometries()) |
| + return previousBoxGeometriesMap().get(&box).borderBoxSize; |
| + return defaultSize; |
| +} |
| - // We didn't save the old border box size because it was the same as the size |
| - // of oldVisualRect. |
| - return m_context.oldVisualRect.size(); |
| +LayoutSize BoxPaintInvalidator::previousBorderBoxSize(const LayoutBox& box) { |
| + return previousBorderBoxSizeInternal(box, box.visualRect().size()); |
| +} |
| + |
| +LayoutSize BoxPaintInvalidator::previousBorderBoxSize() { |
| + return previousBorderBoxSizeInternal(m_box, m_context.oldVisualRect.size()); |
|
chrishtr
2017/02/16 21:11:14
Wh oldVisualRect() here but visualRect() in the ot
Xianzhu
2017/02/16 22:01:58
Added comments:
// This is used during paint inval
|
| } |
| LayoutRect BoxPaintInvalidator::previousContentBoxRect() { |