OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "core/paint/ViewPaintInvalidator.h" | |
6 | |
7 #include "core/layout/LayoutView.h" | |
8 #include "core/paint/BoxPaintInvalidator.h" | |
9 #include "platform/geometry/LayoutSize.h" | |
10 | |
11 namespace blink { | |
12 | |
13 PaintInvalidationReason ViewPaintInvalidator::invalidatePaintIfNeeded() { | |
chrishtr
2017/02/16 23:11:25
Indentation nit:
if (m_view.styleRef().hasEntirel
Xianzhu
2017/02/16 23:39:35
Done.
| |
14 if (!m_view.styleRef().hasEntirelyFixedBackground()) { | |
15 // LayoutView's non-fixed-attachment background is positioned in the | |
16 // document element. | |
chrishtr
2017/02/16 23:11:25
Please link to the spec here, for reference.
Xianzhu
2017/02/16 23:39:35
Done.
| |
17 if (Element* documentElement = m_view.document().documentElement()) { | |
18 const LayoutObject* backgroundObject = documentElement->layoutObject(); | |
19 if (backgroundObject && backgroundObject->isBox()) { | |
20 const LayoutBox& backgroundBox = toLayoutBox(*backgroundObject); | |
21 LayoutSize oldSize = | |
22 BoxPaintInvalidator::previousBorderBoxSize(backgroundBox); | |
23 LayoutSize newSize = backgroundBox.size(); | |
24 const auto& backgroundLayers = m_view.styleRef().backgroundLayers(); | |
25 if ((oldSize.width() != newSize.width() && | |
26 LayoutBox::mustInvalidateFillLayersPaintOnWidthChange( | |
chrishtr
2017/02/16 23:11:25
This looks like mostly the same code as
LayoutView
Xianzhu
2017/02/16 23:39:35
Currently we can only reuse 4 lines of code becaus
| |
27 backgroundLayers)) || | |
28 (oldSize.height() != newSize.height() && | |
29 LayoutBox::mustInvalidateFillLayersPaintOnHeightChange( | |
30 backgroundLayers))) { | |
31 m_view.getMutableForPainting().setShouldDoFullPaintInvalidation( | |
32 PaintInvalidationViewBackground); | |
33 } | |
34 } | |
35 } | |
36 } | |
37 | |
38 return BoxPaintInvalidator(m_view, m_context).invalidatePaintIfNeeded(); | |
39 } | |
40 | |
41 } // namespace blink | |
OLD | NEW |