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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 backgroundRect, baseBackgroundColor, | 160 backgroundRect, baseBackgroundColor, |
161 shouldClearCanvas ? SkBlendMode::kSrc : SkBlendMode::kSrcOver); | 161 shouldClearCanvas ? SkBlendMode::kSrc : SkBlendMode::kSrcOver); |
162 } | 162 } |
163 context.beginLayer(); | 163 context.beginLayer(); |
164 } | 164 } |
165 | 165 |
166 Color combinedBackgroundColor = | 166 Color combinedBackgroundColor = |
167 shouldDrawBackgroundInSeparateBuffer | 167 shouldDrawBackgroundInSeparateBuffer |
168 ? rootBackgroundColor | 168 ? rootBackgroundColor |
169 : baseBackgroundColor.blend(rootBackgroundColor); | 169 : baseBackgroundColor.blend(rootBackgroundColor); |
170 if (combinedBackgroundColor != frameView.baseBackgroundColor() && | 170 |
171 !context.getPaintController().nonDefaultBackgroundColorPainted()) { | 171 if (combinedBackgroundColor != frameView.baseBackgroundColor()) |
172 TRACE_EVENT_INSTANT0("blink.user_timing", "paintNonDefaultBackgroundColor", | 172 context.getPaintController().setFirstPainted(); |
173 TRACE_EVENT_SCOPE_GLOBAL); | 173 |
174 context.getPaintController().setNonDefaultBackgroundColorPainted(); | |
175 } | |
176 if (combinedBackgroundColor.alpha()) { | 174 if (combinedBackgroundColor.alpha()) { |
177 if (!combinedBackgroundColor.hasAlpha() && | 175 if (!combinedBackgroundColor.hasAlpha() && |
178 RuntimeEnabledFeatures::slimmingPaintV2Enabled()) | 176 RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
179 recorder.setKnownToBeOpaque(); | 177 recorder.setKnownToBeOpaque(); |
180 context.fillRect(backgroundRect, combinedBackgroundColor, | 178 context.fillRect(backgroundRect, combinedBackgroundColor, |
181 (shouldDrawBackgroundInSeparateBuffer || shouldClearCanvas) | 179 (shouldDrawBackgroundInSeparateBuffer || shouldClearCanvas) |
182 ? SkBlendMode::kSrc | 180 ? SkBlendMode::kSrc |
183 : SkBlendMode::kSrcOver); | 181 : SkBlendMode::kSrcOver); |
184 } else if (shouldClearCanvas && !shouldDrawBackgroundInSeparateBuffer) { | 182 } else if (shouldClearCanvas && !shouldDrawBackgroundInSeparateBuffer) { |
185 context.fillRect(backgroundRect, Color(), SkBlendMode::kClear); | 183 context.fillRect(backgroundRect, Color(), SkBlendMode::kClear); |
(...skipping 18 matching lines...) Expand all Loading... |
204 LayoutRect(paintRect), BackgroundBleedNone); | 202 LayoutRect(paintRect), BackgroundBleedNone); |
205 context.restore(); | 203 context.restore(); |
206 } | 204 } |
207 } | 205 } |
208 | 206 |
209 if (shouldDrawBackgroundInSeparateBuffer) | 207 if (shouldDrawBackgroundInSeparateBuffer) |
210 context.endLayer(); | 208 context.endLayer(); |
211 } | 209 } |
212 | 210 |
213 } // namespace blink | 211 } // namespace blink |
OLD | NEW |