Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

layout_2020: Only count for content size for height of non-replaced inline elements #29803

Merged
merged 2 commits into from
Jun 3, 2023

Conversation

stshine
Copy link
Contributor

@stshine stshine commented May 28, 2023

Accorinding to https://drafts.csswg.org/css2/#inline-non-replaced, The vertical padding, border and margin of an inline, non-replaced box start at the top and bottom of the content area, and has nothing to do with the line-height. But only the line-height is used when calculating the height of the line box.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • There are tests for these changes OR

@stshine
Copy link
Contributor Author

stshine commented May 28, 2023

@bors-servo try=wpt-2020

@bors-servo
Copy link
Contributor

⌛ Trying commit 521c054 with merge be0b2a3...

bors-servo added a commit that referenced this pull request May 28, 2023
layout_2020: Invalidate bottom and top margins on non-replaced inline elements

<!-- Please describe your changes on the following line: -->

According to https://drafts.csswg.org/css2/#margin-properties, 'margin-top' and 'margin-bottom' have no effect on non-replaced inline elements.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] There are tests for these changes OR

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@github-actions
Copy link

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

Flaky unexpected result (2)
  • TIMEOUT [expected PASS] /css/css-color/animation/opacity-animation-ending-correctly-002.html (#29216)
  • OK /css/cssom-view/MediaQueryList-extends-EventTarget-interop.html (#25285)
    • FAIL [expected PASS] subtest: listener added with addListener and addEventListener is called once assert_equals: triggerMQLEvent expected 1 but got 0
Stable unexpected results (4)
  • PASS [expected FAIL] /css/CSS2/backgrounds/background-root-017.xht
  • PASS [expected FAIL] /css/CSS2/margin-padding-clear/margin-collapse-001.xht
  • PASS [expected FAIL] /css/CSS2/margin-padding-clear/margin-inline-001.xht
  • PASS [expected FAIL] /css/CSS2/margin-padding-clear/margin-inline-002.xht

@bors-servo
Copy link
Contributor

💔 Test failed - checks-github

@stshine
Copy link
Contributor Author

stshine commented May 28, 2023

Although the block direction margins do not take effects, they still show up in firefox devtools.
But still I'm not sure if this is the right fix.

@stshine stshine requested a review from Loirooriol May 28, 2023 15:04
Copy link
Contributor

@Loirooriol Loirooriol left a comment

Choose a reason for hiding this comment

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

I don't think this should special-case margins. https://drafts.csswg.org/css2/#inline-non-replaced says

The vertical padding, border and margin of an inline, non-replaced box start at the top and bottom of the content area, and has nothing to do with the line-height. But only the line-height is used when calculating the height of the line box.

If I take /css/CSS2/margin-padding-clear/margin-inline-002.xht replacing the margin with padding, then it's still wrong:

  • Servo:
  • Firefox:

So can you try removing the vertical padding and borders too, and see if more tests pass or something breaks?

@stshine
Copy link
Contributor Author

stshine commented May 31, 2023

@bors-servo try=wpt-2020

@bors-servo
Copy link
Contributor

⌛ Trying commit 68aa99b with merge f523bb4...

bors-servo added a commit that referenced this pull request May 31, 2023
layout_2020: Invalidate bottom and top margins on non-replaced inline elements

<!-- Please describe your changes on the following line: -->

According to https://drafts.csswg.org/css2/#margin-properties, 'margin-top' and 'margin-bottom' have no effect on non-replaced inline elements.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] There are tests for these changes OR

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
@github-actions
Copy link

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

Stable unexpected results (18)
  • PASS [expected FAIL] /_mozilla/css/inline_border_baseline_a.html
  • PASS [expected FAIL] /_mozilla/css/inline_element_padding_margin.html
  • PASS [expected FAIL] /css/CSS2/backgrounds/background-root-017.xht
  • PASS [expected FAIL] /css/CSS2/borders/border-width-applies-to-008.xht
  • PASS [expected FAIL] /css/CSS2/css1/c5506-ipadn-t-002.xht
  • PASS [expected FAIL] /css/CSS2/linebox/vertical-align-top-bottom-padding.html
  • PASS [expected FAIL] /css/CSS2/margin-padding-clear/margin-bottom-applies-to-008.xht
  • PASS [expected FAIL] /css/CSS2/margin-padding-clear/margin-collapse-001.xht
  • PASS [expected FAIL] /css/CSS2/margin-padding-clear/margin-inline-001.xht
  • PASS [expected FAIL] /css/CSS2/margin-padding-clear/margin-inline-002.xht
  • PASS [expected FAIL] /css/CSS2/margin-padding-clear/margin-top-applies-to-008.xht
  • PASS [expected FAIL] /css/CSS2/normal-flow/block-in-inline-empty-001.xht
  • PASS [expected FAIL] /css/CSS2/normal-flow/inlines-002.xht
  • PASS [expected FAIL] /css/CSS2/tables/table-visual-layout-018.xht
  • PASS [expected FAIL] /css/CSS2/visuren/emptyspan-1.html
  • FAIL [expected PASS] /css/css-flexbox/item-with-table-with-infinite-max-intrinsic-width.html
  • FAIL [expected PASS] /css/css-flexbox/table-with-infinite-max-intrinsic-width.html
  • PASS [expected FAIL] /css/css-ui/outline-020.html

@bors-servo
Copy link
Contributor

💔 Test failed - checks-github

@stshine
Copy link
Contributor Author

stshine commented May 31, 2023

More tests passed :)

inline elements

Accorinding to https://drafts.csswg.org/css2/#inline-non-replaced, The
vertical padding, border and margin of an inline, non-replaced box
start at the top and bottom of the content area, and has nothing to do
with the line-height. But only the line-height is used when
calculating the height of the line box.
@stshine stshine changed the title layout_2020: Invalidate bottom and top margins on non-replaced inline elements layout_2020: Only count for content size for height of non-replaced inline elements May 31, 2023
Copy link
Contributor

@Loirooriol Loirooriol left a comment

Choose a reason for hiding this comment

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

This case is still wrong:

<!DOCTYPE html>
<style>
div {
    border: blue solid 3px;
    margin-top: 50px;
}
span {
    background: orange;
    padding-top: 20px;
    padding-bottom: 20px;
    height: 100px;
    line-height: 100px;
}
</style>
<div><span>Filler Text</span></div>

But this patch is an improvement so I guess it's fine as-is.

@stshine
Copy link
Contributor Author

stshine commented Jun 2, 2023

that looks like is related to line height, let's deal with that later.
Thanks!

@Loirooriol
Copy link
Contributor

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit 78125ae has been approved by Loirooriol

@bors-servo
Copy link
Contributor

⌛ Testing commit 78125ae with merge 053a0aa...

@github-actions
Copy link

github-actions bot commented Jun 3, 2023

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

Stable unexpected results that are known to be intermittent (1)
  • PASS [expected FAIL] /_mozilla/mozilla/simple_scroll_to_fragment.html (#14606)

@github-actions
Copy link

github-actions bot commented Jun 3, 2023

Test results for linux-wpt-layout-2013 from try job (#5161094063):

Flaky unexpected result (12)
  • TIMEOUT [expected OK] /_webgl/conformance/glsl/misc/shader-uniform-packing-restrictions.html (#28103)
    • NOTRUN [expected PASS] subtest: Overall test
  • TIMEOUT [expected OK] /_webgl/conformance/glsl/misc/shader-with-non-reserved-words.html (#16216)
    • NOTRUN [expected PASS] subtest: Overall test
  • OK [expected TIMEOUT] /fetch/api/redirect/redirect-keepalive.any.html (#29536)
  • OK [expected TIMEOUT] /fetch/local-network-access/iframe.tentative.https.window.html (#29605)
    • FAIL [expected TIMEOUT] subtest: public to local, grandparent navigates: failure. timeout adding grandchild
    • FAIL [expected TIMEOUT] subtest: public to local, grandparent navigates: success. timeout adding grandchild
  • 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 [expected TIMEOUT] /html/browsers/browsing-the-web/navigating-across-documents/javascript-url-load-as-html.xhtml (#29070)
    • PASS [expected TIMEOUT] subtest: javascript: URL navigation to a string must create a HTML document using the correct properties
  • OK [expected TIMEOUT] /html/browsers/browsing-the-web/navigating-across-documents/javascript-url-referrer.window.html (#29081)
    • PASS [expected TIMEOUT] subtest: no-referrer referrer policy used to create the starting page
  • OK [expected TIMEOUT] /html/browsers/history/the-history-interface/traverse-during-unload.html (#28688)
    • PASS [expected TIMEOUT] subtest: Traversing the history during unload
  • OK /html/webappapis/dynamic-markup-insertion/document-write/module-delayed.html (#27659)
    • FAIL [expected PASS] subtest: async document.write in a module assert_true: onload must be called expected true got false
  • TIMEOUT /html/webappapis/scripting/events/compile-event-handler-settings-objects.html (#24246)
    • PASS [expected FAIL] subtest: The entry settings object while executing the compiled callback via Web IDL's invoke must be that of the node document
  • TIMEOUT [expected OK] /html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.html (#26371)
    • TIMEOUT [expected FAIL] subtest: delayed handling: delaying handling rejected promise created from createImageBitmap will cause both events to fire Test timed out
  • ERROR [expected OK] /workers/constructors/Worker/Worker-constructor.html (#22991)
Stable unexpected results that are known to be intermittent (22)
  • TIMEOUT [expected OK] /_webgl/conformance/uniforms/out-of-bounds-uniform-array-access.html (#26225)
    • NOTRUN [expected PASS] subtest: Overall test
  • OK /fetch/local-network-access/worker-blob-fetch.window.html (#29602)
    • FAIL [expected PASS] subtest: local https to local https: success. assert_equals: fetch error expected (undefined) undefined but got (string) "unknown error"
  • TIMEOUT /fetch/metadata/generated/css-images.sub.tentative.html (#29047)
    • TIMEOUT [expected PASS] subtest: background-image sec-fetch-site - HTTPS downgrade (header not sent) Test timed out
    • FAIL [expected PASS] subtest: border-image sec-fetch-site - HTTPS downgrade (header not sent) assert_unreached: Reached unreachable code
  • TIMEOUT [expected OK] /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/iframe-src-aboutblank-navigate-immediately.html (#29048)
    • TIMEOUT [expected FAIL] subtest: Navigating to a different document with form submission Test timed out
  • OK /html/browsers/browsing-the-web/navigating-across-documents/initial-empty-document/load-pageshow-events-iframe-contentWindow.html (#28681)
    • PASS [expected FAIL] subtest: load & pageshow events do not fire on contentWindow of <iframe> element created with src='about:blank'
  • OK /html/browsers/browsing-the-web/navigating-across-documents/javascript-url-return-value-handling-dynamic.html (#28066)
    • PASS [expected FAIL] subtest: 0080 00FF 0100 set in href="" targeting a frame and clicked
    • PASS [expected FAIL] subtest: D83D DE0D set in href="" targeting a frame and clicked
    • PASS [expected FAIL] subtest: DE0D 0041 set in href="" targeting a frame and clicked
  • OK /html/browsers/browsing-the-web/navigating-across-documents/navigation-unload-same-origin.window.html (#29049)
    • FAIL [expected PASS] subtest: Same-origin navigation started from unload handler must be ignored assert_equals: expected "?pass" but got "?fail"
  • OK /html/browsers/the-window-object/open-close/creating_browsing_context_test_01.html (#29046)
  • OK [expected TIMEOUT] /html/interaction/focus/the-autofocus-attribute/autofocus-dialog.html (#29087)
    • FAIL [expected TIMEOUT] subtest: <dialog>-contained autofocus element gets focused when the dialog is shown promise_test: Unhandled rejection with value: object "TypeError: w.document.querySelector(...) is null"
  • 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 assert_equals: expected Element node <area></area> but got Element node <body>
      <img src="/media/poster.png" usemap="#map">
      <map n...
  • OK [expected TIMEOUT] /html/interaction/focus/the-autofocus-attribute/update-the-rendering.html (#24145)
    • FAIL [expected TIMEOUT] subtest: "Flush autofocus candidates" should be happen before a scroll event and animation frame callbacks w.focus is not a function
  • OK /html/semantics/embedded-content/media-elements/media_fragment_seek.html (#24114)
    • PASS [expected FAIL] subtest: Video should seek to time specified in media fragment syntax
  • OK [expected CRASH] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-1.html (#24066)
    • 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 [expected CRASH] /html/semantics/embedded-content/the-iframe-element/iframe_sandbox_popups_nonescaping-3.html (#24066)
  • OK /html/semantics/forms/form-submission-0/multipart-formdata.window.html (#28725)
    • FAIL [expected PASS] subtest: multipart/form-data: 0x00 in name (normal form) assert_equals: expected "\r\nContent-Disposition: form-data; name="a\0b"\r\n\r\nc\r\n--\r\n" but got ""
  • OK /html/syntax/parsing/DOMContentLoaded-defer.html (#21550)
    • FAIL [expected PASS] subtest: The end: DOMContentLoaded and defer scripts assert_false: DOMContentLoaded should not have fired before executing a task queued from a defer script expected false got true
  • OK /html/webappapis/dynamic-markup-insertion/document-write/module-static-import-delayed.html (#26243)
    • PASS [expected FAIL] subtest: document.write in an imported module
  • TIMEOUT /html/webappapis/scripting/processing-model-2/integration-with-the-javascript-job-queue/promise-job-entry.html (#25805)
  • CRASH [expected TIMEOUT] /webmessaging/broadcastchannel/cross-partition.https.tentative.html (#29058)
  • OK [expected TIMEOUT] /webmessaging/with-ports/018.html (#24485)
    • PASS [expected TIMEOUT] subtest: origin of the script that invoked the method, javascript:
  • OK [expected TIMEOUT] /webstorage/localstorage-about-blank-3P-iframe-opens-3P-window.partitioned.tentative.html (#29053)
    • PASS [expected TIMEOUT] subtest: StorageKey: test 3P about:blank window opened from a 3P iframe
  • OK /workers/dedicated-worker-from-blob-url.window.html (#22286)
    • FAIL [expected PASS] subtest: Creating a dedicated worker from a blob URL works immediately before revoking. promise_test: Unhandled rejection with value: object "[object Event]"

@bors-servo
Copy link
Contributor

☀️ Test successful - checks-github
Approved by: Loirooriol
Pushing 053a0aa to master...

@bors-servo bors-servo merged commit 053a0aa into servo:master Jun 3, 2023
10 checks passed
@stshine stshine deleted the no-margins branch June 3, 2023 03:49
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.

None yet

3 participants