| 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  * |     6  * | 
|     7  * This library is free software; you can redistribute it and/or |     7  * This library is free software; you can redistribute it and/or | 
|     8  * modify it under the terms of the GNU Library General Public |     8  * modify it under the terms of the GNU Library General Public | 
|     9  * License as published by the Free Software Foundation; either |     9  * License as published by the Free Software Foundation; either | 
|    10  * version 2 of the License, or (at your option) any later version. |    10  * version 2 of the License, or (at your option) any later version. | 
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   422  |   422  | 
|   423     ++depth; |   423     ++depth; | 
|   424  |   424  | 
|   425     for (SVGElementInstance* instance = targetInstance->firstChild(); instance; 
      instance = instance->nextSibling()) |   425     for (SVGElementInstance* instance = targetInstance->firstChild(); instance; 
      instance = instance->nextSibling()) | 
|   426         dumpInstanceTree(depth, text, instance); |   426         dumpInstanceTree(depth, text, instance); | 
|   427  |   427  | 
|   428     --depth; |   428     --depth; | 
|   429 } |   429 } | 
|   430 #endif |   430 #endif | 
|   431  |   431  | 
|   432 static bool isDisallowedElement(Node* element) |   432 static bool isDisallowedElement(Node* node) | 
|   433 { |   433 { | 
|   434     // <foreignObject> should never be contained in a <use> tree. Too dangerous 
      side effects possible. |   434     // Spec: "Any 'svg', 'symbol', 'g', graphics element or other 'use' is poten
      tially a template object that can be re-used | 
|   435     if (element->hasTagName(SVGNames::foreignObjectTag)) |   435     // (i.e., "instanced") in the SVG document via a 'use' element." | 
 |   436     // "Graphics Element" is defined as 'circle', 'ellipse', 'image', 'line', 'p
      ath', 'polygon', 'polyline', 'rect', 'text' | 
 |   437     // Excluded are anything that is used by reference or that only make sense t
      o appear once in a document. | 
 |   438     // We must also allow the shadow roots of other use elements and text. | 
 |   439     if (node->isTextNode()) | 
 |   440         return false; | 
 |   441  | 
 |   442     if (!node->isSVGElement()) | 
|   436         return true; |   443         return true; | 
|   437     if (SVGSMILElement::isSMILElement(element)) |   444  | 
|   438         return true; |   445     SVGElement* element = static_cast<SVGElement*>(node); | 
|   439     return false; |   446  | 
 |   447     DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, allowedElementTags, ()); | 
 |   448     if (allowedElementTags.isEmpty()) { | 
 |   449         allowedElementTags.add(SVGNames::aTag); | 
 |   450         allowedElementTags.add(SVGNames::circleTag); | 
 |   451         allowedElementTags.add(SVGNames::defsTag); | 
 |   452         allowedElementTags.add(SVGNames::descTag); | 
 |   453         allowedElementTags.add(SVGNames::ellipseTag); | 
 |   454         allowedElementTags.add(SVGNames::gTag); | 
 |   455         allowedElementTags.add(SVGNames::imageTag); | 
 |   456         allowedElementTags.add(SVGNames::lineTag); | 
 |   457         allowedElementTags.add(SVGNames::metadataTag); | 
 |   458         allowedElementTags.add(SVGNames::pathTag); | 
 |   459         allowedElementTags.add(SVGNames::polygonTag); | 
 |   460         allowedElementTags.add(SVGNames::polylineTag); | 
 |   461         allowedElementTags.add(SVGNames::rectTag); | 
 |   462         allowedElementTags.add(SVGNames::svgTag); | 
 |   463         allowedElementTags.add(SVGNames::switchTag); | 
 |   464         allowedElementTags.add(SVGNames::symbolTag); | 
 |   465         allowedElementTags.add(SVGNames::textTag); | 
 |   466         allowedElementTags.add(SVGNames::textPathTag); | 
 |   467         allowedElementTags.add(SVGNames::titleTag); | 
 |   468         allowedElementTags.add(SVGNames::trefTag); | 
 |   469         allowedElementTags.add(SVGNames::tspanTag); | 
 |   470         allowedElementTags.add(SVGNames::useTag); | 
 |   471     } | 
 |   472     return !allowedElementTags.contains<QualifiedName, SVGAttributeHashTranslato
      r>(element->tagQName()); | 
|   440 } |   473 } | 
|   441  |   474  | 
|   442 static bool subtreeContainsDisallowedElement(Node* start) |   475 static bool subtreeContainsDisallowedElement(Node* start) | 
|   443 { |   476 { | 
|   444     if (isDisallowedElement(start)) |   477     if (isDisallowedElement(start)) | 
|   445         return true; |   478         return true; | 
|   446  |   479  | 
|   447     for (Node* cur = start->firstChild(); cur; cur = cur->nextSibling()) { |   480     for (Node* cur = start->firstChild(); cur; cur = cur->nextSibling()) { | 
|   448         if (subtreeContainsDisallowedElement(cur)) |   481         if (subtreeContainsDisallowedElement(cur)) | 
|   449             return true; |   482             return true; | 
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1067     SVGElement* element = m_targetElementInstance->correspondingElement(); |  1100     SVGElement* element = m_targetElementInstance->correspondingElement(); | 
|  1068     if (!element || !element->isStyled()) |  1101     if (!element || !element->isStyled()) | 
|  1069         return false; |  1102         return false; | 
|  1070  |  1103  | 
|  1071     return static_cast<SVGStyledElement*>(element)->hasRelativeLengths(); |  1104     return static_cast<SVGStyledElement*>(element)->hasRelativeLengths(); | 
|  1072 } |  1105 } | 
|  1073  |  1106  | 
|  1074 } |  1107 } | 
|  1075  |  1108  | 
|  1076 #endif // ENABLE(SVG) |  1109 #endif // ENABLE(SVG) | 
| OLD | NEW |