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" |
11 #include "core/layout/ImageQualityController.h" | 11 #include "core/layout/ImageQualityController.h" |
12 #include "core/layout/LayoutBox.h" | 12 #include "core/layout/LayoutBox.h" |
13 #include "core/layout/LayoutBoxModelObject.h" | 13 #include "core/layout/LayoutBoxModelObject.h" |
14 #include "core/layout/LayoutObject.h" | 14 #include "core/layout/LayoutObject.h" |
15 #include "core/layout/LayoutTable.h" | 15 #include "core/layout/LayoutTable.h" |
16 #include "core/layout/LayoutTheme.h" | 16 #include "core/layout/LayoutTheme.h" |
17 #include "core/layout/LayoutView.h" | 17 #include "core/layout/LayoutView.h" |
18 #include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h" | 18 #include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h" |
19 #include "core/style/BorderEdge.h" | |
20 #include "core/style/ShadowList.h" | |
21 #include "core/paint/BackgroundImageGeometry.h" | 19 #include "core/paint/BackgroundImageGeometry.h" |
22 #include "core/paint/BoxBorderPainter.h" | 20 #include "core/paint/BoxBorderPainter.h" |
23 #include "core/paint/BoxDecorationData.h" | 21 #include "core/paint/BoxDecorationData.h" |
24 #include "core/paint/DeprecatedPaintLayer.h" | 22 #include "core/paint/DeprecatedPaintLayer.h" |
25 #include "core/paint/LayoutObjectDrawingRecorder.h" | 23 #include "core/paint/LayoutObjectDrawingRecorder.h" |
26 #include "core/paint/NinePieceImagePainter.h" | 24 #include "core/paint/NinePieceImagePainter.h" |
27 #include "core/paint/PaintInfo.h" | 25 #include "core/paint/PaintInfo.h" |
28 #include "core/paint/RoundedInnerRectClipper.h" | 26 #include "core/paint/RoundedInnerRectClipper.h" |
29 #include "core/paint/ThemePainter.h" | 27 #include "core/paint/ThemePainter.h" |
| 28 #include "core/style/BorderEdge.h" |
| 29 #include "core/style/ShadowList.h" |
| 30 #include "core/svg/graphics/SVGImageForContainer.h" |
30 #include "platform/LengthFunctions.h" | 31 #include "platform/LengthFunctions.h" |
31 #include "platform/geometry/LayoutPoint.h" | 32 #include "platform/geometry/LayoutPoint.h" |
32 #include "platform/geometry/LayoutRectOutsets.h" | 33 #include "platform/geometry/LayoutRectOutsets.h" |
33 #include "platform/graphics/GraphicsContextStateSaver.h" | 34 #include "platform/graphics/GraphicsContextStateSaver.h" |
34 #include "platform/graphics/paint/CompositingDisplayItem.h" | 35 #include "platform/graphics/paint/CompositingDisplayItem.h" |
35 #include "wtf/Optional.h" | 36 #include "wtf/Optional.h" |
36 | 37 |
37 namespace blink { | 38 namespace blink { |
38 | 39 |
39 void BoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffse
t) | 40 void BoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffse
t) |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 SkXfermode::Mode bgOp = WebCoreCompositeToSkiaComposite(bgLayer.comp
osite(), bgLayer.blendMode()); | 464 SkXfermode::Mode bgOp = WebCoreCompositeToSkiaComposite(bgLayer.comp
osite(), bgLayer.blendMode()); |
464 // if op != SkXfermode::kSrcOver_Mode, a mask is being painted. | 465 // if op != SkXfermode::kSrcOver_Mode, a mask is being painted. |
465 SkXfermode::Mode compositeOp = op == SkXfermode::kSrcOver_Mode ? bgO
p : op; | 466 SkXfermode::Mode compositeOp = op == SkXfermode::kSrcOver_Mode ? bgO
p : op; |
466 LayoutObject* clientForBackgroundImage = backgroundObject ? backgrou
ndObject : &obj; | 467 LayoutObject* clientForBackgroundImage = backgroundObject ? backgrou
ndObject : &obj; |
467 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geome
try.tileSize()); | 468 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geome
try.tileSize()); |
468 InterpolationQuality interpolationQuality = chooseInterpolationQuali
ty(*clientForBackgroundImage, context, image.get(), &bgLayer, LayoutSize(geometr
y.tileSize())); | 469 InterpolationQuality interpolationQuality = chooseInterpolationQuali
ty(*clientForBackgroundImage, context, image.get(), &bgLayer, LayoutSize(geometr
y.tileSize())); |
469 if (bgLayer.maskSourceType() == MaskLuminance) | 470 if (bgLayer.maskSourceType() == MaskLuminance) |
470 context->setColorFilter(ColorFilterLuminanceToAlpha); | 471 context->setColorFilter(ColorFilterLuminanceToAlpha); |
471 InterpolationQuality previousInterpolationQuality = context->imageIn
terpolationQuality(); | 472 InterpolationQuality previousInterpolationQuality = context->imageIn
terpolationQuality(); |
472 context->setImageInterpolationQuality(interpolationQuality); | 473 context->setImageInterpolationQuality(interpolationQuality); |
| 474 |
| 475 if (image->isSVGImage()) |
| 476 image = SVGImageForContainer::create(toSVGImage(image.get()), ge
ometry.tileSize(), obj.style()->effectiveZoom(), bgImage->url()); |
| 477 |
473 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintI
mage", "data", InspectorPaintImageEvent::data(obj, *bgImage)); | 478 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintI
mage", "data", InspectorPaintImageEvent::data(obj, *bgImage)); |
474 context->drawTiledImage(image.get(), geometry.destRect(), geometry.p
hase(), geometry.tileSize(), | 479 context->drawTiledImage(image.get(), geometry.destRect(), geometry.p
hase(), geometry.tileSize(), |
475 compositeOp, geometry.spaceSize()); | 480 compositeOp, geometry.spaceSize()); |
476 context->setImageInterpolationQuality(previousInterpolationQuality); | 481 context->setImageInterpolationQuality(previousInterpolationQuality); |
477 } | 482 } |
478 } | 483 } |
479 | 484 |
480 if (bgLayer.clip() == TextFillBox) { | 485 if (bgLayer.clip() == TextFillBox) { |
481 // Create the text mask layer. | 486 // Create the text mask layer. |
482 context->beginLayer(1, SkXfermode::kDstIn_Mode); | 487 context->beginLayer(1, SkXfermode::kDstIn_Mode); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 } | 748 } |
744 } | 749 } |
745 | 750 |
746 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle&
style, const Document& document) | 751 bool BoxPainter::shouldForceWhiteBackgroundForPrintEconomy(const ComputedStyle&
style, const Document& document) |
747 { | 752 { |
748 return document.printing() && style.printColorAdjust() == PrintColorAdjustEc
onomy | 753 return document.printing() && style.printColorAdjust() == PrintColorAdjustEc
onomy |
749 && (!document.settings() || !document.settings()->shouldPrintBackgrounds
()); | 754 && (!document.settings() || !document.settings()->shouldPrintBackgrounds
()); |
750 } | 755 } |
751 | 756 |
752 } // namespace blink | 757 } // namespace blink |
OLD | NEW |