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

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

Issue 312423002: Don't expose the user agent shadow tree (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix tests before landing Created 6 years, 6 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 | « Source/core/events/Event.cpp ('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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 345
346 static PassRefPtrWillBeRawPtr<Node> cloneNodeAndAssociate(Node& toClone) 346 static PassRefPtrWillBeRawPtr<Node> cloneNodeAndAssociate(Node& toClone)
347 { 347 {
348 RefPtrWillBeRawPtr<Node> clone = toClone.cloneNode(false); 348 RefPtrWillBeRawPtr<Node> clone = toClone.cloneNode(false);
349 if (!clone->isSVGElement()) 349 if (!clone->isSVGElement())
350 return clone.release(); 350 return clone.release();
351 351
352 SVGElement& svgElement = toSVGElement(toClone); 352 SVGElement& svgElement = toSVGElement(toClone);
353 ASSERT(!svgElement.correspondingElement()); 353 ASSERT(!svgElement.correspondingElement());
354 toSVGElement(clone.get())->setCorrespondingElement(&svgElement); 354 toSVGElement(clone.get())->setCorrespondingElement(&svgElement);
355 if (EventTargetData* data = toClone.eventTargetData())
356 data->eventListenerMap.copyEventListenersNotCreatedFromMarkupToTarget(cl one.get());
355 TrackExceptionState exceptionState; 357 TrackExceptionState exceptionState;
356 for (Node* node = toClone.firstChild(); node && !exceptionState.hadException (); node = node->nextSibling()) 358 for (Node* node = toClone.firstChild(); node && !exceptionState.hadException (); node = node->nextSibling())
357 clone->appendChild(cloneNodeAndAssociate(*node), exceptionState); 359 clone->appendChild(cloneNodeAndAssociate(*node), exceptionState);
358 return clone.release(); 360 return clone.release();
359 } 361 }
360 362
361 void SVGUseElement::buildShadowAndInstanceTree(SVGElement* target) 363 void SVGUseElement::buildShadowAndInstanceTree(SVGElement* target)
362 { 364 {
363 ASSERT(!m_targetElementInstance); 365 ASSERT(!m_targetElementInstance);
364 366
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 // as the invalidation bubbles up the dependency chain. 478 // as the invalidation bubbles up the dependency chain.
477 if (!foundUse) { 479 if (!foundUse) {
478 document().accessSVGExtensions().addElementReferencingTarget(this, t arget); 480 document().accessSVGExtensions().addElementReferencingTarget(this, t arget);
479 foundUse = true; 481 foundUse = true;
480 } 482 }
481 } else if (isDisallowedElement(target)) { 483 } else if (isDisallowedElement(target)) {
482 return false; 484 return false;
483 } 485 }
484 486
485 targetInstance->setCorrespondingElement(target); 487 targetInstance->setCorrespondingElement(target);
488 if (EventTargetData* data = target->eventTargetData())
489 data->eventListenerMap.copyEventListenersNotCreatedFromMarkupToTarget(ta rgetInstance);
486 490
487 for (Node* child = target->firstChild(); child; child = child->nextSibling() ) { 491 for (Node* child = target->firstChild(); child; child = child->nextSibling() ) {
488 // Skip any disallowed element. 492 // Skip any disallowed element.
489 if (isDisallowedElement(child)) 493 if (isDisallowedElement(child))
490 continue; 494 continue;
491 495
492 RefPtrWillBeRawPtr<Node> newChild = child->cloneNode(false); 496 RefPtrWillBeRawPtr<Node> newChild = child->cloneNode(false);
493 targetInstance->appendChild(newChild.get()); 497 targetInstance->appendChild(newChild.get());
494 if (newChild->isSVGElement()) { 498 if (newChild->isSVGElement()) {
495 // Enter recursion, appending new instance tree nodes to the "instan ce" object. 499 // Enter recursion, appending new instance tree nodes to the "instan ce" object.
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 m_resource->addClient(this); 767 m_resource->addClient(this);
764 } 768 }
765 769
766 void SVGUseElement::trace(Visitor* visitor) 770 void SVGUseElement::trace(Visitor* visitor)
767 { 771 {
768 visitor->trace(m_targetElementInstance); 772 visitor->trace(m_targetElementInstance);
769 SVGGraphicsElement::trace(visitor); 773 SVGGraphicsElement::trace(visitor);
770 } 774 }
771 775
772 } 776 }
OLDNEW
« no previous file with comments | « Source/core/events/Event.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698