| 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/DeprecatedPaintLayer.h" | 9 #include "core/paint/DeprecatedPaintLayer.h" |
| 10 #include "core/paint/PaintInfo.h" | 10 #include "core/paint/PaintInfo.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 53 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
| 54 ASSERT(m_paintInfo.context->displayItemList()); | 54 ASSERT(m_paintInfo.context->displayItemList()); |
| 55 if (!m_paintInfo.context->displayItemList()->displayItemConstructionIsDi
sabled()) { | 55 if (!m_paintInfo.context->displayItemList()->displayItemConstructionIsDi
sabled()) { |
| 56 m_clipType = m_paintInfo.displayItemTypeForClipping(); | 56 m_clipType = m_paintInfo.displayItemTypeForClipping(); |
| 57 OwnPtr<Vector<FloatRoundedRect>> roundedRects; | 57 OwnPtr<Vector<FloatRoundedRect>> roundedRects; |
| 58 if (hasBorderRadius) { | 58 if (hasBorderRadius) { |
| 59 roundedRects = adoptPtr(new Vector<FloatRoundedRect>()); | 59 roundedRects = adoptPtr(new Vector<FloatRoundedRect>()); |
| 60 roundedRects->append(clipRoundedRect); | 60 roundedRects->append(clipRoundedRect); |
| 61 } | 61 } |
| 62 OwnPtr<ClipDisplayItem> clipDisplayItem = ClipDisplayItem::create(m_
box, m_clipType, pixelSnappedIntRect(clipRect), roundedRects.release()); | 62 m_paintInfo.context->displayItemList()->createAndAppend<ClipDisplayI
tem>(m_box, m_clipType, pixelSnappedIntRect(clipRect), roundedRects.release()); |
| 63 m_paintInfo.context->displayItemList()->add(clipDisplayItem.release(
)); | |
| 64 } | 63 } |
| 65 } else { | 64 } else { |
| 66 m_clipType = m_paintInfo.displayItemTypeForClipping(); | 65 m_clipType = m_paintInfo.displayItemTypeForClipping(); |
| 67 OwnPtr<Vector<FloatRoundedRect>> roundedRects; | 66 OwnPtr<Vector<FloatRoundedRect>> roundedRects; |
| 68 if (hasBorderRadius) { | 67 if (hasBorderRadius) { |
| 69 roundedRects = adoptPtr(new Vector<FloatRoundedRect>()); | 68 roundedRects = adoptPtr(new Vector<FloatRoundedRect>()); |
| 70 roundedRects->append(clipRoundedRect); | 69 roundedRects->append(clipRoundedRect); |
| 71 } | 70 } |
| 72 OwnPtr<ClipDisplayItem> clipDisplayItem = ClipDisplayItem::create(m_box,
m_clipType, pixelSnappedIntRect(clipRect), roundedRects.release()); | 71 ClipDisplayItem clipDisplayItem(m_box, m_clipType, pixelSnappedIntRect(c
lipRect), roundedRects.release()); |
| 73 clipDisplayItem->replay(*paintInfo.context); | 72 clipDisplayItem.replay(*paintInfo.context); |
| 74 } | 73 } |
| 75 } | 74 } |
| 76 | 75 |
| 77 BoxClipper::~BoxClipper() | 76 BoxClipper::~BoxClipper() |
| 78 { | 77 { |
| 79 if (m_clipType == DisplayItem::UninitializedType) | 78 if (m_clipType == DisplayItem::UninitializedType) |
| 80 return; | 79 return; |
| 81 | 80 |
| 82 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()-
>isSelfPaintingLayer())); | 81 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()-
>isSelfPaintingLayer())); |
| 83 | 82 |
| 84 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 83 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
| 85 ASSERT(m_paintInfo.context->displayItemList()); | 84 ASSERT(m_paintInfo.context->displayItemList()); |
| 86 if (!m_paintInfo.context->displayItemList()->displayItemConstructionIsDi
sabled()) { | 85 if (!m_paintInfo.context->displayItemList()->displayItemConstructionIsDi
sabled()) { |
| 87 if (m_paintInfo.context->displayItemList()->lastDisplayItemIsNoopBeg
in()) | 86 if (m_paintInfo.context->displayItemList()->lastDisplayItemIsNoopBeg
in()) |
| 88 m_paintInfo.context->displayItemList()->removeLastDisplayItem(); | 87 m_paintInfo.context->displayItemList()->removeLastDisplayItem(); |
| 89 else | 88 else |
| 90 m_paintInfo.context->displayItemList()->add(EndClipDisplayItem::
create(m_box, DisplayItem::clipTypeToEndClipType(m_clipType))); | 89 m_paintInfo.context->displayItemList()->createAndAppend<EndClipD
isplayItem>(m_box, DisplayItem::clipTypeToEndClipType(m_clipType)); |
| 91 } | 90 } |
| 92 } else { | 91 } else { |
| 93 EndClipDisplayItem endClipDisplayItem(m_box, DisplayItem::clipTypeToEndC
lipType(m_clipType)); | 92 EndClipDisplayItem endClipDisplayItem(m_box, DisplayItem::clipTypeToEndC
lipType(m_clipType)); |
| 94 endClipDisplayItem.replay(*m_paintInfo.context); | 93 endClipDisplayItem.replay(*m_paintInfo.context); |
| 95 } | 94 } |
| 96 } | 95 } |
| 97 | 96 |
| 98 } // namespace blink | 97 } // namespace blink |
| OLD | NEW |