LEFT | RIGHT |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2007, 2008, 2009 Rob Buis <buis@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. | 5 * Copyright (C) 2009 Google, Inc. |
6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 void RenderSVGRoot::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paint
Offset) | 208 void RenderSVGRoot::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paint
Offset) |
209 { | 209 { |
210 // An empty viewport disables rendering. | 210 // An empty viewport disables rendering. |
211 if (borderBoxRect().isEmpty()) | 211 if (borderBoxRect().isEmpty()) |
212 return; | 212 return; |
213 | 213 |
214 // Don't paint, if the context explicitly disabled it. | 214 // Don't paint, if the context explicitly disabled it. |
215 if (paintInfo.context().paintingDisabled()) | 215 if (paintInfo.context().paintingDisabled()) |
216 return; | 216 return; |
217 | 217 |
218 // SVG outlines are painted during PaintPhaseForeground. | 218 // SVG outlines are painted during PaintPhase::Foreground. |
219 if (paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSel
fOutline) | 219 if (paintInfo.phase == PaintPhase::Outline || paintInfo.phase == PaintPhase:
:SelfOutline) |
220 return; | 220 return; |
221 | 221 |
222 // An empty viewBox also disables rendering. | 222 // An empty viewBox also disables rendering. |
223 // (http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute) | 223 // (http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute) |
224 if (svgSVGElement().hasEmptyViewBox()) | 224 if (svgSVGElement().hasEmptyViewBox()) |
225 return; | 225 return; |
226 | 226 |
227 // Don't paint if we don't have kids, except if we have filters we should pa
int those. | 227 // Don't paint if we don't have kids, except if we have filters we should pa
int those. |
228 if (!firstChild()) { | 228 if (!firstChild()) { |
229 auto* resources = SVGResourcesCache::cachedResourcesForRenderer(*this); | 229 auto* resources = SVGResourcesCache::cachedResourcesForRenderer(*this); |
230 if (!resources || !resources->filter()) { | 230 if (!resources || !resources->filter()) { |
231 if (paintInfo.phase == PaintPhaseForeground) | 231 if (paintInfo.phase == PaintPhase::Foreground) |
232 page().addRelevantUnpaintedObject(this, visualOverflowRect()); | 232 page().addRelevantUnpaintedObject(this, visualOverflowRect()); |
233 return; | 233 return; |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 if (paintInfo.phase == PaintPhaseForeground) | 237 if (paintInfo.phase == PaintPhase::Foreground) |
238 page().addRelevantRepaintedObject(this, visualOverflowRect()); | 238 page().addRelevantRepaintedObject(this, visualOverflowRect()); |
239 | 239 |
240 // Make a copy of the PaintInfo because applyTransform will modify the damag
e rect. | 240 // Make a copy of the PaintInfo because applyTransform will modify the damag
e rect. |
241 PaintInfo childPaintInfo(paintInfo); | 241 PaintInfo childPaintInfo(paintInfo); |
242 childPaintInfo.context().save(); | 242 childPaintInfo.context().save(); |
243 | 243 |
244 // Apply initial viewport clip | 244 // Apply initial viewport clip |
245 if (shouldApplyViewportClip()) | 245 if (shouldApplyViewportClip()) |
246 childPaintInfo.context().clip(snappedIntRect(overflowClipRect(paintOffse
t))); | 246 childPaintInfo.context().clip(snappedIntRect(overflowClipRect(paintOffse
t))); |
247 | 247 |
248 // Convert from container offsets (html renderers) to a relative transform (
svg renderers). | 248 // Convert from container offsets (html renderers) to a relative transform (
svg renderers). |
249 // Transform from our paint container's coordinate system to our local coord
s. | 249 // Transform from our paint container's coordinate system to our local coord
s. |
250 IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset); | 250 IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset); |
251 childPaintInfo.applyTransform(AffineTransform::translation(adjustedPaintOffs
et.x(), adjustedPaintOffset.y()) * localToBorderBoxTransform()); | 251 childPaintInfo.applyTransform(AffineTransform::translation(adjustedPaintOffs
et.x(), adjustedPaintOffset.y()) * localToBorderBoxTransform()); |
252 | 252 |
253 // SVGRenderingContext must be destroyed before we restore the childPaintInf
o.context(), because a filter may have | 253 // SVGRenderingContext must be destroyed before we restore the childPaintInf
o.context(), because a filter may have |
254 // changed the context and it is only reverted when the SVGRenderingContext
destructor finishes applying the filter. | 254 // changed the context and it is only reverted when the SVGRenderingContext
destructor finishes applying the filter. |
255 { | 255 { |
256 SVGRenderingContext renderingContext; | 256 SVGRenderingContext renderingContext; |
257 bool continueRendering = true; | 257 bool continueRendering = true; |
258 if (childPaintInfo.phase == PaintPhaseForeground) { | 258 if (childPaintInfo.phase == PaintPhase::Foreground) { |
259 renderingContext.prepareToRenderSVGContent(*this, childPaintInfo); | 259 renderingContext.prepareToRenderSVGContent(*this, childPaintInfo); |
260 continueRendering = renderingContext.isRenderingPrepared(); | 260 continueRendering = renderingContext.isRenderingPrepared(); |
261 } | 261 } |
262 | 262 |
263 if (continueRendering) { | 263 if (continueRendering) { |
264 childPaintInfo.updateSubtreePaintRootForChildren(this); | 264 childPaintInfo.updateSubtreePaintRootForChildren(this); |
265 for (auto& child : childrenOfType<RenderElement>(*this)) | 265 for (auto& child : childrenOfType<RenderElement>(*this)) |
266 child.paint(childPaintInfo, location()); | 266 child.paint(childPaintInfo, location()); |
267 } | 267 } |
268 } | 268 } |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 435 |
436 void RenderSVGRoot::addResourceForClientInvalidation(RenderSVGResourceContainer*
resource) | 436 void RenderSVGRoot::addResourceForClientInvalidation(RenderSVGResourceContainer*
resource) |
437 { | 437 { |
438 RenderSVGRoot* svgRoot = SVGRenderSupport::findTreeRootObject(*resource); | 438 RenderSVGRoot* svgRoot = SVGRenderSupport::findTreeRootObject(*resource); |
439 if (!svgRoot) | 439 if (!svgRoot) |
440 return; | 440 return; |
441 svgRoot->m_resourcesNeedingToInvalidateClients.add(resource); | 441 svgRoot->m_resourcesNeedingToInvalidateClients.add(resource); |
442 } | 442 } |
443 | 443 |
444 } | 444 } |
LEFT | RIGHT |