Closed Bug 1773121 Opened 3 years ago Closed 3 years ago

Relatively Positioned Element Should Not Decrease the Scroll Area of Its Container

Categories

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

defect

Tracking

()

RESOLVED DUPLICATE of bug 1772593

People

(Reporter: dshin, Assigned: dshin)

References

Details

Attachments

(2 files, 1 obsolete file)

Attached file testcase 1

As per the standard: "The box is laid out as for static, then offset from the resulting position. This offsetting is a purely visual effect, and does not affect the size or position of any other box, except insofar as it increases the scrollable overflow area of its ancestors."

STR: Load test case

Expected Behaviour:

  1. First div's scrollbar width is 200px
  2. Second div's scrollbar width is 300px
  3. Third div's scrollbar width is 200px

Actual behaviour: First and second divs behaves as expected, but the third scrollbar does not appear

Assignee: nobody → dshin
Blocks: 1768921

Tracking calls to that function down, looks like the behaviour is more correct if I trigger UnionChildOverflow (Which calls down to GetActualAndNormalOverflowAreasRelativeToParent) by turning the relevant pref on and applying overflow-clip-box: content-box.
But this feels like we're calculating the overflow area all over again - should we not be returning the correct overflow area (e.g. what GetActualAndNormalOverflowAreasRelativeToParent returns) in the first place at the end of reflow?

(In reply to David Shin[:dshin] from comment #2)

should we not be returning the correct overflow area (e.g. what GetActualAndNormalOverflowAreasRelativeToParent returns) in the first place at the end of reflow?

I think you're right, yeah; we should probably be incorporating the actual-and-normal-position-based overflow areas there.

Severity: -- → S3

With this, a relatively positioned element e.g. being offset to the left
should not decrease the scrollport size. For this, overflow area calculation
for relatively positioned elements must behave like
nsIFrame::GetActualAndNormalOverflowAreasRelativeToParent. We aren't
using the function directly since it's meant to be called post-reflow, and
we want to report it correctly during reflow in the first place.

Pushed by dshin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d6ee5bae41b8 If an element is relatively positioned, report overflow area that is a union of relative and static position. r=dholbert
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/34450 for changes under testing/web-platform/tests
Upstream PR was closed without merging
Attachment #9280103 - Attachment description: rel-scroll.html → testcase 1
Attached file testcase 2

Here's a testcase (using essentially the third piece of the original testcase, and a variant of that piece with a wrapper div).

There are two scrollable areas in the testcase.

  • Firefox Nightly shows no scrollbars at all.
  • Chrome shows scrollbars on the first part but not the second part.
  • Firefox with the attached patch shows scrollbars on both.

The second part is sort of like the failing WPT test where we end up creating scrollbars unnecessarily for a relative-positioned grandchild of the scrollable element, whose static position would overflow but its actual (positioned) position does not:
https://wpt.live/css/CSS2/linebox/empty-inline-002.xht

I think the crux here is that we only want to do this for the "in-flow children" -- e.g. the "in-flow bounds" that we need to consider for bug 1768921 should probably include the normal position of relatively-positioned children.

Per bug 1772593 comment 14, I think a proper fix for that bug over there would also fix this bug here (make us agree with Chrome on testcase 1 and testcase 2 here).

So I think maybe we should just dupe this and proceed to fix bug 1772593?

Ok - agreed.

Status: NEW → RESOLVED
Closed: 3 years ago
Flags: needinfo?(dshin)
Resolution: --- → DUPLICATE
Attachment #9281057 - Attachment is obsolete: true
Duplicate of this bug: 1800939
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: