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

Unified Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp

Issue 1427943002: Wrap SVGImage for container during paint (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use IntSize for SVGImageForContainer Created 5 years, 1 month 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: third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp
index 823f99d6bd660a641f067e130cf43d43f034dc25..e426124d1d6765ede4c0e5b51fd28839e57b8f79 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.cpp
@@ -63,43 +63,6 @@ void LayoutSVGImage::willBeDestroyed()
LayoutSVGModelObject::willBeDestroyed();
}
-FloatSize LayoutSVGImage::computeImageViewportSize(ImageResource& cachedImage) const
-{
- if (toSVGImageElement(element())->preserveAspectRatio()->currentValue()->align() != SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE)
- return m_objectBoundingBox.size();
-
- // Images with preserveAspectRatio=none should force non-uniform
- // scaling. This can be achieved by setting the image's container size to
- // its viewport size (i.e. if a viewBox is available - use that - else use intrinsic size.)
- // See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The 'preserveAspectRatio' attribute.
- Length intrinsicWidth;
- Length intrinsicHeight;
- FloatSize intrinsicRatio;
- cachedImage.computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio);
- return intrinsicRatio;
-}
-
-static bool containerSizeIsSetForLayoutObject(ImageResource& cachedImage, const LayoutObject* layoutObject)
-{
- const Image* image = cachedImage.image();
- // If a container size has been specified for this layoutObject, then
- // imageForLayoutObject() will return the SVGImageForContainer while image()
- // will return the underlying SVGImage.
- return !image->isSVGImage() || image != cachedImage.imageForLayoutObject(layoutObject);
-}
-
-void LayoutSVGImage::updateImageContainerSize()
-{
- ImageResource* cachedImage = m_imageResource->cachedImage();
- if (!cachedImage || !cachedImage->usesImageContainerSize())
- return;
- FloatSize imageViewportSize = computeImageViewportSize(*cachedImage);
- if (LayoutSize(imageViewportSize) != m_imageResource->imageSize(styleRef().effectiveZoom())
- || !containerSizeIsSetForLayoutObject(*cachedImage, this)) {
- m_imageResource->setContainerSizeForLayoutObject(roundedIntSize(imageViewportSize));
- }
-}
-
void LayoutSVGImage::updateBoundingBox()
{
FloatRect oldBoundaries = m_objectBoundingBox;
@@ -119,7 +82,6 @@ void LayoutSVGImage::layout()
LayoutAnalyzer::Scope analyzer(*this);
updateBoundingBox();
- updateImageContainerSize();
bool transformOrBoundariesUpdate = m_needsTransformUpdate || m_needsBoundariesUpdate;
if (m_needsTransformUpdate) {
@@ -185,10 +147,6 @@ void LayoutSVGImage::imageChanged(WrappedImagePtr, const IntRect*)
// representation of this image/layout object.
LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(this, false);
- // Update the SVGImageCache sizeAndScales entry in case image loading finished after layout.
- // (https://bugs.webkit.org/show_bug.cgi?id=99489)
- updateImageContainerSize();
-
m_bufferedForeground.clear();
setShouldDoFullPaintInvalidation();
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/LayoutSVGImage.h ('k') | third_party/WebKit/Source/core/page/PageSerializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698