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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 } | 466 } |
467 | 467 |
468 // no progressive loading of the background image | 468 // no progressive loading of the background image |
469 if (shouldPaintBackgroundImage) { | 469 if (shouldPaintBackgroundImage) { |
470 if (!geometry.destRect().isEmpty()) { | 470 if (!geometry.destRect().isEmpty()) { |
471 SkXfermode::Mode bgOp = WebCoreCompositeToSkiaComposite(bgLayer.comp
osite(), bgLayer.blendMode()); | 471 SkXfermode::Mode bgOp = WebCoreCompositeToSkiaComposite(bgLayer.comp
osite(), bgLayer.blendMode()); |
472 // if op != SkXfermode::kSrcOver_Mode, a mask is being painted. | 472 // if op != SkXfermode::kSrcOver_Mode, a mask is being painted. |
473 SkXfermode::Mode compositeOp = op == SkXfermode::kSrcOver_Mode ? bgO
p : op; | 473 SkXfermode::Mode compositeOp = op == SkXfermode::kSrcOver_Mode ? bgO
p : op; |
474 LayoutObject* clientForBackgroundImage = backgroundObject ? backgrou
ndObject : &obj; | 474 LayoutObject* clientForBackgroundImage = backgroundObject ? backgrou
ndObject : &obj; |
475 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geome
try.tileSize()); | 475 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geome
try.tileSize()); |
| 476 KURL url = bgImage->url(); |
476 InterpolationQuality interpolationQuality = chooseInterpolationQuali
ty(*clientForBackgroundImage, context, image.get(), &bgLayer, LayoutSize(geometr
y.tileSize())); | 477 InterpolationQuality interpolationQuality = chooseInterpolationQuali
ty(*clientForBackgroundImage, context, image.get(), &bgLayer, LayoutSize(geometr
y.tileSize())); |
477 if (bgLayer.maskSourceType() == MaskLuminance) | 478 if (bgLayer.maskSourceType() == MaskLuminance) |
478 context->setColorFilter(ColorFilterLuminanceToAlpha); | 479 context->setColorFilter(ColorFilterLuminanceToAlpha); |
479 InterpolationQuality previousInterpolationQuality = context->imageIn
terpolationQuality(); | 480 InterpolationQuality previousInterpolationQuality = context->imageIn
terpolationQuality(); |
480 context->setImageInterpolationQuality(interpolationQuality); | 481 context->setImageInterpolationQuality(interpolationQuality); |
481 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintI
mage", "data", InspectorPaintImageEvent::data(obj, *bgImage)); | 482 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintI
mage", "data", InspectorPaintImageEvent::data(obj, *bgImage)); |
482 context->drawTiledImage(image.get(), geometry.destRect(), geometry.p
hase(), geometry.tileSize(), | 483 context->drawTiledImage(image.get(), geometry.destRect(), geometry.p
hase(), geometry.tileSize(), |
483 compositeOp, geometry.spaceSize()); | 484 url, compositeOp, geometry.spaceSize()); |
484 context->setImageInterpolationQuality(previousInterpolationQuality); | 485 context->setImageInterpolationQuality(previousInterpolationQuality); |
485 } | 486 } |
486 } | 487 } |
487 | 488 |
488 if (bgLayer.clip() == TextFillBox) { | 489 if (bgLayer.clip() == TextFillBox) { |
489 // Create the text mask layer. | 490 // Create the text mask layer. |
490 context->beginLayer(1, SkXfermode::kDstIn_Mode); | 491 context->beginLayer(1, SkXfermode::kDstIn_Mode); |
491 | 492 |
492 // Now draw the text into the mask. We do this by painting using a speci
al paint phase that signals to | 493 // Now draw the text into the mask. We do this by painting using a speci
al paint phase that signals to |
493 // InlineTextBoxes that they should just add their contents to the clip. | 494 // InlineTextBoxes that they should just add their contents to the clip. |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 } | 763 } |
763 } | 764 } |
764 | 765 |
765 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle&
style, const Document& document) | 766 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle&
style, const Document& document) |
766 { | 767 { |
767 return document.printing() && style.printColorAdjust() == PrintColorAdjustEc
onomy | 768 return document.printing() && style.printColorAdjust() == PrintColorAdjustEc
onomy |
768 && (!document.settings() || !document.settings()->shouldPrintBackgrounds
()); | 769 && (!document.settings() || !document.settings()->shouldPrintBackgrounds
()); |
769 } | 770 } |
770 | 771 |
771 } // namespace blink | 772 } // namespace blink |
OLD | NEW |