OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/paint/ViewPaintInvalidator.h" | 5 #include "core/paint/ViewPaintInvalidator.h" |
6 | 6 |
7 #include "core/layout/LayoutView.h" | 7 #include "core/layout/LayoutView.h" |
8 #include "core/paint/BoxPaintInvalidator.h" | 8 #include "core/paint/BoxPaintInvalidator.h" |
9 #include "platform/geometry/LayoutSize.h" | 9 #include "platform/geometry/LayoutSize.h" |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 // document element. | 26 // document element. |
27 // See https://drafts.csswg.org/css-backgrounds-3/#root-background. | 27 // See https://drafts.csswg.org/css-backgrounds-3/#root-background. |
28 Element* documentElement = m_view.document().documentElement(); | 28 Element* documentElement = m_view.document().documentElement(); |
29 if (!documentElement) | 29 if (!documentElement) |
30 return; | 30 return; |
31 const LayoutObject* backgroundObject = documentElement->layoutObject(); | 31 const LayoutObject* backgroundObject = documentElement->layoutObject(); |
32 if (!backgroundObject || !backgroundObject->isBox()) | 32 if (!backgroundObject || !backgroundObject->isBox()) |
33 return; | 33 return; |
34 | 34 |
35 const LayoutBox& backgroundBox = toLayoutBox(*backgroundObject); | 35 const LayoutBox& backgroundBox = toLayoutBox(*backgroundObject); |
36 LayoutSize oldSize = BoxPaintInvalidator::previousBorderBoxSize( | 36 LayoutSize oldSize = backgroundBox.previousSize(); |
37 backgroundBox, backgroundBox.visualRect().size()); | |
38 LayoutSize newSize = backgroundBox.size(); | 37 LayoutSize newSize = backgroundBox.size(); |
39 const auto& backgroundLayers = m_view.styleRef().backgroundLayers(); | 38 const auto& backgroundLayers = m_view.styleRef().backgroundLayers(); |
40 if ((oldSize.width() != newSize.width() && | 39 if ((oldSize.width() != newSize.width() && |
41 LayoutBox::mustInvalidateFillLayersPaintOnWidthChange( | 40 LayoutBox::mustInvalidateFillLayersPaintOnWidthChange( |
42 backgroundLayers)) || | 41 backgroundLayers)) || |
43 (oldSize.height() != newSize.height() && | 42 (oldSize.height() != newSize.height() && |
44 LayoutBox::mustInvalidateFillLayersPaintOnHeightChange( | 43 LayoutBox::mustInvalidateFillLayersPaintOnHeightChange( |
45 backgroundLayers))) { | 44 backgroundLayers))) { |
46 m_view.getMutableForPainting().setShouldDoFullPaintInvalidation( | 45 m_view.getMutableForPainting().setShouldDoFullPaintInvalidation( |
47 PaintInvalidationViewBackground); | 46 PaintInvalidationViewBackground); |
48 } | 47 } |
49 } | 48 } |
50 | 49 |
51 } // namespace blink | 50 } // namespace blink |
OLD | NEW |