| 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/BoxPainter.h" | 6 #include "core/paint/BoxPainter.h" |
| 7 | 7 |
| 8 #include "core/HTMLNames.h" | 8 #include "core/HTMLNames.h" |
| 9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/html/HTMLFrameOwnerElement.h" | 10 #include "core/html/HTMLFrameOwnerElement.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 bounds = m_renderBox.visualOverflowRect(); | 62 bounds = m_renderBox.visualOverflowRect(); |
| 63 bounds.moveBy(paintOffset); | 63 bounds.moveBy(paintOffset); |
| 64 bounds = pixelSnappedIntRect(bounds); | 64 bounds = pixelSnappedIntRect(bounds); |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 return bounds; | 67 return bounds; |
| 68 } | 68 } |
| 69 | 69 |
| 70 void BoxPainter::paintBoxDecorationBackgroundWithRect(const PaintInfo& paintInfo
, const LayoutPoint& paintOffset, const LayoutRect& paintRect) | 70 void BoxPainter::paintBoxDecorationBackgroundWithRect(const PaintInfo& paintInfo
, const LayoutPoint& paintOffset, const LayoutRect& paintRect) |
| 71 { | 71 { |
| 72 RenderDrawingRecorder recorder(paintInfo.context, m_renderBox, paintInfo.pha
se, boundsForDrawingRecorder(paintOffset)); |
| 73 if (recorder.canUseCachedDrawing()) |
| 74 return; |
| 75 |
| 72 RenderStyle* style = m_renderBox.style(); | 76 RenderStyle* style = m_renderBox.style(); |
| 73 BoxDecorationData boxDecorationData(*style, m_renderBox.canRenderBorderImage
(), m_renderBox.backgroundHasOpaqueTopLayer(), m_renderBox.backgroundShouldAlway
sBeClipped(), paintInfo.context); | 77 BoxDecorationData boxDecorationData(*style, m_renderBox.canRenderBorderImage
(), m_renderBox.backgroundHasOpaqueTopLayer(), m_renderBox.backgroundShouldAlway
sBeClipped(), paintInfo.context); |
| 74 | 78 |
| 75 RenderDrawingRecorder recorder(paintInfo.context, &m_renderBox, paintInfo.ph
ase, boundsForDrawingRecorder(paintOffset)); | |
| 76 | |
| 77 // FIXME: Should eventually give the theme control over whether the box shad
ow should paint, since controls could have | 79 // FIXME: Should eventually give the theme control over whether the box shad
ow should paint, since controls could have |
| 78 // custom shadows of their own. | 80 // custom shadows of their own. |
| 79 if (!m_renderBox.boxShadowShouldBeAppliedToBackground(boxDecorationData.blee
dAvoidance())) | 81 if (!m_renderBox.boxShadowShouldBeAppliedToBackground(boxDecorationData.blee
dAvoidance())) |
| 80 paintBoxShadow(paintInfo, paintRect, style, Normal); | 82 paintBoxShadow(paintInfo, paintRect, style, Normal); |
| 81 | 83 |
| 82 GraphicsContextStateSaver stateSaver(*paintInfo.context, false); | 84 GraphicsContextStateSaver stateSaver(*paintInfo.context, false); |
| 83 if (boxDecorationData.bleedAvoidance() == BackgroundBleedClipBackground) { | 85 if (boxDecorationData.bleedAvoidance() == BackgroundBleedClipBackground) { |
| 84 stateSaver.save(); | 86 stateSaver.save(); |
| 85 RoundedRect border = style->getRoundedBorderFor(paintRect); | 87 RoundedRect border = style->getRoundedBorderFor(paintRect); |
| 86 paintInfo.context->clipRoundedRect(border); | 88 paintInfo.context->clipRoundedRect(border); |
| (...skipping 2084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2171 | 2173 |
| 2172 FloatPoint secondQuad[4]; | 2174 FloatPoint secondQuad[4]; |
| 2173 secondQuad[0] = quad[0]; | 2175 secondQuad[0] = quad[0]; |
| 2174 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); | 2176 secondQuad[1] = FloatPoint(quad[0].x() - r1 * cx, quad[0].y() - r1 * cy); |
| 2175 secondQuad[2] = quad[2]; | 2177 secondQuad[2] = quad[2]; |
| 2176 secondQuad[3] = quad[3]; | 2178 secondQuad[3] = quad[3]; |
| 2177 graphicsContext->clipPolygon(4, secondQuad, !secondEdgeMatches); | 2179 graphicsContext->clipPolygon(4, secondQuad, !secondEdgeMatches); |
| 2178 } | 2180 } |
| 2179 | 2181 |
| 2180 } // namespace blink | 2182 } // namespace blink |
| OLD | NEW |