Bug 1582750 - Ensure descriptionHeightWorkaround is called for multiple consecutive content blocking events. r=johannh

Differential Revision: https://phabricator.services.mozilla.com/D47817

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nihanth Subramanya 2019-10-02 14:45:07 +00:00
parent 128617cd51
commit 43452f1ef3

View File

@ -1628,19 +1628,13 @@ var gProtectionsHandler = {
if (["showing", "open"].includes(this._protectionsPopup.state)) {
this.reorderCategoryItems();
if (!this._descriptionHeightWorkaroundCalled) {
// The first time the panel is opened, the category items are still
// invisible when descriptionHeightWorkaround gets called, i.e. they
// are omitted from the workaround and the content overflows the panel.
// We can fix this by calling the function manually the first time we
// call reorderCategoryItems(). Since we have set all the relevant
// attributes and hidden the "No Trackers Found" description at this
// point, the items are guaranteed to be visible when we call it below.
PanelMultiView.forNode(
this._protectionsPopupMainView
).descriptionHeightWorkaround();
this._descriptionHeightWorkaroundCalled = true;
}
// Until we encounter a site that triggers them, category elements might
// be invisible when descriptionHeightWorkaround gets called, i.e. they
// are omitted from the workaround and the content overflows the panel.
// Solution: call it manually here.
PanelMultiView.forNode(
this._protectionsPopupMainView
).descriptionHeightWorkaround();
}
}