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, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2008 Apple Inc. All rights reserved. | 4 * Copyright (C) 2008 Apple Inc. All rights reserved. |
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> | 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> |
6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 6 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // <title> elements are the title of the document, not a tooltip) so we inst
antly return. | 232 // <title> elements are the title of the document, not a tooltip) so we inst
antly return. |
233 if (isOutermostSVGSVGElement()) | 233 if (isOutermostSVGSVGElement()) |
234 return String(); | 234 return String(); |
235 | 235 |
236 // Walk up the tree, to find out whether we're inside a <use> shadow tree, t
o find the right title. | 236 // Walk up the tree, to find out whether we're inside a <use> shadow tree, t
o find the right title. |
237 if (isInShadowTree()) { | 237 if (isInShadowTree()) { |
238 Element* shadowHostElement = toShadowRoot(treeScope().rootNode()).host()
; | 238 Element* shadowHostElement = toShadowRoot(treeScope().rootNode()).host()
; |
239 // At this time, SVG nodes are not allowed in non-<use> shadow trees, so
any shadow root we do | 239 // At this time, SVG nodes are not allowed in non-<use> shadow trees, so
any shadow root we do |
240 // have should be a use. The assert and following test is here to catch
future shadow DOM changes | 240 // have should be a use. The assert and following test is here to catch
future shadow DOM changes |
241 // that do enable SVG in a shadow tree. | 241 // that do enable SVG in a shadow tree. |
242 ASSERT(!shadowHostElement || shadowHostElement->hasTagName(SVGNames::use
Tag)); | 242 ASSERT(!shadowHostElement || isSVGUseElement(*shadowHostElement)); |
243 if (shadowHostElement && shadowHostElement->hasTagName(SVGNames::useTag)
) { | 243 if (isSVGUseElement(shadowHostElement)) { |
244 SVGUseElement* useElement = toSVGUseElement(shadowHostElement); | 244 SVGUseElement& useElement = toSVGUseElement(*shadowHostElement); |
245 | 245 |
246 // If the <use> title is not empty we found the title to use. | 246 // If the <use> title is not empty we found the title to use. |
247 String useTitle(useElement->title()); | 247 String useTitle(useElement.title()); |
248 if (!useTitle.isEmpty()) | 248 if (!useTitle.isEmpty()) |
249 return useTitle; | 249 return useTitle; |
250 } | 250 } |
251 } | 251 } |
252 | 252 |
253 // If we aren't an instance in a <use> or the <use> title was not found, the
n find the first | 253 // If we aren't an instance in a <use> or the <use> title was not found, the
n find the first |
254 // <title> child of this element. | 254 // <title> child of this element. |
255 // If a title child was found, return the text contents. | 255 // If a title child was found, return the text contents. |
256 if (Element* titleElement = Traversal<SVGTitleElement>::firstChild(*this)) | 256 if (Element* titleElement = Traversal<SVGTitleElement>::firstChild(*this)) |
257 return titleElement->innerText(); | 257 return titleElement->innerText(); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 for (HashSet<SVGElement*>::iterator it = m_elementsWithRelativeLengths.begin
(); it != end; ++it) { | 508 for (HashSet<SVGElement*>::iterator it = m_elementsWithRelativeLengths.begin
(); it != end; ++it) { |
509 if (*it != this) | 509 if (*it != this) |
510 (*it)->invalidateRelativeLengthClients(layoutScope); | 510 (*it)->invalidateRelativeLengthClients(layoutScope); |
511 } | 511 } |
512 } | 512 } |
513 | 513 |
514 SVGSVGElement* SVGElement::ownerSVGElement() const | 514 SVGSVGElement* SVGElement::ownerSVGElement() const |
515 { | 515 { |
516 ContainerNode* n = parentOrShadowHostNode(); | 516 ContainerNode* n = parentOrShadowHostNode(); |
517 while (n) { | 517 while (n) { |
518 if (n->hasTagName(SVGNames::svgTag)) | 518 if (isSVGSVGElement(*n)) |
519 return toSVGSVGElement(n); | 519 return toSVGSVGElement(n); |
520 | 520 |
521 n = n->parentOrShadowHostNode(); | 521 n = n->parentOrShadowHostNode(); |
522 } | 522 } |
523 | 523 |
524 return 0; | 524 return 0; |
525 } | 525 } |
526 | 526 |
527 SVGElement* SVGElement::viewportElement() const | 527 SVGElement* SVGElement::viewportElement() const |
528 { | 528 { |
529 // This function needs shadow tree support - as RenderSVGContainer uses this
function | 529 // This function needs shadow tree support - as RenderSVGContainer uses this
function |
530 // to determine the "overflow" property. <use> on <symbol> wouldn't work oth
erwhise. | 530 // to determine the "overflow" property. <use> on <symbol> wouldn't work oth
erwhise. |
531 ContainerNode* n = parentOrShadowHostNode(); | 531 ContainerNode* n = parentOrShadowHostNode(); |
532 while (n) { | 532 while (n) { |
533 if (n->hasTagName(SVGNames::svgTag) || n->hasTagName(SVGNames::imageTag)
|| n->hasTagName(SVGNames::symbolTag)) | 533 if (isSVGSVGElement(*n) || isSVGImageElement(*n) || isSVGSymbolElement(*
n)) |
534 return toSVGElement(n); | 534 return toSVGElement(n); |
535 | 535 |
536 n = n->parentOrShadowHostNode(); | 536 n = n->parentOrShadowHostNode(); |
537 } | 537 } |
538 | 538 |
539 return 0; | 539 return 0; |
540 } | 540 } |
541 | 541 |
542 SVGDocumentExtensions& SVGElement::accessDocumentSVGExtensions() | 542 SVGDocumentExtensions& SVGElement::accessDocumentSVGExtensions() |
543 { | 543 { |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 animatableAttributes.add(SVGNames::zAttr); | 1133 animatableAttributes.add(SVGNames::zAttr); |
1134 } | 1134 } |
1135 | 1135 |
1136 if (name == classAttr) | 1136 if (name == classAttr) |
1137 return true; | 1137 return true; |
1138 | 1138 |
1139 return animatableAttributes.contains(name); | 1139 return animatableAttributes.contains(name); |
1140 } | 1140 } |
1141 #endif | 1141 #endif |
1142 } | 1142 } |
OLD | NEW |