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

Unified 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: test fixes 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/layout/svg/LayoutSVGImage.cpp
diff --git a/Source/core/layout/svg/LayoutSVGImage.cpp b/Source/core/layout/svg/LayoutSVGImage.cpp
index 1a7140412d0bddf002c2895a4377e1d317dcb52e..e1adf5a7e8765ca56470c54d270658ef5ddb6670 100644
--- a/Source/core/layout/svg/LayoutSVGImage.cpp
+++ b/Source/core/layout/svg/LayoutSVGImage.cpp
@@ -92,14 +92,19 @@ bool LayoutSVGImage::updateImageViewport()
FloatRect oldBoundaries = m_objectBoundingBox;
SVGLengthContext lengthContext(image);
- m_objectBoundingBox = FloatRect(image->x()->currentValue()->value(lengthContext), image->y()->currentValue()->value(lengthContext), image->width()->currentValue()->value(lengthContext), image->height()->currentValue()->value(lengthContext));
+ const LayoutStyle& style = image->layoutObject()->styleRef();
fs 2015/03/12 14:28:48 image->layoutObject()->styleRef() => styleRef()
Erik Dahlström (inactive) 2015/03/12 16:14:56 Done.
+ m_objectBoundingBox = FloatRect(
+ lengthContext.valueForLength(style.svgStyle().x(), style, SVGLengthMode::Width),
+ lengthContext.valueForLength(style.svgStyle().y(), style, SVGLengthMode::Height),
+ lengthContext.valueForLength(style.width(), style, SVGLengthMode::Width),
+ lengthContext.valueForLength(style.height(), style, SVGLengthMode::Height));
fs 2015/03/12 14:28:48 Almost looks like style.svgStyle().x(), style.svg
Erik Dahlström (inactive) 2015/03/12 16:14:56 np, I'll do that as a followup.
bool boundsChanged = oldBoundaries != m_objectBoundingBox;
bool updatedViewport = false;
ImageResource* cachedImage = m_imageResource->cachedImage();
if (cachedImage && cachedImage->usesImageContainerSize()) {
FloatSize imageViewportSize = computeImageViewportSize(*cachedImage);
- if (LayoutSize(imageViewportSize) != m_imageResource->imageSize(style()->effectiveZoom())
+ if (LayoutSize(imageViewportSize) != m_imageResource->imageSize(style.effectiveZoom())
|| !containerSizeIsSetForRenderer(*cachedImage, this)) {
m_imageResource->setContainerSizeForRenderer(roundedIntSize(imageViewportSize));
updatedViewport = true;

Powered by Google App Engine
This is Rietveld 408576698