Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Fix stuck in fullscreen mode when exiting private browsing. Fixes #739
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro committed Nov 21, 2018
1 parent cd50026 commit 404d8f2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,13 @@ public void onCurrentSessionChange(GeckoSession aSession, int aId) {
for (CustomUIButton button : mButtons) {
button.setPrivateMode(isPrivateMode);
}
boolean isFullScreen = SessionStore.get().isInFullScreen(aSession);
if (isFullScreen && !mIsInFullScreenMode) {
enterFullScreenMode();
} else if (!isFullScreen && mIsInFullScreenMode) {
exitVRVideo();
exitFullScreenMode();
}
}

// NavigationURLBarDelegate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ private void initialize(Context aContext) {
if (mAudio != null) {
mAudio.playSound(AudioEngine.Sound.CLICK);
}

if (SessionStore.get().isInFullScreen()) {
SessionStore.get().exitFullScreen();
}
SessionStore.get().exitPrivateMode();
});

Expand All @@ -65,7 +61,6 @@ protected void initializeWidgetPlacement(WidgetPlacement aPlacement) {
Context context = getContext();
aPlacement.width = WidgetPlacement.dpDimension(context, R.dimen.top_bar_width);
aPlacement.height = WidgetPlacement.dpDimension(context, R.dimen.top_bar_height);
// FIXME: Something wrong with the DPI ratio? Revert to top_bar_world_width when fixed
aPlacement.worldWidth = WidgetPlacement.floatDimension(getContext(), R.dimen.browser_world_width) * aPlacement.width/getWorldWidth();
aPlacement.translationY = WidgetPlacement.unitFromMeters(context, R.dimen.top_bar_world_y);
aPlacement.anchorX = 0.5f;
Expand Down Expand Up @@ -109,6 +104,7 @@ public void onCurrentSessionChange(GeckoSession aSession, int aId) {
mCloseButton.setPrivateMode(isPrivateMode);
}

@Override
public void setVisible(boolean isVisible) {
getPlacement().visible = isVisible;

Expand All @@ -121,19 +117,9 @@ public void setVisible(boolean isVisible) {
// WidgetManagerDelegate.UpdateListener
@Override
public void onWidgetUpdate(Widget aWidget) {
if (aWidget != mBrowserWidget) {
return;
if (aWidget == mBrowserWidget && isVisible()) {
mWidgetManager.updateWidget(this);
}

// Browser window may have been resized, adjust the navigation bar
float targetWidth = aWidget.getPlacement().worldWidth;
// FIXME: Something wrong with the DPI ratio? Revert to top_bar_world_width when fixed
float defaultWidth = WidgetPlacement.floatDimension(getContext(), R.dimen.browser_world_width) * 40/720;
targetWidth = Math.max(defaultWidth, targetWidth);

float ratio = targetWidth / defaultWidth;
mWidgetPlacement.worldWidth = targetWidth;
mWidgetPlacement.width = (int) (WidgetPlacement.dpDimension(getContext(), R.dimen.top_bar_width) * ratio);
mWidgetManager.updateWidget(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ private void initialize() {
mWidgetManager = (WidgetManagerDelegate) getContext();
mWidgetPlacement = new WidgetPlacement(getContext());
mHandle = mWidgetManager.newWidgetHandle();
mWorldWidth = WidgetPlacement.pixelDimension(getContext(), R.dimen.world_width);
initializeWidgetPlacement(mWidgetPlacement);
mInitialWidth = mWidgetPlacement.width;
mInitialHeight = mWidgetPlacement.height;
mWorldWidth = WidgetPlacement.pixelDimension(getContext(), R.dimen.world_width);
// Transparent border useful for TimeWarp Layers and better aliasing.
int padding_dp = 1; // 1 dps
final float scale = getResources().getDisplayMetrics().density;
Expand Down

0 comments on commit 404d8f2

Please sign in to comment.