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 "core/paint/ReplacedPainter.h" | 5 #include "core/paint/ReplacedPainter.h" |
6 | 6 |
7 #include "core/layout/LayoutReplaced.h" | 7 #include "core/layout/LayoutReplaced.h" |
8 #include "core/layout/api/SelectionState.h" | 8 #include "core/layout/api/SelectionState.h" |
9 #include "core/layout/svg/LayoutSVGRoot.h" | 9 #include "core/layout/svg/LayoutSVGRoot.h" |
10 #include "core/paint/BoxPainter.h" | 10 #include "core/paint/BoxPainter.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 void ReplacedPainter::paint(const PaintInfo& paintInfo, | 25 void ReplacedPainter::paint(const PaintInfo& paintInfo, |
26 const LayoutPoint& paintOffset) { | 26 const LayoutPoint& paintOffset) { |
27 ObjectPainter(m_layoutReplaced).checkPaintOffset(paintInfo, paintOffset); | 27 ObjectPainter(m_layoutReplaced).checkPaintOffset(paintInfo, paintOffset); |
28 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutReplaced.location(); | 28 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutReplaced.location(); |
29 if (!shouldPaint(paintInfo, adjustedPaintOffset)) | 29 if (!shouldPaint(paintInfo, adjustedPaintOffset)) |
30 return; | 30 return; |
31 | 31 |
32 LayoutRect borderRect(adjustedPaintOffset, m_layoutReplaced.size()); | 32 LayoutRect borderRect(adjustedPaintOffset, m_layoutReplaced.size()); |
33 | 33 |
34 if (m_layoutReplaced.style()->visibility() == EVisibility::Visible && | 34 if (m_layoutReplaced.style()->visibility() == EVisibility::kVisible && |
35 m_layoutReplaced.hasBoxDecorationBackground() && | 35 m_layoutReplaced.hasBoxDecorationBackground() && |
36 (paintInfo.phase == PaintPhaseForeground || | 36 (paintInfo.phase == PaintPhaseForeground || |
37 paintInfo.phase == PaintPhaseSelection)) | 37 paintInfo.phase == PaintPhaseSelection)) |
38 m_layoutReplaced.paintBoxDecorationBackground(paintInfo, | 38 m_layoutReplaced.paintBoxDecorationBackground(paintInfo, |
39 adjustedPaintOffset); | 39 adjustedPaintOffset); |
40 | 40 |
41 if (paintInfo.phase == PaintPhaseMask) { | 41 if (paintInfo.phase == PaintPhaseMask) { |
42 m_layoutReplaced.paintMask(paintInfo, adjustedPaintOffset); | 42 m_layoutReplaced.paintMask(paintInfo, adjustedPaintOffset); |
43 return; | 43 return; |
44 } | 44 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 !shouldPaintSelfOutline(paintInfo.phase) && | 130 !shouldPaintSelfOutline(paintInfo.phase) && |
131 paintInfo.phase != PaintPhaseSelection && | 131 paintInfo.phase != PaintPhaseSelection && |
132 paintInfo.phase != PaintPhaseMask && | 132 paintInfo.phase != PaintPhaseMask && |
133 paintInfo.phase != PaintPhaseClippingMask) | 133 paintInfo.phase != PaintPhaseClippingMask) |
134 return false; | 134 return false; |
135 | 135 |
136 // If we're invisible or haven't received a layout yet, just bail. | 136 // If we're invisible or haven't received a layout yet, just bail. |
137 // But if it's an SVG root, there can be children, so we'll check visibility | 137 // But if it's an SVG root, there can be children, so we'll check visibility |
138 // later. | 138 // later. |
139 if (!m_layoutReplaced.isSVGRoot() && | 139 if (!m_layoutReplaced.isSVGRoot() && |
140 m_layoutReplaced.style()->visibility() != EVisibility::Visible) | 140 m_layoutReplaced.style()->visibility() != EVisibility::kVisible) |
141 return false; | 141 return false; |
142 | 142 |
143 LayoutRect paintRect(m_layoutReplaced.visualOverflowRect()); | 143 LayoutRect paintRect(m_layoutReplaced.visualOverflowRect()); |
144 paintRect.unite(m_layoutReplaced.localSelectionRect()); | 144 paintRect.unite(m_layoutReplaced.localSelectionRect()); |
145 paintRect.moveBy(adjustedPaintOffset); | 145 paintRect.moveBy(adjustedPaintOffset); |
146 | 146 |
147 if (!paintInfo.cullRect().intersectsCullRect(paintRect)) | 147 if (!paintInfo.cullRect().intersectsCullRect(paintRect)) |
148 return false; | 148 return false; |
149 | 149 |
150 return true; | 150 return true; |
151 } | 151 } |
152 | 152 |
153 } // namespace blink | 153 } // namespace blink |
OLD | NEW |