| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 if (conservativeClipRect.contains(contentsVisualOverflow)) | 51 if (conservativeClipRect.contains(contentsVisualOverflow)) |
| 52 return; | 52 return; |
| 53 } | 53 } |
| 54 | 54 |
| 55 OwnPtr<Vector<FloatRoundedRect>> roundedRects; | 55 OwnPtr<Vector<FloatRoundedRect>> roundedRects; |
| 56 if (hasBorderRadius) { | 56 if (hasBorderRadius) { |
| 57 roundedRects = adoptPtr(new Vector<FloatRoundedRect>()); | 57 roundedRects = adoptPtr(new Vector<FloatRoundedRect>()); |
| 58 roundedRects->append(clipRoundedRect); | 58 roundedRects->append(clipRoundedRect); |
| 59 } | 59 } |
| 60 | 60 |
| 61 OwnPtr<ClipDisplayItem> clipDisplayItem = ClipDisplayItem::create(m_box, m_c
lipType, pixelSnappedIntRect(clipRect), roundedRects.release()); | 61 ALLOW_UNUSED_LOCAL(m_clipType); |
| 62 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 62 //OwnPtr<ClipDisplayItem> clipDisplayItem = ClipDisplayItem::create(m_box, m
_clipType, pixelSnappedIntRect(clipRect), roundedRects.release()); |
| 63 m_clipType = m_paintInfo.displayItemTypeForClipping(); | 63 //if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
| 64 ASSERT(m_paintInfo.context->displayItemList()); | 64 // m_clipType = m_paintInfo.displayItemTypeForClipping(); |
| 65 if (!m_paintInfo.context->displayItemList()->displayItemConstructionIsDi
sabled()) | 65 // ASSERT(m_paintInfo.context->displayItemList()); |
| 66 m_paintInfo.context->displayItemList()->add(clipDisplayItem.release(
)); | 66 // if (!m_paintInfo.context->displayItemList()->displayItemConstructionIs
Disabled()) |
| 67 } else { | 67 // m_paintInfo.context->displayItemList()->add(clipDisplayItem.releas
e()); |
| 68 clipDisplayItem->replay(*paintInfo.context); | 68 //} else { |
| 69 } | 69 // clipDisplayItem->replay(*paintInfo.context); |
| 70 //} |
| 70 | 71 |
| 71 m_pushedClip = true; | 72 m_pushedClip = true; |
| 72 } | 73 } |
| 73 | 74 |
| 74 BoxClipper::~BoxClipper() | 75 BoxClipper::~BoxClipper() |
| 75 { | 76 { |
| 76 if (!m_pushedClip) | 77 if (!m_pushedClip) |
| 77 return; | 78 return; |
| 78 | 79 |
| 79 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()-
>isSelfPaintingLayer())); | 80 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()-
>isSelfPaintingLayer())); |
| 80 | 81 |
| 81 DisplayItem::Type endType = DisplayItem::clipTypeToEndClipType(m_clipType); | 82 //DisplayItem::Type endType = DisplayItem::clipTypeToEndClipType(m_clipType)
; |
| 82 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 83 //if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
| 83 ASSERT(m_paintInfo.context->displayItemList()); | 84 // ASSERT(m_paintInfo.context->displayItemList()); |
| 84 if (!m_paintInfo.context->displayItemList()->displayItemConstructionIsDi
sabled()) { | 85 // if (!m_paintInfo.context->displayItemList()->displayItemConstructionIs
Disabled()) { |
| 85 if (m_paintInfo.context->displayItemList()->lastDisplayItemIsNoopBeg
in()) | 86 // if (m_paintInfo.context->displayItemList()->lastDisplayItemIsNoopB
egin()) |
| 86 m_paintInfo.context->displayItemList()->removeLastDisplayItem(); | 87 // m_paintInfo.context->displayItemList()->removeLastDisplayItem(
); |
| 87 else | 88 // else |
| 88 m_paintInfo.context->displayItemList()->add(EndClipDisplayItem::
create(m_box, endType)); | 89 // m_paintInfo.context->displayItemList()->add(EndClipDisplayItem
::create(m_box, endType)); |
| 89 } | 90 // } |
| 90 } else { | 91 //} else { |
| 91 EndClipDisplayItem endClipDisplayItem(m_box, endType); | 92 // EndClipDisplayItem endClipDisplayItem(m_box, endType); |
| 92 endClipDisplayItem.replay(*m_paintInfo.context); | 93 // endClipDisplayItem.replay(*m_paintInfo.context); |
| 93 } | 94 //} |
| 94 } | 95 } |
| 95 | 96 |
| 96 } // namespace blink | 97 } // namespace blink |
| OLD | NEW |