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 "config.h" | 5 #include "config.h" |
6 #include "core/paint/BoxPainter.h" | 6 #include "core/paint/BoxPainter.h" |
7 | 7 |
8 #include "core/HTMLNames.h" | 8 #include "core/HTMLNames.h" |
9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
10 #include "core/html/HTMLFrameOwnerElement.h" | 10 #include "core/html/HTMLFrameOwnerElement.h" |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 } | 435 } |
436 case BorderFillBox: | 436 case BorderFillBox: |
437 break; | 437 break; |
438 default: | 438 default: |
439 ASSERT_NOT_REACHED(); | 439 ASSERT_NOT_REACHED(); |
440 break; | 440 break; |
441 } | 441 } |
442 | 442 |
443 BackgroundImageGeometry geometry; | 443 BackgroundImageGeometry geometry; |
444 if (bgImage) | 444 if (bgImage) |
445 geometry.calculate(obj, paintInfo.paintContainer(), paintInfo.globalPain
tFlags(), bgLayer, scrolledPaintRect, backgroundObject); | 445 geometry.calculate(obj, paintInfo.paintContainer(), paintInfo.globalPain
tFlags(), bgLayer, scrolledPaintRect, paintInfo.accumulatedScrollOffsetSincePain
tContainer, backgroundObject); |
446 bool shouldPaintBackgroundImage = bgImage && bgImage->canRender(obj, obj.sty
le()->effectiveZoom()); | 446 bool shouldPaintBackgroundImage = bgImage && bgImage->canRender(obj, obj.sty
le()->effectiveZoom()); |
447 | 447 |
448 // Paint the color first underneath all images, culled if background image o
ccludes it. | 448 // Paint the color first underneath all images, culled if background image o
ccludes it. |
449 // TODO(trchen): In the !bgLayer.hasRepeatXY() case, we could improve the cu
lling test | 449 // TODO(trchen): In the !bgLayer.hasRepeatXY() case, we could improve the cu
lling test |
450 // by verifying whether the background image covers the entire painting area
. | 450 // by verifying whether the background image covers the entire painting area
. |
451 if (isBottomLayer) { | 451 if (isBottomLayer) { |
452 IntRect backgroundRect(pixelSnappedIntRect(scrolledPaintRect)); | 452 IntRect backgroundRect(pixelSnappedIntRect(scrolledPaintRect)); |
453 bool boxShadowShouldBeAppliedToBackground = obj.boxShadowShouldBeApplied
ToBackground(bleedAvoidance, box); | 453 bool boxShadowShouldBeAppliedToBackground = obj.boxShadowShouldBeApplied
ToBackground(bleedAvoidance, box); |
454 bool backgroundImageOccludesBackgroundColor = shouldPaintBackgroundImage
&& isFillLayerOpaque(bgLayer, obj); | 454 bool backgroundImageOccludesBackgroundColor = shouldPaintBackgroundImage
&& isFillLayerOpaque(bgLayer, obj); |
455 if (boxShadowShouldBeAppliedToBackground || !backgroundImageOccludesBack
groundColor) { | 455 if (boxShadowShouldBeAppliedToBackground || !backgroundImageOccludesBack
groundColor) { |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 } | 762 } |
763 } | 763 } |
764 | 764 |
765 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle&
style, const Document& document) | 765 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle&
style, const Document& document) |
766 { | 766 { |
767 return document.printing() && style.printColorAdjust() == PrintColorAdjustEc
onomy | 767 return document.printing() && style.printColorAdjust() == PrintColorAdjustEc
onomy |
768 && (!document.settings() || !document.settings()->shouldPrintBackgrounds
()); | 768 && (!document.settings() || !document.settings()->shouldPrintBackgrounds
()); |
769 } | 769 } |
770 | 770 |
771 } // namespace blink | 771 } // namespace blink |
OLD | NEW |