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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGUseElement.cpp

Issue 2174833002: Make fragment-only URLs always be document-local references (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove isExternal...; add additional test Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGUseElement.h ('k') | no next file » | 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, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org> 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 5 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
6 * Copyright (C) 2012 University of Szeged 6 * Copyright (C) 2012 University of Szeged
7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> 7 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 { 177 {
178 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); 178 SVGAnimatedPropertyBase* property = propertyFromAttribute(name);
179 if (property == m_x) 179 if (property == m_x)
180 addPropertyToPresentationAttributeStyle(style, CSSPropertyX, m_x->curren tValue()->asCSSPrimitiveValue()); 180 addPropertyToPresentationAttributeStyle(style, CSSPropertyX, m_x->curren tValue()->asCSSPrimitiveValue());
181 else if (property == m_y) 181 else if (property == m_y)
182 addPropertyToPresentationAttributeStyle(style, CSSPropertyY, m_y->curren tValue()->asCSSPrimitiveValue()); 182 addPropertyToPresentationAttributeStyle(style, CSSPropertyY, m_y->curren tValue()->asCSSPrimitiveValue());
183 else 183 else
184 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st yle); 184 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st yle);
185 } 185 }
186 186
187 bool SVGUseElement::isStructurallyExternal() const
188 {
189 return !m_elementIdentifierIsLocal;
190 }
191
187 void SVGUseElement::updateTargetReference() 192 void SVGUseElement::updateTargetReference()
188 { 193 {
189 KURL resolvedUrl = document().completeURL(hrefString()); 194 SVGURLReferenceResolver resolver(hrefString(), document());
190 m_elementIdentifier = AtomicString(resolvedUrl.fragmentIdentifier()); 195 m_elementIdentifier = resolver.fragmentIdentifier();
191 m_elementIdentifierIsLocal = resolvedUrl.isNull() 196 m_elementIdentifierIsLocal = resolver.isLocal();
192 || equalIgnoringFragmentIdentifier(resolvedUrl, document().url());
193 if (m_elementIdentifierIsLocal) { 197 if (m_elementIdentifierIsLocal) {
194 setDocumentResource(nullptr); 198 setDocumentResource(nullptr);
195 return; 199 return;
196 } 200 }
201 KURL resolvedUrl = resolver.absoluteUrl();
197 if (m_elementIdentifier.isEmpty() 202 if (m_elementIdentifier.isEmpty()
198 || (m_resource && equalIgnoringFragmentIdentifier(resolvedUrl, m_resourc e->url()))) 203 || (m_resource && equalIgnoringFragmentIdentifier(resolvedUrl, m_resourc e->url())))
199 return; 204 return;
200 FetchRequest request(ResourceRequest(resolvedUrl), localName()); 205 FetchRequest request(ResourceRequest(resolvedUrl), localName());
201 setDocumentResource(DocumentResource::fetchSVGDocument(request, document().f etcher())); 206 setDocumentResource(DocumentResource::fetchSVGDocument(request, document().f etcher()));
202 } 207 }
203 208
204 void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName) 209 void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName)
205 { 210 {
206 if (attrName == SVGNames::xAttr 211 if (attrName == SVGNames::xAttr
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 756
752 if (m_resource) 757 if (m_resource)
753 m_resource->removeClient(this); 758 m_resource->removeClient(this);
754 759
755 m_resource = resource; 760 m_resource = resource;
756 if (m_resource) 761 if (m_resource)
757 m_resource->addClient(this); 762 m_resource->addClient(this);
758 } 763 }
759 764
760 } // namespace blink 765 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGUseElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698