OLD | NEW |
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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 435 |
436 // Set up root SVG element in shadow tree. | 436 // Set up root SVG element in shadow tree. |
437 // Clone the target subtree into the shadow tree, not handling <use> and <sy
mbol> yet. | 437 // Clone the target subtree into the shadow tree, not handling <use> and <sy
mbol> yet. |
438 Element* instanceRoot = createInstanceTree(target); | 438 Element* instanceRoot = createInstanceTree(target); |
439 m_targetElementInstance = toSVGElement(instanceRoot); | 439 m_targetElementInstance = toSVGElement(instanceRoot); |
440 ShadowRoot* shadowTreeRootElement = userAgentShadowRoot(); | 440 ShadowRoot* shadowTreeRootElement = userAgentShadowRoot(); |
441 shadowTreeRootElement->appendChild(instanceRoot); | 441 shadowTreeRootElement->appendChild(instanceRoot); |
442 | 442 |
443 addReferencesToFirstDegreeNestedUseElements(target); | 443 addReferencesToFirstDegreeNestedUseElements(target); |
444 | 444 |
445 if (instanceTreeIsLoading()) { | 445 if (instanceTreeIsLoading()) |
446 cloneNonMarkupEventListeners(); | |
447 return; | 446 return; |
448 } | |
449 | 447 |
450 // Assure shadow tree building was successful. | 448 // Assure shadow tree building was successful. |
451 ASSERT(m_targetElementInstance); | 449 ASSERT(m_targetElementInstance); |
452 ASSERT(m_targetElementInstance->correspondingUseElement() == this); | 450 ASSERT(m_targetElementInstance->correspondingUseElement() == this); |
453 ASSERT(m_targetElementInstance->correspondingElement() == &target); | 451 ASSERT(m_targetElementInstance->correspondingElement() == &target); |
454 | 452 |
455 // Expand all <use> elements in the shadow tree. | 453 // Expand all <use> elements in the shadow tree. |
456 // Expand means: replace the actual <use> element by what it references. | 454 // Expand means: replace the actual <use> element by what it references. |
457 if (!expandUseElementsInShadowTree()) { | 455 if (!expandUseElementsInShadowTree()) { |
458 clearShadowTree(); | 456 clearShadowTree(); |
459 return; | 457 return; |
460 } | 458 } |
461 | 459 |
462 // If the instance root was a <use>, it could have been replaced now, so | 460 // If the instance root was a <use>, it could have been replaced now, so |
463 // reset |m_targetElementInstance|. | 461 // reset |m_targetElementInstance|. |
464 m_targetElementInstance = toSVGElement(shadowTreeRootElement->firstChild()); | 462 m_targetElementInstance = toSVGElement(shadowTreeRootElement->firstChild()); |
465 ASSERT(m_targetElementInstance->parentNode() == shadowTreeRootElement); | 463 ASSERT(m_targetElementInstance->parentNode() == shadowTreeRootElement); |
466 | 464 |
467 cloneNonMarkupEventListeners(); | |
468 | |
469 // Update relative length information. | 465 // Update relative length information. |
470 updateRelativeLengthsInformation(); | 466 updateRelativeLengthsInformation(); |
471 } | 467 } |
472 | 468 |
473 LayoutObject* SVGUseElement::createLayoutObject(const ComputedStyle&) | 469 LayoutObject* SVGUseElement::createLayoutObject(const ComputedStyle&) |
474 { | 470 { |
475 return new LayoutSVGTransformableContainer(this); | 471 return new LayoutSVGTransformableContainer(this); |
476 } | 472 } |
477 | 473 |
478 static bool isDirectReference(const SVGElement& element) | 474 static bool isDirectReference(const SVGElement& element) |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 return; | 537 return; |
542 // We only need to track first degree <use> dependencies. Indirect | 538 // We only need to track first degree <use> dependencies. Indirect |
543 // references are handled as the invalidation bubbles up the dependency | 539 // references are handled as the invalidation bubbles up the dependency |
544 // chain. | 540 // chain. |
545 SVGUseElement* useElement = | 541 SVGUseElement* useElement = |
546 isSVGUseElement(target) ? toSVGUseElement(&target) : Traversal<SVGUseEle
ment>::firstWithin(target); | 542 isSVGUseElement(target) ? toSVGUseElement(&target) : Traversal<SVGUseEle
ment>::firstWithin(target); |
547 for (; useElement; useElement = Traversal<SVGUseElement>::nextSkippingChildr
en(*useElement, &target)) | 543 for (; useElement; useElement = Traversal<SVGUseElement>::nextSkippingChildr
en(*useElement, &target)) |
548 addReferenceTo(useElement); | 544 addReferenceTo(useElement); |
549 } | 545 } |
550 | 546 |
551 void SVGUseElement::cloneNonMarkupEventListeners() | |
552 { | |
553 for (SVGElement& element : Traversal<SVGElement>::descendantsOf(*userAgentSh
adowRoot())) { | |
554 if (EventTargetData* data = element.correspondingElement()->eventTargetD
ata()) | |
555 data->eventListenerMap.copyEventListenersNotCreatedFromMarkupToTarge
t(&element); | |
556 } | |
557 } | |
558 | |
559 bool SVGUseElement::hasCycleUseReferencing(const SVGUseElement& use, const Conta
inerNode& targetInstance, SVGElement*& newTarget) const | 547 bool SVGUseElement::hasCycleUseReferencing(const SVGUseElement& use, const Conta
inerNode& targetInstance, SVGElement*& newTarget) const |
560 { | 548 { |
561 Element* targetElement = targetElementFromIRIString(use.hrefString(), use.tr
eeScope()); | 549 Element* targetElement = targetElementFromIRIString(use.hrefString(), use.tr
eeScope()); |
562 newTarget = 0; | 550 newTarget = 0; |
563 if (targetElement && targetElement->isSVGElement()) | 551 if (targetElement && targetElement->isSVGElement()) |
564 newTarget = toSVGElement(targetElement); | 552 newTarget = toSVGElement(targetElement); |
565 | 553 |
566 if (!newTarget) | 554 if (!newTarget) |
567 return false; | 555 return false; |
568 | 556 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 | 744 |
757 if (m_resource) | 745 if (m_resource) |
758 m_resource->removeClient(this); | 746 m_resource->removeClient(this); |
759 | 747 |
760 m_resource = resource; | 748 m_resource = resource; |
761 if (m_resource) | 749 if (m_resource) |
762 m_resource->addClient(this); | 750 m_resource->addClient(this); |
763 } | 751 } |
764 | 752 |
765 } // namespace blink | 753 } // namespace blink |
OLD | NEW |