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 switch (m_paintInfo.phase) { | 56 clipType = ClipRecorder::paintPhaseToClipType(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 } | |
89 | 57 |
90 OwnPtr<ClipDisplayItem> clipDisplayItem = adoptPtr(new ClipDisplayItem(&m_bo
x, clipType, pixelSnappedIntRect(clipRect))); | 58 OwnPtr<ClipDisplayItem> clipDisplayItem = adoptPtr(new ClipDisplayItem(&m_bo
x, clipType, pixelSnappedIntRect(clipRect))); |
91 if (hasBorderRadius) | 59 if (hasBorderRadius) |
92 clipDisplayItem->roundedRectClips().append(clipRoundedRect); | 60 clipDisplayItem->roundedRectClips().append(clipRoundedRect); |
93 | 61 |
94 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) | 62 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) |
95 m_box.view()->viewDisplayList().add(clipDisplayItem.release()); | 63 m_box.view()->viewDisplayList().add(clipDisplayItem.release()); |
96 else | 64 else |
97 clipDisplayItem->replay(paintInfo.context); | 65 clipDisplayItem->replay(paintInfo.context); |
98 | 66 |
(...skipping 10 matching lines...) Expand all Loading... |
109 OwnPtr<EndClipDisplayItem> endClipDisplayItem = adoptPtr(new EndClipDisplayI
tem(&m_box)); | 77 OwnPtr<EndClipDisplayItem> endClipDisplayItem = adoptPtr(new EndClipDisplayI
tem(&m_box)); |
110 | 78 |
111 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { | 79 if (RuntimeEnabledFeatures::slimmingPaintEnabled()) { |
112 m_box.view()->viewDisplayList().add(endClipDisplayItem.release()); | 80 m_box.view()->viewDisplayList().add(endClipDisplayItem.release()); |
113 } else { | 81 } else { |
114 endClipDisplayItem->replay(m_paintInfo.context); | 82 endClipDisplayItem->replay(m_paintInfo.context); |
115 } | 83 } |
116 } | 84 } |
117 | 85 |
118 } // namespace blink | 86 } // namespace blink |
OLD | NEW |