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

Side by Side Diff: Source/core/rendering/svg/RenderSVGImage.cpp

Issue 19097005: Remove one SVG animated type special case from the bindings generator (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix the regressions Created 7 years, 5 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 /* 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 m_imageResource->shutdown(); 55 m_imageResource->shutdown();
56 } 56 }
57 57
58 bool RenderSVGImage::updateImageViewport() 58 bool RenderSVGImage::updateImageViewport()
59 { 59 {
60 SVGImageElement* image = toSVGImageElement(node()); 60 SVGImageElement* image = toSVGImageElement(node());
61 FloatRect oldBoundaries = m_objectBoundingBox; 61 FloatRect oldBoundaries = m_objectBoundingBox;
62 bool updatedViewport = false; 62 bool updatedViewport = false;
63 63
64 SVGLengthContext lengthContext(image); 64 SVGLengthContext lengthContext(image);
65 m_objectBoundingBox = FloatRect(image->x().value(lengthContext), image->y(). value(lengthContext), image->width().value(lengthContext), image->height().value (lengthContext)); 65 m_objectBoundingBox = FloatRect(image->xCurrentValue().value(lengthContext), image->yCurrentValue().value(lengthContext), image->widthCurrentValue().value(l engthContext), image->heightCurrentValue().value(lengthContext));
66 66
67 // Images with preserveAspectRatio=none should force non-uniform scaling. Th is can be achieved 67 // Images with preserveAspectRatio=none should force non-uniform scaling. Th is can be achieved
68 // by setting the image's container size to its intrinsic size. 68 // by setting the image's container size to its intrinsic size.
69 // See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The ‘preserveAspectRa tio’ attribute. 69 // See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The ‘preserveAspectRa tio’ attribute.
70 if (image->preserveAspectRatio().align() == SVGPreserveAspectRatio::SVG_PRES ERVEASPECTRATIO_NONE) { 70 if (image->preserveAspectRatioCurrentValue().align() == SVGPreserveAspectRat io::SVG_PRESERVEASPECTRATIO_NONE) {
71 if (CachedImage* cachedImage = m_imageResource->cachedImage()) { 71 if (CachedImage* cachedImage = m_imageResource->cachedImage()) {
72 LayoutSize intrinsicSize = cachedImage->imageSizeForRenderer(0, styl e()->effectiveZoom()); 72 LayoutSize intrinsicSize = cachedImage->imageSizeForRenderer(0, styl e()->effectiveZoom());
73 if (intrinsicSize != m_imageResource->imageSize(style()->effectiveZo om())) { 73 if (intrinsicSize != m_imageResource->imageSize(style()->effectiveZo om())) {
74 m_imageResource->setContainerSizeForRenderer(roundedIntSize(intr insicSize)); 74 m_imageResource->setContainerSizeForRenderer(roundedIntSize(intr insicSize));
75 updatedViewport = true; 75 updatedViewport = true;
76 } 76 }
77 } 77 }
78 } 78 }
79 79
80 if (oldBoundaries != m_objectBoundingBox) { 80 if (oldBoundaries != m_objectBoundingBox) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 156 }
157 } 157 }
158 158
159 void RenderSVGImage::paintForeground(PaintInfo& paintInfo) 159 void RenderSVGImage::paintForeground(PaintInfo& paintInfo)
160 { 160 {
161 RefPtr<Image> image = m_imageResource->image(); 161 RefPtr<Image> image = m_imageResource->image();
162 FloatRect destRect = m_objectBoundingBox; 162 FloatRect destRect = m_objectBoundingBox;
163 FloatRect srcRect(0, 0, image->width(), image->height()); 163 FloatRect srcRect(0, 0, image->width(), image->height());
164 164
165 SVGImageElement* imageElement = toSVGImageElement(node()); 165 SVGImageElement* imageElement = toSVGImageElement(node());
166 imageElement->preserveAspectRatio().transformRect(destRect, srcRect); 166 imageElement->preserveAspectRatioCurrentValue().transformRect(destRect, srcR ect);
167 167
168 bool useLowQualityScaling = false; 168 bool useLowQualityScaling = false;
169 if (style()->svgStyle()->bufferedRendering() != BR_STATIC) 169 if (style()->svgStyle()->bufferedRendering() != BR_STATIC)
170 useLowQualityScaling = ImageQualityController::imageQualityController()- >shouldPaintAtLowQuality(paintInfo.context, this, image.get(), image.get(), Layo utSize(destRect.size())); 170 useLowQualityScaling = ImageQualityController::imageQualityController()- >shouldPaintAtLowQuality(paintInfo.context, this, image.get(), image.get(), Layo utSize(destRect.size()));
171 171
172 paintInfo.context->drawImage(image.get(), destRect, srcRect, CompositeSource Over, DoNotRespectImageOrientation, useLowQualityScaling); 172 paintInfo.context->drawImage(image.get(), destRect, srcRect, CompositeSource Over, DoNotRespectImageOrientation, useLowQualityScaling);
173 } 173 }
174 174
175 void RenderSVGImage::invalidateBufferedForeground() 175 void RenderSVGImage::invalidateBufferedForeground()
176 { 176 {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 void RenderSVGImage::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint &, const RenderLayerModelObject*) 225 void RenderSVGImage::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint &, const RenderLayerModelObject*)
226 { 226 {
227 // this is called from paint() after the localTransform has already been app lied 227 // this is called from paint() after the localTransform has already been app lied
228 IntRect contentRect = enclosingIntRect(repaintRectInLocalCoordinates()); 228 IntRect contentRect = enclosingIntRect(repaintRectInLocalCoordinates());
229 if (!contentRect.isEmpty()) 229 if (!contentRect.isEmpty())
230 rects.append(contentRect); 230 rects.append(contentRect);
231 } 231 }
232 232
233 } // namespace WebCore 233 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698