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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // scaling. This can be achieved by setting the image's container size to | 70 // scaling. This can be achieved by setting the image's container size to |
71 // its viewport size (i.e. if a viewBox is available - use that - else use i
ntrinsic size.) | 71 // its viewport size (i.e. if a viewBox is available - use that - else use i
ntrinsic size.) |
72 // See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The ‘preserveAspectRa
tio’ attribute. | 72 // See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The ‘preserveAspectRa
tio’ attribute. |
73 Length intrinsicWidth; | 73 Length intrinsicWidth; |
74 Length intrinsicHeight; | 74 Length intrinsicHeight; |
75 FloatSize intrinsicRatio; | 75 FloatSize intrinsicRatio; |
76 cachedImage.computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intr
insicRatio); | 76 cachedImage.computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intr
insicRatio); |
77 return intrinsicRatio; | 77 return intrinsicRatio; |
78 } | 78 } |
79 | 79 |
80 static bool containerSizeIsSetForRenderer(ImageResource& cachedImage, const Rend
erObject* renderer) | 80 static bool containerSizeIsSetForRenderer(ImageResource& cachedImage, const Layo
utObject* renderer) |
81 { | 81 { |
82 const Image* image = cachedImage.image(); | 82 const Image* image = cachedImage.image(); |
83 // If a container size has been specified for this renderer, then | 83 // If a container size has been specified for this renderer, then |
84 // imageForRenderer() will return the SVGImageForContainer while image() | 84 // imageForRenderer() will return the SVGImageForContainer while image() |
85 // will return the underlying SVGImage. | 85 // will return the underlying SVGImage. |
86 return !image->isSVGImage() || image != cachedImage.imageForRenderer(rendere
r); | 86 return !image->isSVGImage() || image != cachedImage.imageForRenderer(rendere
r); |
87 } | 87 } |
88 | 88 |
89 bool RenderSVGImage::updateImageViewport() | 89 bool RenderSVGImage::updateImageViewport() |
90 { | 90 { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 return false; | 171 return false; |
172 } | 172 } |
173 | 173 |
174 void RenderSVGImage::imageChanged(WrappedImagePtr, const IntRect*) | 174 void RenderSVGImage::imageChanged(WrappedImagePtr, const IntRect*) |
175 { | 175 { |
176 // The image resource defaults to nullImage until the resource arrives. | 176 // The image resource defaults to nullImage until the resource arrives. |
177 // This empty image may be cached by SVG resources which must be invalidated
. | 177 // This empty image may be cached by SVG resources which must be invalidated
. |
178 if (SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObj
ect(this)) | 178 if (SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObj
ect(this)) |
179 resources->removeClientFromCache(this); | 179 resources->removeClientFromCache(this); |
180 | 180 |
181 // Eventually notify parent resources, that we've changed. | 181 // Eventually notify parent resources, that we've changed. |
182 RenderSVGResourceContainer::markForLayoutAndParentResourceInvalidation(this,
false); | 182 RenderSVGResourceContainer::markForLayoutAndParentResourceInvalidation(this,
false); |
183 | 183 |
184 // Update the SVGImageCache sizeAndScales entry in case image loading finish
ed after layout. | 184 // Update the SVGImageCache sizeAndScales entry in case image loading finish
ed after layout. |
185 // (https://bugs.webkit.org/show_bug.cgi?id=99489) | 185 // (https://bugs.webkit.org/show_bug.cgi?id=99489) |
186 m_objectBoundingBox = FloatRect(); | 186 m_objectBoundingBox = FloatRect(); |
187 updateImageViewport(); | 187 updateImageViewport(); |
188 | 188 |
189 m_bufferedForeground.clear(); | 189 m_bufferedForeground.clear(); |
190 | 190 |
191 setShouldDoFullPaintInvalidation(); | 191 setShouldDoFullPaintInvalidation(); |
192 } | 192 } |
193 | 193 |
194 void RenderSVGImage::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPo
int&) const | 194 void RenderSVGImage::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPo
int&) const |
195 { | 195 { |
196 // this is called from paint() after the localTransform has already been app
lied | 196 // this is called from paint() after the localTransform has already been app
lied |
197 LayoutRect contentRect = LayoutRect(paintInvalidationRectInLocalCoordinates(
)); | 197 LayoutRect contentRect = LayoutRect(paintInvalidationRectInLocalCoordinates(
)); |
198 if (!contentRect.isEmpty()) | 198 if (!contentRect.isEmpty()) |
199 rects.append(contentRect); | 199 rects.append(contentRect); |
200 } | 200 } |
201 | 201 |
202 } // namespace blink | 202 } // namespace blink |
OLD | NEW |