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/paint/ClipRecorder.h" | 8 #include "core/paint/ClipRecorder.h" |
9 #include "core/paint/ViewDisplayList.h" | 9 #include "core/paint/ViewDisplayList.h" |
10 #include "core/rendering/PaintInfo.h" | 10 #include "core/rendering/PaintInfo.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 if (hasBorderRadius) | 45 if (hasBorderRadius) |
46 conservativeClipRect.intersect(clipRoundedRect.radiusCenterRect()); | 46 conservativeClipRect.intersect(clipRoundedRect.radiusCenterRect()); |
47 conservativeClipRect.moveBy(-m_accumulatedOffset); | 47 conservativeClipRect.moveBy(-m_accumulatedOffset); |
48 if (m_box.hasLayer()) | 48 if (m_box.hasLayer()) |
49 conservativeClipRect.move(m_box.scrolledContentOffset()); | 49 conservativeClipRect.move(m_box.scrolledContentOffset()); |
50 if (conservativeClipRect.contains(contentsVisualOverflow)) | 50 if (conservativeClipRect.contains(contentsVisualOverflow)) |
51 return; | 51 return; |
52 } | 52 } |
53 | 53 |
54 DisplayItem::Type clipType = DisplayItem::ClipBoxForeground; | 54 DisplayItem::Type clipType = DisplayItem::ClipBoxForeground; |
55 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | 55 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
56 clipType = ClipRecorder::paintPhaseToClipType(m_paintInfo.phase); | 56 switch (m_paintInfo.phase) { |
| 57 case PaintPhaseChildBlockBackgrounds: |
| 58 clipType = DisplayItem::ClipBoxChildBlockBackgrounds; |
| 59 break; |
| 60 case PaintPhaseFloat: |
| 61 clipType = DisplayItem::ClipBoxFloat; |
| 62 break; |
| 63 case PaintPhaseForeground: |
| 64 clipType = DisplayItem::ClipBoxChildBlockBackgrounds; |
| 65 break; |
| 66 case PaintPhaseChildOutlines: |
| 67 clipType = DisplayItem::ClipBoxChildOutlines; |
| 68 break; |
| 69 case PaintPhaseSelection: |
| 70 clipType = DisplayItem::ClipBoxSelection; |
| 71 break; |
| 72 case PaintPhaseCollapsedTableBorders: |
| 73 clipType = DisplayItem::ClipBoxCollapsedTableBorders; |
| 74 break; |
| 75 case PaintPhaseTextClip: |
| 76 clipType = DisplayItem::ClipBoxTextClip; |
| 77 break; |
| 78 case PaintPhaseClippingMask: |
| 79 clipType = DisplayItem::ClipBoxClippingMask; |
| 80 break; |
| 81 case PaintPhaseChildBlockBackground: |
| 82 case PaintPhaseOutline: |
| 83 case PaintPhaseBlockBackground: |
| 84 case PaintPhaseSelfOutline: |
| 85 case PaintPhaseMask: |
| 86 ASSERT_NOT_REACHED(); |
| 87 } |
| 88 } |
57 | 89 |
58 OwnPtr<ClipDisplayItem> clipDisplayItem = adoptPtr(new ClipDisplayItem(&m_bo
x, clipType, pixelSnappedIntRect(clipRect))); | 90 OwnPtr<ClipDisplayItem> clipDisplayItem = adoptPtr(new ClipDisplayItem(&m_bo
x, clipType, pixelSnappedIntRect(clipRect))); |
59 if (hasBorderRadius) | 91 if (hasBorderRadius) |
60 clipDisplayItem->roundedRectClips().append(clipRoundedRect); | 92 clipDisplayItem->roundedRectClips().append(clipRoundedRect); |
61 | 93 |
62 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | 94 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) |
63 m_box.view()->viewDisplayList().add(clipDisplayItem.release()); | 95 m_box.view()->viewDisplayList().add(clipDisplayItem.release()); |
64 else | 96 else |
65 clipDisplayItem->replay(paintInfo.context); | 97 clipDisplayItem->replay(paintInfo.context); |
66 | 98 |
(...skipping 10 matching lines...) Expand all Loading... |
77 OwnPtr<EndClipDisplayItem> endClipDisplayItem = adoptPtr(new EndClipDisplayI
tem(&m_box)); | 109 OwnPtr<EndClipDisplayItem> endClipDisplayItem = adoptPtr(new EndClipDisplayI
tem(&m_box)); |
78 | 110 |
79 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 111 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
80 m_box.view()->viewDisplayList().add(endClipDisplayItem.release()); | 112 m_box.view()->viewDisplayList().add(endClipDisplayItem.release()); |
81 } else { | 113 } else { |
82 endClipDisplayItem->replay(m_paintInfo.context); | 114 endClipDisplayItem->replay(m_paintInfo.context); |
83 } | 115 } |
84 } | 116 } |
85 | 117 |
86 } // namespace blink | 118 } // namespace blink |
OLD | NEW |