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

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: 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
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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 void SVGUseElement::updateTargetReference() 187 void SVGUseElement::updateTargetReference()
188 { 188 {
189 KURL resolvedUrl = document().completeURL(hrefString()); 189 SVGURLReferenceResolver resolver(hrefString(), document());
190 m_elementIdentifier = AtomicString(resolvedUrl.fragmentIdentifier()); 190 m_elementIdentifier = resolver.fragmentIdentifier();
191 m_elementIdentifierIsLocal = resolvedUrl.isNull() 191 m_elementIdentifierIsLocal = resolver.isLocal();
192 || equalIgnoringFragmentIdentifier(resolvedUrl, document().url());
193 if (m_elementIdentifierIsLocal) { 192 if (m_elementIdentifierIsLocal) {
194 setDocumentResource(nullptr); 193 setDocumentResource(nullptr);
195 return; 194 return;
196 } 195 }
196 KURL resolvedUrl = resolver.absoluteUrl();
197 if (m_elementIdentifier.isEmpty() 197 if (m_elementIdentifier.isEmpty()
198 || (m_resource && equalIgnoringFragmentIdentifier(resolvedUrl, m_resourc e->url()))) 198 || (m_resource && equalIgnoringFragmentIdentifier(resolvedUrl, m_resourc e->url())))
199 return; 199 return;
200 FetchRequest request(ResourceRequest(resolvedUrl), localName()); 200 FetchRequest request(ResourceRequest(resolvedUrl), localName());
201 setDocumentResource(DocumentResource::fetchSVGDocument(request, document().f etcher())); 201 setDocumentResource(DocumentResource::fetchSVGDocument(request, document().f etcher()));
202 } 202 }
203 203
204 void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName) 204 void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName)
205 { 205 {
206 if (attrName == SVGNames::xAttr 206 if (attrName == SVGNames::xAttr
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 751
752 if (m_resource) 752 if (m_resource)
753 m_resource->removeClient(this); 753 m_resource->removeClient(this);
754 754
755 m_resource = resource; 755 m_resource = resource;
756 if (m_resource) 756 if (m_resource)
757 m_resource->addClient(this); 757 m_resource->addClient(this);
758 } 758 }
759 759
760 } // namespace blink 760 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698