| 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/BoxPainter.h" | 5 #include "core/paint/BoxPainter.h" |
| 6 | 6 |
| 7 #include "core/HTMLNames.h" | 7 #include "core/HTMLNames.h" |
| 8 #include "core/frame/Settings.h" | 8 #include "core/frame/Settings.h" |
| 9 #include "core/html/HTMLFrameOwnerElement.h" | 9 #include "core/html/HTMLFrameOwnerElement.h" |
| 10 #include "core/layout/ImageQualityController.h" | 10 #include "core/layout/ImageQualityController.h" |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutBox, | 811 LayoutObjectDrawingRecorder recorder(paintInfo.context, m_layoutBox, |
| 812 paintInfo.phase, visualOverflowRect); | 812 paintInfo.phase, visualOverflowRect); |
| 813 LayoutRect paintRect = LayoutRect(paintOffset, m_layoutBox.size()); | 813 LayoutRect paintRect = LayoutRect(paintOffset, m_layoutBox.size()); |
| 814 paintMaskImages(paintInfo, paintRect); | 814 paintMaskImages(paintInfo, paintRect); |
| 815 } | 815 } |
| 816 | 816 |
| 817 void BoxPainter::paintMaskImages(const PaintInfo& paintInfo, | 817 void BoxPainter::paintMaskImages(const PaintInfo& paintInfo, |
| 818 const LayoutRect& paintRect) { | 818 const LayoutRect& paintRect) { |
| 819 // Figure out if we need to push a transparency layer to render our mask. | 819 // Figure out if we need to push a transparency layer to render our mask. |
| 820 bool pushTransparencyLayer = false; | 820 bool pushTransparencyLayer = false; |
| 821 bool compositedMask = | |
| 822 m_layoutBox.hasLayer() && m_layoutBox.layer()->hasCompositedMask(); | |
| 823 bool flattenCompositingLayers = | 821 bool flattenCompositingLayers = |
| 824 paintInfo.getGlobalPaintFlags() & GlobalPaintFlattenCompositingLayers; | 822 paintInfo.getGlobalPaintFlags() & GlobalPaintFlattenCompositingLayers; |
| 823 bool maskBlendingAppliedByCompositor = |
| 824 !flattenCompositingLayers && m_layoutBox.hasLayer() && |
| 825 m_layoutBox.layer()->maskBlendingAppliedByCompositor(); |
| 825 | 826 |
| 826 bool allMaskImagesLoaded = true; | 827 bool allMaskImagesLoaded = true; |
| 827 | 828 |
| 828 if (!compositedMask || flattenCompositingLayers) { | 829 if (!maskBlendingAppliedByCompositor) { |
| 829 pushTransparencyLayer = true; | 830 pushTransparencyLayer = true; |
| 830 StyleImage* maskBoxImage = m_layoutBox.style()->maskBoxImage().image(); | 831 StyleImage* maskBoxImage = m_layoutBox.style()->maskBoxImage().image(); |
| 831 const FillLayer& maskLayers = m_layoutBox.style()->maskLayers(); | 832 const FillLayer& maskLayers = m_layoutBox.style()->maskLayers(); |
| 832 | 833 |
| 833 // Don't render a masked element until all the mask images have loaded, to | 834 // Don't render a masked element until all the mask images have loaded, to |
| 834 // prevent a flash of unmasked content. | 835 // prevent a flash of unmasked content. |
| 835 if (maskBoxImage) | 836 if (maskBoxImage) |
| 836 allMaskImagesLoaded &= maskBoxImage->isLoaded(); | 837 allMaskImagesLoaded &= maskBoxImage->isLoaded(); |
| 837 | 838 |
| 838 allMaskImagesLoaded &= maskLayers.imagesAreLoaded(); | 839 allMaskImagesLoaded &= maskLayers.imagesAreLoaded(); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1091 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy( | 1092 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy( |
| 1092 const ComputedStyle& style, | 1093 const ComputedStyle& style, |
| 1093 const Document& document) { | 1094 const Document& document) { |
| 1094 return document.printing() && | 1095 return document.printing() && |
| 1095 style.printColorAdjust() == EPrintColorAdjust::kEconomy && | 1096 style.printColorAdjust() == EPrintColorAdjust::kEconomy && |
| 1096 (!document.settings() || | 1097 (!document.settings() || |
| 1097 !document.settings()->getShouldPrintBackgrounds()); | 1098 !document.settings()->getShouldPrintBackgrounds()); |
| 1098 } | 1099 } |
| 1099 | 1100 |
| 1100 } // namespace blink | 1101 } // namespace blink |
| OLD | NEW |