Skip to content

layout: grid template getComputedStyle resolved value#34885

Merged
nicoburns merged 8 commits intoservo:mainfrom
stevennovaryo:get-computed-style-grid-template
Jan 9, 2025
Merged

layout: grid template getComputedStyle resolved value#34885
nicoburns merged 8 commits intoservo:mainfrom
stevennovaryo:get-computed-style-grid-template

Conversation

@stevennovaryo
Copy link
Copy Markdown
Contributor

@stevennovaryo stevennovaryo commented Jan 8, 2025

Description

Fix getComputedValue() for grid-template-* which should return used value for a resolved-track-list. This will also allow several grid WPT test which used getComputedValue() to be tested accordingly.

In the future, one can include the grid line names and subgrid in the resolved track-list once it is implemented.

Changes

  • A new field is added in BoxFragment to store the information from layout algorithm. Which will be used to pass the computation details from Grid algorithm (Taffy).
  • Resolve grid-template-row and grid-template-column using the information.

Feedback are appreciated for the approach of passing the information from layout algorithm.

WPT Result

There are some tests that is previously failed because getComputedStyle() returned computed value. On the other hand some test became failed for the very same reason.

Some css/css-grid/grid-definition/grid-template-columns-rows-resolved-values-001.tentative.html.ini tests seems to fail because the tests wasn't accomodating for implicit grids. Currently, it resemble the results of others browsers better.

Some tests expectation will also be updated once the newest Taffy iteration that fixes my bug is included. Which can be easily done after grid calc changes.

Try


@stevennovaryo stevennovaryo force-pushed the get-computed-style-grid-template branch 3 times, most recently from 1c85eb1 to 45510ce Compare January 9, 2025 04:28
Signed-off-by: stevennovaryo <[email protected]>
Signed-off-by: stevennovaryo <[email protected]>
Signed-off-by: stevennovaryo <[email protected]>
Signed-off-by: stevennovaryo <[email protected]>
@stevennovaryo stevennovaryo force-pushed the get-computed-style-grid-template branch from 99d608d to eaef90b Compare January 9, 2025 09:41
@stevennovaryo stevennovaryo marked this pull request as ready for review January 9, 2025 09:42
@nicoburns
Copy link
Copy Markdown
Contributor

@stevennovaryo I've published Taffy 0.7.4 with your "empty grid" fix. That should get us a few more test passes.

@nicoburns nicoburns added the T-linux-wpt Do a try run of the WPT label Jan 9, 2025
@github-actions github-actions bot removed the T-linux-wpt Do a try run of the WPT label Jan 9, 2025
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 9, 2025

🔨 Triggering try run (#12687978091) for Linux WPT

Copy link
Copy Markdown
Contributor

@nicoburns nicoburns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks excellent. I'd recommend bumping the Taffy version (and updating assertions again) before we merge this, but we can also do this as a follow-up if you prefer.

Looking at the remaining failures in the affected files, they almost looks like they might actually be cases where Taffy is computing the wrong size are tests which include line names (which we don't yet support) which is very good sign. A potential exception being the [Property grid-template-columns value 'none'] subtest which we probably ought to pass?

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 9, 2025

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

Flaky unexpected result (14)
  • FAIL [expected PASS] /_mozilla/css/iframe/hide_and_show.html (#15265)
  • PASS [expected FAIL] /css/css-sizing/dynamic-available-size-iframe.html (#31559)
  • OK /custom-elements/form-associated/ElementInternals-setFormValue.html (#29174)
    • PASS [expected FAIL] subtest: Newline normalization - \r\n in value (urlencoded)
    • PASS [expected FAIL] subtest: Newline normalization - \r\n in value (formdata)
  • OK /fetch/metadata/generated/css-font-face.https.sub.tentative.html (#32732)
    • PASS [expected FAIL] subtest: sec-fetch-storage-access - Cross-site
  • OK /html/browsers/browsing-the-web/navigating-across-documents/005.html (#27062)
    • PASS [expected FAIL] subtest: Link with onclick navigation and href navigation
  • OK /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/load-pageshow-events-iframe-contentWindow.html (#28681)
    • PASS [expected FAIL] subtest: load &amp; pageshow events do not fire on contentWindow of &lt;iframe&gt; element created with src=''
  • OK /html/browsers/browsing-the-web/navigating-across-documents/refresh/same-document-refresh.html (#34597)
    • FAIL [expected PASS] subtest: Same-Document Referrer from Refresh

      assert_equals: original page loads expected "http://web-platform.test:8000/html/browsers/browsing-the-web/navigating-across-documents/refresh/resources/refresh-with-section.sub.html?url=%23section" but got "http://web-platform.test:8000/html/browsers/browsing-the-web/navigating-across-documents/refresh/resources/refresh-with-section.sub.html?url=%23section#section"
      

  • 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
  • CRASH [expected TIMEOUT] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3.html (#24066)
  • OK /html/semantics/forms/historical.html (#28568)
    • PASS [expected FAIL] subtest: &lt;input name=isindex&gt; should not be supported
  • TIMEOUT [expected OK] /webmessaging/with-ports/017.html (#24486)
    • TIMEOUT [expected PASS] subtest: origin of the script that invoked the method, about:blank

      Test timed out
      

  • OK [expected ERROR] /webxr/render_state_update.https.html (#27535)
  • OK [expected ERROR] /workers/constructors/Worker/Worker-constructor.html (#22991)
  • OK /xhr/open-url-multi-window-5.htm (#23360)
    • FAIL [expected PASS] subtest: XMLHttpRequest: open() resolving URLs (multi-Window; 5)

      assert_throws_dom: function "function() {client.open("GET", "...") }" did not throw
      

Stable unexpected results that are known to be intermittent (11)
  • OK /FileAPI/url/url-with-fetch.any.worker.html (#21517)
    • FAIL [expected PASS] subtest: Revoke blob URL after calling fetch, fetch should succeed

      promise_test: Unhandled rejection with value: object "TypeError: Network error occurred"
      

  • OK /html/browsers/browsing-the-web/navigating-across-documents/empty-iframe-load-event.html (#29066)
    • PASS [expected FAIL] subtest: Check execution order on load handler
    • PASS [expected FAIL] subtest: Check execution order from nested timeout
  • OK /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/iframe-nosrc.html (#34819)
    • PASS [expected FAIL] subtest: form submission
  • 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/history/the-history-interface/traverse_the_history_4.html (#21383)
    • PASS [expected FAIL] subtest: Multiple history traversals, last would be aborted
  • CRASH [expected TIMEOUT] /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)
    • FAIL [expected NOTRUN] subtest: Check that popups from a sandboxed iframe do not escape the sandbox

      assert_equals: It came from a sandboxed iframe expected "null" but got "http://web-platform.test:8000"
      

  • OK /navigation-timing/test-navigation-type-reload.html (#33334)
    • PASS [expected FAIL] subtest: Reload domComplete &gt; Original domComplete
    • PASS [expected FAIL] subtest: Reload domContentLoadedEventEnd &gt; Original domContentLoadedEventEnd
    • PASS [expected FAIL] subtest: Reload domContentLoadedEventStart &gt; Original domContentLoadedEventStart
    • PASS [expected FAIL] subtest: Reload fetchStart &gt; Original fetchStart
    • PASS [expected FAIL] subtest: Reload loadEventEnd &gt; Original loadEventEnd
    • PASS [expected FAIL] subtest: Reload loadEventStart &gt; Original loadEventStart
  • TIMEOUT [expected OK] /performance-timeline/navigation-id-detached-frame.tentative.html (#34773)
    • TIMEOUT [expected PASS] subtest: The navigation_id getter does not crash a window of detached frame

      Test timed out
      

  • OK [expected TIMEOUT] /webstorage/localstorage-about-blank-3P-iframe-opens-3P-window.partitioned.html (#29053)
    • PASS [expected TIMEOUT] subtest: StorageKey: test 3P about:blank window opened from a 3P iframe
  • OK /workers/WorkerGlobalScope-close.html (#23064)
    • PASS [expected FAIL] subtest: Test sending a message after closing.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 9, 2025

✨ Try run (#12687978091) succeeded.

@nicoburns nicoburns mentioned this pull request Jan 9, 2025
3 tasks
@nicoburns nicoburns added this pull request to the merge queue Jan 9, 2025
@nicoburns
Copy link
Copy Markdown
Contributor

nicoburns commented Jan 9, 2025

Seeing as this is passing tests and ready to go I'm going to go ahead and merge it before it gets out of date. Taffy version bump can be done in a follow-up :)

Comment on lines +90 to +92
/// Additional information of from layout that could be used by Javascripts and devtools.
#[serde(skip_serializing)]
pub detailed_layout_info: Option<DetailedLayoutInfo>,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming nit: SpecificLayoutInfo might be a better description. I like the way you've designed this as we can start putting information for other layout modes here as well.

@stevennovaryo
Copy link
Copy Markdown
Contributor Author

Thanks for publishing Taffy 7.4.0. I would be happy to bump it later with analyzing the WPT expectations changes once I get back into my proper device. It should fix some none and emptyGrid tests.

It could be bundled with renaming the objects and other minor quality changes too.

Merged via the queue into servo:main with commit 76fa456 Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

getComputedStyle() should return resolved value for ‘grid-template-columns’ and ‘grid-template-rows’

3 participants