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/BoxClipper.h" | 6 #include "core/paint/BoxClipper.h" |
7 | 7 |
8 #include "core/layout/LayoutBox.h" | 8 #include "core/layout/LayoutBox.h" |
9 #include "core/paint/PaintInfo.h" | 9 #include "core/paint/PaintInfo.h" |
10 #include "core/paint/PaintLayer.h" | 10 #include "core/paint/PaintLayer.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 LayoutRect conservativeClipRect = clipRect; | 43 LayoutRect conservativeClipRect = clipRect; |
44 if (hasBorderRadius) | 44 if (hasBorderRadius) |
45 conservativeClipRect.intersect(LayoutRect(clipRoundedRect.radiusCent
erRect())); | 45 conservativeClipRect.intersect(LayoutRect(clipRoundedRect.radiusCent
erRect())); |
46 conservativeClipRect.moveBy(-accumulatedOffset); | 46 conservativeClipRect.moveBy(-accumulatedOffset); |
47 if (m_box.hasLayer()) | 47 if (m_box.hasLayer()) |
48 conservativeClipRect.move(m_box.scrolledContentOffset()); | 48 conservativeClipRect.move(m_box.scrolledContentOffset()); |
49 if (conservativeClipRect.contains(contentsVisualOverflow)) | 49 if (conservativeClipRect.contains(contentsVisualOverflow)) |
50 return; | 50 return; |
51 } | 51 } |
52 | 52 |
53 if (!m_paintInfo.context->paintController().displayItemConstructionIsDisable
d()) { | 53 if (!m_paintInfo.context.paintController().displayItemConstructionIsDisabled
()) { |
54 m_clipType = m_paintInfo.displayItemTypeForClipping(); | 54 m_clipType = m_paintInfo.displayItemTypeForClipping(); |
55 Vector<FloatRoundedRect> roundedRects; | 55 Vector<FloatRoundedRect> roundedRects; |
56 if (hasBorderRadius) | 56 if (hasBorderRadius) |
57 roundedRects.append(clipRoundedRect); | 57 roundedRects.append(clipRoundedRect); |
58 m_paintInfo.context->paintController().createAndAppend<ClipDisplayItem>(
m_box, m_clipType, pixelSnappedIntRect(clipRect), roundedRects); | 58 m_paintInfo.context.paintController().createAndAppend<ClipDisplayItem>(m
_box, m_clipType, pixelSnappedIntRect(clipRect), roundedRects); |
59 } | 59 } |
60 } | 60 } |
61 | 61 |
62 BoxClipper::~BoxClipper() | 62 BoxClipper::~BoxClipper() |
63 { | 63 { |
64 if (m_clipType == DisplayItem::UninitializedType) | 64 if (m_clipType == DisplayItem::UninitializedType) |
65 return; | 65 return; |
66 | 66 |
67 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()-
>isSelfPaintingLayer())); | 67 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()-
>isSelfPaintingLayer())); |
68 m_paintInfo.context->paintController().endItem<EndClipDisplayItem>(m_box, Di
splayItem::clipTypeToEndClipType(m_clipType)); | 68 m_paintInfo.context.paintController().endItem<EndClipDisplayItem>(m_box, Dis
playItem::clipTypeToEndClipType(m_clipType)); |
69 } | 69 } |
70 | 70 |
71 } // namespace blink | 71 } // namespace blink |
OLD | NEW |