Closed Bug 382325 Opened 13 years ago Closed 12 years ago

SVG should fall back to 300px x 150px as per CSS 2.1 section 10.3.2

Categories

(Core :: SVG, defect)

defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: jwatt, Assigned: jwatt)

References

Details

(Keywords: regression, testcase)

Attachments

(4 files)

Absolutely positioned HTML div elements don't seem to recognize the width and height of content SVG. As a result an absolutely positioned div containing only an svg element will be rendered at zero width and height, and the SVG is never displayed. This used to work before the reflow branch landing.

It's likely that this bug will be fixed when one or all of the bugs in the following list is fixed, but I want to track this particular testcase failure.

https://bugzilla.mozilla.org/buglist.cgi?bug_id=280923,288276,294086,342532,367031
Attachment #266474 - Attachment description: testcase → testcase - SVG in absolutely positioned div
Summary: Absolutely positioned HTML div doesn't expand around SVG content → Absolutely positioned/inline-block div doesn't expand around child SVG
When verifying any future fix, check that the document repaints correctly when it is loaded in a small window and the window size is increased.
This is fixed by my patch in bug 294086.
Depends on: 294086
Actually no, the two testcases attached to this bug do not render as I originally expected them to after landing the patch for bug 294086. The testcases turn out to be invalid as written since the height of the <svg>'s containing block depends on the <svg>, but the <svg> has an implicit percentage height so depends on its containing block. This cyclic dependency should mean that the height of the SVG falls back to 150px, but the SVG actually doesn't render at all. I need to investigate why.
Assignee: nobody → jwatt
So in both testcases, both the width and the height of the <div> depend on the child <svg>. The height of the SVG is in fact falling back to 150px, but the width, which should be falling back to 300px, is incorrectly falling back to 0.

Changing the bug Summary to reflect this.
Summary: Absolutely positioned/inline-block div doesn't expand around child SVG → SVG in a positioned/inline-block div should fall back to 300px x 150px
The same problem occurs in HTML tables with unconstrained table cell dimensions.
Status: NEW → ASSIGNED
Summary: SVG in a positioned/inline-block div should fall back to 300px x 150px → SVG in a tables etc should fall back to 300px x 150px
Attached patch patchSplinter Review
Attachment #299203 - Flags: superreview?(tor)
Attachment #299203 - Flags: review?(longsonr)
Could you add something to say where the 300 comes from. i.e. per CSS 2.1 section 10.3.2.  (assuming that's correct).
Attachment #299203 - Flags: review?(longsonr) → review+
Good idea. Do you think the following is okay:

    // If we're being called then our containing block's width depends on our
    // width - fall back to 300px as required by CSS 2.1.
Pointing to the right section of CSS 2.1 would be even better, assuming that's possible.
Uh, I seemed to loose the text over the line break in my paste. I meant:

    // If we're being called then our containing block's width depends on our
    // width - fall back to 300px as required by CSS 2.1 section 10.3.2.
Comment on attachment 299203 [details] [diff] [review]
patch

sr=tor with longsonr's comment suggested comment changes.
Attachment #299203 - Flags: superreview?(tor) → superreview+
(In reply to comment #11)
> Uh, I seemed to loose the text over the line break in my paste. I meant:
> 
>     // If we're being called then our containing block's width depends on our
>     // width - fall back to 300px as required by CSS 2.1 section 10.3.2.
> 

That works for me.
Summary: SVG in a tables etc should fall back to 300px x 150px → SVG should fall back to 300px x 150px as per CSS 2.1 section 10.3.2
Comment on attachment 299203 [details] [diff] [review]
patch

Requesting approval1.9. Very low risk patch to fix standards compliance issue.
Attachment #299203 - Flags: approval1.9?
And without this fix the SVG doesn't display at all, so we really do want this.
Comment on attachment 299203 [details] [diff] [review]
patch

a=beltzner for 1.9
Attachment #299203 - Flags: approval1.9? → approval1.9+
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Flags: in-testsuite?
Marking in-testsuite- since we decided this is not the right thing to do in bug 382325, and hence the patch here was backed out (in said bug).
Flags: in-testsuite? → in-testsuite-
Err, bug 414112.
You need to log in before you can comment on or make changes to this bug.