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