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

Side by Side Diff: third_party/WebKit/Source/core/style/StyleFetchedImage.cpp

Issue 1367193003: NOT FOR LANDING Allocate SVGImageForContainer on demand (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added some NeedsRebaseline and revived some LayoutListMarker code that turned out to be important 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) 3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 10 matching lines...) Expand all
21 * 21 *
22 */ 22 */
23 23
24 #include "config.h" 24 #include "config.h"
25 #include "core/style/StyleFetchedImage.h" 25 #include "core/style/StyleFetchedImage.h"
26 26
27 #include "core/css/CSSImageValue.h" 27 #include "core/css/CSSImageValue.h"
28 #include "core/fetch/ImageResource.h" 28 #include "core/fetch/ImageResource.h"
29 #include "core/layout/LayoutObject.h" 29 #include "core/layout/LayoutObject.h"
30 #include "core/svg/graphics/SVGImage.h" 30 #include "core/svg/graphics/SVGImage.h"
31 #include "core/svg/graphics/SVGImageForContainer.h"
31 32
32 namespace blink { 33 namespace blink {
33 34
34 StyleFetchedImage::StyleFetchedImage(ImageResource* image, Document* document) 35 StyleFetchedImage::StyleFetchedImage(ImageResource* image, Document* document, c onst KURL& urlWithFragment)
35 : m_image(image) 36 : m_image(image)
36 , m_document(document) 37 , m_document(document)
38 , m_urlWithFragment(urlWithFragment)
37 { 39 {
38 m_isImageResource = true; 40 m_isImageResource = true;
39 m_image->addClient(this); 41 m_image->addClient(this);
40 } 42 }
41 43
42 StyleFetchedImage::~StyleFetchedImage() 44 StyleFetchedImage::~StyleFetchedImage()
43 { 45 {
44 m_image->removeClient(this); 46 m_image->removeClient(this);
45 } 47 }
46 48
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 void StyleFetchedImage::computeIntrinsicDimensions(const LayoutObject*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio) 99 void StyleFetchedImage::computeIntrinsicDimensions(const LayoutObject*, Length& intrinsicWidth, Length& intrinsicHeight, FloatSize& intrinsicRatio)
98 { 100 {
99 m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrins icRatio); 101 m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrins icRatio);
100 } 102 }
101 103
102 bool StyleFetchedImage::usesImageContainerSize() const 104 bool StyleFetchedImage::usesImageContainerSize() const
103 { 105 {
104 return m_image->usesImageContainerSize(); 106 return m_image->usesImageContainerSize();
105 } 107 }
106 108
107 void StyleFetchedImage::setContainerSizeForLayoutObject(const LayoutObject* layo utObject, const IntSize& imageContainerSize, float imageContainerZoomFactor)
108 {
109 m_image->setContainerSizeForLayoutObject(layoutObject, imageContainerSize, i mageContainerZoomFactor);
110 }
111
112 void StyleFetchedImage::addClient(LayoutObject* layoutObject) 109 void StyleFetchedImage::addClient(LayoutObject* layoutObject)
113 { 110 {
114 m_image->addClient(layoutObject); 111 m_image->addClient(layoutObject);
115 } 112 }
116 113
117 void StyleFetchedImage::removeClient(LayoutObject* layoutObject) 114 void StyleFetchedImage::removeClient(LayoutObject* layoutObject)
118 { 115 {
119 m_image->removeClient(layoutObject); 116 m_image->removeClient(layoutObject);
120 } 117 }
121 118
122 void StyleFetchedImage::notifyFinished(Resource* resource) 119 void StyleFetchedImage::notifyFinished(Resource* resource)
123 { 120 {
124 if (m_document && m_image && m_image->image() && m_image->image()->isSVGImag e()) 121 if (m_document && m_image && m_image->image() && m_image->image()->isSVGImag e())
125 toSVGImage(m_image->image())->updateUseCounters(*m_document); 122 toSVGImage(m_image->image())->updateUseCounters(*m_document);
126 // Oilpan: do not prolong the Document's lifetime. 123 // Oilpan: do not prolong the Document's lifetime.
127 m_document.clear(); 124 m_document.clear();
128 } 125 }
129 126
130 PassRefPtr<Image> StyleFetchedImage::image(const LayoutObject* layoutObject, con st IntSize&) const 127 PassRefPtr<Image> StyleFetchedImage::image(const LayoutObject*, const IntSize& c ontainerSize, float zoom, const KURL& url) const
131 { 128 {
132 return m_image->imageForLayoutObject(layoutObject); 129 RefPtr<Image> image = m_image->image();
130 if (image->isSVGImage())
131 return SVGImageForContainer::create(toSVGImage(image.get()), containerSi ze, zoom, url);
132 return image;
133 } 133 }
134 134
135 bool StyleFetchedImage::knownToBeOpaque(const LayoutObject* layoutObject) const 135 bool StyleFetchedImage::knownToBeOpaque(const LayoutObject* layoutObject) const
136 { 136 {
137 return m_image->currentFrameKnownToBeOpaque(layoutObject); 137 return m_image->currentFrameKnownToBeOpaque(layoutObject);
138 } 138 }
139 139
140 DEFINE_TRACE(StyleFetchedImage) 140 DEFINE_TRACE(StyleFetchedImage)
141 { 141 {
142 visitor->trace(m_document); 142 visitor->trace(m_document);
143 StyleImage::trace(visitor); 143 StyleImage::trace(visitor);
144 } 144 }
145 145
146 } 146 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/style/StyleFetchedImage.h ('k') | third_party/WebKit/Source/core/style/StyleFetchedImageSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698