mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to fx-team
This commit is contained in:
commit
2448d942b4
@ -460,7 +460,7 @@ TextAttrsMgr::FontFamilyTextAttr::
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm));
|
||||
|
||||
gfxFontGroup* fontGroup = fm->GetThebesFontGroup();
|
||||
gfxFont* font = fontGroup->GetFontAt(0);
|
||||
gfxFont* font = fontGroup->GetFirstValidFont();
|
||||
gfxFontEntry* fontEntry = font->GetFontEntry();
|
||||
aFamily = fontEntry->FamilyName();
|
||||
return true;
|
||||
@ -618,7 +618,7 @@ TextAttrsMgr::FontWeightTextAttr::
|
||||
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm));
|
||||
|
||||
gfxFontGroup *fontGroup = fm->GetThebesFontGroup();
|
||||
gfxFont *font = fontGroup->GetFontAt(0);
|
||||
gfxFont *font = fontGroup->GetFirstValidFont();
|
||||
|
||||
// When there doesn't exist a bold font in the family and so the rendering of
|
||||
// a non-bold font face is changed so that the user sees what looks like a
|
||||
|
@ -57,7 +57,7 @@
|
||||
#include "nsImageFrame.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsObjectFrame.h"
|
||||
#include "nsPluginFrame.h"
|
||||
#include "nsSVGPathGeometryFrame.h"
|
||||
#include "nsTreeBodyFrame.h"
|
||||
#include "nsTreeColumns.h"
|
||||
@ -263,11 +263,11 @@ NS_IMPL_ISUPPORTS(PluginTimerCallBack, nsITimerCallback)
|
||||
#endif
|
||||
|
||||
already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreatePluginAccessible(nsObjectFrame* aFrame,
|
||||
nsAccessibilityService::CreatePluginAccessible(nsPluginFrame* aFrame,
|
||||
nsIContent* aContent,
|
||||
Accessible* aContext)
|
||||
{
|
||||
// nsObjectFrame means a plugin, so we need to use the accessibility support
|
||||
// nsPluginFrame means a plugin, so we need to use the accessibility support
|
||||
// of the plugin.
|
||||
if (aFrame->GetRect().IsEmpty())
|
||||
return nullptr;
|
||||
@ -1619,8 +1619,8 @@ nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame,
|
||||
newAcc = new OuterDocAccessible(aContent, document);
|
||||
break;
|
||||
case ePluginType: {
|
||||
nsObjectFrame* objectFrame = do_QueryFrame(aFrame);
|
||||
newAcc = CreatePluginAccessible(objectFrame, aContent, aContext);
|
||||
nsPluginFrame* pluginFrame = do_QueryFrame(aFrame);
|
||||
newAcc = CreatePluginAccessible(pluginFrame, aContent, aContext);
|
||||
break;
|
||||
}
|
||||
case eTextLeafType:
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "nsIObserver.h"
|
||||
|
||||
class nsImageFrame;
|
||||
class nsObjectFrame;
|
||||
class nsPluginFrame;
|
||||
class nsITreeView;
|
||||
|
||||
namespace mozilla {
|
||||
@ -63,7 +63,7 @@ public:
|
||||
virtual Accessible* GetRootDocumentAccessible(nsIPresShell* aPresShell,
|
||||
bool aCanCreate);
|
||||
already_AddRefed<Accessible>
|
||||
CreatePluginAccessible(nsObjectFrame* aFrame, nsIContent* aContent,
|
||||
CreatePluginAccessible(nsPluginFrame* aFrame, nsIContent* aContent,
|
||||
Accessible* aContext);
|
||||
|
||||
/**
|
||||
|
@ -24,7 +24,7 @@ class nsINode;
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsIPresShell;
|
||||
class nsObjectFrame;
|
||||
class nsPluginFrame;
|
||||
|
||||
// 10ff6dca-b219-4b64-9a4c-67a62b86edce
|
||||
#define NS_IACCESSIBILITYSERVICE_IID \
|
||||
|
@ -182,7 +182,8 @@ sdnTextAccessible::get_fontFamily(BSTR __RPC_FAR* aFontFamily)
|
||||
nsRefPtr<nsFontMetrics> fm;
|
||||
nsLayoutUtils::GetFontMetricsForFrame(frame, getter_AddRefs(fm));
|
||||
|
||||
const nsString& name = fm->GetThebesFontGroup()->GetFontAt(0)->GetName();
|
||||
const nsString& name =
|
||||
fm->GetThebesFontGroup()->GetFirstValidFont()->GetName();
|
||||
if (name.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
|
@ -48,14 +48,14 @@ class MachCommands(MachCommandBase):
|
||||
dirs_to_files = {}
|
||||
|
||||
for path, dirs, files in os.walk(js_src_dir):
|
||||
js_files = [f for f in files if f.endswith(('.js', '.jsm'))]
|
||||
js_files = [f for f in files if f.endswith(('.js', '.jsm', '.html'))]
|
||||
if not js_files:
|
||||
continue
|
||||
|
||||
relative = mozpath.relpath(path, js_src_dir)
|
||||
dirs_to_files[relative] = js_files
|
||||
|
||||
moz_build = """# AUTOMATICALLY GENERATED FROM moz.build.in AND mach. DO NOT EDIT.
|
||||
moz_build = """# AUTOMATICALLY GENERATED FROM mozbuild.template AND mach. DO NOT EDIT.
|
||||
# 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/.
|
||||
|
@ -399,6 +399,7 @@ EXTRA_JS_MODULES.commonjs.sdk.ui.button.view += [
|
||||
|
||||
EXTRA_JS_MODULES.commonjs.sdk.ui.frame += [
|
||||
'source/lib/sdk/ui/frame/model.js',
|
||||
'source/lib/sdk/ui/frame/view.html',
|
||||
'source/lib/sdk/ui/frame/view.js',
|
||||
]
|
||||
|
||||
|
@ -8,8 +8,11 @@ BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
|
||||
JETPACK_PACKAGE_MANIFESTS += ['source/test/jetpack-package.ini']
|
||||
JETPACK_ADDON_MANIFESTS += ['source/test/addons/jetpack-addon.ini']
|
||||
|
||||
DIRS += ["source/modules/system"]
|
||||
|
||||
EXTRA_JS_MODULES.sdk += [
|
||||
'source/app-extension/bootstrap.js',
|
||||
]
|
||||
|
||||
EXTRA_JS_MODULES.sdk.system += [
|
||||
'source/modules/system/Startup.js',
|
||||
'source/modules/system/XulApp.js',
|
||||
]
|
||||
|
@ -744,14 +744,14 @@ pref("hal.processPriorityManager.gonk.LowCPUNice", 18);
|
||||
// priority can be enabled by setting this pref to a value between 1 and 99.
|
||||
// Note that audio processing currently runs at RT priority 2 or 3 at most.
|
||||
//
|
||||
// If RT priority is disabled, then the compositor nice value is used. The
|
||||
// code will default to ANDROID_PRIORITY_URGENT_DISPLAY which is -8. Per gfx
|
||||
// request we are keeping the compositor at nice level 0 until we can complete
|
||||
// the investigation in bug 982972.
|
||||
// If RT priority is disabled, then the compositor nice value is used. We prefer
|
||||
// to use a nice value of -4, which matches Android's preferences. Setting a preference
|
||||
// of RT priority 1 would mean it is higher than audio, which is -16. The compositor
|
||||
// priority must be below the audio thread.
|
||||
//
|
||||
// Do not change these values without gfx team review.
|
||||
pref("hal.gonk.COMPOSITOR.rt_priority", 0);
|
||||
pref("hal.gonk.COMPOSITOR.nice", 0);
|
||||
pref("hal.gonk.COMPOSITOR.nice", -4);
|
||||
|
||||
// Fire a memory pressure event when the system has less than Xmb of memory
|
||||
// remaining. You should probably set this just above Y.KillUnderKB for
|
||||
|
@ -178,13 +178,15 @@ PaymentSettings.prototype = {
|
||||
}
|
||||
|
||||
try {
|
||||
let setting = JSON.parse(aData);
|
||||
if (!setting.key ||
|
||||
(setting.key !== kRilDefaultDataServiceId &&
|
||||
setting.key !== kRilDefaultPaymentServiceId)) {
|
||||
if ('wrappedJSObject' in aSubject) {
|
||||
aSubject = aSubject.wrappedJSObject;
|
||||
}
|
||||
if (!aSubject.key ||
|
||||
(aSubject.key !== kRilDefaultDataServiceId &&
|
||||
aSubject.key !== kRilDefaultPaymentServiceId)) {
|
||||
return;
|
||||
}
|
||||
this.setServiceId(setting.key, setting.value);
|
||||
this.setServiceId(aSubject.key, aSubject.value);
|
||||
} catch (e) {
|
||||
LOGE(e);
|
||||
}
|
||||
|
@ -332,6 +332,7 @@ var shell = {
|
||||
window.addEventListener('unload', this);
|
||||
this.contentBrowser.addEventListener('mozbrowserloadstart', this, true);
|
||||
this.contentBrowser.addEventListener('mozbrowserselectionchange', this, true);
|
||||
this.contentBrowser.addEventListener('mozbrowserscrollviewchange', this, true);
|
||||
|
||||
CustomEventManager.init();
|
||||
WebappsHelper.init();
|
||||
@ -359,6 +360,7 @@ var shell = {
|
||||
window.removeEventListener('sizemodechange', this);
|
||||
this.contentBrowser.removeEventListener('mozbrowserloadstart', this, true);
|
||||
this.contentBrowser.removeEventListener('mozbrowserselectionchange', this, true);
|
||||
this.contentBrowser.removeEventListener('mozbrowserscrollviewchange', this, true);
|
||||
ppmm.removeMessageListener("content-handler", this);
|
||||
|
||||
UserAgentOverrides.uninit();
|
||||
@ -500,7 +502,12 @@ var shell = {
|
||||
|
||||
this.notifyContentStart();
|
||||
break;
|
||||
|
||||
case 'mozbrowserscrollviewchange':
|
||||
this.sendChromeEvent({
|
||||
type: 'scrollviewchange',
|
||||
detail: evt.detail,
|
||||
});
|
||||
break;
|
||||
case 'mozbrowserselectionchange':
|
||||
// The mozbrowserselectionchange event, may have crossed the chrome-content boundary.
|
||||
// This event always dispatch to shell.js. But the offset we got from this event is
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
const { interfaces: Ci, utils: Cu, classes: Cc } = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/ContentRequestHelper.jsm");
|
||||
Cu.import("resource://gre/modules/MobileIdentityCommon.jsm");
|
||||
Cu.import("resource://gre/modules/MobileIdentityUIGlueCommon.jsm");
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="03d7bcad57ea281869976a9aed0a38849f7c8bc5"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c5d2e2f4ebf5f370d6003517057dcd47493dec90"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="837a62c581254345ad97276386757f775a5872bb"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="20a1521efdac44c8219f00c2414de031891fb464"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
@ -15,17 +15,17 @@
|
||||
<remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
|
||||
<default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
|
||||
<!-- Gonk specific things and forks -->
|
||||
<project name="platform_build" path="build" remote="b2g" revision="4d1e85908d792d9468c4da7040acd191fbb51b40">
|
||||
<project name="platform_build" path="build" remote="b2g" revision="84923f1940625c47ff4c1fdf01b10fde3b7d909e">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="03d7bcad57ea281869976a9aed0a38849f7c8bc5"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c5d2e2f4ebf5f370d6003517057dcd47493dec90"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c058843242068d0df7c107e09da31b53d2e08fa6"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="837a62c581254345ad97276386757f775a5872bb"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="20a1521efdac44c8219f00c2414de031891fb464"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
|
||||
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>
|
||||
|
@ -17,10 +17,10 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="03d7bcad57ea281869976a9aed0a38849f7c8bc5"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c5d2e2f4ebf5f370d6003517057dcd47493dec90"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="837a62c581254345ad97276386757f775a5872bb"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="20a1521efdac44c8219f00c2414de031891fb464"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="03d7bcad57ea281869976a9aed0a38849f7c8bc5"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c5d2e2f4ebf5f370d6003517057dcd47493dec90"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="837a62c581254345ad97276386757f775a5872bb"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="20a1521efdac44c8219f00c2414de031891fb464"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>
|
||||
|
@ -15,17 +15,17 @@
|
||||
<remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
|
||||
<default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
|
||||
<!-- Gonk specific things and forks -->
|
||||
<project name="platform_build" path="build" remote="b2g" revision="4d1e85908d792d9468c4da7040acd191fbb51b40">
|
||||
<project name="platform_build" path="build" remote="b2g" revision="84923f1940625c47ff4c1fdf01b10fde3b7d909e">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="03d7bcad57ea281869976a9aed0a38849f7c8bc5"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c5d2e2f4ebf5f370d6003517057dcd47493dec90"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c058843242068d0df7c107e09da31b53d2e08fa6"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="837a62c581254345ad97276386757f775a5872bb"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="20a1521efdac44c8219f00c2414de031891fb464"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
|
||||
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="3a2947df41a480de1457a6dcdbf46ad0af70d8e0">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="03d7bcad57ea281869976a9aed0a38849f7c8bc5"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c5d2e2f4ebf5f370d6003517057dcd47493dec90"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="837a62c581254345ad97276386757f775a5872bb"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="20a1521efdac44c8219f00c2414de031891fb464"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
@ -17,10 +17,10 @@
|
||||
</project>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="03d7bcad57ea281869976a9aed0a38849f7c8bc5"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c5d2e2f4ebf5f370d6003517057dcd47493dec90"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="837a62c581254345ad97276386757f775a5872bb"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="20a1521efdac44c8219f00c2414de031891fb464"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -4,6 +4,6 @@
|
||||
"remote": "",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "89fc79354058663937beda2c0eb657e87354a872",
|
||||
"revision": "15291949ab37f96d1d1e30bb890a2604b4454894",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -13,16 +13,16 @@
|
||||
<remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
|
||||
<default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
|
||||
<!-- Gonk specific things and forks -->
|
||||
<project name="platform_build" path="build" remote="b2g" revision="4d1e85908d792d9468c4da7040acd191fbb51b40">
|
||||
<project name="platform_build" path="build" remote="b2g" revision="84923f1940625c47ff4c1fdf01b10fde3b7d909e">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="03d7bcad57ea281869976a9aed0a38849f7c8bc5"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c5d2e2f4ebf5f370d6003517057dcd47493dec90"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="837a62c581254345ad97276386757f775a5872bb"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="20a1521efdac44c8219f00c2414de031891fb464"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
|
||||
<project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
|
||||
|
@ -11,11 +11,11 @@
|
||||
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
|
||||
<default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
|
||||
<!-- Gonk specific things and forks -->
|
||||
<project name="platform_build" path="build" remote="b2g" revision="4d1e85908d792d9468c4da7040acd191fbb51b40">
|
||||
<project name="platform_build" path="build" remote="b2g" revision="84923f1940625c47ff4c1fdf01b10fde3b7d909e">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="03d7bcad57ea281869976a9aed0a38849f7c8bc5"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c5d2e2f4ebf5f370d6003517057dcd47493dec90"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
@ -17,10 +17,10 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="03d7bcad57ea281869976a9aed0a38849f7c8bc5"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c5d2e2f4ebf5f370d6003517057dcd47493dec90"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="837a62c581254345ad97276386757f775a5872bb"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="20a1521efdac44c8219f00c2414de031891fb464"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -13,16 +13,16 @@
|
||||
<remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
|
||||
<default remote="caf" revision="ics_chocolate_rb4.2" sync-j="4"/>
|
||||
<!-- Gonk specific things and forks -->
|
||||
<project name="platform_build" path="build" remote="b2g" revision="4d1e85908d792d9468c4da7040acd191fbb51b40">
|
||||
<project name="platform_build" path="build" remote="b2g" revision="84923f1940625c47ff4c1fdf01b10fde3b7d909e">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="03d7bcad57ea281869976a9aed0a38849f7c8bc5"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c5d2e2f4ebf5f370d6003517057dcd47493dec90"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="5883a99b6528ced9dafaed8d3ca2405fb285537e"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="837a62c581254345ad97276386757f775a5872bb"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="20a1521efdac44c8219f00c2414de031891fb464"/>
|
||||
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
|
||||
|
@ -305,6 +305,8 @@ nsInProcessTabChildGlobal::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
nsresult
|
||||
nsInProcessTabChildGlobal::InitTabChildGlobal()
|
||||
{
|
||||
// If you change this, please change GetCompartmentName() in XPCJSRuntime.cpp
|
||||
// accordingly.
|
||||
nsAutoCString id;
|
||||
id.AssignLiteral("inProcessTabChildGlobal");
|
||||
nsIURI* uri = mOwner->OwnerDoc()->GetDocumentURI();
|
||||
|
@ -68,7 +68,7 @@
|
||||
#include "nsIChannelPolicy.h"
|
||||
#include "nsChannelPolicy.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "nsObjectFrame.h"
|
||||
#include "nsPluginFrame.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
@ -860,7 +860,7 @@ nsObjectLoadingContent::InstantiatePluginInstance(bool aIsLoading)
|
||||
// dangling. (Bug 854082)
|
||||
nsIFrame* frame = thisContent->GetPrimaryFrame();
|
||||
if (frame && mInstanceOwner) {
|
||||
mInstanceOwner->SetFrame(static_cast<nsObjectFrame*>(frame));
|
||||
mInstanceOwner->SetFrame(static_cast<nsPluginFrame*>(frame));
|
||||
|
||||
// Bug 870216 - Adobe Reader renders with incorrect dimensions until it gets
|
||||
// a second SetWindow call. This is otherwise redundant.
|
||||
@ -1296,7 +1296,7 @@ nsObjectLoadingContent::HasNewFrame(nsIObjectFrame* aFrame)
|
||||
|
||||
// Otherwise, we're just changing frames
|
||||
// Set up relationship between instance owner and frame.
|
||||
nsObjectFrame *objFrame = static_cast<nsObjectFrame*>(aFrame);
|
||||
nsPluginFrame *objFrame = static_cast<nsPluginFrame*>(aFrame);
|
||||
mInstanceOwner->SetFrame(objFrame);
|
||||
|
||||
return NS_OK;
|
||||
@ -2718,13 +2718,13 @@ nsObjectLoadingContent::GetTypeOfContent(const nsCString& aMIMEType)
|
||||
return eType_Null;
|
||||
}
|
||||
|
||||
nsObjectFrame*
|
||||
nsPluginFrame*
|
||||
nsObjectLoadingContent::GetExistingFrame()
|
||||
{
|
||||
nsCOMPtr<nsIContent> thisContent = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
nsIFrame* frame = thisContent->GetPrimaryFrame();
|
||||
nsIObjectFrame* objFrame = do_QueryFrame(frame);
|
||||
return static_cast<nsObjectFrame*>(objFrame);
|
||||
return static_cast<nsPluginFrame*>(objFrame);
|
||||
}
|
||||
|
||||
void
|
||||
@ -3576,7 +3576,7 @@ nsObjectLoadingContent::GetPluginJSObject(JSContext *cx,
|
||||
JS::MutableHandle<JSObject*> plugin_proto)
|
||||
{
|
||||
// NB: We need an AutoEnterCompartment because we can be called from
|
||||
// nsObjectFrame when the plugin loads after the JS object for our content
|
||||
// nsPluginFrame when the plugin loads after the JS object for our content
|
||||
// node has been created.
|
||||
JSAutoCompartment ac(cx, obj);
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
class nsAsyncInstantiateEvent;
|
||||
class nsStopPluginRunnable;
|
||||
class AutoSetInstantiatingToFalse;
|
||||
class nsObjectFrame;
|
||||
class nsPluginFrame;
|
||||
class nsFrameLoader;
|
||||
class nsXULElement;
|
||||
class nsPluginInstanceOwner;
|
||||
@ -502,7 +502,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
||||
* Gets the frame that's associated with this content node.
|
||||
* Does not flush.
|
||||
*/
|
||||
nsObjectFrame* GetExistingFrame();
|
||||
nsPluginFrame* GetExistingFrame();
|
||||
|
||||
// Helper class for SetupProtoChain
|
||||
class SetupProtoChainRunner MOZ_FINAL : public nsIRunnable
|
||||
|
@ -12,11 +12,11 @@ EXPORTS += [
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'BlankDecoderModule.cpp',
|
||||
'MP4Decoder.cpp',
|
||||
'PlatformDecoderModule.cpp',
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
'MP4Decoder.cpp',
|
||||
'MP4Reader.cpp',
|
||||
]
|
||||
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "nsITimer.h"
|
||||
#include "mozilla/dom/HTMLMediaElement.h"
|
||||
#include "VideoUtils.h"
|
||||
#include "mozilla/dom/power/PowerManagerService.h"
|
||||
#include "mozilla/dom/WakeLock.h"
|
||||
|
||||
#include <binder/IPCThreadState.h>
|
||||
#include <stagefright/foundation/ADebug.h>
|
||||
@ -215,6 +217,7 @@ status_t AudioOffloadPlayer::ChangeState(MediaDecoder::PlayState aState)
|
||||
|
||||
static void ResetCallback(nsITimer* aTimer, void* aClosure)
|
||||
{
|
||||
AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("%s", __FUNCTION__));
|
||||
AudioOffloadPlayer* player = static_cast<AudioOffloadPlayer*>(aClosure);
|
||||
if (player) {
|
||||
player->Reset();
|
||||
@ -227,6 +230,8 @@ void AudioOffloadPlayer::Pause(bool aPlayPendingSamples)
|
||||
|
||||
if (mStarted) {
|
||||
CHECK(mAudioSink.get());
|
||||
WakeLockCreate();
|
||||
|
||||
if (aPlayPendingSamples) {
|
||||
mAudioSink->Stop();
|
||||
} else {
|
||||
@ -252,6 +257,7 @@ status_t AudioOffloadPlayer::Play()
|
||||
if (mResetTimer) {
|
||||
mResetTimer->Cancel();
|
||||
mResetTimer = nullptr;
|
||||
WakeLockRelease();
|
||||
}
|
||||
|
||||
status_t err = OK;
|
||||
@ -281,6 +287,7 @@ status_t AudioOffloadPlayer::Play()
|
||||
|
||||
void AudioOffloadPlayer::Reset()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!mStarted) {
|
||||
return;
|
||||
}
|
||||
@ -323,6 +330,8 @@ void AudioOffloadPlayer::Reset()
|
||||
mStarted = false;
|
||||
mPlaying = false;
|
||||
mStartPosUs = 0;
|
||||
|
||||
WakeLockRelease();
|
||||
}
|
||||
|
||||
status_t AudioOffloadPlayer::SeekTo(int64_t aTimeUs, bool aDispatchSeekEvents)
|
||||
@ -711,4 +720,30 @@ void AudioOffloadPlayer::SetVolume(double aVolume)
|
||||
mAudioSink->SetVolume((float) aVolume);
|
||||
}
|
||||
|
||||
void AudioOffloadPlayer::WakeLockCreate()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("%s", __FUNCTION__));
|
||||
if (!mWakeLock) {
|
||||
nsRefPtr<dom::power::PowerManagerService> pmService =
|
||||
dom::power::PowerManagerService::GetInstance();
|
||||
NS_ENSURE_TRUE_VOID(pmService);
|
||||
|
||||
ErrorResult rv;
|
||||
mWakeLock = pmService->NewWakeLock(NS_LITERAL_STRING("cpu"), nullptr, rv);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioOffloadPlayer::WakeLockRelease()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("%s", __FUNCTION__));
|
||||
if (mWakeLock) {
|
||||
ErrorResult rv;
|
||||
mWakeLock->Unlock(rv);
|
||||
NS_WARN_IF_FALSE(!rv.Failed(), "Failed to unlock the wakelock.");
|
||||
mWakeLock = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -33,6 +33,10 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
class WakeLock;
|
||||
}
|
||||
|
||||
/**
|
||||
* AudioOffloadPlayer adds support for audio tunneling to a digital signal
|
||||
* processor (DSP) in the device chipset. With tunneling, audio decoding is
|
||||
@ -193,6 +197,10 @@ private:
|
||||
// OFFLOAD_PAUSE_MAX_USECS. Used only from main thread so no lock is needed.
|
||||
nsCOMPtr<nsITimer> mResetTimer;
|
||||
|
||||
// To avoid device suspend when mResetTimer is going to be triggered.
|
||||
// Used only from main thread so no lock is needed.
|
||||
nsRefPtr<mozilla::dom::WakeLock> mWakeLock;
|
||||
|
||||
int64_t GetMediaTimeUs();
|
||||
|
||||
// Provide the playback position in microseconds from total number of
|
||||
@ -240,6 +248,9 @@ private:
|
||||
nsresult StartTimeUpdate();
|
||||
nsresult StopTimeUpdate();
|
||||
|
||||
void WakeLockCreate();
|
||||
void WakeLockRelease();
|
||||
|
||||
// Notify end of stream by sending PlaybackEnded event to observer
|
||||
// (i.e.MediaDecoder)
|
||||
void NotifyAudioEOS();
|
||||
|
@ -3056,14 +3056,14 @@ nsDocShell::RemoveWeakScrollObserver(nsIScrollObserver* aObserver)
|
||||
}
|
||||
|
||||
void
|
||||
nsDocShell::NotifyAsyncPanZoomStarted()
|
||||
nsDocShell::NotifyAsyncPanZoomStarted(const mozilla::CSSIntPoint aScrollPos)
|
||||
{
|
||||
nsTObserverArray<nsWeakPtr>::ForwardIterator iter(mScrollObservers);
|
||||
while (iter.HasMore()) {
|
||||
nsWeakPtr ref = iter.GetNext();
|
||||
nsCOMPtr<nsIScrollObserver> obs = do_QueryReferent(ref);
|
||||
if (obs) {
|
||||
obs->AsyncPanZoomStarted();
|
||||
obs->AsyncPanZoomStarted(aScrollPos);
|
||||
} else {
|
||||
mScrollObservers.RemoveElement(ref);
|
||||
}
|
||||
@ -3071,14 +3071,14 @@ nsDocShell::NotifyAsyncPanZoomStarted()
|
||||
}
|
||||
|
||||
void
|
||||
nsDocShell::NotifyAsyncPanZoomStopped()
|
||||
nsDocShell::NotifyAsyncPanZoomStopped(const mozilla::CSSIntPoint aScrollPos)
|
||||
{
|
||||
nsTObserverArray<nsWeakPtr>::ForwardIterator iter(mScrollObservers);
|
||||
while (iter.HasMore()) {
|
||||
nsWeakPtr ref = iter.GetNext();
|
||||
nsCOMPtr<nsIScrollObserver> obs = do_QueryReferent(ref);
|
||||
if (obs) {
|
||||
obs->AsyncPanZoomStopped();
|
||||
obs->AsyncPanZoomStopped(aScrollPos);
|
||||
} else {
|
||||
mScrollObservers.RemoveElement(ref);
|
||||
}
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "nsCRT.h"
|
||||
#include "prtime.h"
|
||||
#include "nsRect.h"
|
||||
#include "Units.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -250,10 +251,10 @@ public:
|
||||
|
||||
// Notify Scroll observers when an async panning/zooming transform
|
||||
// has started being applied
|
||||
void NotifyAsyncPanZoomStarted();
|
||||
void NotifyAsyncPanZoomStarted(const mozilla::CSSIntPoint aScrollPos);
|
||||
// Notify Scroll observers when an async panning/zooming transform
|
||||
// is no longer applied
|
||||
void NotifyAsyncPanZoomStopped();
|
||||
void NotifyAsyncPanZoomStopped(const mozilla::CSSIntPoint aScrollPos);
|
||||
|
||||
// Add new profile timeline markers to this docShell. This will only add
|
||||
// markers if the docShell is currently recording profile timeline markers.
|
||||
|
@ -7,10 +7,11 @@
|
||||
#define nsIScrollObserver_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "Units.h"
|
||||
|
||||
#define NS_ISCROLLOBSERVER_IID \
|
||||
{ 0x03465b77, 0x9ce2, 0x4d19, \
|
||||
{ 0xb2, 0xf6, 0x82, 0xae, 0xee, 0x85, 0xc3, 0xbf } }
|
||||
{ 0x00bc10e3, 0xaa59, 0x4aa3, \
|
||||
{ 0x88, 0xe9, 0x43, 0x0a, 0x01, 0xa3, 0x88, 0x04 } }
|
||||
|
||||
class nsIScrollObserver : public nsISupports
|
||||
{
|
||||
@ -23,14 +24,16 @@ public:
|
||||
virtual void ScrollPositionChanged() = 0;
|
||||
|
||||
/**
|
||||
* Called when an async panning/zooming transform has started being applied.
|
||||
* Called when an async panning/zooming transform has started being applied
|
||||
* and passed the scroll offset
|
||||
*/
|
||||
virtual void AsyncPanZoomStarted(){};
|
||||
virtual void AsyncPanZoomStarted(const mozilla::CSSIntPoint scrollPos){};
|
||||
|
||||
/**
|
||||
* Called when an async panning/zooming transform is no longer applied.
|
||||
* Called when an async panning/zooming transform is no longer applied
|
||||
* and passed the scroll offset
|
||||
*/
|
||||
virtual void AsyncPanZoomStopped(){};
|
||||
virtual void AsyncPanZoomStopped(const mozilla::CSSIntPoint scrollPos){};
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIScrollObserver, NS_ISCROLLOBSERVER_IID)
|
||||
|
@ -114,12 +114,8 @@ Animation::GetComputedTimingAt(const Nullable<TimeDuration>& aLocalTime,
|
||||
bool isEndOfFinalIteration = false;
|
||||
|
||||
// Get the normalized time within the active interval.
|
||||
TimeDuration activeTime;
|
||||
// FIXME: The following check that the active duration is not equal to Forever
|
||||
// is a temporary workaround to avoid overflow and should be removed once
|
||||
// bug 1039924 is fixed.
|
||||
if (result.mActiveDuration != TimeDuration::Forever() &&
|
||||
localTime >= aTiming.mDelay + result.mActiveDuration) {
|
||||
StickyTimeDuration activeTime;
|
||||
if (localTime >= aTiming.mDelay + result.mActiveDuration) {
|
||||
result.mPhase = ComputedTiming::AnimationPhase_After;
|
||||
if (!aTiming.FillsForwards()) {
|
||||
// The animation isn't active or filling at this time.
|
||||
@ -148,10 +144,10 @@ Animation::GetComputedTimingAt(const Nullable<TimeDuration>& aLocalTime,
|
||||
}
|
||||
|
||||
// Get the position within the current iteration.
|
||||
TimeDuration iterationTime;
|
||||
StickyTimeDuration iterationTime;
|
||||
if (aTiming.mIterationDuration != zeroDuration) {
|
||||
iterationTime = isEndOfFinalIteration
|
||||
? aTiming.mIterationDuration
|
||||
? StickyTimeDuration(aTiming.mIterationDuration)
|
||||
: activeTime % aTiming.mIterationDuration;
|
||||
} /* else, iterationTime is zero */
|
||||
|
||||
@ -215,19 +211,20 @@ Animation::GetComputedTimingAt(const Nullable<TimeDuration>& aLocalTime,
|
||||
return result;
|
||||
}
|
||||
|
||||
TimeDuration
|
||||
StickyTimeDuration
|
||||
Animation::ActiveDuration(const AnimationTiming& aTiming)
|
||||
{
|
||||
if (aTiming.mIterationCount == mozilla::PositiveInfinity<float>()) {
|
||||
// An animation that repeats forever has an infinite active duration
|
||||
// unless its iteration duration is zero, in which case it has a zero
|
||||
// active duration.
|
||||
const TimeDuration zeroDuration;
|
||||
const StickyTimeDuration zeroDuration;
|
||||
return aTiming.mIterationDuration == zeroDuration
|
||||
? zeroDuration
|
||||
: TimeDuration::Forever();
|
||||
: StickyTimeDuration::Forever();
|
||||
}
|
||||
return aTiming.mIterationDuration.MultDouble(aTiming.mIterationCount);
|
||||
return StickyTimeDuration(
|
||||
aTiming.mIterationDuration.MultDouble(aTiming.mIterationCount));
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsIDocument.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/StickyTimeDuration.h"
|
||||
#include "mozilla/StyleAnimationValue.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/dom/Nullable.h"
|
||||
@ -61,8 +62,9 @@ struct ComputedTiming
|
||||
static const double kNullTimeFraction;
|
||||
|
||||
// The total duration of the animation including all iterations.
|
||||
// Will equal TimeDuration::Forever() if the animation repeats indefinitely.
|
||||
TimeDuration mActiveDuration;
|
||||
// Will equal StickyTimeDuration::Forever() if the animation repeats
|
||||
// indefinitely.
|
||||
StickyTimeDuration mActiveDuration;
|
||||
|
||||
// Will be kNullTimeFraction if the animation is neither animating nor
|
||||
// filling at the sampled time.
|
||||
@ -205,7 +207,8 @@ public:
|
||||
}
|
||||
|
||||
// Return the duration of the active interval for the given timing parameters.
|
||||
static TimeDuration ActiveDuration(const AnimationTiming& aTiming);
|
||||
static StickyTimeDuration
|
||||
ActiveDuration(const AnimationTiming& aTiming);
|
||||
|
||||
// After transitions finish they need to be retained for one throttle-able
|
||||
// cycle (for reasons see explanation in
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "mozilla/dom/SettingChangeNotificationBinding.h"
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include "nsJSUtils.h"
|
||||
@ -801,48 +802,33 @@ AudioChannelService::Observe(nsISupports* aSubject, const char* aTopic, const ch
|
||||
// To process the volume control on each audio channel according to
|
||||
// change of settings
|
||||
else if (!strcmp(aTopic, "mozsettings-changed")) {
|
||||
AutoSafeJSContext cx;
|
||||
nsDependentString dataStr(aData);
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
if (!JS_ParseJSON(cx, dataStr.get(), dataStr.Length(), &val) ||
|
||||
!val.isObject()) {
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
JSContext* cx = jsapi.cx();
|
||||
RootedDictionary<SettingChangeNotification> setting(cx);
|
||||
if (!WrappedJSToDictionary(cx, aSubject, setting)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, &val.toObject());
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
if (!JS_GetProperty(cx, obj, "key", &key) ||
|
||||
!key.isString()) {
|
||||
if (!StringBeginsWith(setting.mKey, NS_LITERAL_STRING("audio.volume."))) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::Rooted<JSString*> jsKey(cx, JS::ToString(cx, key));
|
||||
if (!jsKey) {
|
||||
if (!setting.mValue.isNumber()) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsAutoJSString keyStr;
|
||||
if (!keyStr.init(cx, jsKey) || keyStr.Find("audio.volume.", 0, false)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, obj, "value", &value) || !value.isInt32()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsCOMPtr<nsIAudioManager> audioManager = do_GetService(NS_AUDIOMANAGER_CONTRACTID);
|
||||
NS_ENSURE_TRUE(audioManager, NS_OK);
|
||||
|
||||
int32_t index = value.toInt32();
|
||||
if (keyStr.EqualsLiteral("audio.volume.content")) {
|
||||
int32_t index = setting.mValue.toNumber();
|
||||
if (setting.mKey.EqualsLiteral("audio.volume.content")) {
|
||||
audioManager->SetAudioChannelVolume((int32_t)AudioChannel::Content, index);
|
||||
} else if (keyStr.EqualsLiteral("audio.volume.notification")) {
|
||||
} else if (setting.mKey.EqualsLiteral("audio.volume.notification")) {
|
||||
audioManager->SetAudioChannelVolume((int32_t)AudioChannel::Notification, index);
|
||||
} else if (keyStr.EqualsLiteral("audio.volume.alarm")) {
|
||||
} else if (setting.mKey.EqualsLiteral("audio.volume.alarm")) {
|
||||
audioManager->SetAudioChannelVolume((int32_t)AudioChannel::Alarm, index);
|
||||
} else if (keyStr.EqualsLiteral("audio.volume.telephony")) {
|
||||
} else if (setting.mKey.EqualsLiteral("audio.volume.telephony")) {
|
||||
audioManager->SetAudioChannelVolume((int32_t)AudioChannel::Telephony, index);
|
||||
} else if (!keyStr.EqualsLiteral("audio.volume.bt_sco")) {
|
||||
} else if (!setting.mKey.EqualsLiteral("audio.volume.bt_sco")) {
|
||||
// bt_sco is not a valid audio channel so we manipulate it in
|
||||
// AudioManager.cpp. And the others should not be used.
|
||||
// We didn't use MOZ_CRASH or MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE here
|
||||
|
@ -41,6 +41,11 @@ nsPerformanceTiming::nsPerformanceTiming(nsPerformance* aPerformance,
|
||||
{
|
||||
MOZ_ASSERT(aPerformance, "Parent performance object should be provided");
|
||||
SetIsDOMBinding();
|
||||
|
||||
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
|
||||
mZeroTime = 0;
|
||||
}
|
||||
|
||||
// The aHttpChannel argument is null if this nsPerformanceTiming object
|
||||
// is being used for the navigation timing (document) and has a non-null
|
||||
// value for the resource timing (any resources within the page).
|
||||
|
@ -2977,25 +2977,21 @@ CallerSubsumes(JS::Handle<JS::Value> aValue)
|
||||
|
||||
template<class T>
|
||||
inline bool
|
||||
WrappedJSToDictionary(nsISupports* aObject, T& aDictionary)
|
||||
WrappedJSToDictionary(JSContext* aCx, nsISupports* aObject, T& aDictionary)
|
||||
{
|
||||
nsCOMPtr<nsIXPConnectWrappedJS> wrappedObj = do_QueryInterface(aObject);
|
||||
if (!wrappedObj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
|
||||
JSContext* cx = jsapi.cx();
|
||||
JS::Rooted<JSObject*> obj(cx, wrappedObj->GetJSObject());
|
||||
JS::Rooted<JSObject*> obj(aCx, wrappedObj->GetJSObject());
|
||||
if (!obj) {
|
||||
return false;
|
||||
}
|
||||
|
||||
JSAutoCompartment ac(cx, obj);
|
||||
JS::Rooted<JS::Value> v(cx, OBJECT_TO_JSVAL(obj));
|
||||
return aDictionary.Init(cx, v);
|
||||
JSAutoCompartment ac(aCx, obj);
|
||||
JS::Rooted<JS::Value> v(aCx, JS::ObjectValue(*obj));
|
||||
return aDictionary.Init(aCx, v);
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "nsITimer.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "mozilla/dom/SettingChangeNotificationBinding.h"
|
||||
|
||||
#if defined(MOZ_WIDGET_GONK)
|
||||
#include "cutils/properties.h"
|
||||
@ -560,91 +561,44 @@ BluetoothService::HandleStartupSettingsCheck(bool aEnable)
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothService::HandleSettingsChanged(const nsAString& aData)
|
||||
BluetoothService::HandleSettingsChanged(nsISupports* aSubject)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// The string that we're interested in will be a JSON string that looks like:
|
||||
// {"key":"bluetooth.enabled","value":true}
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
if (!cx) {
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
JSContext* cx = jsapi.cx();
|
||||
RootedDictionary<SettingChangeNotification> setting(cx);
|
||||
if (!WrappedJSToDictionary(cx, aSubject, setting)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
if (!JS_ParseJSON(cx, aData.BeginReading(), aData.Length(), &val)) {
|
||||
return JS_ReportPendingException(cx) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (!val.isObject()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, &val.toObject());
|
||||
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
if (!JS_GetProperty(cx, obj, "key", &key)) {
|
||||
MOZ_ASSERT(!JS_IsExceptionPending(cx));
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (!key.isString()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// First, check if the string equals to BLUETOOTH_DEBUGGING_SETTING
|
||||
bool match;
|
||||
if (!JS_StringEqualsAscii(cx, key.toString(), BLUETOOTH_DEBUGGING_SETTING, &match)) {
|
||||
MOZ_ASSERT(!JS_IsExceptionPending(cx));
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (match) {
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, obj, "value", &value)) {
|
||||
MOZ_ASSERT(!JS_IsExceptionPending(cx));
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (!value.isBoolean()) {
|
||||
if (setting.mKey.EqualsASCII(BLUETOOTH_DEBUGGING_SETTING)) {
|
||||
if (!setting.mValue.isBoolean()) {
|
||||
MOZ_ASSERT(false, "Expecting a boolean for 'bluetooth.debugging.enabled'!");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
SWITCH_BT_DEBUG(value.toBoolean());
|
||||
|
||||
SWITCH_BT_DEBUG(setting.mValue.toBoolean());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Second, check if the string is BLUETOOTH_ENABLED_SETTING
|
||||
if (!JS_StringEqualsAscii(cx, key.toString(), BLUETOOTH_ENABLED_SETTING, &match)) {
|
||||
MOZ_ASSERT(!JS_IsExceptionPending(cx));
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!setting.mKey.EqualsASCII(BLUETOOTH_ENABLED_SETTING)) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (!setting.mValue.isBoolean()) {
|
||||
MOZ_ASSERT(false, "Expecting a boolean for 'bluetooth.enabled'!");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (match) {
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, obj, "value", &value)) {
|
||||
MOZ_ASSERT(!JS_IsExceptionPending(cx));
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
sToggleInProgress = true;
|
||||
|
||||
if (!value.isBoolean()) {
|
||||
MOZ_ASSERT(false, "Expecting a boolean for 'bluetooth.enabled'!");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (sToggleInProgress || value.toBoolean() == IsEnabled()) {
|
||||
// Nothing to do here.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
sToggleInProgress = true;
|
||||
|
||||
nsresult rv = StartStopBluetooth(value.toBoolean(), false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
nsresult rv = StartStopBluetooth(setting.mValue.toBoolean(), false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -755,7 +709,7 @@ BluetoothService::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
}
|
||||
|
||||
if (!strcmp(aTopic, MOZSETTINGS_CHANGED_ID)) {
|
||||
return HandleSettingsChanged(nsDependentString(aData));
|
||||
return HandleSettingsChanged(aSubject);
|
||||
}
|
||||
|
||||
if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
|
||||
|
@ -372,7 +372,7 @@ protected:
|
||||
* Called when "mozsettings-changed" observer topic fires.
|
||||
*/
|
||||
nsresult
|
||||
HandleSettingsChanged(const nsAString& aData);
|
||||
HandleSettingsChanged(nsISupports* aSubject);
|
||||
|
||||
/**
|
||||
* Called when XPCOM is shutting down.
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include "nsRadioInterfaceLayer.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/SettingChangeNotificationBinding.h"
|
||||
|
||||
#define MOZSETTINGS_CHANGED_ID "mozsettings-changed"
|
||||
#define AUDIO_VOLUME_BT_SCO_ID "audio.volume.bt_sco"
|
||||
@ -462,7 +464,7 @@ BluetoothHfpManager::Observe(nsISupports* aSubject,
|
||||
const char16_t* aData)
|
||||
{
|
||||
if (!strcmp(aTopic, MOZSETTINGS_CHANGED_ID)) {
|
||||
HandleVolumeChanged(nsDependentString(aData));
|
||||
HandleVolumeChanged(aSubject);
|
||||
} else if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
|
||||
HandleShutdown();
|
||||
} else {
|
||||
@ -561,39 +563,28 @@ public:
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData)
|
||||
BluetoothHfpManager::HandleVolumeChanged(nsISupports* aSubject)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// The string that we're interested in will be a JSON string that looks like:
|
||||
// {"key":"volumeup", "value":10}
|
||||
// {"key":"volumedown", "value":2}
|
||||
JSContext* cx = nsContentUtils::GetSafeJSContext();
|
||||
NS_ENSURE_TRUE_VOID(cx);
|
||||
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
NS_ENSURE_TRUE_VOID(JS_ParseJSON(cx, aData.BeginReading(), aData.Length(), &val));
|
||||
NS_ENSURE_TRUE_VOID(val.isObject());
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, &val.toObject());
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
if (!JS_GetProperty(cx, obj, "key", &key) || !key.isString()) {
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
JSContext* cx = jsapi.cx();
|
||||
RootedDictionary<dom::SettingChangeNotification> setting(cx);
|
||||
if (!WrappedJSToDictionary(cx, aSubject, setting)) {
|
||||
return;
|
||||
}
|
||||
if (!setting.mKey.EqualsASCII(AUDIO_VOLUME_BT_SCO_ID)) {
|
||||
return;
|
||||
}
|
||||
if (!setting.mValue.isNumber()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool match;
|
||||
if (!JS_StringEqualsAscii(cx, key.toString(), AUDIO_VOLUME_BT_SCO_ID, &match) ||
|
||||
!match) {
|
||||
return;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, obj, "value", &value) ||
|
||||
!value.isNumber()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mCurrentVgs = value.toNumber();
|
||||
mCurrentVgs = setting.mValue.toNumber();
|
||||
|
||||
// Adjust volume by headset and we don't have to send volume back to headset
|
||||
if (mReceiveVgsFlag) {
|
||||
|
@ -149,7 +149,7 @@ private:
|
||||
void Cleanup();
|
||||
|
||||
void HandleShutdown();
|
||||
void HandleVolumeChanged(const nsAString& aData);
|
||||
void HandleVolumeChanged(nsISupports* aSubject);
|
||||
void Notify(const hal::BatteryInformation& aBatteryInfo);
|
||||
|
||||
void NotifyConnectionStateChanged(const nsAString& aType);
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISettingsService.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/SettingChangeNotificationBinding.h"
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
#include "nsIDOMIccInfo.h"
|
||||
@ -205,7 +207,7 @@ BluetoothHfpManager::Observe(nsISupports* aSubject,
|
||||
const char16_t* aData)
|
||||
{
|
||||
if (!strcmp(aTopic, MOZSETTINGS_CHANGED_ID)) {
|
||||
HandleVolumeChanged(nsDependentString(aData));
|
||||
HandleVolumeChanged(aSubject);
|
||||
} else if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
|
||||
HandleShutdown();
|
||||
} else {
|
||||
@ -555,7 +557,7 @@ BluetoothHfpManager::NotifyDialer(const nsAString& aCommand)
|
||||
#endif // MOZ_B2G_RIL
|
||||
|
||||
void
|
||||
BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData)
|
||||
BluetoothHfpManager::HandleVolumeChanged(nsISupports* aSubject)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -563,32 +565,21 @@ BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData)
|
||||
// {"key":"volumeup", "value":10}
|
||||
// {"key":"volumedown", "value":2}
|
||||
|
||||
JSContext* cx = nsContentUtils::GetSafeJSContext();
|
||||
NS_ENSURE_TRUE_VOID(cx);
|
||||
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
NS_ENSURE_TRUE_VOID(JS_ParseJSON(cx, aData.BeginReading(), aData.Length(), &val));
|
||||
NS_ENSURE_TRUE_VOID(val.isObject());
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, &val.toObject());
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
if (!JS_GetProperty(cx, obj, "key", &key) || !key.isString()) {
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
JSContext* cx = jsapi.cx();
|
||||
RootedDictionary<SettingChangeNotification> setting(cx);
|
||||
if (!WrappedJSToDictionary(cx, aSubject, setting)) {
|
||||
return;
|
||||
}
|
||||
if (!setting.mKey.EqualsASCII(AUDIO_VOLUME_BT_SCO_ID)) {
|
||||
return;
|
||||
}
|
||||
if (!setting.mValue.isNumber()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool match;
|
||||
if (!JS_StringEqualsAscii(cx, key.toString(), AUDIO_VOLUME_BT_SCO_ID, &match) ||
|
||||
!match) {
|
||||
return;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, obj, "value", &value)||
|
||||
!value.isNumber()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mCurrentVgs = value.toNumber();
|
||||
mCurrentVgs = setting.mValue.toNumber();
|
||||
|
||||
// Adjust volume by headset and we don't have to send volume back to headset
|
||||
if (mReceiveVgsFlag) {
|
||||
|
@ -149,7 +149,7 @@ private:
|
||||
|
||||
BluetoothHfpManager();
|
||||
void HandleShutdown();
|
||||
void HandleVolumeChanged(const nsAString& aData);
|
||||
void HandleVolumeChanged(nsISupports* aSubject);
|
||||
|
||||
bool Init();
|
||||
void Notify(const hal::BatteryInformation& aBatteryInfo);
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "nsITimer.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "mozilla/dom/SettingChangeNotificationBinding.h"
|
||||
|
||||
#if defined(MOZ_WIDGET_GONK)
|
||||
#include "cutils/properties.h"
|
||||
@ -522,60 +523,29 @@ BluetoothService::HandleStartupSettingsCheck(bool aEnable)
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothService::HandleSettingsChanged(const nsAString& aData)
|
||||
BluetoothService::HandleSettingsChanged(nsISupports* aSubject)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// The string that we're interested in will be a JSON string that looks like:
|
||||
// {"key":"bluetooth.enabled","value":true}
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
if (!cx) {
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
JSContext* cx = jsapi.cx();
|
||||
RootedDictionary<SettingChangeNotification> setting(cx);
|
||||
if (!WrappedJSToDictionary(cx, aSubject, setting)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
if (!JS_ParseJSON(cx, aData.BeginReading(), aData.Length(), &val)) {
|
||||
return JS_ReportPendingException(cx) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (!val.isObject()) {
|
||||
if (!setting.mKey.EqualsASCII(BLUETOOTH_DEBUGGING_SETTING)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, &val.toObject());
|
||||
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
if (!JS_GetProperty(cx, obj, "key", &key)) {
|
||||
MOZ_ASSERT(!JS_IsExceptionPending(cx));
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!setting.mValue.isBoolean()) {
|
||||
MOZ_ASSERT(false, "Expecting a boolean for 'bluetooth.debugging.enabled'!");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (!key.isString()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Check whether the string is BLUETOOTH_DEBUGGING_SETTING
|
||||
bool match;
|
||||
if (!JS_StringEqualsAscii(cx, key.toString(), BLUETOOTH_DEBUGGING_SETTING, &match)) {
|
||||
MOZ_ASSERT(!JS_IsExceptionPending(cx));
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (match) {
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, obj, "value", &value)) {
|
||||
MOZ_ASSERT(!JS_IsExceptionPending(cx));
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (!value.isBoolean()) {
|
||||
MOZ_ASSERT(false, "Expecting a boolean for 'bluetooth.debugging.enabled'!");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
SWITCH_BT_DEBUG(value.toBoolean());
|
||||
}
|
||||
SWITCH_BT_DEBUG(setting.mValue.toBoolean());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -686,7 +656,7 @@ BluetoothService::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
}
|
||||
|
||||
if (!strcmp(aTopic, MOZSETTINGS_CHANGED_ID)) {
|
||||
return HandleSettingsChanged(nsDependentString(aData));
|
||||
return HandleSettingsChanged(aSubject);
|
||||
}
|
||||
|
||||
if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
|
||||
|
@ -371,7 +371,7 @@ protected:
|
||||
* Called when "mozsettings-changed" observer topic fires.
|
||||
*/
|
||||
nsresult
|
||||
HandleSettingsChanged(const nsAString& aData);
|
||||
HandleSettingsChanged(nsISupports* aSubject);
|
||||
|
||||
/**
|
||||
* Called when XPCOM is shutting down.
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "nsRadioInterfaceLayer.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/dom/SettingChangeNotificationBinding.h"
|
||||
|
||||
#define MOZSETTINGS_CHANGED_ID "mozsettings-changed"
|
||||
#define AUDIO_VOLUME_BT_SCO_ID "audio.volume.bt_sco"
|
||||
@ -465,7 +466,7 @@ BluetoothHfpManager::Observe(nsISupports* aSubject,
|
||||
const char16_t* aData)
|
||||
{
|
||||
if (!strcmp(aTopic, MOZSETTINGS_CHANGED_ID)) {
|
||||
HandleVolumeChanged(nsDependentString(aData));
|
||||
HandleVolumeChanged(aSubject);
|
||||
} else if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
|
||||
HandleShutdown();
|
||||
} else {
|
||||
@ -564,39 +565,29 @@ public:
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData)
|
||||
BluetoothHfpManager::HandleVolumeChanged(nsISupports* aSubject)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// The string that we're interested in will be a JSON string that looks like:
|
||||
// {"key":"volumeup", "value":10}
|
||||
// {"key":"volumedown", "value":2}
|
||||
JSContext* cx = nsContentUtils::GetSafeJSContext();
|
||||
NS_ENSURE_TRUE_VOID(cx);
|
||||
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
NS_ENSURE_TRUE_VOID(JS_ParseJSON(cx, aData.BeginReading(), aData.Length(), &val));
|
||||
NS_ENSURE_TRUE_VOID(val.isObject());
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, &val.toObject());
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
if (!JS_GetProperty(cx, obj, "key", &key) || !key.isString()) {
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
JSContext* cx = jsapi.cx();
|
||||
RootedDictionary<dom::SettingChangeNotification> setting(cx);
|
||||
if (!WrappedJSToDictionary(cx, aSubject, setting)) {
|
||||
return;
|
||||
}
|
||||
if (!setting.mKey.EqualsASCII(AUDIO_VOLUME_BT_SCO_ID)) {
|
||||
return;
|
||||
}
|
||||
if (!setting.mValue.isNumber()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool match;
|
||||
if (!JS_StringEqualsAscii(cx, key.toString(), AUDIO_VOLUME_BT_SCO_ID, &match) ||
|
||||
!match) {
|
||||
return;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, obj, "value", &value) ||
|
||||
!value.isNumber()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mCurrentVgs = value.toNumber();
|
||||
mCurrentVgs = setting.mValue.toNumber();
|
||||
|
||||
// Adjust volume by headset and we don't have to send volume back to headset
|
||||
if (mReceiveVgsFlag) {
|
||||
|
@ -147,7 +147,7 @@ private:
|
||||
bool Init();
|
||||
|
||||
void HandleShutdown();
|
||||
void HandleVolumeChanged(const nsAString& aData);
|
||||
void HandleVolumeChanged(nsISupports* aSubject);
|
||||
void Notify(const hal::BatteryInformation& aBatteryInfo);
|
||||
|
||||
void NotifyConnectionStateChanged(const nsAString& aType);
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISettingsService.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "mozilla/dom/SettingChangeNotificationBinding.h"
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
#include "nsIDOMIccInfo.h"
|
||||
@ -205,7 +206,7 @@ BluetoothHfpManager::Observe(nsISupports* aSubject,
|
||||
const char16_t* aData)
|
||||
{
|
||||
if (!strcmp(aTopic, MOZSETTINGS_CHANGED_ID)) {
|
||||
HandleVolumeChanged(nsDependentString(aData));
|
||||
HandleVolumeChanged(aSubject);
|
||||
} else if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
|
||||
HandleShutdown();
|
||||
} else {
|
||||
@ -555,7 +556,7 @@ BluetoothHfpManager::NotifyDialer(const nsAString& aCommand)
|
||||
#endif // MOZ_B2G_RIL
|
||||
|
||||
void
|
||||
BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData)
|
||||
BluetoothHfpManager::HandleVolumeChanged(nsISupports* aSubject)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -563,32 +564,21 @@ BluetoothHfpManager::HandleVolumeChanged(const nsAString& aData)
|
||||
// {"key":"volumeup", "value":10}
|
||||
// {"key":"volumedown", "value":2}
|
||||
|
||||
JSContext* cx = nsContentUtils::GetSafeJSContext();
|
||||
NS_ENSURE_TRUE_VOID(cx);
|
||||
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
NS_ENSURE_TRUE_VOID(JS_ParseJSON(cx, aData.BeginReading(), aData.Length(), &val));
|
||||
NS_ENSURE_TRUE_VOID(val.isObject());
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, &val.toObject());
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
if (!JS_GetProperty(cx, obj, "key", &key) || !key.isString()) {
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
JSContext* cx = jsapi.cx();
|
||||
RootedDictionary<dom::SettingChangeNotification> setting(cx);
|
||||
if (!WrappedJSToDictionary(cx, aSubject, setting)) {
|
||||
return;
|
||||
}
|
||||
if (!setting.mKey.EqualsASCII(AUDIO_VOLUME_BT_SCO_ID)) {
|
||||
return;
|
||||
}
|
||||
if (!setting.mValue.isNumber()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool match;
|
||||
if (!JS_StringEqualsAscii(cx, key.toString(), AUDIO_VOLUME_BT_SCO_ID, &match) ||
|
||||
!match) {
|
||||
return;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, obj, "value", &value)||
|
||||
!value.isNumber()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mCurrentVgs = value.toNumber();
|
||||
mCurrentVgs = setting.mValue.toNumber();
|
||||
|
||||
// Adjust volume by headset and we don't have to send volume back to headset
|
||||
if (mReceiveVgsFlag) {
|
||||
|
@ -149,7 +149,7 @@ private:
|
||||
|
||||
BluetoothHfpManager();
|
||||
void HandleShutdown();
|
||||
void HandleVolumeChanged(const nsAString& aData);
|
||||
void HandleVolumeChanged(nsISupports* aSubject);
|
||||
|
||||
bool Init();
|
||||
void Notify(const hal::BatteryInformation& aBatteryInfo);
|
||||
|
@ -221,6 +221,11 @@ BrowserElementChild.prototype = {
|
||||
/* useCapture = */ false,
|
||||
/* wantsUntrusted = */ false);
|
||||
|
||||
addEventListener('scrollviewchange',
|
||||
this._ScrollViewChangeHandler.bind(this),
|
||||
/* useCapture = */ false,
|
||||
/* wantsUntrusted = */ false);
|
||||
|
||||
// This listens to unload events from our message manager, but /not/ from
|
||||
// the |content| window. That's because the window's unload event doesn't
|
||||
// bubble, and we're not using a capturing listener. If we'd used
|
||||
@ -626,6 +631,16 @@ BrowserElementChild.prototype = {
|
||||
sendAsyncMsg('metachange', meta);
|
||||
},
|
||||
|
||||
_ScrollViewChangeHandler: function(e) {
|
||||
e.stopPropagation();
|
||||
let detail = {
|
||||
state: e.state,
|
||||
scrollX: e.scrollX,
|
||||
scrollY: e.scrollY,
|
||||
};
|
||||
sendAsyncMsg('scrollviewchange', detail);
|
||||
},
|
||||
|
||||
_selectionChangeHandler: function(e) {
|
||||
e.stopPropagation();
|
||||
let boundingClientRect = e.boundingClientRect;
|
||||
@ -666,7 +681,7 @@ BrowserElementChild.prototype = {
|
||||
currentWindow = currentWindow.parent;
|
||||
}
|
||||
|
||||
sendAsyncMsg("selectionchange", detail);
|
||||
sendAsyncMsg('selectionchange', detail);
|
||||
},
|
||||
|
||||
_themeColorChangedHandler: function(eventType, target) {
|
||||
|
@ -255,7 +255,8 @@ BrowserElementParent.prototype = {
|
||||
"got-visible": this._gotDOMRequestResult,
|
||||
"visibilitychange": this._childVisibilityChange,
|
||||
"got-set-input-method-active": this._gotDOMRequestResult,
|
||||
"selectionchange": this._handleSelectionChange
|
||||
"selectionchange": this._handleSelectionChange,
|
||||
"scrollviewchange": this._handleScrollViewChange
|
||||
};
|
||||
|
||||
let mmSecuritySensitiveCalls = {
|
||||
@ -496,6 +497,12 @@ BrowserElementParent.prototype = {
|
||||
this._frameElement.dispatchEvent(evt);
|
||||
},
|
||||
|
||||
_handleScrollViewChange: function(data) {
|
||||
let evt = this._createEvent("scrollviewchange", data.json,
|
||||
/* cancelable = */ false);
|
||||
this._frameElement.dispatchEvent(evt);
|
||||
},
|
||||
|
||||
_createEvent: function(evtName, detail, cancelable) {
|
||||
// This will have to change if we ever want to send a CustomEvent with null
|
||||
// detail. For now, it's OK.
|
||||
|
@ -51,7 +51,7 @@ GetCameraLog()
|
||||
return sLog;
|
||||
}
|
||||
|
||||
WindowTable* nsDOMCameraManager::sActiveWindows = nullptr;
|
||||
::WindowTable* nsDOMCameraManager::sActiveWindows = nullptr;
|
||||
|
||||
nsDOMCameraManager::nsDOMCameraManager(nsPIDOMWindow* aWindow)
|
||||
: mWindowId(aWindow->WindowID())
|
||||
@ -109,7 +109,7 @@ nsDOMCameraManager::CreateInstance(nsPIDOMWindow* aWindow)
|
||||
{
|
||||
// Initialize the shared active window tracker
|
||||
if (!sActiveWindows) {
|
||||
sActiveWindows = new WindowTable();
|
||||
sActiveWindows = new ::WindowTable();
|
||||
}
|
||||
|
||||
nsRefPtr<nsDOMCameraManager> cameraManager =
|
||||
|
@ -13,7 +13,7 @@ EXPORTS += [
|
||||
'DOMCameraManager.h',
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
UNIFIED_SOURCES += [
|
||||
'CameraControlImpl.cpp',
|
||||
'CameraPreferences.cpp',
|
||||
'CameraPreviewMediaStream.cpp',
|
||||
@ -38,7 +38,7 @@ if CONFIG['MOZ_B2G_CAMERA']:
|
||||
'TestGonkCameraHardware.cpp',
|
||||
]
|
||||
else:
|
||||
SOURCES += [
|
||||
UNIFIED_SOURCES += [
|
||||
'FallbackCameraControl.cpp',
|
||||
'FallbackCameraManager.cpp',
|
||||
]
|
||||
|
@ -3103,7 +3103,7 @@ struct MOZ_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcess
|
||||
|
||||
virtual void SetText(const char16_t* text, int32_t length, nsBidiDirection direction)
|
||||
{
|
||||
mFontgrp->UpdateFontList(); // ensure user font generation is current
|
||||
mFontgrp->UpdateUserFonts(); // ensure user font generation is current
|
||||
mTextRun = mFontgrp->MakeTextRun(text,
|
||||
length,
|
||||
mThebes,
|
||||
@ -3455,9 +3455,9 @@ CanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
|
||||
processor.mPt.x -= anchorX * totalWidth;
|
||||
|
||||
// offset pt.y based on text baseline
|
||||
processor.mFontgrp->UpdateFontList(); // ensure user font generation is current
|
||||
NS_ASSERTION(processor.mFontgrp->FontListLength()>0, "font group contains no fonts");
|
||||
const gfxFont::Metrics& fontMetrics = processor.mFontgrp->GetFontAt(0)->GetMetrics();
|
||||
processor.mFontgrp->UpdateUserFonts(); // ensure user font generation is current
|
||||
const gfxFont::Metrics& fontMetrics =
|
||||
processor.mFontgrp->GetFirstValidFont()->GetMetrics();
|
||||
|
||||
gfxFloat anchorY;
|
||||
|
||||
|
@ -3,6 +3,8 @@ support-files =
|
||||
webgl-mochitest/driver-info.js
|
||||
webgl-mochitest/webgl-util.js
|
||||
|
||||
[webgl-mochitest/test-backbuffer-channels.html]
|
||||
[webgl-mochitest/test-hidden-alpha.html]
|
||||
[webgl-mochitest/test_depth_readpixels.html]
|
||||
[webgl-mochitest/test_draw.html]
|
||||
[webgl-mochitest/test_fb_param.html]
|
||||
|
@ -9,7 +9,7 @@ extDotPos = mochiPath.find('.html')
|
||||
assert extDotPos != -1, 'mochitest target must be an html doc.'
|
||||
|
||||
testPath = mochiPath[:extDotPos] + '.solo.html'
|
||||
|
||||
|
||||
def ReadLocalFile(include):
|
||||
incPath = os.path.dirname(mochiPath)
|
||||
filePath = os.path.join(incPath, include)
|
||||
@ -31,22 +31,29 @@ def ReadLocalFile(include):
|
||||
kSimpleTestReplacement = '''\n
|
||||
<script>
|
||||
// SimpleTest.js replacement
|
||||
function ok(val, text) {
|
||||
|
||||
function debug(text) {
|
||||
var elem = document.getElementById('mochi-to-testcase-output');
|
||||
elem.innerHTML += '\\n<br/>\\n' + text;
|
||||
}
|
||||
|
||||
function ok(val, text) {
|
||||
var status = val ? 'Test <font color=\\'green\\'>passed</font>: '
|
||||
: 'Test <font color=\\'red\\' >FAILED</font>: ';
|
||||
elem.innerHTML += '\\n<br/>\\n' + status + text;
|
||||
debug(status + text);
|
||||
}
|
||||
|
||||
function todo(val, text) {
|
||||
ok(!val, 'Todo: ' + text);
|
||||
var status = val ? 'Test <font color=\\'orange\\'>UNEXPECTED PASS</font>: '
|
||||
: 'Test <font color=\\'blue\\' >todo</font>: ';
|
||||
debug(status + text);
|
||||
}
|
||||
</script>
|
||||
<div id='mochi-to-testcase-output'></div>
|
||||
\n'''
|
||||
|
||||
fin = open(mochiPath, 'r')
|
||||
fout = open(testPath, 'w')
|
||||
fin = open(mochiPath, 'rb')
|
||||
fout = open(testPath, 'wb')
|
||||
includePattern = re.compile('<script\\s*src=[\'"](.*)\\.js[\'"]>\\s*</script>')
|
||||
cssPattern = re.compile('<link\\s*rel=[\'"]stylesheet[\'"]\\s*href=[\'"]([^=>]*)[\'"]>')
|
||||
for line in fin:
|
||||
@ -54,7 +61,7 @@ for line in fin:
|
||||
for css in cssPattern.findall(line):
|
||||
skipLine = True
|
||||
print('Ignoring stylesheet: ' + css)
|
||||
|
||||
|
||||
for inc in includePattern.findall(line):
|
||||
skipLine = True
|
||||
if inc == '/MochiKit/MochiKit':
|
||||
@ -64,7 +71,7 @@ for line in fin:
|
||||
print('Injecting SimpleTest replacement')
|
||||
fout.write(kSimpleTestReplacement);
|
||||
continue
|
||||
|
||||
|
||||
incData = ReadLocalFile(inc + '.js')
|
||||
if not incData:
|
||||
print('Warning: Unknown JS file ignored: ' + inc + '.js')
|
||||
@ -78,7 +85,7 @@ for line in fin:
|
||||
|
||||
if skipLine:
|
||||
continue
|
||||
|
||||
|
||||
fout.write(line)
|
||||
continue
|
||||
|
||||
|
111
dom/canvas/test/webgl-mochitest/test-backbuffer-channels.html
Normal file
111
dom/canvas/test/webgl-mochitest/test-backbuffer-channels.html
Normal file
@ -0,0 +1,111 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>WebGL test: bug 958723</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css">
|
||||
<script src="driver-info.js"></script>
|
||||
<script src="webgl-util.js"></script>
|
||||
<body>
|
||||
<script>
|
||||
|
||||
function TestAttribs(attribs) {
|
||||
debug('Testing attribs: ' + JSON.stringify(attribs));
|
||||
var canvas = document.createElement('canvas');
|
||||
var gl = canvas.getContext('experimental-webgl', attribs);
|
||||
ok(gl, 'No tested attribs should result in failure to create a context');
|
||||
if (!gl)
|
||||
return;
|
||||
|
||||
var actual = gl.getContextAttributes();
|
||||
|
||||
ok(actual.alpha == attribs.alpha,
|
||||
'Resulting `alpha` should match request.');
|
||||
ok(actual.premultipliedAlpha == attribs.premultipliedAlpha,
|
||||
'Resulting `premultipliedAlpha` should match request.');
|
||||
ok(actual.preserveDrawingBuffer == attribs.preserveDrawingBuffer,
|
||||
'Resulting `preserveDrawingBuffer` should match request.');
|
||||
|
||||
// "The depth, stencil and antialias attributes, when set to true, are
|
||||
// requests, not requirements."
|
||||
if (!attribs.antialias) {
|
||||
ok(!actual.antialias, 'No `antialias` if not requested.');
|
||||
}
|
||||
if (!attribs.depth) {
|
||||
ok(!actual.depth, 'No `depth` if not requested.');
|
||||
}
|
||||
if (!attribs.stencil) {
|
||||
ok(!actual.stencil, 'No `stencil` if not requested.');
|
||||
}
|
||||
|
||||
var hasAlpha = !!gl.getParameter(gl.ALPHA_BITS);
|
||||
var hasDepth = !!gl.getParameter(gl.DEPTH_BITS);
|
||||
var hasStencil = !!gl.getParameter(gl.STENCIL_BITS);
|
||||
var hasAntialias = !!gl.getParameter(gl.SAMPLES);
|
||||
|
||||
ok(hasAlpha == actual.alpha, 'Bits should match `alpha` attrib.');
|
||||
ok(hasAntialias == actual.antialias, 'Bits should match `antialias` attrib.');
|
||||
ok(hasDepth == actual.depth, 'Bits should match `depth` attrib.');
|
||||
ok(hasStencil == actual.stencil, 'Bits should match `stencil` attrib.');
|
||||
}
|
||||
|
||||
function CloneAttribs(attribs) {
|
||||
return {
|
||||
alpha: attribs.alpha,
|
||||
antialias: attribs.antialias,
|
||||
depth: attribs.depth,
|
||||
premultipliedAlpha: attribs.premultipliedAlpha,
|
||||
preserveDrawingBuffer: attribs.preserveDrawingBuffer,
|
||||
stencil: attribs.stencil,
|
||||
};
|
||||
}
|
||||
|
||||
function SplitForAttrib(list, attrib) {
|
||||
var ret = [];
|
||||
|
||||
for (var i in list) {
|
||||
var cur = list[i];
|
||||
if (cur[attrib])
|
||||
throw 'Attrib is already true.';
|
||||
|
||||
var clone = CloneAttribs(cur);
|
||||
clone[attrib] = true;
|
||||
|
||||
ret.push(cur);
|
||||
ret.push(clone);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
function GenAttribList() {
|
||||
var base = {
|
||||
alpha: false,
|
||||
antialias: false,
|
||||
depth: false,
|
||||
premultipliedAlpha: false,
|
||||
preserveDrawingBuffer: false,
|
||||
stencil: false,
|
||||
};
|
||||
var list = [base];
|
||||
list = SplitForAttrib(list, 'alpha');
|
||||
list = SplitForAttrib(list, 'antialias');
|
||||
list = SplitForAttrib(list, 'depth');
|
||||
list = SplitForAttrib(list, 'premultipliedAlpha');
|
||||
list = SplitForAttrib(list, 'preserveDrawingBuffer');
|
||||
list = SplitForAttrib(list, 'stencil');
|
||||
|
||||
if (list.length != 1<<6)
|
||||
throw 'Attribs list length wrong: ' + list.length;
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
var list = GenAttribList();
|
||||
for (var i in list) {
|
||||
var attribs = list[i];
|
||||
TestAttribs(attribs);
|
||||
}
|
||||
|
||||
ok(true, 'Test complete.');
|
||||
|
||||
</script>
|
||||
|
153
dom/canvas/test/webgl-mochitest/test-hidden-alpha.html
Normal file
153
dom/canvas/test/webgl-mochitest/test-hidden-alpha.html
Normal file
@ -0,0 +1,153 @@
|
||||
<!DOCTYPE HTML>
|
||||
<title>WebGL test: Hidden alpha on no-alpha contexts</title>
|
||||
<script src='/tests/SimpleTest/SimpleTest.js'></script>
|
||||
<link rel='stylesheet' href='/tests/SimpleTest/test.css'>
|
||||
<script src='driver-info.js'></script>
|
||||
<script src='webgl-util.js'></script>
|
||||
<body>
|
||||
<script id='vs' type='x-shader/x-vertex'>
|
||||
attribute vec2 aPosCoord;
|
||||
|
||||
void main(void) {
|
||||
gl_Position = vec4(aPosCoord, 0.0, 1.0);
|
||||
}
|
||||
</script>
|
||||
|
||||
<script id='fs' type='x-shader/x-fragment'>
|
||||
precision mediump float;
|
||||
|
||||
void main(void) {
|
||||
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
</script>
|
||||
<canvas id='canvas' style='border: none;' width='100' height='100'></canvas>
|
||||
<script>
|
||||
|
||||
var posCoords_arr = new Float32Array(2 * 4);
|
||||
var posCoords_buff = null;
|
||||
function DrawQuad(gl, prog, x0, y0, x1, y1) {
|
||||
gl.useProgram(prog);
|
||||
|
||||
if (!posCoords_buff) {
|
||||
posCoords_buff = gl.createBuffer();
|
||||
}
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, posCoords_buff);
|
||||
posCoords_arr[0] = x0;
|
||||
posCoords_arr[1] = y0;
|
||||
|
||||
posCoords_arr[2] = x1;
|
||||
posCoords_arr[3] = y0;
|
||||
|
||||
posCoords_arr[4] = x0;
|
||||
posCoords_arr[5] = y1;
|
||||
|
||||
posCoords_arr[6] = x1;
|
||||
posCoords_arr[7] = y1;
|
||||
gl.bufferData(gl.ARRAY_BUFFER, posCoords_arr, gl.STREAM_DRAW);
|
||||
|
||||
gl.enableVertexAttribArray(prog.aPosCoord);
|
||||
gl.vertexAttribPointer(prog.aPosCoord, 2, gl.FLOAT, false, 0, 0);
|
||||
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
function DrawSquare(gl, prog, size) {
|
||||
DrawQuad(gl, prog, -size, -size, size, size);
|
||||
}
|
||||
|
||||
function Reset(gl) {
|
||||
gl.canvas.width += 1;
|
||||
gl.canvas.width -= 1;
|
||||
}
|
||||
|
||||
function ReadCenterPixel(gl) {
|
||||
var w = gl.drawingbufferWidth;
|
||||
var h = gl.drawingbufferHeight;
|
||||
var ret = new Uint8Array(4);
|
||||
gl.readPixels(w/2, h/2, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
function Test(gl, prog) {
|
||||
gl.enable(gl.BLEND);
|
||||
gl.blendFunc(gl.ZERO, gl.DST_ALPHA);
|
||||
|
||||
var iColor = 64;
|
||||
var fColor = iColor / 255.0;
|
||||
|
||||
//////////////////
|
||||
|
||||
debug('clear(R,G,B,0)');
|
||||
|
||||
Reset(gl);
|
||||
|
||||
gl.clearColor(fColor, fColor, fColor, 0.0);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
|
||||
var dataURL_pre = gl.canvas.toDataURL();
|
||||
//console.log('Before blending: ' + dataURL_pre);
|
||||
|
||||
DrawSquare(gl, prog, 0.7);
|
||||
|
||||
var pixel = ReadCenterPixel(gl);
|
||||
ok(pixel[0] == iColor &&
|
||||
pixel[1] == iColor &&
|
||||
pixel[2] == iColor, 'Color should be the same.');
|
||||
ok(pixel[3] == 255, 'No-alpha should always readback as 1.0 alpha.');
|
||||
|
||||
var dataURL_post = gl.canvas.toDataURL();
|
||||
//console.log('After blending: ' + dataURL_post);
|
||||
ok(dataURL_post == dataURL_pre,
|
||||
'toDataURL should be unchanged after blending.');
|
||||
|
||||
//////////////////
|
||||
|
||||
debug('mask(R,G,B,0), clear(R,G,B,1)');
|
||||
|
||||
Reset(gl);
|
||||
|
||||
gl.colorMask(true, true, true, false);
|
||||
gl.clearColor(fColor, fColor, fColor, 1.0);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
gl.colorMask(true, true, true, true);
|
||||
|
||||
dataURL_pre = gl.canvas.toDataURL();
|
||||
//console.log('Before blending: ' + dataURL_pre);
|
||||
|
||||
DrawSquare(gl, prog, 0.7);
|
||||
|
||||
var pixel = ReadCenterPixel(gl);
|
||||
ok(pixel[0] == iColor &&
|
||||
pixel[1] == iColor &&
|
||||
pixel[2] == iColor, 'Color should be the same.');
|
||||
ok(pixel[3] == 255, 'No-alpha should always readback as 1.0 alpha.');
|
||||
ok(gl.getError() == 0, 'Should have no errors.');
|
||||
|
||||
dataURL_post = gl.canvas.toDataURL();
|
||||
//console.log('After blending: ' + dataURL_post);
|
||||
ok(dataURL_post == dataURL_pre,
|
||||
'toDataURL should be unchanged after blending.');
|
||||
|
||||
ok(true, 'Test complete.');
|
||||
}
|
||||
|
||||
(function(){
|
||||
var canvas = document.getElementById('canvas');
|
||||
var attribs = {
|
||||
alpha: false,
|
||||
antialias: false,
|
||||
premultipliedAlpha: false,
|
||||
};
|
||||
var gl = canvas.getContext('experimental-webgl', attribs);
|
||||
ok(gl, 'WebGL should work.');
|
||||
ok(gl.getParameter(gl.ALPHA_BITS) == 0, 'Shouldn\'t have alpha bits.');
|
||||
|
||||
var prog = WebGLUtil.createProgramByIds(gl, 'vs', 'fs');
|
||||
ok(prog, 'Program should link.');
|
||||
prog.aPosCoord = gl.getAttribLocation(prog, 'aPosCoord');
|
||||
|
||||
setTimeout(function(){ Test(gl, prog); }, 500);
|
||||
})();
|
||||
|
||||
</script>
|
||||
</body>
|
@ -16,6 +16,8 @@
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsISettingsService.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/SettingChangeNotificationBinding.h"
|
||||
|
||||
#define BAND_87500_108000_kHz 1
|
||||
#define BAND_76000_108000_kHz 2
|
||||
@ -678,9 +680,9 @@ FMRadioService::CancelSeek(FMRadioReplyRunnable* aReplyRunnable)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FMRadioService::Observe(nsISupports * aSubject,
|
||||
const char * aTopic,
|
||||
const char16_t * aData)
|
||||
FMRadioService::Observe(nsISupports* aSubject,
|
||||
const char* aTopic,
|
||||
const char16_t* aData)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(sFMRadioService);
|
||||
@ -691,47 +693,26 @@ FMRadioService::Observe(nsISupports * aSubject,
|
||||
|
||||
// The string that we're interested in will be a JSON string looks like:
|
||||
// {"key":"airplaneMode.enabled","value":true}
|
||||
AutoSafeJSContext cx;
|
||||
const nsDependentString dataStr(aData);
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
if (!JS_ParseJSON(cx, dataStr.get(), dataStr.Length(), &val) ||
|
||||
!val.isObject()) {
|
||||
NS_WARNING("Bad JSON string format.");
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
JSContext* cx = jsapi.cx();
|
||||
RootedDictionary<dom::SettingChangeNotification> setting(cx);
|
||||
if (!WrappedJSToDictionary(cx, aSubject, setting)) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (!setting.mKey.EqualsASCII(SETTING_KEY_AIRPLANEMODE_ENABLED)) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (!setting.mValue.isBoolean()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, &val.toObject());
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
if (!JS_GetProperty(cx, obj, "key", &key) ||
|
||||
!key.isString()) {
|
||||
NS_WARNING("Failed to get string property `key`.");
|
||||
return NS_OK;
|
||||
}
|
||||
mAirplaneModeEnabled = setting.mValue.toBoolean();
|
||||
mHasReadAirplaneModeSetting = true;
|
||||
|
||||
JS::Rooted<JSString*> jsKey(cx, key.toString());
|
||||
nsAutoJSString keyStr;
|
||||
if (!keyStr.init(cx, jsKey)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (keyStr.EqualsLiteral(SETTING_KEY_AIRPLANEMODE_ENABLED)) {
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, obj, "value", &value)) {
|
||||
NS_WARNING("Failed to get property `value`.");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!value.isBoolean()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mAirplaneModeEnabled = value.toBoolean();
|
||||
mHasReadAirplaneModeSetting = true;
|
||||
|
||||
// Disable the FM radio HW if Airplane mode is enabled.
|
||||
if (mAirplaneModeEnabled) {
|
||||
Disable(nullptr);
|
||||
}
|
||||
// Disable the FM radio HW if Airplane mode is enabled.
|
||||
if (mAirplaneModeEnabled) {
|
||||
Disable(nullptr);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "mozilla/dom/SettingChangeNotificationBinding.h"
|
||||
|
||||
class nsIPrincipal;
|
||||
|
||||
@ -712,36 +713,26 @@ nsGeolocationService::~nsGeolocationService()
|
||||
}
|
||||
|
||||
void
|
||||
nsGeolocationService::HandleMozsettingChanged(const char16_t* aData)
|
||||
nsGeolocationService::HandleMozsettingChanged(nsISupports* aSubject)
|
||||
{
|
||||
// The string that we're interested in will be a JSON string that looks like:
|
||||
// {"key":"gelocation.enabled","value":true}
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
|
||||
nsDependentString dataStr(aData);
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
if (!JS_ParseJSON(cx, dataStr.get(), dataStr.Length(), &val) || !val.isObject()) {
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
JSContext* cx = jsapi.cx();
|
||||
RootedDictionary<SettingChangeNotification> setting(cx);
|
||||
if (!WrappedJSToDictionary(cx, aSubject, setting)) {
|
||||
return;
|
||||
}
|
||||
if (!setting.mKey.EqualsASCII(GEO_SETINGS_ENABLED)) {
|
||||
return;
|
||||
}
|
||||
if (!setting.mValue.isBoolean()) {
|
||||
return;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, &val.toObject());
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
if (!JS_GetProperty(cx, obj, "key", &key) || !key.isString()) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool match;
|
||||
if (!JS_StringEqualsAscii(cx, key.toString(), GEO_SETINGS_ENABLED, &match) || !match) {
|
||||
return;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, obj, "value", &value) || !value.isBoolean()) {
|
||||
return;
|
||||
}
|
||||
|
||||
HandleMozsettingValue(value.toBoolean());
|
||||
HandleMozsettingValue(setting.mValue.toBoolean());
|
||||
}
|
||||
|
||||
void
|
||||
@ -786,7 +777,7 @@ nsGeolocationService::Observe(nsISupports* aSubject,
|
||||
}
|
||||
|
||||
if (!strcmp("mozsettings-changed", aTopic)) {
|
||||
HandleMozsettingChanged(aData);
|
||||
HandleMozsettingChanged(aSubject);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
|
||||
nsresult Init();
|
||||
|
||||
void HandleMozsettingChanged(const char16_t* aData);
|
||||
void HandleMozsettingChanged(nsISupports* aSubject);
|
||||
void HandleMozsettingValue(const bool aValue);
|
||||
|
||||
// Management of the Geolocation objects
|
||||
|
@ -2000,9 +2000,9 @@ TabChild::RecvNotifyAPZStateChange(const ViewID& aViewId,
|
||||
nsCOMPtr<nsIDocument> doc = GetDocument();
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIDocShell> docshell(doc->GetDocShell());
|
||||
if (docshell) {
|
||||
if (docshell && sf) {
|
||||
nsDocShell* nsdocshell = static_cast<nsDocShell*>(docshell.get());
|
||||
nsdocshell->NotifyAsyncPanZoomStarted();
|
||||
nsdocshell->NotifyAsyncPanZoomStarted(sf->GetScrollPositionCSSPixels());
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -2018,9 +2018,9 @@ TabChild::RecvNotifyAPZStateChange(const ViewID& aViewId,
|
||||
nsCOMPtr<nsIDocument> doc = GetDocument();
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIDocShell> docshell(doc->GetDocShell());
|
||||
if (docshell) {
|
||||
if (docshell && sf) {
|
||||
nsDocShell* nsdocshell = static_cast<nsDocShell*>(docshell.get());
|
||||
nsdocshell->NotifyAsyncPanZoomStopped();
|
||||
nsdocshell->NotifyAsyncPanZoomStopped(sf->GetScrollPositionCSSPixels());
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -188,11 +188,9 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
|
||||
},
|
||||
|
||||
checkP2PRegistration: function checkP2PRegistration(message) {
|
||||
// Check if the session and application id yeild a valid registered
|
||||
// target. It should have registered for NFC_PEER_EVENT_READY
|
||||
let isValid = (this.nfc._currentSessionId != null) &&
|
||||
(this.peerTargets[message.data.appId] != null);
|
||||
|
||||
let target = this.peerTargets[message.data.appId];
|
||||
let sessionToken = SessionHelper.getCurrentP2PToken();
|
||||
let isValid = (sessionToken != null) && (target != null);
|
||||
let respMsg = { requestId: message.data.requestId };
|
||||
if (!isValid) {
|
||||
respMsg.errorMsg = this.nfc.getErrorMessage(NFC.NFC_GECKO_ERROR_P2P_REG_INVALID);
|
||||
@ -203,7 +201,7 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
|
||||
|
||||
notifyUserAcceptedP2P: function notifyUserAcceptedP2P(appId) {
|
||||
let target = this.peerTargets[appId];
|
||||
let sessionToken = this.nfc.sessionTokenMap[this.nfc._currentSessionId];
|
||||
let sessionToken = SessionHelper.getCurrentP2PToken();
|
||||
let isValid = (sessionToken != null) && (target != null);
|
||||
if (!isValid) {
|
||||
debug("Peer already lost or " + appId + " is not a registered PeerReadytarget");
|
||||
@ -217,7 +215,7 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
|
||||
|
||||
onPeerLost: function onPeerLost(sessionToken) {
|
||||
if (!this.currentPeer) {
|
||||
// not a P2P session or the target is already killed.
|
||||
// The target is already killed.
|
||||
return;
|
||||
}
|
||||
|
||||
@ -267,9 +265,8 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
|
||||
|
||||
switch (message.name) {
|
||||
case "NFC:CheckSessionToken":
|
||||
if (message.data.sessionToken !== this.nfc.sessionTokenMap[this.nfc._currentSessionId]) {
|
||||
debug("Received invalid Session Token: " + message.data.sessionToken +
|
||||
", current SessionToken: " + this.nfc.sessionTokenMap[this.nfc._currentSessionId]);
|
||||
if (!SessionHelper.isValidToken(message.data.sessionToken)) {
|
||||
debug("Received invalid Session Token: " + message.data.sessionToken);
|
||||
return NFC.NFC_ERROR_BAD_SESSION_ID;
|
||||
}
|
||||
return NFC.NFC_SUCCESS;
|
||||
@ -314,6 +311,66 @@ XPCOMUtils.defineLazyGetter(this, "gMessageManager", function () {
|
||||
};
|
||||
});
|
||||
|
||||
let SessionHelper = {
|
||||
tokenMap: {},
|
||||
|
||||
registerSession: function registerSession(id, techList) {
|
||||
if (this.tokenMap[id]) {
|
||||
return this.tokenMap[id].token;
|
||||
}
|
||||
|
||||
this.tokenMap[id] = {
|
||||
token: UUIDGenerator.generateUUID().toString(),
|
||||
isP2P: techList.indexOf("P2P") != -1
|
||||
};
|
||||
|
||||
return this.tokenMap[id].token;
|
||||
},
|
||||
|
||||
unregisterSession: function unregisterSession(id) {
|
||||
if (this.tokenMap[id]) {
|
||||
delete this.tokenMap[id];
|
||||
}
|
||||
},
|
||||
|
||||
getToken: function getToken(id) {
|
||||
return this.tokenMap[id] ? this.tokenMap[id].token : null;
|
||||
},
|
||||
|
||||
getCurrentP2PToken: function getCurrentP2PToken() {
|
||||
for (let id in this.tokenMap) {
|
||||
if (this.tokenMap[id] && this.tokenMap[id].isP2P) {
|
||||
return this.tokenMap[id].token;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
getId: function getId(token) {
|
||||
for (let id in this.tokenMap) {
|
||||
if (this.tokenMap[id].token == token) {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
},
|
||||
|
||||
isP2PSession: function isP2PSession(id) {
|
||||
return (this.tokenMap[id] != null) && this.tokenMap[id].isP2P;
|
||||
},
|
||||
|
||||
isValidToken: function isValidToken(token) {
|
||||
for (let id in this.tokenMap) {
|
||||
if (this.tokenMap[id].token == token) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
function Nfc() {
|
||||
debug("Starting Nfc Service");
|
||||
|
||||
@ -328,8 +385,6 @@ function Nfc() {
|
||||
|
||||
gMessageManager.init(this);
|
||||
|
||||
// Maps sessionId (that are generated from nfcd) with a unique guid : 'SessionToken'
|
||||
this.sessionTokenMap = {};
|
||||
this.targetsByRequestId = {};
|
||||
}
|
||||
|
||||
@ -342,10 +397,12 @@ Nfc.prototype = {
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsINfcEventListener]),
|
||||
|
||||
_currentSessionId: null,
|
||||
|
||||
powerLevel: NFC.NFC_POWER_LEVEL_UNKNOWN,
|
||||
|
||||
nfcService: null,
|
||||
|
||||
targetsByRequestId: null,
|
||||
|
||||
/**
|
||||
* Send arbitrary message to Nfc service.
|
||||
*
|
||||
@ -412,15 +469,9 @@ Nfc.prototype = {
|
||||
break;
|
||||
case "TechDiscoveredNotification":
|
||||
message.type = "techDiscovered";
|
||||
this._currentSessionId = message.sessionId;
|
||||
|
||||
// Check if the session token already exists. If exists, continue to use the same one.
|
||||
// If not, generate a new token.
|
||||
if (!this.sessionTokenMap[this._currentSessionId]) {
|
||||
this.sessionTokenMap[this._currentSessionId] = UUIDGenerator.generateUUID().toString();
|
||||
}
|
||||
// Update the upper layers with a session token (alias)
|
||||
message.sessionToken = this.sessionTokenMap[this._currentSessionId];
|
||||
message.sessionToken =
|
||||
SessionHelper.registerSession(message.sessionId, message.techList);
|
||||
// Do not expose the actual session to the content
|
||||
delete message.sessionId;
|
||||
|
||||
@ -430,16 +481,16 @@ Nfc.prototype = {
|
||||
message.type = "techLost";
|
||||
|
||||
// Update the upper layers with a session token (alias)
|
||||
message.sessionToken = this.sessionTokenMap[this._currentSessionId];
|
||||
message.sessionToken = SessionHelper.getToken(message.sessionId);
|
||||
if (SessionHelper.isP2PSession(message.sessionId)) {
|
||||
gMessageManager.onPeerLost(message.sessionToken);
|
||||
}
|
||||
|
||||
SessionHelper.unregisterSession(message.sessionId);
|
||||
// Do not expose the actual session to the content
|
||||
delete message.sessionId;
|
||||
|
||||
gSystemMessenger.broadcastMessage("nfc-manager-tech-lost", message);
|
||||
gMessageManager.onPeerLost(this.sessionTokenMap[this._currentSessionId]);
|
||||
|
||||
delete this.sessionTokenMap[this._currentSessionId];
|
||||
this._currentSessionId = null;
|
||||
|
||||
break;
|
||||
case "HCIEventTransactionNotification":
|
||||
this.notifyHCIEventTransaction(message);
|
||||
@ -484,12 +535,6 @@ Nfc.prototype = {
|
||||
gSystemMessenger.broadcastMessage("nfc-hci-event-transaction", message);
|
||||
},
|
||||
|
||||
nfcService: null,
|
||||
|
||||
sessionTokenMap: null,
|
||||
|
||||
targetsByRequestId: null,
|
||||
|
||||
/**
|
||||
* Process a message from the gMessageManager.
|
||||
*/
|
||||
@ -505,17 +550,15 @@ Nfc.prototype = {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Update the current sessionId before sending to the NFC service.
|
||||
message.data.sessionId = this._currentSessionId;
|
||||
}
|
||||
// Sanity check on sessionToken.
|
||||
if (!SessionHelper.isValidToken(message.data.sessionToken)) {
|
||||
debug("Invalid Session Token: " + message.data.sessionToken);
|
||||
this.sendNfcErrorResponse(message, NFC.NFC_ERROR_BAD_SESSION_ID);
|
||||
return null;
|
||||
}
|
||||
|
||||
// Sanity check on sessionId
|
||||
let sessionToken = this.sessionTokenMap[this._currentSessionId];
|
||||
if (message.data.sessionToken && (message.data.sessionToken !== sessionToken)) {
|
||||
debug("Invalid Session Token: " + message.data.sessionToken +
|
||||
" Expected Session Token: " + sessionToken);
|
||||
this.sendNfcErrorResponse(message, NFC.NFC_ERROR_BAD_SESSION_ID);
|
||||
return null;
|
||||
// Update the current sessionId before sending to the NFC service.
|
||||
message.data.sessionId = SessionHelper.getId(message.data.sessionToken);
|
||||
}
|
||||
|
||||
switch (message.name) {
|
||||
|
@ -23,7 +23,7 @@ using mozilla::DefaultXDisplay;
|
||||
#include "nsDisplayList.h"
|
||||
#include "ImageLayers.h"
|
||||
#include "GLImages.h"
|
||||
#include "nsObjectFrame.h"
|
||||
#include "nsPluginFrame.h"
|
||||
#include "nsIPluginDocument.h"
|
||||
#include "nsIStringStream.h"
|
||||
#include "nsNetUtil.h"
|
||||
@ -222,7 +222,7 @@ nsPluginInstanceOwner::GetImageContainer()
|
||||
|
||||
// NotifySize() causes Flash to do a bunch of stuff like ask for surfaces to render
|
||||
// into, set y-flip flags, etc, so we do this at the beginning.
|
||||
gfxSize resolution = mObjectFrame->PresContext()->PresShell()->GetCumulativeResolution();
|
||||
gfxSize resolution = mPluginFrame->PresContext()->PresShell()->GetCumulativeResolution();
|
||||
ScreenSize screenSize = (r * LayoutDeviceToScreenScale(resolution.width, resolution.height)).Size();
|
||||
mInstance->NotifySize(nsIntSize(screenSize.width, screenSize.height));
|
||||
|
||||
@ -322,7 +322,7 @@ nsPluginInstanceOwner::nsPluginInstanceOwner()
|
||||
else
|
||||
mPluginWindow = nullptr;
|
||||
|
||||
mObjectFrame = nullptr;
|
||||
mPluginFrame = nullptr;
|
||||
mContent = nullptr;
|
||||
mWidgetCreationComplete = false;
|
||||
#ifdef XP_MACOSX
|
||||
@ -365,7 +365,7 @@ nsPluginInstanceOwner::~nsPluginInstanceOwner()
|
||||
NS_DispatchToMainThread(event);
|
||||
}
|
||||
|
||||
mObjectFrame = nullptr;
|
||||
mPluginFrame = nullptr;
|
||||
|
||||
PLUG_DeletePluginNativeWindow(mPluginWindow);
|
||||
mPluginWindow = nullptr;
|
||||
@ -543,10 +543,10 @@ NS_IMETHODIMP nsPluginInstanceOwner::ShowStatus(const char16_t *aStatusMsg)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
if (!mObjectFrame) {
|
||||
if (!mPluginFrame) {
|
||||
return rv;
|
||||
}
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellItem = mObjectFrame->PresContext()->GetDocShell();
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellItem = mPluginFrame->PresContext()->GetDocShell();
|
||||
if (NS_FAILED(rv) || !docShellItem) {
|
||||
return rv;
|
||||
}
|
||||
@ -582,7 +582,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(NPRect *invalidRect)
|
||||
{
|
||||
// If our object frame has gone away, we won't be able to determine
|
||||
// up-to-date-ness, so just fire off the event.
|
||||
if (mWaitingForPaint && (!mObjectFrame || IsUpToDate())) {
|
||||
if (mWaitingForPaint && (!mPluginFrame || IsUpToDate())) {
|
||||
// We don't care when the event is dispatched as long as it's "soon",
|
||||
// since whoever needs it will be waiting for it.
|
||||
nsCOMPtr<nsIRunnable> event = new AsyncPaintWaitEvent(mContent, true);
|
||||
@ -590,7 +590,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(NPRect *invalidRect)
|
||||
mWaitingForPaint = false;
|
||||
}
|
||||
|
||||
if (!mObjectFrame || !invalidRect || !mWidgetVisible)
|
||||
if (!mPluginFrame || !invalidRect || !mWidgetVisible)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#if defined(XP_MACOSX) || defined(MOZ_WIDGET_ANDROID)
|
||||
@ -621,7 +621,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(NPRect *invalidRect)
|
||||
double scaleFactor = 1.0;
|
||||
GetContentsScaleFactor(&scaleFactor);
|
||||
rect.ScaleRoundOut(scaleFactor);
|
||||
mObjectFrame->InvalidateLayer(nsDisplayItem::TYPE_PLUGIN, &rect);
|
||||
mPluginFrame->InvalidateLayer(nsDisplayItem::TYPE_PLUGIN, &rect);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -633,22 +633,22 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRegion(NPRegion invalidRegion)
|
||||
NS_IMETHODIMP
|
||||
nsPluginInstanceOwner::RedrawPlugin()
|
||||
{
|
||||
if (mObjectFrame) {
|
||||
mObjectFrame->InvalidateLayer(nsDisplayItem::TYPE_PLUGIN);
|
||||
if (mPluginFrame) {
|
||||
mPluginFrame->InvalidateLayer(nsDisplayItem::TYPE_PLUGIN);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
|
||||
{
|
||||
if (!mObjectFrame) {
|
||||
if (!mPluginFrame) {
|
||||
NS_WARNING("plugin owner has no owner in getting doc's window handle");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
#if defined(XP_WIN)
|
||||
void** pvalue = (void**)value;
|
||||
nsViewManager* vm = mObjectFrame->PresContext()->GetPresShell()->GetViewManager();
|
||||
nsViewManager* vm = mPluginFrame->PresContext()->GetPresShell()->GetViewManager();
|
||||
if (!vm)
|
||||
return NS_ERROR_FAILURE;
|
||||
#if defined(XP_WIN)
|
||||
@ -680,7 +680,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
|
||||
// fixing both the caret and ability to interact issues for a windowless control in a non document aligned windw
|
||||
// does not seem to be possible without a change to the flash plugin
|
||||
|
||||
nsIWidget* win = mObjectFrame->GetNearestWidget();
|
||||
nsIWidget* win = mPluginFrame->GetNearestWidget();
|
||||
if (win) {
|
||||
nsView *view = nsView::GetViewFor(win);
|
||||
NS_ASSERTION(view, "No view for widget");
|
||||
@ -708,7 +708,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
|
||||
return NS_OK;
|
||||
#elif (defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)) && defined(MOZ_X11)
|
||||
// X11 window managers want the toplevel window for WM_TRANSIENT_FOR.
|
||||
nsIWidget* win = mObjectFrame->GetNearestWidget();
|
||||
nsIWidget* win = mPluginFrame->GetNearestWidget();
|
||||
if (!win)
|
||||
return NS_ERROR_FAILURE;
|
||||
*static_cast<Window*>(value) = (long unsigned int)win->GetNativeData(NS_NATIVE_SHAREABLE_WINDOW);
|
||||
@ -1127,8 +1127,8 @@ GetOffsetRootContent(nsIFrame* aFrame)
|
||||
LayoutDeviceRect nsPluginInstanceOwner::GetPluginRect()
|
||||
{
|
||||
// Get the offset of the content relative to the page
|
||||
nsRect bounds = mObjectFrame->GetContentRectRelativeToSelf() + GetOffsetRootContent(mObjectFrame);
|
||||
LayoutDeviceIntRect rect = LayoutDeviceIntRect::FromAppUnitsToNearest(bounds, mObjectFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
nsRect bounds = mPluginFrame->GetContentRectRelativeToSelf() + GetOffsetRootContent(mPluginFrame);
|
||||
LayoutDeviceIntRect rect = LayoutDeviceIntRect::FromAppUnitsToNearest(bounds, mPluginFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
return LayoutDeviceRect(rect);
|
||||
}
|
||||
|
||||
@ -1350,7 +1350,7 @@ nsPluginInstanceOwner::ProcessMouseDown(nsIDOMEvent* aMouseEvent)
|
||||
|
||||
// if the plugin is windowless, we need to set focus ourselves
|
||||
// otherwise, we might not get key events
|
||||
if (mObjectFrame && mPluginWindow &&
|
||||
if (mPluginFrame && mPluginWindow &&
|
||||
mPluginWindow->type == NPWindowTypeDrawable) {
|
||||
|
||||
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
@ -1482,7 +1482,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
||||
{
|
||||
nsEventStatus rv = nsEventStatus_eIgnore;
|
||||
|
||||
if (!mInstance || !mObjectFrame) // if mInstance is null, we shouldn't be here
|
||||
if (!mInstance || !mPluginFrame) // if mInstance is null, we shouldn't be here
|
||||
return nsEventStatus_eIgnore;
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
@ -1503,9 +1503,9 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
||||
NPCocoaEvent synthCocoaEvent;
|
||||
const NPCocoaEvent* event = static_cast<const NPCocoaEvent*>(anEvent.mPluginEvent);
|
||||
nsPoint pt =
|
||||
nsLayoutUtils::GetEventCoordinatesRelativeTo(&anEvent, mObjectFrame) -
|
||||
mObjectFrame->GetContentRectRelativeToSelf().TopLeft();
|
||||
nsPresContext* presContext = mObjectFrame->PresContext();
|
||||
nsLayoutUtils::GetEventCoordinatesRelativeTo(&anEvent, mPluginFrame) -
|
||||
mPluginFrame->GetContentRectRelativeToSelf().TopLeft();
|
||||
nsPresContext* presContext = mPluginFrame->PresContext();
|
||||
// Plugin event coordinates need to be translated from device pixels
|
||||
// into "display pixels" in HiDPI modes.
|
||||
double scaleFactor = 1.0;
|
||||
@ -1521,9 +1521,9 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
||||
{
|
||||
// Ignore mouse-moved events that happen as part of a dragging
|
||||
// operation that started over another frame. See bug 525078.
|
||||
nsRefPtr<nsFrameSelection> frameselection = mObjectFrame->GetFrameSelection();
|
||||
nsRefPtr<nsFrameSelection> frameselection = mPluginFrame->GetFrameSelection();
|
||||
if (!frameselection->GetDragState() ||
|
||||
(nsIPresShell::GetCapturingContent() == mObjectFrame->GetContent())) {
|
||||
(nsIPresShell::GetCapturingContent() == mPluginFrame->GetContent())) {
|
||||
synthCocoaEvent.type = NPCocoaEventMouseMoved;
|
||||
synthCocoaEvent.data.mouse.pluginX = static_cast<double>(ptPx.x);
|
||||
synthCocoaEvent.data.mouse.pluginY = static_cast<double>(ptPx.y);
|
||||
@ -1542,7 +1542,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
||||
// convert it into a mouse-entered event (in the Cocoa Event Model).
|
||||
// See bug 525078.
|
||||
if (anEvent.AsMouseEvent()->button == WidgetMouseEvent::eLeftButton &&
|
||||
(nsIPresShell::GetCapturingContent() != mObjectFrame->GetContent())) {
|
||||
(nsIPresShell::GetCapturingContent() != mPluginFrame->GetContent())) {
|
||||
synthCocoaEvent.type = NPCocoaEventMouseEntered;
|
||||
synthCocoaEvent.data.mouse.pluginX = static_cast<double>(ptPx.x);
|
||||
synthCocoaEvent.data.mouse.pluginY = static_cast<double>(ptPx.y);
|
||||
@ -1652,12 +1652,12 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
||||
anEvent.message == NS_MOUSE_MOVE,
|
||||
"Incorrect event type for coordinate translation");
|
||||
nsPoint pt =
|
||||
nsLayoutUtils::GetEventCoordinatesRelativeTo(&anEvent, mObjectFrame) -
|
||||
mObjectFrame->GetContentRectRelativeToSelf().TopLeft();
|
||||
nsPresContext* presContext = mObjectFrame->PresContext();
|
||||
nsLayoutUtils::GetEventCoordinatesRelativeTo(&anEvent, mPluginFrame) -
|
||||
mPluginFrame->GetContentRectRelativeToSelf().TopLeft();
|
||||
nsPresContext* presContext = mPluginFrame->PresContext();
|
||||
nsIntPoint ptPx(presContext->AppUnitsToDevPixels(pt.x),
|
||||
presContext->AppUnitsToDevPixels(pt.y));
|
||||
nsIntPoint widgetPtPx = ptPx + mObjectFrame->GetWindowOriginInPixels(true);
|
||||
nsIntPoint widgetPtPx = ptPx + mPluginFrame->GetWindowOriginInPixels(true);
|
||||
const_cast<NPEvent*>(pPluginEvent)->lParam = MAKELPARAM(widgetPtPx.x, widgetPtPx.y);
|
||||
}
|
||||
}
|
||||
@ -1680,7 +1680,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
||||
|
||||
if (pPluginEvent && !pPluginEvent->event) {
|
||||
// Don't send null events to plugins.
|
||||
NS_WARNING("nsObjectFrame ProcessEvent: trying to send null event to plugin.");
|
||||
NS_WARNING("nsPluginFrame ProcessEvent: trying to send null event to plugin.");
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -1712,10 +1712,10 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
||||
}
|
||||
|
||||
// Get reference point relative to plugin origin.
|
||||
const nsPresContext* presContext = mObjectFrame->PresContext();
|
||||
const nsPresContext* presContext = mPluginFrame->PresContext();
|
||||
nsPoint appPoint =
|
||||
nsLayoutUtils::GetEventCoordinatesRelativeTo(&anEvent, mObjectFrame) -
|
||||
mObjectFrame->GetContentRectRelativeToSelf().TopLeft();
|
||||
nsLayoutUtils::GetEventCoordinatesRelativeTo(&anEvent, mPluginFrame) -
|
||||
mPluginFrame->GetContentRectRelativeToSelf().TopLeft();
|
||||
nsIntPoint pluginPoint(presContext->AppUnitsToDevPixels(appPoint.x),
|
||||
presContext->AppUnitsToDevPixels(appPoint.y));
|
||||
const WidgetMouseEvent& mouseEvent = *anEvent.AsMouseEvent();
|
||||
@ -1913,10 +1913,10 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
||||
}
|
||||
|
||||
// Get reference point relative to plugin origin.
|
||||
const nsPresContext* presContext = mObjectFrame->PresContext();
|
||||
const nsPresContext* presContext = mPluginFrame->PresContext();
|
||||
nsPoint appPoint =
|
||||
nsLayoutUtils::GetEventCoordinatesRelativeTo(&anEvent, mObjectFrame) -
|
||||
mObjectFrame->GetContentRectRelativeToSelf().TopLeft();
|
||||
nsLayoutUtils::GetEventCoordinatesRelativeTo(&anEvent, mPluginFrame) -
|
||||
mPluginFrame->GetContentRectRelativeToSelf().TopLeft();
|
||||
nsIntPoint pluginPoint(presContext->AppUnitsToDevPixels(appPoint.x),
|
||||
presContext->AppUnitsToDevPixels(appPoint.y));
|
||||
|
||||
@ -2045,7 +2045,7 @@ nsPluginInstanceOwner::Destroy()
|
||||
#ifdef XP_MACOSX
|
||||
void nsPluginInstanceOwner::Paint(const gfxRect& aDirtyRect, CGContextRef cgContext)
|
||||
{
|
||||
if (!mInstance || !mObjectFrame)
|
||||
if (!mInstance || !mPluginFrame)
|
||||
return;
|
||||
|
||||
gfxRect dirtyRectCopy = aDirtyRect;
|
||||
@ -2067,7 +2067,7 @@ void nsPluginInstanceOwner::Paint(const gfxRect& aDirtyRect, CGContextRef cgCont
|
||||
|
||||
void nsPluginInstanceOwner::DoCocoaEventDrawRect(const gfxRect& aDrawRect, CGContextRef cgContext)
|
||||
{
|
||||
if (!mInstance || !mObjectFrame)
|
||||
if (!mInstance || !mPluginFrame)
|
||||
return;
|
||||
|
||||
// The context given here is only valid during the HandleEvent call.
|
||||
@ -2087,7 +2087,7 @@ void nsPluginInstanceOwner::DoCocoaEventDrawRect(const gfxRect& aDrawRect, CGCon
|
||||
#ifdef XP_WIN
|
||||
void nsPluginInstanceOwner::Paint(const RECT& aDirty, HDC aDC)
|
||||
{
|
||||
if (!mInstance || !mObjectFrame)
|
||||
if (!mInstance || !mPluginFrame)
|
||||
return;
|
||||
|
||||
NPEvent pluginEvent;
|
||||
@ -2104,7 +2104,7 @@ void nsPluginInstanceOwner::Paint(gfxContext* aContext,
|
||||
const gfxRect& aFrameRect,
|
||||
const gfxRect& aDirtyRect)
|
||||
{
|
||||
if (!mInstance || !mObjectFrame || !mPluginDocumentActiveState || mFullScreen)
|
||||
if (!mInstance || !mPluginFrame || !mPluginDocumentActiveState || mFullScreen)
|
||||
return;
|
||||
|
||||
int32_t model = mInstance->GetANPDrawingModel();
|
||||
@ -2169,7 +2169,7 @@ void nsPluginInstanceOwner::Paint(gfxContext* aContext,
|
||||
const gfxRect& aFrameRect,
|
||||
const gfxRect& aDirtyRect)
|
||||
{
|
||||
if (!mInstance || !mObjectFrame)
|
||||
if (!mInstance || !mPluginFrame)
|
||||
return;
|
||||
|
||||
// to provide crisper and faster drawing.
|
||||
@ -2372,7 +2372,7 @@ nsresult nsPluginInstanceOwner::Init(nsIContent* aContent)
|
||||
// done at a higher level than this (content).
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
nsIObjectFrame* iObjFrame = do_QueryFrame(frame);
|
||||
nsObjectFrame* objFrame = static_cast<nsObjectFrame*>(iObjFrame);
|
||||
nsPluginFrame* objFrame = static_cast<nsPluginFrame*>(iObjFrame);
|
||||
if (objFrame) {
|
||||
SetFrame(objFrame);
|
||||
// Some plugins require a specific sequence of shutdown and startup when
|
||||
@ -2524,9 +2524,9 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
if (mObjectFrame) {
|
||||
if (mPluginFrame) {
|
||||
// nullptr widget is fine, will result in windowless setup.
|
||||
mObjectFrame->PrepForDrawing(mWidget);
|
||||
mPluginFrame->PrepForDrawing(mWidget);
|
||||
}
|
||||
|
||||
if (windowless) {
|
||||
@ -2573,21 +2573,21 @@ NS_IMETHODIMP nsPluginInstanceOwner::CreateWidget(void)
|
||||
|
||||
void* nsPluginInstanceOwner::FixUpPluginWindow(int32_t inPaintState)
|
||||
{
|
||||
if (!mWidget || !mPluginWindow || !mInstance || !mObjectFrame)
|
||||
if (!mWidget || !mPluginWindow || !mInstance || !mPluginFrame)
|
||||
return nullptr;
|
||||
|
||||
nsCOMPtr<nsIPluginWidget> pluginWidget = do_QueryInterface(mWidget);
|
||||
if (!pluginWidget)
|
||||
return nullptr;
|
||||
|
||||
// If we've already set up a CGContext in nsObjectFrame::PaintPlugin(), we
|
||||
// If we've already set up a CGContext in nsPluginFrame::PaintPlugin(), we
|
||||
// don't want calls to SetPluginPortAndDetectChange() to step on our work.
|
||||
if (mInCGPaintLevel < 1) {
|
||||
SetPluginPortAndDetectChange();
|
||||
}
|
||||
|
||||
// We'll need the top-level Cocoa window for the Cocoa event model.
|
||||
nsIWidget* widget = mObjectFrame->GetNearestWidget();
|
||||
nsIWidget* widget = mPluginFrame->GetNearestWidget();
|
||||
if (!widget)
|
||||
return nullptr;
|
||||
void *cocoaTopLevelWindow = widget->GetNativeData(NS_NATIVE_WINDOW);
|
||||
@ -2722,7 +2722,7 @@ void nsPluginInstanceOwner::UpdateWindowPositionAndClipRect(bool aSetWindow)
|
||||
const NPWindow oldWindow = *mPluginWindow;
|
||||
|
||||
bool windowless = (mPluginWindow->type == NPWindowTypeDrawable);
|
||||
nsIntPoint origin = mObjectFrame->GetWindowOriginInPixels(windowless);
|
||||
nsIntPoint origin = mPluginFrame->GetWindowOriginInPixels(windowless);
|
||||
|
||||
mPluginWindow->x = origin.x;
|
||||
mPluginWindow->y = origin.y;
|
||||
@ -2786,8 +2786,8 @@ nsPluginInstanceOwner::UpdateDocumentActiveState(bool aIsActive)
|
||||
NS_IMETHODIMP
|
||||
nsPluginInstanceOwner::CallSetWindow()
|
||||
{
|
||||
if (mObjectFrame) {
|
||||
mObjectFrame->CallSetWindow(false);
|
||||
if (mPluginFrame) {
|
||||
mPluginFrame->CallSetWindow(false);
|
||||
} else if (mInstance) {
|
||||
if (UseAsyncRendering()) {
|
||||
mInstance->AsyncSetWindow(mPluginWindow);
|
||||
@ -2818,32 +2818,32 @@ nsPluginInstanceOwner::GetContentsScaleFactor(double *result)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsPluginInstanceOwner::SetFrame(nsObjectFrame *aFrame)
|
||||
void nsPluginInstanceOwner::SetFrame(nsPluginFrame *aFrame)
|
||||
{
|
||||
// Don't do anything if the frame situation hasn't changed.
|
||||
if (mObjectFrame == aFrame) {
|
||||
if (mPluginFrame == aFrame) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we already have a frame that is changing or going away...
|
||||
if (mObjectFrame) {
|
||||
if (mPluginFrame) {
|
||||
// Make sure the old frame isn't holding a reference to us.
|
||||
mObjectFrame->SetInstanceOwner(nullptr);
|
||||
mPluginFrame->SetInstanceOwner(nullptr);
|
||||
}
|
||||
|
||||
// Swap in the new frame (or no frame)
|
||||
mObjectFrame = aFrame;
|
||||
mPluginFrame = aFrame;
|
||||
|
||||
// Set up a new frame
|
||||
if (mObjectFrame) {
|
||||
mObjectFrame->SetInstanceOwner(this);
|
||||
if (mPluginFrame) {
|
||||
mPluginFrame->SetInstanceOwner(this);
|
||||
// Can only call PrepForDrawing on an object frame once. Don't do it here unless
|
||||
// widget creation is complete. Doesn't matter if we actually have a widget.
|
||||
if (mWidgetCreationComplete) {
|
||||
mObjectFrame->PrepForDrawing(mWidget);
|
||||
mPluginFrame->PrepForDrawing(mWidget);
|
||||
}
|
||||
mObjectFrame->FixupWindow(mObjectFrame->GetContentRectRelativeToSelf().Size());
|
||||
mObjectFrame->InvalidateFrame();
|
||||
mPluginFrame->FixupWindow(mPluginFrame->GetContentRectRelativeToSelf().Size());
|
||||
mPluginFrame->InvalidateFrame();
|
||||
|
||||
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
const nsIContent* content = aFrame->GetContent();
|
||||
@ -2853,9 +2853,9 @@ void nsPluginInstanceOwner::SetFrame(nsObjectFrame *aFrame)
|
||||
}
|
||||
}
|
||||
|
||||
nsObjectFrame* nsPluginInstanceOwner::GetFrame()
|
||||
nsPluginFrame* nsPluginInstanceOwner::GetFrame()
|
||||
{
|
||||
return mObjectFrame;
|
||||
return mPluginFrame;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPluginInstanceOwner::PrivateModeChanged(bool aEnabled)
|
||||
|
@ -26,7 +26,7 @@
|
||||
class nsIInputStream;
|
||||
struct nsIntRect;
|
||||
class nsPluginDOMContextMenuListener;
|
||||
class nsObjectFrame;
|
||||
class nsPluginFrame;
|
||||
class nsDisplayListBuilder;
|
||||
|
||||
namespace mozilla {
|
||||
@ -143,9 +143,9 @@ public:
|
||||
// changed, and SetWindow() needs to be called again.
|
||||
void* SetPluginPortAndDetectChange();
|
||||
// Flag when we've set up a Thebes (and CoreGraphics) context in
|
||||
// nsObjectFrame::PaintPlugin(). We need to know this in
|
||||
// nsPluginFrame::PaintPlugin(). We need to know this in
|
||||
// FixUpPluginWindow() (i.e. we need to know when FixUpPluginWindow() has
|
||||
// been called from nsObjectFrame::PaintPlugin() when we're using the
|
||||
// been called from nsPluginFrame::PaintPlugin() when we're using the
|
||||
// CoreGraphics drawing model).
|
||||
void BeginCGPaint();
|
||||
void EndCGPaint();
|
||||
@ -155,8 +155,8 @@ public:
|
||||
void UpdateDocumentActiveState(bool aIsActive);
|
||||
#endif // XP_MACOSX
|
||||
|
||||
void SetFrame(nsObjectFrame *aFrame);
|
||||
nsObjectFrame* GetFrame();
|
||||
void SetFrame(nsPluginFrame *aFrame);
|
||||
nsPluginFrame* GetFrame();
|
||||
|
||||
uint32_t GetLastEventloopNestingLevel() const {
|
||||
return mLastEventloopNestingLevel;
|
||||
@ -276,7 +276,7 @@ private:
|
||||
|
||||
nsPluginNativeWindow *mPluginWindow;
|
||||
nsRefPtr<nsNPAPIPluginInstance> mInstance;
|
||||
nsObjectFrame *mObjectFrame;
|
||||
nsPluginFrame *mPluginFrame;
|
||||
nsIContent *mContent; // WEAK, content owns us
|
||||
nsCString mDocumentBase;
|
||||
bool mWidgetCreationComplete;
|
||||
|
@ -145,7 +145,7 @@ nsresult nsPluginNativeWindowGtk::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance>
|
||||
|
||||
// Make sure to resize and re-place the window if required.
|
||||
SetAllocation();
|
||||
// Need to reset "window" each time as nsObjectFrame::DidReflow sets it
|
||||
// Need to reset "window" each time as nsPluginFrame::DidReflow sets it
|
||||
// to the ancestor window.
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
if (GTK_IS_XTBIN(mSocketWidget)) {
|
||||
@ -225,7 +225,7 @@ nsresult nsPluginNativeWindowGtk::CreateXEmbedWindow(bool aEnableXtFocus) {
|
||||
SetWindow(gtk_socket_get_id(GTK_SOCKET(mSocketWidget)));
|
||||
|
||||
// Fill out the ws_info structure.
|
||||
// (The windowless case is done in nsObjectFrame.cpp.)
|
||||
// (The windowless case is done in nsPluginFrame.cpp.)
|
||||
GdkWindow *gdkWindow = gdk_x11_window_lookup_for_display(display, GetWindow());
|
||||
if(!gdkWindow)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -1948,7 +1948,7 @@ PluginInstanceChild::SharedSurfacePaint(NPEvent& evcopy)
|
||||
break;
|
||||
case RENDER_BACK_ONE:
|
||||
// Handle a double pass render used in alpha extraction for transparent
|
||||
// plugins. (See nsObjectFrame and gfxWindowsNativeDrawing for details.)
|
||||
// plugins. (See nsPluginFrame and gfxWindowsNativeDrawing for details.)
|
||||
// We render twice, once to the shared dib, and once to a cache which
|
||||
// we copy back on a second paint. These paints can't be spread across
|
||||
// multiple rpc messages as delays cause animation frame changes.
|
||||
|
@ -367,7 +367,7 @@ PluginInstanceParent::AnswerNPN_SetValue_NPPVpluginDrawingModel(
|
||||
if (drawingModel == NPDrawingModelCoreAnimation ||
|
||||
drawingModel == NPDrawingModelInvalidatingCoreAnimation) {
|
||||
// We need to request CoreGraphics otherwise
|
||||
// the nsObjectFrame will try to draw a CALayer
|
||||
// the nsPluginFrame will try to draw a CALayer
|
||||
// that can not be shared across process.
|
||||
mDrawingModel = drawingModel;
|
||||
*result = mNPNIface->setvalue(mNPP, NPPVpluginDrawingModel,
|
||||
@ -1231,7 +1231,7 @@ PluginInstanceParent::NPP_HandleEvent(void* event)
|
||||
|
||||
case WM_WINDOWPOSCHANGED:
|
||||
{
|
||||
// We send this in nsObjectFrame just before painting
|
||||
// We send this in nsPluginFrame just before painting
|
||||
return SendWindowPosChanged(npremoteevent);
|
||||
}
|
||||
break;
|
||||
|
@ -100,7 +100,7 @@ pluginDoSetWindow(InstanceData* instanceData, NPWindow* newWindow)
|
||||
{
|
||||
// Ugh. Due to a terrible Gecko bug, we have to ignore position changes
|
||||
// when the clip rect doesn't change; the position can be wrong
|
||||
// when set by a path other than nsObjectFrame::FixUpPluginWindow.
|
||||
// when set by a path other than nsPluginFrame::FixUpPluginWindow.
|
||||
int32_t oldX = instanceData->window.x;
|
||||
int32_t oldY = instanceData->window.y;
|
||||
bool clipChanged =
|
||||
|
@ -666,12 +666,13 @@ let SettingsRequestManager = {
|
||||
sendSettingsChange: function(aKey, aValue, aIsServiceLock) {
|
||||
this.broadcastMessage("Settings:Change:Return:OK",
|
||||
{ key: aKey, value: aValue });
|
||||
Services.obs.notifyObservers(this, kMozSettingsChangedObserverTopic,
|
||||
JSON.stringify({
|
||||
key: aKey,
|
||||
value: aValue,
|
||||
isInternalChange: aIsServiceLock
|
||||
}));
|
||||
var setting = {
|
||||
key: aKey,
|
||||
value: aValue,
|
||||
isInternalChange: aIsServiceLock
|
||||
};
|
||||
setting.wrappedJSObject = setting;
|
||||
Services.obs.notifyObservers(setting, kMozSettingsChangedObserverTopic, "");
|
||||
},
|
||||
|
||||
broadcastMessage: function broadcastMessage(aMsgName, aContent) {
|
||||
|
@ -264,11 +264,13 @@ WifiGeoPositionProvider.prototype = {
|
||||
}
|
||||
|
||||
try {
|
||||
let setting = JSON.parse(aData);
|
||||
if (setting.key == SETTINGS_DEBUG_ENABLED) {
|
||||
gLoggingEnabled = setting.value;
|
||||
} else if (setting.key == SETTINGS_WIFI_ENABLED) {
|
||||
gWifiScanningEnabled = setting.value;
|
||||
if ("wrappedJSObject" in aSubject) {
|
||||
aSubject = aSubject.wrappedJSObject;
|
||||
}
|
||||
if (aSubject.key == SETTINGS_DEBUG_ENABLED) {
|
||||
gLoggingEnabled = aSubject.value;
|
||||
} else if (aSubject.key == SETTINGS_WIFI_ENABLED) {
|
||||
gWifiScanningEnabled = aSubject.value;
|
||||
}
|
||||
} catch (e) {
|
||||
}
|
||||
|
@ -41,6 +41,8 @@
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/SettingChangeNotificationBinding.h"
|
||||
|
||||
using namespace mozilla::dom::gonk;
|
||||
using namespace android;
|
||||
@ -350,36 +352,21 @@ AudioManager::Observe(nsISupports* aSubject,
|
||||
// To process the volume control on each audio channel according to
|
||||
// change of settings
|
||||
else if (!strcmp(aTopic, MOZ_SETTINGS_CHANGE_ID)) {
|
||||
AutoSafeJSContext cx;
|
||||
nsDependentString dataStr(aData);
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
if (!JS_ParseJSON(cx, dataStr.get(), dataStr.Length(), &val) ||
|
||||
!val.isObject()) {
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
JSContext* cx = jsapi.cx();
|
||||
RootedDictionary<dom::SettingChangeNotification> setting(cx);
|
||||
if (!WrappedJSToDictionary(cx, aSubject, setting)) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (!setting.mKey.EqualsASCII("audio.volume.bt_sco")) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (!setting.mValue.isNumber()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> obj(cx, &val.toObject());
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
if (!JS_GetProperty(cx, obj, "key", &key) ||
|
||||
!key.isString()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::Rooted<JSString*> jsKey(cx, JS::ToString(cx, key));
|
||||
if (!jsKey) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsAutoJSString keyStr;
|
||||
if (!keyStr.init(cx, jsKey) || !keyStr.EqualsLiteral("audio.volume.bt_sco")) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, obj, "value", &value) || !value.isInt32()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
int32_t index = value.toInt32();
|
||||
int32_t index = setting.mValue.toNumber();
|
||||
SetStreamVolumeIndex(AUDIO_STREAM_BLUETOOTH_SCO, index);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include "xpcpublic.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/SettingChangeNotificationBinding.h"
|
||||
|
||||
#undef LOG
|
||||
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "AutoMounterSetting" , ## args)
|
||||
@ -31,6 +33,8 @@
|
||||
#define UMS_VOLUME_ENABLED_SUFFIX ".enabled"
|
||||
#define MOZSETTINGS_CHANGED "mozsettings-changed"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
namespace mozilla {
|
||||
namespace system {
|
||||
|
||||
@ -235,52 +239,35 @@ AutoMounterSetting::Observe(nsISupports* aSubject,
|
||||
// The string that we're interested in will be a JSON string that looks like:
|
||||
// {"key":"ums.autoMount","value":true}
|
||||
|
||||
mozilla::AutoSafeJSContext cx;
|
||||
nsDependentString dataStr(aData);
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
if (!JS_ParseJSON(cx, dataStr.get(), dataStr.Length(), &val) ||
|
||||
!val.isObject()) {
|
||||
return NS_OK;
|
||||
}
|
||||
JS::Rooted<JSObject*> obj(cx, &val.toObject());
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
if (!JS_GetProperty(cx, obj, "key", &key) ||
|
||||
!key.isString()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JSString *jsKey = JS::ToString(cx, key);
|
||||
nsAutoJSString keyStr;
|
||||
if (!keyStr.init(cx, jsKey)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, obj, "value", &value)) {
|
||||
AutoJSAPI jsapi;
|
||||
jsapi.Init();
|
||||
JSContext* cx = jsapi.cx();
|
||||
RootedDictionary<SettingChangeNotification> setting(cx);
|
||||
if (!WrappedJSToDictionary(cx, aSubject, setting)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Check for ums.mode changes
|
||||
if (keyStr.EqualsLiteral(UMS_MODE)) {
|
||||
if (!value.isInt32()) {
|
||||
if (setting.mKey.EqualsASCII(UMS_MODE)) {
|
||||
if (!setting.mValue.isInt32()) {
|
||||
return NS_OK;
|
||||
}
|
||||
int32_t mode = value.toInt32();
|
||||
int32_t mode = setting.mValue.toInt32();
|
||||
SetAutoMounterMode(mode);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Check for ums.volume.NAME.enabled
|
||||
if (StringBeginsWith(keyStr, NS_LITERAL_STRING(UMS_VOLUME_ENABLED_PREFIX)) &&
|
||||
StringEndsWith(keyStr, NS_LITERAL_STRING(UMS_VOLUME_ENABLED_SUFFIX))) {
|
||||
if (!value.isBoolean()) {
|
||||
if (StringBeginsWith(setting.mKey, NS_LITERAL_STRING(UMS_VOLUME_ENABLED_PREFIX)) &&
|
||||
StringEndsWith(setting.mKey, NS_LITERAL_STRING(UMS_VOLUME_ENABLED_SUFFIX))) {
|
||||
if (!setting.mValue.isBoolean()) {
|
||||
return NS_OK;
|
||||
}
|
||||
const size_t prefixLen = sizeof(UMS_VOLUME_ENABLED_PREFIX) - 1;
|
||||
const size_t suffixLen = sizeof(UMS_VOLUME_ENABLED_SUFFIX) - 1;
|
||||
nsDependentSubstring volumeName =
|
||||
Substring(keyStr, prefixLen, keyStr.Length() - prefixLen - suffixLen);
|
||||
bool isSharingEnabled = value.toBoolean();
|
||||
Substring(setting.mKey, prefixLen, setting.mKey.Length() - prefixLen - suffixLen);
|
||||
bool isSharingEnabled = setting.mValue.toBoolean();
|
||||
SetAutoMounterSharingMode(NS_LossyConvertUTF16toASCII(volumeName), isSharingEnabled);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -220,8 +220,10 @@ NetworkManager.prototype = {
|
||||
observe: function(subject, topic, data) {
|
||||
switch (topic) {
|
||||
case TOPIC_MOZSETTINGS_CHANGED:
|
||||
let setting = JSON.parse(data);
|
||||
this.handle(setting.key, setting.value);
|
||||
if ("wrappedJSObject" in subject) {
|
||||
subject = subject.wrappedJSObject;
|
||||
}
|
||||
this.handle(subject.key, subject.value);
|
||||
break;
|
||||
case TOPIC_PREF_CHANGED:
|
||||
this._manageOfflineStatus =
|
||||
|
@ -960,8 +960,10 @@ XPCOMUtils.defineLazyGetter(this, "gDataConnectionManager", function () {
|
||||
observe: function(subject, topic, data) {
|
||||
switch (topic) {
|
||||
case kMozSettingsChangedObserverTopic:
|
||||
let setting = JSON.parse(data);
|
||||
this.handle(setting.key, setting.value);
|
||||
if ("wrappedJSObject" in subject) {
|
||||
subject = subject.wrappedJSObject;
|
||||
}
|
||||
this.handle(subject.key, subject.value);
|
||||
break;
|
||||
case NS_XPCOM_SHUTDOWN_OBSERVER_ID:
|
||||
this._shutdown();
|
||||
@ -3052,8 +3054,10 @@ RadioInterface.prototype = {
|
||||
observe: function(subject, topic, data) {
|
||||
switch (topic) {
|
||||
case kMozSettingsChangedObserverTopic:
|
||||
let setting = JSON.parse(data);
|
||||
this.handleSettingsChange(setting.key, setting.value, setting.isInternalChange);
|
||||
if ("wrappedJSObject" in subject) {
|
||||
subject = subject.wrappedJSObject;
|
||||
}
|
||||
this.handleSettingsChange(subject.key, subject.value, subject.isInternalChange);
|
||||
break;
|
||||
case kSysClockChangeObserverTopic:
|
||||
let offset = parseInt(data, 10);
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "xpcpublic.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/SettingChangeNotificationBinding.h"
|
||||
|
||||
#undef LOG
|
||||
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "Time Zone Setting" , ## args)
|
||||
@ -31,6 +33,7 @@
|
||||
#define MOZSETTINGS_CHANGED "mozsettings-changed"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
namespace {
|
||||
|
||||
@ -184,8 +187,8 @@ NS_IMPL_ISUPPORTS(TimeZoneSettingObserver, nsIObserver)
|
||||
|
||||
NS_IMETHODIMP
|
||||
TimeZoneSettingObserver::Observe(nsISupports *aSubject,
|
||||
const char *aTopic,
|
||||
const char16_t *aData)
|
||||
const char *aTopic,
|
||||
const char16_t *aData)
|
||||
{
|
||||
if (strcmp(aTopic, MOZSETTINGS_CHANGED) != 0) {
|
||||
return NS_OK;
|
||||
@ -199,37 +202,19 @@ TimeZoneSettingObserver::Observe(nsISupports *aSubject,
|
||||
// {"key":"time.timezone","value":"UTC-05:00"}
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
|
||||
// Parse the JSON value.
|
||||
nsDependentString dataStr(aData);
|
||||
JS::Rooted<JS::Value> val(cx);
|
||||
if (!JS_ParseJSON(cx, dataStr.get(), dataStr.Length(), &val) ||
|
||||
!val.isObject()) {
|
||||
RootedDictionary<SettingChangeNotification> setting(cx);
|
||||
if (!WrappedJSToDictionary(cx, aSubject, setting)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Get the key, which should be the JS string "time.timezone".
|
||||
JS::Rooted<JSObject*> obj(cx, &val.toObject());
|
||||
JS::Rooted<JS::Value> key(cx);
|
||||
if (!JS_GetProperty(cx, obj, "key", &key) ||
|
||||
!key.isString()) {
|
||||
if (!setting.mKey.EqualsASCII(TIME_TIMEZONE)) {
|
||||
return NS_OK;
|
||||
}
|
||||
bool match;
|
||||
if (!JS_StringEqualsAscii(cx, key.toString(), TIME_TIMEZONE, &match) ||
|
||||
!match) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Get the value, which should be a JS string like "America/Chicago".
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!JS_GetProperty(cx, obj, "value", &value) ||
|
||||
!value.isString()) {
|
||||
if (!setting.mValue.isString()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Set the system timezone.
|
||||
return SetTimeZone(value, cx);
|
||||
return SetTimeZone(setting.mValue, cx);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
@ -32,6 +32,7 @@ support-files =
|
||||
res7.resource^headers^
|
||||
res8.resource
|
||||
res8.resource^headers^
|
||||
resource_timing.js
|
||||
|
||||
[test_497898.html]
|
||||
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') || toolkit == 'android' #Bug 931116, b2g desktop specific, initial triage
|
||||
|
0
dom/tests/mochitest/general/resource_timing.js
Normal file
0
dom/tests/mochitest/general/resource_timing.js
Normal file
@ -86,6 +86,10 @@ function firstCheck() {
|
||||
ok(!!entries[0], "redirected res8.resource is missing from entries");
|
||||
checkRedirectCrossOriginResourceSameOrigin(entries[0]);
|
||||
|
||||
entries = window.performance.getEntriesByName("http://mochi.test:8888/tests/dom/tests/mochitest/general/resource_timing.js");
|
||||
ok(!!entries[0], "same origin resource_timing.js is missing from entries");
|
||||
checkSameOrigin(entries[0]);
|
||||
|
||||
is(bufferFullCounter, expectedBufferFullEvents, "Buffer full was called");
|
||||
finishTests();
|
||||
}
|
||||
@ -176,6 +180,7 @@ function finishTests() {
|
||||
<object data="http://test1.example.com/tests/dom/tests/mochitest/general/res6.resource"> <!-- cross origin, Timing-Allow-Origin: "" (empty string) -->
|
||||
<object data="http://test1.example.com/tests/dom/tests/mochitest/general/res7.resource"> <!-- cross origin, Timing-Allow-Origin: http://mochi.test:8888 http://test1.com header -->
|
||||
<object data="http://test1.example.com/tests/dom/tests/mochitest/general/res8.resource"> <!-- double cross origin redirect -->
|
||||
<script type="text/javascript" src="http://mochi.test:8888/tests/dom/tests/mochitest/general/resource_timing.js"></script> <!-- same origin script -->
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
@ -6,7 +6,7 @@ support-files =
|
||||
|
||||
[test_notification_basics.html]
|
||||
[test_notification_storage.html]
|
||||
skip-if = (toolkit == 'gonk' && debug) #debug-only timeout
|
||||
skip-if = (toolkit == 'gonk')
|
||||
[test_bug931307.html]
|
||||
skip-if = (toolkit == 'gonk' && debug) #debug-only timeout
|
||||
[test_notification_resend.html]
|
||||
|
21
dom/webidl/ScrollViewChangeEvent.webidl
Normal file
21
dom/webidl/ScrollViewChangeEvent.webidl
Normal file
@ -0,0 +1,21 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/.
|
||||
*/
|
||||
|
||||
enum ScrollState {"started", "stopped"};
|
||||
|
||||
dictionary ScrollViewChangeEventInit : EventInit {
|
||||
ScrollState state = "started";
|
||||
float scrollX = 0;
|
||||
float scrollY = 0;
|
||||
};
|
||||
|
||||
[Constructor(DOMString type, optional ScrollViewChangeEventInit eventInit),
|
||||
ChromeOnly]
|
||||
interface ScrollViewChangeEvent : Event {
|
||||
readonly attribute ScrollState state;
|
||||
readonly attribute float scrollX;
|
||||
readonly attribute float scrollY;
|
||||
};
|
12
dom/webidl/SettingChangeNotification.webidl
Normal file
12
dom/webidl/SettingChangeNotification.webidl
Normal file
@ -0,0 +1,12 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/.
|
||||
*/
|
||||
|
||||
// Used internally by Gecko
|
||||
dictionary SettingChangeNotification {
|
||||
DOMString key = "";
|
||||
any value;
|
||||
boolean isInternalChange = false;
|
||||
};
|
@ -337,6 +337,7 @@ WEBIDL_FILES = [
|
||||
'ServiceWorkerContainer.webidl',
|
||||
'ServiceWorkerGlobalScope.webidl',
|
||||
'ServiceWorkerRegistration.webidl',
|
||||
'SettingChangeNotification.webidl',
|
||||
'SettingsManager.webidl',
|
||||
'ShadowRoot.webidl',
|
||||
'SharedWorker.webidl',
|
||||
@ -679,6 +680,7 @@ GENERATED_EVENTS_WEBIDL_FILES = [
|
||||
'RTCPeerConnectionIceEvent.webidl',
|
||||
'RTCPeerConnectionIdentityErrorEvent.webidl',
|
||||
'RTCPeerConnectionIdentityEvent.webidl',
|
||||
'ScrollViewChangeEvent.webidl',
|
||||
'SelectionChangeEvent.webidl',
|
||||
'StyleRuleChangeEvent.webidl',
|
||||
'StyleSheetApplicableStateChangeEvent.webidl',
|
||||
|
@ -3642,17 +3642,16 @@ WifiWorker.prototype = {
|
||||
observe: function observe(subject, topic, data) {
|
||||
switch (topic) {
|
||||
case kMozSettingsChangedObserverTopic:
|
||||
// The string we're interested in will be a JSON string that looks like:
|
||||
// {"key":"wifi.enabled","value":"true"}.
|
||||
|
||||
let setting = JSON.parse(data);
|
||||
// To avoid WifiWorker setting the wifi again, don't need to deal with
|
||||
// the "mozsettings-changed" event fired from internal setting.
|
||||
if (setting.isInternalChange) {
|
||||
if ("wrappedJSObject" in subject) {
|
||||
subject = subject.wrappedJSObject;
|
||||
}
|
||||
if (subject.isInternalChange) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.handle(setting.key, setting.value);
|
||||
this.handle(subject.key, subject.value);
|
||||
break;
|
||||
|
||||
case "xpcom-shutdown":
|
||||
|
@ -95,6 +95,7 @@ static const char *sExtensionNames[] = {
|
||||
"GL_ARB_texture_float",
|
||||
"GL_ARB_texture_non_power_of_two",
|
||||
"GL_ARB_texture_rectangle",
|
||||
"GL_ARB_texture_storage",
|
||||
"GL_ARB_transform_feedback2",
|
||||
"GL_ARB_uniform_buffer_object",
|
||||
"GL_ARB_vertex_array_object",
|
||||
@ -930,6 +931,22 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
|
||||
}
|
||||
}
|
||||
|
||||
if (IsSupported(GLFeature::texture_storage)) {
|
||||
SymLoadStruct coreSymbols[] = {
|
||||
{ (PRFuncPtr*) &mSymbols.fTexStorage2D, { "TexStorage2D", nullptr } },
|
||||
{ (PRFuncPtr*) &mSymbols.fTexStorage3D, { "TexStorage3D", nullptr } },
|
||||
END_SYMBOLS
|
||||
};
|
||||
|
||||
if (!LoadSymbols(coreSymbols, trygl, prefix)) {
|
||||
NS_ERROR("GL supports texture storage without supplying its functions.");
|
||||
|
||||
MarkUnsupported(GLFeature::texture_storage);
|
||||
MarkExtensionUnsupported(ARB_texture_storage);
|
||||
ClearSymbols(coreSymbols);
|
||||
}
|
||||
}
|
||||
|
||||
// ARB_transform_feedback2/NV_transform_feedback2 is a
|
||||
// superset of EXT_transform_feedback/NV_transform_feedback
|
||||
// and adds glPauseTransformFeedback &
|
||||
|
@ -118,6 +118,7 @@ MOZ_BEGIN_ENUM_CLASS(GLFeature)
|
||||
texture_half_float,
|
||||
texture_half_float_linear,
|
||||
texture_non_power_of_two,
|
||||
texture_storage,
|
||||
transform_feedback2,
|
||||
uniform_buffer_object,
|
||||
uniform_matrix_nonsquare,
|
||||
@ -374,6 +375,7 @@ public:
|
||||
ARB_texture_float,
|
||||
ARB_texture_non_power_of_two,
|
||||
ARB_texture_rectangle,
|
||||
ARB_texture_storage,
|
||||
ARB_transform_feedback2,
|
||||
ARB_uniform_buffer_object,
|
||||
ARB_vertex_array_object,
|
||||
@ -3066,6 +3068,23 @@ public:
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Core GL 4.2, GL ES 3.0 & Extension ARB_texture_storage/EXT_texture_storage
|
||||
void fTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
|
||||
{
|
||||
BEFORE_GL_CALL;
|
||||
ASSERT_SYMBOL_PRESENT(fTexStorage2D);
|
||||
mSymbols.fTexStorage2D(target, levels, internalformat, width, height);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
void fTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
|
||||
{
|
||||
BEFORE_GL_CALL;
|
||||
ASSERT_SYMBOL_PRESENT(fTexStorage3D);
|
||||
mSymbols.fTexStorage3D(target, levels, internalformat, width, height, depth);
|
||||
AFTER_GL_CALL;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// 3D Textures
|
||||
|
@ -508,6 +508,20 @@ static const FeatureInfo sFeatureInfoArr[] = {
|
||||
GLContext::Extensions_End
|
||||
}
|
||||
},
|
||||
{
|
||||
"texture_storage",
|
||||
420, // OpenGL version
|
||||
300, // OpenGL ES version
|
||||
GLContext::ARB_texture_storage,
|
||||
{
|
||||
/*
|
||||
* Not including GL_EXT_texture_storage here because it
|
||||
* doesn't guarantee glTexStorage3D, which is required for
|
||||
* WebGL 2.
|
||||
*/
|
||||
GLContext::Extensions_End
|
||||
}
|
||||
},
|
||||
{
|
||||
"transform_feedback2",
|
||||
400, // OpenGL version
|
||||
|
@ -580,6 +580,12 @@ struct GLContextSymbols
|
||||
typedef void (GLAPIENTRY * PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params);
|
||||
PFNGLGETSAMPLERPARAMETERFVPROC fGetSamplerParameterfv;
|
||||
|
||||
// texture_storage
|
||||
typedef void (GLAPIENTRY * PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
PFNGLTEXSTORAGE2DPROC fTexStorage2D;
|
||||
typedef void (GLAPIENTRY * PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
|
||||
PFNGLTEXSTORAGE3DPROC fTexStorage3D;
|
||||
|
||||
// uniform_buffer_object
|
||||
typedef void (GLAPIENTRY * PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount,
|
||||
const GLchar* const* uniformNames, GLuint* uniformIndices);
|
||||
|
@ -11,6 +11,73 @@
|
||||
namespace mozilla {
|
||||
namespace gl {
|
||||
|
||||
// Returns `EGL_NO_SURFACE` (`0`) on error.
|
||||
static EGLSurface
|
||||
CreatePBufferSurface(GLLibraryEGL* egl,
|
||||
EGLDisplay display,
|
||||
EGLConfig config,
|
||||
const gfx::IntSize& size)
|
||||
{
|
||||
auto width = size.width;
|
||||
auto height = size.height;
|
||||
|
||||
EGLint attribs[] = {
|
||||
LOCAL_EGL_WIDTH, width,
|
||||
LOCAL_EGL_HEIGHT, height,
|
||||
LOCAL_EGL_NONE
|
||||
};
|
||||
|
||||
DebugOnly<EGLint> preCallErr = egl->fGetError();
|
||||
MOZ_ASSERT(preCallErr == LOCAL_EGL_SUCCESS);
|
||||
EGLSurface surface = egl->fCreatePbufferSurface(display, config, attribs);
|
||||
EGLint err = egl->fGetError();
|
||||
if (err != LOCAL_EGL_SUCCESS)
|
||||
return 0;
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
/*static*/ UniquePtr<SharedSurface_ANGLEShareHandle>
|
||||
SharedSurface_ANGLEShareHandle::Create(GLContext* gl,
|
||||
EGLContext context, EGLConfig config,
|
||||
const gfx::IntSize& size, bool hasAlpha)
|
||||
{
|
||||
GLLibraryEGL* egl = &sEGLLibrary;
|
||||
MOZ_ASSERT(egl);
|
||||
MOZ_ASSERT(egl->IsExtensionSupported(
|
||||
GLLibraryEGL::ANGLE_surface_d3d_texture_2d_share_handle));
|
||||
|
||||
if (!context || !config)
|
||||
return nullptr;
|
||||
|
||||
EGLDisplay display = egl->Display();
|
||||
EGLSurface pbuffer = CreatePBufferSurface(egl, display, config, size);
|
||||
if (!pbuffer)
|
||||
return nullptr;
|
||||
|
||||
// Declare everything before 'goto's.
|
||||
HANDLE shareHandle = nullptr;
|
||||
bool ok = egl->fQuerySurfacePointerANGLE(display,
|
||||
pbuffer,
|
||||
LOCAL_EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE,
|
||||
&shareHandle);
|
||||
if (!ok) {
|
||||
egl->fDestroySurface(egl->Display(), pbuffer);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GLuint fence = 0;
|
||||
if (gl->IsExtensionSupported(GLContext::NV_fence)) {
|
||||
gl->MakeCurrent();
|
||||
gl->fGenFences(1, &fence);
|
||||
}
|
||||
|
||||
typedef SharedSurface_ANGLEShareHandle ptrT;
|
||||
UniquePtr<ptrT> ret( new ptrT(gl, egl, size, hasAlpha, context,
|
||||
pbuffer, shareHandle, fence) );
|
||||
return Move(ret);
|
||||
}
|
||||
|
||||
EGLDisplay
|
||||
SharedSurface_ANGLEShareHandle::Display()
|
||||
{
|
||||
@ -114,6 +181,9 @@ SharedSurface_ANGLEShareHandle::PollSync_ContentThread_Impl()
|
||||
return PollSync();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Factory
|
||||
|
||||
static void
|
||||
FillPBufferAttribs_ByBits(nsTArray<EGLint>& aAttrs,
|
||||
int redBits, int greenBits,
|
||||
@ -169,15 +239,25 @@ FillPBufferAttribs_BySizes(nsTArray<EGLint>& attribs,
|
||||
alpha = 8;
|
||||
}
|
||||
|
||||
FillPBufferAttribs_ByBits(attribs,
|
||||
red, green, blue, alpha,
|
||||
depthBits, stencilBits);
|
||||
FillPBufferAttribs_ByBits(attribs, red, green, blue, alpha, depthBits,
|
||||
stencilBits);
|
||||
}
|
||||
|
||||
static bool
|
||||
DoesAttribBitsMatchCapBool(GLLibraryEGL* egl, EGLConfig config, EGLint attrib,
|
||||
bool capBool)
|
||||
{
|
||||
EGLint bits = 0;
|
||||
egl->fGetConfigAttrib(egl->Display(), config, attrib, &bits);
|
||||
MOZ_ASSERT(egl->fGetError() == LOCAL_EGL_SUCCESS);
|
||||
|
||||
bool hasBits = !!bits;
|
||||
|
||||
return hasBits == capBool;
|
||||
}
|
||||
|
||||
static EGLConfig
|
||||
ChooseConfig(GLContext* gl,
|
||||
GLLibraryEGL* egl,
|
||||
const SurfaceCaps& caps)
|
||||
ChooseConfig(GLContext* gl, GLLibraryEGL* egl, const SurfaceCaps& caps)
|
||||
{
|
||||
MOZ_ASSERT(egl);
|
||||
MOZ_ASSERT(caps.color);
|
||||
@ -188,28 +268,43 @@ ChooseConfig(GLContext* gl,
|
||||
|
||||
// Ok, now we have everything.
|
||||
nsTArray<EGLint> attribs(32);
|
||||
FillPBufferAttribs_BySizes(attribs,
|
||||
caps.bpp16, caps.alpha,
|
||||
depthBits, stencilBits);
|
||||
FillPBufferAttribs_BySizes(attribs, caps.bpp16, caps.alpha, depthBits,
|
||||
stencilBits);
|
||||
|
||||
// Time to try to get this config:
|
||||
EGLConfig configs[64];
|
||||
int numConfigs = sizeof(configs)/sizeof(EGLConfig);
|
||||
int foundConfigs = 0;
|
||||
|
||||
if (!egl->fChooseConfig(egl->Display(),
|
||||
attribs.Elements(),
|
||||
configs, numConfigs,
|
||||
&foundConfigs) ||
|
||||
if (!egl->fChooseConfig(egl->Display(), attribs.Elements(), configs,
|
||||
numConfigs, &foundConfigs) ||
|
||||
!foundConfigs)
|
||||
{
|
||||
NS_WARNING("No configs found for the requested formats.");
|
||||
return EGL_NO_CONFIG;
|
||||
}
|
||||
|
||||
// TODO: Pick a config progamatically instead of hoping that
|
||||
// the first config will be minimally matching our request.
|
||||
EGLConfig config = configs[0];
|
||||
// The requests passed to ChooseConfig are treated as minimums. If you ask
|
||||
// for 0 bits of alpha, we might still get 8 bits.
|
||||
EGLConfig config = EGL_NO_CONFIG;
|
||||
for (int i = 0; i < foundConfigs; i++) {
|
||||
EGLConfig cur = configs[0];
|
||||
if (DoesAttribBitsMatchCapBool(egl, cur, LOCAL_EGL_ALPHA_SIZE,
|
||||
caps.alpha) &&
|
||||
DoesAttribBitsMatchCapBool(egl, cur, LOCAL_EGL_DEPTH_SIZE,
|
||||
caps.depth) &&
|
||||
DoesAttribBitsMatchCapBool(egl, cur, LOCAL_EGL_STENCIL_SIZE,
|
||||
caps.stencil))
|
||||
{
|
||||
config = cur;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (config == EGL_NO_CONFIG) {
|
||||
NS_WARNING("No acceptable EGLConfig found.");
|
||||
return EGL_NO_CONFIG;
|
||||
}
|
||||
|
||||
if (gl->DebugMode()) {
|
||||
egl->DumpEGLConfig(config);
|
||||
@ -218,73 +313,6 @@ ChooseConfig(GLContext* gl,
|
||||
return config;
|
||||
}
|
||||
|
||||
// Returns `EGL_NO_SURFACE` (`0`) on error.
|
||||
static EGLSurface
|
||||
CreatePBufferSurface(GLLibraryEGL* egl,
|
||||
EGLDisplay display,
|
||||
EGLConfig config,
|
||||
const gfx::IntSize& size)
|
||||
{
|
||||
auto width = size.width;
|
||||
auto height = size.height;
|
||||
|
||||
EGLint attribs[] = {
|
||||
LOCAL_EGL_WIDTH, width,
|
||||
LOCAL_EGL_HEIGHT, height,
|
||||
LOCAL_EGL_NONE
|
||||
};
|
||||
|
||||
DebugOnly<EGLint> preCallErr = egl->fGetError();
|
||||
MOZ_ASSERT(preCallErr == LOCAL_EGL_SUCCESS);
|
||||
EGLSurface surface = egl->fCreatePbufferSurface(display, config, attribs);
|
||||
EGLint err = egl->fGetError();
|
||||
if (err != LOCAL_EGL_SUCCESS)
|
||||
return 0;
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
/*static*/ UniquePtr<SharedSurface_ANGLEShareHandle>
|
||||
SharedSurface_ANGLEShareHandle::Create(GLContext* gl,
|
||||
EGLContext context, EGLConfig config,
|
||||
const gfx::IntSize& size, bool hasAlpha)
|
||||
{
|
||||
GLLibraryEGL* egl = &sEGLLibrary;
|
||||
MOZ_ASSERT(egl);
|
||||
MOZ_ASSERT(egl->IsExtensionSupported(
|
||||
GLLibraryEGL::ANGLE_surface_d3d_texture_2d_share_handle));
|
||||
|
||||
if (!context || !config)
|
||||
return nullptr;
|
||||
|
||||
EGLDisplay display = egl->Display();
|
||||
EGLSurface pbuffer = CreatePBufferSurface(egl, display, config, size);
|
||||
if (!pbuffer)
|
||||
return nullptr;
|
||||
|
||||
// Declare everything before 'goto's.
|
||||
HANDLE shareHandle = nullptr;
|
||||
bool ok = egl->fQuerySurfacePointerANGLE(display,
|
||||
pbuffer,
|
||||
LOCAL_EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE,
|
||||
&shareHandle);
|
||||
if (!ok) {
|
||||
egl->fDestroySurface(egl->Display(), pbuffer);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GLuint fence = 0;
|
||||
if (gl->IsExtensionSupported(GLContext::NV_fence)) {
|
||||
gl->MakeCurrent();
|
||||
gl->fGenFences(1, &fence);
|
||||
}
|
||||
|
||||
typedef SharedSurface_ANGLEShareHandle ptrT;
|
||||
UniquePtr<ptrT> ret( new ptrT(gl, egl, size, hasAlpha, context,
|
||||
pbuffer, shareHandle, fence) );
|
||||
return Move(ret);
|
||||
}
|
||||
|
||||
/*static*/ UniquePtr<SurfaceFactory_ANGLEShareHandle>
|
||||
SurfaceFactory_ANGLEShareHandle::Create(GLContext* gl,
|
||||
const SurfaceCaps& caps)
|
||||
@ -295,25 +323,36 @@ SurfaceFactory_ANGLEShareHandle::Create(GLContext* gl,
|
||||
|
||||
auto ext = GLLibraryEGL::ANGLE_surface_d3d_texture_2d_share_handle;
|
||||
if (!egl->IsExtensionSupported(ext))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool success;
|
||||
typedef SurfaceFactory_ANGLEShareHandle ptrT;
|
||||
UniquePtr<ptrT> ret( new ptrT(gl, egl, caps) );
|
||||
UniquePtr<ptrT> ret( new ptrT(gl, egl, caps, &success) );
|
||||
|
||||
if (!success)
|
||||
return nullptr;
|
||||
|
||||
return Move(ret);
|
||||
}
|
||||
|
||||
SurfaceFactory_ANGLEShareHandle::SurfaceFactory_ANGLEShareHandle(GLContext* gl,
|
||||
GLLibraryEGL* egl,
|
||||
const SurfaceCaps& caps)
|
||||
const SurfaceCaps& caps,
|
||||
bool* const out_success)
|
||||
: SurfaceFactory(gl, SharedSurfaceType::EGLSurfaceANGLE, caps)
|
||||
, mProdGL(gl)
|
||||
, mEGL(egl)
|
||||
{
|
||||
mConfig = ChooseConfig(mProdGL, mEGL, mReadCaps);
|
||||
MOZ_ASSERT(out_success);
|
||||
*out_success = false;
|
||||
|
||||
mContext = GLContextEGL::Cast(mProdGL)->GetEGLContext();
|
||||
mConfig = ChooseConfig(mProdGL, mEGL, mReadCaps);
|
||||
if (mConfig == EGL_NO_CONFIG)
|
||||
return;
|
||||
|
||||
MOZ_ASSERT(mConfig && mContext);
|
||||
*out_success = true;
|
||||
}
|
||||
|
||||
} /* namespace gl */
|
||||
|
@ -88,7 +88,8 @@ public:
|
||||
protected:
|
||||
SurfaceFactory_ANGLEShareHandle(GLContext* gl,
|
||||
GLLibraryEGL* egl,
|
||||
const SurfaceCaps& caps);
|
||||
const SurfaceCaps& caps,
|
||||
bool* const out_success);
|
||||
|
||||
virtual UniquePtr<SharedSurface> CreateShared(const gfx::IntSize& size) MOZ_OVERRIDE {
|
||||
bool hasAlpha = mReadCaps.alpha;
|
||||
|
@ -143,7 +143,7 @@ nsFontCache::GetMetricsFor(const nsFont& aFont, nsIAtom* aLanguage,
|
||||
mFontMetrics.RemoveElementAt(i);
|
||||
mFontMetrics.AppendElement(fm);
|
||||
}
|
||||
fm->GetThebesFontGroup()->UpdateFontList();
|
||||
fm->GetThebesFontGroup()->UpdateUserFonts();
|
||||
NS_ADDREF(aMetrics = fm);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -132,9 +132,6 @@ nsFontMetrics::Init(const nsFont& aFont, nsIAtom* aLanguage,
|
||||
mFontGroup = gfxPlatform::GetPlatform()->
|
||||
CreateFontGroup(aFont.fontlist, &style, aUserFontSet);
|
||||
mFontGroup->SetTextPerfMetrics(aTextPerf);
|
||||
if (mFontGroup->FontListLength() < 1)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -150,7 +147,7 @@ nsFontMetrics::Destroy()
|
||||
|
||||
const gfxFont::Metrics& nsFontMetrics::GetMetrics() const
|
||||
{
|
||||
return mFontGroup->GetFontAt(0)->GetMetrics();
|
||||
return mFontGroup->GetFirstValidFont()->GetMetrics();
|
||||
}
|
||||
|
||||
nscoord
|
||||
|
@ -126,12 +126,6 @@ public:
|
||||
*/
|
||||
static int32_t FormatStrideForWidth(gfxImageFormat format, int32_t width);
|
||||
|
||||
/* Return the default set of context flags for this surface; these are
|
||||
* hints to the context about any special rendering considerations. See
|
||||
* gfxContext::SetFlag for documentation.
|
||||
*/
|
||||
virtual int32_t GetDefaultContextFlags() const { return 0; }
|
||||
|
||||
static gfxContentType ContentFromFormat(gfxImageFormat format);
|
||||
|
||||
void SetSubpixelAntialiasingEnabled(bool aEnabled);
|
||||
|
@ -34,13 +34,6 @@ public:
|
||||
return gfxIntSize(mSize.width, mSize.height);
|
||||
}
|
||||
|
||||
virtual int32_t GetDefaultContextFlags() const
|
||||
{
|
||||
return gfxContext::FLAG_SIMPLIFY_OPERATORS |
|
||||
gfxContext::FLAG_DISABLE_SNAPPING |
|
||||
gfxContext::FLAG_DISABLE_COPY_BACKGROUND;
|
||||
}
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIOutputStream> mStream;
|
||||
double mXDPI;
|
||||
|
@ -41,12 +41,6 @@ public:
|
||||
return mSize;
|
||||
}
|
||||
|
||||
virtual int32_t GetDefaultContextFlags() const
|
||||
{
|
||||
return gfxContext::FLAG_SIMPLIFY_OPERATORS |
|
||||
gfxContext::FLAG_DISABLE_SNAPPING;
|
||||
}
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIOutputStream> mStream;
|
||||
double mXDPI;
|
||||
|
@ -813,8 +813,8 @@ FindFontPatterns(gfxUserFontSet *mUserFontSet,
|
||||
gfxFontFamily *family = mUserFontSet->LookupFamily(utf16Family);
|
||||
if (family) {
|
||||
gfxUserFontEntry* userFontEntry =
|
||||
mUserFontSet->FindUserFontEntry(family, style, needsBold,
|
||||
aWaitForUserFont);
|
||||
mUserFontSet->FindUserFontEntryAndLoad(family, style, needsBold,
|
||||
aWaitForUserFont);
|
||||
if (userFontEntry) {
|
||||
fontEntry = static_cast<gfxUserFcFontEntry*>
|
||||
(userFontEntry->GetPlatformFontEntry());
|
||||
@ -826,9 +826,10 @@ FindFontPatterns(gfxUserFontSet *mUserFontSet,
|
||||
// and probably never use it
|
||||
if (!fontEntry && aStyle != NS_FONT_STYLE_NORMAL) {
|
||||
style.style = NS_FONT_STYLE_NORMAL;
|
||||
userFontEntry = mUserFontSet->FindUserFontEntry(family, style,
|
||||
needsBold,
|
||||
aWaitForUserFont);
|
||||
userFontEntry =
|
||||
mUserFontSet->FindUserFontEntryAndLoad(family, style,
|
||||
needsBold,
|
||||
aWaitForUserFont);
|
||||
if (userFontEntry) {
|
||||
fontEntry = static_cast<gfxUserFcFontEntry*>
|
||||
(userFontEntry->GetPlatformFontEntry());
|
||||
@ -1308,16 +1309,22 @@ gfxPangoFontGroup::GetBaseFont()
|
||||
return static_cast<gfxFcFont*>(mFonts[0].Font());
|
||||
}
|
||||
|
||||
gfxFont*
|
||||
gfxPangoFontGroup::GetFirstValidFont()
|
||||
{
|
||||
return GetFontAt(0);
|
||||
}
|
||||
|
||||
gfxFont *
|
||||
gfxPangoFontGroup::GetFontAt(int32_t i)
|
||||
{
|
||||
// If it turns out to be hard for all clients that cache font
|
||||
// groups to call UpdateFontList at appropriate times, we could
|
||||
// instead consider just calling UpdateFontList from someplace
|
||||
// groups to call UpdateUserFonts at appropriate times, we could
|
||||
// instead consider just calling UpdateUserFonts from someplace
|
||||
// more central (such as here).
|
||||
NS_ASSERTION(!mUserFontSet || mCurrGeneration == GetGeneration(),
|
||||
"Whoever was caching this font group should have "
|
||||
"called UpdateFontList on it");
|
||||
"called UpdateUserFonts on it");
|
||||
|
||||
NS_PRECONDITION(i == 0, "Only have one font");
|
||||
|
||||
@ -1325,7 +1332,7 @@ gfxPangoFontGroup::GetFontAt(int32_t i)
|
||||
}
|
||||
|
||||
void
|
||||
gfxPangoFontGroup::UpdateFontList()
|
||||
gfxPangoFontGroup::UpdateUserFonts()
|
||||
{
|
||||
uint64_t newGeneration = GetGeneration();
|
||||
if (newGeneration == mCurrGeneration)
|
||||
|
@ -30,9 +30,11 @@ public:
|
||||
|
||||
virtual gfxFontGroup *Copy(const gfxFontStyle *aStyle);
|
||||
|
||||
virtual gfxFont* GetFirstValidFont();
|
||||
|
||||
virtual gfxFont *GetFontAt(int32_t i);
|
||||
|
||||
virtual void UpdateFontList();
|
||||
virtual void UpdateUserFonts();
|
||||
|
||||
virtual already_AddRefed<gfxFont>
|
||||
FindFontForChar(uint32_t aCh, uint32_t aPrevCh, int32_t aRunScript,
|
||||
|
@ -15,9 +15,8 @@ gfxQuartzSurface::MakeInvalid()
|
||||
mSize = gfxIntSize(-1, -1);
|
||||
}
|
||||
|
||||
gfxQuartzSurface::gfxQuartzSurface(const gfxSize& desiredSize, gfxImageFormat format,
|
||||
bool aForPrinting)
|
||||
: mCGContext(nullptr), mSize(desiredSize), mForPrinting(aForPrinting)
|
||||
gfxQuartzSurface::gfxQuartzSurface(const gfxSize& desiredSize, gfxImageFormat format)
|
||||
: mCGContext(nullptr), mSize(desiredSize)
|
||||
{
|
||||
gfxIntSize size((unsigned int) floor(desiredSize.width),
|
||||
(unsigned int) floor(desiredSize.height));
|
||||
@ -41,9 +40,8 @@ gfxQuartzSurface::gfxQuartzSurface(const gfxSize& desiredSize, gfxImageFormat fo
|
||||
}
|
||||
|
||||
gfxQuartzSurface::gfxQuartzSurface(CGContextRef context,
|
||||
const gfxSize& desiredSize,
|
||||
bool aForPrinting)
|
||||
: mCGContext(context), mSize(desiredSize), mForPrinting(aForPrinting)
|
||||
const gfxSize& desiredSize)
|
||||
: mCGContext(context), mSize(desiredSize)
|
||||
{
|
||||
gfxIntSize size((unsigned int) floor(desiredSize.width),
|
||||
(unsigned int) floor(desiredSize.height));
|
||||
@ -66,9 +64,8 @@ gfxQuartzSurface::gfxQuartzSurface(CGContextRef context,
|
||||
}
|
||||
|
||||
gfxQuartzSurface::gfxQuartzSurface(CGContextRef context,
|
||||
const gfxIntSize& size,
|
||||
bool aForPrinting)
|
||||
: mCGContext(context), mSize(size), mForPrinting(aForPrinting)
|
||||
const gfxIntSize& size)
|
||||
: mCGContext(context), mSize(size)
|
||||
{
|
||||
if (!CheckSurfaceSize(size))
|
||||
MakeInvalid();
|
||||
@ -89,9 +86,8 @@ gfxQuartzSurface::gfxQuartzSurface(CGContextRef context,
|
||||
}
|
||||
|
||||
gfxQuartzSurface::gfxQuartzSurface(cairo_surface_t *csurf,
|
||||
const gfxIntSize& aSize,
|
||||
bool aForPrinting) :
|
||||
mSize(aSize), mForPrinting(aForPrinting)
|
||||
const gfxIntSize& aSize) :
|
||||
mSize(aSize)
|
||||
{
|
||||
mCGContext = cairo_quartz_surface_get_cg_context (csurf);
|
||||
CGContextRetain (mCGContext);
|
||||
@ -102,9 +98,8 @@ gfxQuartzSurface::gfxQuartzSurface(cairo_surface_t *csurf,
|
||||
gfxQuartzSurface::gfxQuartzSurface(unsigned char *data,
|
||||
const gfxSize& desiredSize,
|
||||
long stride,
|
||||
gfxImageFormat format,
|
||||
bool aForPrinting)
|
||||
: mCGContext(nullptr), mSize(desiredSize), mForPrinting(aForPrinting)
|
||||
gfxImageFormat format)
|
||||
: mCGContext(nullptr), mSize(desiredSize)
|
||||
{
|
||||
gfxIntSize size((unsigned int) floor(desiredSize.width),
|
||||
(unsigned int) floor(desiredSize.height));
|
||||
@ -130,9 +125,8 @@ gfxQuartzSurface::gfxQuartzSurface(unsigned char *data,
|
||||
gfxQuartzSurface::gfxQuartzSurface(unsigned char *data,
|
||||
const gfxIntSize& aSize,
|
||||
long stride,
|
||||
gfxImageFormat format,
|
||||
bool aForPrinting)
|
||||
: mCGContext(nullptr), mSize(aSize.width, aSize.height), mForPrinting(aForPrinting)
|
||||
gfxImageFormat format)
|
||||
: mCGContext(nullptr), mSize(aSize.width, aSize.height)
|
||||
{
|
||||
if (!CheckSurfaceSize(aSize))
|
||||
MakeInvalid();
|
||||
@ -173,15 +167,6 @@ gfxQuartzSurface::GetCGContextWithClip(gfxContext *ctx)
|
||||
return cairo_quartz_get_cg_context_with_clip(ctx->GetCairo());
|
||||
}
|
||||
|
||||
int32_t gfxQuartzSurface::GetDefaultContextFlags() const
|
||||
{
|
||||
if (mForPrinting)
|
||||
return gfxContext::FLAG_DISABLE_SNAPPING |
|
||||
gfxContext::FLAG_DISABLE_COPY_BACKGROUND;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
already_AddRefed<gfxImageSurface> gfxQuartzSurface::GetAsImageSurface()
|
||||
{
|
||||
cairo_surface_t *surface = cairo_quartz_surface_get_image(mSurface);
|
||||
|
@ -17,12 +17,12 @@ class gfxImageSurface;
|
||||
|
||||
class gfxQuartzSurface : public gfxASurface {
|
||||
public:
|
||||
gfxQuartzSurface(const gfxSize& size, gfxImageFormat format, bool aForPrinting = false);
|
||||
gfxQuartzSurface(CGContextRef context, const gfxSize& size, bool aForPrinting = false);
|
||||
gfxQuartzSurface(CGContextRef context, const gfxIntSize& size, bool aForPrinting = false);
|
||||
gfxQuartzSurface(cairo_surface_t *csurf, const gfxIntSize& aSize, bool aForPrinting = false);
|
||||
gfxQuartzSurface(unsigned char *data, const gfxSize& size, long stride, gfxImageFormat format, bool aForPrinting = false);
|
||||
gfxQuartzSurface(unsigned char *data, const gfxIntSize& size, long stride, gfxImageFormat format, bool aForPrinting = false);
|
||||
gfxQuartzSurface(const gfxSize& size, gfxImageFormat format);
|
||||
gfxQuartzSurface(CGContextRef context, const gfxSize& size);
|
||||
gfxQuartzSurface(CGContextRef context, const gfxIntSize& size);
|
||||
gfxQuartzSurface(cairo_surface_t *csurf, const gfxIntSize& aSize);
|
||||
gfxQuartzSurface(unsigned char *data, const gfxSize& size, long stride, gfxImageFormat format);
|
||||
gfxQuartzSurface(unsigned char *data, const gfxIntSize& size, long stride, gfxImageFormat format);
|
||||
|
||||
virtual ~gfxQuartzSurface();
|
||||
|
||||
@ -35,8 +35,6 @@ public:
|
||||
|
||||
CGContextRef GetCGContextWithClip(gfxContext *ctx);
|
||||
|
||||
virtual int32_t GetDefaultContextFlags() const;
|
||||
|
||||
already_AddRefed<gfxImageSurface> GetAsImageSurface();
|
||||
|
||||
protected:
|
||||
@ -44,7 +42,6 @@ protected:
|
||||
|
||||
CGContextRef mCGContext;
|
||||
gfxSize mSize;
|
||||
bool mForPrinting;
|
||||
};
|
||||
|
||||
#endif /* GFX_QUARTZSURFACE_H */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user