W3C home > Mailing lists > Public > www-svg@w3.org > August 2009

Re: foreignObject and viewBox and XHTML

From: Helder Magalh„es <helder.magalhaes@gmail.com>
Date: Sat, 15 Aug 2009 13:42:25 +0100
Message-ID: <2a1ddf8a0908150542n272e71aeh33703a2c40600871@mail.gmail.com>
To: Jason Dusek <jason.dusek@gmail.com>
Cc: www-svg@w3.org
Hi Jason,


> †What is the theory here? Is this something that should work
> †but doesn't (not in Gecko or Webkit) or is it something that
> †definitely shouldn't work?

I'd say that that this sort of questions should be addressed in
another mailing list, as this one is meant for "technical discussion
on Scalable Vector Graphics (SVG) and its specifications" [1] and this
seems to be an authoring problem. I'd recommend SVG Developers [2] for
those. ;-)

Also, you stated that it doesn't work in Gecko nor Webkit, but don't
provide any version information (which is very relevant given SVG
support is getting improved as we speak). I'd also suggest trying
Opera when conducting these sort of support tests, as it's one of the
best available implementations in terms of SVG support [3].


You also don't state what was expected and what you ended up with in
prose: one needs to figure that out by:
 * Copy+paste your test case into a file and test it in those implementations;
 * Mentally parse the pasted code snippet taking a look at the
comments in order to figure out what was intended.
A textual description would help; stating you intention [4] was even better! :-)


Follows a quick attempt to comment on the code snippet (while testing it):

> †<rect width="100%" height="100%" fill="black" />

Why "black"? This was causing all visible text to be "hidden"! Change
to "silver" (or any other lighter color) to see something immediately
changing... ;-)



> †<!-- This text is visible. -->
> †<foreignObject x="0" y="0" width="200" height="200">
> † †<body xmlns="http://www.w3.org/1999/xhtml">
> † † †<p> Text in root SVG element. </p>
> † †</body>
> †</foreignObject>

Yep, can see it. :-)


> †<!-- This SVG element has a viewBox defined. None of the text shows up. -->
> †<svg viewBox="-1.6180339887498948482 -1 3.23606797749979 2" >
> † †<!-- †Bounding box to see the viewBox.†-->
> † †<rect x="-50%" y="-50%" width="100%" height="100%"
> † † †stroke-width="0.002" stroke="white" fill="none" />

Where did those "viewBox" values come from?

Changed the "rect"'s fill to "grey"; added "fill-opacity" to see
(potential) overlying content. Also, note that it isn't actually a
'bounding box' as its coordinates aren't set to the actual viewBox
(should be "0%"). As I understand it, percentage units apply to the
current SVG document [5] (but I might be wrong).


I'm attaching a modified version which works for me in Gecko (Firefox
3.0.13, Ubuntu), although it still looks messy as the text strings are
stacked: I've changed text colors in order to help distinguishing a
bit. ;-)

Actually, I've noticed an unexpected behavior in Gecko (didn't check
other rendering engines) for this test case: the "gray" rectangle
disappears in wider than taller windows. I notice it disappearing in
edge values: it's there, and if I make the window a bit taller it
disappears; if I resize back it appears again. Weird (or, at least to
me, unexpected)...


Hope this helps,
  Helder


[1] http://lists.w3.org/Archives/Public/www-svg/
[2] http://tech.groups.yahoo.com/group/svg-developers/
[3] http://www.codedread.com/svg-support.php
[4] http://catb.org/~esr/faqs/smart-questions.html#goal
[5] http://www.w3.org/TR/SVG/coords.html#Units


EmbeddingXHTML.svg
(image/svg+xml attachment: EmbeddingXHTML.svg)

Received on Saturday, 15 August 2009 12:43:06 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:43 GMT