зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to inbound.
This commit is contained in:
Коммит
93247b9975
|
@ -29,8 +29,8 @@ this.AccessFu = {
|
|||
Utils.init(aWindow);
|
||||
|
||||
try {
|
||||
Cc['@mozilla.org/android/bridge;1'].
|
||||
getService(Ci.nsIAndroidBridge).handleGeckoMessage(
|
||||
let bridgeCc = Cc['@mozilla.org/android/bridge;1'];
|
||||
bridgeCc.getService(Ci.nsIAndroidBridge).handleGeckoMessage(
|
||||
JSON.stringify({ type: 'Accessibility:Ready' }));
|
||||
Services.obs.addObserver(this, 'Accessibility:Settings', false);
|
||||
} catch (x) {
|
||||
|
|
|
@ -1103,8 +1103,12 @@ window.addEventListener('ContentStart', function cr_onContentStart() {
|
|||
});
|
||||
|
||||
window.addEventListener('ContentStart', function update_onContentStart() {
|
||||
let updatePrompt = Cc["@mozilla.org/updates/update-prompt;1"]
|
||||
.createInstance(Ci.nsIUpdatePrompt);
|
||||
let promptCc = Cc["@mozilla.org/updates/update-prompt;1"];
|
||||
if (!promptCc) {
|
||||
return;
|
||||
}
|
||||
|
||||
let updatePrompt = promptCc.createInstance(Ci.nsIUpdatePrompt);
|
||||
if (!updatePrompt) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"revision": "340f6676fc5dc34f1b9ab0c40169c0c4fd744587",
|
||||
"revision": "10a9cab9cf34cc34b34e1ee2c83ba2bf0af6d6f1",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ this.AppsUtils = {
|
|||
#ifdef MOZ_WIDGET_GONK
|
||||
isCoreApp = app.basePath == this.getCoreAppsBasePath();
|
||||
#endif
|
||||
debug(app.name + " isCoreApp: " + isCoreApp);
|
||||
debug(app.basePath + " isCoreApp: " + isCoreApp);
|
||||
return { "basePath": app.basePath + "/",
|
||||
"isCoreApp": isCoreApp };
|
||||
},
|
||||
|
|
|
@ -420,7 +420,7 @@ this.DOMApplicationRegistry = {
|
|||
let localId = this.webapps[id].localId;
|
||||
let permMgr = Cc["@mozilla.org/permissionmanager;1"]
|
||||
.getService(Ci.nsIPermissionManager);
|
||||
permMgr.RemovePermissionsForApp(localId, false);
|
||||
permMgr.removePermissionsForApp(localId, false);
|
||||
Services.cookies.removeCookiesForApp(localId, false);
|
||||
this._clearPrivateData(localId, false);
|
||||
delete this.webapps[id];
|
||||
|
|
|
@ -718,52 +718,41 @@ ParseProperties(DBusMessageIter* aIter,
|
|||
aValue = props;
|
||||
}
|
||||
|
||||
static void
|
||||
static bool
|
||||
UnpackPropertiesMessage(DBusMessage* aMsg, DBusError* aErr,
|
||||
BluetoothValue& aValue, nsAString& aErrorStr,
|
||||
Properties* aPropertyTypes,
|
||||
const int aPropertyTypeLen)
|
||||
BluetoothValue& aValue, const char* aIface)
|
||||
{
|
||||
if (!IsDBusMessageError(aMsg, aErr, aErrorStr) &&
|
||||
dbus_message_get_type(aMsg) == DBUS_MESSAGE_TYPE_METHOD_RETURN) {
|
||||
DBusMessageIter iter;
|
||||
if (!dbus_message_iter_init(aMsg, &iter)) {
|
||||
aErrorStr.AssignLiteral("Cannot create dbus message iter!");
|
||||
} else {
|
||||
ParseProperties(&iter, aValue, aErrorStr, aPropertyTypes,
|
||||
aPropertyTypeLen);
|
||||
}
|
||||
Properties* propertyTypes;
|
||||
int propertyTypesLength;
|
||||
|
||||
nsAutoString errorStr;
|
||||
if (IsDBusMessageError(aMsg, aErr, errorStr) ||
|
||||
dbus_message_get_type(aMsg) != DBUS_MESSAGE_TYPE_METHOD_RETURN) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
UnpackAdapterPropertiesMessage(DBusMessage* aMsg, DBusError* aErr,
|
||||
BluetoothValue& aValue,
|
||||
nsAString& aErrorStr)
|
||||
{
|
||||
UnpackPropertiesMessage(aMsg, aErr, aValue, aErrorStr,
|
||||
sAdapterProperties,
|
||||
ArrayLength(sAdapterProperties));
|
||||
}
|
||||
DBusMessageIter iter;
|
||||
if (!dbus_message_iter_init(aMsg, &iter)) {
|
||||
BT_WARNING("Cannot create dbus message iter!");
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
UnpackDevicePropertiesMessage(DBusMessage* aMsg, DBusError* aErr,
|
||||
BluetoothValue& aValue,
|
||||
nsAString& aErrorStr)
|
||||
{
|
||||
UnpackPropertiesMessage(aMsg, aErr, aValue, aErrorStr,
|
||||
sDeviceProperties,
|
||||
ArrayLength(sDeviceProperties));
|
||||
}
|
||||
if (!strcmp(aIface, DBUS_DEVICE_IFACE)) {
|
||||
propertyTypes = sDeviceProperties;
|
||||
propertyTypesLength = ArrayLength(sDeviceProperties);
|
||||
} else if (!strcmp(aIface, DBUS_ADAPTER_IFACE)) {
|
||||
propertyTypes = sAdapterProperties;
|
||||
propertyTypesLength = ArrayLength(sAdapterProperties);
|
||||
} else if (!strcmp(aIface, DBUS_MANAGER_IFACE)) {
|
||||
propertyTypes = sManagerProperties;
|
||||
propertyTypesLength = ArrayLength(sManagerProperties);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
static void
|
||||
UnpackManagerPropertiesMessage(DBusMessage* aMsg, DBusError* aErr,
|
||||
BluetoothValue& aValue,
|
||||
nsAString& aErrorStr)
|
||||
{
|
||||
UnpackPropertiesMessage(aMsg, aErr, aValue, aErrorStr,
|
||||
sManagerProperties,
|
||||
ArrayLength(sManagerProperties));
|
||||
ParseProperties(&iter, aValue, errorStr, propertyTypes,
|
||||
propertyTypesLength);
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -809,63 +798,87 @@ GetPropertiesInternal(const nsAString& aPath,
|
|||
"GetProperties",
|
||||
DBUS_TYPE_INVALID);
|
||||
|
||||
nsAutoString replyError;
|
||||
if (!strcmp(aIface, DBUS_DEVICE_IFACE)) {
|
||||
UnpackDevicePropertiesMessage(msg, &err, aValue, replyError);
|
||||
} else if (!strcmp(aIface, DBUS_ADAPTER_IFACE)) {
|
||||
UnpackAdapterPropertiesMessage(msg, &err, aValue, replyError);
|
||||
} else if (!strcmp(aIface, DBUS_MANAGER_IFACE)) {
|
||||
UnpackManagerPropertiesMessage(msg, &err, aValue, replyError);
|
||||
} else {
|
||||
NS_WARNING("Unknown interface for GetProperties!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!replyError.IsEmpty()) {
|
||||
NS_WARNING("Failed to get device properties");
|
||||
return false;
|
||||
}
|
||||
bool success = UnpackPropertiesMessage(msg, &err, aValue, aIface);
|
||||
|
||||
if (msg) {
|
||||
dbus_message_unref(msg);
|
||||
}
|
||||
|
||||
if (!success) {
|
||||
BT_WARNING("Failed to get device properties");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
class AppendDeviceNameRunnable : public nsRunnable
|
||||
class GetPropertiesReplyHandler : public DBusReplyHandler
|
||||
{
|
||||
public:
|
||||
AppendDeviceNameRunnable(const BluetoothSignal& aSignal)
|
||||
: mSignal(aSignal)
|
||||
GetPropertiesReplyHandler(const nsCString& aIface)
|
||||
: mIface(aIface)
|
||||
{
|
||||
MOZ_ASSERT(!mIface.IsEmpty());
|
||||
}
|
||||
|
||||
nsresult Run()
|
||||
const nsCString& GetInterface() const
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
return mIface;
|
||||
}
|
||||
|
||||
InfallibleTArray<BluetoothNamedValue>& arr =
|
||||
mSignal.value().get_ArrayOfBluetoothNamedValue();
|
||||
nsString devicePath = arr[0].value().get_nsString();
|
||||
private:
|
||||
nsCString mIface;
|
||||
};
|
||||
|
||||
class AppendDeviceNameReplyHandler: public GetPropertiesReplyHandler
|
||||
{
|
||||
public:
|
||||
AppendDeviceNameReplyHandler(const nsCString& aIface,
|
||||
const nsString& aDevicePath,
|
||||
const BluetoothSignal& aSignal)
|
||||
: GetPropertiesReplyHandler(aIface)
|
||||
, mDevicePath(aDevicePath)
|
||||
, mSignal(aSignal)
|
||||
{
|
||||
MOZ_ASSERT(!mDevicePath.IsEmpty());
|
||||
}
|
||||
|
||||
void Handle(DBusMessage* aReply) MOZ_OVERRIDE
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread()); // DBus thread
|
||||
|
||||
if (!aReply || (dbus_message_get_type(aReply) == DBUS_MESSAGE_TYPE_ERROR)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get device properties from result of GetProperties
|
||||
|
||||
DBusError err;
|
||||
dbus_error_init(&err);
|
||||
|
||||
BluetoothValue deviceProperties;
|
||||
|
||||
bool success = UnpackPropertiesMessage(aReply, &err, deviceProperties,
|
||||
GetInterface().get());
|
||||
if (!success) {
|
||||
BT_WARNING("Failed to get device properties");
|
||||
return;
|
||||
}
|
||||
|
||||
// First we replace object path with device address.
|
||||
|
||||
// Replace object path with device address
|
||||
InfallibleTArray<BluetoothNamedValue>& parameters =
|
||||
mSignal.value().get_ArrayOfBluetoothNamedValue();
|
||||
nsString address = GetAddressFromObjectPath(devicePath);
|
||||
nsString address =
|
||||
GetAddressFromObjectPath(mDevicePath);
|
||||
parameters[0].name().AssignLiteral("address");
|
||||
parameters[0].value() = address;
|
||||
|
||||
BluetoothValue prop;
|
||||
if(!GetPropertiesInternal(devicePath, DBUS_DEVICE_IFACE, prop)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
// Then we append the device's name to the original signal's data.
|
||||
|
||||
// Get device name from result of GetPropertiesInternal and append to
|
||||
// original signal
|
||||
InfallibleTArray<BluetoothNamedValue>& properties =
|
||||
prop.get_ArrayOfBluetoothNamedValue();
|
||||
uint8_t i;
|
||||
deviceProperties.get_ArrayOfBluetoothNamedValue();
|
||||
InfallibleTArray<BluetoothNamedValue>::size_type i;
|
||||
for (i = 0; i < properties.Length(); i++) {
|
||||
if (properties[i].name().EqualsLiteral("Name")) {
|
||||
properties[i].name().AssignLiteral("name");
|
||||
|
@ -878,53 +891,54 @@ public:
|
|||
nsRefPtr<DistributeBluetoothSignalTask> task =
|
||||
new DistributeBluetoothSignalTask(mSignal);
|
||||
NS_DispatchToMainThread(task);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
nsString mDevicePath;
|
||||
BluetoothSignal mSignal;
|
||||
};
|
||||
|
||||
class AppendDeviceNameHandler : public nsRunnable
|
||||
static void
|
||||
AppendDeviceName(BluetoothSignal& aSignal)
|
||||
{
|
||||
public:
|
||||
AppendDeviceNameHandler(const BluetoothSignal& aSignal)
|
||||
: mSignal(aSignal)
|
||||
{
|
||||
BluetoothValue v = aSignal.value();
|
||||
if (v.type() != BluetoothValue::TArrayOfBluetoothNamedValue ||
|
||||
v.get_ArrayOfBluetoothNamedValue().Length() == 0) {
|
||||
BT_WARNING("Invalid argument type for AppendDeviceNameRunnable");
|
||||
return;
|
||||
}
|
||||
const InfallibleTArray<BluetoothNamedValue>& arr =
|
||||
v.get_ArrayOfBluetoothNamedValue();
|
||||
|
||||
// Device object path should be put in the first element
|
||||
if (!arr[0].name().EqualsLiteral("path") ||
|
||||
arr[0].value().type() != BluetoothValue::TnsString) {
|
||||
BT_WARNING("Invalid object path for AppendDeviceNameRunnable");
|
||||
return;
|
||||
}
|
||||
|
||||
nsresult Run()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
NS_ENSURE_TRUE(bs, NS_ERROR_FAILURE);
|
||||
nsString devicePath = arr[0].value().get_nsString();
|
||||
|
||||
BluetoothValue v = mSignal.value();
|
||||
if (v.type() != BluetoothValue::TArrayOfBluetoothNamedValue ||
|
||||
v.get_ArrayOfBluetoothNamedValue().Length() == 0) {
|
||||
NS_WARNING("Invalid argument type for AppendDeviceNameHandler");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
const InfallibleTArray<BluetoothNamedValue>& arr =
|
||||
v.get_ArrayOfBluetoothNamedValue();
|
||||
nsRefPtr<RawDBusConnection> threadConnection = gThreadConnection;
|
||||
|
||||
// Device object path should be put in the first element
|
||||
if (!arr[0].name().EqualsLiteral("path") ||
|
||||
arr[0].value().type() != BluetoothValue::TnsString) {
|
||||
NS_WARNING("Invalid object path for AppendDeviceNameHandler");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsRefPtr<nsRunnable> func(new AppendDeviceNameRunnable(mSignal));
|
||||
bs->DispatchToCommandThread(func);
|
||||
|
||||
return NS_OK;
|
||||
if (!threadConnection.get()) {
|
||||
BT_WARNING("%s: DBus connection has been closed.", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothSignal mSignal;
|
||||
};
|
||||
nsRefPtr<AppendDeviceNameReplyHandler> handler =
|
||||
new AppendDeviceNameReplyHandler(nsCString(DBUS_DEVICE_IFACE),
|
||||
devicePath, aSignal);
|
||||
bool success = dbus_func_args_async(threadConnection->GetConnection(), 1000,
|
||||
AppendDeviceNameReplyHandler::Callback,
|
||||
handler.get(),
|
||||
NS_ConvertUTF16toUTF8(devicePath).get(),
|
||||
DBUS_DEVICE_IFACE, "GetProperties",
|
||||
DBUS_TYPE_INVALID);
|
||||
NS_ENSURE_TRUE_VOID(success);
|
||||
|
||||
handler.forget();
|
||||
}
|
||||
|
||||
static DBusHandlerResult
|
||||
AgentEventFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
||||
|
@ -947,7 +961,6 @@ AgentEventFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
|||
nsString errorStr;
|
||||
BluetoothValue v;
|
||||
InfallibleTArray<BluetoothNamedValue> parameters;
|
||||
nsRefPtr<nsRunnable> handler;
|
||||
bool isPairingReq = false;
|
||||
BluetoothSignal signal(signalName, signalPath, v);
|
||||
char *objectPath;
|
||||
|
@ -1122,11 +1135,10 @@ AgentEventFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
|||
// It'll be unrefed when set*Internal() is called.
|
||||
dbus_message_ref(msg);
|
||||
|
||||
handler = new AppendDeviceNameHandler(signal);
|
||||
AppendDeviceName(signal);
|
||||
} else {
|
||||
handler = new DistributeBluetoothSignalTask(signal);
|
||||
NS_DispatchToMainThread(new DistributeBluetoothSignalTask(signal));
|
||||
}
|
||||
NS_DispatchToMainThread(handler);
|
||||
|
||||
return DBUS_HANDLER_RESULT_HANDLED;
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ using gfxMatrix;
|
|||
using gfxSize;
|
||||
using CSSRect;
|
||||
using mozilla::layers::FrameMetrics;
|
||||
using FrameMetrics::ViewID;
|
||||
using mozilla::layout::ScrollingBehavior;
|
||||
using mozilla::void_t;
|
||||
using mozilla::WindowsHandle;
|
||||
|
@ -288,6 +289,13 @@ parent:
|
|||
*/
|
||||
UpdateZoomConstraints(bool aAllowZoom, float aMinZoom, float aMaxZoom);
|
||||
|
||||
/**
|
||||
* Notifies the parent about a scroll event. The pres shell ID and
|
||||
* view ID identify which scrollable (sub-)frame was scrolled, and
|
||||
* the new scroll offset for that frame is sent.
|
||||
*/
|
||||
UpdateScrollOffset(uint32_t aPresShellId, ViewID aViewId, CSSIntPoint aScrollOffset);
|
||||
|
||||
__delete__();
|
||||
|
||||
child:
|
||||
|
|
|
@ -299,6 +299,29 @@ TabChild::TabChild(ContentChild* aManager, const TabContext& aContext, uint32_t
|
|||
printf("creating %d!\n", NS_IsMainThread());
|
||||
}
|
||||
|
||||
// Get the DOMWindowUtils for the window corresponding to the given document.
|
||||
static already_AddRefed<nsIDOMWindowUtils> GetDOMWindowUtils(nsIDocument* doc)
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindowUtils> utils;
|
||||
nsCOMPtr<nsIDOMWindow> window = doc->GetDefaultView();
|
||||
if (window) {
|
||||
utils = do_GetInterface(window);
|
||||
}
|
||||
return utils.forget();
|
||||
}
|
||||
|
||||
// Get the DOMWindowUtils for the window corresponding to the givent content
|
||||
// element. This might be an iframe inside the tab, for instance.
|
||||
static already_AddRefed<nsIDOMWindowUtils> GetDOMWindowUtils(nsIContent* content)
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindowUtils> utils;
|
||||
nsIDocument* doc = content->GetCurrentDoc();
|
||||
if (doc) {
|
||||
utils = GetDOMWindowUtils(doc);
|
||||
}
|
||||
return utils.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
TabChild::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
|
@ -308,6 +331,48 @@ TabChild::HandleEvent(nsIDOMEvent* aEvent)
|
|||
// This meta data may or may not have been a meta viewport tag. If it was,
|
||||
// we should handle it immediately.
|
||||
HandlePossibleViewportChange();
|
||||
} else if (eventType.EqualsLiteral("scroll")) {
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
aEvent->GetTarget(getter_AddRefs(target));
|
||||
|
||||
ViewID viewId;
|
||||
uint32_t presShellId;
|
||||
nsIScrollableFrame* scrollFrame = nullptr;
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
if (nsCOMPtr<nsIDocument> doc = do_QueryInterface(target))
|
||||
content = doc->GetDocumentElement();
|
||||
else
|
||||
content = do_QueryInterface(target);
|
||||
|
||||
nsCOMPtr<nsIDOMWindowUtils> utils = ::GetDOMWindowUtils(content);
|
||||
utils->GetPresShellId(&presShellId);
|
||||
|
||||
if (!nsLayoutUtils::FindIDFor(content, &viewId))
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
scrollFrame = nsLayoutUtils::FindScrollableFrameFor(viewId);
|
||||
if (scrollFrame) {
|
||||
CSSIntPoint scrollOffset = scrollFrame->GetScrollPositionCSSPixels();
|
||||
|
||||
// For the root frame, we store the last metrics, including the last
|
||||
// scroll offset, sent by APZC. (This is updated in ProcessUpdateFrame()).
|
||||
// We use this here to avoid sending APZC back a scroll event that
|
||||
// originally came from APZC (besides being unnecessary, the event might
|
||||
// be slightly out of date by the time it reaches APZC).
|
||||
// We should probably do this for subframes, too.
|
||||
if (viewId == FrameMetrics::ROOT_SCROLL_ID) {
|
||||
if (RoundedToInt(mLastMetrics.mScrollOffset) == scrollOffset)
|
||||
return NS_OK;
|
||||
else
|
||||
// Update the last scroll offset now, otherwise RecvUpdateDimensions()
|
||||
// might trigger a scroll to the old offset before RecvUpdateFrame()
|
||||
// gets a chance to update it.
|
||||
mLastMetrics.mScrollOffset = scrollOffset;
|
||||
}
|
||||
|
||||
SendUpdateScrollOffset(presShellId, viewId, scrollOffset);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1039,20 +1104,6 @@ TabChild::GetDOMWindowUtils()
|
|||
return utils.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMWindowUtils>
|
||||
TabChild::GetDOMWindowUtils(nsIContent* content)
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindowUtils> utils;
|
||||
nsIDocument* doc = content->GetCurrentDoc();
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIDOMWindow> window = doc->GetDefaultView();
|
||||
if (window) {
|
||||
utils = do_GetInterface(window);
|
||||
}
|
||||
}
|
||||
return utils.forget();
|
||||
}
|
||||
|
||||
static nsInterfaceHashtable<nsPtrHashKey<PContentDialogChild>, nsIDialogParamBlock> gActiveDialogs;
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1586,6 +1637,15 @@ TabChild::ProcessUpdateFrame(const FrameMetrics& aFrameMetrics)
|
|||
}
|
||||
|
||||
mLastMetrics = aFrameMetrics;
|
||||
|
||||
// ScrollWindowTo() can make some small adjustments to the offset before
|
||||
// actually scrolling the window. To ensure that the scroll offset stored
|
||||
// in mLastMetrics is the same as the offset stored in the window,
|
||||
// re-query the latter.
|
||||
CSSIntPoint actualScrollOffset;
|
||||
utils->GetScrollXY(false, &actualScrollOffset.x, &actualScrollOffset.y);
|
||||
mLastMetrics.mScrollOffset = actualScrollOffset;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1599,7 +1659,7 @@ TabChild::ProcessUpdateSubframe(nsIContent* aContent,
|
|||
scrollFrame->ScrollToCSSPixelsApproximate(aMetrics.mScrollOffset);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMWindowUtils> utils(GetDOMWindowUtils(aContent));
|
||||
nsCOMPtr<nsIDOMWindowUtils> utils(::GetDOMWindowUtils(aContent));
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(aContent);
|
||||
if (utils && element) {
|
||||
// and set the display port
|
||||
|
@ -2190,6 +2250,7 @@ TabChild::InitTabChildGlobal(FrameScriptLoading aScriptLoading)
|
|||
root->SetParentTarget(scope);
|
||||
|
||||
chromeHandler->AddEventListener(NS_LITERAL_STRING("DOMMetaAdded"), this, false);
|
||||
chromeHandler->AddEventListener(NS_LITERAL_STRING("scroll"), this, false);
|
||||
}
|
||||
|
||||
if (aScriptLoading != DONT_LOAD_SCRIPTS && !mTriedBrowserInit) {
|
||||
|
|
|
@ -436,9 +436,6 @@ private:
|
|||
|
||||
// Get the DOMWindowUtils for the top-level window in this tab.
|
||||
already_AddRefed<nsIDOMWindowUtils> GetDOMWindowUtils();
|
||||
// Get the DOMWindowUtils for the window corresponding to the givent content
|
||||
// element. This might be an iframe inside the tab, for instance.
|
||||
already_AddRefed<nsIDOMWindowUtils> GetDOMWindowUtils(nsIContent* aContent);
|
||||
|
||||
class CachedFileDescriptorInfo;
|
||||
class CachedFileDescriptorCallbackRunnable;
|
||||
|
|
|
@ -1561,6 +1561,17 @@ TabParent::RecvUpdateZoomConstraints(const bool& aAllowZoom,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvUpdateScrollOffset(const uint32_t& aPresShellId,
|
||||
const ViewID& aViewId,
|
||||
const CSSIntPoint& aScrollOffset)
|
||||
{
|
||||
if (RenderFrameParent* rfp = GetRenderFrame()) {
|
||||
rfp->UpdateScrollOffset(aPresShellId, aViewId, aScrollOffset);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabParent::RecvContentReceivedTouch(const bool& aPreventDefault)
|
||||
{
|
||||
|
|
|
@ -161,6 +161,7 @@ public:
|
|||
virtual bool RecvUpdateZoomConstraints(const bool& aAllowZoom,
|
||||
const float& aMinZoom,
|
||||
const float& aMaxZoom);
|
||||
virtual bool RecvUpdateScrollOffset(const uint32_t& aPresShellId, const ViewID& aViewId, const CSSIntPoint& aScrollOffset);
|
||||
virtual bool RecvContentReceivedTouch(const bool& aPreventDefault);
|
||||
virtual PContentDialogParent* AllocPContentDialogParent(const uint32_t& aType,
|
||||
const nsCString& aName,
|
||||
|
|
|
@ -163,6 +163,9 @@ var WifiManager = (function() {
|
|||
}
|
||||
|
||||
var driverLoaded = false;
|
||||
|
||||
manager.getDriverLoaded = function() { return driverLoaded; }
|
||||
|
||||
function loadDriver(callback) {
|
||||
if (driverLoaded) {
|
||||
callback(0);
|
||||
|
@ -2840,6 +2843,7 @@ WifiWorker.prototype = {
|
|||
|
||||
// First, notify all of the requests that were trying to make this change.
|
||||
let state = this._stateRequests[0].enabled;
|
||||
let driverLoaded = WifiManager.getDriverLoaded();
|
||||
|
||||
// It is callback function's responsibility to handle the pending request.
|
||||
// So we just return here.
|
||||
|
@ -2848,9 +2852,12 @@ WifiWorker.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
// If the new state is not the same as state, then we weren't processing
|
||||
// the first request (we were racing somehow) so don't notify.
|
||||
if (!success || state === newState) {
|
||||
// If the new state is not the same as state or new state is not the same as
|
||||
// driver loaded state, then we weren't processing the first request (we
|
||||
// were racing somehow) so don't notify.
|
||||
// For newState is false(disable), we expect driverLoaded is false(driver unloaded)
|
||||
// to proceed, and vice versa.
|
||||
if (!success || (newState === driverLoaded && state === newState)) {
|
||||
do {
|
||||
if (!("callback" in this._stateRequests[0])) {
|
||||
this._stateRequests.shift();
|
||||
|
@ -2864,16 +2871,27 @@ WifiWorker.prototype = {
|
|||
// If there were requests queued after this one, run them.
|
||||
if (this._stateRequests.length > 0) {
|
||||
let self = this;
|
||||
let callback = null;
|
||||
this._callbackTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||
this._callbackTimer.initWithCallback(function(timer) {
|
||||
if ("callback" in self._stateRequests[0]) {
|
||||
self._stateRequests[0].callback.call(self, self._stateRequests[0].enabled);
|
||||
} else {
|
||||
WifiManager.setWifiEnabled(self._stateRequests[0].enabled,
|
||||
self._setWifiEnabledCallback.bind(self));
|
||||
}
|
||||
timer = null;
|
||||
}, 1000, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
if (newState === driverLoaded) {
|
||||
// Driver status is as same as new state, proceed next request.
|
||||
callback = function(timer) {
|
||||
if ("callback" in self._stateRequests[0]) {
|
||||
self._stateRequests[0].callback.call(self, self._stateRequests[0].enabled);
|
||||
} else {
|
||||
WifiManager.setWifiEnabled(self._stateRequests[0].enabled,
|
||||
self._setWifiEnabledCallback.bind(this));
|
||||
}
|
||||
timer = null;
|
||||
};
|
||||
} else {
|
||||
// Driver status is not as same as new state, wait driver.
|
||||
callback = function(timer) {
|
||||
self._notifyAfterStateChange(success, newState);
|
||||
timer = null;
|
||||
};
|
||||
}
|
||||
this._callbackTimer.initWithCallback(callback, 1000, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include "BasePoint.h"
|
||||
#include "BaseSize.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace mozilla {
|
||||
namespace gfx {
|
||||
|
||||
|
@ -63,8 +65,8 @@ typedef PointTyped<UnknownUnits> Point;
|
|||
|
||||
template<class units>
|
||||
IntPointTyped<units> RoundedToInt(const PointTyped<units>& aPoint) {
|
||||
return IntPointTyped<units>(NS_lround(aPoint.x),
|
||||
NS_lround(aPoint.y));
|
||||
return IntPointTyped<units>(int32_t(floorf(aPoint.x + 0.5f)),
|
||||
int32_t(floorf(aPoint.y + 0.5f)));
|
||||
}
|
||||
|
||||
template<class units>
|
||||
|
|
|
@ -1116,8 +1116,8 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
|
|||
mFrameMetrics.mMayHaveTouchListeners = aLayerMetrics.mMayHaveTouchListeners;
|
||||
|
||||
// TODO: Once a mechanism for calling UpdateScrollOffset() when content does
|
||||
// a scrollTo() is implemented for B2G (bug 895905), this block can be removed.
|
||||
#ifndef MOZ_WIDGET_ANDROID
|
||||
// a scrollTo() is implemented for metro (bug 898580), this block can be removed.
|
||||
#ifdef MOZ_METRO
|
||||
if (!mPaintThrottler.IsOutstanding()) {
|
||||
// No paint was requested, but we got one anyways. One possible cause of this
|
||||
// is that content could have fired a scrollTo(). In this case, we should take
|
||||
|
@ -1418,9 +1418,9 @@ void AsyncPanZoomController::UpdateScrollOffset(const CSSPoint& aScrollOffset)
|
|||
|
||||
bool AsyncPanZoomController::Matches(const ScrollableLayerGuid& aGuid)
|
||||
{
|
||||
// TODO: also check the presShellId and mScrollId, once those are
|
||||
// fully propagated everywhere in RenderFrameParent and AndroidJNI.
|
||||
return aGuid.mLayersId == mLayersId;
|
||||
// TODO: also check the presShellId, once that is fully propagated
|
||||
// everywhere in RenderFrameParent and AndroidJNI.
|
||||
return aGuid.mLayersId == mLayersId && aGuid.mScrollId == mFrameMetrics.mScrollId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
struct nsIntPoint;
|
||||
|
||||
// nsPoint represents a point in app units.
|
||||
|
||||
struct nsPoint : public mozilla::gfx::BasePoint<nscoord, nsPoint> {
|
||||
typedef mozilla::gfx::BasePoint<nscoord, nsPoint> Super;
|
||||
|
||||
|
@ -28,6 +30,10 @@ struct nsPoint : public mozilla::gfx::BasePoint<nscoord, nsPoint> {
|
|||
inline nsPoint ConvertAppUnits(int32_t aFromAPP, int32_t aToAPP) const;
|
||||
};
|
||||
|
||||
// nsIntPoint represents a point in one of the types of pixels.
|
||||
// Uses of nsIntPoint should eventually be converted to CSSIntPoint,
|
||||
// LayoutDeviceIntPoint, etc. (see layout/base/Units.h).
|
||||
|
||||
struct nsIntPoint : public mozilla::gfx::BasePoint<int32_t, nsIntPoint> {
|
||||
typedef mozilla::gfx::BasePoint<int32_t, nsIntPoint> Super;
|
||||
|
||||
|
|
|
@ -1156,6 +1156,13 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder,
|
|||
usingDisplayport = nsLayoutUtils::GetDisplayPort(content, &displayport);
|
||||
usingCriticalDisplayport =
|
||||
nsLayoutUtils::GetCriticalDisplayPort(content, &criticalDisplayport);
|
||||
|
||||
if (id == FrameMetrics::ROOT_SCROLL_ID) {
|
||||
// Record the mapping between the root scroll frame's content and
|
||||
// ROOT_SCROLL_ID so that users of nsLayoutUtils::FindIDFor() and
|
||||
// nsLayoutUtils::FindContentFor() don't have to special-case the root.
|
||||
nsLayoutUtils::FindOrCreateIDFor(content, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3213,7 +3220,7 @@ nsDisplayScrollLayer::BuildLayer(nsDisplayListBuilder* aBuilder,
|
|||
// Get the already set unique ID for scrolling this content remotely.
|
||||
// Or, if not set, generate a new ID.
|
||||
nsIContent* content = mScrolledFrame->GetContent();
|
||||
ViewID scrollId = nsLayoutUtils::FindIDFor(content);
|
||||
ViewID scrollId = nsLayoutUtils::FindOrCreateIDFor(content);
|
||||
|
||||
nsRect viewport = mScrollFrame->GetRect() -
|
||||
mScrollFrame->GetPosition() +
|
||||
|
|
|
@ -434,16 +434,24 @@ static void DestroyViewID(void* aObject, nsIAtom* aPropertyName,
|
|||
* A namespace class for static layout utilities.
|
||||
*/
|
||||
|
||||
bool
|
||||
nsLayoutUtils::FindIDFor(nsIContent* aContent, ViewID* aOutViewId)
|
||||
{
|
||||
void* scrollIdProperty = aContent->GetProperty(nsGkAtoms::RemoteId);
|
||||
if (scrollIdProperty) {
|
||||
*aOutViewId = *static_cast<ViewID*>(scrollIdProperty);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
ViewID
|
||||
nsLayoutUtils::FindIDFor(nsIContent* aContent)
|
||||
nsLayoutUtils::FindOrCreateIDFor(nsIContent* aContent, bool aRoot)
|
||||
{
|
||||
ViewID scrollId;
|
||||
|
||||
void* scrollIdProperty = aContent->GetProperty(nsGkAtoms::RemoteId);
|
||||
if (scrollIdProperty) {
|
||||
scrollId = *static_cast<ViewID*>(scrollIdProperty);
|
||||
} else {
|
||||
scrollId = sScrollIdCounter++;
|
||||
if (!FindIDFor(aContent, &scrollId)) {
|
||||
scrollId = aRoot ? FrameMetrics::ROOT_SCROLL_ID : sScrollIdCounter++;
|
||||
aContent->SetProperty(nsGkAtoms::RemoteId, new ViewID(scrollId),
|
||||
DestroyViewID);
|
||||
GetContentMap().Put(scrollId, aContent);
|
||||
|
@ -455,9 +463,8 @@ nsLayoutUtils::FindIDFor(nsIContent* aContent)
|
|||
nsIContent*
|
||||
nsLayoutUtils::FindContentFor(ViewID aId)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(aId != FrameMetrics::NULL_SCROLL_ID &&
|
||||
aId != FrameMetrics::ROOT_SCROLL_ID,
|
||||
"Cannot find a content element in map for null or root IDs.");
|
||||
NS_ABORT_IF_FALSE(aId != FrameMetrics::NULL_SCROLL_ID,
|
||||
"Cannot find a content element in map for null IDs.");
|
||||
nsIContent* content;
|
||||
bool exists = GetContentMap().Get(aId, &content);
|
||||
|
||||
|
|
|
@ -64,13 +64,21 @@ class nsLayoutUtils
|
|||
typedef gfxPattern::GraphicsFilter GraphicsFilter;
|
||||
|
||||
public:
|
||||
typedef mozilla::layers::FrameMetrics::ViewID ViewID;
|
||||
typedef mozilla::layers::FrameMetrics FrameMetrics;
|
||||
typedef FrameMetrics::ViewID ViewID;
|
||||
|
||||
/**
|
||||
* Finds previously assigned ViewID for the given content element, if any.
|
||||
* Returns whether a ViewID was previously assigned.
|
||||
*/
|
||||
static bool FindIDFor(nsIContent* aContent, ViewID* aOutViewId);
|
||||
|
||||
/**
|
||||
* Finds previously assigned or generates a unique ViewID for the given
|
||||
* content element.
|
||||
* content element. If aRoot is true, the special ID
|
||||
* FrameMetrics::ROOT_SCROLL_ID is used.
|
||||
*/
|
||||
static ViewID FindIDFor(nsIContent* aContent);
|
||||
static ViewID FindOrCreateIDFor(nsIContent* aContent, bool aRoot = false);
|
||||
|
||||
/**
|
||||
* Find content for given ID.
|
||||
|
|
|
@ -1016,6 +1016,15 @@ RenderFrameParent::UpdateZoomConstraints(bool aAllowZoom, float aMinZoom, float
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
RenderFrameParent::UpdateScrollOffset(uint32_t aPresShellId, ViewID aViewId, const CSSIntPoint& aScrollOffset)
|
||||
{
|
||||
if (GetApzcTreeManager()) {
|
||||
GetApzcTreeManager()->UpdateScrollOffset(ScrollableLayerGuid(mLayersId, aPresShellId, aViewId),
|
||||
aScrollOffset);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
RenderFrameParent::HitTest(const nsRect& aRect)
|
||||
{
|
||||
|
|
|
@ -104,6 +104,10 @@ public:
|
|||
|
||||
void UpdateZoomConstraints(bool aAllowZoom, float aMinZoom, float aMaxZoom);
|
||||
|
||||
void UpdateScrollOffset(uint32_t aPresShellId,
|
||||
ViewID aViewId,
|
||||
const CSSIntPoint& aScrollOffset);
|
||||
|
||||
bool HitTest(const nsRect& aRect);
|
||||
|
||||
protected:
|
||||
|
|
Загрузка…
Ссылка в новой задаче