| 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/svg/SVGSVGElement.h" | 14 #include "core/svg/SVGSVGElement.h" |
| 15 #include "wtf/Optional.h" | 15 #include "wtf/Optional.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 void SVGContainerPainter::paint(const PaintInfo& paintInfo) { | 19 void SVGContainerPainter::paint(const PaintInfo& paintInfo) { |
| 20 // Spec: groups w/o children still may render filter content. | 20 // Spec: groups w/o children still may render filter content. |
| 21 if (!m_layoutSVGContainer.firstChild() && | 21 if (!m_layoutSVGContainer.firstChild() && |
| 22 !m_layoutSVGContainer.selfWillPaint()) | 22 !m_layoutSVGContainer.selfWillPaint()) |
| 23 return; | 23 return; |
| 24 | 24 |
| 25 FloatRect boundingBox = | 25 FloatRect boundingBox = |
| 26 m_layoutSVGContainer.paintInvalidationRectInLocalSVGCoordinates(); | 26 m_layoutSVGContainer.paintInvalidationRectInLocalSVGCoordinates(); |
| 27 // LayoutSVGHiddenContainer's paint invalidation rect is always empty but we n
eed to paint its descendants. | 27 // LayoutSVGHiddenContainer's paint invalidation rect is always empty but we |
| 28 // need to paint its descendants. |
| 28 if (!m_layoutSVGContainer.isSVGHiddenContainer() && | 29 if (!m_layoutSVGContainer.isSVGHiddenContainer() && |
| 29 !paintInfo.cullRect().intersectsCullRect( | 30 !paintInfo.cullRect().intersectsCullRect( |
| 30 m_layoutSVGContainer.localToSVGParentTransform(), boundingBox)) | 31 m_layoutSVGContainer.localToSVGParentTransform(), boundingBox)) |
| 31 return; | 32 return; |
| 32 | 33 |
| 33 // Spec: An empty viewBox on the <svg> element disables rendering. | 34 // Spec: An empty viewBox on the <svg> element disables rendering. |
| 34 ASSERT(m_layoutSVGContainer.element()); | 35 ASSERT(m_layoutSVGContainer.element()); |
| 35 if (isSVGSVGElement(*m_layoutSVGContainer.element()) && | 36 if (isSVGSVGElement(*m_layoutSVGContainer.element()) && |
| 36 toSVGSVGElement(*m_layoutSVGContainer.element()).hasEmptyViewBox()) | 37 toSVGSVGElement(*m_layoutSVGContainer.element()).hasEmptyViewBox()) |
| 37 return; | 38 return; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 ObjectPainter(m_layoutSVGContainer) | 78 ObjectPainter(m_layoutSVGContainer) |
| 78 .paintOutline(outlinePaintInfo, LayoutPoint(boundingBox.location())); | 79 .paintOutline(outlinePaintInfo, LayoutPoint(boundingBox.location())); |
| 79 } | 80 } |
| 80 | 81 |
| 81 if (paintInfoBeforeFiltering.isPrinting()) | 82 if (paintInfoBeforeFiltering.isPrinting()) |
| 82 ObjectPainter(m_layoutSVGContainer) | 83 ObjectPainter(m_layoutSVGContainer) |
| 83 .addPDFURLRectIfNeeded(paintInfoBeforeFiltering, LayoutPoint()); | 84 .addPDFURLRectIfNeeded(paintInfoBeforeFiltering, LayoutPoint()); |
| 84 } | 85 } |
| 85 | 86 |
| 86 } // namespace blink | 87 } // namespace blink |
| OLD | NEW |