| 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 shadowTreeRootElement->removeChildren(); | 367 shadowTreeRootElement->removeChildren(); |
| 368 | 368 |
| 369 if (m_targetElementInstance) { | 369 if (m_targetElementInstance) { |
| 370 m_targetElementInstance->detach(); | 370 m_targetElementInstance->detach(); |
| 371 m_targetElementInstance = nullptr; | 371 m_targetElementInstance = nullptr; |
| 372 } | 372 } |
| 373 | 373 |
| 374 m_needsShadowTreeRecreation = false; | 374 m_needsShadowTreeRecreation = false; |
| 375 document().unscheduleUseShadowTreeUpdate(*this); | 375 document().unscheduleUseShadowTreeUpdate(*this); |
| 376 | 376 |
| 377 document().accessSVGExtensions()->removeAllTargetReferencesForElement(this); | 377 document().accessSVGExtensions().removeAllTargetReferencesForElement(this); |
| 378 } | 378 } |
| 379 | 379 |
| 380 void SVGUseElement::buildPendingResource() | 380 void SVGUseElement::buildPendingResource() |
| 381 { | 381 { |
| 382 if (!referencedDocument() || isInShadowTree()) | 382 if (!referencedDocument() || isInShadowTree()) |
| 383 return; | 383 return; |
| 384 clearResourceReferences(); | 384 clearResourceReferences(); |
| 385 if (!inDocument()) | 385 if (!inDocument()) |
| 386 return; | 386 return; |
| 387 | 387 |
| 388 AtomicString id; | 388 AtomicString id; |
| 389 Element* target = SVGURIReference::targetElementFromIRIString(hrefString(),
document(), &id, externalDocument()); | 389 Element* target = SVGURIReference::targetElementFromIRIString(hrefString(),
document(), &id, externalDocument()); |
| 390 if (!target || !target->inDocument()) { | 390 if (!target || !target->inDocument()) { |
| 391 // If we can't find the target of an external element, just give up. | 391 // If we can't find the target of an external element, just give up. |
| 392 // We can't observe if the target somewhen enters the external document,
nor should we do it. | 392 // We can't observe if the target somewhen enters the external document,
nor should we do it. |
| 393 if (externalDocument()) | 393 if (externalDocument()) |
| 394 return; | 394 return; |
| 395 if (id.isEmpty()) | 395 if (id.isEmpty()) |
| 396 return; | 396 return; |
| 397 | 397 |
| 398 referencedDocument()->accessSVGExtensions()->addPendingResource(id, this
); | 398 referencedDocument()->accessSVGExtensions().addPendingResource(id, this)
; |
| 399 ASSERT(hasPendingResources()); | 399 ASSERT(hasPendingResources()); |
| 400 return; | 400 return; |
| 401 } | 401 } |
| 402 | 402 |
| 403 if (target->isSVGElement()) { | 403 if (target->isSVGElement()) { |
| 404 buildShadowAndInstanceTree(toSVGElement(target)); | 404 buildShadowAndInstanceTree(toSVGElement(target)); |
| 405 invalidateDependentShadowTrees(); | 405 invalidateDependentShadowTrees(); |
| 406 } | 406 } |
| 407 | 407 |
| 408 ASSERT(!m_needsShadowTreeRecreation); | 408 ASSERT(!m_needsShadowTreeRecreation); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 { | 527 { |
| 528 ASSERT(path.isEmpty()); | 528 ASSERT(path.isEmpty()); |
| 529 | 529 |
| 530 Node* n = m_targetElementInstance ? m_targetElementInstance->shadowTreeEleme
nt() : 0; | 530 Node* n = m_targetElementInstance ? m_targetElementInstance->shadowTreeEleme
nt() : 0; |
| 531 if (!n) | 531 if (!n) |
| 532 return; | 532 return; |
| 533 | 533 |
| 534 if (n->isSVGElement() && toSVGElement(n)->isSVGGraphicsElement()) { | 534 if (n->isSVGElement() && toSVGElement(n)->isSVGGraphicsElement()) { |
| 535 if (!isDirectReference(n)) { | 535 if (!isDirectReference(n)) { |
| 536 // Spec: Indirect references are an error (14.3.5) | 536 // Spec: Indirect references are an error (14.3.5) |
| 537 document().accessSVGExtensions()->reportError("Not allowed to use in
direct reference in <clip-path>"); | 537 document().accessSVGExtensions().reportError("Not allowed to use ind
irect reference in <clip-path>"); |
| 538 } else { | 538 } else { |
| 539 toSVGGraphicsElement(n)->toClipPath(path); | 539 toSVGGraphicsElement(n)->toClipPath(path); |
| 540 // FIXME: Avoid manual resolution of x/y here. Its potentially harmf
ul. | 540 // FIXME: Avoid manual resolution of x/y here. Its potentially harmf
ul. |
| 541 SVGLengthContext lengthContext(this); | 541 SVGLengthContext lengthContext(this); |
| 542 path.translate(FloatSize(m_x->currentValue()->value(lengthContext),
m_y->currentValue()->value(lengthContext))); | 542 path.translate(FloatSize(m_x->currentValue()->value(lengthContext),
m_y->currentValue()->value(lengthContext))); |
| 543 path.transform(animatedLocalTransform()); | 543 path.transform(animatedLocalTransform()); |
| 544 } | 544 } |
| 545 } | 545 } |
| 546 } | 546 } |
| 547 | 547 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 567 bool targetHasUseTag = target->hasTagName(SVGNames::useTag); | 567 bool targetHasUseTag = target->hasTagName(SVGNames::useTag); |
| 568 SVGElement* newTarget = 0; | 568 SVGElement* newTarget = 0; |
| 569 if (targetHasUseTag) { | 569 if (targetHasUseTag) { |
| 570 foundProblem = hasCycleUseReferencing(toSVGUseElement(target), targetIns
tance, newTarget); | 570 foundProblem = hasCycleUseReferencing(toSVGUseElement(target), targetIns
tance, newTarget); |
| 571 if (foundProblem) | 571 if (foundProblem) |
| 572 return; | 572 return; |
| 573 | 573 |
| 574 // We only need to track first degree <use> dependencies. Indirect refer
ences are handled | 574 // We only need to track first degree <use> dependencies. Indirect refer
ences are handled |
| 575 // as the invalidation bubbles up the dependency chain. | 575 // as the invalidation bubbles up the dependency chain. |
| 576 if (!foundUse) { | 576 if (!foundUse) { |
| 577 document().accessSVGExtensions()->addElementReferencingTarget(this,
target); | 577 document().accessSVGExtensions().addElementReferencingTarget(this, t
arget); |
| 578 foundUse = true; | 578 foundUse = true; |
| 579 } | 579 } |
| 580 } else if (isDisallowedElement(target)) { | 580 } else if (isDisallowedElement(target)) { |
| 581 foundProblem = true; | 581 foundProblem = true; |
| 582 return; | 582 return; |
| 583 } | 583 } |
| 584 | 584 |
| 585 // A general description from the SVG spec, describing what buildInstanceTre
e() actually does. | 585 // A general description from the SVG spec, describing what buildInstanceTre
e() actually does. |
| 586 // | 586 // |
| 587 // Spec: If the 'use' element references a 'g' which contains two 'rect' ele
ments, then the instance tree | 587 // Spec: If the 'use' element references a 'g' which contains two 'rect' ele
ments, then the instance tree |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 | 981 |
| 982 if (m_resource) | 982 if (m_resource) |
| 983 m_resource->removeClient(this); | 983 m_resource->removeClient(this); |
| 984 | 984 |
| 985 m_resource = resource; | 985 m_resource = resource; |
| 986 if (m_resource) | 986 if (m_resource) |
| 987 m_resource->addClient(this); | 987 m_resource->addClient(this); |
| 988 } | 988 } |
| 989 | 989 |
| 990 } | 990 } |
| OLD | NEW |