| 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/paint/BoxPainter.h" | 8 #include "core/paint/BoxPainter.h" |
| 9 #include "core/paint/ObjectPainter.h" | 9 #include "core/paint/ObjectPainter.h" |
| 10 #include "core/paint/RenderDrawingRecorder.h" | 10 #include "core/paint/RenderDrawingRecorder.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 bool completelyClippedOut = false; | 59 bool completelyClippedOut = false; |
| 60 if (m_renderReplaced.style()->hasBorderRadius()) { | 60 if (m_renderReplaced.style()->hasBorderRadius()) { |
| 61 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, m_renderReplaced
.size()); | 61 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, m_renderReplaced
.size()); |
| 62 | 62 |
| 63 if (borderRect.isEmpty()) { | 63 if (borderRect.isEmpty()) { |
| 64 completelyClippedOut = true; | 64 completelyClippedOut = true; |
| 65 } else { | 65 } else { |
| 66 // Push a clip if we have a border radius, since we want to round th
e foreground content that gets painted. | 66 // Push a clip if we have a border radius, since we want to round th
e foreground content that gets painted. |
| 67 paintInfo.context->save(); | 67 paintInfo.context->save(); |
| 68 RoundedRect roundedInnerRect = m_renderReplaced.style()->getRoundedI
nnerBorderFor(paintRect, | 68 FloatRoundedRect roundedInnerRect = m_renderReplaced.style()->getRou
ndedInnerBorderFor(paintRect, |
| 69 m_renderReplaced.paddingTop() + m_renderReplaced.borderTop(), m_
renderReplaced.paddingBottom() + m_renderReplaced.borderBottom(), m_renderReplac
ed.paddingLeft() + m_renderReplaced.borderLeft(), m_renderReplaced.paddingRight(
) + m_renderReplaced.borderRight(), true, true); | 69 m_renderReplaced.paddingTop() + m_renderReplaced.borderTop(), m_
renderReplaced.paddingBottom() + m_renderReplaced.borderBottom(), m_renderReplac
ed.paddingLeft() + m_renderReplaced.borderLeft(), m_renderReplaced.paddingRight(
) + m_renderReplaced.borderRight(), true, true); |
| 70 BoxPainter::clipRoundedInnerRect(paintInfo.context, paintRect, round
edInnerRect); | 70 BoxPainter::clipRoundedInnerRect(paintInfo.context, paintRect, round
edInnerRect); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 if (!completelyClippedOut) { | 74 if (!completelyClippedOut) { |
| 75 if (paintInfo.phase == PaintPhaseClippingMask) { | 75 if (paintInfo.phase == PaintPhaseClippingMask) { |
| 76 m_renderReplaced.paintClippingMask(paintInfo, adjustedPaintOffset); | 76 m_renderReplaced.paintClippingMask(paintInfo, adjustedPaintOffset); |
| 77 } else { | 77 } else { |
| 78 m_renderReplaced.paintReplaced(paintInfo, adjustedPaintOffset); | 78 m_renderReplaced.paintReplaced(paintInfo, adjustedPaintOffset); |
| 79 } | 79 } |
| 80 | 80 |
| 81 if (m_renderReplaced.style()->hasBorderRadius()) | 81 if (m_renderReplaced.style()->hasBorderRadius()) |
| 82 paintInfo.context->restore(); | 82 paintInfo.context->restore(); |
| 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 if (drawSelectionTint) { | 87 if (drawSelectionTint) { |
| 88 LayoutRect selectionPaintingRect = m_renderReplaced.localSelectionRect()
; | 88 LayoutRect selectionPaintingRect = m_renderReplaced.localSelectionRect()
; |
| 89 selectionPaintingRect.moveBy(adjustedPaintOffset); | 89 selectionPaintingRect.moveBy(adjustedPaintOffset); |
| 90 paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect),
m_renderReplaced.selectionBackgroundColor()); | 90 paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect),
m_renderReplaced.selectionBackgroundColor()); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace blink | 94 } // namespace blink |
| OLD | NEW |