| 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" |
| 11 #include "platform/RuntimeEnabledFeatures.h" | 11 #include "platform/RuntimeEnabledFeatures.h" |
| 12 #include "platform/graphics/GraphicsLayer.h" | 12 #include "platform/graphics/GraphicsLayer.h" |
| 13 #include "platform/graphics/paint/ClipDisplayItem.h" | 13 #include "platform/graphics/paint/ClipDisplayItem.h" |
| 14 #include "platform/graphics/paint/DisplayItemList.h" | 14 #include "platform/graphics/paint/PaintController.h" |
| 15 | 15 |
| 16 namespace blink { | 16 namespace blink { |
| 17 | 17 |
| 18 BoxClipper::BoxClipper(const LayoutBox& box, const PaintInfo& paintInfo, const L
ayoutPoint& accumulatedOffset, ContentsClipBehavior contentsClipBehavior) | 18 BoxClipper::BoxClipper(const LayoutBox& box, const PaintInfo& paintInfo, const L
ayoutPoint& accumulatedOffset, ContentsClipBehavior contentsClipBehavior) |
| 19 : m_box(box) | 19 : m_box(box) |
| 20 , m_paintInfo(paintInfo) | 20 , m_paintInfo(paintInfo) |
| 21 , m_clipType(DisplayItem::UninitializedType) | 21 , m_clipType(DisplayItem::UninitializedType) |
| 22 { | 22 { |
| 23 if (m_paintInfo.phase == PaintPhaseBlockBackground || m_paintInfo.phase == P
aintPhaseSelfOutline || m_paintInfo.phase == PaintPhaseMask) | 23 if (m_paintInfo.phase == PaintPhaseBlockBackground || m_paintInfo.phase == P
aintPhaseSelfOutline || m_paintInfo.phase == PaintPhaseMask) |
| 24 return; | 24 return; |
| (...skipping 18 matching lines...) Expand all 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 ASSERT(m_paintInfo.context->displayItemList()); | 53 ASSERT(m_paintInfo.context->paintController()); |
| 54 if (!m_paintInfo.context->displayItemList()->displayItemConstructionIsDisabl
ed()) { | 54 if (!m_paintInfo.context->paintController()->displayItemConstructionIsDisabl
ed()) { |
| 55 m_clipType = m_paintInfo.displayItemTypeForClipping(); | 55 m_clipType = m_paintInfo.displayItemTypeForClipping(); |
| 56 Vector<FloatRoundedRect> roundedRects; | 56 Vector<FloatRoundedRect> roundedRects; |
| 57 if (hasBorderRadius) | 57 if (hasBorderRadius) |
| 58 roundedRects.append(clipRoundedRect); | 58 roundedRects.append(clipRoundedRect); |
| 59 m_paintInfo.context->displayItemList()->createAndAppend<ClipDisplayItem>
(m_box, m_clipType, pixelSnappedIntRect(clipRect), roundedRects); | 59 m_paintInfo.context->paintController()->createAndAppend<ClipDisplayItem>
(m_box, m_clipType, pixelSnappedIntRect(clipRect), roundedRects); |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 BoxClipper::~BoxClipper() | 63 BoxClipper::~BoxClipper() |
| 64 { | 64 { |
| 65 if (m_clipType == DisplayItem::UninitializedType) | 65 if (m_clipType == DisplayItem::UninitializedType) |
| 66 return; | 66 return; |
| 67 | 67 |
| 68 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()-
>isSelfPaintingLayer())); | 68 ASSERT(m_box.hasControlClip() || (m_box.hasOverflowClip() && !m_box.layer()-
>isSelfPaintingLayer())); |
| 69 ASSERT(m_paintInfo.context->displayItemList()); | 69 ASSERT(m_paintInfo.context->paintController()); |
| 70 m_paintInfo.context->displayItemList()->endItem<EndClipDisplayItem>(m_box, D
isplayItem::clipTypeToEndClipType(m_clipType)); | 70 m_paintInfo.context->paintController()->endItem<EndClipDisplayItem>(m_box, D
isplayItem::clipTypeToEndClipType(m_clipType)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 } // namespace blink | 73 } // namespace blink |
| OLD | NEW |