| 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/layout/svg/LayoutSVGContainer.h" | 8 #include "core/layout/svg/LayoutSVGContainer.h" |
| 9 #include "core/layout/svg/LayoutSVGViewportContainer.h" | 9 #include "core/layout/svg/LayoutSVGViewportContainer.h" |
| 10 #include "core/layout/svg/SVGLayoutSupport.h" | 10 #include "core/layout/svg/SVGLayoutSupport.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 return; | 24 return; |
| 25 | 25 |
| 26 // Spec: An empty viewBox on the <svg> element disables rendering. | 26 // Spec: An empty viewBox on the <svg> element disables rendering. |
| 27 ASSERT(m_layoutSVGContainer.element()); | 27 ASSERT(m_layoutSVGContainer.element()); |
| 28 if (isSVGSVGElement(*m_layoutSVGContainer.element()) && toSVGSVGElement(*m_l
ayoutSVGContainer.element()).hasEmptyViewBox()) | 28 if (isSVGSVGElement(*m_layoutSVGContainer.element()) && toSVGSVGElement(*m_l
ayoutSVGContainer.element()).hasEmptyViewBox()) |
| 29 return; | 29 return; |
| 30 | 30 |
| 31 PaintInfo paintInfoBeforeFiltering(paintInfo); | 31 PaintInfo paintInfoBeforeFiltering(paintInfo); |
| 32 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_lay
outSVGContainer, m_layoutSVGContainer.localToParentTransform()); | 32 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_lay
outSVGContainer, m_layoutSVGContainer.localToParentTransform()); |
| 33 { | 33 { |
| 34 OwnPtr<FloatClipRecorder> clipRecorder; | 34 FloatClipRecorder clipRecorder(*paintInfoBeforeFiltering.context, m_layo
utSVGContainer, paintInfoBeforeFiltering.phase); |
| 35 if (m_layoutSVGContainer.isSVGViewportContainer() && SVGLayoutSupport::i
sOverflowHidden(&m_layoutSVGContainer)) { | 35 if (m_layoutSVGContainer.isSVGViewportContainer() && SVGLayoutSupport::i
sOverflowHidden(&m_layoutSVGContainer)) { |
| 36 FloatRect viewport = m_layoutSVGContainer.localToParentTransform().i
nverse().mapRect(toLayoutSVGViewportContainer(m_layoutSVGContainer).viewport()); | 36 FloatRect viewport = m_layoutSVGContainer.localToParentTransform().i
nverse().mapRect(toLayoutSVGViewportContainer(m_layoutSVGContainer).viewport()); |
| 37 clipRecorder = adoptPtr(new FloatClipRecorder(*paintInfoBeforeFilter
ing.context, m_layoutSVGContainer, paintInfoBeforeFiltering.phase, viewport)); | 37 clipRecorder.begin(viewport); |
| 38 } | 38 } |
| 39 | 39 |
| 40 SVGPaintContext paintContext(m_layoutSVGContainer, paintInfoBeforeFilter
ing); | 40 SVGPaintContext paintContext(m_layoutSVGContainer, paintInfoBeforeFilter
ing); |
| 41 bool continueRendering = true; | 41 bool continueRendering = true; |
| 42 if (paintContext.paintInfo().phase == PaintPhaseForeground) | 42 if (paintContext.paintInfo().phase == PaintPhaseForeground) |
| 43 continueRendering = paintContext.applyClipMaskAndFilterIfNecessary()
; | 43 continueRendering = paintContext.applyClipMaskAndFilterIfNecessary()
; |
| 44 | 44 |
| 45 if (continueRendering) { | 45 if (continueRendering) { |
| 46 paintContext.paintInfo().updatePaintingRootForChildren(&m_layoutSVGC
ontainer); | 46 paintContext.paintInfo().updatePaintingRootForChildren(&m_layoutSVGC
ontainer); |
| 47 for (LayoutObject* child = m_layoutSVGContainer.firstChild(); child;
child = child->nextSibling()) | 47 for (LayoutObject* child = m_layoutSVGContainer.firstChild(); child;
child = child->nextSibling()) |
| 48 child->paint(paintContext.paintInfo(), IntPoint()); | 48 child->paint(paintContext.paintInfo(), IntPoint()); |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 | 51 |
| 52 if (paintInfoBeforeFiltering.phase == PaintPhaseForeground && m_layoutSVGCon
tainer.style()->outlineWidth() && m_layoutSVGContainer.style()->visibility() ==
VISIBLE) { | 52 if (paintInfoBeforeFiltering.phase == PaintPhaseForeground && m_layoutSVGCon
tainer.style()->outlineWidth() && m_layoutSVGContainer.style()->visibility() ==
VISIBLE) { |
| 53 LayoutRect layoutBoundingBox(m_layoutSVGContainer.paintInvalidationRectI
nLocalCoordinates()); | 53 LayoutRect layoutBoundingBox(m_layoutSVGContainer.paintInvalidationRectI
nLocalCoordinates()); |
| 54 ObjectPainter(m_layoutSVGContainer).paintOutline(paintInfoBeforeFilterin
g, layoutBoundingBox, layoutBoundingBox); | 54 ObjectPainter(m_layoutSVGContainer).paintOutline(paintInfoBeforeFilterin
g, layoutBoundingBox, layoutBoundingBox); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace blink | 58 } // namespace blink |
| OLD | NEW |