Skip to content

Fix sizing of replaced elements with min/max sizes - #32777

Merged
mrobinson merged 1 commit into
servo:mainfrom
valadaptive:img-auto-aspect-ratio
Jul 18, 2024
Merged

mrobinson merged 1 commit into
servo:mainfrom
valadaptive:img-auto-aspect-ratio

Conversation

@valadaptive

@valadaptive valadaptive commented Jul 15, 2024 •

Copy link
Copy Markdown
Contributor

If a (min/max)-(height/width) property is set, we still need to respect the intrinsic ratio of the element if it exists. The previous code was simply clamping the element size after doing the sizing calculations once, but this leads to an incorrect aspect ratio.

Now, we clamp to the maximum size and redo the calculations, then do the same with the minimum size.

I'm not sure if we need to do it in two steps, as the CSS spec does, or if we can just clamp between the min and max sizes in one step (possibly even before calculating the tentative size in the first place), but to avoid any unforeseen edge cases, I've opted to take the spec literally here.


  • There are tests for these changes (It appears WPT has several tests that cover this behavior)
  • These changes do not require tests because ___

(What kind of test should I add? The automated testing section of the book mentions wpt, but am I supposed to put "home-grown" tests in there too, or is it supposed to be just for the official wpt test suite?)

@valadaptive
valadaptive force-pushed the img-auto-aspect-ratio branch from 97477c2 to 6615533 Compare July 15, 2024 16:10
@jdm jdm added the T-linux-wpt Do a try run of the WPT label Jul 15, 2024
@github-actions github-actions Bot removed the T-linux-wpt Do a try run of the WPT label Jul 15, 2024
@github-actions

Copy link
Copy Markdown

🔨 Triggering try run (#9942861470) for Linux WPT

@jdm

jdm commented Jul 15, 2024

Copy link
Copy Markdown
Member

What kind of test should I add? The automated testing section of the book mentions wpt, but am I supposed to put "home-grown" tests in there too, or is it supposed to be just for the official wpt test suite?)

If there are not already test cases covering this behavior in the official WPT suite, we should add one to it.

@mrobinson mrobinson added A-layout/2020 https://github.com/servo/servo/wiki/Layout-2020 and removed A-layout/2020 https://github.com/servo/servo/wiki/Layout-2020 labels Jul 15, 2024
@valadaptive

Copy link
Copy Markdown
Contributor Author

Ah, so should I just wait for the WPT run to complete and see if anything turns green?

@mrobinson

Copy link
Copy Markdown
Member

Ah, so should I just wait for the WPT run to complete and see if anything turns green?

Yep! Let's do that. That will also give you a pointer to which tests you can run locally to continue testing your changes, if necessary.

@github-actions

Copy link
Copy Markdown

Test results for linux-wpt-layout-2020 from try job (#9942861470):

Flaky unexpected result (22)
  • FAIL [expected PASS] /_mozilla/css/dirty_viewport.html (#13731)
  • TIMEOUT [expected OK] /_webgl/conformance/glsl/misc/shader-with-non-reserved-words.html (#16216)
    • NOTRUN [expected PASS] subtest: Overall test
  • TIMEOUT [expected OK] /_webgl/conformance/uniforms/out-of-bounds-uniform-array-access.html (#26225)
    • NOTRUN [expected PASS] subtest: Overall test
  • OK /css/css-values/cap-invalidation.html (#32757)
    • FAIL [expected PASS] subtest: CSS Values and Units Test: cap invalidation

      uncaught exception: Error: assert_not_equals: expect the capital height of Ahem and sans-serif to be different got disallowed value 371.3333333333333
      

  • TIMEOUT [expected OK] /css/cssom-view/MediaQueryList-change-event-matches-value.html (#27973)
    • TIMEOUT [expected PASS] subtest: MediaQueryList.changed is correct for all lists in the document even during a change event handler

      Test timed out
      

  • TIMEOUT /css/cssom-view/MediaQueryList-extends-EventTarget.html (#25269)
    • TIMEOUT [expected PASS] subtest: onchange removes listener

      Test timed out
      

    • NOTRUN [expected TIMEOUT] subtest: listeners for "change" type are called
  • OK [expected TIMEOUT] /css/cssom-view/MediaQueryListEvent.html (#25275)
    • PASS [expected TIMEOUT] subtest: argument of onchange
    • PASS [expected NOTRUN] subtest: constructor of "change" event
  • OK /custom-elements/form-associated/ElementInternals-setFormValue.html (#29174)
    • PASS [expected FAIL] subtest: Single value - name is missing
  • OK /html/browsers/browsing-the-web/navigating-across-documents/javascript-url-return-value-handling-dynamic.html (#28066)
    • FAIL [expected PASS] subtest: DE0D 0041 set in href="" targeting a frame and clicked

      assert_equals: expected "\ufffdA" but got ""
      

  • CRASH [expected OK] /html/browsers/windows/embedded-opener-remove-frame.html (#23867)
  • TIMEOUT [expected ERROR] /html/canvas/element/manual/imagebitmap/createImageBitmap-drawImage.html (#32745)
  • TIMEOUT [expected OK] /html/infrastructure/urls/base-url/document-base-url-window-initiator-is-not-opener.https.window.html (#30970)
  • TIMEOUT [expected OK] /html/interaction/focus/the-autofocus-attribute/document-with-fragment-valid.html (#28259)
    • TIMEOUT [expected FAIL] subtest: Autofocus elements in top-level browsing context's documents with URL fragments should be skipped.

      Test timed out
      

  • TIMEOUT [expected OK] /html/semantics/document-metadata/the-base-element/base_target_does_not_affect_location_assignment.html (#32615)
    • TIMEOUT [expected PASS] subtest: base_target_does_not_affect_location_assignment

      Test timed out
      

  • OK /html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-reload-location-reload.html (#32595)
    • PASS [expected FAIL] subtest: Reloading iframe loading='lazy' before it is loaded: location.reload
  • OK /html/semantics/embedded-content/the-img-element/environment-changes/viewport-change.html (#21682)
    • FAIL [expected PASS] subtest: picture: source (max-width:500px) broken image, img broken image, onload, wide

      assert_equals: expected "http://web-platform.test:8000/images/broken.png?71-8fe7eb27-0668-4764-aa9c-8a002f2b8039" but got "http://web-platform.test:8000/images/broken.png?70-8fe7eb27-0668-4764-aa9c-8a002f2b8039"
      

    • FAIL [expected PASS] subtest: picture: source (max-width:500px) broken image, img valid image, onload, wide

      assert_equals: expected "http://web-platform.test:8000/images/green-2x2.png?81-8fe7eb27-0668-4764-aa9c-8a002f2b8039" but got "http://web-platform.test:8000/images/broken.png?80-8fe7eb27-0668-4764-aa9c-8a002f2b8039"
      

    • FAIL [expected PASS] subtest: picture: source (max-width:500px) valid image, img broken image, onload, wide

      assert_equals: expected "http://web-platform.test:8000/images/broken.png?91-8fe7eb27-0668-4764-aa9c-8a002f2b8039" but got "http://web-platform.test:8000/images/green-1x1.png?90-8fe7eb27-0668-4764-aa9c-8a002f2b8039"
      

    • PASS [expected FAIL] subtest: picture: source (max-width:500px) valid image, img broken image, resize to narrow
    • FAIL [expected PASS] subtest: picture: source (max-width:500px) valid image, img valid image, onload, wide

      assert_equals: expected "http://web-platform.test:8000/images/green-2x2.png?101-8fe7eb27-0668-4764-aa9c-8a002f2b8039" but got "http://web-platform.test:8000/images/green-1x1.png?100-8fe7eb27-0668-4764-aa9c-8a002f2b8039"
      

    • PASS [expected FAIL] subtest: picture: source (max-width:500px) valid image, img valid image, resize to narrow
  • OK /html/semantics/forms/form-submission-0/multipart-formdata.window.html (#28725)
    • PASS [expected FAIL] subtest: multipart/form-data: backslash in value (normal form)
  • CRASH [expected OK] /html/semantics/forms/the-fieldset-element/disabled-003.html (#31730)
  • TIMEOUT [expected OK] /resource-timing/nested-context-navigations-iframe.html (#24311)
    • TIMEOUT [expected PASS] subtest: Test that iframe navigations are not observable by the parent, even after history navigations by the parent

      Test timed out
      

    • NOTRUN [expected PASS] subtest: Test that crossorigin iframe navigations are not observable by the parent, even after history navigations by the parent
    • NOTRUN [expected PASS] subtest: Test that cross-site iframe navigations are not observable by the parent, even after history navigations by the parent
    • NOTRUN [expected PASS] subtest: Test that iframe navigations are not observable by the parent
    • NOTRUN [expected PASS] subtest: Test that crossorigin iframe navigations are not observable by the parent
    • NOTRUN [expected PASS] subtest: Test that cross-site iframe navigations are not observable by the parent
    • NOTRUN [expected PASS] subtest: Test that iframe refreshes are not observable by the parent
    • NOTRUN [expected PASS] subtest: Test that crossorigin iframe refreshes are not observable by the parent
    • NOTRUN [expected PASS] subtest: Test that cross-site iframe refreshes are not observable by the parent
  • OK /resource-timing/status-codes-create-entry.html (#28675)
    • PASS [expected FAIL] subtest: Make sure all status codes are reported
  • OK /workers/WorkerGlobalScope-close.html (#23064)
    • PASS [expected FAIL] subtest: Test sending a message after closing.
  • OK [expected ERROR] /workers/constructors/Worker/Worker-constructor.html (#22991)
Stable unexpected results that are known to be intermittent (17)
  • FAIL [expected PASS] /_mozilla/css/iframe/simple_inline_min.html (#15227)
  • OK /css/css-fonts/variations/at-font-face-font-matching.html (#20684)
    • FAIL [expected PASS] subtest: Matching font-weight: '430' should prefer '340 398' over '501 550'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

    • FAIL [expected PASS] subtest: Matching font-style: 'normal' should prefer 'oblique -50deg -20deg' over 'oblique -40deg -30deg'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

    • FAIL [expected PASS] subtest: Matching font-style: 'oblique 10deg' should prefer 'oblique 40deg 50deg' over 'italic'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

  • TIMEOUT /css/cssom-view/MediaQueryList-addListener-removeListener.html (#24569)
    • TIMEOUT [expected PASS] subtest: listeners are called in order they were added

      Test timed out
      

  • OK [expected TIMEOUT] /css/cssom-view/MediaQueryList-extends-EventTarget-interop.html (#25285)
    • FAIL [expected TIMEOUT] subtest: listener added with addListener and addEventListener (capture) is called twice

      assert_equals: triggerMQLEvent expected 2 but got 0
      

    • PASS [expected NOTRUN] subtest: removeEventListener removes listener added with addListener
    • FAIL [expected NOTRUN] subtest: removeEventListener (capture) doesn't remove listener added with addListener

      assert_equals: triggerMQLEvent expected 1 but got 0
      

    • PASS [expected NOTRUN] subtest: removeListener removes listener added with addEventListener
    • FAIL [expected NOTRUN] subtest: removeListener doesn't remove listener added with addEventListener (capture)

      assert_equals: triggerMQLEvent expected 1 but got 0
      

    • FAIL [expected NOTRUN] subtest: capturing event listener fires before non-capturing listener at target

      assert_array_equals: triggerMQLEvent lengths differ, expected array ["addEventListener", "addListener"] length 2, got [] length 0
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/empty-iframe-load-event.html (#29066)
    • FAIL [expected PASS] subtest: Check execution order from nested timeout

      assert_equals: Expected nested setTimeout to run second expected true but got false
      

    • FAIL [expected PASS] subtest: Check execution order on load handler

      assert_equals: Expected onload to run first expected false but got true
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-same-origin-fragment.html (#20768)
    • FAIL [expected PASS] subtest: Tests that a fragment navigation in the unload handler will not block the initial navigation

      assert_equals: expected "" but got "#fragment"
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-same-origin.window.html (#29049)
    • PASS [expected FAIL] subtest: Same-origin navigation started from unload handler must be ignored
  • OK /html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/a-click.html (#28697)
    • PASS [expected FAIL] subtest: aElement.click() before the load event must NOT replace
  • OK /html/browsers/history/the-history-interface/traverse_the_history_4.html (#21383)
    • PASS [expected FAIL] subtest: Multiple history traversals, last would be aborted
  • OK /html/browsers/history/the-history-interface/traverse_the_history_5.html (#21383)
    • PASS [expected FAIL] subtest: Multiple history traversals, last would be aborted
  • OK [expected TIMEOUT] /html/interaction/focus/the-autofocus-attribute/supported-elements.html (#24145)
    • FAIL [expected TIMEOUT] subtest: Element with tabindex should support autofocus

      assert_equals: expected "SPAN" but got "BODY"
      

    • PASS [expected NOTRUN] subtest: Non-HTMLElement should not support autofocus
    • FAIL [expected NOTRUN] subtest: Host element with delegatesFocus should support autofocus

      promise_test: Unhandled rejection with value: object "TypeError: host.attachShadow is not a function"
      

    • FAIL [expected NOTRUN] subtest: Host element with delegatesFocus including no focusable descendants should be skipped

      promise_test: Unhandled rejection with value: object "TypeError: host.attachShadow is not a function"
      

    • FAIL [expected NOTRUN] subtest: Area element should support autofocus

      promise_test: Unhandled rejection with value: object "TypeError: w.document.querySelector(...) is null"
      

  • TIMEOUT [expected OK] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-1.html (#24066)
    • NOTRUN [expected FAIL] subtest: Check that popups from a sandboxed iframe do not escape the sandbox
  • TIMEOUT /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-2.html (#22154)
    • NOTRUN [expected FAIL] subtest: Check that popups from a sandboxed iframe do not escape the sandbox
  • OK /html/semantics/links/links-created-by-a-and-area-elements/htmlanchorelement_noopener.html (#23205)
    • PASS [expected FAIL] subtest: Check that rel=noopener with target=_self does a normal load
  • OK /resize-observer/change-layout-in-error.html (#32629)
    • PASS [expected FAIL] subtest: Changing layout in window error handler should not result in lifecyle loop when resize observer loop limit is reached.
  • TIMEOUT /resource-timing/test_resource_timing.https.html (#25216)
    • FAIL [expected PASS] subtest: PerformanceEntry has correct name, initiatorType, startTime, and duration (img)

      assert_equals: expected 15797504 but got 15797248
      

  • TIMEOUT [expected OK] /webstorage/localstorage-about-blank-3P-iframe-opens-3P-window.partitioned.tentative.html (#29053)
    • TIMEOUT [expected PASS] subtest: StorageKey: test 3P about:blank window opened from a 3P iframe

      Test timed out
      

Stable unexpected results (18)
  • FAIL [expected PASS] /_mozilla/css/iframe/simple_inline_max.html
  • FAIL [expected PASS] /_mozilla/css/max_inline_block_size_canvas.html
  • FAIL [expected PASS] /_mozilla/css/max_inline_block_size_image.html
  • PASS [expected FAIL] /css/CSS2/normal-flow/inline-replaced-height-010.xht
  • PASS [expected FAIL] /css/CSS2/normal-flow/inline-replaced-width-016.xht
  • OK /css/css-flexbox/image-as-flexitem-size-001.html
    • FAIL [expected PASS] subtest: .flexbox > img 15

      assert_equals: 
      <img src="support/solidblue.png" style="min-width: 30px;
                                                    height: 10px" data-expected-width="30" data-expected-height="10">
      height expected 10 but got 0
      

    • FAIL [expected PASS] subtest: .flexbox > img 16

      assert_equals: 
      <img src="support/solidblue.png" style="width: 30px;
                                                    max-height: 10px" data-expected-width="30" data-expected-height="10">
      height expected 10 but got 30
      

    • FAIL [expected PASS] subtest: .flexbox > img 18

      assert_equals: 
      <img src="support/solidblue.png" style="width: 10px;
                                                    min-height: 30px" data-expected-width="10" data-expected-height="30">
      height expected 30 but got 0
      

  • OK /css/css-flexbox/image-as-flexitem-size-001v.html
    • FAIL [expected PASS] subtest: .flexbox > img 15

      assert_equals: 
      <img src="support/solidblue.png" style="min-width: 30px;
                                                    height: 10px" data-expected-width="30" data-expected-height="10">
      height expected 10 but got 0
      

    • FAIL [expected PASS] subtest: .flexbox > img 16

      assert_equals: 
      <img src="support/solidblue.png" style="width: 30px;
                                                    max-height: 10px" data-expected-width="30" data-expected-height="10">
      height expected 10 but got 30
      

    • FAIL [expected PASS] subtest: .flexbox > img 18

      assert_equals: 
      <img src="support/solidblue.png" style="width: 10px;
                                                    min-height: 30px" data-expected-width="10" data-expected-height="30">
      height expected 30 but got 0
      

  • OK /css/css-flexbox/image-as-flexitem-size-002.html
    • FAIL [expected PASS] subtest: .flexbox > img 15

      assert_equals: 
      <img src="support/solidblue.png" style="min-width: 30px;
                                                    height: 10px" data-expected-width="30" data-expected-height="10">
      height expected 10 but got 0
      

    • FAIL [expected PASS] subtest: .flexbox > img 16

      assert_equals: 
      <img src="support/solidblue.png" style="width: 30px;
                                                    max-height: 10px" data-expected-width="30" data-expected-height="10">
      height expected 10 but got 30
      

    • FAIL [expected PASS] subtest: .flexbox > img 18

      assert_equals: 
      <img src="support/solidblue.png" style="width: 10px;
                                                    min-height: 30px" data-expected-width="10" data-expected-height="30">
      height expected 30 but got 0
      

  • OK /css/css-flexbox/image-as-flexitem-size-002v.html
    • FAIL [expected PASS] subtest: .flexbox > img 15

      assert_equals: 
      <img src="support/solidblue.png" style="min-width: 30px;
                                                    height: 10px" data-expected-width="30" data-expected-height="10">
      height expected 10 but got 0
      

    • FAIL [expected PASS] subtest: .flexbox > img 16

      assert_equals: 
      <img src="support/solidblue.png" style="width: 30px;
                                                    max-height: 10px" data-expected-width="30" data-expected-height="10">
      height expected 10 but got 30
      

    • FAIL [expected PASS] subtest: .flexbox > img 18

      assert_equals: 
      <img src="support/solidblue.png" style="width: 10px;
                                                    min-height: 30px" data-expected-width="10" data-expected-height="30">
      height expected 30 but got 0
      

  • OK /css/css-flexbox/image-as-flexitem-size-003.html
    • FAIL [expected PASS] subtest: .flexbox > img 15

      assert_equals: 
      <img src="support/solidblue.png" style="min-width: 30px;
                                                    height: 10px" data-expected-width="30" data-expected-height="10">
      height expected 10 but got 0
      

  • OK /css/css-flexbox/image-as-flexitem-size-003v.html
    • FAIL [expected PASS] subtest: .flexbox > img 15

      assert_equals: 
      <img src="support/solidblue.png" style="min-width: 30px;
                                                    height: 10px" data-expected-width="30" data-expected-height="10">
      height expected 10 but got 0
      

  • OK /css/css-flexbox/image-as-flexitem-size-005.html
    • FAIL [expected PASS] subtest: .flexbox > img 15

      assert_equals: 
      <img src="support/solidblue.png" style="min-width: 30px;
                                                    height: 10px" data-expected-width="40" data-expected-height="10">
      height expected 10 but got 0
      

    • FAIL [expected PASS] subtest: .flexbox > img 16

      assert_equals: 
      <img src="support/solidblue.png" style="width: 30px;
                                                    max-height: 10px" data-expected-width="40" data-expected-height="10">
      height expected 10 but got 30
      

  • OK /css/css-flexbox/image-as-flexitem-size-005v.html
    • FAIL [expected PASS] subtest: .flexbox > img 15

      assert_equals: 
      <img src="support/solidblue.png" style="min-width: 30px;
                                                    height: 10px" data-expected-width="40" data-expected-height="10">
      height expected 10 but got 0
      

    • FAIL [expected PASS] subtest: .flexbox > img 16

      assert_equals: 
      <img src="support/solidblue.png" style="width: 30px;
                                                    max-height: 10px" data-expected-width="40" data-expected-height="10">
      height expected 10 but got 30
      

  • OK /css/css-flexbox/image-as-flexitem-size-007.html
    • FAIL [expected PASS] subtest: .flexbox > img 15

      assert_equals: 
      <img src="support/solidblue.png" style="min-width: 30px;
                                                    height: 10px" data-expected-width="30" data-expected-height="10">
      height expected 10 but got 4
      

    • FAIL [expected PASS] subtest: .flexbox > img 16

      assert_equals: 
      <img src="support/solidblue.png" style="width: 30px;
                                                    max-height: 10px" data-expected-width="30" data-expected-height="10">
      height expected 10 but got 28
      

    • FAIL [expected PASS] subtest: .flexbox > img 18

      assert_equals: 
      <img src="support/solidblue.png" style="width: 10px;
                                                    min-height: 30px" data-expected-width="10" data-expected-height="30">
      height expected 30 but got 4
      

  • OK /css/css-flexbox/image-as-flexitem-size-007v.html
    • FAIL [expected PASS] subtest: .flexbox > img 15

      assert_equals: 
      <img src="support/solidblue.png" style="min-width: 30px;
                                                    height: 10px" data-expected-width="30" data-expected-height="10">
      height expected 10 but got 4
      

    • FAIL [expected PASS] subtest: .flexbox > img 16

      assert_equals: 
      <img src="support/solidblue.png" style="width: 30px;
                                                    max-height: 10px" data-expected-width="30" data-expected-height="10">
      height expected 10 but got 28
      

    • FAIL [expected PASS] subtest: .flexbox > img 18

      assert_equals: 
      <img src="support/solidblue.png" style="width: 10px;
                                                    min-height: 30px" data-expected-width="10" data-expected-height="30">
      height expected 30 but got 4
      

  • OK /html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio.html
    • PASS [expected FAIL] subtest: Canvas width and height attributes are used as the surface size with contain:size
    • PASS [expected FAIL] subtest: Canvas width and height attributes are used as the surface size
  • OK /html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html
    • PASS [expected FAIL] subtest: Loaded images test: <img> without width height attributes
    • PASS [expected FAIL] subtest: Loaded images test: <img> with width and height attributes, but conflicting to the original aspect ratio
    • PASS [expected FAIL] subtest: Loaded images test: <img> with width and height attributes, but not equal to the original aspect ratio
  • OK /html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-replaced-box-while-loading.html
    • FAIL [expected PASS] subtest: Loading images should get a replaced box, even without specified size

      assert_equals: expected 1000 but got 0
      

@github-actions

Copy link
Copy Markdown

⚠️ Try run (#9942861470) failed.

@valadaptive
valadaptive force-pushed the img-auto-aspect-ratio branch from b92e311 to 6a221be Compare July 15, 2024 17:39
@valadaptive

Copy link
Copy Markdown
Contributor Author

Fixed what was causing the last set of tests to fail; let's see how it does now

@jdm jdm added the T-linux-wpt Do a try run of the WPT label Jul 15, 2024
@github-actions github-actions Bot removed the T-linux-wpt Do a try run of the WPT label Jul 15, 2024
@github-actions

Copy link
Copy Markdown

🔨 Triggering try run (#9945014811) for Linux WPT

@github-actions

Copy link
Copy Markdown

⚠️ Try run (#9945014811) failed.

@valadaptive
valadaptive force-pushed the img-auto-aspect-ratio branch from 6a221be to 9b79469 Compare July 15, 2024 19:05
@jdm jdm added the T-linux-wpt Do a try run of the WPT label Jul 15, 2024
@github-actions github-actions Bot removed the T-linux-wpt Do a try run of the WPT label Jul 15, 2024
@github-actions

Copy link
Copy Markdown

🔨 Triggering try run (#9945398555) for Linux WPT

@github-actions

Copy link
Copy Markdown

Test results for linux-wpt-layout-2020 from try job (#9945398555):

Flaky unexpected result (31)
  • TIMEOUT [expected OK] /_webgl/conformance/uniforms/out-of-bounds-uniform-array-access.html (#26225)
    • NOTRUN [expected PASS] subtest: Overall test
  • TIMEOUT [expected PASS] /css/compositing/mix-blend-mode/mix-blend-mode-video-sibling.html
  • TIMEOUT [expected PASS] /css/compositing/mix-blend-mode/mix-blend-mode-video.html (#32763)
  • TIMEOUT [expected PASS] /css/css-color/animation/opacity-animation-ending-correctly-002.html (#29216)
  • OK /css/css-fonts/variations/at-font-face-font-matching.html (#20684)
    • FAIL [expected PASS] subtest: Matching font-style: 'oblique 10deg' should prefer 'oblique 0deg' over 'oblique -50deg -20deg'

      assert_equals: Unexpected font on test element expected 487 but got 532
      

  • OK /css/css-values/calc-in-media-queries-with-mixed-units.html (#31731)
    • FAIL [expected PASS] subtest: box should be orange if the calc between vh+px in @media was correct

      assert_equals: expected "rgb(255, 165, 0)" but got "rgb(0, 0, 255)"
      

  • OK /css/css-values/viewport-units-after-font-load.html (#27645)
    • FAIL [expected PASS] subtest: Viewport units are correctly updated after resize even if a font load has happened before

      assert_equals: Height shouldn't have changed expected "0px" but got "300px"
      

  • TIMEOUT /css/cssom-view/MediaQueryList-extends-EventTarget.html (#25269)
    • TIMEOUT [expected PASS] subtest: onchange adds listener

      Test timed out
      

    • NOTRUN [expected PASS] subtest: onchange removes listener
    • NOTRUN [expected TIMEOUT] subtest: listeners for "change" type are called
  • OK /custom-elements/form-associated/ElementInternals-setFormValue.html (#29174)
    • PASS [expected FAIL] subtest: Newline normalization - \r\n in name (urlencoded)
    • PASS [expected FAIL] subtest: Newline normalization - \n in value (urlencoded)
    • PASS [expected FAIL] subtest: Newline normalization - \n in value (formdata)
  • OK /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/load-pageshow-events-window-open.html (#28691)
    • PASS [expected FAIL] subtest: load event does not fire on window.open('about:blank')
  • OK /html/browsers/browsing-the-web/navigating-across-documents/javascript-url-return-value-handling-dynamic.html (#28066)
    • FAIL [expected PASS] subtest: 0041 set in href="" targeting a frame and clicked

      assert_equals: expected "A" but got ""
      

    • FAIL [expected PASS] subtest: 0080 00FF set in href="" targeting a frame and clicked

      assert_equals: expected "�ÿ" but got ""
      

    • FAIL [expected PASS] subtest: 0080 00FF 0100 set in href="" targeting a frame and clicked

      assert_equals: expected "�ÿĀ" but got ""
      

    • FAIL [expected PASS] subtest: D83D DE0D set in href="" targeting a frame and clicked

      assert_equals: expected "😍" but got ""
      

    • FAIL [expected PASS] subtest: DE0D 0041 set in href="" targeting a frame and clicked

      assert_equals: expected "\ufffdA" but got ""
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-same-origin.window.html (#29049)
    • PASS [expected FAIL] subtest: Same-origin navigation started from unload handler must be ignored
  • CRASH [expected OK] /html/browsers/browsing-the-web/unloading-documents/prompt-and-unload-script-closeable.html
  • OK /html/browsers/history/the-history-interface/traverse_the_history_2.html (#21383)
    • PASS [expected FAIL] subtest: Multiple history traversals, last would be aborted
  • TIMEOUT [expected OK] /html/browsers/history/the-location-interface/assign-replace-from-iframe.html (#31638)
    • TIMEOUT [expected PASS] subtest: Browser sends Referer header in iframe request when location.replace is called from an iframe

      Test timed out
      

    • TIMEOUT [expected PASS] subtest: Browser sends Referer header in iframe request when location.assign is called from an iframe

      Test timed out
      

  • CRASH [expected OK] /html/browsers/windows/embedded-opener-remove-frame.html (#23867)
  • ERROR [expected TIMEOUT] /html/canvas/element/manual/imagebitmap/createImageBitmap-invalid-args.html (#32745)
  • TIMEOUT [expected OK] /html/infrastructure/urls/base-url/document-base-url-window-initiator-is-not-opener.https.window.html (#30970)
  • TIMEOUT [expected OK] /html/interaction/focus/the-autofocus-attribute/autofocus-dialog.html (#29087)
    • TIMEOUT [expected FAIL] subtest: <dialog>-contained autofocus element gets focused when the dialog is shown

      Test timed out
      

  • OK /html/interaction/focus/the-autofocus-attribute/document-with-fragment-valid.html (#28259)
    • PASS [expected FAIL] subtest: Autofocus elements in top-level browsing context's documents with URL fragments should be skipped.
  • TIMEOUT /html/interaction/focus/the-autofocus-attribute/supported-elements.html (#24145)
    • FAIL [expected TIMEOUT] subtest: Element with tabindex should support autofocus

      assert_equals: expected "SPAN" but got "BODY"
      

    • TIMEOUT [expected NOTRUN] subtest: Non-HTMLElement should not support autofocus

      Test timed out
      

  • ERROR /html/semantics/embedded-content/image-maps/image-map-processing-model/hash-name-reference.html (#16179)
    • FAIL [expected PASS] subtest: HTML (quirks) OBJECT usemap=undefined

      assert_not_equals: sanity check (too many tests to fit in viewport?) got disallowed value null
      

    • FAIL [expected PASS] subtest: HTML (quirks) IMG usemap="no-hash-id"

      assert_not_equals: sanity check (too many tests to fit in viewport?) got disallowed value null
      

    • FAIL [expected PASS] subtest: HTML (quirks) OBJECT usemap=undefined

      assert_not_equals: sanity check (too many tests to fit in viewport?) got disallowed value null
      

    • FAIL [expected PASS] subtest: HTML (quirks) OBJECT usemap=undefined

      assert_not_equals: sanity check (too many tests to fit in viewport?) got disallowed value null
      

    • FAIL [expected PASS] subtest: HTML (quirks) OBJECT usemap=undefined

      assert_not_equals: sanity check (too many tests to fit in viewport?) got disallowed value null
      

    • FAIL [expected PASS] subtest: HTML (quirks) OBJECT usemap=undefined

      assert_not_equals: sanity check (too many tests to fit in viewport?) got disallowed value null
      

    • FAIL [expected PASS] subtest: HTML (quirks) OBJECT usemap=undefined

      assert_not_equals: sanity check (too many tests to fit in viewport?) got disallowed value null
      

    • FAIL [expected PASS] subtest: HTML (quirks) OBJECT usemap=undefined

      assert_not_equals: sanity check (too many tests to fit in viewport?) got disallowed value null
      

    • FAIL [expected PASS] subtest: HTML (quirks) OBJECT usemap=undefined

      assert_not_equals: sanity check (too many tests to fit in viewport?) got disallowed value null
      

    • FAIL [expected PASS] subtest: HTML (quirks) OBJECT usemap=undefined

      assert_not_equals: sanity check (too many tests to fit in viewport?) got disallowed value null
      

    • And 27 more unexpected results...
  • TIMEOUT [expected CRASH] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-1.html (#22647)
    • TIMEOUT [expected FAIL] subtest: Check that popups from a sandboxed iframe escape the sandbox if allow-popups-to-escape-sandbox is used

      Test timed out
      

  • CRASH [expected OK] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3.html (#24066)
  • TIMEOUT [expected OK] /html/semantics/embedded-content/the-img-element/source-media-outside-doc.html
    • TIMEOUT [expected FAIL] subtest: Image source selection using media queries is performed for img elements outside the document

      Test timed out
      

  • OK /html/semantics/forms/form-submission-0/text-plain.window.html (#28687)
    • PASS [expected FAIL] subtest: text/plain: single quote in name (normal form)
  • OK /html/semantics/forms/form-submission-0/urlencoded2.window.html (#28687)
    • PASS [expected FAIL] subtest: application/x-www-form-urlencoded: Basic test (formdata event)
  • OK /html/semantics/links/links-created-by-a-and-area-elements/htmlanchorelement_noopener.html (#23205)
    • PASS [expected FAIL] subtest: Check that rel=noopener with target=_self does a normal load
  • OK /html/syntax/parsing/DOMContentLoaded-defer.html (#21550)
    • PASS [expected FAIL] subtest: The end: DOMContentLoaded and defer scripts
  • OK /html/webappapis/dynamic-markup-insertion/document-write/module-static-import-delayed.html (#26243)
    • FAIL [expected PASS] subtest: document.write in an imported module

      assert_true: onload must be called expected true got false
      

  • TIMEOUT [expected OK] /resource-timing/nested-context-navigations-iframe.html (#24311)
    • TIMEOUT [expected PASS] subtest: Test that cross-site iframe navigations are not observable by the parent, even after history navigations by the parent

      Test timed out
      

    • NOTRUN [expected PASS] subtest: Test that iframe navigations are not observable by the parent
    • NOTRUN [expected PASS] subtest: Test that crossorigin iframe navigations are not observable by the parent
    • NOTRUN [expected PASS] subtest: Test that cross-site iframe navigations are not observable by the parent
    • NOTRUN [expected PASS] subtest: Test that iframe refreshes are not observable by the parent
    • NOTRUN [expected PASS] subtest: Test that crossorigin iframe refreshes are not observable by the parent
    • NOTRUN [expected PASS] subtest: Test that cross-site iframe refreshes are not observable by the parent
Stable unexpected results that are known to be intermittent (9)
  • FAIL [expected PASS] /_mozilla/css/iframe/hide_and_show.html (#15265)
  • TIMEOUT /css/cssom-view/MediaQueryList-addListener-removeListener.html (#24569)
    • TIMEOUT [expected PASS] subtest: listeners are called correct number of times

      Test timed out
      

    • NOTRUN [expected PASS] subtest: listeners are called in order they were added
  • TIMEOUT /fetch/metadata/generated/element-img-environment-change.sub.html (#30111)
    • PASS [expected FAIL] subtest: sec-fetch-site - Not sent to non-trustworthy same-origin destination, no attributes
    • FAIL [expected TIMEOUT] subtest: sec-fetch-site - Not sent to non-trustworthy same-site destination, no attributes

      promise_test: Unhandled rejection with value: object "Error: Failed to query for recorded headers."
      

    • TIMEOUT [expected NOTRUN] subtest: sec-fetch-site - Not sent to non-trustworthy cross-site destination, no attributes

      Test timed out
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/replace-before-load/a-click.html (#28697)
    • PASS [expected FAIL] subtest: aElement.click() before the load event must NOT replace
  • OK /html/browsers/history/the-history-interface/traverse_the_history_3.html (#21383)
    • FAIL [expected PASS] subtest: Multiple history traversals, last would be aborted

      assert_array_equals: Pages opened during history navigation lengths differ, expected array [6, 3] length 2, got [6, 1, 1] length 3
      

  • TIMEOUT [expected ERROR] /html/canvas/element/manual/imagebitmap/createImageBitmap-drawImage.html (#32745)
  • ERROR [expected TIMEOUT] /html/canvas/element/manual/imagebitmap/createImageBitmap-flipY.html (#32745)
  • TIMEOUT [expected CRASH] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_escaping-3.html (#24057)
  • OK [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-2.html (#22154)
Stable unexpected results (7)
  • PASS [expected FAIL] /css/CSS2/normal-flow/inline-replaced-height-010.xht
  • PASS [expected FAIL] /css/CSS2/normal-flow/inline-replaced-height-011.xht
  • PASS [expected FAIL] /css/CSS2/normal-flow/inline-replaced-width-016.xht
  • PASS [expected FAIL] /css/CSS2/normal-flow/inline-replaced-width-017.xht
  • PASS [expected FAIL] /css/css-flexbox/flex-aspect-ratio-img-column-005.html
  • OK /html/rendering/replaced-elements/attributes-for-embedded-content-and-images/canvas-aspect-ratio.html
    • PASS [expected FAIL] subtest: Canvas width and height attributes are used as the surface size with contain:size
    • PASS [expected FAIL] subtest: Canvas width and height attributes are used as the surface size
  • OK /html/rendering/replaced-elements/attributes-for-embedded-content-and-images/img-aspect-ratio.html
    • PASS [expected FAIL] subtest: Loaded images test: <img> without width height attributes
    • PASS [expected FAIL] subtest: Loaded images test: <img> with width and height attributes, but conflicting to the original aspect ratio
    • PASS [expected FAIL] subtest: Loaded images test: <img> with width and height attributes, but not equal to the original aspect ratio

@github-actions

Copy link
Copy Markdown

⚠️ Try run (#9945398555) failed.

@valadaptive
valadaptive force-pushed the img-auto-aspect-ratio branch from 9b79469 to 64f1a33 Compare July 15, 2024 20:37
@valadaptive

Copy link
Copy Markdown
Contributor Author

Looks like this fixes several WPT tests!

If a (min/max)-(height/width) property is set, we still need to respect
the intrinsic ratio of the element if it exists. The previous code was
simply clamping the element size after doing the sizing calculations
once, but this leads to an incorrect aspect ratio.

Signed-off-by: valadaptive <[email protected]>
@mrobinson
mrobinson added this pull request to the merge queue Jul 18, 2024
Merged via the queue into servo:main with commit f6c9714 Jul 18, 2024
Gae24 pushed a commit to Gae24/servo that referenced this pull request Jul 26, 2024
If a (min/max)-(height/width) property is set, we still need to respect
the intrinsic ratio of the element if it exists. The previous code was
simply clamping the element size after doing the sizing calculations
once, but this leads to an incorrect aspect ratio.

Signed-off-by: valadaptive <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: No status

Development

Successfully merging this pull request may close these issues.

<img> elements with width and height attributes have incorrect aspect ratio with height: auto; max-height: [...]

3 participants