Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: Source/core/paint/SVGContainerPainter.cpp

Issue 921633007: Move the SVG container code from rendering/svg to layout/svg. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/PaintInfo.h" 8 #include "core/layout/PaintInfo.h"
9 #include "core/layout/svg/LayoutSVGContainer.h" 9 #include "core/layout/svg/LayoutSVGContainer.h"
10 #include "core/layout/svg/LayoutSVGViewportContainer.h"
10 #include "core/layout/svg/SVGLayoutSupport.h" 11 #include "core/layout/svg/SVGLayoutSupport.h"
11 #include "core/paint/FloatClipRecorder.h" 12 #include "core/paint/FloatClipRecorder.h"
12 #include "core/paint/GraphicsContextAnnotator.h" 13 #include "core/paint/GraphicsContextAnnotator.h"
13 #include "core/paint/ObjectPainter.h" 14 #include "core/paint/ObjectPainter.h"
14 #include "core/paint/SVGPaintContext.h" 15 #include "core/paint/SVGPaintContext.h"
15 #include "core/paint/TransformRecorder.h" 16 #include "core/paint/TransformRecorder.h"
16 #include "core/rendering/svg/RenderSVGViewportContainer.h"
17 #include "core/svg/SVGSVGElement.h" 17 #include "core/svg/SVGSVGElement.h"
18 18
19 namespace blink { 19 namespace blink {
20 20
21 void SVGContainerPainter::paint(const PaintInfo& paintInfo) 21 void SVGContainerPainter::paint(const PaintInfo& paintInfo)
22 { 22 {
23 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderSVGContainer); 23 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, &m_renderSVGContainer);
24 24
25 // Spec: groups w/o children still may render filter content. 25 // Spec: groups w/o children still may render filter content.
26 if (!m_renderSVGContainer.firstChild() && !m_renderSVGContainer.selfWillPain t()) 26 if (!m_renderSVGContainer.firstChild() && !m_renderSVGContainer.selfWillPain t())
27 return; 27 return;
28 28
29 // Spec: An empty viewBox on the <svg> element disables rendering. 29 // Spec: An empty viewBox on the <svg> element disables rendering.
30 ASSERT(m_renderSVGContainer.element()); 30 ASSERT(m_renderSVGContainer.element());
31 if (isSVGSVGElement(*m_renderSVGContainer.element()) && toSVGSVGElement(*m_r enderSVGContainer.element()).hasEmptyViewBox()) 31 if (isSVGSVGElement(*m_renderSVGContainer.element()) && toSVGSVGElement(*m_r enderSVGContainer.element()).hasEmptyViewBox())
32 return; 32 return;
33 33
34 PaintInfo paintInfoBeforeFiltering(paintInfo); 34 PaintInfo paintInfoBeforeFiltering(paintInfo);
35 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_ren derSVGContainer.displayItemClient(), m_renderSVGContainer.localToParentTransform ()); 35 TransformRecorder transformRecorder(*paintInfoBeforeFiltering.context, m_ren derSVGContainer.displayItemClient(), m_renderSVGContainer.localToParentTransform ());
36 { 36 {
37 OwnPtr<FloatClipRecorder> clipRecorder; 37 OwnPtr<FloatClipRecorder> clipRecorder;
38 if (m_renderSVGContainer.isSVGViewportContainer() && SVGLayoutSupport::i sOverflowHidden(&m_renderSVGContainer)) { 38 if (m_renderSVGContainer.isSVGViewportContainer() && SVGLayoutSupport::i sOverflowHidden(&m_renderSVGContainer)) {
39 FloatRect viewport = m_renderSVGContainer.localToParentTransform().i nverse().mapRect(toRenderSVGViewportContainer(m_renderSVGContainer).viewport()); 39 FloatRect viewport = m_renderSVGContainer.localToParentTransform().i nverse().mapRect(toLayoutSVGViewportContainer(m_renderSVGContainer).viewport());
40 clipRecorder = adoptPtr(new FloatClipRecorder(*paintInfoBeforeFilter ing.context, m_renderSVGContainer.displayItemClient(), paintInfoBeforeFiltering. phase, viewport)); 40 clipRecorder = adoptPtr(new FloatClipRecorder(*paintInfoBeforeFilter ing.context, m_renderSVGContainer.displayItemClient(), paintInfoBeforeFiltering. phase, viewport));
41 } 41 }
42 42
43 SVGPaintContext paintContext(m_renderSVGContainer, paintInfoBeforeFilter ing); 43 SVGPaintContext paintContext(m_renderSVGContainer, paintInfoBeforeFilter ing);
44 bool continueRendering = true; 44 bool continueRendering = true;
45 if (paintContext.paintInfo().phase == PaintPhaseForeground) 45 if (paintContext.paintInfo().phase == PaintPhaseForeground)
46 continueRendering = paintContext.applyClipMaskAndFilterIfNecessary() ; 46 continueRendering = paintContext.applyClipMaskAndFilterIfNecessary() ;
47 47
48 if (continueRendering) { 48 if (continueRendering) {
49 paintContext.paintInfo().updatePaintingRootForChildren(&m_renderSVGC ontainer); 49 paintContext.paintInfo().updatePaintingRootForChildren(&m_renderSVGC ontainer);
50 for (LayoutObject* child = m_renderSVGContainer.firstChild(); child; child = child->nextSibling()) 50 for (LayoutObject* child = m_renderSVGContainer.firstChild(); child; child = child->nextSibling())
51 child->paint(paintContext.paintInfo(), IntPoint()); 51 child->paint(paintContext.paintInfo(), IntPoint());
52 } 52 }
53 } 53 }
54 54
55 if (paintInfoBeforeFiltering.phase == PaintPhaseForeground && m_renderSVGCon tainer.style()->outlineWidth() && m_renderSVGContainer.style()->visibility() == VISIBLE) 55 if (paintInfoBeforeFiltering.phase == PaintPhaseForeground && m_renderSVGCon tainer.style()->outlineWidth() && m_renderSVGContainer.style()->visibility() == VISIBLE)
56 ObjectPainter(m_renderSVGContainer).paintOutline(paintInfoBeforeFilterin g, LayoutRect(m_renderSVGContainer.paintInvalidationRectInLocalCoordinates())); 56 ObjectPainter(m_renderSVGContainer).paintOutline(paintInfoBeforeFilterin g, LayoutRect(m_renderSVGContainer.paintInvalidationRectInLocalCoordinates()));
57 } 57 }
58 58
59 } // namespace blink 59 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/svg/SVGLayoutSupport.cpp ('k') | Source/core/rendering/svg/RenderSVGHiddenContainer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698