CSS Test: The 'image-fit' property applies to replaced elements only


Melinda Grant, 2008/08/27 19:09

I think a better way to prove this would be to put an image in the div to show that the image-fit value didn't apply to the div and therefore wasn't inherited by the img…

Use 'contain' because 'fill' is the initial value so 'fill' is what we'll get if the implementation is correct. Use a red background on the image.

In addition to proving it doesn't apply to non-replaced block elements, we should probably also show that it doesn't apply to non-replaced inline elements, so put an image in a span as well.

Tom Clancy, 2008/09/12 06:28

Updated. Is there any reason to keep 002-b (http://csswg.inkedblade.net/test/css2.1/submit/25)? I'm not sure why I split this into two tests and can't find any emails that requested it.

Melinda Grant, 2008/09/18 17:43

I gave you bad advice above. It seems even though the property doesn't apply, it still gets passed on to kids to inherit. We know this because CSS2.1 Section 6.1.2 says “The computed value exists even when the property doesn't apply, as defined by the 'Applies To' line.” I think the translation to “Property values are inherited by children even when the property doesn't apply to the element itself” is a bit subtle, but then CSS's 'elegance' still goes right over my head every now and then. ;-)

I think the best we can do here is to create two fixed-sized divs with different aspect ratios and put one inside another, set image-fit on the inner and show that it is not rescaled to 'fit'. Repeat for abspos. Do another and set min-width on the inner rather than h/w; and another for max-height.

My preference would be to put it all within a single test, using multiple pages if necessary. But someone else may prefer them as separate tests, so use your judgment. Send email if this is confusing. %-\

Tom Clancy, 2008/11/11 14:44

I changed this test from http://www.revenutiontesting.com/w3c/image-fit-002-a.xht to http://www.revenutiontesting.com/w3c/image-fit-002.xht; since there's just one test now, I didn't want it to be mis-leading. Each of the old links works if you want them for reference. I've added 3 of the 4 tests you describe. The only one I left out was the absolute position version as I'm not clear how you see that test working. If the inner box is absolutely positioned, the constraint of the outer box's height/ width wouldn't have any effect anyway, would it?

Melinda Grant, 2008/11/11 19:59

I don't see anything here that relies on 1px being 1/96in, so we can lose the 96dpi flag. (The test would work the same if 1px were 1/72in or 1/30cm.)

Folding the page in half won't help the tester here.

Make the boxes smaller so they'll fit on a 4x6in page.

If the inner box is absolutely positioned, the constraint of the outer box's height/ width wouldn't have any effect anyway, would it?

Sorry, I wasn't clear. If the outer box is relatively positioned and the inner is absolutely positioned, we can prove that the inner box isn't rescaled to 'fit'.

Tom Clancy, 2008/11/12 05:57


You could leave a comment if you were logged in.
test/css2.1/submit/24.txt · Last modified: 2014/12/09 15:48 (external edit)
Recent changes RSS feed Valid XHTML 1.0 Valid CSS Driven by DokuWiki