Closed Bug 1017878 Opened 10 years ago Closed 5 years ago

[meta] Make picture sizes grammar spec compliant and add tests

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: johns, Unassigned)

References

Details

(Keywords: meta, Whiteboard: [tw-dom] )

Attachments

(6 obsolete files)

The initial sizes syntax in bug 870022 is out of date with the spec, and needs to be updated and given tests for the newest version.
Blocks: 1023519
Blocks: 1052417
No longer blocks: 1052417
Depends on: 1052417
Should Bug 1139560 be considered a dupe of this?
Mike, no, this bug is about parsing sizes="".
Some analysis of failures in http://web-platform.test:8000/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute.html

* sizes="all 100vw, 1px" - media queries are not allowed, only <meta-condition>. Might cause pages to rely on it working.

* sizes="0.1%" - percentages are not allowed, only <length>. Might cause pages to rely on it working.

* sizes="x(),1px" - interferes with graceful fallback when using future extensions. It seems like the entire attribute is ignored if something is invalid.

Some fails are due to changes between MQ L3 and MQ L4 or new CSS units etc; these I would say are low-prio.
(In reply to Simon Pieters from comment #3)
> * sizes="all 100vw, 1px" - media queries are not allowed, only
> <meta-condition>. Might cause pages to rely on it working.

Never mind, it seems Gecko correctly doesn't allow media queries. It's just that the fallback mechanism doesn't work and 100vw is the default.

> * sizes="0.1%" - percentages are not allowed, only <length>. Might cause
> pages to rely on it working.

Any percentage value seems to make Gecko use the image's actual width as intrinsic width instead of acting like sizes="100vw". So Gecko doesn't "allow" percentages but there's still a bug and pages might rely on it.
Blocks: 1064083
Hi John, not sure if you're still working on this. Do you mind if I take it?
Flags: needinfo?(john)
Besides the analysis in comment #3 and comment #4, there are two more different failures,

* sizes="1q" - not sure why test expects the parsing result will be `1px`.

* sizes="calc(1px" - test expects getting error in parsing and falling back to default value, 100vw. But  gecko allows an open construct be closed by EOF, https://dxr.mozilla.org/mozilla-central/source/layout/style/nsCSSParser.cpp#3075-3083.
Summarizing the analysis we have now,

1. sizes="all 100vw, 1px" - media queries are not allowed, only <meta-condition>. And we should fallback to `1px` instead of ignoring entire attribute. See step 4 in https://html.spec.whatwg.org/multipage/embedded-content.html#parse-a-sizes-attribute. 

2. sizes="x(),1px" - interferes with graceful fallback when using future extensions. It seems like the entire attribute is ignored if something is invalid. See step 2 in https://html.spec.whatwg.org/multipage/embedded-content.html#parse-a-sizes-attribute. 

3. sizes="0.1%" - percentages are not allowed. See https://html.spec.whatwg.org/multipage/embedded-content.html#source-size-value.

4. sizes="calc(1px" - test expects getting error in parsing and falling back to default value, 100vw. But  gecko allows an open construct be closed by EOF, https://dxr.mozilla.org/mozilla-central/source/layout/style/nsCSSParser.cpp#3075-3083.

5. sizes="1q" - not sure why test expects the parsing result will be `1px`.

6. sizes="(min-width:0) or (min-width:0) 1px" - due to changes between MQ L3 and MQ L4 or new CSS units etc;
(In reply to Edgar Chen [:edgar][:echen] from comment #8)
> Summarizing the analysis we have now,
> 
> 1. sizes="all 100vw, 1px" - media queries are not allowed, only
> <meta-condition>. And we should fallback to `1px` instead of ignoring entire
> attribute. See step 4 in
> https://html.spec.whatwg.org/multipage/embedded-content.html#parse-a-sizes-
> attribute. 
> 
> 2. sizes="x(),1px" - interferes with graceful fallback when using future
> extensions. It seems like the entire attribute is ignored if something is
> invalid. See step 2 in
> https://html.spec.whatwg.org/multipage/embedded-content.html#parse-a-sizes-
> attribute. 
> 
> 3. sizes="0.1%" - percentages are not allowed. See
> https://html.spec.whatwg.org/multipage/embedded-content.html#source-size-
> value.
> 
> 4. sizes="calc(1px" - test expects getting error in parsing and falling back
> to default value, 100vw. But  gecko allows an open construct be closed by
> EOF,
> https://dxr.mozilla.org/mozilla-central/source/layout/style/nsCSSParser.
> cpp#3075-3083.
> 
> 5. sizes="1q" - not sure why test expects the parsing result will be `1px`.
> 
> 6. sizes="(min-width:0) or (min-width:0) 1px" - due to changes between MQ L3
> and MQ L4 or new CSS units etc;

7. sizes="1px !important" - ParseSourceSizeList() returns parsing error, but still appends the parsing result to the list.
Depends on: 1134120
Assignee: john → echen
Flags: needinfo?(john)

(In reply to Edgar Chen [:edgar][:echen] from comment #8)
> Summarizing the analysis we have now,
> 
> 5. sizes="1q" - not sure why test expects the parsing result will be `1px`.

q stands for "quarter-millimeters", see https://www.w3.org/TR/css-values/#absolute-lengths.
Whiteboard: btpp-active
Whiteboard: btpp-active → [tw-dom] btpp-active
\o/ thanks for working on this
Attachment #8738468 - Attachment is obsolete: true
Attachment #8740449 - Attachment is obsolete: true
Comment on attachment 8741895 [details]
MozReview Request: Bug 1017878 - Part 1: Don't append result to the candidate list if got unexpected token at the end of size string

Sorry, there are some works need to do, canceling the review first.
Attachment #8741895 - Flags: review?(josh)
Attachment #8741896 - Flags: review?(josh)
Attachment #8741897 - Flags: review?(josh)
Since there are multiple things we need to fix, I'd like to file separated bugs for each of one and leave this bug as meta bug to track the status.
Attachment #8741895 - Attachment is obsolete: true
Attachment #8741896 - Attachment is obsolete: true
Attachment #8741897 - Attachment is obsolete: true
Depends on: 1274519
Depends on: 1274526
(In reply to Edgar Chen [:edgar][:echen] from comment #9)
> 
> 4. sizes="calc(1px" - test expects getting error in parsing and falling back
> to default value, 100vw. But  gecko allows an open construct be closed by
> EOF,
> https://dxr.mozilla.org/mozilla-central/source/layout/style/nsCSSParser.
> cpp#3075-3083.

This test is wrong and gecko behaviour is correct, see https://github.com/w3c/web-platform-tests/issues/3066.
Depends on: 1275511
Keywords: meta
Whiteboard: [tw-dom] btpp-active → [tw-dom]
> 6. sizes="(min-width:0) or (min-width:0) 1px" - due to changes between MQ L3 and MQ L4 or new CSS units etc;

IIRC, this is the only thing we need to fix which depends on bug 1312621.
Assignee: echen → nobody
Status: ASSIGNED → NEW
Depends on: mediaqueries-4
Priority: -- → P3
Summary: Make picture sizes grammar spec compliant and add tests → [meta] Make picture sizes grammar spec compliant and add tests
I think that got done in bug 1422225, unless I'm misinterpreting something.
Yes, thanks for this information. I will udpate the dependency and also close this bug.
Status: NEW → RESOLVED
Closed: 5 years ago
Depends on: 1422225
No longer depends on: mediaqueries-4
Resolution: --- → FIXED
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: