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

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

Issue 908243002: Move rendering/svg/RenderSVGResource* 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
« no previous file with comments | « Source/core/paint/SVGPaintContext.h ('k') | Source/core/paint/SVGShapePainter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org> 2 * Copyright (C) 2007, 2008 Rob Buis <buis@kde.org>
3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. All rights reserved. 5 * Copyright (C) 2009 Google, Inc. All rights reserved.
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 10 matching lines...) Expand all
21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA. 22 * Boston, MA 02110-1301, USA.
23 */ 23 */
24 24
25 #include "config.h" 25 #include "config.h"
26 #include "core/paint/SVGPaintContext.h" 26 #include "core/paint/SVGPaintContext.h"
27 27
28 #include "core/frame/FrameHost.h" 28 #include "core/frame/FrameHost.h"
29 #include "core/layout/Layer.h" 29 #include "core/layout/Layer.h"
30 #include "core/layout/PaintInfo.h" 30 #include "core/layout/PaintInfo.h"
31 #include "core/layout/svg/LayoutSVGResourceFilter.h"
32 #include "core/layout/svg/LayoutSVGResourceMasker.h"
31 #include "core/layout/svg/SVGLayoutSupport.h" 33 #include "core/layout/svg/SVGLayoutSupport.h"
32 #include "core/layout/svg/SVGResources.h" 34 #include "core/layout/svg/SVGResources.h"
33 #include "core/layout/svg/SVGResourcesCache.h" 35 #include "core/layout/svg/SVGResourcesCache.h"
34 #include "core/paint/RenderDrawingRecorder.h" 36 #include "core/paint/RenderDrawingRecorder.h"
35 #include "core/rendering/svg/RenderSVGResourceFilter.h"
36 #include "core/rendering/svg/RenderSVGResourceMasker.h"
37 #include "platform/FloatConversion.h" 37 #include "platform/FloatConversion.h"
38 38
39 namespace blink { 39 namespace blink {
40 40
41 SVGPaintContext::~SVGPaintContext() 41 SVGPaintContext::~SVGPaintContext()
42 { 42 {
43 if (m_filter) { 43 if (m_filter) {
44 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)); 44 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object));
45 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)->filt er() == m_filter); 45 ASSERT(SVGResourcesCache::cachedResourcesForLayoutObject(m_object)->filt er() == m_filter);
46 46
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 CompositeOperator compositeOp = hasBlendMode ? CompositeSourceOver : m_p aintInfo.context->compositeOperationDeprecated(); 118 CompositeOperator compositeOp = hasBlendMode ? CompositeSourceOver : m_p aintInfo.context->compositeOperationDeprecated();
119 m_compositingRecorder = adoptPtr(new CompositingRecorder(m_paintInfo.con text, m_object->displayItemClient(), compositeOp, blendMode, opacity, compositeO p)); 119 m_compositingRecorder = adoptPtr(new CompositingRecorder(m_paintInfo.con text, m_object->displayItemClient(), compositeOp, blendMode, opacity, compositeO p));
120 } 120 }
121 } 121 }
122 122
123 bool SVGPaintContext::applyClipIfNecessary(SVGResources* resources) 123 bool SVGPaintContext::applyClipIfNecessary(SVGResources* resources)
124 { 124 {
125 // resources->clipper() corresponds to the non-prefixed 'clip-path' whereas 125 // resources->clipper() corresponds to the non-prefixed 'clip-path' whereas
126 // m_object->style()->clipPath() corresponds to '-webkit-clip-path'. 126 // m_object->style()->clipPath() corresponds to '-webkit-clip-path'.
127 // FIXME: We should unify the clip-path and -webkit-clip-path codepaths. 127 // FIXME: We should unify the clip-path and -webkit-clip-path codepaths.
128 if (RenderSVGResourceClipper* clipper = resources ? resources->clipper() : n ullptr) { 128 if (LayoutSVGResourceClipper* clipper = resources ? resources->clipper() : n ullptr) {
129 if (!clipper->applyStatefulResource(m_object, m_paintInfo.context, m_cli pperState)) 129 if (!clipper->applyStatefulResource(m_object, m_paintInfo.context, m_cli pperState))
130 return false; 130 return false;
131 m_clipper = clipper; 131 m_clipper = clipper;
132 } else { 132 } else {
133 ClipPathOperation* clipPathOperation = m_object->style()->clipPath(); 133 ClipPathOperation* clipPathOperation = m_object->style()->clipPath();
134 if (clipPathOperation && clipPathOperation->type() == ClipPathOperation: :SHAPE) { 134 if (clipPathOperation && clipPathOperation->type() == ClipPathOperation: :SHAPE) {
135 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(clipPath Operation); 135 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(clipPath Operation);
136 if (!clipPath->isValid()) 136 if (!clipPath->isValid())
137 return false; 137 return false;
138 m_clipPathRecorder = adoptPtr(new ClipPathRecorder(*m_paintInfo.cont ext, m_object->displayItemClient(), clipPath->path(m_object->objectBoundingBox() ), clipPath->windRule())); 138 m_clipPathRecorder = adoptPtr(new ClipPathRecorder(*m_paintInfo.cont ext, m_object->displayItemClient(), clipPath->path(m_object->objectBoundingBox() ), clipPath->windRule()));
139 } 139 }
140 } 140 }
141 return true; 141 return true;
142 } 142 }
143 143
144 bool SVGPaintContext::applyMaskIfNecessary(SVGResources* resources) 144 bool SVGPaintContext::applyMaskIfNecessary(SVGResources* resources)
145 { 145 {
146 if (RenderSVGResourceMasker* masker = resources ? resources->masker() : null ptr) { 146 if (LayoutSVGResourceMasker* masker = resources ? resources->masker() : null ptr) {
147 if (!masker->prepareEffect(m_object, m_paintInfo.context)) 147 if (!masker->prepareEffect(m_object, m_paintInfo.context))
148 return false; 148 return false;
149 m_masker = masker; 149 m_masker = masker;
150 } 150 }
151 return true; 151 return true;
152 } 152 }
153 153
154 bool SVGPaintContext::applyFilterIfNecessary(SVGResources* resources) 154 bool SVGPaintContext::applyFilterIfNecessary(SVGResources* resources)
155 { 155 {
156 if (!resources) { 156 if (!resources) {
157 if (m_object->style()->svgStyle().hasFilter()) 157 if (m_object->style()->svgStyle().hasFilter())
158 return false; 158 return false;
159 } else if (RenderSVGResourceFilter* filter = resources->filter()) { 159 } else if (LayoutSVGResourceFilter* filter = resources->filter()) {
160 m_filter = filter; 160 m_filter = filter;
161 GraphicsContext* filterContext = filter->prepareEffect(m_object, m_paint Info.context); 161 GraphicsContext* filterContext = filter->prepareEffect(m_object, m_paint Info.context);
162 if (!filterContext) 162 if (!filterContext)
163 return false; 163 return false;
164 164
165 // Because the filter needs to cache its contents we replace the context 165 // Because the filter needs to cache its contents we replace the context
166 // during filtering with the filter's context. 166 // during filtering with the filter's context.
167 m_paintInfo.context = filterContext; 167 m_paintInfo.context = filterContext;
168 168
169 // Because we cache the filter contents and do not invalidate on paint 169 // Because we cache the filter contents and do not invalidate on paint
170 // invalidation rect changes, we need to paint the entire filter region 170 // invalidation rect changes, we need to paint the entire filter region
171 // so elements outside the initial paint (due to scrolling, etc) paint. 171 // so elements outside the initial paint (due to scrolling, etc) paint.
172 m_paintInfo.rect = LayoutRect::infiniteIntRect(); 172 m_paintInfo.rect = LayoutRect::infiniteIntRect();
173 } 173 }
174 return true; 174 return true;
175 } 175 }
176 176
177 bool SVGPaintContext::isIsolationInstalled() const 177 bool SVGPaintContext::isIsolationInstalled() const
178 { 178 {
179 if (m_compositingRecorder) 179 if (m_compositingRecorder)
180 return true; 180 return true;
181 if (m_masker || m_filter) 181 if (m_masker || m_filter)
182 return true; 182 return true;
183 if (m_clipper && m_clipperState == RenderSVGResourceClipper::ClipperAppliedM ask) 183 if (m_clipper && m_clipperState == LayoutSVGResourceClipper::ClipperAppliedM ask)
184 return true; 184 return true;
185 return false; 185 return false;
186 } 186 }
187 187
188 void SVGPaintContext::paintSubtree(GraphicsContext* context, LayoutObject* item) 188 void SVGPaintContext::paintSubtree(GraphicsContext* context, LayoutObject* item)
189 { 189 {
190 ASSERT(context); 190 ASSERT(context);
191 ASSERT(item); 191 ASSERT(item);
192 ASSERT(!item->needsLayout()); 192 ASSERT(!item->needsLayout());
193 193
194 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForeground, PaintBehaviorNormal); 194 PaintInfo info(context, LayoutRect::infiniteIntRect(), PaintPhaseForeground, PaintBehaviorNormal);
195 item->paint(info, IntPoint()); 195 item->paint(info, IntPoint());
196 } 196 }
197 197
198 } // namespace blink 198 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/SVGPaintContext.h ('k') | Source/core/paint/SVGShapePainter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698