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

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

Issue 2633143002: SVG objects with same idrefs conflict when under different shadow root (Closed)
Patch Set: ensureSVGTreeScopedResources(); add comment Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann
3 * <zimmermann@kde.org> 3 * <zimmermann@kde.org>
4 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 4 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
5 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved.
6 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 6 * Copyright (C) 2011 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
7 * Copyright (C) 2012 University of Szeged 7 * Copyright (C) 2012 University of Szeged
8 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org> 8 * Copyright (C) 2012 Renata Hodovan <reni@webkit.org>
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 20 matching lines...) Expand all
31 #include "core/dom/Document.h" 31 #include "core/dom/Document.h"
32 #include "core/dom/ElementTraversal.h" 32 #include "core/dom/ElementTraversal.h"
33 #include "core/dom/StyleChangeReason.h" 33 #include "core/dom/StyleChangeReason.h"
34 #include "core/dom/TaskRunnerHelper.h" 34 #include "core/dom/TaskRunnerHelper.h"
35 #include "core/dom/shadow/ElementShadow.h" 35 #include "core/dom/shadow/ElementShadow.h"
36 #include "core/dom/shadow/ShadowRoot.h" 36 #include "core/dom/shadow/ShadowRoot.h"
37 #include "core/events/Event.h" 37 #include "core/events/Event.h"
38 #include "core/fetch/FetchRequest.h" 38 #include "core/fetch/FetchRequest.h"
39 #include "core/fetch/ResourceFetcher.h" 39 #include "core/fetch/ResourceFetcher.h"
40 #include "core/layout/svg/LayoutSVGTransformableContainer.h" 40 #include "core/layout/svg/LayoutSVGTransformableContainer.h"
41 #include "core/svg/SVGDocumentExtensions.h"
42 #include "core/svg/SVGGElement.h" 41 #include "core/svg/SVGGElement.h"
43 #include "core/svg/SVGLengthContext.h" 42 #include "core/svg/SVGLengthContext.h"
44 #include "core/svg/SVGSVGElement.h" 43 #include "core/svg/SVGSVGElement.h"
45 #include "core/svg/SVGSymbolElement.h" 44 #include "core/svg/SVGSymbolElement.h"
45 #include "core/svg/SVGTreeScopeResources.h"
46 #include "core/xml/parser/XMLDocumentParser.h" 46 #include "core/xml/parser/XMLDocumentParser.h"
47 #include "wtf/Vector.h" 47 #include "wtf/Vector.h"
48 48
49 namespace blink { 49 namespace blink {
50 50
51 inline SVGUseElement::SVGUseElement(Document& document) 51 inline SVGUseElement::SVGUseElement(Document& document)
52 : SVGGraphicsElement(SVGNames::useTag, document), 52 : SVGGraphicsElement(SVGNames::useTag, document),
53 SVGURIReference(this), 53 SVGURIReference(this),
54 m_x(SVGAnimatedLength::create(this, 54 m_x(SVGAnimatedLength::create(this,
55 SVGNames::xAttr, 55 SVGNames::xAttr,
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 else if (resourceIsValid()) 309 else if (resourceIsValid())
310 lookupScope = m_resource->document(); 310 lookupScope = m_resource->document();
311 else 311 else
312 return nullptr; 312 return nullptr;
313 Element* target = lookupScope->getElementById(m_elementIdentifier); 313 Element* target = lookupScope->getElementById(m_elementIdentifier);
314 // TODO(fs): Why would the Element not be "connected" at this point? 314 // TODO(fs): Why would the Element not be "connected" at this point?
315 if (target && target->isConnected()) 315 if (target && target->isConnected())
316 return target; 316 return target;
317 // Don't record any pending references for external resources. 317 // Don't record any pending references for external resources.
318 if (!m_resource) { 318 if (!m_resource) {
319 document().accessSVGExtensions().addPendingResource(m_elementIdentifier, 319 treeScope().ensureSVGTreeScopedResources().addPendingResource(
320 this); 320 m_elementIdentifier, this);
321 DCHECK(hasPendingResources()); 321 DCHECK(hasPendingResources());
322 } 322 }
323 return nullptr; 323 return nullptr;
324 } 324 }
325 325
326 void SVGUseElement::buildPendingResource() { 326 void SVGUseElement::buildPendingResource() {
327 if (inUseShadowTree()) 327 if (inUseShadowTree())
328 return; 328 return;
329 clearShadowTree(); 329 clearShadowTree();
330 cancelShadowTreeRecreation(); 330 cancelShadowTreeRecreation();
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 724
725 if (m_resource) 725 if (m_resource)
726 m_resource->removeClient(this); 726 m_resource->removeClient(this);
727 727
728 m_resource = resource; 728 m_resource = resource;
729 if (m_resource) 729 if (m_resource)
730 m_resource->addClient(this); 730 m_resource->addClient(this);
731 } 731 }
732 732
733 } // namespace blink 733 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698