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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 if (shouldPaintSelfOutline(paintInfo.phase)) { | 44 if (shouldPaintSelfOutline(paintInfo.phase)) { |
45 ObjectPainter(m_layoutReplaced).paintOutline(paintInfo, adjustedPaintOff
set); | 45 ObjectPainter(m_layoutReplaced).paintOutline(paintInfo, adjustedPaintOff
set); |
46 return; | 46 return; |
47 } | 47 } |
48 | 48 |
49 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection && !m_layoutReplaced.canHaveChildren() && paintInfo.phase != PaintPhas
eClippingMask) | 49 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection && !m_layoutReplaced.canHaveChildren() && paintInfo.phase != PaintPhas
eClippingMask) |
50 return; | 50 return; |
51 | 51 |
52 if (paintInfo.phase == PaintPhaseSelection) | 52 if (paintInfo.phase == PaintPhaseSelection) |
53 if (m_layoutReplaced.selectionState() == SelectionNone) | 53 if (m_layoutReplaced.getSelectionState() == SelectionNone) |
54 return; | 54 return; |
55 | 55 |
56 { | 56 { |
57 Optional<RoundedInnerRectClipper> clipper; | 57 Optional<RoundedInnerRectClipper> clipper; |
58 bool completelyClippedOut = false; | 58 bool completelyClippedOut = false; |
59 if (m_layoutReplaced.style()->hasBorderRadius()) { | 59 if (m_layoutReplaced.style()->hasBorderRadius()) { |
60 if (borderRect.isEmpty()) { | 60 if (borderRect.isEmpty()) { |
61 completelyClippedOut = true; | 61 completelyClippedOut = true; |
62 } else if (shouldApplyViewportClip(m_layoutReplaced)) { | 62 } else if (shouldApplyViewportClip(m_layoutReplaced)) { |
63 // Push a clip if we have a border radius, since we want to roun
d the foreground content that gets painted. | 63 // Push a clip if we have a border radius, since we want to roun
d the foreground content that gets painted. |
(...skipping 13 matching lines...) Expand all Loading... |
77 if (paintInfo.phase == PaintPhaseClippingMask) { | 77 if (paintInfo.phase == PaintPhaseClippingMask) { |
78 BoxPainter(m_layoutReplaced).paintClippingMask(paintInfo, adjust
edPaintOffset); | 78 BoxPainter(m_layoutReplaced).paintClippingMask(paintInfo, adjust
edPaintOffset); |
79 } else { | 79 } else { |
80 m_layoutReplaced.paintReplaced(paintInfo, adjustedPaintOffset); | 80 m_layoutReplaced.paintReplaced(paintInfo, adjustedPaintOffset); |
81 } | 81 } |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 // The selection tint never gets clipped by border-radius rounding, since we
want it to run right up to the edges of | 85 // The selection tint never gets clipped by border-radius rounding, since we
want it to run right up to the edges of |
86 // surrounding content. | 86 // surrounding content. |
87 bool drawSelectionTint = paintInfo.phase == PaintPhaseForeground && m_layout
Replaced.selectionState() != SelectionNone && !paintInfo.isPrinting(); | 87 bool drawSelectionTint = paintInfo.phase == PaintPhaseForeground && m_layout
Replaced.getSelectionState() != SelectionNone && !paintInfo.isPrinting(); |
88 if (drawSelectionTint && !LayoutObjectDrawingRecorder::useCachedDrawingIfPos
sible(paintInfo.context, m_layoutReplaced, DisplayItem::SelectionTint, adjustedP
aintOffset)) { | 88 if (drawSelectionTint && !LayoutObjectDrawingRecorder::useCachedDrawingIfPos
sible(paintInfo.context, m_layoutReplaced, DisplayItem::SelectionTint, adjustedP
aintOffset)) { |
89 LayoutRect selectionPaintingRect = m_layoutReplaced.localSelectionRect()
; | 89 LayoutRect selectionPaintingRect = m_layoutReplaced.localSelectionRect()
; |
90 selectionPaintingRect.moveBy(adjustedPaintOffset); | 90 selectionPaintingRect.moveBy(adjustedPaintOffset); |
91 IntRect selectionPaintingIntRect = pixelSnappedIntRect(selectionPainting
Rect); | 91 IntRect selectionPaintingIntRect = pixelSnappedIntRect(selectionPainting
Rect); |
92 | 92 |
93 LayoutObjectDrawingRecorder drawingRecorder(paintInfo.context, m_layoutR
eplaced, DisplayItem::SelectionTint, selectionPaintingIntRect, adjustedPaintOffs
et); | 93 LayoutObjectDrawingRecorder drawingRecorder(paintInfo.context, m_layoutR
eplaced, DisplayItem::SelectionTint, selectionPaintingIntRect, adjustedPaintOffs
et); |
94 paintInfo.context.fillRect(selectionPaintingIntRect, m_layoutReplaced.se
lectionBackgroundColor()); | 94 paintInfo.context.fillRect(selectionPaintingIntRect, m_layoutReplaced.se
lectionBackgroundColor()); |
95 } | 95 } |
96 } | 96 } |
97 | 97 |
(...skipping 11 matching lines...) Expand all Loading... |
109 paintRect.unite(m_layoutReplaced.localSelectionRect()); | 109 paintRect.unite(m_layoutReplaced.localSelectionRect()); |
110 paintRect.moveBy(adjustedPaintOffset); | 110 paintRect.moveBy(adjustedPaintOffset); |
111 | 111 |
112 if (!paintInfo.cullRect().intersectsCullRect(paintRect)) | 112 if (!paintInfo.cullRect().intersectsCullRect(paintRect)) |
113 return false; | 113 return false; |
114 | 114 |
115 return true; | 115 return true; |
116 } | 116 } |
117 | 117 |
118 } // namespace blink | 118 } // namespace blink |
OLD | NEW |