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 "core/paint/ViewPainter.h" | 5 #include "core/paint/ViewPainter.h" |
6 | 6 |
7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
9 #include "core/layout/LayoutBox.h" | 9 #include "core/layout/LayoutBox.h" |
10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 if (!baseBackgroundColor.alpha() && shouldClearCanvas) | 122 if (!baseBackgroundColor.alpha() && shouldClearCanvas) |
123 shouldDrawBackgroundInSeparateBuffer = false; | 123 shouldDrawBackgroundInSeparateBuffer = false; |
124 | 124 |
125 if (shouldDrawBackgroundInSeparateBuffer) { | 125 if (shouldDrawBackgroundInSeparateBuffer) { |
126 if (baseBackgroundColor.alpha()) | 126 if (baseBackgroundColor.alpha()) |
127 context.fillRect(backgroundRect, baseBackgroundColor, shouldClearCan
vas ? SkXfermode::kSrc_Mode : SkXfermode::kSrcOver_Mode); | 127 context.fillRect(backgroundRect, baseBackgroundColor, shouldClearCan
vas ? SkXfermode::kSrc_Mode : SkXfermode::kSrcOver_Mode); |
128 context.beginLayer(); | 128 context.beginLayer(); |
129 } | 129 } |
130 | 130 |
131 Color combinedBackgroundColor = shouldDrawBackgroundInSeparateBuffer ? rootB
ackgroundColor : baseBackgroundColor.blend(rootBackgroundColor); | 131 Color combinedBackgroundColor = shouldDrawBackgroundInSeparateBuffer ? rootB
ackgroundColor : baseBackgroundColor.blend(rootBackgroundColor); |
132 if (combinedBackgroundColor.alpha()) | 132 if (combinedBackgroundColor.alpha()) { |
| 133 if (!combinedBackgroundColor.hasAlpha() && RuntimeEnabledFeatures::slimm
ingPaintV2Enabled()) |
| 134 recorder.setKnownToBeOpaque(); |
133 context.fillRect(backgroundRect, combinedBackgroundColor, (shouldDrawBac
kgroundInSeparateBuffer || shouldClearCanvas) ? SkXfermode::kSrc_Mode : SkXfermo
de::kSrcOver_Mode); | 135 context.fillRect(backgroundRect, combinedBackgroundColor, (shouldDrawBac
kgroundInSeparateBuffer || shouldClearCanvas) ? SkXfermode::kSrc_Mode : SkXfermo
de::kSrcOver_Mode); |
134 else if (shouldClearCanvas && !shouldDrawBackgroundInSeparateBuffer) | 136 } else if (shouldClearCanvas && !shouldDrawBackgroundInSeparateBuffer) { |
135 context.fillRect(backgroundRect, Color(), SkXfermode::kClear_Mode); | 137 context.fillRect(backgroundRect, Color(), SkXfermode::kClear_Mode); |
| 138 } |
136 | 139 |
137 for (auto it = reversedPaintList.rbegin(); it != reversedPaintList.rend(); +
+it) { | 140 for (auto it = reversedPaintList.rbegin(); it != reversedPaintList.rend(); +
+it) { |
138 ASSERT((*it)->clip() == BorderFillBox); | 141 ASSERT((*it)->clip() == BorderFillBox); |
139 | 142 |
140 bool shouldPaintInViewportSpace = (*it)->attachment() == FixedBackground
Attachment; | 143 bool shouldPaintInViewportSpace = (*it)->attachment() == FixedBackground
Attachment; |
141 if (shouldPaintInViewportSpace) { | 144 if (shouldPaintInViewportSpace) { |
142 BoxPainter::paintFillLayer(m_layoutView, paintInfo, Color(), **it, L
ayoutRect(LayoutRect::infiniteIntRect()), BackgroundBleedNone); | 145 BoxPainter::paintFillLayer(m_layoutView, paintInfo, Color(), **it, L
ayoutRect(LayoutRect::infiniteIntRect()), BackgroundBleedNone); |
143 } else { | 146 } else { |
144 context.save(); | 147 context.save(); |
145 // TODO(trchen): We should be able to handle 3D-transformed root | 148 // TODO(trchen): We should be able to handle 3D-transformed root |
146 // background with slimming paint by using transform display items. | 149 // background with slimming paint by using transform display items. |
147 context.concatCTM(transform.toAffineTransform()); | 150 context.concatCTM(transform.toAffineTransform()); |
148 BoxPainter::paintFillLayer(m_layoutView, paintInfo, Color(), **it, L
ayoutRect(paintRect), BackgroundBleedNone); | 151 BoxPainter::paintFillLayer(m_layoutView, paintInfo, Color(), **it, L
ayoutRect(paintRect), BackgroundBleedNone); |
149 context.restore(); | 152 context.restore(); |
150 } | 153 } |
151 } | 154 } |
152 | 155 |
153 if (shouldDrawBackgroundInSeparateBuffer) | 156 if (shouldDrawBackgroundInSeparateBuffer) |
154 context.endLayer(); | 157 context.endLayer(); |
155 } | 158 } |
156 | 159 |
157 } // namespace blink | 160 } // namespace blink |
OLD | NEW |