| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> | 2 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> |
| 3 * Copyright (C) 2006 Apple Computer, Inc. | 3 * Copyright (C) 2006 Apple Computer, Inc. |
| 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> | 4 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 5 * Copyright (C) 2007, 2008, 2009 Rob Buis <buis@kde.org> | 5 * Copyright (C) 2007, 2008, 2009 Rob Buis <buis@kde.org> |
| 6 * Copyright (C) 2009 Google, Inc. | 6 * Copyright (C) 2009 Google, Inc. |
| 7 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 7 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 8 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> | 8 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 RenderSVGImage::~RenderSVGImage() | 60 RenderSVGImage::~RenderSVGImage() |
| 61 { | 61 { |
| 62 ImageQualityController::remove(this); | 62 ImageQualityController::remove(this); |
| 63 m_imageResource->shutdown(); | 63 m_imageResource->shutdown(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 bool RenderSVGImage::updateImageViewport() | 66 bool RenderSVGImage::updateImageViewport() |
| 67 { | 67 { |
| 68 SVGImageElement* image = static_cast<SVGImageElement*>(node()); | 68 SVGImageElement* image = static_cast<SVGImageElement*>(node()); |
| 69 FloatRect oldBoundaries = m_objectBoundingBox; | 69 FloatRect oldBoundaries = m_objectBoundingBox; |
| 70 bool updatedViewport = false; |
| 70 | 71 |
| 71 SVGLengthContext lengthContext(image); | 72 SVGLengthContext lengthContext(image); |
| 72 m_objectBoundingBox = FloatRect(image->x().value(lengthContext), image->y().
value(lengthContext), image->width().value(lengthContext), image->height().value
(lengthContext)); | 73 m_objectBoundingBox = FloatRect(image->x().value(lengthContext), image->y().
value(lengthContext), image->width().value(lengthContext), image->height().value
(lengthContext)); |
| 73 | 74 |
| 74 if (oldBoundaries == m_objectBoundingBox) | 75 // Images with preserveAspectRatio=none should force non-uniform scaling. Th
is can be achieved |
| 75 return false; | 76 // by setting the image's container size to its intrinsic size. |
| 77 // See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The ‘preserveAspectRa
tio’ attribute. |
| 78 if (image->preserveAspectRatio().align() == SVGPreserveAspectRatio::SVG_PRES
ERVEASPECTRATIO_NONE) { |
| 79 if (CachedImage* cachedImage = m_imageResource->cachedImage()) { |
| 80 LayoutSize intrinsicSize = cachedImage->imageSizeForRenderer(0, styl
e()->effectiveZoom()); |
| 81 if (intrinsicSize != m_imageResource->imageSize(style()->effectiveZo
om())) { |
| 82 m_imageResource->setContainerSizeForRenderer(roundedIntSize(intr
insicSize)); |
| 83 updatedViewport = true; |
| 84 } |
| 85 } |
| 86 } |
| 76 | 87 |
| 77 m_imageResource->setContainerSizeForRenderer(enclosingIntRect(m_objectBoundi
ngBox).size()); | 88 if (oldBoundaries != m_objectBoundingBox) { |
| 78 m_needsBoundariesUpdate = true; | 89 if (!updatedViewport) |
| 79 return true; | 90 m_imageResource->setContainerSizeForRenderer(enclosingIntRect(m_obje
ctBoundingBox).size()); |
| 91 updatedViewport = true; |
| 92 m_needsBoundariesUpdate = true; |
| 93 } |
| 94 |
| 95 return updatedViewport; |
| 80 } | 96 } |
| 81 | 97 |
| 82 void RenderSVGImage::layout() | 98 void RenderSVGImage::layout() |
| 83 { | 99 { |
| 84 StackStats::LayoutCheckPoint layoutCheckPoint; | 100 StackStats::LayoutCheckPoint layoutCheckPoint; |
| 85 ASSERT(needsLayout()); | 101 ASSERT(needsLayout()); |
| 86 | 102 |
| 87 LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringL
ayout(this) && selfNeedsLayout()); | 103 LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringL
ayout(this) && selfNeedsLayout()); |
| 88 updateImageViewport(); | 104 updateImageViewport(); |
| 89 | 105 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 { | 232 { |
| 217 // this is called from paint() after the localTransform has already been app
lied | 233 // this is called from paint() after the localTransform has already been app
lied |
| 218 IntRect contentRect = enclosingIntRect(repaintRectInLocalCoordinates()); | 234 IntRect contentRect = enclosingIntRect(repaintRectInLocalCoordinates()); |
| 219 if (!contentRect.isEmpty()) | 235 if (!contentRect.isEmpty()) |
| 220 rects.append(contentRect); | 236 rects.append(contentRect); |
| 221 } | 237 } |
| 222 | 238 |
| 223 } // namespace WebCore | 239 } // namespace WebCore |
| 224 | 240 |
| 225 #endif // ENABLE(SVG) | 241 #endif // ENABLE(SVG) |
| OLD | NEW |