Closed Bug 452031 Opened 16 years ago Closed 4 years ago

SVG in XUL has incorrect height

Categories

(Core :: SVG, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: Dolske, Unassigned)

Details

Attachments

(1 file)

388 bytes, application/vnd.mozilla.xul+xml
Details
Attached file Testcase
While working on bug 448909, I ran into problems with my SVG viewport not being sized as expected. I distilled it down to the following attachment.

Here, the window is split into half vertically and horizontally. The green box on the left should be the same height as the red box on the left. Instead, the red box is taller.

Replacing
  <svg:svg flex="1" style="background-color: red"/>
with
  <box flex="1" style="background-color: red"/>

works as expected.
(In reply to comment #0)
> Here, the window is split into half vertically and horizontally. The green box
> on the left should be the same height as the red box on the left. Instead, the
> red box is taller.

As you haven't specified a height for the SVG element, it defaults to some height, (100 pixels perhaps?). The default height of a box is 0. When the remaining empty space is divided between the svg/box and spacers, there is more empty space to divide between the box and spacer, so it appears smaller.
 

Ugh. SVG/XUL interaction is rather undefined, and whatever behavior you get is probably by accident.

Looking at the testcase, the extra height appears to come from the SVG's fallback height of 150px. If you set the 'height' attribute to that value you'll see you get the same rendering (and if you adjust it up and down you'll adjust the rendered height up and down). As a consequence, a hack would be to set height="0" to allow 'flex' to work without interference. You'll then get the rendering you want (for now).

Neil: the height defaults to 100%, which falls back to 150px when a percentage can't be resolved.
I'd close this as invalid, but it's not clear from the last comment if this is really expected (if unfortunate) behavior or not.

No longer blocks 448909, in any case.
No longer blocks: 448909
I don't think the current behavior makes any sense. Let's leave this open.

XUL is obsolete now.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: