Closed Bug 2010730 Opened 8 months ago Closed 7 months ago

`RangeBoundaryBase::AsRangeBoundaryInFlatTree` needs to use proper parent node for the pointing child

Categories

(Core :: DOM: Selection, defect)

defect

Tracking

()

RESOLVED FIXED
149 Branch
Tracking Status
firefox149 --- fixed

People

(Reporter: masayuki, Assigned: masayuki)

References

Details

Attachments

(1 file)

Currently, RangeBoundaryBase::AsRangeBoundaryInFlatTree() use the parent node as-is and the offset. However, the pointing child may be moved into a <slot> in the flat tree. Therefore, it should compute parent node from pointing child.

Currently, the method may return unset boundary. However, we need to
map a DOM tree point to a flat tree point.

The wrong point of current implementation is, the method respect the
container and offset. However, that may be wrong if the pointing child
node is moved into a <slot> or a ShadowRoot. Instead, this patch
computes proper parent from pointing child node if there is.

(I think there should be nsINode::ComputeFlatTreeIndexOfForSelection
or something, but I'd like to put off doing that later because it'd
affect to wider scope of our code.)

Pushed by masayuki@d-toybox.com: https://github.com/mozilla-firefox/firefox/commit/34e2538a7173 https://hg.mozilla.org/integration/autoland/rev/89ecc0ba319a Rewrite `RangeBoundaryBase::AsRangeBoundaryInFlatTree()` r=jjaschke,smaug,dom-core
Pushed by agoloman@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/96800d940e01 https://hg.mozilla.org/integration/autoland/rev/381c8dfd5d28 Revert "Bug 2010730 - Rewrite `RangeBoundaryBase::AsRangeBoundaryInFlatTree()` r=jjaschke,smaug,dom-core" for causing wpt failures @setBaseAndExtent-start-or-end-in-anonymous-shadow-container.html.

Backed out for causing wpt failures @setBaseAndExtent-start-or-end-in-anonymous-shadow-container.html.

Flags: needinfo?(masayuki)

It's odd, that was not reproduced on Linux before landing... Although the crash itself looks like a possible case and explicitly a bug of GetPromotedEndPoint().

Now, I'm waiting the test result on tryserver.
https://treeherder.mozilla.org/jobs?repo=try&revision=3a4f57bba5aa759979f51dbf9a5d1506e6697d5c

Flags: needinfo?(masayuki)

Ah, I misunderstand about the shadow DOM construction, but I still don't understand why the result becomes different if I run the path even on Windows. Anyway, the assertion failure cases on macOS are caused by 2 trivial bugs of the patch.

Pushed by masayuki@d-toybox.com: https://github.com/mozilla-firefox/firefox/commit/f880cd0ef82c https://hg.mozilla.org/integration/autoland/rev/83ccd8953f46 Rewrite `RangeBoundaryBase::AsRangeBoundaryInFlatTree()` r=jjaschke,smaug,dom-core
Status: ASSIGNED → RESOLVED
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → 149 Branch

FYI: I guess the fuzzing team will file some assertion failures related to this series of patches. Especially related to nsContentUtils::ComparePoints. However, I won't work on them immediately because now I'm writing patches to fix the known issues of the flattened tree handling.

QA Whiteboard: [qa-triage-done-c150/b149]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: