| 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(); |
| 28 if (!shouldPaint(paintInfo, adjustedPaintOffset)) | 29 if (!shouldPaint(paintInfo, adjustedPaintOffset)) |
| 29 return; | 30 return; |
| 30 | 31 |
| 31 LayoutRect borderRect(adjustedPaintOffset, m_layoutReplaced.size()); | 32 LayoutRect borderRect(adjustedPaintOffset, m_layoutReplaced.size()); |
| 32 | 33 |
| 33 if (m_layoutReplaced.style()->visibility() == EVisibility::Visible && | 34 if (m_layoutReplaced.style()->visibility() == EVisibility::Visible && |
| 34 m_layoutReplaced.hasBoxDecorationBackground() && | 35 m_layoutReplaced.hasBoxDecorationBackground() && |
| 35 (paintInfo.phase == PaintPhaseForeground || | 36 (paintInfo.phase == PaintPhaseForeground || |
| 36 paintInfo.phase == PaintPhaseSelection)) | 37 paintInfo.phase == PaintPhaseSelection)) |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 paintRect.unite(m_layoutReplaced.localSelectionRect()); | 144 paintRect.unite(m_layoutReplaced.localSelectionRect()); |
| 144 paintRect.moveBy(adjustedPaintOffset); | 145 paintRect.moveBy(adjustedPaintOffset); |
| 145 | 146 |
| 146 if (!paintInfo.cullRect().intersectsCullRect(paintRect)) | 147 if (!paintInfo.cullRect().intersectsCullRect(paintRect)) |
| 147 return false; | 148 return false; |
| 148 | 149 |
| 149 return true; | 150 return true; |
| 150 } | 151 } |
| 151 | 152 |
| 152 } // namespace blink | 153 } // namespace blink |
| OLD | NEW |