| 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/SVGContainerPainter.h" | 6 #include "core/paint/SVGContainerPainter.h" |
| 7 | 7 |
| 8 #include "core/paint/ObjectPainter.h" | 8 #include "core/paint/ObjectPainter.h" |
| 9 #include "core/rendering/GraphicsContextAnnotator.h" | 9 #include "core/rendering/GraphicsContextAnnotator.h" |
| 10 #include "core/rendering/PaintInfo.h" | 10 #include "core/rendering/PaintInfo.h" |
| 11 #include "core/rendering/svg/RenderSVGContainer.h" | 11 #include "core/rendering/svg/RenderSVGContainer.h" |
| 12 #include "core/rendering/svg/RenderSVGViewportContainer.h" | 12 #include "core/rendering/svg/RenderSVGViewportContainer.h" |
| 13 #include "core/rendering/svg/SVGRenderSupport.h" | 13 #include "core/rendering/svg/SVGRenderSupport.h" |
| 14 #include "core/rendering/svg/SVGRenderingContext.h" | 14 #include "core/rendering/svg/SVGRenderingContext.h" |
| 15 #include "core/svg/SVGSVGElement.h" | 15 #include "core/svg/SVGSVGElement.h" |
| 16 #include "platform/graphics/GraphicsContextStateSaver.h" | 16 #include "platform/graphics/GraphicsContextStateSaver.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 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderSVGContainer); | 22 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderSVGContainer); |
| 23 | 23 |
| 24 // Spec: groups w/o children still may render filter content. | 24 // Spec: groups w/o children still may render filter content. |
| 25 if (!m_renderSVGContainer.firstChild() && !m_renderSVGContainer.selfWillPain
t()) | 25 if (!m_renderSVGContainer.firstChild() && !m_renderSVGContainer.selfWillPain
t()) |
| 26 return; | 26 return; |
| 27 | 27 |
| 28 FloatRect paintInvalidationRect = m_renderSVGContainer.paintInvalidationRect
InLocalCoordinates(); | |
| 29 if (!SVGRenderSupport::paintInfoIntersectsPaintInvalidationRect(paintInvalid
ationRect, m_renderSVGContainer.localToParentTransform(), paintInfo)) | |
| 30 return; | |
| 31 | |
| 32 // Spec: An empty viewBox on the <svg> element disables rendering. | 28 // Spec: An empty viewBox on the <svg> element disables rendering. |
| 33 ASSERT(m_renderSVGContainer.element()); | 29 ASSERT(m_renderSVGContainer.element()); |
| 34 if (isSVGSVGElement(*m_renderSVGContainer.element()) && toSVGSVGElement(*m_r
enderSVGContainer.element()).hasEmptyViewBox()) | 30 if (isSVGSVGElement(*m_renderSVGContainer.element()) && toSVGSVGElement(*m_r
enderSVGContainer.element()).hasEmptyViewBox()) |
| 35 return; | 31 return; |
| 36 | 32 |
| 37 PaintInfo childPaintInfo(paintInfo); | 33 PaintInfo childPaintInfo(paintInfo); |
| 38 { | 34 { |
| 39 GraphicsContextStateSaver stateSaver(*childPaintInfo.context); | 35 GraphicsContextStateSaver stateSaver(*childPaintInfo.context); |
| 40 | 36 |
| 41 if (m_renderSVGContainer.isSVGViewportContainer() && SVGRenderSupport::i
sOverflowHidden(&m_renderSVGContainer)) | 37 if (m_renderSVGContainer.isSVGViewportContainer() && SVGRenderSupport::i
sOverflowHidden(&m_renderSVGContainer)) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 56 child->paint(childPaintInfo, IntPoint()); | 52 child->paint(childPaintInfo, IntPoint()); |
| 57 } | 53 } |
| 58 } | 54 } |
| 59 | 55 |
| 60 // FIXME: This really should be drawn from local coordinates, but currently
we hack it | 56 // FIXME: This really should be drawn from local coordinates, but currently
we hack it |
| 61 // to avoid our clip killing our outline rect. Thus we translate our | 57 // to avoid our clip killing our outline rect. Thus we translate our |
| 62 // outline rect into parent coords before drawing. | 58 // outline rect into parent coords before drawing. |
| 63 // FIXME: This means our focus ring won't share our rotation like it should. | 59 // FIXME: This means our focus ring won't share our rotation like it should. |
| 64 // We should instead disable our clip during PaintPhaseOutline | 60 // We should instead disable our clip during PaintPhaseOutline |
| 65 if (paintInfo.phase == PaintPhaseForeground && m_renderSVGContainer.style()-
>outlineWidth() && m_renderSVGContainer.style()->visibility() == VISIBLE) { | 61 if (paintInfo.phase == PaintPhaseForeground && m_renderSVGContainer.style()-
>outlineWidth() && m_renderSVGContainer.style()->visibility() == VISIBLE) { |
| 66 IntRect paintRectInParent = enclosingIntRect(m_renderSVGContainer.localT
oParentTransform().mapRect(paintInvalidationRect)); | 62 IntRect paintRectInParent = enclosingIntRect(m_renderSVGContainer.localT
oParentTransform().mapRect(m_renderSVGContainer.paintInvalidationRectInLocalCoor
dinates())); |
| 67 ObjectPainter(m_renderSVGContainer).paintOutline(paintInfo, paintRectInP
arent); | 63 ObjectPainter(m_renderSVGContainer).paintOutline(paintInfo, paintRectInP
arent); |
| 68 } | 64 } |
| 69 } | 65 } |
| 70 | 66 |
| 71 } // namespace blink | 67 } // namespace blink |
| OLD | NEW |