Merge m-c to inbound.

This commit is contained in:
Ryan VanderMeulen 2013-08-13 16:56:11 -04:00
commit 5ba0b25a8d
47 changed files with 1140 additions and 915 deletions

View File

@ -382,6 +382,10 @@ let FormAssistant = {
break;
case "keydown":
if (!this.focusedElement) {
break;
}
// Don't monitor the text change resulting from key event.
this._ignoreEditActionOnce = true;
@ -393,6 +397,10 @@ let FormAssistant = {
break;
case "keyup":
if (!this.focusedElement) {
break;
}
this._ignoreEditActionOnce = false;
break;
}
@ -824,6 +832,10 @@ function getDocumentEncoder(element) {
// Get the visible content text of a content editable element
function getContentEditableText(element) {
if (!element) {
return null;
}
let doc = element.ownerDocument;
let range = doc.createRange();
range.selectNodeContents(element);

View File

@ -1,4 +1,4 @@
{
"revision": "a6b81f7d4b84287a2bdf0ce78df08fed9fd46bee",
"revision": "2b195ef19ed8cadd557ca185bae72c9ff836b264",
"repo_path": "/integration/gaia-central"
}

View File

@ -0,0 +1,36 @@
{
"config_version": 2,
"tooltool_manifest": "releng-helix.tt",
"mock_target": "mozilla-centos6-i386",
"mock_packages": ["ccache", "make", "bison", "flex", "gcc", "g++", "mpfr", "zlib-devel", "ncurses-devel", "zip", "autoconf213", "glibc-static", "perl-Digest-SHA", "wget", "alsa-lib", "atk", "cairo", "dbus-glib", "fontconfig", "freetype", "glib2", "gtk2", "libXRender", "libXt", "pango", "mozilla-python27-mercurial", "openssh-clients", "nss-devel", "java-1.6.0-openjdk-devel", "git"],
"mock_files": [["/home/cltbld/.ssh", "/home/mock_mozilla/.ssh"]],
"build_targets": [],
"upload_files": [
"{objdir}/dist/b2g-*.crashreporter-symbols.zip",
"{objdir}/dist/b2g-*.tar.gz",
"{workdir}/sources.xml"
],
"zip_files": [
["{workdir}/out/target/product/helix/*.img", "out/target/product/helix/"],
"{workdir}/flash.sh",
"{workdir}/load-config.sh",
"{workdir}/.config",
"{workdir}/sources.xml"
],
"env": {
"VARIANT": "user",
"MOZILLA_OFFICIAL": "1",
"B2GUPDATER": "1",
"ANDROIDFS_DIR": "{workdir}/helix-ics"
},
"b2g_manifest": "helix.xml",
"b2g_manifest_branch": "master",
"additional_source_tarballs": ["helix-ics.tar.xz"],
"gecko_l10n_root": "http://hg.mozilla.org/l10n-central",
"gaia": {
"l10n": {
"vcs": "hgtool",
"root": "http://hg.mozilla.org/gaia-l10n"
}
}
}

View File

@ -0,0 +1,14 @@
[
{
"size": 214609120,
"digest": "cbda63d37b8db104a0fddcb5d8ffe1da173922805863905cb82e819c80cf6032caffa49903cb74e8c703da35df876cc305a7d7b989a52c045e99845e20718f7e",
"algorithm": "sha512",
"filename": "helix-ics.tar.xz"
},
{
"size": 1570553,
"digest": "ea03de74df73b05e939c314cd15c54aac7b5488a407b7cc4f5f263f3049a1f69642c567dd35c43d0bc3f0d599d0385a26ab2dd947a6b18f9044e4918b382eea7",
"algorithm": "sha512",
"filename": "Adreno200-AU_LINUX_ANDROID_ICS_CHOCO_CS.04.00.03.06.001.zip"
}
]

View File

@ -2072,6 +2072,13 @@ nsFrameLoader::TryRemoteBrowser()
mRemoteBrowser->SetBrowserDOMWindow(browserDOMWin);
mContentParent = mRemoteBrowser->Manager();
if (mOwnerContent->AttrValueIs(kNameSpaceID_None,
nsGkAtoms::mozpasspointerevents,
nsGkAtoms::_true,
eCaseMatters)) {
unused << mRemoteBrowser->SendSetUpdateHitRegion(true);
}
}
return true;
}

View File

@ -80,7 +80,6 @@ MOCHITEST_FILES = \
test_bug659350.html \
test_bug662678.html \
test_bug667919-1.html \
test_bug667919-2.html \
test_bug667612.html \
empty.js \
test_bug689564.html \

View File

@ -24,7 +24,6 @@ window.addEventListener("deviceorientation", function(event) {
is(event.beta, 2.25);
is(event.gamma, 3.667);
is(event.absolute, true);
SimpleTest.finish();
}, true);
var event = DeviceOrientationEvent;
@ -33,7 +32,6 @@ ok(!!event, "Should have seen DeviceOrientationEvent!");
event = document.createEvent("DeviceOrientationEvent");
event.initDeviceOrientationEvent('deviceorientation', true, true, 1.5, 2.25, 3.667, true);
window.dispatchEvent(event);
SimpleTest.waitForExplicitFinish();
</script>
</pre>

View File

@ -1,41 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=615597
-->
<head>
<title>Test for Bug 615597</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=615597">Mozilla Bug 615597</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 615597 **/
window.ondeviceorientation = function(event) {
is(event.alpha, 1.5);
is(event.beta, 2.25);
is(event.gamma, 3.667);
is(event.absolute, true);
SimpleTest.finish();
};
var event = DeviceOrientationEvent;
ok(!!event, "Should have seen DeviceOrientationEvent!");
event = document.createEvent("DeviceOrientationEvent");
event.initDeviceOrientationEvent('deviceorientation', true, true, 1.5, 2.25, 3.667, true);
window.dispatchEvent(event);
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>

View File

@ -57,6 +57,7 @@ extern bool gBluetoothDebugFlag;
*/
#define BLUETOOTH_A2DP_STATUS_CHANGED_ID "bluetooth-a2dp-status-changed"
#define BLUETOOTH_HFP_STATUS_CHANGED_ID "bluetooth-hfp-status-changed"
#define BLUETOOTH_HID_STATUS_CHANGED_ID "bluetooth-hid-status-changed"
#define BLUETOOTH_SCO_STATUS_CHANGED_ID "bluetooth-sco-status-changed"
/**

View File

@ -0,0 +1,207 @@
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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/. */
#include "base/basictypes.h"
#include "BluetoothHidManager.h"
#include "BluetoothCommon.h"
#include "BluetoothService.h"
#include "BluetoothUtils.h"
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPtr.h"
#include "nsIObserverService.h"
using namespace mozilla;
USING_BLUETOOTH_NAMESPACE
namespace {
StaticRefPtr<BluetoothHidManager> sBluetoothHidManager;
bool sInShutdown = false;
} // anonymous namespace
NS_IMETHODIMP
BluetoothHidManager::Observe(nsISupports* aSubject,
const char* aTopic,
const PRUnichar* aData)
{
MOZ_ASSERT(sBluetoothHidManager);
if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
HandleShutdown();
return NS_OK;
}
MOZ_ASSERT(false, "BluetoothHidManager got unexpected topic!");
return NS_ERROR_UNEXPECTED;
}
BluetoothHidManager::BluetoothHidManager()
: mConnected(false)
{
}
bool
BluetoothHidManager::Init()
{
MOZ_ASSERT(NS_IsMainThread());
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
NS_ENSURE_TRUE(obs, false);
if (NS_FAILED(obs->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false))) {
BT_WARNING("Failed to add shutdown observer!");
return false;
}
return true;
}
BluetoothHidManager::~BluetoothHidManager()
{
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
NS_ENSURE_TRUE_VOID(obs);
if (NS_FAILED(obs->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID))) {
BT_WARNING("Failed to remove shutdown observer!");
}
}
//static
BluetoothHidManager*
BluetoothHidManager::Get()
{
MOZ_ASSERT(NS_IsMainThread());
// If we already exist, exit early
if (sBluetoothHidManager) {
return sBluetoothHidManager;
}
// If we're in shutdown, don't create a new instance
NS_ENSURE_FALSE(sInShutdown, nullptr);
// Create a new instance, register, and return
BluetoothHidManager* manager = new BluetoothHidManager();
NS_ENSURE_TRUE(manager->Init(), nullptr);
sBluetoothHidManager = manager;
return sBluetoothHidManager;
}
void
BluetoothHidManager::HandleShutdown()
{
MOZ_ASSERT(NS_IsMainThread());
sInShutdown = true;
Disconnect();
sBluetoothHidManager = nullptr;
}
bool
BluetoothHidManager::Connect(const nsAString& aDeviceAddress,
BluetoothReplyRunnable* aRunnable)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!aDeviceAddress.IsEmpty());
NS_ENSURE_FALSE(sInShutdown, false);
NS_ENSURE_FALSE(mConnected, false);
mDeviceAddress = aDeviceAddress;
BluetoothService* bs = BluetoothService::Get();
NS_ENSURE_TRUE(bs, false);
nsresult rv = bs->SendInputMessage(aDeviceAddress,
NS_LITERAL_STRING("Connect"),
aRunnable);
return NS_SUCCEEDED(rv);
}
void
BluetoothHidManager::Disconnect()
{
NS_ENSURE_TRUE_VOID(mConnected);
MOZ_ASSERT(!mDeviceAddress.IsEmpty());
BluetoothService* bs = BluetoothService::Get();
NS_ENSURE_TRUE_VOID(bs);
bs->SendInputMessage(mDeviceAddress,
NS_LITERAL_STRING("Disconnect"),
nullptr);
}
bool BluetoothHidManager::IsConnected()
{
return mConnected;
}
void BluetoothHidManager::HandleInputPropertyChanged(const BluetoothSignal& aSignal)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aSignal.value().type() == BluetoothValue::TArrayOfBluetoothNamedValue);
const InfallibleTArray<BluetoothNamedValue>& arr =
aSignal.value().get_ArrayOfBluetoothNamedValue();
MOZ_ASSERT(arr.Length() == 1);
const nsString& name = arr[0].name();
const BluetoothValue& value = arr[0].value();
if (name.EqualsLiteral("Connected")) {
MOZ_ASSERT(value.type() == BluetoothValue::Tbool);
MOZ_ASSERT(mConnected != value.get_bool());
mConnected = value.get_bool();
NotifyStatusChanged();
}
}
void
BluetoothHidManager::NotifyStatusChanged()
{
MOZ_ASSERT(NS_IsMainThread());
NS_NAMED_LITERAL_STRING(type, BLUETOOTH_HID_STATUS_CHANGED_ID);
InfallibleTArray<BluetoothNamedValue> parameters;
BluetoothValue v = mConnected;
parameters.AppendElement(
BluetoothNamedValue(NS_LITERAL_STRING("connected"), v));
v = mDeviceAddress;
parameters.AppendElement(
BluetoothNamedValue(NS_LITERAL_STRING("address"), v));
if (!BroadcastSystemMessage(type, parameters)) {
NS_WARNING("Failed to broadcast system message to settings");
return;
}
}
void
BluetoothHidManager::OnGetServiceChannel(const nsAString& aDeviceAddress,
const nsAString& aServiceUuid,
int aChannel)
{
// Do nothing here as bluez acquires service channel and connects for us
}
void
BluetoothHidManager::OnUpdateSdpRecords(const nsAString& aDeviceAddress)
{
// Do nothing here as bluez acquires service channel and connects for us
}
void
BluetoothHidManager::GetAddress(nsAString& aDeviceAddress)
{
aDeviceAddress = mDeviceAddress;
}
NS_IMPL_ISUPPORTS1(BluetoothHidManager, nsIObserver)

View File

@ -0,0 +1,53 @@
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* 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/. */
#ifndef mozilla_dom_bluetooth_bluetoothhidmanager_h__
#define mozilla_dom_bluetooth_bluetoothhidmanager_h__
#include "BluetoothCommon.h"
#include "BluetoothProfileManagerBase.h"
BEGIN_BLUETOOTH_NAMESPACE
class BluetoothReplyRunnable;
class BluetoothHidManager : public BluetoothProfileManagerBase
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
static BluetoothHidManager* Get();
~BluetoothHidManager();
virtual void OnGetServiceChannel(const nsAString& aDeviceAddress,
const nsAString& aServiceUuid,
int aChannel) MOZ_OVERRIDE;
virtual void OnUpdateSdpRecords(const nsAString& aDeviceAddress) MOZ_OVERRIDE;
virtual void GetAddress(nsAString& aDeviceAddress) MOZ_OVERRIDE;
virtual bool IsConnected() MOZ_OVERRIDE;
bool Connect(const nsAString& aDeviceAddress,
BluetoothReplyRunnable* aRunnable);
void Disconnect();
void HandleInputPropertyChanged(const BluetoothSignal& aSignal);
private:
BluetoothHidManager();
bool Init();
void Cleanup();
void HandleShutdown();
void NotifyStatusChanged();
// data member
bool mConnected;
nsString mDeviceAddress;
};
END_BLUETOOTH_NAMESPACE
#endif //#ifndef mozilla_dom_bluetooth_bluetoothhidmanager_h__

View File

@ -294,6 +294,11 @@ public:
SendSinkMessage(const nsAString& aDeviceAddresses,
const nsAString& aMessage) = 0;
virtual nsresult
SendInputMessage(const nsAString& aDeviceAddresses,
const nsAString& aMessage,
BluetoothReplyRunnable* aRunnable) = 0;
bool
IsEnabled() const
{

View File

@ -26,7 +26,8 @@ enum BluetoothServiceClass
HEADSET_AG = 0x1112,
HANDSFREE = 0x111E,
HANDSFREE_AG = 0x111F,
OBJECT_PUSH = 0x1105
OBJECT_PUSH = 0x1105,
HID = 0x1124,
};
class BluetoothUuidHelper

View File

@ -415,6 +415,14 @@ BluetoothServiceChildProcess::SendSinkMessage(const nsAString& aDeviceAddresses,
MOZ_CRASH("This should never be called!");
}
nsresult
BluetoothServiceChildProcess::SendInputMessage(const nsAString& aDeviceAddresses,
const nsAString& aMessage,
BluetoothReplyRunnable* aRunnable)
{
MOZ_CRASH("This should never be called!");
}
void
BluetoothServiceChildProcess::UpdatePlayStatus(uint32_t aDuration,
uint32_t aPosition,

View File

@ -176,6 +176,11 @@ public:
SendSinkMessage(const nsAString& aDeviceAddresses,
const nsAString& aMessage) MOZ_OVERRIDE;
virtual nsresult
SendInputMessage(const nsAString& aDeviceAddresses,
const nsAString& aMessage,
BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
protected:
BluetoothServiceChildProcess();
virtual ~BluetoothServiceChildProcess();

View File

@ -20,6 +20,7 @@
#include "BluetoothDBusService.h"
#include "BluetoothA2dpManager.h"
#include "BluetoothHfpManager.h"
#include "BluetoothHidManager.h"
#include "BluetoothOppManager.h"
#include "BluetoothReplyRunnable.h"
#include "BluetoothUnixSocketConnector.h"
@ -69,6 +70,7 @@ USING_BLUETOOTH_NAMESPACE
#define DBUS_AGENT_IFACE BLUEZ_DBUS_BASE_IFC ".Agent"
#define DBUS_SINK_IFACE BLUEZ_DBUS_BASE_IFC ".AudioSink"
#define DBUS_CTL_IFACE BLUEZ_DBUS_BASE_IFC ".Control"
#define DBUS_INPUT_IFACE BLUEZ_DBUS_BASE_IFC ".Input"
#define BLUEZ_DBUS_BASE_PATH "/org/bluez"
#define BLUEZ_DBUS_BASE_IFC "org.bluez"
#define BLUEZ_ERROR_IFC "org.bluez.Error"
@ -139,6 +141,10 @@ static Properties sControlProperties[] = {
{"Connected", DBUS_TYPE_BOOLEAN}
};
static Properties sInputProperties[] = {
{"Connected", DBUS_TYPE_BOOLEAN}
};
static const char* sBluetoothDBusIfaces[] =
{
DBUS_MANAGER_IFACE,
@ -175,7 +181,6 @@ static Monitor sStopBluetoothMonitor("BluetoothService.sStopBluetoothMonitor");
typedef void (*UnpackFunc)(DBusMessage*, DBusError*, BluetoothValue&, nsAString&);
typedef bool (*FilterFunc)(const BluetoothValue&);
typedef void (*SinkCallback)(DBusMessage*, void*);
static bool
GetConnectedDevicesFilter(const BluetoothValue& aValue)
@ -290,6 +295,35 @@ private:
BluetoothSignal mSignal;
};
class InputPropertyChangedHandler : public nsRunnable
{
public:
InputPropertyChangedHandler(const BluetoothSignal& aSignal)
: mSignal(aSignal)
{
}
NS_IMETHOD
Run()
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mSignal.name().EqualsLiteral("PropertyChanged"));
MOZ_ASSERT(mSignal.value().type() == BluetoothValue::TArrayOfBluetoothNamedValue);
// Replace object path with device address
nsString address = GetAddressFromObjectPath(mSignal.path());
mSignal.path() = address;
BluetoothHidManager* hid = BluetoothHidManager::Get();
NS_ENSURE_TRUE(hid, NS_ERROR_FAILURE);
hid->HandleInputPropertyChanged(mSignal);
return NS_OK;
}
private:
BluetoothSignal mSignal;
};
static bool
IsDBusMessageError(DBusMessage* aMsg, DBusError* aErr, nsAString& aErrorStr)
{
@ -489,6 +523,15 @@ CheckForError(DBusMessage* aMsg, void *aParam, const nsAString& aError)
}
#endif
static void
InputDisconnectCallback(DBusMessage* aMsg, void* aParam)
{
#ifdef DEBUG
NS_NAMED_LITERAL_STRING(errorStr, "Failed to disconnect input device");
CheckForError(aMsg, aParam, errorStr);
#endif
}
static void
SinkConnectCallback(DBusMessage* aMsg, void* aParam)
{
@ -503,7 +546,7 @@ SinkDisconnectCallback(DBusMessage* aMsg, void* aParam)
{
#ifdef DEBUG
NS_NAMED_LITERAL_STRING(errorStr, "Failed to disconnect sink");
CheckForError(false, aMsg, errorStr);
CheckForError(aMsg, aParam, errorStr);
#endif
}
@ -1558,6 +1601,13 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData)
errorStr,
sControlProperties,
ArrayLength(sControlProperties));
} else if (dbus_message_is_signal(aMsg, DBUS_INPUT_IFACE,
"PropertyChanged")) {
ParsePropertyChange(aMsg,
v,
errorStr,
sInputProperties,
ArrayLength(sInputProperties));
} else {
errorStr = NS_ConvertUTF8toUTF16(dbus_message_get_member(aMsg));
errorStr.AppendLiteral(" Signal not handled!");
@ -1574,6 +1624,8 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData)
task = new SinkPropertyChangedHandler(signal);
} else if (signalInterface.EqualsLiteral(DBUS_CTL_IFACE)) {
task = new ControlPropertyChangedHandler(signal);
} else if (signalInterface.EqualsLiteral(DBUS_INPUT_IFACE)) {
task = new InputPropertyChangedHandler(signal);
} else {
task = new DistributeBluetoothSignalTask(signal);
}
@ -1882,6 +1934,43 @@ BluetoothDBusService::SendDiscoveryMessage(const char* aMessageName,
return NS_OK;
}
nsresult
BluetoothDBusService::SendInputMessage(const nsAString& aDeviceAddress,
const nsAString& aMessage,
BluetoothReplyRunnable* aRunnable)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mConnection);
MOZ_ASSERT(aMessage.EqualsLiteral("Connect") ||
aMessage.EqualsLiteral("Disconnect"));
NS_ENSURE_TRUE(IsReady(), NS_ERROR_FAILURE);
DBusCallback callback;
if (aMessage.EqualsLiteral("Connect")) {
callback = GetVoidCallback;
} else if (aMessage.EqualsLiteral("Disconnect")) {
callback = InputDisconnectCallback;
}
nsRefPtr<BluetoothReplyRunnable> runnable(aRunnable);
nsString objectPath = GetObjectPathFromAddress(sAdapterPath, aDeviceAddress);
bool ret = dbus_func_args_async(mConnection,
-1,
callback,
static_cast<void*>(runnable.get()),
NS_ConvertUTF16toUTF8(objectPath).get(),
DBUS_INPUT_IFACE,
NS_ConvertUTF16toUTF8(aMessage).get(),
DBUS_TYPE_INVALID);
NS_ENSURE_TRUE(ret, NS_ERROR_FAILURE);
runnable.forget();
return NS_OK;
}
nsresult
BluetoothDBusService::SendSinkMessage(const nsAString& aDeviceAddress,
const nsAString& aMessage)
@ -1890,7 +1979,7 @@ BluetoothDBusService::SendSinkMessage(const nsAString& aDeviceAddress,
MOZ_ASSERT(mConnection);
MOZ_ASSERT(IsEnabled());
SinkCallback callback;
DBusCallback callback;
if (aMessage.EqualsLiteral("Connect")) {
callback = SinkConnectCallback;
} else if (aMessage.EqualsLiteral("Disconnect")) {
@ -1909,8 +1998,8 @@ BluetoothDBusService::SendSinkMessage(const nsAString& aDeviceAddress,
DBUS_SINK_IFACE,
NS_ConvertUTF16toUTF8(aMessage).get(),
DBUS_TYPE_INVALID);
NS_ENSURE_TRUE(ret, NS_ERROR_FAILURE);
return NS_OK;
}
@ -2022,6 +2111,8 @@ BluetoothDBusService::GetConnectedDevicePropertiesInternal(uint16_t aProfileId,
if (aProfileId == BluetoothServiceClass::HANDSFREE ||
aProfileId == BluetoothServiceClass::HEADSET) {
profile = BluetoothHfpManager::Get();
} else if (aProfileId == BluetoothServiceClass::HID) {
profile = BluetoothHidManager::Get();
} else if (aProfileId == BluetoothServiceClass::OBJECT_PUSH) {
profile = BluetoothOppManager::Get();
} else {
@ -2489,6 +2580,9 @@ BluetoothDBusService::Connect(const nsAString& aDeviceAddress,
} else if (aProfileId == BluetoothServiceClass::HEADSET) {
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
hfp->Connect(aDeviceAddress, false, aRunnable);
} else if (aProfileId == BluetoothServiceClass::HID) {
BluetoothHidManager* hid = BluetoothHidManager::Get();
hid->Connect(aDeviceAddress, aRunnable);
} else if (aProfileId == BluetoothServiceClass::OBJECT_PUSH) {
BluetoothOppManager* opp = BluetoothOppManager::Get();
opp->Connect(aDeviceAddress, aRunnable);
@ -2508,6 +2602,9 @@ BluetoothDBusService::Disconnect(const uint16_t aProfileId,
aProfileId == BluetoothServiceClass::HEADSET) {
BluetoothHfpManager* hfp = BluetoothHfpManager::Get();
hfp->Disconnect();
} else if (aProfileId == BluetoothServiceClass::HID) {
BluetoothHidManager* hid = BluetoothHidManager::Get();
hid->Disconnect();
} else if (aProfileId == BluetoothServiceClass::OBJECT_PUSH) {
BluetoothOppManager* opp = BluetoothOppManager::Get();
opp->Disconnect();
@ -2531,6 +2628,8 @@ BluetoothDBusService::IsConnected(const uint16_t aProfileId)
if (aProfileId == BluetoothServiceClass::HANDSFREE ||
aProfileId == BluetoothServiceClass::HEADSET) {
profile = BluetoothHfpManager::Get();
} else if (aProfileId == BluetoothServiceClass::HID) {
profile = BluetoothHidManager::Get();
} else if (aProfileId == BluetoothServiceClass::OBJECT_PUSH) {
profile = BluetoothOppManager::Get();
} else {

View File

@ -162,6 +162,11 @@ public:
SendSinkMessage(const nsAString& aDeviceAddresses,
const nsAString& aMessage) MOZ_OVERRIDE;
virtual nsresult
SendInputMessage(const nsAString& aDeviceAddresses,
const nsAString& aMessage,
BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
private:
/**
* For DBus Control method of "UpdateNotification", event id should be

View File

@ -37,6 +37,7 @@ if CONFIG['MOZ_B2G_BT']:
'BluetoothUnixSocketConnector.cpp',
'BluetoothA2dpManager.cpp',
'BluetoothHfpManager.cpp',
'BluetoothHidManager.cpp',
'BluetoothOppManager.cpp',
'ObexBase.cpp',
'BluetoothUuid.cpp',

View File

@ -24,8 +24,6 @@ EXPORTS += [
'CameraPreviewMediaStream.h',
'DOMCameraManager.h',
'GonkCameraControl.h',
'GonkNativeWindow.h',
'GonkNativeWindowClient.h',
]
CPP_SOURCES += [
@ -43,20 +41,11 @@ if CONFIG['MOZ_B2G_CAMERA']:
'GonkCameraManager.cpp',
'GonkCameraControl.cpp',
'GonkCameraHwMgr.cpp',
'GonkNativeWindow.cpp',
'GonkNativeWindowClient.cpp',
'GonkRecorder.cpp',
'GonkCameraSource.cpp',
'AudioParameter.cpp',
'GonkRecorderProfiles.cpp',
]
elif CONFIG['MOZ_OMX_DECODER']:
CPP_SOURCES += [
'FallbackCameraManager.cpp',
'FallbackCameraControl.cpp',
'GonkNativeWindow.cpp',
'GonkNativeWindowClient.cpp',
]
else:
CPP_SOURCES += [
'FallbackCameraManager.cpp',

View File

@ -405,6 +405,13 @@ child:
*/
Destroy();
/**
* Tell the child side if it has to update it's touchable region
* to the parent.
*/
SetUpdateHitRegion(bool aEnabled);
/*
* FIXME: write protocol!

View File

@ -294,6 +294,7 @@ TabChild::TabChild(ContentChild* aManager, const TabContext& aContext, uint32_t
, mContentDocumentIsDisplayed(false)
, mTriedBrowserInit(false)
, mOrientation(eScreenOrientation_PortraitPrimary)
, mUpdateHitRegion(false)
{
printf("creating %d!\n", NS_IsMainThread());
}
@ -2142,6 +2143,13 @@ TabChild::RecvDestroy()
return Send__delete__(this);
}
bool
TabChild::RecvSetUpdateHitRegion(const bool& aEnabled)
{
mUpdateHitRegion = aEnabled;
return true;
}
PRenderFrameChild*
TabChild::AllocPRenderFrameChild(ScrollingBehavior* aScrolling,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
@ -2353,6 +2361,12 @@ TabChild::MakeHidden()
}
}
void
TabChild::UpdateHitRegion(const nsRegion& aRegion)
{
mRemoteFrame->SendUpdateHitRegion(aRegion);
}
NS_IMETHODIMP
TabChild::GetMessageManager(nsIContentFrameMessageManager** aResult)
{

View File

@ -340,12 +340,17 @@ public:
ContentChild* Manager() { return mManager; }
bool GetUpdateHitRegion() { return mUpdateHitRegion; }
void UpdateHitRegion(const nsRegion& aRegion);
protected:
virtual PRenderFrameChild* AllocPRenderFrameChild(ScrollingBehavior* aScrolling,
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint64_t* aLayersId) MOZ_OVERRIDE;
virtual bool DeallocPRenderFrameChild(PRenderFrameChild* aFrame) MOZ_OVERRIDE;
virtual bool RecvDestroy() MOZ_OVERRIDE;
virtual bool RecvSetUpdateHitRegion(const bool& aEnabled) MOZ_OVERRIDE;
nsEventStatus DispatchWidgetEvent(nsGUIEvent& event);
@ -471,6 +476,7 @@ private:
bool mContentDocumentIsDisplayed;
bool mTriedBrowserInit;
ScreenOrientation mOrientation;
bool mUpdateHitRegion;
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
};

View File

@ -49,6 +49,9 @@ this.SystemMessagePermissionsTable = {
"bluetooth-hfp-status-changed": {
"bluetooth": []
},
"bluetooth-hid-status-changed": {
"bluetooth": []
},
"bluetooth-sco-status-changed": {
"bluetooth": []
},

View File

@ -82,10 +82,8 @@ const RIL_IPC_MSG_NAMES = [
"RIL:CardLockResult",
"RIL:CardLockRetryCount",
"RIL:USSDReceived",
"RIL:SendMMI:Return:OK",
"RIL:SendMMI:Return:KO",
"RIL:CancelMMI:Return:OK",
"RIL:CancelMMI:Return:KO",
"RIL:SendMMI",
"RIL:CancelMMI",
"RIL:StkCommand",
"RIL:StkSessionEnd",
"RIL:DataError",
@ -1521,10 +1519,8 @@ RILContentHelper.prototype = {
[data.message, data.sessionEnded]);
break;
}
case "RIL:SendMMI:Return:OK":
case "RIL:CancelMMI:Return:OK":
case "RIL:SendMMI:Return:KO":
case "RIL:CancelMMI:Return:KO":
case "RIL:SendMMI":
case "RIL:CancelMMI":
this.handleSendCancelMMI(msg.json);
break;
case "RIL:StkCommand":

File diff suppressed because it is too large Load Diff

View File

@ -28,6 +28,7 @@
#include "mozilla/ipc/Netd.h"
#include "AutoMounter.h"
#include "TimeZoneSettingObserver.h"
#include "AudioManager.h"
#endif
#include "mozilla/ipc/Ril.h"
#include "nsIObserverService.h"
@ -347,6 +348,8 @@ SystemWorkerManager::Init()
InitializeTimeZoneSettingObserver();
rv = InitNetd(cx);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAudioManager> audioManager =
do_GetService(NS_AUDIOMANAGER_CONTRACTID);
#endif
nsCOMPtr<nsIObserverService> obs =

View File

@ -1383,9 +1383,9 @@ let RIL = {
*/
readICCContacts: function readICCContacts(options) {
if (!this.appType) {
options.rilMessageType = "icccontacts";
options.errorMsg = GECKO_ERROR_REQUEST_NOT_SUPPORTED;
this.sendChromeMessage(options);
return;
}
ICCContactHelper.readICCContacts(
@ -1393,12 +1393,10 @@ let RIL = {
options.contactType,
function onsuccess(contacts) {
// Reuse 'options' to get 'requestId' and 'contactType'.
options.rilMessageType = "icccontacts";
options.contacts = contacts;
RIL.sendChromeMessage(options);
}.bind(this),
function onerror(errorMsg) {
options.rilMessageType = "icccontacts";
options.errorMsg = errorMsg;
RIL.sendChromeMessage(options);
}.bind(this));
@ -1415,12 +1413,10 @@ let RIL = {
updateICCContact: function updateICCContact(options) {
let onsuccess = function onsuccess() {
// Reuse 'options' to get 'requestId' and 'contactType'.
options.rilMessageType = "icccontactupdate";
RIL.sendChromeMessage(options);
}.bind(this);
let onerror = function onerror(errorMsg) {
options.rilMessageType = "icccontactupdate";
options.errorMsg = errorMsg;
RIL.sendChromeMessage(options);
}.bind(this);
@ -2076,12 +2072,16 @@ let RIL = {
try {
let str = options.searchListStr;
this.cellBroadcastConfigs.MMI = this._convertCellBroadcastSearchList(str);
options.success = true;
} catch (e) {
if (DEBUG) {
debug("Invalid Cell Broadcast search list: " + e);
}
options.rilRequestError = ERROR_GENERIC_FAILURE;
this.sendChromeMessage(options);
options.success = false;
}
this.sendChromeMessage(options);
if (!options.success) {
return;
}
@ -2420,7 +2420,6 @@ let RIL = {
let _sendMMIError = (function _sendMMIError(errorMsg, mmiServiceCode) {
options.success = false;
options.rilMessageType = "sendMMI";
options.errorMsg = errorMsg;
if (mmiServiceCode) {
options.mmiServiceCode = mmiServiceCode;
@ -2484,8 +2483,6 @@ let RIL = {
debug("MMI " + JSON.stringify(mmi));
}
options.rilMessageType = "sendMMI";
// We check if the MMI service code is supported and in that case we
// trigger the appropriate RIL request if possible.
let sc = mmi.serviceCode;
@ -2514,8 +2511,7 @@ let RIL = {
return;
}
options.rilMessageType = "setCallForward";
options.isSendMMI = true;
options.isSetCallForward = true;
options.timeSeconds = mmi.sic;
this.setCallForward(options);
return;
@ -2592,7 +2588,7 @@ let RIL = {
case MMI_SC_IMEI:
// A device's IMEI can't change, so we only need to request it once.
if (this.IMEI == null) {
this.getIMEI({mmi: true});
this.getIMEI(options);
return;
}
// If we already had the device's IMEI, we just send it to chrome.
@ -2634,8 +2630,7 @@ let RIL = {
_sendMMIError(MMI_ERROR_KS_NOT_SUPPORTED, MMI_KS_SC_CLIR);
return;
}
options.rilMessageType = "setCLIR";
options.isSendMMI = true;
options.isSetCLIR = true;
this.setCLIR(options);
return;
@ -2656,7 +2651,8 @@ let RIL = {
if (mmi.procedure === MMI_PROCEDURE_INTERROGATION) {
this.queryICCFacilityLock(options);
return;
} else if (mmi.procedure === MMI_PROCEDURE_ACTIVATION) {
}
if (mmi.procedure === MMI_PROCEDURE_ACTIVATION) {
options.enabled = 1;
} else if (mmi.procedure === MMI_PROCEDURE_DEACTIVATION) {
options.enabled = 0;
@ -2725,7 +2721,7 @@ let RIL = {
Buf.newParcel(REQUEST_QUERY_CALL_FORWARD_STATUS, options);
Buf.writeUint32(CALL_FORWARD_ACTION_QUERY_STATUS);
Buf.writeUint32(options.reason);
Buf.writeUint32(options.serviceClass);
Buf.writeUint32(options.serviceClass || ICC_SERVICE_CLASS_NONE);
Buf.writeUint32(this._toaFromString(options.number));
Buf.writeString(options.number);
Buf.writeUint32(0);
@ -2795,7 +2791,7 @@ let RIL = {
* Does use have confirmed the call requested from ICC?
*/
stkHandleCallSetup: function stkHandleCallSetup(options) {
Buf.newParcel(REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM, options);
Buf.newParcel(REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM);
Buf.writeUint32(1);
Buf.writeUint32(options.hasConfirmed ? 1 : 0);
Buf.sendParcel();
@ -4375,8 +4371,8 @@ let RIL = {
? GECKO_SMS_DELIVERY_STATUS_SUCCESS
: GECKO_SMS_DELIVERY_STATUS_ERROR;
this.sendChromeMessage({
rilMessageType: "sms-delivery",
envelopeId: options.envelopeId,
rilMessageType: options.rilMessageType,
rilMessageToken: options.rilMessageToken,
deliveryStatus: deliveryStatus
});
@ -4492,8 +4488,8 @@ let RIL = {
// Fall through.
default:
this.sendChromeMessage({
rilMessageType: "sms-send-failed",
envelopeId: options.envelopeId,
rilMessageType: options.rilMessageType,
rilMessageToken: options.rilMessageToken,
errorMsg: options.rilRequestError,
});
break;
@ -4517,8 +4513,8 @@ let RIL = {
}
this.sendChromeMessage({
rilMessageType: "sms-sent",
envelopeId: options.envelopeId,
rilMessageType: options.rilMessageType,
rilMessageToken: options.rilMessageToken,
});
}
},
@ -5403,8 +5399,7 @@ RIL[REQUEST_SET_CLIR] = function REQUEST_SET_CLIR(length, options) {
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
}
if (options.success && options.isSendMMI) {
} else if (options.rilMessageType === "sendMMI") {
switch (options.procedure) {
case MMI_PROCEDURE_ACTIVATION:
options.statusMessage = MMI_SM_KS_SERVICE_ENABLED;
@ -5462,8 +5457,7 @@ RIL[REQUEST_SET_CALL_FORWARD] =
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
}
if (options.success && options.isSendMMI) {
} else if (options.rilMessageType === "sendMMI") {
switch (options.action) {
case CALL_FORWARD_ACTION_ENABLE:
options.statusMessage = MMI_SM_KS_SERVICE_ENABLED;
@ -5506,12 +5500,10 @@ RIL[REQUEST_SMS_ACKNOWLEDGE] = null;
RIL[REQUEST_GET_IMEI] = function REQUEST_GET_IMEI(length, options) {
this.IMEI = Buf.readString();
// So far we only send the IMEI back to chrome if it was requested via MMI.
if (!options.mmi) {
if (options.rilMessageType !== "sendMMI") {
return;
}
options.mmiServiceCode = MMI_KS_SC_IMEI;
options.rilMessageType = "sendMMI";
options.success = (options.rilRequestError === 0);
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
if ((!options.success || this.IMEI == null) && !options.errorMsg) {
@ -5667,8 +5659,6 @@ RIL[REQUEST_QUERY_NETWORK_SELECTION_MODE] = function REQUEST_QUERY_NETWORK_SELEC
RIL[REQUEST_SET_NETWORK_SELECTION_AUTOMATIC] = function REQUEST_SET_NETWORK_SELECTION_AUTOMATIC(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
return;
}
this.sendChromeMessage(options);
@ -5676,8 +5666,6 @@ RIL[REQUEST_SET_NETWORK_SELECTION_AUTOMATIC] = function REQUEST_SET_NETWORK_SELE
RIL[REQUEST_SET_NETWORK_SELECTION_MANUAL] = function REQUEST_SET_NETWORK_SELECTION_MANUAL(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
return;
}
this.sendChromeMessage(options);
@ -5685,11 +5673,9 @@ RIL[REQUEST_SET_NETWORK_SELECTION_MANUAL] = function REQUEST_SET_NETWORK_SELECTI
RIL[REQUEST_QUERY_AVAILABLE_NETWORKS] = function REQUEST_QUERY_AVAILABLE_NETWORKS(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
return;
} else {
options.networks = this._processNetworks();
}
options.networks = this._processNetworks();
this.sendChromeMessage(options);
};
RIL[REQUEST_DTMF_START] = null;
@ -5857,11 +5843,8 @@ RIL[REQUEST_SET_PREFERRED_NETWORK_TYPE] = function REQUEST_SET_PREFERRED_NETWORK
return;
}
this.sendChromeMessage({
rilMessageType: "setPreferredNetworkType",
networkType: options.networkType,
success: options.rilRequestError == ERROR_SUCCESS
});
options.success = (options.rilRequestError == ERROR_SUCCESS);
this.sendChromeMessage(options);
};
RIL[REQUEST_GET_PREFERRED_NETWORK_TYPE] = function REQUEST_GET_PREFERRED_NETWORK_TYPE(length, options) {
let networkType;
@ -5885,21 +5868,16 @@ RIL[REQUEST_CDMA_SET_SUBSCRIPTION_SOURCE] = null;
RIL[REQUEST_CDMA_SET_ROAMING_PREFERENCE] = function REQUEST_CDMA_SET_ROAMING_PREFERENCE(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
return;
}
this.sendChromeMessage(options);
};
RIL[REQUEST_CDMA_QUERY_ROAMING_PREFERENCE] = function REQUEST_CDMA_QUERY_ROAMING_PREFERENCE(length, options) {
if (options.rilRequestError) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
return;
} else {
let mode = Buf.readUint32List();
options.mode = CDMA_ROAMING_PREFERENCE_TO_GECKO[mode[0]];
}
let mode = Buf.readUint32List();
options.mode = CDMA_ROAMING_PREFERENCE_TO_GECKO[mode[0]];
this.sendChromeMessage(options);
};
RIL[REQUEST_SET_TTY_MODE] = null;

View File

@ -763,24 +763,24 @@ struct ParamTraits<nsIntRect>
}
};
template<>
struct ParamTraits<nsIntRegion>
template<typename Region, typename Rect, typename Iter>
struct RegionParamTraits
{
typedef nsIntRegion paramType;
typedef Region paramType;
static void Write(Message* msg, const paramType& param)
{
nsIntRegionRectIterator it(param);
while (const nsIntRect* r = it.Next())
Iter it(param);
while (const Rect* r = it.Next())
WriteParam(msg, *r);
// empty rects are sentinel values because nsRegions will never
// contain them
WriteParam(msg, nsIntRect());
WriteParam(msg, Rect());
}
static bool Read(const Message* msg, void** iter, paramType* result)
{
nsIntRect rect;
Rect rect;
while (ReadParam(msg, iter, &rect)) {
if (rect.IsEmpty())
return true;
@ -790,6 +790,11 @@ struct ParamTraits<nsIntRegion>
}
};
template<>
struct ParamTraits<nsIntRegion>
: RegionParamTraits<nsIntRegion, nsIntRect, nsIntRegionRectIterator>
{};
template<>
struct ParamTraits<nsIntSize>
{
@ -988,6 +993,11 @@ struct ParamTraits<nsRect>
}
};
template<>
struct ParamTraits<nsRegion>
: RegionParamTraits<nsRegion, nsRect, nsRegionRectIterator>
{};
template<>
struct ParamTraits<nsID>
{

View File

@ -40,6 +40,7 @@
#include "BasicLayers.h"
#include "nsBoxFrame.h"
#include "nsViewportFrame.h"
#include "nsSubDocumentFrame.h"
#include "nsSVGEffects.h"
#include "nsSVGElement.h"
#include "nsSVGClipPathFrame.h"
@ -1270,6 +1271,17 @@ GetMouseThrough(const nsIFrame* aFrame)
return false;
}
static bool
IsFrameReceivingPointerEvents(nsIFrame* aFrame)
{
nsSubDocumentFrame* frame = do_QueryFrame(aFrame);
if (frame && frame->PassPointerEventsToChildren()) {
return true;
}
return NS_STYLE_POINTER_EVENTS_NONE !=
aFrame->StyleVisibility()->GetEffectivePointerEvents(aFrame);
}
// A list of frames, and their z depth. Used for sorting
// the results of hit testing.
struct FramesWithDepth
@ -1352,8 +1364,7 @@ void nsDisplayList::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
for (uint32_t j = 0; j < outFrames.Length(); j++) {
nsIFrame *f = outFrames.ElementAt(j);
// Handle the XUL 'mousethrough' feature and 'pointer-events'.
if (!GetMouseThrough(f) &&
f->StyleVisibility()->GetEffectivePointerEvents(f) != NS_STYLE_POINTER_EVENTS_NONE) {
if (!GetMouseThrough(f) && IsFrameReceivingPointerEvents(f)) {
writeFrames->AppendElement(f);
}
}

View File

@ -5489,6 +5489,47 @@ private:
uint32_t mFlags;
};
class AutoUpdateHitRegion
{
public:
AutoUpdateHitRegion(PresShell* aShell, nsIFrame* aFrame)
: mShell(aShell), mFrame(aFrame)
{
}
~AutoUpdateHitRegion()
{
if (XRE_GetProcessType() != GeckoProcessType_Content ||
!mFrame || !mShell) {
return;
}
TabChild* tabChild = GetTabChildFrom(mShell);
if (!tabChild || !tabChild->GetUpdateHitRegion()) {
return;
}
nsRegion region;
nsDisplayListBuilder builder(mFrame,
nsDisplayListBuilder::EVENT_DELIVERY,
/* aBuildCert= */ false);
nsDisplayList list;
nsAutoTArray<nsIFrame*, 100> outFrames;
nsDisplayItem::HitTestState hitTestState;
nsRect bounds = mShell->GetPresContext()->GetVisibleArea();
builder.EnterPresShell(mFrame, bounds);
mFrame->BuildDisplayListForStackingContext(&builder, bounds, &list);
builder.LeavePresShell(mFrame, bounds);
list.HitTest(&builder, bounds, &hitTestState, &outFrames);
list.DeleteAll();
for (int32_t i = outFrames.Length() - 1; i >= 0; --i) {
region.Or(region, nsLayoutUtils::TransformFrameRectToAncestor(
outFrames[i], nsRect(nsPoint(0, 0), outFrames[i]->GetSize()), mFrame));
}
tabChild->UpdateHitRegion(region);
}
private:
PresShell* mShell;
nsIFrame* mFrame;
};
void
PresShell::Paint(nsView* aViewToPaint,
const nsRegion& aDirtyRegion,
@ -5520,6 +5561,7 @@ PresShell::Paint(nsView* aViewToPaint,
didPaintFlags |= PAINT_COMPOSITE;
}
nsAutoNotifyDidPaint notifyDidPaint(this, didPaintFlags);
AutoUpdateHitRegion updateHitRegion(this, frame);
// Whether or not we should set first paint when painting is
// suppressed is debatable. For now we'll do it because

View File

@ -141,6 +141,7 @@ MOCHITEST_FILES = \
test_bug770106.html \
test_maxLineBoxWidth.html \
test_remote_frame.html \
test_remote_passpointerevents.html \
test_bug842853.html \
test_bug842853-2.html \
file_bug842853.sjs \

View File

@ -0,0 +1,52 @@
<!DOCTYPE HTML>
<html>
<head>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript;version=1.7">
"use strict";
SimpleTest.waitForExplicitFinish();
function checkPointerEvents() {
let iframe = this;
let fRect = iframe.getBoundingClientRect();
let e1 = document.elementFromPoint(fRect.left + 10, fRect.top + 10);
let e2 = document.elementFromPoint(fRect.left + 110, fRect.top + 110);
if (e1 === document.body && e2 === iframe) {
is(e1, document.body, "check point in transparent region of the iframe");
is(e2, iframe, "check point in opaque region of the iframe");
SimpleTest.finish();
}
else {
SimpleTest.executeSoon(checkPointerEvents.bind(iframe));
}
}
function runTest() {
let iframe = document.createElement("iframe");
SpecialPowers.wrap(iframe).setAttribute('mozbrowser', 'true');
SpecialPowers.wrap(iframe).setAttribute('mozpasspointerevents', 'true');
SpecialPowers.wrap(iframe).setAttribute('remote', 'true');
iframe.style = "border:none; width:400px; height:400px; pointer-events:none";
iframe.src = "data:text/html,<html style='pointer-events:none'><div style='margin:100px; width:100px; height:100px; background:yellow; pointer-events:auto'>";
document.body.appendChild(iframe);
SimpleTest.executeSoon(checkPointerEvents.bind(iframe));
}
addEventListener("load", function() {
SpecialPowers.addPermission("browser", true, document);
SpecialPowers.addPermission("embed-apps", true, document);
SpecialPowers.pushPrefEnv({
"set": [
["dom.ipc.browser_frames.oop_by_default", true],
["dom.mozBrowserFramesEnabled", true]
]
}, runTest);
});
</script>
</body>
</html>

View File

@ -303,7 +303,11 @@ nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
if (aBuilder->IsForEventDelivery() && !PassPointerEventsToChildren())
return;
DisplayBorderBackgroundOutline(aBuilder, aLists);
// If we are pointer-events:none then we don't need to HitTest background
if (!aBuilder->IsForEventDelivery() ||
StyleVisibility()->mPointerEvents != NS_STYLE_POINTER_EVENTS_NONE) {
DisplayBorderBackgroundOutline(aBuilder, aLists);
}
if (!mInnerView)
return;

View File

@ -107,6 +107,12 @@ public:
return !frameLoader || frameLoader->ShouldClampScrollPosition();
}
/**
* Return true if pointer event hit-testing should be allowed to target
* content in the subdocument.
*/
bool PassPointerEventsToChildren();
protected:
friend class AsyncFrameInit;
@ -135,12 +141,6 @@ protected:
*/
nsIFrame* ObtainIntrinsicSizeFrame();
/**
* Return true if pointer event hit-testing should be allowed to target
* content in the subdocument.
*/
bool PassPointerEventsToChildren();
nsRefPtr<nsFrameLoader> mFrameLoader;
nsView* mInnerView;
bool mIsInline;

View File

@ -8,6 +8,10 @@
include protocol PBrowser;
include protocol PLayerTransaction;
include "nsRegion.h";
using nsRegion;
namespace mozilla {
namespace layout {
@ -44,15 +48,19 @@ parent:
async CancelDefaultPanZoom();
async DetectScrollableSubframe();
async UpdateHitRegion(nsRegion aRegion);
async __delete__();
state EMPTY_OR_DIRECT_COMPOSITOR:
recv PLayerTransaction goto HAVE_CONTENT;
recv NotifyCompositorTransaction goto EMPTY_OR_DIRECT_COMPOSITOR;
recv UpdateHitRegion goto EMPTY_OR_DIRECT_COMPOSITOR;
recv __delete__;
state HAVE_CONTENT:
recv NotifyCompositorTransaction goto HAVE_CONTENT;
recv UpdateHitRegion goto HAVE_CONTENT;
recv __delete__;
};

View File

@ -624,6 +624,8 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader,
CompositorParent::SetControllerForLayerTree(mLayersId, mContentController);
}
}
// Set a default RenderFrameParent
mFrameLoader->SetCurrentRemoteFrame(this);
}
APZCTreeManager*
@ -862,6 +864,13 @@ RenderFrameParent::RecvDetectScrollableSubframe()
return true;
}
bool
RenderFrameParent::RecvUpdateHitRegion(const nsRegion& aRegion)
{
mTouchRegion = aRegion;
return true;
}
PLayerTransactionParent*
RenderFrameParent::AllocPLayerTransactionParent()
{
@ -1007,6 +1016,12 @@ RenderFrameParent::UpdateZoomConstraints(bool aAllowZoom, float aMinZoom, float
}
}
bool
RenderFrameParent::HitTest(const nsRect& aRect)
{
return mTouchRegion.Contains(aRect);
}
} // namespace layout
} // namespace mozilla
@ -1022,6 +1037,14 @@ nsDisplayRemote::BuildLayer(nsDisplayListBuilder* aBuilder,
return layer.forget();
}
void
nsDisplayRemote::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames)
{
if (mRemoteFrame->HitTest(aRect)) {
aOutFrames->AppendElement(mFrame);
}
}
void
nsDisplayRemoteShadow::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,

View File

@ -104,6 +104,8 @@ public:
void UpdateZoomConstraints(bool aAllowZoom, float aMinZoom, float aMaxZoom);
bool HitTest(const nsRect& aRect);
protected:
void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
@ -112,6 +114,8 @@ protected:
virtual bool RecvCancelDefaultPanZoom() MOZ_OVERRIDE;
virtual bool RecvDetectScrollableSubframe() MOZ_OVERRIDE;
virtual bool RecvUpdateHitRegion(const nsRegion& aRegion) MOZ_OVERRIDE;
virtual PLayerTransactionParent* AllocPLayerTransactionParent() MOZ_OVERRIDE;
virtual bool DeallocPLayerTransactionParent(PLayerTransactionParent* aLayers) MOZ_OVERRIDE;
@ -160,6 +164,8 @@ private:
bool mFrameLoaderDestroyed;
// this is gfxRGBA because that's what ColorLayer wants.
gfxRGBA mBackgroundColor;
nsRegion mTouchRegion;
};
} // namespace layout
@ -190,6 +196,9 @@ public:
BuildLayer(nsDisplayListBuilder* aBuilder, LayerManager* aManager,
const ContainerParameters& aContainerParameters) MOZ_OVERRIDE;
void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) MOZ_OVERRIDE;
NS_DISPLAY_DECL_NAME("Remote", TYPE_REMOTE)
private:

View File

@ -457,6 +457,7 @@ OS_LIBS += \
-lstagefright_omx \
-lbinder \
-lgui \
$(DEPTH)/widget/gonk/nativewindow/$(LIB_PREFIX)nativewindow.$(LIB_SUFFIX) \
$(NULL)
endif

View File

@ -20,7 +20,7 @@ EXPORTS += [
'OrientationObserver.h',
]
DIRS += ['libdisplay']
DIRS += ['libdisplay', 'nativewindow']
CPP_SOURCES += [
'EventHub.cpp',

View File

@ -0,0 +1,2 @@
#include "GonkNativeWindowICS.h"

View File

@ -0,0 +1,2 @@
#include "GonkNativeWindowClientICS.h"

View File

@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef DOM_CAMERA_GONKNATIVEWINDOWCLIENT_H
#define DOM_CAMERA_GONKNATIVEWINDOWCLIENT_H
#ifndef NATIVEWINDOW_GONKNATIVEWINDOWCLIENT_ICS_H
#define NATIVEWINDOW_GONKNATIVEWINDOWCLIENT_ICS_H
#include <ui/egl/android_natives.h>
@ -127,10 +127,10 @@ private:
// member variables are accessed.
mutable Mutex mMutex;
bool mConnectedToCpu;
bool mConnectedToCpu;
};
}; // namespace android
#endif // DOM_CAMERA_GONKNATIVEWINDOWCLIENT_H
#endif // NATIVEWINDOW_GONKNATIVEWINDOWCLIENT_ICS_H

View File

@ -16,7 +16,6 @@
*/
#include "base/basictypes.h"
#include "GonkCameraHwMgr.h"
#include "mozilla/layers/ShadowLayers.h"
#include "mozilla/layers/ShadowLayerUtilsGralloc.h"
#include "mozilla/layers/ImageBridgeChild.h"

View File

@ -15,8 +15,8 @@
* limitations under the License.
*/
#ifndef DOM_CAMERA_GONKNATIVEWINDOW_H
#define DOM_CAMERA_GONKNATIVEWINDOW_H
#ifndef NATIVEWINDOW_GONKNATIVEWINDOW_ICS_H
#define NATIVEWINDOW_GONKNATIVEWINDOW_ICS_H
#include <stdint.h>
#include <sys/types.h>
@ -349,4 +349,4 @@ protected:
}; // namespace android
#endif // DOM_CAMERA_GONKNATIVEWINDOW_H
#endif // NATIVEWINDOW_GONKNATIVEWINDOW_ICS_H

View File

@ -0,0 +1,27 @@
# Copyright 2013 Mozilla Foundation and Mozilla contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
DEPTH = @DEPTH@
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
LIBRARY_NAME = nativewindow
LIBXUL_LIBRARY = 1
FAIL_ON_WARNINGS := 1
STL_FLAGS=
include $(topsrcdir)/config/rules.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk

View File

@ -0,0 +1,34 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# Copyright 2013 Mozilla Foundation and Mozilla contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
MODULE = 'nativewindow'
EXPORTS += [
'GonkNativeWindow.h',
'GonkNativeWindowClient.h',
]
EXPORTS += [
'GonkNativeWindowClientICS.h',
'GonkNativeWindowICS.h',
]
if CONFIG['MOZ_B2G_CAMERA'] or CONFIG['MOZ_OMX_DECODER']:
CPP_SOURCES += [
'GonkNativeWindowICS.cpp',
'GonkNativeWindowClientICS.cpp',
]