| 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/SVGContainerPainter.h" | 5 #include "core/paint/SVGContainerPainter.h" |
| 6 | 6 |
| 7 #include "core/layout/svg/LayoutSVGContainer.h" | 7 #include "core/layout/svg/LayoutSVGContainer.h" |
| 8 #include "core/layout/svg/LayoutSVGViewportContainer.h" | 8 #include "core/layout/svg/LayoutSVGViewportContainer.h" |
| 9 #include "core/layout/svg/SVGLayoutSupport.h" | 9 #include "core/layout/svg/SVGLayoutSupport.h" |
| 10 #include "core/paint/FloatClipRecorder.h" | 10 #include "core/paint/FloatClipRecorder.h" |
| 11 #include "core/paint/ObjectPainter.h" | 11 #include "core/paint/ObjectPainter.h" |
| 12 #include "core/paint/PaintInfo.h" | 12 #include "core/paint/PaintInfo.h" |
| 13 #include "core/paint/SVGPaintContext.h" | 13 #include "core/paint/SVGPaintContext.h" |
| 14 #include "core/paint/TransformRecorder.h" | 14 #include "core/paint/TransformRecorder.h" |
| 15 #include "core/svg/SVGSVGElement.h" | 15 #include "core/svg/SVGSVGElement.h" |
| 16 #include "wtf/Optional.h" | 16 #include "wtf/Optional.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 void SVGContainerPainter::paint(const PaintInfo& paintInfo) | 20 void SVGContainerPainter::paint(const PaintInfo& paintInfo) |
| 21 { | 21 { |
| 22 // Spec: groups w/o children still may render filter content. | 22 // Spec: groups w/o children still may render filter content. |
| 23 if (!m_layoutSVGContainer.firstChild() && !m_layoutSVGContainer.selfWillPain
t()) | 23 if (!m_layoutSVGContainer.firstChild() && !m_layoutSVGContainer.selfWillPain
t()) |
| 24 return; | 24 return; |
| 25 | 25 |
| 26 FloatRect boundingBox = m_layoutSVGContainer.paintInvalidationRectInLocalSVG
Coordinates(); | 26 FloatRect boundingBox = m_layoutSVGContainer.paintInvalidationRectInLocalSVG
Coordinates(); |
| 27 if (!paintInfo.cullRect().intersectsCullRect(m_layoutSVGContainer.localToSVG
ParentTransform(), boundingBox)) | 27 // LayoutSVGHiddenContainer's paint invalidation rect is always empty but we
need to paint its descendants. |
| 28 if (!m_layoutSVGContainer.isSVGHiddenContainer() |
| 29 && !paintInfo.cullRect().intersectsCullRect(m_layoutSVGContainer.localTo
SVGParentTransform(), boundingBox)) |
| 28 return; | 30 return; |
| 29 | 31 |
| 30 // Spec: An empty viewBox on the <svg> element disables rendering. | 32 // Spec: An empty viewBox on the <svg> element disables rendering. |
| 31 ASSERT(m_layoutSVGContainer.element()); | 33 ASSERT(m_layoutSVGContainer.element()); |
| 32 if (isSVGSVGElement(*m_layoutSVGContainer.element()) && toSVGSVGElement(*m_l
ayoutSVGContainer.element()).hasEmptyViewBox()) | 34 if (isSVGSVGElement(*m_layoutSVGContainer.element()) && toSVGSVGElement(*m_l
ayoutSVGContainer.element()).hasEmptyViewBox()) |
| 33 return; | 35 return; |
| 34 | 36 |
| 35 PaintInfo paintInfoBeforeFiltering(paintInfo); | 37 PaintInfo paintInfoBeforeFiltering(paintInfo); |
| 36 paintInfoBeforeFiltering.updateCullRect(m_layoutSVGContainer.localToSVGParen
tTransform()); | 38 paintInfoBeforeFiltering.updateCullRect(m_layoutSVGContainer.localToSVGParen
tTransform()); |
| 37 TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layo
utSVGContainer, m_layoutSVGContainer.localToSVGParentTransform()); | 39 TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layo
utSVGContainer, m_layoutSVGContainer.localToSVGParentTransform()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 60 PaintInfo outlinePaintInfo(paintInfoBeforeFiltering); | 62 PaintInfo outlinePaintInfo(paintInfoBeforeFiltering); |
| 61 outlinePaintInfo.phase = PaintPhaseSelfOutlineOnly; | 63 outlinePaintInfo.phase = PaintPhaseSelfOutlineOnly; |
| 62 ObjectPainter(m_layoutSVGContainer).paintOutline(outlinePaintInfo, Layou
tPoint(boundingBox.location())); | 64 ObjectPainter(m_layoutSVGContainer).paintOutline(outlinePaintInfo, Layou
tPoint(boundingBox.location())); |
| 63 } | 65 } |
| 64 | 66 |
| 65 if (paintInfoBeforeFiltering.isPrinting()) | 67 if (paintInfoBeforeFiltering.isPrinting()) |
| 66 ObjectPainter(m_layoutSVGContainer).addPDFURLRectIfNeeded(paintInfoBefor
eFiltering, LayoutPoint()); | 68 ObjectPainter(m_layoutSVGContainer).addPDFURLRectIfNeeded(paintInfoBefor
eFiltering, LayoutPoint()); |
| 67 } | 69 } |
| 68 | 70 |
| 69 } // namespace blink | 71 } // namespace blink |
| OLD | NEW |