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/SVGImagePainter.h" | 5 #include "core/paint/SVGImagePainter.h" |
6 | 6 |
7 #include "core/layout/ImageQualityController.h" | 7 #include "core/layout/ImageQualityController.h" |
8 #include "core/layout/LayoutImageResource.h" | 8 #include "core/layout/LayoutImageResource.h" |
9 #include "core/layout/svg/LayoutSVGImage.h" | 9 #include "core/layout/svg/LayoutSVGImage.h" |
10 #include "core/layout/svg/SVGLayoutSupport.h" | 10 #include "core/layout/svg/SVGLayoutSupport.h" |
11 #include "core/paint/LayoutObjectDrawingRecorder.h" | 11 #include "core/paint/LayoutObjectDrawingRecorder.h" |
12 #include "core/paint/ObjectPainter.h" | 12 #include "core/paint/ObjectPainter.h" |
13 #include "core/paint/PaintInfo.h" | 13 #include "core/paint/PaintInfo.h" |
14 #include "core/paint/SVGPaintContext.h" | 14 #include "core/paint/SVGPaintContext.h" |
15 #include "core/paint/TransformRecorder.h" | 15 #include "core/paint/TransformRecorder.h" |
16 #include "core/svg/SVGImageElement.h" | 16 #include "core/svg/SVGImageElement.h" |
17 #include "core/svg/graphics/SVGImage.h" | 17 #include "core/svg/graphics/SVGImage.h" |
18 #include "platform/graphics/GraphicsContext.h" | 18 #include "platform/graphics/GraphicsContext.h" |
19 #include "third_party/skia/include/core/SkPicture.h" | 19 #include "third_party/skia/include/core/SkPicture.h" |
20 | 20 |
21 namespace blink { | 21 namespace blink { |
22 | 22 |
23 void SVGImagePainter::paint(const PaintInfo& paintInfo) | 23 void SVGImagePainter::paint(const PaintInfo& paintInfo) |
24 { | 24 { |
25 if (paintInfo.phase != PaintPhaseForeground | 25 if (paintInfo.phase != PaintPhaseForeground |
26 || m_layoutSVGImage.style()->visibility() == HIDDEN | 26 || m_layoutSVGImage.style()->visibility() == HIDDEN |
pdr.
2016/06/07 23:02:25
We should just check for "visibility() != VISIBLE"
Shanmuga Pandi
2016/06/08 05:17:13
Done.
| |
27 || m_layoutSVGImage.style()->visibility() == COLLAPSE | |
27 || !m_layoutSVGImage.imageResource()->hasImage()) | 28 || !m_layoutSVGImage.imageResource()->hasImage()) |
28 return; | 29 return; |
29 | 30 |
30 FloatRect boundingBox = m_layoutSVGImage.paintInvalidationRectInLocalSVGCoor dinates(); | 31 FloatRect boundingBox = m_layoutSVGImage.paintInvalidationRectInLocalSVGCoor dinates(); |
31 if (!paintInfo.cullRect().intersectsCullRect(m_layoutSVGImage.localToSVGPare ntTransform(), boundingBox)) | 32 if (!paintInfo.cullRect().intersectsCullRect(m_layoutSVGImage.localToSVGPare ntTransform(), boundingBox)) |
32 return; | 33 return; |
33 | 34 |
34 PaintInfo paintInfoBeforeFiltering(paintInfo); | 35 PaintInfo paintInfoBeforeFiltering(paintInfo); |
35 // Images cannot have children so do not call updateCullRect. | 36 // Images cannot have children so do not call updateCullRect. |
36 TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layo utSVGImage, m_layoutSVGImage.localToSVGParentTransform()); | 37 TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layo utSVGImage, m_layoutSVGImage.localToSVGParentTransform()); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 if (cachedImage->errorOccurred()) | 92 if (cachedImage->errorOccurred()) |
92 return FloatSize(); | 93 return FloatSize(); |
93 | 94 |
94 if (cachedImage->getImage()->isSVGImage()) | 95 if (cachedImage->getImage()->isSVGImage()) |
95 return toSVGImage(cachedImage->getImage())->concreteObjectSize(m_layoutS VGImage.objectBoundingBox().size()); | 96 return toSVGImage(cachedImage->getImage())->concreteObjectSize(m_layoutS VGImage.objectBoundingBox().size()); |
96 | 97 |
97 return FloatSize(cachedImage->getImage()->size()); | 98 return FloatSize(cachedImage->getImage()->size()); |
98 } | 99 } |
99 | 100 |
100 } // namespace blink | 101 } // namespace blink |
OLD | NEW |