зеркало из https://github.com/mozilla/gecko-dev.git
Bug 859683 - Allow scrolling in full-screen mode if and only if the full-screen element is the document element. r=wesj
This commit is contained in:
Родитель
e359c4c12a
Коммит
161c8400d7
|
@ -36,6 +36,7 @@ import org.mozilla.gecko.background.announcements.AnnouncementsBroadcastService;
|
|||
import org.mozilla.gecko.db.BrowserDB;
|
||||
import org.mozilla.gecko.favicons.Favicons;
|
||||
import org.mozilla.gecko.gfx.BitmapUtils;
|
||||
import org.mozilla.gecko.gfx.FullScreenState;
|
||||
import org.mozilla.gecko.gfx.Layer;
|
||||
import org.mozilla.gecko.gfx.LayerView;
|
||||
import org.mozilla.gecko.gfx.PluginLayer;
|
||||
|
@ -564,13 +565,14 @@ public abstract class GeckoApp
|
|||
// Local ref to layerView for thread safety
|
||||
LayerView layerView = mLayerView;
|
||||
if (layerView != null) {
|
||||
layerView.setFullScreen(true);
|
||||
layerView.setFullScreenState(message.getBoolean("rootElement")
|
||||
? FullScreenState.ROOT_ELEMENT : FullScreenState.NON_ROOT_ELEMENT);
|
||||
}
|
||||
} else if (event.equals("DOMFullScreen:Stop")) {
|
||||
// Local ref to layerView for thread safety
|
||||
LayerView layerView = mLayerView;
|
||||
if (layerView != null) {
|
||||
layerView.setFullScreen(false);
|
||||
layerView.setFullScreenState(FullScreenState.NONE);
|
||||
}
|
||||
} else if (event.equals("Permissions:Data")) {
|
||||
String host = message.getString("host");
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.gecko.gfx;
|
||||
|
||||
public enum FullScreenState {
|
||||
NONE,
|
||||
ROOT_ELEMENT,
|
||||
NON_ROOT_ELEMENT
|
||||
}
|
|
@ -801,8 +801,8 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
|||
|
||||
/** Implementation of PanZoomTarget */
|
||||
@Override
|
||||
public boolean isFullScreen() {
|
||||
return mView.isFullScreen();
|
||||
public FullScreenState getFullScreenState() {
|
||||
return mView.getFullScreenState();
|
||||
}
|
||||
|
||||
/** Implementation of PanZoomTarget */
|
||||
|
|
|
@ -469,8 +469,11 @@ class JavaPanZoomController
|
|||
return false;
|
||||
|
||||
case TOUCHING:
|
||||
// Don't allow panning if there is an element in full-screen mode. See bug 775511.
|
||||
if ((mTarget.isFullScreen() && !mSubscroller.scrolling()) || panDistance(event) < PAN_THRESHOLD) {
|
||||
// Don't allow panning if there is a non-root element in full-screen mode. See bug 775511 and bug 859683.
|
||||
if (mTarget.getFullScreenState() == FullScreenState.NON_ROOT_ELEMENT && !mSubscroller.scrolling()) {
|
||||
return false;
|
||||
}
|
||||
if (panDistance(event) < PAN_THRESHOLD) {
|
||||
return false;
|
||||
}
|
||||
cancelTouch();
|
||||
|
@ -1173,7 +1176,7 @@ class JavaPanZoomController
|
|||
|
||||
@Override
|
||||
public boolean onScale(SimpleScaleGestureDetector detector) {
|
||||
if (mTarget.isFullScreen())
|
||||
if (mTarget.getFullScreenState() != FullScreenState.NONE)
|
||||
return false;
|
||||
|
||||
if (mState != PanZoomState.PINCHING)
|
||||
|
|
|
@ -504,9 +504,11 @@ public class LayerRenderer implements Tabs.OnTabsChangedListener {
|
|||
// Run through pre-render tasks
|
||||
runRenderTasks(mTasks, false, mFrameStartTime);
|
||||
|
||||
if (!mPageContext.fuzzyEquals(mLastPageContext) && !mView.isFullScreen()) {
|
||||
boolean hideScrollbars = (mView.getFullScreenState() == FullScreenState.NON_ROOT_ELEMENT);
|
||||
if (!mPageContext.fuzzyEquals(mLastPageContext) && !hideScrollbars) {
|
||||
// The viewport or page changed, so show the scrollbars again
|
||||
// as per UX decision. Don't do this if we're in full-screen mode though.
|
||||
// as per UX decision. Don't do this if we're disabling scrolling due to
|
||||
// full-screen mode though.
|
||||
mVertScrollLayer.unfade();
|
||||
mHorizScrollLayer.unfade();
|
||||
mFadeRunnable.scheduleStartFade(ScrollbarLayer.FADE_DELAY);
|
||||
|
|
|
@ -64,7 +64,7 @@ public class LayerView extends FrameLayout implements Tabs.OnTabsChangedListener
|
|||
/* Must be a PAINT_xxx constant */
|
||||
private int mPaintState;
|
||||
private int mBackgroundColor;
|
||||
private boolean mFullScreen;
|
||||
private FullScreenState mFullScreenState;
|
||||
|
||||
private SurfaceView mSurfaceView;
|
||||
private TextureView mTextureView;
|
||||
|
@ -109,6 +109,7 @@ public class LayerView extends FrameLayout implements Tabs.OnTabsChangedListener
|
|||
mGLController = GLController.getInstance(this);
|
||||
mPaintState = PAINT_START;
|
||||
mBackgroundColor = Color.WHITE;
|
||||
mFullScreenState = FullScreenState.NONE;
|
||||
|
||||
mTouchInterceptors = new ArrayList<TouchEventInterceptor>();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
|
@ -692,12 +693,16 @@ public class LayerView extends FrameLayout implements Tabs.OnTabsChangedListener
|
|||
GeckoAccessibility.onLayerViewFocusChanged(this, gainFocus);
|
||||
}
|
||||
|
||||
public void setFullScreen(boolean fullScreen) {
|
||||
mFullScreen = fullScreen;
|
||||
public void setFullScreenState(FullScreenState state) {
|
||||
mFullScreenState = state;
|
||||
}
|
||||
|
||||
public boolean isFullScreen() {
|
||||
return mFullScreen;
|
||||
return mFullScreenState != FullScreenState.NONE;
|
||||
}
|
||||
|
||||
public FullScreenState getFullScreenState() {
|
||||
return mFullScreenState;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -13,7 +13,7 @@ import android.graphics.RectF;
|
|||
public interface PanZoomTarget {
|
||||
public ImmutableViewportMetrics getViewportMetrics();
|
||||
public ZoomConstraints getZoomConstraints();
|
||||
public boolean isFullScreen();
|
||||
public FullScreenState getFullScreenState();
|
||||
public RectF getMaxMargins();
|
||||
|
||||
public void setAnimationTarget(ImmutableViewportMetrics viewport);
|
||||
|
|
|
@ -199,6 +199,7 @@ gbjar.sources += [
|
|||
'gfx/DisplayPortMetrics.java',
|
||||
'gfx/DrawTimingQueue.java',
|
||||
'gfx/FloatSize.java',
|
||||
'gfx/FullScreenState.java',
|
||||
'gfx/GeckoLayerClient.java',
|
||||
'gfx/GLController.java',
|
||||
'gfx/ImmutableViewportMetrics.java',
|
||||
|
|
|
@ -346,12 +346,19 @@ var BrowserApp = {
|
|||
});
|
||||
}, false);
|
||||
|
||||
window.addEventListener("mozfullscreenchange", function() {
|
||||
window.addEventListener("mozfullscreenchange", function(e) {
|
||||
// This event gets fired on the document and its entire ancestor chain
|
||||
// of documents. When enabling fullscreen, it is fired on the top-level
|
||||
// document first and goes down; when disabling the order is reversed
|
||||
// (per spec). This means the last event on enabling will be for the innermost
|
||||
// document, which will have mozFullScreenElement set correctly.
|
||||
let doc = e.target;
|
||||
sendMessageToJava({
|
||||
type: document.mozFullScreen ? "DOMFullScreen:Start" : "DOMFullScreen:Stop"
|
||||
type: doc.mozFullScreen ? "DOMFullScreen:Start" : "DOMFullScreen:Stop",
|
||||
rootElement: (doc.mozFullScreen && doc.mozFullScreenElement == doc.documentElement)
|
||||
});
|
||||
|
||||
if (document.mozFullScreen)
|
||||
if (doc.mozFullScreen)
|
||||
showFullScreenWarning();
|
||||
}, false);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче