| OLD | NEW |
| 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 setNeedsLayout(false); | 254 setNeedsLayout(false); |
| 255 } | 255 } |
| 256 | 256 |
| 257 void RenderSVGRoot::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paint
Offset) | 257 void RenderSVGRoot::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paint
Offset) |
| 258 { | 258 { |
| 259 // An empty viewport disables rendering. | 259 // An empty viewport disables rendering. |
| 260 if (pixelSnappedBorderBoxRect().isEmpty()) | 260 if (pixelSnappedBorderBoxRect().isEmpty()) |
| 261 return; | 261 return; |
| 262 | 262 |
| 263 // Don't paint, if the context explicitly disabled it. | 263 // Don't paint, if the context explicitly disabled it. |
| 264 if (paintInfo.context->paintingDisabled()) | 264 if (paintInfo.getContext()->paintingDisabled()) |
| 265 return; | 265 return; |
| 266 | 266 |
| 267 // An empty viewBox also disables rendering. | 267 // An empty viewBox also disables rendering. |
| 268 // (http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute) | 268 // (http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute) |
| 269 SVGSVGElement* svg = toSVGSVGElement(node()); | 269 SVGSVGElement* svg = toSVGSVGElement(node()); |
| 270 ASSERT(svg); | 270 ASSERT(svg); |
| 271 if (svg->hasEmptyViewBox()) | 271 if (svg->hasEmptyViewBox()) |
| 272 return; | 272 return; |
| 273 | 273 |
| 274 Page* page = 0; | 274 Page* page = 0; |
| 275 if (Frame* frame = this->frame()) | 275 if (Frame* frame = this->frame()) |
| 276 page = frame->page(); | 276 page = frame->page(); |
| 277 | 277 |
| 278 // Don't paint if we don't have kids, except if we have filters we should pa
int those. | 278 // Don't paint if we don't have kids, except if we have filters we should pa
int those. |
| 279 if (!firstChild()) { | 279 if (!firstChild()) { |
| 280 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObj
ect(this); | 280 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObj
ect(this); |
| 281 if (!resources || !resources->filter()) { | 281 if (!resources || !resources->filter()) { |
| 282 if (page && paintInfo.phase == PaintPhaseForeground) | 282 if (page && paintInfo.getPhase() == PaintPhaseForeground) |
| 283 page->addRelevantUnpaintedObject(this, visualOverflowRect()); | 283 page->addRelevantUnpaintedObject(this, visualOverflowRect()); |
| 284 return; | 284 return; |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 | 287 |
| 288 if (page && paintInfo.phase == PaintPhaseForeground) | 288 if (page && paintInfo.getPhase() == PaintPhaseForeground) |
| 289 page->addRelevantRepaintedObject(this, visualOverflowRect()); | 289 page->addRelevantRepaintedObject(this, visualOverflowRect()); |
| 290 | 290 |
| 291 // Make a copy of the PaintInfo because applyTransform will modify the damag
e rect. | 291 // Make a copy of the PaintInfo because applyTransform will modify the damag
e rect. |
| 292 PaintInfo childPaintInfo(paintInfo); | 292 PaintInfo childPaintInfo(paintInfo); |
| 293 childPaintInfo.context->save(); | 293 childPaintInfo.getContext()->save(); |
| 294 | 294 |
| 295 // Apply initial viewport clip - not affected by overflow handling | 295 // Apply initial viewport clip - not affected by overflow handling |
| 296 childPaintInfo.context->clip(pixelSnappedIntRect(overflowClipRect(paintOffse
t, paintInfo.renderRegion))); | 296 childPaintInfo.getContext()->clip(pixelSnappedIntRect(overflowClipRect(paint
Offset, paintInfo.getRenderRegion()))); |
| 297 | 297 |
| 298 // Convert from container offsets (html renderers) to a relative transform (
svg renderers). | 298 // Convert from container offsets (html renderers) to a relative transform (
svg renderers). |
| 299 // Transform from our paint container's coordinate system to our local coord
s. | 299 // Transform from our paint container's coordinate system to our local coord
s. |
| 300 IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset); | 300 IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset); |
| 301 childPaintInfo.applyTransform(AffineTransform::translation(adjustedPaintOffs
et.x(), adjustedPaintOffset.y()) * localToBorderBoxTransform()); | 301 childPaintInfo.applyTransform(AffineTransform::translation(adjustedPaintOffs
et.x(), adjustedPaintOffset.y()) * localToBorderBoxTransform()); |
| 302 | 302 |
| 303 // SVGRenderingContext must be destroyed before we restore the childPaintInf
o.context, because a filter may have | 303 // SVGRenderingContext must be destroyed before we restore the childPaintInf
o.context, because a filter may have |
| 304 // changed the context and it is only reverted when the SVGRenderingContext
destructor finishes applying the filter. | 304 // changed the context and it is only reverted when the SVGRenderingContext
destructor finishes applying the filter. |
| 305 { | 305 { |
| 306 SVGRenderingContext renderingContext; | 306 SVGRenderingContext renderingContext; |
| 307 bool continueRendering = true; | 307 bool continueRendering = true; |
| 308 if (childPaintInfo.phase == PaintPhaseForeground) { | 308 if (childPaintInfo.getPhase() == PaintPhaseForeground) { |
| 309 renderingContext.prepareToRenderSVGContent(this, childPaintInfo); | 309 renderingContext.prepareToRenderSVGContent(this, childPaintInfo); |
| 310 continueRendering = renderingContext.isRenderingPrepared(); | 310 continueRendering = renderingContext.isRenderingPrepared(); |
| 311 } | 311 } |
| 312 | 312 |
| 313 if (continueRendering) | 313 if (continueRendering) |
| 314 RenderBox::paint(childPaintInfo, LayoutPoint()); | 314 RenderBox::paint(childPaintInfo, LayoutPoint()); |
| 315 } | 315 } |
| 316 | 316 |
| 317 childPaintInfo.context->restore(); | 317 childPaintInfo.getContext()->restore(); |
| 318 } | 318 } |
| 319 | 319 |
| 320 void RenderSVGRoot::willBeDestroyed() | 320 void RenderSVGRoot::willBeDestroyed() |
| 321 { | 321 { |
| 322 RenderBlock::removePercentHeightDescendant(const_cast<RenderSVGRoot*>(this))
; | 322 RenderBlock::removePercentHeightDescendant(const_cast<RenderSVGRoot*>(this))
; |
| 323 | 323 |
| 324 SVGResourcesCache::clientDestroyed(this); | 324 SVGResourcesCache::clientDestroyed(this); |
| 325 RenderReplaced::willBeDestroyed(); | 325 RenderReplaced::willBeDestroyed(); |
| 326 } | 326 } |
| 327 | 327 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 { | 482 { |
| 483 RenderObject* svgRoot = resource->parent(); | 483 RenderObject* svgRoot = resource->parent(); |
| 484 while (svgRoot && !svgRoot->isSVGRoot()) | 484 while (svgRoot && !svgRoot->isSVGRoot()) |
| 485 svgRoot = svgRoot->parent(); | 485 svgRoot = svgRoot->parent(); |
| 486 if (!svgRoot) | 486 if (!svgRoot) |
| 487 return; | 487 return; |
| 488 toRenderSVGRoot(svgRoot)->m_resourcesNeedingToInvalidateClients.add(resource
); | 488 toRenderSVGRoot(svgRoot)->m_resourcesNeedingToInvalidateClients.add(resource
); |
| 489 } | 489 } |
| 490 | 490 |
| 491 } | 491 } |
| OLD | NEW |