| 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 LOG(ERROR) << "Document background color: " << combinedBackgroundColor.seria
lized(); |
| 132 if (combinedBackgroundColor.alpha()) { | 133 if (combinedBackgroundColor.alpha()) { |
| 133 if (!combinedBackgroundColor.hasAlpha() && RuntimeEnabledFeatures::slimm
ingPaintV2Enabled()) | 134 if (!combinedBackgroundColor.hasAlpha() && RuntimeEnabledFeatures::slimm
ingPaintV2Enabled()) |
| 134 recorder.setKnownToBeOpaque(); | 135 recorder.setKnownToBeOpaque(); |
| 135 context.fillRect(backgroundRect, combinedBackgroundColor, (shouldDrawBac
kgroundInSeparateBuffer || shouldClearCanvas) ? SkXfermode::kSrc_Mode : SkXfermo
de::kSrcOver_Mode); | 136 context.fillRect(backgroundRect, combinedBackgroundColor, (shouldDrawBac
kgroundInSeparateBuffer || shouldClearCanvas) ? SkXfermode::kSrc_Mode : SkXfermo
de::kSrcOver_Mode); |
| 136 } else if (shouldClearCanvas && !shouldDrawBackgroundInSeparateBuffer) { | 137 } else if (shouldClearCanvas && !shouldDrawBackgroundInSeparateBuffer) { |
| 137 context.fillRect(backgroundRect, Color(), SkXfermode::kClear_Mode); | 138 context.fillRect(backgroundRect, Color(), SkXfermode::kClear_Mode); |
| 138 } | 139 } |
| 139 | 140 |
| 140 for (auto it = reversedPaintList.rbegin(); it != reversedPaintList.rend(); +
+it) { | 141 for (auto it = reversedPaintList.rbegin(); it != reversedPaintList.rend(); +
+it) { |
| 141 ASSERT((*it)->clip() == BorderFillBox); | 142 ASSERT((*it)->clip() == BorderFillBox); |
| 142 | 143 |
| 143 bool shouldPaintInViewportSpace = (*it)->attachment() == FixedBackground
Attachment; | 144 bool shouldPaintInViewportSpace = (*it)->attachment() == FixedBackground
Attachment; |
| 144 if (shouldPaintInViewportSpace) { | 145 if (shouldPaintInViewportSpace) { |
| 145 BoxPainter::paintFillLayer(m_layoutView, paintInfo, Color(), **it, L
ayoutRect(LayoutRect::infiniteIntRect()), BackgroundBleedNone); | 146 BoxPainter::paintFillLayer(m_layoutView, paintInfo, Color(), **it, L
ayoutRect(LayoutRect::infiniteIntRect()), BackgroundBleedNone); |
| 146 } else { | 147 } else { |
| 147 context.save(); | 148 context.save(); |
| 148 // TODO(trchen): We should be able to handle 3D-transformed root | 149 // TODO(trchen): We should be able to handle 3D-transformed root |
| 149 // background with slimming paint by using transform display items. | 150 // background with slimming paint by using transform display items. |
| 150 context.concatCTM(transform.toAffineTransform()); | 151 context.concatCTM(transform.toAffineTransform()); |
| 151 BoxPainter::paintFillLayer(m_layoutView, paintInfo, Color(), **it, L
ayoutRect(paintRect), BackgroundBleedNone); | 152 BoxPainter::paintFillLayer(m_layoutView, paintInfo, Color(), **it, L
ayoutRect(paintRect), BackgroundBleedNone); |
| 152 context.restore(); | 153 context.restore(); |
| 153 } | 154 } |
| 154 } | 155 } |
| 155 | 156 |
| 156 if (shouldDrawBackgroundInSeparateBuffer) | 157 if (shouldDrawBackgroundInSeparateBuffer) |
| 157 context.endLayer(); | 158 context.endLayer(); |
| 158 } | 159 } |
| 159 | 160 |
| 160 } // namespace blink | 161 } // namespace blink |
| OLD | NEW |