Bug 5392

Summary: WebKit SVG lacks relevant context menu
Product: WebKit Reporter: Daniel Udey <dan>
Component: SVGAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: ian, sullivan
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Bug Depends on: 5971, 10882    
Bug Blocks:    

Description Daniel Udey 2005-10-15 20:48:29 PDT
Right-clicking on an SVG object in Safari fails to provide a context menu relevant to the content (e.g. like 
'Open in New Tab', 'Save to Downloads', etc. in an image's context menu).

Useful context menu items (in addition to those in the image context menu) might be zoom functions 
(zoom in/out/normal), and 'View SVG Source'. Opera 8.5 and the Adobe SVG Plug-in have good context 
menus which may be worth reviewing as well.
Comment 1 Eric Seidel (no email) 2006-01-23 03:05:26 PST
The contextual menus seem to be there these days.  Can you confirm?
Comment 2 Daniel Udey 2006-01-23 09:39:33 PST
(In reply to comment #1)
> The contextual menus seem to be there these days.  Can you confirm?

The bug was specific to SVG canvases - right-clicking on an SVG canvas gets you the same context menu as you get in an HTML document - no option for 'Copy Image Location', etc. is provided (i.e. no SVG-specific options are available).
Comment 3 Eric Seidel (no email) 2006-01-23 11:03:39 PST
So I'm assuming you'd like this reopened.  Are there other contextual menus you would like to see besides "Copy Image Location"?  Would you like to see existing ones removed?
Comment 4 Eric Seidel (no email) 2006-08-11 21:46:22 PDT
The way this code is currently implemented, we can't make this work until SVG has Obj-C DOM bindings.

The code which generates this menu can be found in:
- (NSArray *)contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems
inside WebDefaultContextMenuItemsForElement in WebKit.

Once we have SVG Obj-C DOM bindings, we could consider adding an "absoluteImageURL" method on the SVGSVGElement Obj-C class.  I'm not sure that would be correct however.

SVG, unlike an image, is interactive.  Thus clicking in the SVG means the SVG has a chance to respond to the mouse event.  When SVGs are referenced from inside <img> tags (not yet possible: bug 5971) then this type of operation will work for automatically. When SVGs are inside <embed> or <object> tags, I'm not sure we'd want these menu items at all.
Comment 5 Eric Seidel (no email) 2006-09-22 05:29:57 PDT
Adding dependency links to the bug 5971 about svgs in <img> tags and bug 10882 about the SVG Obj-C bindings.
Comment 6 Eric Seidel (no email) 2006-12-29 01:06:34 PST
SVGImage support is in.  And this "just works" at least when SVGs are referenced from <img> tags.  I'm going to close this.  Feel free to re-open if you feel there is something we still haven't covered.

You can grab a nightly from http://nightly.webkit.org/  You'll have to make your own html file which references an svg from an <img> tag, since I don't have an easy example to point you to on the web.