| 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/ObjectPainter.h" | 10 #include "core/paint/ObjectPainter.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 return; | 62 return; |
| 63 } | 63 } |
| 64 | 64 |
| 65 if (shouldPaintSelfOutline(paintInfo.phase)) | 65 if (shouldPaintSelfOutline(paintInfo.phase)) |
| 66 ObjectPainter(m_layoutPart).paintOutline(paintInfo, adjustedPaintOffset); | 66 ObjectPainter(m_layoutPart).paintOutline(paintInfo, adjustedPaintOffset); |
| 67 | 67 |
| 68 if (paintInfo.phase != PaintPhaseForeground) | 68 if (paintInfo.phase != PaintPhaseForeground) |
| 69 return; | 69 return; |
| 70 | 70 |
| 71 if (m_layoutPart.widget()) { | 71 if (m_layoutPart.widget()) { |
| 72 // TODO(schenney) crbug.com/93805 Speculative release assert to verify that
the crashes | 72 // TODO(schenney) crbug.com/93805 Speculative release assert to verify that |
| 73 // we see in widget painting are due to a destroyed LayoutPart object. | 73 // the crashes we see in widget painting are due to a destroyed LayoutPart |
| 74 // object. |
| 74 RELEASE_ASSERT(m_layoutPart.node()); | 75 RELEASE_ASSERT(m_layoutPart.node()); |
| 75 Optional<RoundedInnerRectClipper> clipper; | 76 Optional<RoundedInnerRectClipper> clipper; |
| 76 if (m_layoutPart.style()->hasBorderRadius()) { | 77 if (m_layoutPart.style()->hasBorderRadius()) { |
| 77 if (borderRect.isEmpty()) | 78 if (borderRect.isEmpty()) |
| 78 return; | 79 return; |
| 79 | 80 |
| 80 FloatRoundedRect roundedInnerRect = | 81 FloatRoundedRect roundedInnerRect = |
| 81 m_layoutPart.style()->getRoundedInnerBorderFor( | 82 m_layoutPart.style()->getRoundedInnerBorderFor( |
| 82 borderRect, | 83 borderRect, |
| 83 LayoutRectOutsets( | 84 LayoutRectOutsets( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 void PartPainter::paintContents(const PaintInfo& paintInfo, | 116 void PartPainter::paintContents(const PaintInfo& paintInfo, |
| 116 const LayoutPoint& paintOffset) { | 117 const LayoutPoint& paintOffset) { |
| 117 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutPart.location(); | 118 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutPart.location(); |
| 118 | 119 |
| 119 Widget* widget = m_layoutPart.widget(); | 120 Widget* widget = m_layoutPart.widget(); |
| 120 RELEASE_ASSERT(widget); | 121 RELEASE_ASSERT(widget); |
| 121 | 122 |
| 122 IntPoint paintLocation(roundedIntPoint( | 123 IntPoint paintLocation(roundedIntPoint( |
| 123 adjustedPaintOffset + m_layoutPart.replacedContentRect().location())); | 124 adjustedPaintOffset + m_layoutPart.replacedContentRect().location())); |
| 124 | 125 |
| 125 // Widgets don't support painting with a paint offset, but instead offset them
selves using the | 126 // Widgets don't support painting with a paint offset, but instead offset |
| 126 // frame rect location. To paint widgets at our desired location, we need to a
pply paint offset | 127 // themselves using the frame rect location. To paint widgets at our desired |
| 127 // as a transform, with the frame rect neutralized. | 128 // location, we need to apply paint offset as a transform, with the frame rect |
| 129 // neutralized. |
| 128 IntSize widgetPaintOffset = paintLocation - widget->frameRect().location(); | 130 IntSize widgetPaintOffset = paintLocation - widget->frameRect().location(); |
| 129 TransformRecorder transform( | 131 TransformRecorder transform( |
| 130 paintInfo.context, m_layoutPart, | 132 paintInfo.context, m_layoutPart, |
| 131 AffineTransform::translation(widgetPaintOffset.width(), | 133 AffineTransform::translation(widgetPaintOffset.width(), |
| 132 widgetPaintOffset.height())); | 134 widgetPaintOffset.height())); |
| 133 CullRect adjustedCullRect(paintInfo.cullRect(), -widgetPaintOffset); | 135 CullRect adjustedCullRect(paintInfo.cullRect(), -widgetPaintOffset); |
| 134 widget->paint(paintInfo.context, adjustedCullRect); | 136 widget->paint(paintInfo.context, adjustedCullRect); |
| 135 } | 137 } |
| 136 | 138 |
| 137 } // namespace blink | 139 } // namespace blink |
| OLD | NEW |