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

Side by Side Diff: Source/core/svg/SVGImageElement.cpp

Issue 927583002: Moving RenderSVG* files from rendering/ to layout/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/svg/SVGGraphicsElement.cpp ('k') | Source/core/svg/SVGLineElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Rob Buis <buis@kde.org>
4 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> 4 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org>
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
11 * This library is distributed in the hope that it will be useful, 11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details. 14 * Library General Public License for more details.
15 * 15 *
16 * You should have received a copy of the GNU Library General Public License 16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to 17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA. 19 * Boston, MA 02110-1301, USA.
20 */ 20 */
21 21
22 #include "config.h" 22 #include "config.h"
23 23
24 #include "core/svg/SVGImageElement.h" 24 #include "core/svg/SVGImageElement.h"
25 25
26 #include "core/CSSPropertyNames.h" 26 #include "core/CSSPropertyNames.h"
27 #include "core/XLinkNames.h" 27 #include "core/XLinkNames.h"
28 #include "core/layout/LayoutImageResource.h" 28 #include "core/layout/LayoutImageResource.h"
29 #include "core/rendering/svg/RenderSVGImage.h" 29 #include "core/layout/svg/LayoutSVGImage.h"
30 30
31 namespace blink { 31 namespace blink {
32 32
33 inline SVGImageElement::SVGImageElement(Document& document) 33 inline SVGImageElement::SVGImageElement(Document& document)
34 : SVGGraphicsElement(SVGNames::imageTag, document) 34 : SVGGraphicsElement(SVGNames::imageTag, document)
35 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len gthModeWidth), AllowNegativeLengths)) 35 , m_x(SVGAnimatedLength::create(this, SVGNames::xAttr, SVGLength::create(Len gthModeWidth), AllowNegativeLengths))
36 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len gthModeHeight), AllowNegativeLengths)) 36 , m_y(SVGAnimatedLength::create(this, SVGNames::yAttr, SVGLength::create(Len gthModeHeight), AllowNegativeLengths))
37 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr eate(LengthModeWidth), ForbidNegativeLengths)) 37 , m_width(SVGAnimatedLength::create(this, SVGNames::widthAttr, SVGLength::cr eate(LengthModeWidth), ForbidNegativeLengths))
38 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength:: create(LengthModeHeight), ForbidNegativeLengths)) 38 , m_height(SVGAnimatedLength::create(this, SVGNames::heightAttr, SVGLength:: create(LengthModeHeight), ForbidNegativeLengths))
39 , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(this, SVGName s::preserveAspectRatioAttr, SVGPreserveAspectRatio::create())) 39 , m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create(this, SVGName s::preserveAspectRatioAttr, SVGPreserveAspectRatio::create()))
(...skipping 18 matching lines...) Expand all
58 visitor->trace(m_width); 58 visitor->trace(m_width);
59 visitor->trace(m_height); 59 visitor->trace(m_height);
60 visitor->trace(m_preserveAspectRatio); 60 visitor->trace(m_preserveAspectRatio);
61 visitor->trace(m_imageLoader); 61 visitor->trace(m_imageLoader);
62 SVGGraphicsElement::trace(visitor); 62 SVGGraphicsElement::trace(visitor);
63 SVGURIReference::trace(visitor); 63 SVGURIReference::trace(visitor);
64 } 64 }
65 65
66 bool SVGImageElement::currentFrameHasSingleSecurityOrigin() const 66 bool SVGImageElement::currentFrameHasSingleSecurityOrigin() const
67 { 67 {
68 if (RenderSVGImage* renderSVGImage = toRenderSVGImage(renderer())) { 68 if (LayoutSVGImage* renderSVGImage = toLayoutSVGImage(renderer())) {
69 if (renderSVGImage->imageResource()->hasImage()) { 69 if (renderSVGImage->imageResource()->hasImage()) {
70 if (Image* image = renderSVGImage->imageResource()->cachedImage()->i mage()) 70 if (Image* image = renderSVGImage->imageResource()->cachedImage()->i mage())
71 return image->currentFrameHasSingleSecurityOrigin(); 71 return image->currentFrameHasSingleSecurityOrigin();
72 } 72 }
73 } 73 }
74 74
75 return true; 75 return true;
76 } 76 }
77 77
78 bool SVGImageElement::isSupportedAttribute(const QualifiedName& attrName) 78 bool SVGImageElement::isSupportedAttribute(const QualifiedName& attrName)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 else 134 else
135 m_needsLoaderURIUpdate = true; 135 m_needsLoaderURIUpdate = true;
136 return; 136 return;
137 } 137 }
138 138
139 LayoutObject* renderer = this->renderer(); 139 LayoutObject* renderer = this->renderer();
140 if (!renderer) 140 if (!renderer)
141 return; 141 return;
142 142
143 if (isLengthAttribute) { 143 if (isLengthAttribute) {
144 if (toRenderSVGImage(renderer)->updateImageViewport()) 144 if (toLayoutSVGImage(renderer)->updateImageViewport())
145 markForLayoutAndParentResourceInvalidation(renderer); 145 markForLayoutAndParentResourceInvalidation(renderer);
146 return; 146 return;
147 } 147 }
148 148
149 if (attrName == SVGNames::preserveAspectRatioAttr) { 149 if (attrName == SVGNames::preserveAspectRatioAttr) {
150 markForLayoutAndParentResourceInvalidation(renderer); 150 markForLayoutAndParentResourceInvalidation(renderer);
151 return; 151 return;
152 } 152 }
153 153
154 ASSERT_NOT_REACHED(); 154 ASSERT_NOT_REACHED();
155 } 155 }
156 156
157 bool SVGImageElement::selfHasRelativeLengths() const 157 bool SVGImageElement::selfHasRelativeLengths() const
158 { 158 {
159 return m_x->currentValue()->isRelative() 159 return m_x->currentValue()->isRelative()
160 || m_y->currentValue()->isRelative() 160 || m_y->currentValue()->isRelative()
161 || m_width->currentValue()->isRelative() 161 || m_width->currentValue()->isRelative()
162 || m_height->currentValue()->isRelative(); 162 || m_height->currentValue()->isRelative();
163 } 163 }
164 164
165 LayoutObject* SVGImageElement::createRenderer(const LayoutStyle&) 165 LayoutObject* SVGImageElement::createRenderer(const LayoutStyle&)
166 { 166 {
167 return new RenderSVGImage(this); 167 return new LayoutSVGImage(this);
168 } 168 }
169 169
170 bool SVGImageElement::haveLoadedRequiredResources() 170 bool SVGImageElement::haveLoadedRequiredResources()
171 { 171 {
172 return !m_needsLoaderURIUpdate && !imageLoader().hasPendingActivity(); 172 return !m_needsLoaderURIUpdate && !imageLoader().hasPendingActivity();
173 } 173 }
174 174
175 void SVGImageElement::attach(const AttachContext& context) 175 void SVGImageElement::attach(const AttachContext& context)
176 { 176 {
177 SVGGraphicsElement::attach(context); 177 SVGGraphicsElement::attach(context);
178 178
179 if (RenderSVGImage* imageObj = toRenderSVGImage(renderer())) { 179 if (LayoutSVGImage* imageObj = toLayoutSVGImage(renderer())) {
180 if (imageObj->imageResource()->hasImage()) 180 if (imageObj->imageResource()->hasImage())
181 return; 181 return;
182 182
183 imageObj->imageResource()->setImageResource(imageLoader().image()); 183 imageObj->imageResource()->setImageResource(imageLoader().image());
184 } 184 }
185 } 185 }
186 186
187 Node::InsertionNotificationRequest SVGImageElement::insertedInto(ContainerNode* rootParent) 187 Node::InsertionNotificationRequest SVGImageElement::insertedInto(ContainerNode* rootParent)
188 { 188 {
189 SVGGraphicsElement::insertedInto(rootParent); 189 SVGGraphicsElement::insertedInto(rootParent);
(...skipping 20 matching lines...) Expand all
210 return AtomicString(hrefString()); 210 return AtomicString(hrefString());
211 } 211 }
212 212
213 void SVGImageElement::didMoveToNewDocument(Document& oldDocument) 213 void SVGImageElement::didMoveToNewDocument(Document& oldDocument)
214 { 214 {
215 imageLoader().elementDidMoveToNewDocument(); 215 imageLoader().elementDidMoveToNewDocument();
216 SVGGraphicsElement::didMoveToNewDocument(oldDocument); 216 SVGGraphicsElement::didMoveToNewDocument(oldDocument);
217 } 217 }
218 218
219 } // namespace blink 219 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/svg/SVGGraphicsElement.cpp ('k') | Source/core/svg/SVGLineElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698