mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Merge b2g-inbound to m-c.
This commit is contained in:
commit
f0f9a42b91
@ -1048,9 +1048,11 @@ let RemoteDebugger = {
|
||||
DebuggerServer.addActors("resource://gre/modules/devtools/server/actors/webapps.js");
|
||||
DebuggerServer.registerModule("devtools/server/actors/device");
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
DebuggerServer.onConnectionChange = function(what) {
|
||||
AdbController.updateState();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
let path = Services.prefs.getCharPref("devtools.debugger.unix-domain-socket") ||
|
||||
@ -1076,10 +1078,8 @@ let RemoteDebugger = {
|
||||
}
|
||||
|
||||
let KeyboardHelper = {
|
||||
handleEvent: function keyboard_handleEvent(aMessage) {
|
||||
let data = aMessage.data;
|
||||
|
||||
Keyboard.setLayouts(data.layouts);
|
||||
handleEvent: function keyboard_handleEvent(detail) {
|
||||
Keyboard.setLayouts(detail.layouts);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -17,7 +17,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
|
||||
"@mozilla.org/parentprocessmessagemanager;1", "nsIMessageBroadcaster");
|
||||
|
||||
let Keyboard = {
|
||||
this.Keyboard = {
|
||||
_messageManager: null,
|
||||
_messageNames: [
|
||||
'SetValue', 'RemoveFocus', 'SetSelectedOption', 'SetSelectedOptions',
|
||||
@ -267,4 +267,4 @@ let Keyboard = {
|
||||
}
|
||||
};
|
||||
|
||||
Keyboard.init();
|
||||
this.Keyboard.init();
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"revision": "eb59735156986ce7a697063021ad74f1fca0bc12",
|
||||
"revision": "ca3cef257ae1d19f25cd4b973f7ba2a713b8a7c2",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -65,14 +65,15 @@ function checkInstalledApp(aMiniManifestURL,
|
||||
aCb) {
|
||||
var req = navigator.mozApps.checkInstalled(aMiniManifestURL);
|
||||
req.onsuccess = function(evt) {
|
||||
ok(true, "The app is installed");
|
||||
ok(req.result, "The app is installed");
|
||||
|
||||
if (!req.result) {
|
||||
PackagedTestHelper.finish();
|
||||
}
|
||||
|
||||
PackagedTestHelper.checkAppState(evt.application, aVersion, aExpectedApp,
|
||||
aLaunchable, false, aCb);
|
||||
};
|
||||
req.onerror = function() {
|
||||
ok(false, "The app is not installed");
|
||||
PackagedTestHelper.finish();
|
||||
};
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -47,7 +47,7 @@ BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
// Major device class = 0x4, Audio/Video
|
||||
// Minor device class = 0x1, Wearable Headset device
|
||||
#define IS_HEADSET(cod) ((GET_MAJOR_SERVICE_CLASS(cod) == 0x4) && \
|
||||
#define IS_HEADSET(cod) ((GET_MAJOR_DEVICE_CLASS(cod) == 0x4) && \
|
||||
(GET_MINOR_DEVICE_CLASS(cod) == 0x1))
|
||||
|
||||
class BluetoothProfileManagerBase;
|
||||
|
@ -1257,7 +1257,13 @@ status_t GonkRecorder::setupVideoEncoder(
|
||||
|
||||
uint32_t encoder_flags = 0;
|
||||
if (mIsMetaDataStoredInVideoBuffers) {
|
||||
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 18
|
||||
encoder_flags |= OMXCodec::kStoreMetaDataInVideoBuffers;
|
||||
#else
|
||||
encoder_flags |= OMXCodec::kHardwareCodecsOnly;
|
||||
encoder_flags |= OMXCodec::kStoreMetaDataInVideoBuffers;
|
||||
encoder_flags |= OMXCodec::kOnlySubmitOneInputBufferAtOneTime;
|
||||
#endif
|
||||
}
|
||||
|
||||
sp<MediaSource> encoder = OMXCodec::Create(
|
||||
|
@ -321,6 +321,16 @@ MediaDevice::MediaDevice(MediaEngineVideoSource* aSource)
|
||||
mSource->GetName(mName);
|
||||
mSource->GetUUID(mID);
|
||||
|
||||
#ifdef MOZ_B2G_CAMERA
|
||||
if (mName.EqualsLiteral("back")) {
|
||||
mHasFacingMode = true;
|
||||
mFacingMode = dom::VideoFacingModeEnum::Environment;
|
||||
} else if (mName.EqualsLiteral("front")) {
|
||||
mHasFacingMode = true;
|
||||
mFacingMode = dom::VideoFacingModeEnum::User;
|
||||
}
|
||||
#endif // MOZ_B2G_CAMERA
|
||||
|
||||
// Kludge to test user-facing cameras on OSX.
|
||||
if (mName.Find(NS_LITERAL_STRING("Face")) != -1) {
|
||||
mHasFacingMode = true;
|
||||
|
@ -118,7 +118,7 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
|
||||
|
||||
bool newApzc = (apzc == nullptr);
|
||||
if (newApzc) {
|
||||
apzc = new AsyncPanZoomController(aLayersId, state->mController,
|
||||
apzc = new AsyncPanZoomController(aLayersId, this, state->mController,
|
||||
AsyncPanZoomController::USE_GESTURE_DETECTOR);
|
||||
apzc->SetCompositorParent(aCompositor);
|
||||
} else {
|
||||
@ -243,11 +243,20 @@ APZCTreeManager::ReceiveInputEvent(const InputData& aEvent)
|
||||
mApzcForInputBlock = RootAPZCForLayersId(mApzcForInputBlock);
|
||||
APZC_LOG("Using APZC %p as the root APZC for multi-touch\n", mApzcForInputBlock.get());
|
||||
}
|
||||
|
||||
// Cache transformToApzc so it can be used for future events in this block.
|
||||
if (mApzcForInputBlock) {
|
||||
GetInputTransforms(mApzcForInputBlock, transformToApzc, transformToScreen);
|
||||
mCachedTransformToApzcForInputBlock = transformToApzc;
|
||||
}
|
||||
} else if (mApzcForInputBlock) {
|
||||
APZC_LOG("Re-using APZC %p as continuation of event block\n", mApzcForInputBlock.get());
|
||||
}
|
||||
if (mApzcForInputBlock) {
|
||||
GetInputTransforms(mApzcForInputBlock, transformToApzc, transformToScreen);
|
||||
// Use the cached transform to compute the point to send to the APZC.
|
||||
// This ensures that the sequence of touch points an APZC sees in an
|
||||
// input block are all in the same coordinate space.
|
||||
transformToApzc = mCachedTransformToApzcForInputBlock;
|
||||
MultiTouchInput inputForApzc(multiTouchInput);
|
||||
for (size_t i = 0; i < inputForApzc.mTouches.Length(); i++) {
|
||||
ApplyTransform(&(inputForApzc.mTouches[i].mScreenPoint), transformToApzc);
|
||||
@ -314,16 +323,28 @@ APZCTreeManager::ReceiveInputEvent(const nsInputEvent& aEvent,
|
||||
mApzcForInputBlock = RootAPZCForLayersId(mApzcForInputBlock);
|
||||
APZC_LOG("Using APZC %p as the root APZC for multi-touch\n", mApzcForInputBlock.get());
|
||||
}
|
||||
if (mApzcForInputBlock) {
|
||||
// Cache transformToApzc so it can be used for future events in this block.
|
||||
GetInputTransforms(mApzcForInputBlock, transformToApzc, transformToScreen);
|
||||
mCachedTransformToApzcForInputBlock = transformToApzc;
|
||||
}
|
||||
} else if (mApzcForInputBlock) {
|
||||
APZC_LOG("Re-using APZC %p as continuation of event block\n", mApzcForInputBlock.get());
|
||||
}
|
||||
if (mApzcForInputBlock) {
|
||||
GetInputTransforms(mApzcForInputBlock, transformToApzc, transformToScreen);
|
||||
// For computing the input for the APZC, used the cached transform.
|
||||
// This ensures that the sequence of touch points an APZC sees in an
|
||||
// input block are all in the same coordinate space.
|
||||
transformToApzc = mCachedTransformToApzcForInputBlock;
|
||||
MultiTouchInput inputForApzc(touchEvent);
|
||||
for (size_t i = 0; i < inputForApzc.mTouches.Length(); i++) {
|
||||
ApplyTransform(&(inputForApzc.mTouches[i].mScreenPoint), transformToApzc);
|
||||
}
|
||||
|
||||
// For computing the event to pass back to Gecko, use the up-to-date transforms.
|
||||
// This ensures that transformToApzc and transformToScreen are in sync
|
||||
// (note that transformToScreen isn't cached).
|
||||
GetInputTransforms(mApzcForInputBlock, transformToApzc, transformToScreen);
|
||||
gfx3DMatrix outTransform = transformToApzc * transformToScreen;
|
||||
nsTouchEvent* outEvent = static_cast<nsTouchEvent*>(aOutEvent);
|
||||
for (size_t i = 0; i < outEvent->touches.Length(); i++) {
|
||||
@ -459,6 +480,29 @@ APZCTreeManager::ClearTree()
|
||||
mRootApzc = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
APZCTreeManager::HandleOverscroll(AsyncPanZoomController* aChild, ScreenPoint aStartPoint, ScreenPoint aEndPoint)
|
||||
{
|
||||
AsyncPanZoomController* parent = aChild->GetParent();
|
||||
if (parent == nullptr)
|
||||
return;
|
||||
|
||||
gfx3DMatrix transformToApzc;
|
||||
gfx3DMatrix transformToScreen; // ignored
|
||||
|
||||
// Convert start and end points to untransformed screen coordinates.
|
||||
GetInputTransforms(aChild, transformToApzc, transformToScreen);
|
||||
ApplyTransform(&aStartPoint, transformToApzc.Inverse());
|
||||
ApplyTransform(&aEndPoint, transformToApzc.Inverse());
|
||||
|
||||
// Convert start and end points to parent's transformed screen coordinates.
|
||||
GetInputTransforms(parent, transformToApzc, transformToScreen);
|
||||
ApplyTransform(&aStartPoint, transformToApzc);
|
||||
ApplyTransform(&aEndPoint, transformToApzc);
|
||||
|
||||
parent->AttemptScroll(aStartPoint, aEndPoint);
|
||||
}
|
||||
|
||||
already_AddRefed<AsyncPanZoomController>
|
||||
APZCTreeManager::GetTargetAPZC(const ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "FrameMetrics.h" // for FrameMetrics, etc
|
||||
#include "Units.h" // for CSSPoint, CSSRect, etc
|
||||
#include "gfxPoint.h" // for gfxPoint
|
||||
#include "gfx3DMatrix.h" // for gfx3DMatrix
|
||||
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
|
||||
#include "mozilla/Monitor.h" // for Monitor
|
||||
#include "nsAutoPtr.h" // for nsRefPtr
|
||||
@ -246,6 +247,18 @@ public:
|
||||
*/
|
||||
static float GetDPI() { return sDPI; }
|
||||
|
||||
/**
|
||||
* This is a callback for AsyncPanZoomController to call when a touch-move
|
||||
* event causes overscroll. The overscroll will be passed on to the parent
|
||||
* APZC. |aStartPoint| and |aEndPoint| are in |aAPZC|'s transformed screen
|
||||
* coordinates (i.e. the same coordinates in which touch points are given to
|
||||
* APZCs). The amount of the overscroll is represented by two points rather
|
||||
* than a displacement because with certain 3D transforms, the same
|
||||
* displacement between different points in transformed coordinates can
|
||||
* represent different displacements in untransformed coordinates.
|
||||
*/
|
||||
void HandleOverscroll(AsyncPanZoomController* aAPZC, ScreenPoint aStartPoint, ScreenPoint aEndPoint);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Debug-build assertion that can be called to ensure code is running on the
|
||||
@ -303,6 +316,14 @@ private:
|
||||
* input delivery thread, and so does not require locking.
|
||||
*/
|
||||
nsRefPtr<AsyncPanZoomController> mApzcForInputBlock;
|
||||
/* The transform from root screen coordinates into mApzcForInputBlock's
|
||||
* screen coordinates, as returned through the 'aTransformToApzcOut' parameter
|
||||
* of GetInputTransform(), at the start of the input block. This is cached
|
||||
* because this transform can change over the course of the input block,
|
||||
* but for some operations we need to use the initial tranform.
|
||||
* Meaningless if mApzcForInputBlock is nullptr.
|
||||
*/
|
||||
gfx3DMatrix mCachedTransformToApzcForInputBlock;
|
||||
|
||||
static float sDPI;
|
||||
};
|
||||
|
@ -55,6 +55,7 @@ CompositableHost::AddTextureHost(TextureHost* aTexture)
|
||||
RefPtr<TextureHost> second = mFirstTexture;
|
||||
mFirstTexture = aTexture;
|
||||
aTexture->SetNextSibling(second);
|
||||
aTexture->SetCompositableQuirks(GetCompositableQuirks());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -200,6 +200,7 @@ AsyncPanZoomController::InitializeGlobalState()
|
||||
}
|
||||
|
||||
AsyncPanZoomController::AsyncPanZoomController(uint64_t aLayersId,
|
||||
APZCTreeManager* aTreeManager,
|
||||
GeckoContentController* aGeckoContentController,
|
||||
GestureBehavior aGestures)
|
||||
: mLayersId(aLayersId),
|
||||
@ -221,7 +222,8 @@ AsyncPanZoomController::AsyncPanZoomController(uint64_t aLayersId,
|
||||
mAsyncScrollTimeoutTask(nullptr),
|
||||
mDisableNextTouchBatch(false),
|
||||
mHandlingTouchQueue(false),
|
||||
mDelayPanning(false)
|
||||
mDelayPanning(false),
|
||||
mTreeManager(aTreeManager)
|
||||
{
|
||||
MOZ_COUNT_CTOR(AsyncPanZoomController);
|
||||
|
||||
@ -262,6 +264,7 @@ AsyncPanZoomController::Destroy()
|
||||
mPrevSibling = nullptr;
|
||||
mLastChild = nullptr;
|
||||
mParent = nullptr;
|
||||
mTreeManager = nullptr;
|
||||
}
|
||||
|
||||
/* static */float
|
||||
@ -727,7 +730,49 @@ void AsyncPanZoomController::UpdateWithTouchAtDevicePoint(const MultiTouchInput&
|
||||
mY.UpdateWithTouchAtDevicePoint(point.y, timeDelta);
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::AttemptScroll(const ScreenPoint& aStartPoint,
|
||||
const ScreenPoint& aEndPoint) {
|
||||
// "start - end" rather than "end - start" because e.g. moving your finger
|
||||
// down (*positive* direction along y axis) causes the vertical scroll offset
|
||||
// to *decrease* as the page follows your finger.
|
||||
ScreenPoint displacement = aStartPoint - aEndPoint;
|
||||
|
||||
ScreenPoint overscroll; // will be used outside monitor block
|
||||
{
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
|
||||
CSSToScreenScale zoom = mFrameMetrics.mZoom;
|
||||
|
||||
// Inversely scale the offset by the resolution (when you're zoomed further in,
|
||||
// a larger swipe should move you a shorter distance).
|
||||
CSSPoint cssDisplacement = displacement / zoom;
|
||||
|
||||
CSSPoint cssOverscroll;
|
||||
gfx::Point scrollOffset(mX.AdjustDisplacement(cssDisplacement.x, cssOverscroll.x),
|
||||
mY.AdjustDisplacement(cssDisplacement.y, cssOverscroll.y));
|
||||
overscroll = cssOverscroll * zoom;
|
||||
|
||||
if (fabs(scrollOffset.x) > EPSILON || fabs(scrollOffset.y) > EPSILON) {
|
||||
ScrollBy(CSSPoint::FromUnknownPoint(scrollOffset));
|
||||
ScheduleComposite();
|
||||
|
||||
TimeDuration timePaintDelta = mPaintThrottler.TimeSinceLastRequest(GetFrameTime());
|
||||
if (timePaintDelta.ToMilliseconds() > gPanRepaintInterval) {
|
||||
RequestContentRepaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fabs(overscroll.x) > EPSILON || fabs(overscroll.y) > EPSILON) {
|
||||
// "+ overscroll" rather than "- overscroll" for the same reason as above.
|
||||
mTreeManager->HandleOverscroll(this, aEndPoint + overscroll, aEndPoint);
|
||||
}
|
||||
}
|
||||
|
||||
void AsyncPanZoomController::TrackTouch(const MultiTouchInput& aEvent) {
|
||||
SingleTouchData& touch = GetFirstSingleTouch(aEvent);
|
||||
ScreenIntPoint prevTouchPoint(mX.GetPos(), mY.GetPos());
|
||||
ScreenIntPoint touchPoint = touch.mScreenPoint;
|
||||
TimeDuration timeDelta = TimeDuration().FromMilliseconds(aEvent.mTime - mLastEventTime);
|
||||
|
||||
// Probably a duplicate event, just throw it away.
|
||||
@ -737,29 +782,7 @@ void AsyncPanZoomController::TrackTouch(const MultiTouchInput& aEvent) {
|
||||
|
||||
UpdateWithTouchAtDevicePoint(aEvent);
|
||||
|
||||
{
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
|
||||
// We want to inversely scale it because when you're zoomed further in, a
|
||||
// larger swipe should move you a shorter distance.
|
||||
ScreenToCSSScale inverseResolution = mFrameMetrics.mZoom.Inverse();
|
||||
|
||||
gfx::Point displacement(mX.GetDisplacementForDuration(inverseResolution.scale,
|
||||
timeDelta),
|
||||
mY.GetDisplacementForDuration(inverseResolution.scale,
|
||||
timeDelta));
|
||||
if (fabs(displacement.x) <= EPSILON && fabs(displacement.y) <= EPSILON) {
|
||||
return;
|
||||
}
|
||||
|
||||
ScrollBy(CSSPoint::FromUnknownPoint(displacement));
|
||||
ScheduleComposite();
|
||||
|
||||
TimeDuration timePaintDelta = mPaintThrottler.TimeSinceLastRequest(GetFrameTime());
|
||||
if (timePaintDelta.ToMilliseconds() > gPanRepaintInterval) {
|
||||
RequestContentRepaint();
|
||||
}
|
||||
}
|
||||
AttemptScroll(prevTouchPoint, touchPoint);
|
||||
}
|
||||
|
||||
SingleTouchData& AsyncPanZoomController::GetFirstSingleTouch(const MultiTouchInput& aEvent) {
|
||||
@ -784,13 +807,16 @@ bool AsyncPanZoomController::DoFling(const TimeDuration& aDelta) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// We want to inversely scale it because when you're zoomed further in, a
|
||||
// larger swipe should move you a shorter distance.
|
||||
ScreenToCSSScale inverseResolution = mFrameMetrics.mZoom.Inverse();
|
||||
CSSPoint overscroll; // overscroll is ignored for flings
|
||||
ScreenPoint offset(aDelta.ToMilliseconds() * mX.GetVelocity(),
|
||||
aDelta.ToMilliseconds() * mY.GetVelocity());
|
||||
|
||||
// Inversely scale the offset by the resolution (when you're zoomed further in,
|
||||
// a larger swipe should move you a shorter distance).
|
||||
CSSPoint cssOffset = offset / mFrameMetrics.mZoom;
|
||||
ScrollBy(CSSPoint::FromUnknownPoint(gfx::Point(
|
||||
mX.GetDisplacementForDuration(inverseResolution.scale, aDelta),
|
||||
mY.GetDisplacementForDuration(inverseResolution.scale, aDelta)
|
||||
mX.AdjustDisplacement(cssOffset.x, overscroll.x),
|
||||
mY.AdjustDisplacement(cssOffset.y, overscroll.y)
|
||||
)));
|
||||
TimeDuration timePaintDelta = mPaintThrottler.TimeSinceLastRequest(GetFrameTime());
|
||||
if (timePaintDelta.ToMilliseconds() > gFlingRepaintInterval) {
|
||||
|
@ -15,8 +15,8 @@
|
||||
#include "InputData.h"
|
||||
#include "Axis.h"
|
||||
#include "TaskThrottler.h"
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
#include "gfx3DMatrix.h"
|
||||
#include "nsEvent.h"
|
||||
|
||||
#include "base/message_loop.h"
|
||||
|
||||
@ -28,6 +28,7 @@ class CompositorParent;
|
||||
class GestureEventListener;
|
||||
class ContainerLayer;
|
||||
class ViewTransform;
|
||||
class APZCTreeManager;
|
||||
|
||||
/**
|
||||
* Controller for all panning and zooming logic. Any time a user input is
|
||||
@ -73,6 +74,7 @@ public:
|
||||
static float GetTouchStartTolerance();
|
||||
|
||||
AsyncPanZoomController(uint64_t aLayersId,
|
||||
APZCTreeManager* aTreeManager,
|
||||
GeckoContentController* aController,
|
||||
GestureBehavior aGestures = DEFAULT_GESTURES);
|
||||
~AsyncPanZoomController();
|
||||
@ -259,6 +261,17 @@ public:
|
||||
*/
|
||||
void CancelAnimation();
|
||||
|
||||
/**
|
||||
* Attempt to scroll in response to a touch-move from |aStartPoint| to
|
||||
* |aEndPoint|, which are in our (transformed) screen coordinates.
|
||||
* Due to overscroll handling, there may not actually have been a touch-move
|
||||
* at these points, but this function will scroll as if there had been.
|
||||
* If this attempt causes overscroll (i.e. the layer cannot be scrolled
|
||||
* by the entire amount requested), the overscroll is passed back to the
|
||||
* tree manager via APZCTreeManager::HandleOverscroll().
|
||||
*/
|
||||
void AttemptScroll(const ScreenPoint& aStartPoint, const ScreenPoint& aEndPoint);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Helper method for touches beginning. Sets everything up for panning and any
|
||||
@ -630,6 +643,13 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
// This is a raw pointer to avoid introducing a reference cycle between
|
||||
// AsyncPanZoomController and APZCTreeManager. Since these objects don't
|
||||
// live on the main thread, we can't use the cycle collector with them.
|
||||
// The APZCTreeManager owns the lifetime of the APZCs, so nulling this
|
||||
// pointer out in Destroy() will prevent accessing deleted memory.
|
||||
APZCTreeManager* mTreeManager;
|
||||
|
||||
nsRefPtr<AsyncPanZoomController> mLastChild;
|
||||
nsRefPtr<AsyncPanZoomController> mPrevSibling;
|
||||
nsRefPtr<AsyncPanZoomController> mParent;
|
||||
|
@ -135,13 +135,13 @@ void Axis::StartTouch(int32_t aPos) {
|
||||
mPos = aPos;
|
||||
}
|
||||
|
||||
float Axis::GetDisplacementForDuration(float aScale, const TimeDuration& aDelta) {
|
||||
float Axis::AdjustDisplacement(float aDisplacement, float& aOverscrollAmountOut) {
|
||||
if (fabsf(mVelocity) < gVelocityThreshold) {
|
||||
mAcceleration = 0;
|
||||
}
|
||||
|
||||
float accelerationFactor = GetAccelerationFactor();
|
||||
float displacement = mVelocity * aScale * aDelta.ToMilliseconds() * accelerationFactor;
|
||||
float displacement = aDisplacement * accelerationFactor;
|
||||
// If this displacement will cause an overscroll, throttle it. Can potentially
|
||||
// bring it to 0 even if the velocity is high.
|
||||
if (DisplacementWillOverscroll(displacement) != OVERSCROLL_NONE) {
|
||||
@ -149,7 +149,8 @@ float Axis::GetDisplacementForDuration(float aScale, const TimeDuration& aDelta)
|
||||
// anywhere, so we're just spinning needlessly.
|
||||
mVelocity = 0.0f;
|
||||
mAcceleration = 0;
|
||||
displacement -= DisplacementWillOverscrollAmount(displacement);
|
||||
aOverscrollAmountOut = DisplacementWillOverscrollAmount(displacement);
|
||||
displacement -= aOverscrollAmountOut;
|
||||
}
|
||||
return displacement;
|
||||
}
|
||||
|
@ -68,16 +68,14 @@ public:
|
||||
void CancelTouch();
|
||||
|
||||
/**
|
||||
* Gets displacement that should have happened since the previous touch.
|
||||
* Note: Does not reset the displacement. It gets recalculated on the next
|
||||
* UpdateWithTouchAtDevicePoint(), however it is not safe to assume this will
|
||||
* be the same on every call. This also checks for page boundaries and will
|
||||
* return an adjusted displacement to prevent the viewport from overscrolling
|
||||
* the page rect. An example of where this might matter is when you call it,
|
||||
* apply a displacement that takes you to the boundary of the page, then call
|
||||
* it again. The result will be different in this case.
|
||||
* Takes a requested displacement to the position of this axis, and adjusts
|
||||
* it to account for acceleration (which might increase the displacement)
|
||||
* and overscroll (which might decrease the displacement; this is to prevent
|
||||
* the viewport from overscrolling the page rect). If overscroll ocurred,
|
||||
* its amount is written to |aOverscrollAmountOut|.
|
||||
* The adjusted displacement is returned.
|
||||
*/
|
||||
float GetDisplacementForDuration(float aScale, const TimeDuration& aDelta);
|
||||
float AdjustDisplacement(float aDisplacement, float& aOverscrollAmountOut);
|
||||
|
||||
/**
|
||||
* Gets the distance between the starting position of the touch supplied in
|
||||
@ -170,6 +168,8 @@ public:
|
||||
float GetCompositionEnd();
|
||||
float GetPageEnd();
|
||||
|
||||
int32_t GetPos() const { return mPos; }
|
||||
|
||||
virtual float GetPointOffset(const CSSPoint& aPoint) = 0;
|
||||
virtual float GetRectLength(const CSSRect& aRect) = 0;
|
||||
virtual float GetRectOffset(const CSSRect& aRect) = 0;
|
||||
|
@ -243,7 +243,6 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
|
||||
// on gonk, create EGLImage if possible.
|
||||
// create EGLImage during buffer swap could reduce the graphic driver's task
|
||||
// during rendering.
|
||||
tex->SetCompositableQuirks(compositable->GetCompositableQuirks());
|
||||
compositable->AddTextureHost(tex);
|
||||
MOZ_ASSERT(compositable->GetTextureHost(op.textureID()) == tex.get());
|
||||
break;
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <math.h> // for fabsf
|
||||
#include <stddef.h> // for size_t
|
||||
#include "AsyncPanZoomController.h" // for AsyncPanZoomController
|
||||
#include "mozilla/layers/APZCTreeManager.h" // for APZCTreeManager
|
||||
#include "base/task.h" // for CancelableTask, etc
|
||||
#include "mozilla/Preferences.h" // for Preferences
|
||||
#include "mozilla/gfx/BasePoint.h" // for BasePoint
|
||||
|
@ -216,7 +216,6 @@ int64_t GrallocReporter::sAmount = 0;
|
||||
|
||||
GrallocBufferActor::GrallocBufferActor()
|
||||
: mAllocBytes(0)
|
||||
, mDeprecatedTextureHost(nullptr)
|
||||
{
|
||||
static bool registered;
|
||||
if (!registered) {
|
||||
@ -267,18 +266,27 @@ GrallocBufferActor::Create(const gfxIntSize& aSize,
|
||||
return actor;
|
||||
}
|
||||
|
||||
// used only for hacky fix in gecko 23 for bug 862324
|
||||
// used only for hacky fix for bug 862324
|
||||
void GrallocBufferActor::ActorDestroy(ActorDestroyReason)
|
||||
{
|
||||
if (mDeprecatedTextureHost) {
|
||||
mDeprecatedTextureHost->ForgetBuffer();
|
||||
for (size_t i = 0; i < mDeprecatedTextureHosts.Length(); i++) {
|
||||
mDeprecatedTextureHosts[i]->ForgetBuffer();
|
||||
}
|
||||
}
|
||||
|
||||
// used only for hacky fix in gecko 23 for bug 862324
|
||||
void GrallocBufferActor::SetDeprecatedTextureHost(DeprecatedTextureHost* aDeprecatedTextureHost)
|
||||
// used only for hacky fix for bug 862324
|
||||
void GrallocBufferActor::AddDeprecatedTextureHost(DeprecatedTextureHost* aDeprecatedTextureHost)
|
||||
{
|
||||
mDeprecatedTextureHost = aDeprecatedTextureHost;
|
||||
mDeprecatedTextureHosts.AppendElement(aDeprecatedTextureHost);
|
||||
}
|
||||
|
||||
// used only for hacky fix for bug 862324
|
||||
void GrallocBufferActor::RemoveDeprecatedTextureHost(DeprecatedTextureHost* aDeprecatedTextureHost)
|
||||
{
|
||||
mDeprecatedTextureHosts.RemoveElement(aDeprecatedTextureHost);
|
||||
// that should be the only occurence, otherwise we'd leak this TextureHost...
|
||||
// assert that that's not happening.
|
||||
MOZ_ASSERT(!mDeprecatedTextureHosts.Contains(aDeprecatedTextureHost));
|
||||
}
|
||||
|
||||
/*static*/ already_AddRefed<TextureImage>
|
||||
|
@ -87,7 +87,8 @@ public:
|
||||
|
||||
// used only for hacky fix in gecko 23 for bug 862324
|
||||
// see bug 865908 about fixing this.
|
||||
void SetDeprecatedTextureHost(DeprecatedTextureHost* aDeprecatedTextureHost);
|
||||
void AddDeprecatedTextureHost(DeprecatedTextureHost* aDeprecatedTextureHost);
|
||||
void RemoveDeprecatedTextureHost(DeprecatedTextureHost* aDeprecatedTextureHost);
|
||||
|
||||
android::GraphicBuffer* GetGraphicBuffer();
|
||||
|
||||
@ -104,7 +105,7 @@ private:
|
||||
|
||||
// used only for hacky fix in gecko 23 for bug 862324
|
||||
// see bug 865908 about fixing this.
|
||||
DeprecatedTextureHost* mDeprecatedTextureHost;
|
||||
nsAutoTArray<DeprecatedTextureHost*, 2> mDeprecatedTextureHosts;
|
||||
|
||||
friend class ISurfaceAllocator;
|
||||
};
|
||||
|
@ -117,8 +117,7 @@ void GrallocTextureSourceOGL::BindTexture(GLenum aTextureUnit)
|
||||
MOZ_ASSERT(gl());
|
||||
gl()->MakeCurrent();
|
||||
|
||||
mQuirks->SetCompositor(mCompositor);
|
||||
GLuint tex = static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
|
||||
GLuint tex = GetGLTexture();
|
||||
GLuint textureTarget = GetTextureTarget();
|
||||
|
||||
gl()->fActiveTexture(aTextureUnit);
|
||||
@ -179,8 +178,7 @@ GrallocTextureSourceOGL::SetCompositableQuirks(CompositableQuirks* aQuirks)
|
||||
DeallocateDeviceData();
|
||||
|
||||
gl()->MakeCurrent();
|
||||
mQuirks->SetCompositor(mCompositor);
|
||||
GLuint tex = static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
|
||||
GLuint tex = GetGLTexture();
|
||||
GLuint textureTarget = GetTextureTarget();
|
||||
|
||||
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
||||
@ -310,8 +308,7 @@ GrallocTextureSourceOGL::GetAsSurface() {
|
||||
MOZ_ASSERT(gl());
|
||||
gl()->MakeCurrent();
|
||||
|
||||
mQuirks->SetCompositor(mCompositor);
|
||||
GLuint tex = static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
|
||||
GLuint tex = GetGLTexture();
|
||||
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
||||
gl()->fBindTexture(GetTextureTarget(), tex);
|
||||
if (!mEGLImage) {
|
||||
@ -326,6 +323,13 @@ GrallocTextureSourceOGL::GetAsSurface() {
|
||||
return surf.forget();
|
||||
}
|
||||
|
||||
GLuint
|
||||
GrallocTextureSourceOGL::GetGLTexture()
|
||||
{
|
||||
mQuirks->SetCompositor(mCompositor);
|
||||
return static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
|
||||
}
|
||||
|
||||
void
|
||||
GrallocTextureHostOGL::SetCompositableQuirks(CompositableQuirks* aQuirks)
|
||||
{
|
||||
|
@ -62,6 +62,8 @@ public:
|
||||
|
||||
already_AddRefed<gfxImageSurface> GetAsSurface();
|
||||
|
||||
GLuint GetGLTexture();
|
||||
|
||||
protected:
|
||||
CompositorOGL* mCompositor;
|
||||
android::sp<android::GraphicBuffer> mGraphicBuffer;
|
||||
|
@ -172,10 +172,7 @@ CompositableQuirksGonkOGL::CompositableQuirksGonkOGL()
|
||||
}
|
||||
CompositableQuirksGonkOGL::~CompositableQuirksGonkOGL()
|
||||
{
|
||||
if (mTexture) {
|
||||
gl()->MakeCurrent();
|
||||
gl()->fDeleteTextures(1, &mTexture);
|
||||
}
|
||||
DeleteTextureIfPresent();
|
||||
}
|
||||
|
||||
gl::GLContext*
|
||||
@ -198,6 +195,15 @@ GLuint CompositableQuirksGonkOGL::GetTexture()
|
||||
return mTexture;
|
||||
}
|
||||
|
||||
void
|
||||
CompositableQuirksGonkOGL::DeleteTextureIfPresent()
|
||||
{
|
||||
if (mTexture) {
|
||||
gl()->MakeCurrent();
|
||||
gl()->fDeleteTextures(1, &mTexture);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
TextureImageTextureSourceOGL::Update(gfx::DataSourceSurface* aSurface,
|
||||
TextureFlags aFlags,
|
||||
@ -500,6 +506,19 @@ TextureImageDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
if (mQuirks) {
|
||||
// on gonk, this class is used as a fallback from gralloc buffer.
|
||||
// There is a case this class is used with GrallocDeprecatedTextureHostOGL
|
||||
// under same CompositableHost. if it happens, a gralloc buffer of
|
||||
// GrallocDeprecatedTextureHostOGL needs to be unbounded from a texture,
|
||||
// when the gralloc buffer is not rendered.
|
||||
// Establish the unbound by deleting the texture.
|
||||
// See Bug 916264.
|
||||
static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->DeleteTextureIfPresent();
|
||||
}
|
||||
#endif
|
||||
|
||||
AutoOpenSurface surf(OPEN_READ_ONLY, aImage);
|
||||
nsIntSize size = surf.Size();
|
||||
TextureImage::ImageFormat format = surf.ImageFormat();
|
||||
@ -1089,11 +1108,20 @@ GrallocDeprecatedTextureHostOGL::DeleteTextures()
|
||||
|
||||
// only used for hacky fix in gecko 23 for bug 862324
|
||||
static void
|
||||
RegisterDeprecatedTextureHostAtGrallocBufferActor(DeprecatedTextureHost* aDeprecatedTextureHost, const SurfaceDescriptor& aSurfaceDescriptor)
|
||||
AddDeprecatedTextureHostToGrallocBufferActor(DeprecatedTextureHost* aDeprecatedTextureHost, const SurfaceDescriptor* aSurfaceDescriptor)
|
||||
{
|
||||
if (IsSurfaceDescriptorValid(aSurfaceDescriptor)) {
|
||||
GrallocBufferActor* actor = static_cast<GrallocBufferActor*>(aSurfaceDescriptor.get_SurfaceDescriptorGralloc().bufferParent());
|
||||
actor->SetDeprecatedTextureHost(aDeprecatedTextureHost);
|
||||
if (aSurfaceDescriptor && IsSurfaceDescriptorValid(*aSurfaceDescriptor)) {
|
||||
GrallocBufferActor* actor = static_cast<GrallocBufferActor*>(aSurfaceDescriptor->get_SurfaceDescriptorGralloc().bufferParent());
|
||||
actor->AddDeprecatedTextureHost(aDeprecatedTextureHost);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
RemoveDeprecatedTextureHostFromGrallocBufferActor(DeprecatedTextureHost* aDeprecatedTextureHost, const SurfaceDescriptor* aSurfaceDescriptor)
|
||||
{
|
||||
if (aSurfaceDescriptor && IsSurfaceDescriptorValid(*aSurfaceDescriptor)) {
|
||||
GrallocBufferActor* actor = static_cast<GrallocBufferActor*>(aSurfaceDescriptor->get_SurfaceDescriptorGralloc().bufferParent());
|
||||
actor->RemoveDeprecatedTextureHost(aDeprecatedTextureHost);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1111,11 +1139,6 @@ GrallocDeprecatedTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImag
|
||||
{
|
||||
MOZ_ASSERT(aImage.type() == SurfaceDescriptor::TSurfaceDescriptorGralloc);
|
||||
|
||||
if (mBuffer) {
|
||||
// only done for hacky fix in gecko 23 for bug 862324.
|
||||
RegisterDeprecatedTextureHostAtGrallocBufferActor(nullptr, *mBuffer);
|
||||
}
|
||||
|
||||
const SurfaceDescriptorGralloc& desc = aImage.get_SurfaceDescriptorGralloc();
|
||||
mGraphicBuffer = GrallocBufferActor::GetFrom(desc);
|
||||
mIsRBSwapped = desc.isRBSwapped();
|
||||
@ -1123,11 +1146,10 @@ GrallocDeprecatedTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImag
|
||||
mIsRBSwapped);
|
||||
|
||||
mTextureTarget = TextureTargetForAndroidPixelFormat(mGraphicBuffer->getPixelFormat());
|
||||
mQuirks->SetCompositor(mCompositor);
|
||||
GLuint tex = static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
|
||||
GLuint tex = GetGLTexture();
|
||||
// delete old EGLImage
|
||||
DeleteTextures();
|
||||
#if 1
|
||||
|
||||
gl()->MakeCurrent();
|
||||
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
||||
gl()->fBindTexture(mTextureTarget, tex);
|
||||
@ -1136,7 +1158,6 @@ GrallocDeprecatedTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImag
|
||||
// during rendering.
|
||||
mEGLImage = gl()->CreateEGLImageForNativeBuffer(mGraphicBuffer->getNativeBuffer());
|
||||
gl()->fEGLImageTargetTexture2D(mTextureTarget, mEGLImage);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@ -1163,8 +1184,7 @@ void GrallocDeprecatedTextureHostOGL::BindTexture(GLenum aTextureUnit)
|
||||
MOZ_ASSERT(gl());
|
||||
gl()->MakeCurrent();
|
||||
|
||||
mQuirks->SetCompositor(mCompositor);
|
||||
GLuint tex = static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
|
||||
GLuint tex = GetGLTexture();
|
||||
|
||||
gl()->fActiveTexture(aTextureUnit);
|
||||
gl()->fBindTexture(mTextureTarget, tex);
|
||||
@ -1182,11 +1202,9 @@ GrallocDeprecatedTextureHostOGL::~GrallocDeprecatedTextureHostOGL()
|
||||
DeleteTextures();
|
||||
|
||||
// only done for hacky fix in gecko 23 for bug 862324.
|
||||
if (mBuffer) {
|
||||
// make sure that if the GrallocBufferActor survives us, it doesn't keep a dangling
|
||||
// pointer to us.
|
||||
RegisterDeprecatedTextureHostAtGrallocBufferActor(nullptr, *mBuffer);
|
||||
}
|
||||
// make sure that if the GrallocBufferActor survives us, it doesn't keep a dangling
|
||||
// pointer to us.
|
||||
RemoveDeprecatedTextureHostFromGrallocBufferActor(this, mBuffer);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1206,12 +1224,16 @@ void
|
||||
GrallocDeprecatedTextureHostOGL::SetBuffer(SurfaceDescriptor* aBuffer, ISurfaceAllocator* aAllocator)
|
||||
{
|
||||
MOZ_ASSERT(!mBuffer, "Will leak the old mBuffer");
|
||||
|
||||
if (aBuffer != mBuffer) {
|
||||
// only done for hacky fix in gecko 23 for bug 862324.
|
||||
// Doing this in SwapTextures is not enough, as the crash could occur right after SetBuffer.
|
||||
RemoveDeprecatedTextureHostFromGrallocBufferActor(this, mBuffer);
|
||||
AddDeprecatedTextureHostToGrallocBufferActor(this, aBuffer);
|
||||
}
|
||||
|
||||
mBuffer = aBuffer;
|
||||
mDeAllocator = aAllocator;
|
||||
|
||||
// only done for hacky fix in gecko 23 for bug 862324.
|
||||
// Doing this in SwapTextures is not enough, as the crash could occur right after SetBuffer.
|
||||
RegisterDeprecatedTextureHostAtGrallocBufferActor(this, *mBuffer);
|
||||
}
|
||||
|
||||
LayerRenderState
|
||||
@ -1243,6 +1265,14 @@ GrallocDeprecatedTextureHostOGL::GetRenderState()
|
||||
|
||||
return LayerRenderState();
|
||||
}
|
||||
|
||||
GLuint
|
||||
GrallocDeprecatedTextureHostOGL::GetGLTexture()
|
||||
{
|
||||
mQuirks->SetCompositor(mCompositor);
|
||||
return static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
|
||||
}
|
||||
|
||||
#endif // MOZ_WIDGET_GONK
|
||||
|
||||
already_AddRefed<gfxImageSurface>
|
||||
@ -1300,8 +1330,7 @@ already_AddRefed<gfxImageSurface>
|
||||
GrallocDeprecatedTextureHostOGL::GetAsSurface() {
|
||||
gl()->MakeCurrent();
|
||||
|
||||
mQuirks->SetCompositor(mCompositor);
|
||||
GLuint tex = static_cast<CompositableQuirksGonkOGL*>(mQuirks.get())->GetTexture();
|
||||
GLuint tex = GetGLTexture();
|
||||
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
||||
gl()->fBindTexture(mTextureTarget, tex);
|
||||
if (!mEGLImage) {
|
||||
|
@ -71,6 +71,7 @@ public:
|
||||
|
||||
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
|
||||
GLuint GetTexture();
|
||||
void DeleteTextureIfPresent();
|
||||
gl::GLContext* gl() const;
|
||||
protected:
|
||||
RefPtr<CompositorOGL> mCompositor;
|
||||
@ -920,6 +921,8 @@ public:
|
||||
|
||||
virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
|
||||
|
||||
GLuint GetGLTexture();
|
||||
|
||||
private:
|
||||
gl::GLContext* gl() const;
|
||||
|
||||
|
@ -45,8 +45,8 @@ class TestAPZCContainerLayer : public ContainerLayer {
|
||||
|
||||
class TestAsyncPanZoomController : public AsyncPanZoomController {
|
||||
public:
|
||||
TestAsyncPanZoomController(uint64_t aLayersId, MockContentController* mcc)
|
||||
: AsyncPanZoomController(aLayersId, mcc)
|
||||
TestAsyncPanZoomController(uint64_t aLayersId, MockContentController* aMcc)
|
||||
: AsyncPanZoomController(aLayersId, nullptr, aMcc)
|
||||
{}
|
||||
|
||||
void SetFrameMetrics(const FrameMetrics& metrics) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Extensions we recognize for DeviceStorage storage areas
|
||||
pictures=*.jpe; *.jpg; *.jpeg; *.gif; *.png; *.bmp;
|
||||
music=*.mp3; *.ogg; *.m4a; *.m4b; *.m4p; *.m4r; *.3gp; *.mp4; *.m3u; *.pls; *.opus; *.amr; *.wav; *.lcka;
|
||||
music=*.mp3; *.oga; *.ogg; *.m4a; *.m4b; *.m4p; *.m4r; *.3gp; *.mp4; *.m3u; *.pls; *.opus; *.amr; *.wav; *.lcka;
|
||||
videos=*.mp4; *.mpeg; *.mpg; *.ogv; *.ogx; *.webm; *.3gp; *.ogg; *.m4v;
|
||||
|
@ -40,6 +40,7 @@ using mozilla::unused;
|
||||
#include "LayerManagerOGL.h"
|
||||
#include "mozilla/layers/LayerManagerComposite.h"
|
||||
#include "mozilla/layers/AsyncCompositionManager.h"
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
#include "GLContext.h"
|
||||
#include "GLContextProvider.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user