| 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/rendering/RenderBoxClipper.h" | 6 #include "core/paint/BoxClipper.h" |
| 7 | 7 |
| 8 #include "core/rendering/PaintInfo.h" | 8 #include "core/rendering/PaintInfo.h" |
| 9 #include "core/rendering/RenderBox.h" | 9 #include "core/rendering/RenderBox.h" |
| 10 #include "core/rendering/RenderLayer.h" | 10 #include "core/rendering/RenderLayer.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 RenderBoxClipper::RenderBoxClipper(RenderBox& box, PaintInfo& paintInfo, const L
ayoutPoint& accumulatedOffset, ContentsClipBehavior contentsClipBehavior) | 14 BoxClipper::BoxClipper(RenderBox& box, PaintInfo& paintInfo, const LayoutPoint&
accumulatedOffset, ContentsClipBehavior contentsClipBehavior) |
| 15 : m_pushedClip(false) | 15 : m_pushedClip(false) |
| 16 , m_accumulatedOffset(accumulatedOffset) | 16 , m_accumulatedOffset(accumulatedOffset) |
| 17 , m_paintInfo(paintInfo) | 17 , m_paintInfo(paintInfo) |
| 18 , m_originalPhase(paintInfo.phase) | 18 , m_originalPhase(paintInfo.phase) |
| 19 , m_box(box) | 19 , m_box(box) |
| 20 { | 20 { |
| 21 if (m_paintInfo.phase == PaintPhaseBlockBackground || m_paintInfo.phase == P
aintPhaseSelfOutline || m_paintInfo.phase == PaintPhaseMask) | 21 if (m_paintInfo.phase == PaintPhaseBlockBackground || m_paintInfo.phase == P
aintPhaseSelfOutline || m_paintInfo.phase == PaintPhaseMask) |
| 22 return; | 22 return; |
| 23 | 23 |
| 24 bool isControlClip = m_box.hasControlClip(); | 24 bool isControlClip = m_box.hasControlClip(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 55 m_box.paintObject(m_paintInfo, m_accumulatedOffset); | 55 m_box.paintObject(m_paintInfo, m_accumulatedOffset); |
| 56 m_paintInfo.phase = PaintPhaseChildBlockBackgrounds; | 56 m_paintInfo.phase = PaintPhaseChildBlockBackgrounds; |
| 57 } | 57 } |
| 58 m_paintInfo.context->save(); | 58 m_paintInfo.context->save(); |
| 59 if (hasBorderRadius) | 59 if (hasBorderRadius) |
| 60 m_paintInfo.context->clipRoundedRect(clipRoundedRect); | 60 m_paintInfo.context->clipRoundedRect(clipRoundedRect); |
| 61 m_paintInfo.context->clip(pixelSnappedIntRect(clipRect)); | 61 m_paintInfo.context->clip(pixelSnappedIntRect(clipRect)); |
| 62 m_pushedClip = true; | 62 m_pushedClip = true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 RenderBoxClipper::~RenderBoxClipper() | 65 BoxClipper::~BoxClipper() |
| 66 { | 66 { |
| 67 if (!m_pushedClip) | 67 if (!m_pushedClip) |
| 68 return; | 68 return; |
| 69 | 69 |
| 70 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()-
>isSelfPaintingLayer())); | 70 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()-
>isSelfPaintingLayer())); |
| 71 | 71 |
| 72 m_paintInfo.context->restore(); | 72 m_paintInfo.context->restore(); |
| 73 if (m_originalPhase == PaintPhaseOutline) { | 73 if (m_originalPhase == PaintPhaseOutline) { |
| 74 m_paintInfo.phase = PaintPhaseSelfOutline; | 74 m_paintInfo.phase = PaintPhaseSelfOutline; |
| 75 m_box.paintObject(m_paintInfo, m_accumulatedOffset); | 75 m_box.paintObject(m_paintInfo, m_accumulatedOffset); |
| 76 m_paintInfo.phase = m_originalPhase; | 76 m_paintInfo.phase = m_originalPhase; |
| 77 } else if (m_originalPhase == PaintPhaseChildBlockBackground) { | 77 } else if (m_originalPhase == PaintPhaseChildBlockBackground) { |
| 78 m_paintInfo.phase = m_originalPhase; | 78 m_paintInfo.phase = m_originalPhase; |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace blink | 82 } // namespace blink |
| OLD | NEW |