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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 return; | 231 return; |
232 } | 232 } |
233 | 233 |
234 if (!renderer) | 234 if (!renderer) |
235 return; | 235 return; |
236 | 236 |
237 ASSERT_NOT_REACHED(); | 237 ASSERT_NOT_REACHED(); |
238 } | 238 } |
239 | 239 |
240 #ifdef DUMP_INSTANCE_TREE | 240 #ifdef DUMP_INSTANCE_TREE |
241 static void dumpInstanceTree(unsigned int& depth, String& text, SVGElementInstan
ce* targetInstance) | 241 static void dumpInstanceTree(unsigned& depth, String& text, SVGElementInstance*
targetInstance) |
242 { | 242 { |
243 SVGElement* element = targetInstance->correspondingElement(); | 243 SVGElement* element = targetInstance->correspondingElement(); |
244 ASSERT(element); | 244 ASSERT(element); |
245 | 245 |
246 if (isSVGUseElement(*element) && toSVGUseElement(*element).resourceIsStillLo
ading()) | 246 if (isSVGUseElement(*element) && toSVGUseElement(*element).resourceIsStillLo
ading()) |
247 return; | 247 return; |
248 | 248 |
249 SVGElement* shadowTreeElement = targetInstance->shadowTreeElement(); | 249 SVGElement* shadowTreeElement = targetInstance->shadowTreeElement(); |
250 ASSERT(shadowTreeElement); | 250 ASSERT(shadowTreeElement); |
251 | 251 |
252 SVGUseElement* directUseElement = targetInstance->directUseElement(); | 252 SVGUseElement* directUseElement = targetInstance->directUseElement(); |
253 String directUseElementName = directUseElement ? directUseElement->nodeName(
) : "null"; | 253 String directUseElementName = directUseElement ? directUseElement->nodeName(
) : "null"; |
254 | 254 |
255 String elementId = element->getIdAttribute(); | 255 String elementId = element->getIdAttribute(); |
256 String elementNodeName = element->nodeName(); | 256 String elementNodeName = element->nodeName(); |
257 String shadowTreeElementNodeName = shadowTreeElement->nodeName(); | 257 String shadowTreeElementNodeName = shadowTreeElement->nodeName(); |
258 String parentNodeName = element->parentNode() ? element->parentNode()->nodeN
ame() : "null"; | 258 String parentNodeName = element->parentNode() ? element->parentNode()->nodeN
ame() : "null"; |
259 String firstChildNodeName = element->firstChild() ? element->firstChild()->n
odeName() : "null"; | 259 String firstChildNodeName = element->firstChild() ? element->firstChild()->n
odeName() : "null"; |
260 | 260 |
261 for (unsigned int i = 0; i < depth; ++i) | 261 for (unsigned i = 0; i < depth; ++i) |
262 text += " "; | 262 text += " "; |
263 | 263 |
264 text += String::format("SVGElementInstance this=%p, (parentNode=%s (%p), fir
stChild=%s (%p), correspondingElement=%s (%p), directUseElement=%s (%p), shadowT
reeElement=%s (%p), id=%s)\n", | 264 text += String::format("SVGElementInstance this=%p, (parentNode=%s (%p), fir
stChild=%s (%p), correspondingElement=%s (%p), directUseElement=%s (%p), shadowT
reeElement=%s (%p), id=%s)\n", |
265 targetInstance, parentNodeName.latin1().data(), eleme
nt->parentNode(), firstChildNodeName.latin1().data(), element->firstChild(), | 265 targetInstance, parentNodeName.latin1().data(), eleme
nt->parentNode(), firstChildNodeName.latin1().data(), element->firstChild(), |
266 elementNodeName.latin1().data(), element, directUseEl
ementName.latin1().data(), directUseElement, shadowTreeElementNodeName.latin1().
data(), shadowTreeElement, elementId.latin1().data()); | 266 elementNodeName.latin1().data(), element, directUseEl
ementName.latin1().data(), directUseElement, shadowTreeElementNodeName.latin1().
data(), shadowTreeElement, elementId.latin1().data()); |
267 | 267 |
268 for (unsigned int i = 0; i < depth; ++i) | 268 for (unsigned i = 0; i < depth; ++i) |
269 text += " "; | 269 text += " "; |
270 | 270 |
271 const HashSet<SVGElementInstance*>& elementInstances = element->instancesFor
Element(); | 271 const HashSet<SVGElementInstance*>& elementInstances = element->instancesFor
Element(); |
272 text += "Corresponding element is associated with " + String::number(element
Instances.size()) + " instance(s):\n"; | 272 text += "Corresponding element is associated with " + String::number(element
Instances.size()) + " instance(s):\n"; |
273 | 273 |
274 const HashSet<SVGElementInstance*>::const_iterator end = elementInstances.en
d(); | 274 const HashSet<SVGElementInstance*>::const_iterator end = elementInstances.en
d(); |
275 for (HashSet<SVGElementInstance*>::const_iterator it = elementInstances.begi
n(); it != end; ++it) { | 275 for (HashSet<SVGElementInstance*>::const_iterator it = elementInstances.begi
n(); it != end; ++it) { |
276 for (unsigned int i = 0; i < depth; ++i) | 276 for (unsigned i = 0; i < depth; ++i) |
277 text += " "; | 277 text += " "; |
278 | 278 |
279 text += String::format(" -> SVGElementInstance this=%p, (refCount: %i, s
hadowTreeElement in document? %i)\n", | 279 text += String::format(" -> SVGElementInstance this=%p, (refCount: %i, s
hadowTreeElement in document? %i)\n", |
280 *it, (*it)->refCount(), (*it)->shadowTreeElement(
)->inDocument()); | 280 *it, (*it)->refCount(), (*it)->shadowTreeElement(
)->inDocument()); |
281 } | 281 } |
282 | 282 |
283 ++depth; | 283 ++depth; |
284 | 284 |
285 for (SVGElementInstance* instance = targetInstance->firstChild(); instance;
instance = instance->nextSibling()) | 285 for (SVGElementInstance* instance = targetInstance->firstChild(); instance;
instance = instance->nextSibling()) |
286 dumpInstanceTree(depth, text, instance); | 286 dumpInstanceTree(depth, text, instance); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 | 477 |
478 // Transfer event listeners assigned to the referenced element to our shadow
tree elements. | 478 // Transfer event listeners assigned to the referenced element to our shadow
tree elements. |
479 transferEventListenersToShadowTree(m_targetElementInstance.get()); | 479 transferEventListenersToShadowTree(m_targetElementInstance.get()); |
480 | 480 |
481 // Update relative length information. | 481 // Update relative length information. |
482 updateRelativeLengthsInformation(); | 482 updateRelativeLengthsInformation(); |
483 | 483 |
484 // Eventually dump instance tree | 484 // Eventually dump instance tree |
485 #ifdef DUMP_INSTANCE_TREE | 485 #ifdef DUMP_INSTANCE_TREE |
486 String text; | 486 String text; |
487 unsigned int depth = 0; | 487 unsigned depth = 0; |
488 | 488 |
489 dumpInstanceTree(depth, text, m_targetElementInstance.get()); | 489 dumpInstanceTree(depth, text, m_targetElementInstance.get()); |
490 fprintf(stderr, "\nDumping <use> instance tree:\n%s\n", text.latin1().data()
); | 490 fprintf(stderr, "\nDumping <use> instance tree:\n%s\n", text.latin1().data()
); |
491 #endif | 491 #endif |
492 | 492 |
493 // Eventually dump shadow tree | 493 // Eventually dump shadow tree |
494 #ifdef DUMP_SHADOW_TREE | 494 #ifdef DUMP_SHADOW_TREE |
495 RefPtr<XMLSerializer> serializer = XMLSerializer::create(); | 495 RefPtr<XMLSerializer> serializer = XMLSerializer::create(); |
496 String markup = serializer->serializeToString(shadowTreeRootElement, ASSERT_
NO_EXCEPTION); | 496 String markup = serializer->serializeToString(shadowTreeRootElement, ASSERT_
NO_EXCEPTION); |
497 fprintf(stderr, "Dumping <use> shadow tree markup:\n%s\n", markup.latin1().d
ata()); | 497 fprintf(stderr, "Dumping <use> shadow tree markup:\n%s\n", markup.latin1().d
ata()); |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 | 974 |
975 if (m_resource) | 975 if (m_resource) |
976 m_resource->removeClient(this); | 976 m_resource->removeClient(this); |
977 | 977 |
978 m_resource = resource; | 978 m_resource = resource; |
979 if (m_resource) | 979 if (m_resource) |
980 m_resource->addClient(this); | 980 m_resource->addClient(this); |
981 } | 981 } |
982 | 982 |
983 } | 983 } |
OLD | NEW |