Bug 96816

Summary: <use> not working when the SVG doc is embedded in <object> data
Product: WebKit Reporter: Florin Malita <fmalita>
Component: SVGAssignee: Florin Malita <fmalita>
Status: RESOLVED FIXED    
Severity: Normal CC: krit, pdr, schenney, webkit.review.bot, zimmermann
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
SVG use fail for <object> data
none
Patch none

Description Florin Malita 2012-09-14 11:58:27 PDT
Created attachment 164201 [details]
SVG use fail for <object> data

Chromium issue: http://code.google.com/p/chromium/issues/detail?id=148786

When the SVG document is embedded as inline <object> data, the use element doesn't seem work. Same document embedded as inline <img> data works fine (see attached test).
Comment 1 Florin Malita 2012-09-14 13:08:43 PDT
The problem seems to be that href's are always considered external when embedding via <object> data.

SVGURIReference::isExternalURIReference():

        // If the URI matches our documents URL, early exit, we're dealing with a local reference.
        ASSERT(document);
        KURL url = document->completeURL(uri);
        if (equalIgnoringFragmentIdentifier(url, document->url()))
            return false;

        // If the URI doesn't contain a base string, just see if it starts with a fragment-identifier.
        return uri.find('#') != notFound;

For <object> data-embedded SVGs, the document URL is set to the actual 'data' attribute value (unlike <img>'s). So the test above falls through and hits the last return.... which is odd as it doesn't seem to do what the comment says at all: shouldn't we just check if the first character matches '#'?

I'll post a patch shortly.
Comment 2 Florin Malita 2012-09-14 13:29:46 PDT
Created attachment 164214 [details]
Patch
Comment 3 WebKit Review Bot 2012-09-15 22:03:21 PDT
Comment on attachment 164214 [details]
Patch

Clearing flags on attachment: 164214

Committed r128702: <http://trac.webkit.org/changeset/128702>
Comment 4 WebKit Review Bot 2012-09-15 22:03:25 PDT
All reviewed patches have been landed.  Closing bug.