| 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" |
| 11 #include "core/paint/LayoutObjectDrawingRecorder.h" | 11 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 12 #include "core/paint/ObjectPainter.h" | 12 #include "core/paint/ObjectPainter.h" |
| 13 #include "core/paint/PaintInfo.h" | 13 #include "core/paint/PaintInfo.h" |
| 14 #include "core/paint/PaintLayer.h" | 14 #include "core/paint/PaintLayer.h" |
| 15 #include "core/paint/RoundedInnerRectClipper.h" | 15 #include "core/paint/RoundedInnerRectClipper.h" |
| 16 #include "wtf/Optional.h" | 16 #include "wtf/Optional.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 static bool shouldApplyViewportClip(const LayoutReplaced& layoutReplaced) { | 20 static bool shouldApplyViewportClip(const LayoutReplaced& layoutReplaced) { |
| 21 return !layoutReplaced.isSVGRoot() || | 21 return !layoutReplaced.isSVGRoot() || |
| 22 toLayoutSVGRoot(&layoutReplaced)->shouldApplyViewportClip(); | 22 toLayoutSVGRoot(&layoutReplaced)->shouldApplyViewportClip(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void ReplacedPainter::paint(const PaintInfo& paintInfo, | 25 void ReplacedPainter::paint(const PaintInfo& paintInfo, |
| 26 const LayoutPoint& paintOffset) { | 26 const LayoutPoint& paintOffset) { |
| 27 ObjectPainter(m_layoutReplaced).checkPaintOffset(paintInfo, paintOffset); |
| 27 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutReplaced.location(); | 28 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutReplaced.location(); |
| 29 |
| 28 if (!shouldPaint(paintInfo, adjustedPaintOffset)) | 30 if (!shouldPaint(paintInfo, adjustedPaintOffset)) |
| 29 return; | 31 return; |
| 30 | 32 |
| 31 LayoutRect borderRect(adjustedPaintOffset, m_layoutReplaced.size()); | 33 LayoutRect borderRect(adjustedPaintOffset, m_layoutReplaced.size()); |
| 32 | 34 |
| 33 if (m_layoutReplaced.style()->visibility() == EVisibility::Visible && | 35 if (m_layoutReplaced.style()->visibility() == EVisibility::Visible && |
| 34 m_layoutReplaced.hasBoxDecorationBackground() && | 36 m_layoutReplaced.hasBoxDecorationBackground() && |
| 35 (paintInfo.phase == PaintPhaseForeground || | 37 (paintInfo.phase == PaintPhaseForeground || |
| 36 paintInfo.phase == PaintPhaseSelection)) | 38 paintInfo.phase == PaintPhaseSelection)) |
| 37 m_layoutReplaced.paintBoxDecorationBackground(paintInfo, | 39 m_layoutReplaced.paintBoxDecorationBackground(paintInfo, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 paintRect.unite(m_layoutReplaced.localSelectionRect()); | 145 paintRect.unite(m_layoutReplaced.localSelectionRect()); |
| 144 paintRect.moveBy(adjustedPaintOffset); | 146 paintRect.moveBy(adjustedPaintOffset); |
| 145 | 147 |
| 146 if (!paintInfo.cullRect().intersectsCullRect(paintRect)) | 148 if (!paintInfo.cullRect().intersectsCullRect(paintRect)) |
| 147 return false; | 149 return false; |
| 148 | 150 |
| 149 return true; | 151 return true; |
| 150 } | 152 } |
| 151 | 153 |
| 152 } // namespace blink | 154 } // namespace blink |
| OLD | NEW |