зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1401383 - remove anchor state after transition even if the transition is canceled, and always set main view as current, r=mikedeboer
Prior to this change, showMainView set the 'current' attribute on a main view, but then _cleanupTransitionPhase() would remove it again. This patch fixes that by calling showMainView *after* _cleanupTransitionPhase. Separately, we weren't removing the 'open' attribute from the anchor if the transition didn't complete. This patch fixes this by moving the addition of 'open' into _transitionViews, and its removal into _cleanupTransitionPhase. MozReview-Commit-ID: 24FYaxDVlga --HG-- extra : rebase_source : 41bb5ffe29ca8e0ec9acc1793ae87d63d28e1f43
This commit is contained in:
Родитель
eb785983d9
Коммит
b078909af6
|
@ -534,13 +534,7 @@ this.PanelMultiView = class {
|
|||
|
||||
// Now we have to transition the panel.
|
||||
if (this.panelViews && playTransition) {
|
||||
if (aAnchor)
|
||||
aAnchor.setAttribute("open", true);
|
||||
|
||||
await this._transitionViews(previousViewNode, viewNode, reverse, previousRect);
|
||||
|
||||
if (aAnchor)
|
||||
aAnchor.removeAttribute("open");
|
||||
await this._transitionViews(previousViewNode, viewNode, reverse, previousRect, aAnchor);
|
||||
|
||||
this._dispatchViewEvent(viewNode, "ViewShown");
|
||||
this._updateKeyboardFocus(viewNode);
|
||||
|
@ -577,11 +571,10 @@ this.PanelMultiView = class {
|
|||
* previous view or forward to a next view.
|
||||
* @param {Object} previousRect Rect object, with the same structure as
|
||||
* a DOMRect, of the `previousViewNode`.
|
||||
* @param {Function} callback Function that will be invoked when the
|
||||
* transition is finished or when the
|
||||
* operation was canceled (early return).
|
||||
* @param {Element} anchor the anchor for which we're opening
|
||||
* a new panelview, if any
|
||||
*/
|
||||
async _transitionViews(previousViewNode, viewNode, reverse, previousRect) {
|
||||
async _transitionViews(previousViewNode, viewNode, reverse, previousRect, anchor) {
|
||||
// There's absolutely no need to show off our epic animation skillz when
|
||||
// the panel's not even open.
|
||||
if (this._panel.state != "open") {
|
||||
|
@ -595,9 +588,12 @@ this.PanelMultiView = class {
|
|||
|
||||
this._transitionDetails = {
|
||||
phase: TRANSITION_PHASES.START,
|
||||
previousViewNode, viewNode, reverse
|
||||
previousViewNode, viewNode, reverse, anchor
|
||||
};
|
||||
|
||||
if (anchor)
|
||||
anchor.setAttribute("open", "true");
|
||||
|
||||
// Set the viewContainer dimensions to make sure only the current view is
|
||||
// visible.
|
||||
this._viewContainer.style.height = Math.max(previousRect.height, this._mainViewHeight) + "px";
|
||||
|
@ -704,7 +700,7 @@ this.PanelMultiView = class {
|
|||
if (!this._transitionDetails)
|
||||
return;
|
||||
|
||||
let {phase, previousViewNode, viewNode, reverse, resolve, listener} = this._transitionDetails;
|
||||
let {phase, previousViewNode, viewNode, reverse, resolve, listener, anchor} = this._transitionDetails;
|
||||
this._transitionDetails = null;
|
||||
|
||||
// Do the things we _always_ need to do whenever the transition ends or is
|
||||
|
@ -715,6 +711,9 @@ this.PanelMultiView = class {
|
|||
this._resetKeyNavigation(previousViewNode);
|
||||
this.descriptionHeightWorkaround(viewNode);
|
||||
|
||||
if (anchor)
|
||||
anchor.removeAttribute("open");
|
||||
|
||||
if (phase >= TRANSITION_PHASES.START) {
|
||||
this._panel.removeAttribute("width");
|
||||
this._panel.removeAttribute("height");
|
||||
|
@ -995,7 +994,6 @@ this.PanelMultiView = class {
|
|||
this._viewShowing = null;
|
||||
this._transitioning = false;
|
||||
this.node.removeAttribute("panelopen");
|
||||
this.showMainView();
|
||||
if (this.panelViews) {
|
||||
this._cleanupTransitionPhase();
|
||||
for (let panelView of this._viewStack.children) {
|
||||
|
@ -1018,6 +1016,7 @@ this.PanelMultiView = class {
|
|||
this._viewContainer.style.removeProperty("min-width");
|
||||
this._viewContainer.style.removeProperty("max-width");
|
||||
}
|
||||
this.showMainView();
|
||||
|
||||
// Always try to layout the panel normally when reopening it. This is
|
||||
// also the layout that will be used in customize mode.
|
||||
|
|
Загрузка…
Ссылка в новой задаче