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

Side by Side Diff: Source/core/layout/svg/LayoutSVGImage.cpp

Issue 963733002: [svg2] Make 'width' and 'height' presentation attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebaseline some EX tests [Mac Win] Created 5 years, 9 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
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 LayoutSVGImage::updateImageViewport() 89 bool LayoutSVGImage::updateImageViewport()
90 { 90 {
91 SVGImageElement* image = toSVGImageElement(element()); 91 SVGImageElement* image = toSVGImageElement(element());
92 FloatRect oldBoundaries = m_objectBoundingBox; 92 FloatRect oldBoundaries = m_objectBoundingBox;
93 93
94 SVGLengthContext lengthContext(image); 94 SVGLengthContext lengthContext(image);
95 m_objectBoundingBox = FloatRect(image->x()->currentValue()->value(lengthCont ext), image->y()->currentValue()->value(lengthContext), image->width()->currentV alue()->value(lengthContext), image->height()->currentValue()->value(lengthConte xt)); 95 m_objectBoundingBox = FloatRect(
96 lengthContext.valueForLength(styleRef().svgStyle().x(), styleRef(), SVGL engthMode::Width),
97 lengthContext.valueForLength(styleRef().svgStyle().y(), styleRef(), SVGL engthMode::Height),
98 lengthContext.valueForLength(styleRef().width(), styleRef(), SVGLengthMo de::Width),
99 lengthContext.valueForLength(styleRef().height(), styleRef(), SVGLengthM ode::Height));
96 bool boundsChanged = oldBoundaries != m_objectBoundingBox; 100 bool boundsChanged = oldBoundaries != m_objectBoundingBox;
97 101
98 bool updatedViewport = false; 102 bool updatedViewport = false;
99 ImageResource* cachedImage = m_imageResource->cachedImage(); 103 ImageResource* cachedImage = m_imageResource->cachedImage();
100 if (cachedImage && cachedImage->usesImageContainerSize()) { 104 if (cachedImage && cachedImage->usesImageContainerSize()) {
101 FloatSize imageViewportSize = computeImageViewportSize(*cachedImage); 105 FloatSize imageViewportSize = computeImageViewportSize(*cachedImage);
102 if (LayoutSize(imageViewportSize) != m_imageResource->imageSize(style()- >effectiveZoom()) 106 if (LayoutSize(imageViewportSize) != m_imageResource->imageSize(styleRef ().effectiveZoom())
103 || !containerSizeIsSetForRenderer(*cachedImage, this)) { 107 || !containerSizeIsSetForRenderer(*cachedImage, this)) {
104 m_imageResource->setContainerSizeForRenderer(roundedIntSize(imageVie wportSize)); 108 m_imageResource->setContainerSizeForRenderer(roundedIntSize(imageVie wportSize));
105 updatedViewport = true; 109 updatedViewport = true;
106 } 110 }
107 } 111 }
108 112
109 m_needsBoundariesUpdate |= boundsChanged; 113 m_needsBoundariesUpdate |= boundsChanged;
110 return updatedViewport || boundsChanged; 114 return updatedViewport || boundsChanged;
111 } 115 }
112 116
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 197
194 void LayoutSVGImage::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPo int&) const 198 void LayoutSVGImage::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPo int&) const
195 { 199 {
196 // this is called from paint() after the localTransform has already been app lied 200 // this is called from paint() after the localTransform has already been app lied
197 LayoutRect contentRect = LayoutRect(paintInvalidationRectInLocalCoordinates( )); 201 LayoutRect contentRect = LayoutRect(paintInvalidationRectInLocalCoordinates( ));
198 if (!contentRect.isEmpty()) 202 if (!contentRect.isEmpty())
199 rects.append(contentRect); 203 rects.append(contentRect);
200 } 204 }
201 205
202 } // namespace blink 206 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/svg/LayoutSVGForeignObject.cpp ('k') | Source/core/layout/svg/LayoutSVGRect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698