Sunday, 11 November 2012

Re: Embedded SVGs

In article
<OUT-509FC3CC.MD-1.4.17.chris.young@unsatisfactorysoftware.co.uk>,
Chris Young <chris.young@unsatisfactorysoftware.co.uk> wrote:

> "SVG Tiger IMG Tag" at the top
> Rest of the page blank.

OK. There seems to have been a couple of problems.

The problem in NetSurf was we weren't calling content_reformat on the SVG.

So now this (lion) should now work:

data:text/html,%3Ch1%3ESVG%20Lion%20IMG%20Tag%3C/h1%3E%3Cimg%20src=%22http://croczilla.com/bits_and_pieces/svg/samples/lion/lion.svg%22%3E


> If I go straight to the tiger URL it displays fine unembedded.

As for the tiger, it does not set a width attribute on the SVG tag, so
libsvgtiny sets the "diagram width" to whatever it gets passed as a
viewport width.

This is almost fine when you view it unembedded. (If the window is too
narrow you won't be able to scroll to see the rest, since NetSurf doesn't
get told the true size.)

When you view the tiger in an HTML document, the viewport width passed to
libsvgtiny will be given by the the initial box size. If the box doesn't
have a width and is, say, inline this will be 0 and the image will not be
shown.

Tiger Inline IMG tag:

data:text/html,%3Ch1%3ESVG%20Tiger%20Inline%20IMG%20Tag%3C/h1%3E%3Cimg%20src=%22http://croczilla.com/bits_and_pieces/svg/samples/tiger/tiger.svg%22%3E


Tiger Block IMG tag:

data:text/html,%3Ch1%3ESVG%20Tiger%20Block%20IMG%20Tag%3C/h1%3E%3Cimg%20style=%22display:block%22%20src=%22http://croczilla.com/bits_and_pieces/svg/samples/tiger/tiger.svg%22%3E


So we need to fix libsvgtiny to do the right thing when width/height
attributes aren't given.



> Is there any reason why embedded/inline SVGs don't display? Here on
> the below link, all I can see is the "iframe" SVG briefly flash on
> screen. Showing the SVGs outside of the page is fine.

> http://www.schepers.cc/svg/blendups/embedding.html

Any change with this? It still works here.

Cheers,

--

Michael Drake (tlsa) http://www.netsurf-browser.org/

No comments:

Post a Comment