| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 bool completelyClippedOut = false; | 62 bool completelyClippedOut = false; |
| 63 if (m_renderReplaced.style()->hasBorderRadius()) { | 63 if (m_renderReplaced.style()->hasBorderRadius()) { |
| 64 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, m_renderReplaced
.size()); | 64 LayoutRect borderRect = LayoutRect(adjustedPaintOffset, m_renderReplaced
.size()); |
| 65 | 65 |
| 66 if (borderRect.isEmpty()) { | 66 if (borderRect.isEmpty()) { |
| 67 completelyClippedOut = true; | 67 completelyClippedOut = true; |
| 68 } else { | 68 } else { |
| 69 // Push a clip if we have a border radius, since we want to round th
e foreground content that gets painted. | 69 // Push a clip if we have a border radius, since we want to round th
e foreground content that gets painted. |
| 70 paintInfo.context->save(); | 70 paintInfo.context->save(); |
| 71 RoundedRect roundedInnerRect = m_renderReplaced.style()->getRoundedI
nnerBorderFor(paintRect, | 71 FloatRoundedRect roundedInnerRect = m_renderReplaced.style()->getRou
ndedInnerBorderFor(paintRect, |
| 72 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); | 72 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); |
| 73 BoxPainter::clipRoundedInnerRect(paintInfo.context, paintRect, round
edInnerRect); | 73 BoxPainter::clipRoundedInnerRect(paintInfo.context, paintRect, round
edInnerRect); |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 if (!completelyClippedOut) { | 77 if (!completelyClippedOut) { |
| 78 if (paintInfo.phase == PaintPhaseClippingMask) { | 78 if (paintInfo.phase == PaintPhaseClippingMask) { |
| 79 m_renderReplaced.paintClippingMask(paintInfo, adjustedPaintOffset); | 79 m_renderReplaced.paintClippingMask(paintInfo, adjustedPaintOffset); |
| 80 } else { | 80 } else { |
| 81 m_renderReplaced.paintReplaced(paintInfo, adjustedPaintOffset); | 81 m_renderReplaced.paintReplaced(paintInfo, adjustedPaintOffset); |
| 82 } | 82 } |
| 83 | 83 |
| 84 if (m_renderReplaced.style()->hasBorderRadius()) | 84 if (m_renderReplaced.style()->hasBorderRadius()) |
| 85 paintInfo.context->restore(); | 85 paintInfo.context->restore(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 // The selection tint never gets clipped by border-radius rounding, since we
want it to run right up to the edges of | 88 // The selection tint never gets clipped by border-radius rounding, since we
want it to run right up to the edges of |
| 89 // surrounding content. | 89 // surrounding content. |
| 90 if (drawSelectionTint) { | 90 if (drawSelectionTint) { |
| 91 LayoutRect selectionPaintingRect = m_renderReplaced.localSelectionRect()
; | 91 LayoutRect selectionPaintingRect = m_renderReplaced.localSelectionRect()
; |
| 92 selectionPaintingRect.moveBy(adjustedPaintOffset); | 92 selectionPaintingRect.moveBy(adjustedPaintOffset); |
| 93 paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect),
m_renderReplaced.selectionBackgroundColor()); | 93 paintInfo.context->fillRect(pixelSnappedIntRect(selectionPaintingRect),
m_renderReplaced.selectionBackgroundColor()); |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 } // namespace blink | 97 } // namespace blink |
| OLD | NEW |