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