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

Unified Diff: Source/core/fetch/ImageResource.cpp

Issue 1339183003: NOT FOR LANDING Experiment with allocating SVGImageForContainer on demand (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 3 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
« no previous file with comments | « Source/core/fetch/ImageResource.h ('k') | Source/core/layout/LayoutImage.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/ImageResource.cpp
diff --git a/Source/core/fetch/ImageResource.cpp b/Source/core/fetch/ImageResource.cpp
index 9151123f9e4c055c943f74353f60064f0818315c..0af0db62e869bfb4df3d25c9a7357281fd1b905c 100644
--- a/Source/core/fetch/ImageResource.cpp
+++ b/Source/core/fetch/ImageResource.cpp
@@ -33,7 +33,6 @@
#include "core/html/HTMLImageElement.h"
#include "core/layout/LayoutObject.h"
#include "core/svg/graphics/SVGImage.h"
-#include "core/svg/graphics/SVGImageForContainer.h"
#include "platform/Logging.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/SharedBuffer.h"
@@ -127,8 +126,6 @@ void ImageResource::didRemoveClient(ResourceClient* c)
{
ASSERT(c);
ASSERT(c->resourceClientType() == ImageResourceClient::expectedType());
- if (m_imageForContainerMap)
- m_imageForContainerMap->remove(static_cast<ImageResourceClient*>(c));
Resource::didRemoveClient(c);
}
@@ -203,33 +200,9 @@ blink::Image* ImageResource::imageForLayoutObject(const LayoutObject* layoutObje
if (!m_image)
return blink::Image::nullImage();
- if (m_image->isSVGImage()) {
- blink::Image* image = svgImageForLayoutObject(layoutObject);
- if (image != blink::Image::nullImage())
- return image;
- }
-
return m_image.get();
}
-void ImageResource::setContainerSizeForLayoutObject(const ImageResourceClient* layoutObject, const IntSize& containerSize, float containerZoom)
-{
- if (containerSize.isEmpty())
- return;
- ASSERT(layoutObject);
- ASSERT(containerZoom);
- if (!m_image)
- return;
- if (!m_image->isSVGImage()) {
- m_image->setContainerSize(containerSize);
- return;
- }
-
- FloatSize containerSizeWithoutZoom(containerSize);
- containerSizeWithoutZoom.scale(1 / containerZoom);
- m_imageForContainerMap->set(layoutObject, SVGImageForContainer::create(toSVGImage(m_image.get()), containerSizeWithoutZoom, containerZoom));
-}
-
bool ImageResource::usesImageContainerSize() const
{
if (m_image)
@@ -265,8 +238,6 @@ LayoutSize ImageResource::imageSizeForLayoutObject(const LayoutObject* layoutObj
if (m_image->isBitmapImage() && (layoutObject && layoutObject->shouldRespectImageOrientation() == RespectImageOrientation))
imageSize = LayoutSize(toBitmapImage(m_image.get())->sizeRespectingOrientation());
- else if (m_image->isSVGImage() && sizeType == NormalSize)
- imageSize = LayoutSize(svgImageSizeForLayoutObject(layoutObject));
else
imageSize = LayoutSize(m_image->size());
@@ -320,7 +291,6 @@ inline void ImageResource::createImage()
if (m_response.mimeType() == "image/svg+xml") {
m_image = SVGImage::create(this);
- m_imageForContainerMap = adoptPtr(new ImageForContainerMap);
} else {
m_image = BitmapImage::create(this);
}
@@ -496,45 +466,6 @@ bool ImageResource::isAccessAllowed(SecurityOrigin* securityOrigin)
return !securityOrigin->taintsCanvas(response().url());
}
-IntSize ImageResource::svgImageSizeForLayoutObject(const LayoutObject* layoutObject) const
-{
- IntSize imageSize = m_image->size();
- if (!layoutObject)
- return imageSize;
-
- ImageForContainerMap::const_iterator it = m_imageForContainerMap->find(layoutObject);
- if (it == m_imageForContainerMap->end())
- return imageSize;
-
- RefPtr<SVGImageForContainer> imageForContainer = it->value;
- ASSERT(!imageForContainer->size().isEmpty());
- return imageForContainer->size();
-}
-
-// FIXME: This doesn't take into account the animation timeline so animations will not
-// restart on page load, nor will two animations in different pages have different timelines.
-Image* ImageResource::svgImageForLayoutObject(const LayoutObject* layoutObject)
-{
- if (!layoutObject)
- return Image::nullImage();
-
- ImageForContainerMap::iterator it = m_imageForContainerMap->find(layoutObject);
- if (it == m_imageForContainerMap->end())
- return Image::nullImage();
-
- RefPtr<SVGImageForContainer> imageForContainer = it->value;
- ASSERT(!imageForContainer->size().isEmpty());
-
- Node* node = layoutObject->node();
- if (node && isHTMLImageElement(node)) {
- const AtomicString& urlString = toHTMLImageElement(node)->imageSourceURL();
- KURL url = node->document().completeURL(urlString);
- imageForContainer->setURL(url);
- }
-
- return imageForContainer.get();
-}
-
bool ImageResource::loadingMultipartContent() const
{
return m_loader && m_loader->loadingMultipartContent();
« no previous file with comments | « Source/core/fetch/ImageResource.h ('k') | Source/core/layout/LayoutImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698