Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: third_party/WebKit/Source/core/paint/ReplacedPainter.cpp

Issue 2624383002: Apply SVG viewport clips in PaintLayer; paint background of replaced like boxes. (Closed)
Patch Set: none Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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::kVisible && 34 if (shouldPaintSelfBlockBackground(paintInfo.phase)) {
35 m_layoutReplaced.hasBoxDecorationBackground() && 35 if (m_layoutReplaced.style()->visibility() == EVisibility::kVisible &&
36 (paintInfo.phase == PaintPhaseForeground || 36 m_layoutReplaced.hasBoxDecorationBackground()) {
37 paintInfo.phase == PaintPhaseSelection)) 37 m_layoutReplaced.paintBoxDecorationBackground(paintInfo,
38 m_layoutReplaced.paintBoxDecorationBackground(paintInfo, 38 adjustedPaintOffset);
39 adjustedPaintOffset); 39 }
40 // We're done. We don't bother painting any children.
41 if (paintInfo.phase == PaintPhaseSelfBlockBackgroundOnly)
42 return;
43 }
40 44
41 if (paintInfo.phase == PaintPhaseMask) { 45 if (paintInfo.phase == PaintPhaseMask) {
42 m_layoutReplaced.paintMask(paintInfo, adjustedPaintOffset); 46 m_layoutReplaced.paintMask(paintInfo, adjustedPaintOffset);
43 return; 47 return;
44 } 48 }
45 49
46 if (paintInfo.phase == PaintPhaseClippingMask && 50 if (paintInfo.phase == PaintPhaseClippingMask &&
47 (!m_layoutReplaced.hasLayer() || 51 (!m_layoutReplaced.hasLayer() ||
48 !m_layoutReplaced.layer()->hasCompositedClippingMask())) 52 !m_layoutReplaced.layer()->hasCompositedClippingMask()))
49 return; 53 return;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 127 }
124 } 128 }
125 129
126 bool ReplacedPainter::shouldPaint( 130 bool ReplacedPainter::shouldPaint(
127 const PaintInfo& paintInfo, 131 const PaintInfo& paintInfo,
128 const LayoutPoint& adjustedPaintOffset) const { 132 const LayoutPoint& adjustedPaintOffset) const {
129 if (paintInfo.phase != PaintPhaseForeground && 133 if (paintInfo.phase != PaintPhaseForeground &&
130 !shouldPaintSelfOutline(paintInfo.phase) && 134 !shouldPaintSelfOutline(paintInfo.phase) &&
131 paintInfo.phase != PaintPhaseSelection && 135 paintInfo.phase != PaintPhaseSelection &&
132 paintInfo.phase != PaintPhaseMask && 136 paintInfo.phase != PaintPhaseMask &&
133 paintInfo.phase != PaintPhaseClippingMask) 137 paintInfo.phase != PaintPhaseClippingMask &&
138 !shouldPaintSelfBlockBackground(paintInfo.phase))
134 return false; 139 return false;
135 140
136 // If we're invisible or haven't received a layout yet, just bail. 141 // 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 142 // But if it's an SVG root, there can be children, so we'll check visibility
138 // later. 143 // later.
139 if (!m_layoutReplaced.isSVGRoot() && 144 if (!m_layoutReplaced.isSVGRoot() &&
140 m_layoutReplaced.style()->visibility() != EVisibility::kVisible) 145 m_layoutReplaced.style()->visibility() != EVisibility::kVisible)
141 return false; 146 return false;
142 147
143 LayoutRect paintRect(m_layoutReplaced.visualOverflowRect()); 148 LayoutRect paintRect(m_layoutReplaced.visualOverflowRect());
144 paintRect.unite(m_layoutReplaced.localSelectionRect()); 149 paintRect.unite(m_layoutReplaced.localSelectionRect());
145 paintRect.moveBy(adjustedPaintOffset); 150 paintRect.moveBy(adjustedPaintOffset);
146 151
147 if (!paintInfo.cullRect().intersectsCullRect(paintRect)) 152 if (!paintInfo.cullRect().intersectsCullRect(paintRect))
148 return false; 153 return false;
149 154
150 return true; 155 return true;
151 } 156 }
152 157
153 } // namespace blink 158 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698