mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Add dimension source attribute to HTMLImageElement (#38152)
HTMLImageElement was missing the dimension source attribute, as step 9 from [here](https://html.spec.whatwg.org/multipage/images.html#updating-the-source-set) wasn't implemented. This meant that for an element like this: ```html <picture> <source media="(min-width: 1000px)" srcset="" width="84" height="29"> <img src="" width="25" height="25" alt="Wikimedia Foundation" lang="en" loading="lazy"> </picture> ``` The `width` and `height` attributes of the source tag were being ignored. This broke stuff like these icons on the main page of Wikipedia. **Original:** <img width="2252" height="229" alt="image" src="https://github.com/user-attachments/assets/fa3fdd9d-5f91-43d4-bc9d-784b0a836d44" /> **Fixed:** <img width="2252" height="229" alt="image" src="https://github.com/user-attachments/assets/6f4ca4ae-e764-4394-ac31-9a92bbb456ab" /> Testing: If there isn't an existing test that covers this I'll make one, waiting for the github runner to tell me whether this is covered and then I'll amend the PR --------- Signed-off-by: Leo Ring <leoring03@gmail.com> Signed-off-by: Xiaocheng Hu <hu.xiaocheng@huawei.com> Signed-off-by: Xiaocheng Hu <xiaochengh.work@gmail.com> Co-authored-by: Xiaocheng Hu <hu.xiaocheng@huawei.com> Co-authored-by: Xiaocheng Hu <xiaochengh.work@gmail.com>
This commit is contained in:
parent
be38bd4636
commit
5592061474
2 changed files with 36 additions and 15 deletions
|
@ -31,9 +31,3 @@
|
|||
|
||||
[If we only have height attribute, we should get height mapped but no aspect ratio, even if <img> has attributes.]
|
||||
expected: FAIL
|
||||
|
||||
[Loaded picture test: <source> with width and height attributes, <img> without width and height attributes]
|
||||
expected: FAIL
|
||||
|
||||
[Loaded picture test: Both <source> and <img> are with width and height attributes]
|
||||
expected: FAIL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue