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/ReplacedPainter.h" | 6 #include "core/paint/ReplacedPainter.h" |
7 | 7 |
8 #include "core/layout/LayoutReplaced.h" | 8 #include "core/layout/LayoutReplaced.h" |
9 #include "core/layout/api/SelectionState.h" | 9 #include "core/layout/api/SelectionState.h" |
10 #include "core/paint/BoxPainter.h" | 10 #include "core/paint/BoxPainter.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 if (paintInfo.phase == PaintPhaseMask) { | 34 if (paintInfo.phase == PaintPhaseMask) { |
35 m_layoutReplaced.paintMask(paintInfo, adjustedPaintOffset); | 35 m_layoutReplaced.paintMask(paintInfo, adjustedPaintOffset); |
36 return; | 36 return; |
37 } | 37 } |
38 | 38 |
39 if (paintInfo.phase == PaintPhaseClippingMask && (!m_layoutReplaced.hasLayer
() || !m_layoutReplaced.layer()->hasCompositedClippingMask())) | 39 if (paintInfo.phase == PaintPhaseClippingMask && (!m_layoutReplaced.hasLayer
() || !m_layoutReplaced.layer()->hasCompositedClippingMask())) |
40 return; | 40 return; |
41 | 41 |
42 if (paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSel
fOutline) { | 42 if (paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSel
fOutline) { |
43 if (m_layoutReplaced.styleRef().outlineWidth()) | 43 if (m_layoutReplaced.styleRef().outlineWidth()) |
44 ObjectPainter(m_layoutReplaced).paintOutline(paintInfo, paintRect, v
isualOverflowRect); | 44 ObjectPainter(m_layoutReplaced).paintOutline(paintInfo, paintRect, v
isualOverflowRect, adjustedPaintOffset); |
45 return; | 45 return; |
46 } | 46 } |
47 | 47 |
48 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection && !m_layoutReplaced.canHaveChildren() && paintInfo.phase != PaintPhas
eClippingMask) | 48 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection && !m_layoutReplaced.canHaveChildren() && paintInfo.phase != PaintPhas
eClippingMask) |
49 return; | 49 return; |
50 | 50 |
51 if (!paintInfo.shouldPaintWithinRoot(&m_layoutReplaced)) | 51 if (!paintInfo.shouldPaintWithinRoot(&m_layoutReplaced)) |
52 return; | 52 return; |
53 | 53 |
54 if (paintInfo.phase == PaintPhaseSelection) | 54 if (paintInfo.phase == PaintPhaseSelection) |
(...skipping 27 matching lines...) Expand all Loading... |
82 BoxPainter(m_layoutReplaced).paintClippingMask(paintInfo, adjust
edPaintOffset); | 82 BoxPainter(m_layoutReplaced).paintClippingMask(paintInfo, adjust
edPaintOffset); |
83 } else { | 83 } else { |
84 m_layoutReplaced.paintReplaced(paintInfo, adjustedPaintOffset); | 84 m_layoutReplaced.paintReplaced(paintInfo, adjustedPaintOffset); |
85 } | 85 } |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
89 // The selection tint never gets clipped by border-radius rounding, since we
want it to run right up to the edges of | 89 // The selection tint never gets clipped by border-radius rounding, since we
want it to run right up to the edges of |
90 // surrounding content. | 90 // surrounding content. |
91 bool drawSelectionTint = paintInfo.phase == PaintPhaseForeground && m_layout
Replaced.selectionState() != SelectionNone && !paintInfo.isPrinting(); | 91 bool drawSelectionTint = paintInfo.phase == PaintPhaseForeground && m_layout
Replaced.selectionState() != SelectionNone && !paintInfo.isPrinting(); |
92 if (drawSelectionTint && !LayoutObjectDrawingRecorder::useCachedDrawingIfPos
sible(*paintInfo.context, m_layoutReplaced, DisplayItem::SelectionTint)) { | 92 if (drawSelectionTint && !LayoutObjectDrawingRecorder::useCachedDrawingIfPos
sible(*paintInfo.context, m_layoutReplaced, DisplayItem::SelectionTint, paintOff
set)) { |
93 LayoutRect selectionPaintingRect = m_layoutReplaced.localSelectionRect()
; | 93 LayoutRect selectionPaintingRect = m_layoutReplaced.localSelectionRect()
; |
94 selectionPaintingRect.moveBy(adjustedPaintOffset); | 94 selectionPaintingRect.moveBy(adjustedPaintOffset); |
95 IntRect selectionPaintingIntRect = pixelSnappedIntRect(selectionPainting
Rect); | 95 IntRect selectionPaintingIntRect = pixelSnappedIntRect(selectionPainting
Rect); |
96 | 96 |
97 LayoutObjectDrawingRecorder drawingRecorder(*paintInfo.context, m_layout
Replaced, DisplayItem::SelectionTint, selectionPaintingIntRect); | 97 LayoutObjectDrawingRecorder drawingRecorder(*paintInfo.context, m_layout
Replaced, DisplayItem::SelectionTint, selectionPaintingIntRect, paintOffset); |
98 paintInfo.context->fillRect(selectionPaintingIntRect, m_layoutReplaced.s
electionBackgroundColor()); | 98 paintInfo.context->fillRect(selectionPaintingIntRect, m_layoutReplaced.s
electionBackgroundColor()); |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
102 } // namespace blink | 102 } // namespace blink |
OLD | NEW |