| 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/PartPainter.h" | 5 #include "core/paint/PartPainter.h" |
| 6 | 6 |
| 7 #include "core/layout/LayoutPart.h" | 7 #include "core/layout/LayoutPart.h" |
| 8 #include "core/paint/BoxPainter.h" | 8 #include "core/paint/BoxPainter.h" |
| 9 #include "core/paint/LayoutObjectDrawingRecorder.h" | 9 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 10 #include "core/paint/PaintInfo.h" | 10 #include "core/paint/PaintInfo.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 return selectionEnd == end; | 35 return selectionEnd == end; |
| 36 if (s == SelectionBoth) | 36 if (s == SelectionBoth) |
| 37 return selectionStart == 0 && selectionEnd == end; | 37 return selectionStart == 0 && selectionEnd == end; |
| 38 | 38 |
| 39 ASSERT(0); | 39 ASSERT(0); |
| 40 return false; | 40 return false; |
| 41 } | 41 } |
| 42 | 42 |
| 43 void PartPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) | 43 void PartPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) |
| 44 { | 44 { |
| 45 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutPart.location(); | 45 if (!ReplacedPainter(m_layoutPart).shouldPaint(paintInfo, paintOffset)) |
| 46 if (!ReplacedPainter(m_layoutPart).shouldPaint(paintInfo, adjustedPaintOffse
t)) | |
| 47 return; | 46 return; |
| 48 | 47 |
| 48 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutPart.location(); |
| 49 LayoutRect borderRect(adjustedPaintOffset, m_layoutPart.size()); | 49 LayoutRect borderRect(adjustedPaintOffset, m_layoutPart.size()); |
| 50 | 50 |
| 51 if (m_layoutPart.hasBoxDecorationBackground() && (paintInfo.phase == PaintPh
aseForeground || paintInfo.phase == PaintPhaseSelection)) | 51 if (m_layoutPart.hasBoxDecorationBackground() && (paintInfo.phase == PaintPh
aseForeground || paintInfo.phase == PaintPhaseSelection)) |
| 52 BoxPainter(m_layoutPart).paintBoxDecorationBackground(paintInfo, adjuste
dPaintOffset); | 52 BoxPainter(m_layoutPart).paintBoxDecorationBackground(paintInfo, adjuste
dPaintOffset); |
| 53 | 53 |
| 54 if (paintInfo.phase == PaintPhaseMask) { | 54 if (paintInfo.phase == PaintPhaseMask) { |
| 55 BoxPainter(m_layoutPart).paintMask(paintInfo, adjustedPaintOffset); | 55 BoxPainter(m_layoutPart).paintMask(paintInfo, adjustedPaintOffset); |
| 56 return; | 56 return; |
| 57 } | 57 } |
| 58 | 58 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 76 -(m_layoutPart.paddingLeft() + m_layoutPart.borderLeft())), | 76 -(m_layoutPart.paddingLeft() + m_layoutPart.borderLeft())), |
| 77 true, true); | 77 true, true); |
| 78 clipper.emplace(m_layoutPart, paintInfo, borderRect, roundedInnerRec
t, ApplyToDisplayList); | 78 clipper.emplace(m_layoutPart, paintInfo, borderRect, roundedInnerRec
t, ApplyToDisplayList); |
| 79 } | 79 } |
| 80 | 80 |
| 81 if (m_layoutPart.widget()) | 81 if (m_layoutPart.widget()) |
| 82 m_layoutPart.paintContents(paintInfo, paintOffset); | 82 m_layoutPart.paintContents(paintInfo, paintOffset); |
| 83 } | 83 } |
| 84 | 84 |
| 85 // Paint a partially transparent wash over selected widgets. | 85 // Paint a partially transparent wash over selected widgets. |
| 86 if (isSelected() && !paintInfo.isPrinting() && !LayoutObjectDrawingRecorder:
:useCachedDrawingIfPossible(paintInfo.context, m_layoutPart, paintInfo.phase, ad
justedPaintOffset)) { | 86 if (isSelected() && !paintInfo.isPrinting() && !LayoutObjectDrawingRecorder:
:useCachedDrawingIfPossible(paintInfo.context, m_layoutPart, paintInfo.phase)) { |
| 87 LayoutRect rect = m_layoutPart.localSelectionRect(); | 87 LayoutRect rect = m_layoutPart.localSelectionRect(); |
| 88 rect.moveBy(adjustedPaintOffset); | 88 rect.moveBy(adjustedPaintOffset); |
| 89 IntRect selectionRect = pixelSnappedIntRect(rect); | 89 IntRect selectionRect = pixelSnappedIntRect(rect); |
| 90 LayoutObjectDrawingRecorder drawingRecorder(paintInfo.context, m_layoutP
art, paintInfo.phase, selectionRect, adjustedPaintOffset); | 90 LayoutObjectDrawingRecorder drawingRecorder(paintInfo.context, m_layoutP
art, paintInfo.phase, selectionRect); |
| 91 paintInfo.context.fillRect(selectionRect, m_layoutPart.selectionBackgrou
ndColor()); | 91 paintInfo.context.fillRect(selectionRect, m_layoutPart.selectionBackgrou
ndColor()); |
| 92 } | 92 } |
| 93 | 93 |
| 94 if (m_layoutPart.canResize()) | 94 if (m_layoutPart.canResize()) |
| 95 ScrollableAreaPainter(*m_layoutPart.layer()->scrollableArea()).paintResi
zer(paintInfo.context, roundedIntPoint(adjustedPaintOffset), paintInfo.cullRect(
)); | 95 ScrollableAreaPainter(*m_layoutPart.layer()->scrollableArea()).paintResi
zer(paintInfo.context, roundedIntPoint(adjustedPaintOffset), paintInfo.cullRect(
)); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void PartPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint& p
aintOffset) | 98 void PartPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint& p
aintOffset) |
| 99 { | 99 { |
| 100 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutPart.location(); | 100 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutPart.location(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 112 // When painting widgets into compositing layers, tx and ty are relative to
the enclosing compositing layer, | 112 // When painting widgets into compositing layers, tx and ty are relative to
the enclosing compositing layer, |
| 113 // not the root. In this case, shift the CTM and adjust the CullRect to be r
oot-relative to fix plugin drawing. | 113 // not the root. In this case, shift the CTM and adjust the CullRect to be r
oot-relative to fix plugin drawing. |
| 114 TransformRecorder transform(paintInfo.context, m_layoutPart, | 114 TransformRecorder transform(paintInfo.context, m_layoutPart, |
| 115 AffineTransform::translation(widgetPaintOffset.width(), widgetPaintOffse
t.height())); | 115 AffineTransform::translation(widgetPaintOffset.width(), widgetPaintOffse
t.height())); |
| 116 | 116 |
| 117 CullRect adjustedCullRect(paintInfo.cullRect(), -widgetPaintOffset); | 117 CullRect adjustedCullRect(paintInfo.cullRect(), -widgetPaintOffset); |
| 118 widget->paint(paintInfo.context, adjustedCullRect); | 118 widget->paint(paintInfo.context, adjustedCullRect); |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace blink | 121 } // namespace blink |
| OLD | NEW |