Open Bug 1942036 Opened 3 days ago Updated 12 hours ago

scrollWidth / scrollHeight not properly calculated when content has negative margin

Categories

(Core :: Layout: Scrolling and Overflow, defect)

Firefox 134
defect

Tracking

()

Tracking Status
firefox-esr115 --- unaffected
firefox-esr128 --- unaffected
firefox134 --- affected
firefox135 --- affected
firefox136 --- affected

People

(Reporter: m.irrschik, Assigned: emilio, NeedInfo)

References

(Regression)

Details

(Keywords: regression)

Attachments

(2 files)

Attached file marginTest.html

Steps to reproduce:

For the attached case, the contentWidth/Height and scrollWidth/Height should be equals (and were till FF133, and still are in chrome/edge) - but since v134 the values are wronlgy caluclated, assumingly because of incorrect handling of the negative margins.

Actual results:

scrollWidth/scrollHeight is wrong (310 in my test-case)

Expected results:

scrollWidth/scrollHeight should be 300 in my test-case

Component: Untriaged → DOM: CSS Object Model
Product: Firefox → Core

:emilio, since you are the author of the regressor, bug 1936156, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: nobody → emilio
Flags: needinfo?(emilio)

Thanks for the report! FYI, in case you've encountered this in a site you develop or what not, a potential workaround is to use display: flow-root, or something that turns the block into a block formatting context.

Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/87e1173b9098 Don't ignore negative margins for scroll{Width,Height} on overflow:visible frames. r=dshin
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/50151 for changes under testing/web-platform/tests

Backed out for causing multiple failures

Backout link: https://hg.mozilla.org/integration/autoland/rev/e1e29a88000d0dbbb33b2e0f8c75a096dbe718b8

Push with failures

Failure log -> TEST-UNEXPECTED-FAIL | widget/tests/test_wheeltransaction.xhtml

INFO - TEST-UNEXPECTED-FAIL | widget/tests/test_wheeltransaction.xhtml | Test timed out. - 
[task 2025-01-17T19:10:59.514Z] 19:10:59     INFO - GECKO(1619) | MEMORY STAT | vsize 20137MB | residentFast 626MB | heapAllocated 289MB
[task 2025-01-17T19:11:02.531Z] 19:11:02     INFO - Error: Unable to restore focus, expect failures and timeouts.
[task 2025-01-17T19:11:02.532Z] 19:11:02     INFO - GECKO(1619) | [Parent 1619, Main Thread] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005 (NS_ERROR_FAILURE): file /builds/worker/checkouts/gecko/chrome/nsChromeRegistry.cpp:182
[task 2025-01-17T19:11:02.533Z] 19:11:02     INFO - GECKO(1619) | [Parent 1619, Main Thread] WARNING: 'NS_FAILED(rv)', file /builds/worker/checkouts/gecko/chrome/nsChromeProtocolHandler.cpp:73
[task 2025-01-17T19:11:02.546Z] 19:11:02     INFO - GECKO(1619) | [Parent 1619, Main Thread] WARNING: Failed to retarget HTML data delivery to the parser thread.: file /builds/worker/checkouts/gecko/parser/html/nsHtml5StreamParser.cpp:1215
[task 2025-01-17T19:11:02.606Z] 19:11:02     INFO - TEST-OK | widget/tests/test_wheeltransaction.xhtml | took 323690ms

Failure log -> REFTEST TEST-UNEXPECTED-FAIL | layout/reftests/position-sticky/padding-3.html == layout/reftests/position-sticky/padding-3-ref.html | image comparison, max difference: 54, number of differing pixels: 234

Failure log -> TEST-UNEXPECTED-FAIL | /css/css-flexbox/scrollbars-auto.html & TEST-UNEXPECTED-FAIL | /css/css-flexbox/scrollbars-no-margin.html

Flags: needinfo?(emilio)
Upstream PR was closed without merging

Blerg, typo, accounted for the normal position twice accidentally in one code-path.

Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3f6d1963e0e0 Don't ignore negative margins for scroll{Width,Height} on overflow:visible frames. r=dshin
Regressions: 1942457

Backed out for causing wpt failures in scrollWidthHeight-overflow-visible-negative-margins.html.

  • Backout link
  • Push with failures
  • Failure Log
  • Failure line: TEST-UNEXPECTED-FAIL | /css/cssom-view/scrollWidthHeight-overflow-visible-negative-margins.html | scroll{Width,Height} with negative margins with overflow: auto, padding: 2px, border: 0, display: flex - assert_equals: scrollWidth expecting 5px of overflow expected 14 but got 15
Flags: needinfo?(emilio)
Upstream PR was closed without merging
Flags: needinfo?(emilio)
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d291e613ef7b Don't ignore negative margins for scroll{Width,Height} on overflow:visible frames. r=dshin

Backed out for causing wpt failures in scrollWidthHeight-overflow-visible-negative-margins.html.

Flags: needinfo?(emilio)
Upstream PR was closed without merging
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: