OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
6 #include "core/paint/ViewPainter.h" | 6 #include "core/paint/ViewPainter.h" |
7 | 7 |
8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
9 #include "core/layout/LayoutBox.h" | 9 #include "core/layout/LayoutBox.h" |
10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
11 #include "core/paint/BlockPainter.h" | 11 #include "core/paint/BlockPainter.h" |
12 #include "core/paint/LayoutObjectDrawingRecorder.h" | 12 #include "core/paint/LayoutObjectDrawingRecorder.h" |
13 #include "core/paint/PaintInfo.h" | 13 #include "core/paint/PaintInfo.h" |
14 #include "platform/RuntimeEnabledFeatures.h" | 14 #include "platform/RuntimeEnabledFeatures.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 void ViewPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) | 18 void ViewPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) |
19 { | 19 { |
20 // If we ever require layout but receive a paint anyway, something has gone
horribly wrong. | 20 // If we ever require layout but receive a paint anyway, something has gone
horribly wrong. |
21 ASSERT(!m_layoutView.needsLayout()); | 21 ASSERT(!m_layoutView.needsLayout()); |
22 // LayoutViews should never be called to paint with an offset not on device
pixels. | 22 // LayoutViews should never be called to paint with an offset not on device
pixels. |
23 ASSERT(LayoutPoint(IntPoint(paintOffset.x(), paintOffset.y())) == paintOffse
t); | 23 ASSERT(LayoutPoint(IntPoint(paintOffset.x(), paintOffset.y())) == paintOffse
t); |
24 | 24 |
25 // This avoids painting garbage between columns if there is a column gap. | |
26 // This is legacy WebKit behavior and doesn't work with slimmingpaint. We ca
n remove it once region-based columns are launched. | |
27 if (!RuntimeEnabledFeatures::regionBasedColumnsEnabled() && m_layoutView.fra
meView() && m_layoutView.style()->isOverflowPaged()) { | |
28 ASSERT(!RuntimeEnabledFeatures::slimmingPaintEnabled()); | |
29 LayoutRect paintRect(paintInfo.rect); | |
30 paintInfo.context->fillRect(paintRect, m_layoutView.frameView()->baseBac
kgroundColor()); | |
31 } | |
32 | |
33 m_layoutView.paintObject(paintInfo, paintOffset); | 25 m_layoutView.paintObject(paintInfo, paintOffset); |
34 BlockPainter(m_layoutView).paintOverflowControlsIfNeeded(paintInfo, paintOff
set); | 26 BlockPainter(m_layoutView).paintOverflowControlsIfNeeded(paintInfo, paintOff
set); |
35 } | 27 } |
36 | 28 |
37 static inline bool layoutObjectObscuresBackground(LayoutBox* rootBox) | 29 static inline bool layoutObjectObscuresBackground(LayoutBox* rootBox) |
38 { | 30 { |
39 ASSERT(rootBox); | 31 ASSERT(rootBox); |
40 const ComputedStyle& style = rootBox->styleRef(); | 32 const ComputedStyle& style = rootBox->styleRef(); |
41 if (style.visibility() != VISIBLE | 33 if (style.visibility() != VISIBLE |
42 || style.opacity() != 1 | 34 || style.opacity() != 1 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 { | 85 { |
94 ASSERT(rootBox); | 86 ASSERT(rootBox); |
95 // CSS Boxes always fill the viewport background (see paintRootBoxFillLayers
) | 87 // CSS Boxes always fill the viewport background (see paintRootBoxFillLayers
) |
96 if (!rootBox->isSVG()) | 88 if (!rootBox->isSVG()) |
97 return true; | 89 return true; |
98 | 90 |
99 return rootBox->frameRect().contains(m_layoutView.frameRect()); | 91 return rootBox->frameRect().contains(m_layoutView.frameRect()); |
100 } | 92 } |
101 | 93 |
102 } // namespace blink | 94 } // namespace blink |
OLD | NEW |