Closed Bug 1690701 Opened 4 years ago Closed 4 years ago

Check NS_FRAME_OUT_OF_FLOW bit in nsIFrame::IsAbsolutelyPositioned() and nsIFrame::IsFloating()

Categories

(Core :: Layout: Positioned, task)

task

Tracking

()

RESOLVED FIXED
88 Branch
Tracking Status
firefox88 --- fixed

People

(Reporter: TYLin, Assigned: TYLin)

References

Details

Attachments

(5 files, 1 obsolete file)

Per discussion with mats in https://phabricator.services.mozilla.com/D103824#3368905,

both nsIFrame::IsAbsolutelyPositioned() and nsIFrame::IsFloating() only check the style so which might be a bit misleading given that they are nsIFrame methods. We should probably just convert all existing consumers to call the corresponding nsStyleDisplay method directly instead. Then we can make the nsIFrame version also check the frame bit, and convert expressions like that one I'm adding here to call the new nsIFrame method.

Per https://drafts.csswg.org/css-position-3/#position-property, table-column-group and table-column ignore position, so nsIFrame::IsAbsolutelyPositioned() should also check NS_FRAME_OUT_OF_FLOW bit to ensure its correctness across all frame types. Similarly for nsIFrame::IsFloating().

The nsIFrame::IsAbsolutelyPositioned() is removed to ensure all the
callers are converted. In Part 2, we are going to bring it back with
HasAnyStateBits(NS_FRAME_OUT_OF_FLOW) added into it.

This patch shouldn't change the behavior at all.

Similar to Part 1, nsIFrame::IsFloating() is removed to ensure all the
callers are converted. In Part 4, we are going to bring it back with
HasAnyStateBits(NS_FRAME_OUT_OF_FLOW) added into it.

Depends on D106580

Assignee: nobody → aethanyc
Status: NEW → ASSIGNED
Attachment #9205618 - Attachment description: Bug 1690701 Part 1 - Convert nsIFrame::IsAbsolutelyPositioned() to the equivalent nsStyleDisplay method. → Bug 1690701 Part 1 - Check floating style when determining whether it is a floating first letter.
Attachment #9205619 - Attachment description: Bug 1690701 Part 2 - Resurrect nsIFrame::IsAbsolutelyPositioned(), and adapt some callsites. → Bug 1690701 Part 2 - Check NS_FRAME_OUT_OF_FLOW bit in nsIFrame::IsAbsolutelyPositioned().
Attachment #9205621 - Attachment description: Bug 1690701 Part 4 - Resurrect nsIFrame::IsFloating(), and adapt a callsite. → Bug 1690701 Part 3 - Check NS_FRAME_OUT_OF_FLOW bit in nsIFrame::IsFloating().
Attachment #9205622 - Attachment description: Bug 1690701 Part 5 - Replace rarely used ReflowInput::IsFloating() with nsStyleDisplay::IsFloating(). → Bug 1690701 Part 4 - Replace rarely used ReflowInput::IsFloating() with nsIFrame::IsFloating().
Attachment #9205620 - Attachment is obsolete: true
Attachment #9205622 - Attachment description: Bug 1690701 Part 4 - Replace rarely used ReflowInput::IsFloating() with nsIFrame::IsFloating(). → Bug 1690701 Part 4 - Replace rarely used ReflowInput::IsFloating() with nsStyleDisplay::IsFloating().

When aElement is a <table>, styleFrame is the inner table frame. It has
the abspos style, but not the NS_FRAME_OUT_OF_FLOW bit. The bit is set
on the table wrapper frame.

We want to check just the abspos style for styleFrame. Otherwise we'll
break <table> element's offsetParent property after applying Part 2.

Without this patch, running ./mach test dom/html/test/test_bug375003-1.html
can generate the following exception.

dom/html/test/test_bug375003-1.html | uncaught exception -
TypeError: can't access property "id", p is null at
t3@http://mochi.test:8888/tests/dom/html/test/test_bug375003-1.html:39:3

Depends on D106579

Attachment #9206007 - Attachment description: Bug 1690701 Part 1.5 - Check abspos style for styleFrame in GetUnretargetedOffsetsFor(). → Bug 1690701 Part 1.5 - Check |frame| instead of |styleFrame| for abspos in GetUnretargetedOffsetsFor().
Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/928da174181e Part 1 - Check floating style when determining whether it is a floating first letter. r=layout-reviewers,emilio https://hg.mozilla.org/integration/autoland/rev/53191bd0032c Part 1.5 - Check |frame| instead of |styleFrame| for abspos in GetUnretargetedOffsetsFor(). r=emilio https://hg.mozilla.org/integration/autoland/rev/a7bf4082de04 Part 2 - Check NS_FRAME_OUT_OF_FLOW bit in nsIFrame::IsAbsolutelyPositioned(). r=emilio https://hg.mozilla.org/integration/autoland/rev/d3e1a283826c Part 3 - Check NS_FRAME_OUT_OF_FLOW bit in nsIFrame::IsFloating(). r=emilio https://hg.mozilla.org/integration/autoland/rev/6b60e720eecd Part 4 - Replace rarely used ReflowInput::IsFloating() with nsStyleDisplay::IsFloating(). r=emilio
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: