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