Closed Bug 1516258 Opened 6 years ago Closed 6 years ago

Remove XULScrollElement

Categories

(Core :: XUL, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: Paolo, Assigned: Paolo)

References

(Regressed 1 open bug)

Details

Attachments

(2 files)

After bug 1454360, XULScrollElement can be easily removed.
The only method of XULScrollElement that is still used is in "richlistbox", and can be easily reimplemented. There is still styling associated with the "scrollbox" element, but eventually those instances can be replaced with simple boxes.
Blocks: 1472557
Attachment #9033182 - Attachment description: Bug 1516258 - Remove XULScrollElement. r=NeilDeakin → Bug 1516258 - Part 2 - Remove XULScrollElement. r=NeilDeakin

Jorg, please see https://phabricator.services.mozilla.com/D16840. Calls to:

scrollbox.ensureElementIsVisible(element);

should be replaced with:

element.scrollIntoView({ block: "nearest" });

comm-central has callers at: https://searchfox.org/comm-central/search?q=ensureElementIsVisible&path=
There's a replacement for ensureElementIsVisible (used in comm-central at): https://searchfox.org/comm-central/search?q=ensureElementIsVisible&path=

Flags: needinfo?(jorgk)

Paolo, why block: "nearest"? I don't actually see any documentation about what that means in https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView.

Flags: needinfo?(paolo.mozmail)
Depends on: 1520902

Thanks, I filed bug 1520902. Something went wrong in comment #4:

(In reply to Brian Grinstead [:bgrins] from comment #4)

comm-central has callers at: https://searchfox.org/comm-central/search?q=ensureElementIsVisible&path=
There's a replacement for ensureElementIsVisible (used in comm-central at): https://searchfox.org/comm-central/search?q=ensureElementIsVisible&path=

That's the same link twice, and I thought the replacement was element.scrollIntoView({ block: "nearest" });. Can you please explain.

Flags: needinfo?(jorgk)

(In reply to Jorg K (GMT+1) from comment #6)

Thanks, I filed bug 1520902. Something went wrong in comment #4:

(In reply to Brian Grinstead [:bgrins] from comment #4)

comm-central has callers at: https://searchfox.org/comm-central/search?q=ensureElementIsVisible&path=
There's a replacement for ensureElementIsVisible (used in comm-central at): https://searchfox.org/comm-central/search?q=ensureElementIsVisible&path=

That's the same link twice, and I thought the replacement was element.scrollIntoView({ block: "nearest" });. Can you please explain.

Oh, that was a typo. The callers at https://searchfox.org/comm-central/search?q=ensureElementIsVisible&path= should be replaced with element.scrollIntoView({ block: "nearest" }).

(In reply to Brian Grinstead [:bgrins] from comment #5)

Paolo, why block: "nearest"?

If this parameter is omitted, the element would be placed at the top, even if it was out of view at the bottom. The comment before ScrollIntoViewOptions points here:

https://drafts.csswg.org/cssom-view/#extension-to-the-element-interface

Flags: needinfo?(paolo.mozmail)
Pushed by paolo.mozmail@amadzone.org:
https://hg.mozilla.org/integration/mozilla-inbound/rev/364d6aef9d05
Part 1 - Stop using XULScrollElement::EnsureElementIsVisible. r=bgrins
https://hg.mozilla.org/integration/mozilla-inbound/rev/2b59993a9659
Part 2 - Remove XULScrollElement. r=NeilDeakin

(In reply to Brian Grinstead [:bgrins] from comment #7)

Oh, that was a typo. The callers at https://searchfox.org/comm-central/search?q=ensureElementIsVisible&path= should be replaced with element.scrollIntoView({ block: "nearest" }).

Sadly it's not that easy. We have two bindings which define ensureElementIsVisible, one being the forked richlistbox. So consumers won't have to change for now. From DXR/Searchfox it's not obvious which should be replaced and which shouldn't.

I'm seriously confused as to which call sites need replacement. Clearly you haven't touched browserLanguages.js which has five ensureElementIsVisible() calls. We have equivalent code in C-C.

Flags: needinfo?(bgrinstead)
Flags: needinfo?(bgrinstead) → needinfo?(paolo.mozmail)

(In reply to :aceman from comment #12)

Is this also killing <scrollbox> element as in https://searchfox.org/comm-central/source/common/bindings/richlistbox.xml#19 ?

I'm not sure - but I thought that instance would have been removed by Bug 1472557.

Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66

(In reply to Jorg K (GMT+1) from comment #11)

I'm seriously confused as to which call sites need replacement. Clearly you haven't touched browserLanguages.js which has five ensureElementIsVisible() calls. We have equivalent code in C-C.

Yes, we have similarly named methods on the "richlistbox" Custom Element and the "arrowscrollbox" XBL binding:

https://searchfox.org/mozilla-central/rev/dac799c9f4e9f5f05c1071cba94f2522aa31f7eb/toolkit/content/widgets/richlistbox.js#548
https://searchfox.org/mozilla-central/rev/dac799c9f4e9f5f05c1071cba94f2522aa31f7eb/toolkit/content/widgets/scrollbox.xml#282

The calls affected by this patch are only the ones on the "scrollbox" element itself. There are two more interface methods on XULScrollElement, but all the callers were already removed from mozilla-central in bug 1472557, in particular you can see how this call in "richlistbox" was replaced:

this._scrollbox.scrollToElement(item);

Flags: needinfo?(paolo.mozmail)
Regressions: 1715000
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: