2007-10-01 Eric Seidel <eric@webkit.org>
[WebKit-https.git] / WebKit / DOM / WebDOMOperations.mm
index ca725f717238d5b4f3902594d1f5ce5bb1f59fdc..ce9088baeb33b434319649d0dff4bce454aedba3 100644 (file)
@@ -37,6 +37,9 @@
 #import <WebKit/WebKitNSStringExtras.h>
 #import <WebKit/WebArchiver.h>
 
+#if ENABLE(SVG)
+#import <WebKit/DOMSVG.h>
+#endif
 
 @implementation DOMNode (WebDOMNodeOperations)
 
     
     SEL selector = firstSel;
     do {
+#if ENABLE(SVG)
+        NSString *string;
+        id attributeValue = [self performSelector:selector];
+        if ([attributeValue isKindOfClass:[DOMSVGAnimatedString class]])
+            string = [(DOMSVGAnimatedString*)attributeValue animVal];
+        else
+            string = attributeValue;
+#else
         NSString *string = [self performSelector:selector];
-        if ([string length] > 0) {
+#endif
+        if ([string length] > 0)
             [URLs addObject:[[self ownerDocument] URLWithAttributeString:string]];
-        }
     } while ((selector = va_arg(args, SEL)) != nil);
     
     va_end(args);
 
 @end
 
+#if ENABLE(SVG)
+
+@implementation DOMSVGImageElement (WebDOMSVGImageElementOperationsPrivate)
+
+- (NSArray *)_subresourceURLs
+{
+    return [self _URLsFromSelectors:@selector(href), nil];
+}
+
+@end
+
+@implementation DOMSVGScriptElement (WebDOMSVGScriptElementOperationsPrivate)
+
+- (NSArray *)_subresourceURLs
+{
+    return [self _URLsFromSelectors:@selector(href), nil];
+}
+
+@end
+
+@implementation DOMSVGCursorElement (WebDOMSVGCursorElementOperationsPrivate)
+
+- (NSArray *)_subresourceURLs
+{
+    return [self _URLsFromSelectors:@selector(href), nil];
+}
+
+@end
+
+@implementation DOMSVGFEImageElement (WebDOMSVGFEImageElementOperationsPrivate)
+
+- (NSArray *)_subresourceURLs
+{
+    return [self _URLsFromSelectors:@selector(href), nil];
+}
+
+@end
+
+#endif
+
+@implementation DOMProcessingInstruction (WebDOMProcessingInstructionOperationsPrivate)
+
+- (NSString *)_stylesheetURL
+{
+    DOMStyleSheet *styleSheet = [self sheet];
+    if (styleSheet)
+        return [styleSheet href];
+    return nil;
+}
+
+- (NSArray *)_subresourceURLs
+{
+    return [self _URLsFromSelectors:@selector(_stylesheetURL), nil];
+}
+
+@end
+
 @implementation DOMHTMLEmbedElement (WebDOMHTMLEmbedElementOperationsPrivate)
 
 - (NSArray *)_subresourceURLs