Bug 96816 - <use> not working when the SVG doc is embedded in <object> data
Summary: <use> not working when the SVG doc is embedded in <object> data
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Florin Malita
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-14 11:58 PDT by Florin Malita
Modified: 2012-09-15 22:03 PDT (History)
5 users (show)

See Also:


Attachments
SVG use fail for <object> data (907 bytes, text/html)
2012-09-14 11:58 PDT, Florin Malita
no flags Details
Patch (4.11 KB, patch)
2012-09-14 13:29 PDT, Florin Malita
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.