Merge m-c to fx-team a=merge

This commit is contained in:
Wes Kocher 2014-10-23 18:06:22 -07:00
commit c5a3a5c3a7
216 changed files with 2028 additions and 1469 deletions

View File

@ -33,8 +33,8 @@ LOCAL_INCLUDES += [
'/accessible/xul',
'/layout/generic',
'/layout/xul',
'/widget',
'/widget/cocoa',
'/widget/xpwidgets',
]
FINAL_LIBRARY = 'xul'

View File

@ -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="f46d56d812480bff7f3b35e8cacbedfa4d49edc5"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="d893a9b971a0f3ee48e5a57dca516837d92cf52b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<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="b9fe09fe470f7c22d70c98cc0458e49fdd4618c2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="be8b952fde51d8c83748b41ce232f02b2218451d"/>
<!-- 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"/>

View File

@ -19,13 +19,13 @@
<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="f46d56d812480bff7f3b35e8cacbedfa4d49edc5"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d893a9b971a0f3ee48e5a57dca516837d92cf52b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<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="b9fe09fe470f7c22d70c98cc0458e49fdd4618c2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="be8b952fde51d8c83748b41ce232f02b2218451d"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>

View File

@ -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="f46d56d812480bff7f3b35e8cacbedfa4d49edc5"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="d893a9b971a0f3ee48e5a57dca516837d92cf52b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b9fe09fe470f7c22d70c98cc0458e49fdd4618c2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="be8b952fde51d8c83748b41ce232f02b2218451d"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -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="f46d56d812480bff7f3b35e8cacbedfa4d49edc5"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="d893a9b971a0f3ee48e5a57dca516837d92cf52b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<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="b9fe09fe470f7c22d70c98cc0458e49fdd4618c2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="be8b952fde51d8c83748b41ce232f02b2218451d"/>
<!-- 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"/>

View File

@ -19,13 +19,13 @@
<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="f46d56d812480bff7f3b35e8cacbedfa4d49edc5"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d893a9b971a0f3ee48e5a57dca516837d92cf52b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<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="b9fe09fe470f7c22d70c98cc0458e49fdd4618c2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="be8b952fde51d8c83748b41ce232f02b2218451d"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>

View File

@ -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="f46d56d812480bff7f3b35e8cacbedfa4d49edc5"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="d893a9b971a0f3ee48e5a57dca516837d92cf52b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<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="b9fe09fe470f7c22d70c98cc0458e49fdd4618c2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="be8b952fde51d8c83748b41ce232f02b2218451d"/>
<!-- 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"/>

View File

@ -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="f46d56d812480bff7f3b35e8cacbedfa4d49edc5"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="d893a9b971a0f3ee48e5a57dca516837d92cf52b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b9fe09fe470f7c22d70c98cc0458e49fdd4618c2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="be8b952fde51d8c83748b41ce232f02b2218451d"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "9420e20475daffd4ff3f8e4b1537a4800346bcb6",
"revision": "e7679f24177bc939b159dd075085352229a4b709",
"repo_path": "/integration/gaia-central"
}

View File

@ -17,12 +17,12 @@
<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="f46d56d812480bff7f3b35e8cacbedfa4d49edc5"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d893a9b971a0f3ee48e5a57dca516837d92cf52b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<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="b9fe09fe470f7c22d70c98cc0458e49fdd4618c2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="be8b952fde51d8c83748b41ce232f02b2218451d"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
<project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>

View File

@ -15,7 +15,7 @@
<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="f46d56d812480bff7f3b35e8cacbedfa4d49edc5"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d893a9b971a0f3ee48e5a57dca516837d92cf52b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -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="f46d56d812480bff7f3b35e8cacbedfa4d49edc5"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="d893a9b971a0f3ee48e5a57dca516837d92cf52b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="b9fe09fe470f7c22d70c98cc0458e49fdd4618c2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="be8b952fde51d8c83748b41ce232f02b2218451d"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
<!-- Stock Android things -->

View File

@ -17,12 +17,12 @@
<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="f46d56d812480bff7f3b35e8cacbedfa4d49edc5"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d893a9b971a0f3ee48e5a57dca516837d92cf52b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="314f305d3163cc094e6fe7701d95a98fc180b639"/>
<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="b9fe09fe470f7c22d70c98cc0458e49fdd4618c2"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="be8b952fde51d8c83748b41ce232f02b2218451d"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>

View File

@ -1,4 +1,3 @@
MOZ_AUTOMATION_TALOS_SENDCHANGE=0
. $topsrcdir/build/macosx/mozconfig.common
ac_add_options --enable-application=b2g/dev

View File

@ -30,10 +30,11 @@ LOCAL_INCLUDES += [
'/xpcom/build',
]
DELAYLOAD_DLLS += [
'mozglue.dll',
]
USE_STATIC_LIBS = True
if not CONFIG['MOZ_METRO']:
DELAYLOAD_DLLS += [
'mozglue.dll',
]
USE_STATIC_LIBS = True
if CONFIG['_MSC_VER']:
# Always enter a Windows program through wmain, whether or not we're
@ -55,7 +56,7 @@ if CONFIG['OS_ARCH'] == 'WINNT':
if CONFIG['OS_ARCH'] == 'WINNT' and not CONFIG['GNU_CC']:
LDFLAGS += ['/HEAP:0x40000']
if CONFIG['OS_ARCH'] == 'WINNT':
if CONFIG['OS_ARCH'] == 'WINNT' and not CONFIG['MOZ_METRO']:
USE_LIBS += [
'mozglue',
'xpcomglue_staticruntime',

View File

@ -137,7 +137,9 @@ GetAboutModuleName(nsIURI *aURI)
}
NS_IMETHODIMP
AboutRedirector::NewChannel(nsIURI *aURI, nsIChannel **result)
AboutRedirector::NewChannel(nsIURI* aURI,
nsILoadInfo* aLoadInfo,
nsIChannel** result)
{
NS_ENSURE_ARG_POINTER(aURI);
NS_ASSERTION(result, "must not be null");

View File

@ -5,7 +5,6 @@ ac_add_options --with-google-oauth-api-keyfile=/builds/google-oauth-api.key
ac_add_options --disable-unified-compilation
MOZ_AUTOMATION_TALOS_SENDCHANGE=0
MOZ_AUTOMATION_L10N_CHECK=0
. $topsrcdir/build/unix/mozconfig.linux32

View File

@ -3,7 +3,6 @@ ac_add_options --enable-dmd
ac_add_options --enable-signmar
ac_add_options --with-google-oauth-api-keyfile=/builds/google-oauth-api.key
MOZ_AUTOMATION_TALOS_SENDCHANGE=0
MOZ_AUTOMATION_L10N_CHECK=0
. $topsrcdir/build/unix/mozconfig.linux

View File

@ -1,6 +1,4 @@
MOZ_AUTOMATION_UPLOAD=0
MOZ_AUTOMATION_UNITTEST_SENDCHANGE=0
MOZ_AUTOMATION_CHECK=0
. "$topsrcdir/browser/config/mozconfigs/linux64/debug"

View File

@ -1,9 +1,6 @@
MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_UNITTEST_SENDCHANGE=0
MOZ_AUTOMATION_TALOS_SENDCHANGE=0
MOZ_AUTOMATION_L10N_CHECK=0
MOZ_AUTOMATION_CHECK=0
. "$topsrcdir/build/mozconfig.common"

View File

@ -1,7 +1,4 @@
MOZ_AUTOMATION_UPLOAD=0
MOZ_AUTOMATION_UNITTEST_SENDCHANGE=0
MOZ_AUTOMATION_TALOS_SENDCHANGE=0
MOZ_AUTOMATION_CHECK=0
MOZ_AUTOMATION_PRETTY=1
. "$topsrcdir/browser/config/mozconfigs/linux64/nightly"

View File

@ -1,8 +1,5 @@
MOZ_AUTOMATION_PRETTY=1
MOZ_AUTOMATION_UPLOAD=0
MOZ_AUTOMATION_UNITTEST_SENDCHANGE=0
MOZ_AUTOMATION_TALOS_SENDCHANGE=0
MOZ_AUTOMATION_CHECK=0
. "$topsrcdir/browser/config/mozconfigs/macosx-universal/nightly"
ac_add_options --disable-unified-compilation

View File

@ -1,4 +1,3 @@
MOZ_AUTOMATION_TALOS_SENDCHANGE=0
. $topsrcdir/build/macosx/mozconfig.common
ac_add_options --enable-debug

View File

@ -1,7 +1,4 @@
MOZ_AUTOMATION_UPLOAD=0
MOZ_AUTOMATION_UNITTEST_SENDCHANGE=0
MOZ_AUTOMATION_TALOS_SENDCHANGE=0
MOZ_AUTOMATION_CHECK=0
. "$topsrcdir/browser/config/mozconfigs/macosx64/debug"
ac_add_options --disable-unified-compilation

View File

@ -1,6 +1,5 @@
. "$topsrcdir/build/mozconfig.win-common"
MOZ_AUTOMATION_L10N_CHECK=0
MOZ_AUTOMATION_TALOS_SENDCHANGE=0
. "$topsrcdir/browser/config/mozconfigs/common"
ac_add_options --enable-debug

View File

@ -1,8 +1,5 @@
. "$topsrcdir/build/mozconfig.win-common"
MOZ_AUTOMATION_CHECK=0
MOZ_AUTOMATION_L10N_CHECK=0
MOZ_AUTOMATION_TALOS_SENDCHANGE=0
MOZ_AUTOMATION_UNITTEST_SENDCHANGE=0
MOZ_AUTOMATION_UPLOAD=0
. "$topsrcdir/browser/config/mozconfigs/win32/debug"

View File

@ -1,9 +1,6 @@
. "$topsrcdir/build/mozconfig.win-common"
MOZ_AUTOMATION_PRETTY=1
MOZ_AUTOMATION_UPLOAD=0
MOZ_AUTOMATION_UNITTEST_SENDCHANGE=0
MOZ_AUTOMATION_TALOS_SENDCHANGE=0
MOZ_AUTOMATION_CHECK=0
. "$topsrcdir/browser/config/mozconfigs/win32/nightly"
ac_add_options --disable-unified-compilation

View File

@ -1,6 +1,5 @@
. "$topsrcdir/build/mozconfig.win-common"
MOZ_AUTOMATION_L10N_CHECK=0
MOZ_AUTOMATION_TALOS_SENDCHANGE=0
. "$topsrcdir/browser/config/mozconfigs/common"
ac_add_options --target=x86_64-pc-mingw32

View File

@ -6,28 +6,28 @@
import sys
import os
import sha
import hashlib
import json
import re
import errno
from argparse import ArgumentParser
def getFileHashAndSize(filename):
sha1Hash = 'UNKNOWN'
sha512Hash = 'UNKNOWN'
size = 'UNKNOWN'
try:
# open in binary mode to make sure we get consistent results
# across all platforms
f = open(filename, "rb")
shaObj = sha.new(f.read())
sha1Hash = shaObj.hexdigest()
shaObj = hashlib.sha512(f.read())
sha512Hash = shaObj.hexdigest()
size = os.path.getsize(filename)
except:
pass
return (sha1Hash, size)
return (sha512Hash, size)
def getMarProperties(filename):
if not os.path.exists(filename):

View File

@ -75,6 +75,7 @@ MACH_MODULES = [
'python/mach/mach/commands/commandinfo.py',
'python/mozboot/mozboot/mach_commands.py',
'python/mozbuild/mozbuild/mach_commands.py',
'python/mozbuild/mozbuild/backend/mach_commands.py',
'python/mozbuild/mozbuild/frontend/mach_commands.py',
'services/common/tests/mach_commands.py',
'testing/mach_commands.py',

View File

@ -20,7 +20,6 @@ AUTOMATION_UPLOAD_OUTPUT = $(DIST)/automation-upload.txt
# Helper variables to convert from MOZ_AUTOMATION_* variables to the
# corresponding the make target
tier_BUILD_SYMBOLS = buildsymbols
tier_CHECK = check
tier_L10N_CHECK = l10n-check
tier_PRETTY_L10N_CHECK = pretty-l10n-check
tier_INSTALLER = installer
@ -49,7 +48,6 @@ moz_automation_symbols = \
PRETTY_INSTALLER \
UPDATE_PACKAGING \
PRETTY_UPDATE_PACKAGING \
CHECK \
L10N_CHECK \
PRETTY_L10N_CHECK \
UPLOAD \
@ -74,11 +72,10 @@ automation/upload: automation/package-tests
automation/upload: automation/buildsymbols
automation/upload: automation/update-packaging
# automation/{pretty-}package and automation/check should depend on build (which is
# implicit due to the way client.mk invokes automation/build), but buildsymbols
# changes the binaries/libs, and that's what we package/test.
# automation/{pretty-}package should depend on build (which is implicit due to
# the way client.mk invokes automation/build), but buildsymbols changes the
# binaries/libs, and that's what we package/test.
automation/pretty-package: automation/buildsymbols
automation/check: automation/buildsymbols
# The 'pretty' versions of targets run before the regular ones to avoid
# conflicts in writing to the same files.
@ -91,9 +88,6 @@ automation/update-packaging: automation/pretty-update-packaging
automation/build: $(addprefix automation/,$(MOZ_AUTOMATION_TIERS))
$(PYTHON) $(topsrcdir)/build/gen_mach_buildprops.py --complete-mar-file $(DIST)/$(COMPLETE_MAR) --upload-output $(AUTOMATION_UPLOAD_OUTPUT)
# make check runs with the keep-going flag so we can see all the failures
AUTOMATION_EXTRA_CMDLINE-check = -k
# We need the log from make upload to grep it for urls in order to set
# properties.
AUTOMATION_EXTRA_CMDLINE-upload = 2>&1 | tee $(AUTOMATION_UPLOAD_OUTPUT)

View File

@ -10,13 +10,10 @@
# overridden by setting them earlier in the appropriate mozconfig.
mk_add_options "export MOZ_AUTOMATION_BUILD_SYMBOLS=${MOZ_AUTOMATION_BUILD_SYMBOLS-1}"
mk_add_options "export MOZ_AUTOMATION_CHECK=${MOZ_AUTOMATION_CHECK-1}"
mk_add_options "export MOZ_AUTOMATION_L10N_CHECK=${MOZ_AUTOMATION_L10N_CHECK-1}"
mk_add_options "export MOZ_AUTOMATION_PACKAGE=${MOZ_AUTOMATION_PACKAGE-1}"
mk_add_options "export MOZ_AUTOMATION_PACKAGE_TESTS=${MOZ_AUTOMATION_PACKAGE_TESTS-1}"
mk_add_options "export MOZ_AUTOMATION_INSTALLER=${MOZ_AUTOMATION_INSTALLER-0}"
mk_add_options "export MOZ_AUTOMATION_TALOS_SENDCHANGE=${MOZ_AUTOMATION_TALOS_SENDCHANGE-1}"
mk_add_options "export MOZ_AUTOMATION_UNITTEST_SENDCHANGE=${MOZ_AUTOMATION_UNITTEST_SENDCHANGE-1}"
mk_add_options "export MOZ_AUTOMATION_UPDATE_PACKAGING=${MOZ_AUTOMATION_UPDATE_PACKAGING-0}"
mk_add_options "export MOZ_AUTOMATION_UPLOAD=${MOZ_AUTOMATION_UPLOAD-1}"
mk_add_options "export MOZ_AUTOMATION_UPLOAD_SYMBOLS=${MOZ_AUTOMATION_UPLOAD_SYMBOLS-0}"

View File

@ -1,4 +1,3 @@
MOZ_AUTOMATION_TALOS_SENDCHANGE=0
MOZ_AUTOMATION_L10N_CHECK=0
. "$topsrcdir/build/mozconfig.common"

View File

@ -99,8 +99,9 @@ nsChromeProtocolHandler::NewURI(const nsACString &aSpec,
}
NS_IMETHODIMP
nsChromeProtocolHandler::NewChannel(nsIURI* aURI,
nsIChannel* *aResult)
nsChromeProtocolHandler::NewChannel2(nsIURI* aURI,
nsILoadInfo* aLoadinfo,
nsIChannel** aResult)
{
nsresult rv;
@ -207,4 +208,11 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI,
return NS_OK;
}
NS_IMETHODIMP
nsChromeProtocolHandler::NewChannel(nsIURI* aURI,
nsIChannel* *aResult)
{
return NewChannel2(aURI, nullptr, aResult);
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -39,6 +39,7 @@ public:
NS_IMETHOD GetDefaultPort(int32_t *aDefaultPort) MOZ_OVERRIDE;
NS_IMETHOD GetProtocolFlags(uint32_t *aProtocolFlags) MOZ_OVERRIDE;
NS_IMETHOD NewURI(const nsACString & aSpec, const char * aOriginCharset, nsIURI *aBaseURI, nsIURI * *_retval) MOZ_OVERRIDE;
NS_IMETHOD NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadinfo, nsIChannel * *_retval) MOZ_OVERRIDE;
NS_IMETHOD NewChannel(nsIURI *aURI, nsIChannel * *_retval) MOZ_OVERRIDE;
NS_IMETHOD AllowPort(int32_t port, const char * scheme, bool *_retval) MOZ_OVERRIDE;

View File

@ -484,7 +484,9 @@ nsHostObjectProtocolHandler::NewURI(const nsACString& aSpec,
}
NS_IMETHODIMP
nsHostObjectProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
nsHostObjectProtocolHandler::NewChannel2(nsIURI* uri,
nsILoadInfo *aLoadinfo,
nsIChannel** result)
{
*result = nullptr;
@ -550,6 +552,12 @@ nsHostObjectProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
return NS_OK;
}
NS_IMETHODIMP
nsHostObjectProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
{
return NewChannel2(uri, nullptr, result);
}
NS_IMETHODIMP
nsHostObjectProtocolHandler::AllowPort(int32_t port, const char *scheme,
bool *_retval)

View File

@ -1,6 +1,9 @@
This is sqlite 3.8.6
This is sqlite 3.8.6.1
-- Ryan VanderMeulen <ryanvm@gmail.com>, 08/2014
NB: We did not update SQLITE_VERSION in configure.in for this. See bug 1088143
for the rationale.
-- Kyle Huey <khuey@kylehuey.com>, 10/23/2014
See http://www.sqlite.org/ for more info.

View File

@ -1,6 +1,6 @@
/******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite
** version 3.8.6. By combining all the individual C code files into this
** version 3.8.6.1. By combining all the individual C code files into this
** single large file, the entire code can be compiled as a single translation
** unit. This allows many compilers to do optimizations that would not be
** possible if the files were compiled separately. Performance improvements
@ -222,9 +222,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION "3.8.6"
#define SQLITE_VERSION "3.8.6.1"
#define SQLITE_VERSION_NUMBER 3008006
#define SQLITE_SOURCE_ID "2014-08-15 11:46:33 9491ba7d738528f168657adb43a198238abde19e"
#define SQLITE_SOURCE_ID "2014-10-22 14:22:11 1581c30c389acb2af2c7040d3583c89d48f9bea5"
/*
** CAPI3REF: Run-Time Library Version Numbers
@ -42202,6 +42202,14 @@ static int pager_end_transaction(Pager *pPager, int hasMaster, int bCommit){
rc = SQLITE_OK;
}else{
rc = sqlite3OsTruncate(pPager->jfd, 0);
if( rc==SQLITE_OK && pPager->fullSync ){
/* Make sure the new file size is written into the inode right away.
** Otherwise the journal might resurrect following a power loss and
** cause the last transaction to roll back. See
** https://bugzilla.mozilla.org/show_bug.cgi?id=1072773
*/
rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags);
}
}
pPager->journalOff = 0;
}else if( pPager->journalMode==PAGER_JOURNALMODE_PERSIST

View File

@ -107,9 +107,9 @@ extern "C" {
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION "3.8.6"
#define SQLITE_VERSION "3.8.6.1"
#define SQLITE_VERSION_NUMBER 3008006
#define SQLITE_SOURCE_ID "2014-08-15 11:46:33 9491ba7d738528f168657adb43a198238abde19e"
#define SQLITE_SOURCE_ID "2014-10-22 14:22:11 1581c30c389acb2af2c7040d3583c89d48f9bea5"
/*
** CAPI3REF: Run-Time Library Version Numbers

View File

@ -78,7 +78,9 @@ static RedirEntry kRedirMap[] = {
static const int kRedirTotal = mozilla::ArrayLength(kRedirMap);
NS_IMETHODIMP
nsAboutRedirector::NewChannel(nsIURI *aURI, nsIChannel **result)
nsAboutRedirector::NewChannel(nsIURI* aURI,
nsILoadInfo* aLoadInfo,
nsIChannel** result)
{
NS_ENSURE_ARG_POINTER(aURI);
NS_ASSERTION(result, "must not be null");

View File

@ -164,7 +164,7 @@ LOCAL_INCLUDES += [
'/layout/generic',
'/layout/style',
'/layout/xul',
'/widget/shared',
'/widget',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':

View File

@ -1422,8 +1422,8 @@ void
FullGCTimerFired(nsITimer* aTimer, void* aClosure)
{
nsJSContext::KillFullGCTimer();
uintptr_t reason = reinterpret_cast<uintptr_t>(aClosure);
nsJSContext::GarbageCollectNow(static_cast<JS::gcreason::Reason>(reason),
MOZ_ASSERT(!aClosure, "Don't pass a closure to FullGCTimerFired");
nsJSContext::GarbageCollectNow(JS::gcreason::FULL_GC_TIMER,
nsJSContext::IncrementalGC);
}
@ -2101,7 +2101,7 @@ ReadyToTriggerExpensiveCollectorTimer()
// timers, sInterSliceGCTimer and sICCTimer, are fast and need to be run many times, so
// always run their corresponding timer.
// This does not check sFullGCTimer, as that's an even more expensive collector we run
// This does not check sFullGCTimer, as that's an even more expensive collection we run
// on a long timer.
// static
@ -2386,9 +2386,8 @@ DOMGCSliceCallback(JSRuntime *aRt, JS::GCProgress aProgress, const JS::GCDescrip
if (aDesc.isCompartment_) {
if (!sFullGCTimer && !sShuttingDown) {
CallCreateInstance("@mozilla.org/timer;1", &sFullGCTimer);
JS::gcreason::Reason reason = JS::gcreason::FULL_GC_TIMER;
sFullGCTimer->InitWithFuncCallback(FullGCTimerFired,
reinterpret_cast<void *>(reason),
nullptr,
NS_FULL_GC_DELAY,
nsITimer::TYPE_ONE_SHOT);
}

View File

@ -27,7 +27,6 @@
#include "nsUTF8Utils.h"
#include "WrapperFactory.h"
#include "xpcprivate.h"
#include "XPCQuickStubs.h"
#include "XrayWrapper.h"
#include "nsPrintfCString.h"
#include "prprf.h"
@ -828,7 +827,7 @@ QueryInterface(JSContext* cx, unsigned argc, JS::Value* vp)
// Switch this to UnwrapDOMObjectToISupports once our global objects are
// using new bindings.
nsCOMPtr<nsISupports> native;
UnwrapArg<nsISupports>(cx, obj, getter_AddRefs(native));
UnwrapArg<nsISupports>(obj, getter_AddRefs(native));
if (!native) {
return Throw(cx, NS_ERROR_FAILURE);
}
@ -843,7 +842,7 @@ QueryInterface(JSContext* cx, unsigned argc, JS::Value* vp)
nsCOMPtr<nsIJSID> iid;
obj = &args[0].toObject();
if (NS_FAILED(UnwrapArg<nsIJSID>(cx, obj, getter_AddRefs(iid)))) {
if (NS_FAILED(UnwrapArg<nsIJSID>(obj, getter_AddRefs(iid)))) {
return Throw(cx, NS_ERROR_XPC_BAD_CONVERT_JS);
}
MOZ_ASSERT(iid);
@ -2624,5 +2623,32 @@ CallerSubsumes(JSObject *aObject)
return nsContentUtils::SubjectPrincipal()->Subsumes(objPrin);
}
nsresult
UnwrapArgImpl(JS::Handle<JSObject*> src,
const nsIID &iid,
void **ppArg)
{
nsISupports *iface = xpc::UnwrapReflectorToISupports(src);
if (iface) {
if (NS_FAILED(iface->QueryInterface(iid, ppArg))) {
return NS_ERROR_XPC_BAD_CONVERT_JS;
}
return NS_OK;
}
nsRefPtr<nsXPCWrappedJS> wrappedJS;
nsresult rv = nsXPCWrappedJS::GetNewOrUsed(src, iid, getter_AddRefs(wrappedJS));
if (NS_FAILED(rv) || !wrappedJS) {
return rv;
}
// We need to go through the QueryInterface logic to make this return
// the right thing for the various 'special' interfaces; e.g.
// nsIPropertyBag. We must use AggregatedQueryInterface in cases where
// there is an outer to avoid nasty recursion.
return wrappedJS->QueryInterface(iid, ppArg);
}
} // namespace dom
} // namespace mozilla

View File

@ -39,10 +39,6 @@
class nsIJSID;
class nsPIDOMWindow;
extern nsresult
xpc_qsUnwrapArgImpl(JSContext* cx, JS::Handle<JSObject*> src, const nsIID& iid,
void** ppArg);
namespace mozilla {
namespace dom {
template<typename DataType> class MozMap;
@ -56,13 +52,16 @@ struct SelfRef
nsISupports* ptr;
};
nsresult
UnwrapArgImpl(JS::Handle<JSObject*> src, const nsIID& iid, void** ppArg);
/** Convert a jsval to an XPCOM pointer. */
template <class Interface>
inline nsresult
UnwrapArg(JSContext* cx, JS::Handle<JSObject*> src, Interface** ppArg)
UnwrapArg(JS::Handle<JSObject*> src, Interface** ppArg)
{
return xpc_qsUnwrapArgImpl(cx, src, NS_GET_TEMPLATE_IID(Interface),
reinterpret_cast<void**>(ppArg));
return UnwrapArgImpl(src, NS_GET_TEMPLATE_IID(Interface),
reinterpret_cast<void**>(ppArg));
}
inline const ErrNum

View File

@ -3677,7 +3677,7 @@ class CastableObjectUnwrapper():
// want to be in that compartment for the UnwrapArg call.
JS::Rooted<JSObject*> source(cx, ${source});
JSAutoCompartment ac(cx, ${source});
rv = UnwrapArg<${type}>(cx, source, getter_AddRefs(objPtr));
rv = UnwrapArg<${type}>(source, getter_AddRefs(objPtr));
}
""")
else:
@ -3685,7 +3685,7 @@ class CastableObjectUnwrapper():
self.substitution["source"] = source
xpconnectUnwrap = (
"JS::Rooted<JSObject*> source(cx, ${source});\n"
"nsresult rv = UnwrapArg<${type}>(cx, source, getter_AddRefs(objPtr));\n")
"nsresult rv = UnwrapArg<${type}>(source, getter_AddRefs(objPtr));\n")
if descriptor.hasXPConnectImpls:
self.substitution["codeOnFailure"] = string.Template(
@ -4763,7 +4763,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
holderType = "nsRefPtr<" + typeName + ">"
templateBody += (
"JS::Rooted<JSObject*> source(cx, &${val}.toObject());\n" +
"if (NS_FAILED(UnwrapArg<" + typeName + ">(cx, source, getter_AddRefs(${holderName})))) {\n")
"if (NS_FAILED(UnwrapArg<" + typeName + ">(source, getter_AddRefs(${holderName})))) {\n")
templateBody += CGIndenter(onFailureBadType(failureCode,
descriptor.interface.identifier.name)).define()
templateBody += ("}\n"

View File

@ -7,7 +7,6 @@
#include "mozilla/dom/DOMJSProxyHandler.h"
#include "xpcpublic.h"
#include "xpcprivate.h"
#include "XPCQuickStubs.h"
#include "XPCWrapper.h"
#include "WrapperFactory.h"
#include "nsDOMClassInfo.h"

View File

@ -7,10 +7,9 @@
#include "mozilla/dom/Date.h"
#include "jsapi.h" // for JS_ObjectIsDate, JS_NewDateObjectMsec
#include "jsfriendapi.h" // for js_DateGetMsecSinceEpoch
#include "jsfriendapi.h" // for DateGetMsecSinceEpoch
#include "js/RootingAPI.h" // for Rooted, MutableHandle
#include "js/Value.h" // for Value
#include "jswrapper.h" // for CheckedUnwrap
#include "mozilla/FloatingPoint.h" // for IsNaN, UnspecifiedNaN
namespace mozilla {
@ -32,14 +31,7 @@ Date::SetTimeStamp(JSContext* aCx, JSObject* aObject)
{
JS::Rooted<JSObject*> obj(aCx, aObject);
MOZ_ASSERT(JS_ObjectIsDate(aCx, obj));
obj = js::CheckedUnwrap(obj);
// This really sucks: even if JS_ObjectIsDate, CheckedUnwrap can _still_ fail.
if (!obj) {
return false;
}
mMsecSinceEpoch = js_DateGetMsecSinceEpoch(obj);
mMsecSinceEpoch = js::DateGetMsecSinceEpoch(aCx, obj);
return true;
}

View File

@ -175,10 +175,10 @@ Key::EncodeJSValInternal(JSContext* aCx, JS::Handle<JS::Value> aVal,
}
if (JS_ObjectIsDate(aCx, obj)) {
if (!js_DateIsValid(obj)) {
if (!js::DateIsValid(aCx, obj)) {
return NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
}
EncodeNumber(js_DateGetMsecSinceEpoch(obj), eDate + aTypeOffset);
EncodeNumber(js::DateGetMsecSinceEpoch(aCx, obj), eDate + aTypeOffset);
return NS_OK;
}
}

View File

@ -119,7 +119,7 @@ LOCAL_INCLUDES += [
'/netwerk/base/src',
'/toolkit/xre',
'/uriloader/exthandler',
'/widget/xpwidgets',
'/widget',
'/xpcom/base',
'/xpcom/threads',
]

View File

@ -1207,7 +1207,9 @@ nsJSProtocolHandler::NewURI(const nsACString &aSpec,
}
NS_IMETHODIMP
nsJSProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
nsJSProtocolHandler::NewChannel2(nsIURI* uri,
nsILoadInfo* aLoadInfo,
nsIChannel** result)
{
nsresult rv;
nsJSChannel * channel;
@ -1229,6 +1231,12 @@ nsJSProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
return rv;
}
NS_IMETHODIMP
nsJSProtocolHandler::NewChannel(nsIURI* uri, nsIChannel* *result)
{
return NewChannel2(uri, nullptr, result);
}
NS_IMETHODIMP
nsJSProtocolHandler::AllowPort(int32_t port, const char *scheme, bool *_retval)
{

View File

@ -31,8 +31,8 @@ FINAL_LIBRARY = 'xul'
LOCAL_INCLUDES += [
'/dom/plugins/base',
'/gfx/gl',
'/widget',
'/widget/android',
'/widget/xpwidgets',
]
DEFINES['MOZ_APP_NAME'] = '"%s"' % CONFIG['MOZ_APP_NAME']

View File

@ -100,8 +100,8 @@ LOCAL_INCLUDES += [
'/dom/base',
'/layout/generic',
'/layout/xul',
'/widget',
'/widget/android',
'/widget/xpwidgets',
'/xpcom/base',
]

View File

@ -54,7 +54,7 @@ if CONFIG['OS_ARCH'] == 'WINNT':
]
DEFINES['MOZ_HANGUI_PROCESS_NAME'] = '"plugin-hang-ui%s"' % CONFIG['BIN_SUFFIX']
LOCAL_INCLUDES += [
'/widget/shared',
'/widget',
'hangui',
]

View File

@ -1046,7 +1046,9 @@ nsGIOProtocolHandler::NewURI(const nsACString &aSpec,
}
NS_IMETHODIMP
nsGIOProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **aResult)
nsGIOProtocolHandler::NewChannel2(nsIURI* aURI,
nsILoadInfo* aLoadInfo,
nsIChannel** aResult)
{
NS_ENSURE_ARG_POINTER(aURI);
nsresult rv;
@ -1082,6 +1084,12 @@ nsGIOProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **aResult)
return rv;
}
NS_IMETHODIMP
nsGIOProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **aResult)
{
return NewChannel2(aURI, nullptr, aResult);
}
NS_IMETHODIMP
nsGIOProtocolHandler::AllowPort(int32_t aPort,
const char *aScheme,

View File

@ -899,7 +899,9 @@ nsGnomeVFSProtocolHandler::NewURI(const nsACString &aSpec,
}
NS_IMETHODIMP
nsGnomeVFSProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **aResult)
nsGnomeVFSProtocolHandler::NewChannel2(nsIURI* aURI,
nsILoadInfo* aLoadInfo,
nsIChannel** aResult)
{
NS_ENSURE_ARG_POINTER(aURI);
nsresult rv;
@ -926,6 +928,12 @@ nsGnomeVFSProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **aResult)
return rv;
}
NS_IMETHODIMP
nsGnomeVFSProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **aResult)
{
return NewChannel2(aURI, nullptr, aResult);
}
NS_IMETHODIMP
nsGnomeVFSProtocolHandler::AllowPort(int32_t aPort,
const char *aScheme,

View File

@ -135,17 +135,6 @@ enum SurfaceInitMode
INIT_MODE_CLEAR
};
/**
* A base class for a platform-dependent helper for use by TextureHost.
*/
class CompositorBackendSpecificData
{
NS_INLINE_DECL_REFCOUNTING(CompositorBackendSpecificData)
protected:
virtual ~CompositorBackendSpecificData() {}
};
/**
* Common interface for compositor backends.
*
@ -481,10 +470,6 @@ public:
return fillRatio;
}
virtual CompositorBackendSpecificData* GetCompositorBackendSpecificData() {
return nullptr;
}
ScreenRotation GetScreenRotation() const {
return mScreenRotation;
}

View File

@ -24,14 +24,6 @@ namespace layers {
class Compositor;
CompositableBackendSpecificData::CompositableBackendSpecificData()
: mAllowSharingTextureHost(false)
{
static uint64_t sNextID = 1;
++sNextID;
mId = sNextID;
}
/**
* IPDL actor used by CompositableHost to match with its corresponding
* CompositableClient on the content side.
@ -87,9 +79,6 @@ CompositableHost::CompositableHost(const TextureInfo& aTextureInfo)
CompositableHost::~CompositableHost()
{
MOZ_COUNT_DTOR(CompositableHost);
if (mBackendData) {
mBackendData->ClearData();
}
}
PCompositableParent*
@ -121,7 +110,6 @@ CompositableHost::UseTextureHost(TextureHost* aTexture)
return;
}
aTexture->SetCompositor(GetCompositor());
aTexture->SetCompositableBackendSpecificData(GetCompositableBackendSpecificData());
}
void
@ -130,17 +118,12 @@ CompositableHost::UseComponentAlphaTextures(TextureHost* aTextureOnBlack,
{
MOZ_ASSERT(aTextureOnBlack && aTextureOnWhite);
aTextureOnBlack->SetCompositor(GetCompositor());
aTextureOnBlack->SetCompositableBackendSpecificData(GetCompositableBackendSpecificData());
aTextureOnWhite->SetCompositor(GetCompositor());
aTextureOnWhite->SetCompositableBackendSpecificData(GetCompositableBackendSpecificData());
}
void
CompositableHost::RemoveTextureHost(TextureHost* aTexture)
{
// Clear strong refrence to CompositableBackendSpecificData
aTexture->UnsetCompositableBackendSpecificData(GetCompositableBackendSpecificData());
}
{}
void
CompositableHost::SetCompositor(Compositor* aCompositor)
@ -153,7 +136,7 @@ CompositableHost::AddMaskEffect(EffectChain& aEffects,
const gfx::Matrix4x4& aTransform,
bool aIs3D)
{
RefPtr<TextureSource> source;
CompositableTextureSourceRef source;
RefPtr<TextureHost> host = GetAsTextureHost();
if (!host) {
@ -166,14 +149,12 @@ CompositableHost::AddMaskEffect(EffectChain& aEffects,
return false;
}
source = host->GetTextureSources();
MOZ_ASSERT(source);
if (!source) {
if (!host->BindTextureSource(source)) {
NS_WARNING("The TextureHost was successfully locked but can't provide a TextureSource");
host->Unlock();
return false;
}
MOZ_ASSERT(source);
RefPtr<EffectMask> effect = new EffectMask(source,
source->GetSize(),
@ -192,9 +173,6 @@ CompositableHost::RemoveMaskEffect()
}
}
// implemented in TextureHostOGL.cpp
TemporaryRef<CompositableBackendSpecificData> CreateCompositableBackendSpecificDataOGL();
/* static */ TemporaryRef<CompositableHost>
CompositableHost::Create(const TextureInfo& aTextureInfo)
{
@ -227,12 +205,6 @@ CompositableHost::Create(const TextureInfo& aTextureInfo)
default:
NS_ERROR("Unknown CompositableType");
}
// We know that Tiled buffers don't use the compositable backend-specific
// data, so don't bother creating it.
if (result && aTextureInfo.mCompositableType != CompositableType::BUFFER_TILED) {
RefPtr<CompositableBackendSpecificData> data = CreateCompositableBackendSpecificDataOGL();
result->SetCompositableBackendSpecificData(data);
}
return result;
}

View File

@ -49,42 +49,6 @@ class CompositableParentManager;
class PCompositableParent;
struct EffectChain;
/**
* A base class for doing CompositableHost and platform dependent task on TextureHost.
*/
class CompositableBackendSpecificData
{
protected:
virtual ~CompositableBackendSpecificData() {}
public:
NS_INLINE_DECL_REFCOUNTING(CompositableBackendSpecificData)
CompositableBackendSpecificData();
virtual void ClearData() {}
virtual void SetCompositor(Compositor* aCompositor) {}
bool IsAllowingSharingTextureHost()
{
return mAllowSharingTextureHost;
}
void SetAllowSharingTextureHost(bool aAllow)
{
mAllowSharingTextureHost = aAllow;
}
uint64_t GetId()
{
return mId;
}
public:
bool mAllowSharingTextureHost;
uint64_t mId;
};
/**
* The compositor-side counterpart to CompositableClient. Responsible for
* updating textures and data about textures from IPC and how textures are
@ -112,16 +76,6 @@ public:
virtual CompositableType GetType() = 0;
virtual CompositableBackendSpecificData* GetCompositableBackendSpecificData()
{
return mBackendData;
}
virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
{
mBackendData = aBackendData;
}
// If base class overrides, it should still call the parent implementation
virtual void SetCompositor(Compositor* aCompositor);
@ -252,9 +206,6 @@ public:
SetLayer(nullptr);
mAttached = false;
mKeepAttached = false;
if (mBackendData) {
mBackendData->ClearData();
}
}
}
bool IsAttached() { return mAttached; }
@ -314,7 +265,6 @@ protected:
uint64_t mCompositorID;
RefPtr<Compositor> mCompositor;
Layer* mLayer;
RefPtr<CompositableBackendSpecificData> mBackendData;
uint32_t mFlashCounter; // used when the pref "layers.flash-borders" is true.
bool mAttached;
bool mKeepAttached;

View File

@ -35,12 +35,12 @@ ContentHostBase::~ContentHostBase()
}
void
ContentHostBase::Composite(EffectChain& aEffectChain,
float aOpacity,
const gfx::Matrix4x4& aTransform,
const Filter& aFilter,
const Rect& aClipRect,
const nsIntRegion* aVisibleRegion)
ContentHostTexture::Composite(EffectChain& aEffectChain,
float aOpacity,
const gfx::Matrix4x4& aTransform,
const Filter& aFilter,
const Rect& aClipRect,
const nsIntRegion* aVisibleRegion)
{
NS_ASSERTION(aVisibleRegion, "Requires a visible region");
@ -49,14 +49,18 @@ ContentHostBase::Composite(EffectChain& aEffectChain,
return;
}
RefPtr<TextureSource> source = GetTextureSource();
RefPtr<TextureSource> sourceOnWhite = GetTextureSourceOnWhite();
if (!mTextureHost->BindTextureSource(mTextureSource)) {
return;
}
MOZ_ASSERT(mTextureSource.get());
if (!source) {
if (mTextureHostOnWhite && !mTextureHostOnWhite->BindTextureSource(mTextureSourceOnWhite)) {
return;
}
RefPtr<TexturedEffect> effect = GenEffect(aFilter);
RefPtr<TexturedEffect> effect = CreateTexturedEffect(mTextureSource.get(),
mTextureSourceOnWhite.get(),
aFilter, true);
if (!effect) {
return;
}
@ -81,7 +85,7 @@ ContentHostBase::Composite(EffectChain& aEffectChain,
region.MoveBy(-origin);
// Figure out the intersecting draw region
gfx::IntSize texSize = source->GetSize();
gfx::IntSize texSize = mTextureSource->GetSize();
nsIntRect textureRect = nsIntRect(0, 0, texSize.width, texSize.height);
textureRect.MoveBy(region.GetBounds().TopLeft());
nsIntRegion subregion;
@ -105,14 +109,14 @@ ContentHostBase::Composite(EffectChain& aEffectChain,
regionRects.Or(regionRects, regionRect);
}
BigImageIterator* bigImgIter = source->AsBigImageIterator();
BigImageIterator* bigImgIter = mTextureSource->AsBigImageIterator();
BigImageIterator* iterOnWhite = nullptr;
if (bigImgIter) {
bigImgIter->BeginBigImageIteration();
}
if (sourceOnWhite) {
iterOnWhite = sourceOnWhite->AsBigImageIterator();
if (mTextureSourceOnWhite) {
iterOnWhite = mTextureSourceOnWhite->AsBigImageIterator();
MOZ_ASSERT(!bigImgIter || bigImgIter->GetTileCount() == iterOnWhite->GetTileCount(),
"Tile count mismatch on component alpha texture");
if (iterOnWhite) {
@ -205,32 +209,39 @@ ContentHostBase::Composite(EffectChain& aEffectChain,
aTransform, mFlashCounter);
}
TemporaryRef<TexturedEffect>
ContentHostBase::GenEffect(const gfx::Filter& aFilter)
{
RefPtr<TextureSource> source = GetTextureSource();
RefPtr<TextureSource> sourceOnWhite = GetTextureSourceOnWhite();
if (!source) {
return nullptr;
}
return CreateTexturedEffect(source, sourceOnWhite, aFilter, true);
}
void
ContentHostTexture::UseTextureHost(TextureHost* aTexture)
{
if (mTextureHost && mTextureHost != aTexture) {
mTextureHost->UnbindTextureSource();
}
ContentHostBase::UseTextureHost(aTexture);
mTextureHost = aTexture;
mTextureHostOnWhite = nullptr;
if (mTextureHost) {
mTextureHost->PrepareTextureSource(mTextureSource);
}
}
void
ContentHostTexture::UseComponentAlphaTextures(TextureHost* aTextureOnBlack,
TextureHost* aTextureOnWhite)
{
if (mTextureHost && mTextureHost != aTextureOnBlack) {
mTextureHost->UnbindTextureSource();
}
if (mTextureHostOnWhite && mTextureHostOnWhite != aTextureOnWhite) {
mTextureHostOnWhite->UnbindTextureSource();
}
ContentHostBase::UseComponentAlphaTextures(aTextureOnBlack, aTextureOnWhite);
mTextureHost = aTextureOnBlack;
mTextureHostOnWhite = aTextureOnWhite;
if (mTextureHost) {
mTextureHost->PrepareTextureSource(mTextureSource);
}
if (mTextureHostOnWhite) {
mTextureHostOnWhite->PrepareTextureSource(mTextureSourceOnWhite);
}
}
void
@ -417,6 +428,176 @@ ContentHostIncremental::UpdateIncremental(TextureIdentifier aTextureId,
FlushUpdateQueue();
}
void
ContentHostIncremental::Composite(EffectChain& aEffectChain,
float aOpacity,
const gfx::Matrix4x4& aTransform,
const Filter& aFilter,
const Rect& aClipRect,
const nsIntRegion* aVisibleRegion)
{
NS_ASSERTION(aVisibleRegion, "Requires a visible region");
AutoLockCompositableHost lock(this);
if (lock.Failed()) {
return;
}
if (!mSource) {
return;
}
RefPtr<TexturedEffect> effect = CreateTexturedEffect(mSource.get(),
mSourceOnWhite.get(),
aFilter, true);
if (!effect) {
return;
}
aEffectChain.mPrimaryEffect = effect;
nsIntRegion tmpRegion;
const nsIntRegion* renderRegion;
if (PaintWillResample()) {
// If we're resampling, then the texture image will contain exactly the
// entire visible region's bounds, and we should draw it all in one quad
// to avoid unexpected aliasing.
tmpRegion = aVisibleRegion->GetBounds();
renderRegion = &tmpRegion;
} else {
renderRegion = aVisibleRegion;
}
nsIntRegion region(*renderRegion);
nsIntPoint origin = GetOriginOffset();
// translate into TexImage space, buffer origin might not be at texture (0,0)
region.MoveBy(-origin);
// Figure out the intersecting draw region
gfx::IntSize texSize = mSource->GetSize();
nsIntRect textureRect = nsIntRect(0, 0, texSize.width, texSize.height);
textureRect.MoveBy(region.GetBounds().TopLeft());
nsIntRegion subregion;
subregion.And(region, textureRect);
if (subregion.IsEmpty()) {
// Region is empty, nothing to draw
return;
}
nsIntRegion screenRects;
nsIntRegion regionRects;
// Collect texture/screen coordinates for drawing
nsIntRegionRectIterator iter(subregion);
while (const nsIntRect* iterRect = iter.Next()) {
nsIntRect regionRect = *iterRect;
nsIntRect screenRect = regionRect;
screenRect.MoveBy(origin);
screenRects.Or(screenRects, screenRect);
regionRects.Or(regionRects, regionRect);
}
BigImageIterator* bigImgIter = mSource->AsBigImageIterator();
BigImageIterator* iterOnWhite = nullptr;
if (bigImgIter) {
bigImgIter->BeginBigImageIteration();
}
if (mSourceOnWhite) {
iterOnWhite = mSourceOnWhite->AsBigImageIterator();
MOZ_ASSERT(!bigImgIter || bigImgIter->GetTileCount() == iterOnWhite->GetTileCount(),
"Tile count mismatch on component alpha texture");
if (iterOnWhite) {
iterOnWhite->BeginBigImageIteration();
}
}
bool usingTiles = (bigImgIter && bigImgIter->GetTileCount() > 1);
do {
if (iterOnWhite) {
MOZ_ASSERT(iterOnWhite->GetTileRect() == bigImgIter->GetTileRect(),
"component alpha textures should be the same size.");
}
nsIntRect texRect = bigImgIter ? bigImgIter->GetTileRect()
: nsIntRect(0, 0,
texSize.width,
texSize.height);
// Draw texture. If we're using tiles, we do repeating manually, as texture
// repeat would cause each individual tile to repeat instead of the
// compound texture as a whole. This involves drawing at most 4 sections,
// 2 for each axis that has texture repeat.
for (int y = 0; y < (usingTiles ? 2 : 1); y++) {
for (int x = 0; x < (usingTiles ? 2 : 1); x++) {
nsIntRect currentTileRect(texRect);
currentTileRect.MoveBy(x * texSize.width, y * texSize.height);
nsIntRegionRectIterator screenIter(screenRects);
nsIntRegionRectIterator regionIter(regionRects);
const nsIntRect* screenRect;
const nsIntRect* regionRect;
while ((screenRect = screenIter.Next()) &&
(regionRect = regionIter.Next())) {
nsIntRect tileScreenRect(*screenRect);
nsIntRect tileRegionRect(*regionRect);
// When we're using tiles, find the intersection between the tile
// rect and this region rect. Tiling is then handled by the
// outer for-loops and modifying the tile rect.
if (usingTiles) {
tileScreenRect.MoveBy(-origin);
tileScreenRect = tileScreenRect.Intersect(currentTileRect);
tileScreenRect.MoveBy(origin);
if (tileScreenRect.IsEmpty())
continue;
tileRegionRect = regionRect->Intersect(currentTileRect);
tileRegionRect.MoveBy(-currentTileRect.TopLeft());
}
gfx::Rect rect(tileScreenRect.x, tileScreenRect.y,
tileScreenRect.width, tileScreenRect.height);
effect->mTextureCoords = Rect(Float(tileRegionRect.x) / texRect.width,
Float(tileRegionRect.y) / texRect.height,
Float(tileRegionRect.width) / texRect.width,
Float(tileRegionRect.height) / texRect.height);
GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain, aOpacity, aTransform);
if (usingTiles) {
DiagnosticFlags diagnostics = DiagnosticFlags::CONTENT | DiagnosticFlags::BIGIMAGE;
if (iterOnWhite) {
diagnostics |= DiagnosticFlags::COMPONENT_ALPHA;
}
GetCompositor()->DrawDiagnostics(diagnostics, rect, aClipRect,
aTransform, mFlashCounter);
}
}
}
}
if (iterOnWhite) {
iterOnWhite->NextTile();
}
} while (usingTiles && bigImgIter->NextTile());
if (bigImgIter) {
bigImgIter->EndBigImageIteration();
}
if (iterOnWhite) {
iterOnWhite->EndBigImageIteration();
}
DiagnosticFlags diagnostics = DiagnosticFlags::CONTENT;
if (iterOnWhite) {
diagnostics |= DiagnosticFlags::COMPONENT_ALPHA;
}
GetCompositor()->DrawDiagnostics(diagnostics, nsIntRegion(mBufferRect), aClipRect,
aTransform, mFlashCounter);
}
void
ContentHostIncremental::FlushUpdateQueue()
{
@ -439,20 +620,6 @@ ContentHostIncremental::ProcessTextureUpdates()
mUpdateList.Clear();
}
TextureSource*
ContentHostIncremental::GetTextureSource()
{
MOZ_ASSERT(mLocked);
return mSource;
}
TextureSource*
ContentHostIncremental::GetTextureSourceOnWhite()
{
MOZ_ASSERT(mLocked);
return mSourceOnWhite;
}
void
ContentHostIncremental::TextureCreationRequest::Execute(ContentHostIncremental* aHost)
{
@ -683,6 +850,32 @@ ContentHostTexture::GetRenderState()
return result;
}
TemporaryRef<TexturedEffect>
ContentHostTexture::GenEffect(const gfx::Filter& aFilter)
{
if (!mTextureHost) {
return nullptr;
}
if (!mTextureHost->BindTextureSource(mTextureSource)) {
return nullptr;
}
if (mTextureHostOnWhite && !mTextureHostOnWhite->BindTextureSource(mTextureSourceOnWhite)) {
return nullptr;
}
return CreateTexturedEffect(mTextureSource.get(),
mTextureSourceOnWhite.get(),
aFilter, true);
}
TemporaryRef<TexturedEffect>
ContentHostIncremental::GenEffect(const gfx::Filter& aFilter)
{
if (!mSource) {
return nullptr;
}
return CreateTexturedEffect(mSource, mSourceOnWhite, aFilter, true);
}
#ifdef MOZ_DUMP_PAINTING
TemporaryRef<gfx::DataSourceSurface>
ContentHostTexture::GetAsSurface()

View File

@ -96,18 +96,6 @@ public:
explicit ContentHostBase(const TextureInfo& aTextureInfo);
virtual ~ContentHostBase();
virtual void Composite(EffectChain& aEffectChain,
float aOpacity,
const gfx::Matrix4x4& aTransform,
const gfx::Filter& aFilter,
const gfx::Rect& aClipRect,
const nsIntRegion* aVisibleRegion = nullptr);
virtual TextureSource* GetTextureSource() = 0;
virtual TextureSource* GetTextureSourceOnWhite() = 0;
virtual TemporaryRef<TexturedEffect> GenEffect(const gfx::Filter& aFilter) MOZ_OVERRIDE;
protected:
virtual nsIntPoint GetOriginOffset()
{
@ -132,6 +120,13 @@ public:
, mLocked(false)
{ }
virtual void Composite(EffectChain& aEffectChain,
float aOpacity,
const gfx::Matrix4x4& aTransform,
const gfx::Filter& aFilter,
const gfx::Rect& aClipRect,
const nsIntRegion* aVisibleRegion = nullptr);
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
#ifdef MOZ_DUMP_PAINTING
@ -173,23 +168,15 @@ public:
mLocked = false;
}
virtual TextureSource* GetTextureSource() MOZ_OVERRIDE {
MOZ_ASSERT(mLocked);
return mTextureHost->GetTextureSources();
}
virtual TextureSource* GetTextureSourceOnWhite() MOZ_OVERRIDE {
MOZ_ASSERT(mLocked);
if (mTextureHostOnWhite) {
return mTextureHostOnWhite->GetTextureSources();
}
return nullptr;
}
LayerRenderState GetRenderState();
virtual TemporaryRef<TexturedEffect> GenEffect(const gfx::Filter& aFilter) MOZ_OVERRIDE;
protected:
RefPtr<TextureHost> mTextureHost;
RefPtr<TextureHost> mTextureHostOnWhite;
CompositableTextureSourceRef mTextureSource;
CompositableTextureSourceRef mTextureSourceOnWhite;
bool mLocked;
};
@ -277,6 +264,13 @@ public:
return false;
}
virtual void Composite(EffectChain& aEffectChain,
float aOpacity,
const gfx::Matrix4x4& aTransform,
const gfx::Filter& aFilter,
const gfx::Rect& aClipRect,
const nsIntRegion* aVisibleRegion = nullptr);
virtual void PrintInfo(std::stringstream& aStream, const char* aPrefix) MOZ_OVERRIDE;
virtual bool Lock() MOZ_OVERRIDE {
@ -291,8 +285,8 @@ public:
mLocked = false;
}
virtual TextureSource* GetTextureSource() MOZ_OVERRIDE;
virtual TextureSource* GetTextureSourceOnWhite() MOZ_OVERRIDE;
virtual TemporaryRef<TexturedEffect>
GenEffect(const gfx::Filter& aFilter) MOZ_OVERRIDE;
private:

View File

@ -37,28 +37,21 @@ ImageHost::ImageHost(const TextureInfo& aTextureInfo)
ImageHost::~ImageHost()
{
if (mFrontBuffer) {
mFrontBuffer->UnsetCompositableBackendSpecificData(GetCompositableBackendSpecificData());
}
}
void
ImageHost::SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
{
CompositableHost::SetCompositableBackendSpecificData(aBackendData);
// ImageHost allows TextureHost sharing among ImageHosts.
if (aBackendData) {
aBackendData->SetAllowSharingTextureHost(true);
mFrontBuffer->UnbindTextureSource();
}
}
void
ImageHost::UseTextureHost(TextureHost* aTexture)
{
CompositableHost::UseTextureHost(aTexture);
if (mFrontBuffer) {
mFrontBuffer->UnsetCompositableBackendSpecificData(GetCompositableBackendSpecificData());
if (mFrontBuffer && mFrontBuffer != aTexture) {
mFrontBuffer->UnbindTextureSource();
}
CompositableHost::UseTextureHost(aTexture);
mFrontBuffer = aTexture;
if (mFrontBuffer) {
mFrontBuffer->PrepareTextureSource(mTextureSource);
}
}
void
@ -66,7 +59,8 @@ ImageHost::RemoveTextureHost(TextureHost* aTexture)
{
CompositableHost::RemoveTextureHost(aTexture);
if (aTexture && mFrontBuffer == aTexture) {
aTexture->SetCompositableBackendSpecificData(nullptr);
mFrontBuffer->UnbindTextureSource();
mTextureSource = nullptr;
mFrontBuffer = nullptr;
}
}
@ -97,25 +91,34 @@ ImageHost::Composite(EffectChain& aEffectChain,
// Make sure the front buffer has a compositor
mFrontBuffer->SetCompositor(GetCompositor());
mFrontBuffer->SetCompositableBackendSpecificData(GetCompositableBackendSpecificData());
AutoLockCompositableHost autoLock(this);
if (autoLock.Failed()) {
NS_WARNING("failed to lock front buffer");
return;
}
RefPtr<TextureSource> source = GetTextureSource();
if (!source) {
if (!mFrontBuffer->BindTextureSource(mTextureSource)) {
return;
}
RefPtr<TexturedEffect> effect = GenEffect(aFilter);
if (!mTextureSource) {
// BindTextureSource above should have returned false!
MOZ_ASSERT(false);
return;
}
bool isAlphaPremultiplied = !(mFrontBuffer->GetFlags() & TextureFlags::NON_PREMULTIPLIED);
RefPtr<TexturedEffect> effect = CreateTexturedEffect(mFrontBuffer->GetFormat(),
mTextureSource.get(),
aFilter,
isAlphaPremultiplied);
if (!effect) {
return;
}
aEffectChain.mPrimaryEffect = effect;
IntSize textureSize = source->GetSize();
IntSize textureSize = mTextureSource->GetSize();
gfx::Rect gfxPictureRect
= mHasPictureRect ? gfx::Rect(0, 0, mPictureRect.width, mPictureRect.height)
: gfx::Rect(0, 0, textureSize.width, textureSize.height);
@ -123,7 +126,7 @@ ImageHost::Composite(EffectChain& aEffectChain,
gfx::Rect pictureRect(0, 0,
mPictureRect.width,
mPictureRect.height);
BigImageIterator* it = source->AsBigImageIterator();
BigImageIterator* it = mTextureSource->AsBigImageIterator();
if (it) {
// This iteration does not work if we have multiple texture sources here
@ -139,7 +142,7 @@ ImageHost::Composite(EffectChain& aEffectChain,
// the corresponding source tiles from all planes, with appropriate
// per-plane per-tile texture coords.
// DrawQuad currently assumes that all planes use the same texture coords.
MOZ_ASSERT(it->GetTileCount() == 1 || !source->GetNextSibling(),
MOZ_ASSERT(it->GetTileCount() == 1 || !mTextureSource->GetNextSibling(),
"Can't handle multi-plane BigImages");
it->BeginBigImageIteration();
@ -170,7 +173,7 @@ ImageHost::Composite(EffectChain& aEffectChain,
gfxPictureRect, aClipRect,
aTransform, mFlashCounter);
} else {
IntSize textureSize = source->GetSize();
IntSize textureSize = mTextureSource->GetSize();
gfx::Rect rect;
if (mHasPictureRect) {
effect->mTextureCoords = Rect(Float(mPictureRect.x) / textureSize.width,
@ -273,18 +276,10 @@ ImageHost::Unlock()
mLocked = false;
}
TemporaryRef<TextureSource>
ImageHost::GetTextureSource()
{
MOZ_ASSERT(mLocked);
return mFrontBuffer->GetTextureSources();
}
TemporaryRef<TexturedEffect>
ImageHost::GenEffect(const gfx::Filter& aFilter)
{
RefPtr<TextureSource> source = GetTextureSource();
if (!source) {
if (!mFrontBuffer->BindTextureSource(mTextureSource)) {
return nullptr;
}
bool isAlphaPremultiplied = true;
@ -292,7 +287,7 @@ ImageHost::GenEffect(const gfx::Filter& aFilter)
isAlphaPremultiplied = false;
return CreateTexturedEffect(mFrontBuffer->GetFormat(),
source,
mTextureSource,
aFilter,
isAlphaPremultiplied);
}

View File

@ -45,8 +45,6 @@ public:
virtual CompositableType GetType() { return mTextureInfo.mCompositableType; }
virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData) MOZ_OVERRIDE;
virtual void Composite(EffectChain& aEffectChain,
float aOpacity,
const gfx::Matrix4x4& aTransform,
@ -84,13 +82,12 @@ public:
virtual void Unlock() MOZ_OVERRIDE;
virtual TemporaryRef<TextureSource> GetTextureSource();
virtual TemporaryRef<TexturedEffect> GenEffect(const gfx::Filter& aFilter) MOZ_OVERRIDE;
protected:
RefPtr<TextureHost> mFrontBuffer;
CompositableTextureSourceRef mTextureSource;
nsIntRect mPictureRect;
bool mHasPictureRect;
bool mLocked;

View File

@ -144,6 +144,13 @@ TextureHost::GetIPDLActor()
return mActor;
}
bool
TextureHost::BindTextureSource(CompositableTextureSourceRef& texture)
{
texture = GetTextureSources();
return !!texture;
}
FenceHandle
TextureHost::GetAndResetReleaseFenceHandle()
{
@ -277,18 +284,6 @@ TextureHost::CompositorRecycle()
static_cast<TextureParent*>(mActor)->CompositorRecycle();
}
void
TextureHost::SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
{
mCompositableBackendData = aBackendData;
}
void
TextureHost::UnsetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
{
mCompositableBackendData = nullptr;
}
TextureHost::TextureHost(TextureFlags aFlags)
: mActor(nullptr)
, mFlags(aFlags)
@ -322,9 +317,11 @@ TextureHost::PrintInfo(std::stringstream& aStream, const char* aPrefix)
}
TextureSource::TextureSource()
: mCompositableCount(0)
{
MOZ_COUNT_CTOR(TextureSource);
}
TextureSource::~TextureSource()
{
MOZ_COUNT_DTOR(TextureSource);
@ -844,8 +841,9 @@ SharedSurfaceToTexSource(gl::SharedSurface* abstractSurf, Compositor* compositor
GLenum target = surf->ConsTextureTarget();
GLuint tex = surf->ConsTexture(gl);
texSource = new GLTextureSource(compositorOGL, tex, format, target,
surf->mSize);
texSource = new GLTextureSource(compositorOGL, tex, target,
surf->mSize, format,
true/*externally owned*/);
break;
}
case gl::SharedSurfaceType::EGLImageShare: {
@ -860,8 +858,9 @@ SharedSurfaceToTexSource(gl::SharedSurface* abstractSurf, Compositor* compositor
GLuint tex = 0;
surf->AcquireConsumerTexture(gl, &tex, &target);
texSource = new GLTextureSource(compositorOGL, tex, format, target,
surf->mSize);
texSource = new GLTextureSource(compositorOGL, tex, target,
surf->mSize, format,
true/*externally owned*/);
break;
}
#ifdef XP_MACOSX

View File

@ -46,7 +46,6 @@ namespace layers {
class Compositor;
class CompositableHost;
class CompositableBackendSpecificData;
class CompositableParentManager;
class SurfaceDescriptor;
class SharedSurfaceDescriptor;
@ -150,10 +149,69 @@ public:
return nullptr;
}
void AddCompositableRef() { ++mCompositableCount; }
void ReleaseCompositableRef() {
--mCompositableCount;
MOZ_ASSERT(mCompositableCount >= 0);
}
int NumCompositableRefs() const { return mCompositableCount; }
protected:
virtual ~TextureSource();
RefPtr<TextureSource> mNextSibling;
int mCompositableCount;
};
/**
* equivalent of a RefPtr<TextureSource>, that calls AddCompositableRef and
* ReleaseCompositableRef in addition to the usual AddRef and Release.
*/
class CompositableTextureSourceRef {
public:
CompositableTextureSourceRef() {}
~CompositableTextureSourceRef()
{
if (mRef) {
mRef->ReleaseCompositableRef();
}
}
CompositableTextureSourceRef& operator=(const TemporaryRef<TextureSource>& aOther)
{
RefPtr<TextureSource> temp = aOther;
if (temp) {
temp->AddCompositableRef();
}
if (mRef) {
mRef->ReleaseCompositableRef();
}
mRef = temp;
return *this;
}
CompositableTextureSourceRef& operator=(TextureSource* aOther)
{
if (aOther) {
aOther->AddCompositableRef();
}
if (mRef) {
mRef->ReleaseCompositableRef();
}
mRef = aOther;
return *this;
}
TextureSource* get() const { return mRef; }
operator TextureSource*() const { return mRef; }
TextureSource* operator->() const { return mRef; }
TextureSource& operator*() const { return *mRef; }
private:
RefPtr<TextureSource> mRef;
};
/**
@ -302,6 +360,25 @@ public:
*/
virtual TextureSource* GetTextureSources() = 0;
/**
* Called during the transaction. The TextureSource may or may not be composited.
*
* Note that this is called outside of lock/unlock.
*/
virtual void PrepareTextureSource(CompositableTextureSourceRef& aTexture) {}
/**
* Called at composition time, just before compositing the TextureSource composited.
*
* Note that this is called only withing lock/unlock.
*/
virtual bool BindTextureSource(CompositableTextureSourceRef& aTexture);
/**
* Called when another TextureHost will take over.
*/
virtual void UnbindTextureSource() {}
/**
* Is called before compositing if the shared data has changed since last
* composition.
@ -406,10 +483,6 @@ public:
return LayerRenderState();
}
virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData);
virtual void UnsetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData);
// If a texture host holds a reference to shmem, it should override this method
// to forget about the shmem _without_ releasing it.
virtual void OnShutdown() {}
@ -435,7 +508,6 @@ public:
protected:
PTextureParent* mActor;
TextureFlags mFlags;
RefPtr<CompositableBackendSpecificData> mCompositableBackendData;
friend class TextureParent;
};

View File

@ -136,17 +136,6 @@ GrallocTextureSourceOGL::BindTexture(GLenum aTextureUnit, gfx::Filter aFilter)
gl()->fActiveTexture(aTextureUnit);
gl()->fBindTexture(textureTarget, tex);
if (mTextureBackendSpecificData) {
// There are two paths for locking/unlocking - if mTextureBackendSpecificData is
// set, we use the texture on there, otherwise we use
// CompositorBackendSpecificData from the compositor and bind the EGLImage
// only in Lock().
if (!mEGLImage) {
mEGLImage = EGLImageCreateFromNativeBuffer(gl(), mGraphicBuffer->getNativeBuffer());
}
BindEGLImage();
}
ApplyFilterToBoundTexture(gl(), aFilter, textureTarget);
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
@ -159,10 +148,6 @@ GrallocTextureSourceOGL::BindTexture(GLenum aTextureUnit, gfx::Filter aFilter)
bool GrallocTextureSourceOGL::Lock()
{
if (mTextureBackendSpecificData) {
return true;
}
MOZ_ASSERT(IsValid());
if (!IsValid()) {
return false;
@ -188,7 +173,7 @@ bool GrallocTextureSourceOGL::Lock()
bool
GrallocTextureSourceOGL::IsValid() const
{
return !!gl() && !!mGraphicBuffer.get() && (!!mCompositor || !!mTextureBackendSpecificData);
return !!gl() && !!mGraphicBuffer.get() && !!mCompositor;
}
gl::GLContext*
@ -230,62 +215,6 @@ GrallocTextureSourceOGL::GetTextureTarget() const
return TextureTargetForAndroidPixelFormat(mGraphicBuffer->getPixelFormat());
}
void
GrallocTextureSourceOGL::SetTextureBackendSpecificData(TextureSharedDataGonkOGL* aBackendData)
{
if (!aBackendData) {
DeallocateDeviceData();
// Update mTextureBackendSpecificData after calling DeallocateDeviceData().
mTextureBackendSpecificData = nullptr;
return;
}
if (mTextureBackendSpecificData != aBackendData) {
mNeedsReset = true;
}
if (!gl() || !gl()->MakeCurrent()) {
NS_WARNING("Failed to make the context current");
return;
}
if (!mNeedsReset) {
// Update binding to the EGLImage
GLuint tex = GetGLTexture();
GLuint textureTarget = GetTextureTarget();
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
gl()->fBindTexture(textureTarget, tex);
BindEGLImage();
return;
}
if (!mCompositor) {
mTextureBackendSpecificData = aBackendData;
return;
}
// delete old EGLImage
DeallocateDeviceData();
// Update mTextureBackendSpecificData after calling DeallocateDeviceData().
mTextureBackendSpecificData = aBackendData;
GLuint tex = GetGLTexture();
GLuint textureTarget = GetTextureTarget();
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
gl()->fBindTexture(textureTarget, tex);
// Setup texure parameters at the first binding.
gl()->fTexParameteri(textureTarget, LOCAL_GL_TEXTURE_WRAP_T, GetWrapMode());
gl()->fTexParameteri(textureTarget, LOCAL_GL_TEXTURE_WRAP_S, GetWrapMode());
// create new EGLImage
mEGLImage = EGLImageCreateFromNativeBuffer(gl(), mGraphicBuffer->getNativeBuffer());
BindEGLImage();
mNeedsReset = false;
}
gfx::IntSize
GrallocTextureSourceOGL::GetSize() const
{
@ -304,9 +233,6 @@ GrallocTextureSourceOGL::DeallocateDeviceData()
if (!gl() || !gl()->MakeCurrent()) {
return;
}
if (mTextureBackendSpecificData) {
mTextureBackendSpecificData->ClearBoundEGLImage(mEGLImage);
}
EGLImageDestroy(gl(), mEGLImage);
mEGLImage = EGL_NO_IMAGE;
}
@ -315,49 +241,48 @@ GrallocTextureSourceOGL::DeallocateDeviceData()
GrallocTextureHostOGL::GrallocTextureHostOGL(TextureFlags aFlags,
const NewSurfaceDescriptorGralloc& aDescriptor)
: TextureHost(aFlags)
, mGrallocHandle(aDescriptor)
, mSize(0, 0)
, mDescriptorSize(aDescriptor.size())
, mFormat(gfx::SurfaceFormat::UNKNOWN)
, mEGLImage(EGL_NO_IMAGE)
{
gfx::SurfaceFormat format = gfx::SurfaceFormat::UNKNOWN;
mGrallocHandle = aDescriptor;
android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
MOZ_ASSERT(graphicBuffer);
mSize = aDescriptor.size();
if (graphicBuffer) {
format =
mFormat =
SurfaceFormatForAndroidPixelFormat(graphicBuffer->getPixelFormat(),
aFlags & TextureFlags::RB_SWAPPED);
mTextureSource = new GrallocTextureSourceOGL(nullptr,
this,
graphicBuffer,
format);
mSize = gfx::IntSize(graphicBuffer->getWidth(), graphicBuffer->getHeight());
} else {
printf_stderr("gralloc buffer is nullptr");
}
}
GrallocTextureHostOGL::~GrallocTextureHostOGL()
{
MOZ_ASSERT(!mTextureSource || (mFlags & TextureFlags::DEALLOCATE_CLIENT),
"Leaking our buffer");
}
{}
void
GrallocTextureHostOGL::SetCompositor(Compositor* aCompositor)
{
if (mTextureSource) {
mTextureSource->SetCompositor(static_cast<CompositorOGL*>(aCompositor));
mCompositor = static_cast<CompositorOGL*>(aCompositor);
if (mTilingTextureSource) {
mTilingTextureSource->SetCompositor(mCompositor);
}
if (mGLTextureSource) {
mGLTextureSource->SetCompositor(mCompositor);
}
if (mCompositor && aCompositor != mCompositor) {
DestroyEGLImage();
}
}
bool
GrallocTextureHostOGL::Lock()
{
if (IsValid()) {
mTextureSource->Lock();
return true;
}
return false;
return IsValid();
}
void
@ -369,28 +294,29 @@ GrallocTextureHostOGL::Unlock()
bool
GrallocTextureHostOGL::IsValid() const
{
if (!mTextureSource) {
return false;
}
return mTextureSource->IsValid();
android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
return graphicBuffer != nullptr;
}
gfx::SurfaceFormat
GrallocTextureHostOGL::GetFormat() const
{
if (!mTextureSource) {
return gfx::SurfaceFormat::UNKNOWN;
}
return mTextureSource->GetFormat();
return mFormat;
}
void
GrallocTextureHostOGL::DeallocateSharedData()
{
if (mTextureSource) {
mTextureSource->ForgetBuffer();
mTextureSource = nullptr;
if (mTilingTextureSource) {
mTilingTextureSource->ForgetBuffer();
mTilingTextureSource = nullptr;
}
if (mGLTextureSource) {
mGLTextureSource = nullptr;
}
DestroyEGLImage();
if (mGrallocHandle.buffer().type() != SurfaceDescriptor::Tnull_t) {
MaybeMagicGrallocBufferHandle handle = mGrallocHandle.buffer();
base::ProcessId owner;
@ -408,24 +334,33 @@ GrallocTextureHostOGL::DeallocateSharedData()
void
GrallocTextureHostOGL::ForgetSharedData()
{
if (mTextureSource) {
mTextureSource->ForgetBuffer();
mTextureSource = nullptr;
if (mTilingTextureSource) {
mTilingTextureSource->ForgetBuffer();
mTilingTextureSource = nullptr;
}
if (mGLTextureSource) {
mGLTextureSource = nullptr;
}
}
void
GrallocTextureHostOGL::DeallocateDeviceData()
{
if (mTextureSource) {
mTextureSource->DeallocateDeviceData();
if (mTilingTextureSource) {
mTilingTextureSource->DeallocateDeviceData();
}
if (mGLTextureSource) {
mGLTextureSource = nullptr;
}
DestroyEGLImage();
}
LayerRenderState
GrallocTextureHostOGL::GetRenderState()
{
if (IsValid()) {
android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
if (graphicBuffer) {
LayerRenderStateFlags flags = LayerRenderStateFlags::LAYER_RENDER_STATE_DEFAULT;
if (mFlags & TextureFlags::NEEDS_Y_FLIP) {
flags |= LayerRenderStateFlags::Y_FLIPPED;
@ -433,8 +368,8 @@ GrallocTextureHostOGL::GetRenderState()
if (mFlags & TextureFlags::RB_SWAPPED) {
flags |= LayerRenderStateFlags::FORMAT_RB_SWAP;
}
return LayerRenderState(mTextureSource->mGraphicBuffer.get(),
gfx::ThebesIntSize(mSize),
return LayerRenderState(graphicBuffer,
gfx::ThebesIntSize(mDescriptorSize),
flags,
this);
}
@ -444,8 +379,8 @@ GrallocTextureHostOGL::GetRenderState()
TemporaryRef<gfx::DataSourceSurface>
GrallocTextureHostOGL::GetAsSurface() {
return mTextureSource ? mTextureSource->GetAsSurface()
: nullptr;
return mTilingTextureSource ? mTilingTextureSource->GetAsSurface()
: nullptr;
}
TemporaryRef<gfx::DataSourceSurface>
@ -473,103 +408,186 @@ GrallocTextureSourceOGL::GetAsSurface() {
GLuint
GrallocTextureSourceOGL::GetGLTexture()
{
if (mTextureBackendSpecificData) {
mTextureBackendSpecificData->SetCompositor(mCompositor);
return mTextureBackendSpecificData->GetTexture();
}
return mTexture;
}
void
GrallocTextureSourceOGL::BindEGLImage()
{
if (mTextureBackendSpecificData) {
mTextureBackendSpecificData->BindEGLImage(GetTextureTarget(), mEGLImage);
gl()->fEGLImageTargetTexture2D(GetTextureTarget(), mEGLImage);
}
TextureSource*
GrallocTextureHostOGL::GetTextureSources()
{
// This is now only used with tiled layers, and will eventually be removed.
// Other layer types use BindTextureSource instead.
MOZ_ASSERT(!mGLTextureSource);
if (!mTilingTextureSource) {
android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
MOZ_ASSERT(graphicBuffer);
if (!graphicBuffer) {
return nullptr;
}
mTilingTextureSource = new GrallocTextureSourceOGL(mCompositor, this,
graphicBuffer, mFormat);
}
mTilingTextureSource->Lock();
return mTilingTextureSource;
}
void
GrallocTextureHostOGL::UnbindTextureSource()
{
// Clear the reference to the TextureSource (if any), because we know that
// another TextureHost is being bound to the TextureSource. This means that
// we will have to re-do gl->fEGLImageTargetTexture2D next time we go through
// BindTextureSource (otherwise we would have skipped it).
// Note that this doesn't "unlock" the gralloc buffer or force it to be
// detached, Although decreasing the refcount of the TextureSource may lead
// to the gl handle being destroyed, which would unlock the gralloc buffer.
// That said, this method is called before another TextureHost attaches to the
// TextureSource, which has the effect of unlocking the gralloc buffer. So when
// this is called we know we are going to be unlocked soon.
mGLTextureSource = nullptr;
}
GLenum GetTextureTarget(gl::GLContext* aGL, android::PixelFormat aFormat) {
MOZ_ASSERT(aGL);
if (aGL->Renderer() == gl::GLRenderer::SGX530 ||
aGL->Renderer() == gl::GLRenderer::SGX540) {
// SGX has a quirk that only TEXTURE_EXTERNAL works and any other value will
// result in black pixels when trying to draw from bound textures.
// Unfortunately, using TEXTURE_EXTERNAL on Adreno has a terrible effect on
// performance.
// See Bug 950050.
return LOCAL_GL_TEXTURE_EXTERNAL;
} else {
gl()->fEGLImageTargetTexture2D(GetTextureTarget(), mEGLImage);
return TextureTargetForAndroidPixelFormat(aFormat);
}
}
void
GrallocTextureHostOGL::SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
GrallocTextureHostOGL::DestroyEGLImage()
{
if(!aBackendData) {
return;
// Only called when we want to get rid of the gralloc buffer, usually
// around the end of life of the TextureHost.
if (mEGLImage != EGL_NO_IMAGE && GetGLContext()) {
EGLImageDestroy(GetGLContext(), mEGLImage);
mEGLImage = EGL_NO_IMAGE;
}
// Update mTextureBackendSpecificData if it is not set yet.
if (!mTextureBackendSpecificData) {
MOZ_ASSERT(!mCompositableBackendData);
mCompositableBackendData = aBackendData;
CompositableDataGonkOGL* backend = static_cast<CompositableDataGonkOGL*>(mCompositableBackendData.get());
mTextureBackendSpecificData = backend->GetTextureBackendSpecificData();
}
// If TextureHost sharing by multiple CompositableHosts are detected,
// enable mBackendDatas usage.
if (!mBackendDatas &&
mCompositableBackendData &&
mCompositableBackendData != aBackendData &&
mTextureBackendSpecificData->IsAllowingSharingTextureHost())
{
mBackendDatas = MakeUnique<std::map<uint64_t, RefPtr<CompositableBackendSpecificData> > >();
(*mBackendDatas)[mCompositableBackendData->GetId()] = mCompositableBackendData;
mCompositableBackendData = nullptr;
// Get new mTextureBackendSpecificData
mTextureBackendSpecificData =
mTextureBackendSpecificData->GetNewTextureBackendSpecificData(mTextureSource->GetEGLImage());
mTextureBackendSpecificData->SetOwnedByTextureHost();
}
// Update mCompositableBackendData.
if (mBackendDatas)
{
// Handle a case that TextureHost has ownership of TextureSharedDataGonkOGL.
MOZ_ASSERT(aBackendData->IsAllowingSharingTextureHost());
(*mBackendDatas)[aBackendData->GetId()] = aBackendData;
if (mBackendDatas->size() > 200) {
NS_WARNING("Too many CompositableBackends");
}
} else {
// Handle a case that CompositableHost has ownership of TextureSharedDataGonkOGL.
mCompositableBackendData = aBackendData;
CompositableDataGonkOGL* backend = static_cast<CompositableDataGonkOGL*>(mCompositableBackendData.get());
mTextureBackendSpecificData = backend->GetTextureBackendSpecificData();
}
if (mTextureSource) {
mTextureSource->SetTextureBackendSpecificData(mTextureBackendSpecificData);
}
}
void
GrallocTextureHostOGL::UnsetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData)
GrallocTextureHostOGL::PrepareTextureSource(CompositableTextureSourceRef& aTextureSource)
{
if(!aBackendData ||
!mTextureBackendSpecificData) {
// This happens during the layers transaction.
// All of the gralloc magic goes here. The only thing that happens externally
// and that is good to keep in mind is that when the TextureSource is deleted,
// it destroys its gl texture handle which is important for genlock.
// If this TextureHost's mGLTextureSource member is non-null, it means we are
// still bound to the TextureSource, in which case we can skip the driver
// overhead of binding the texture again (fEGLImageTargetTexture2D)
// As a result, if the TextureHost is used with several CompositableHosts,
// it will be bound to only one TextureSource, and we'll do the driver work
// only once, which is great. This means that all of the compositables that
// use this TextureHost will keep a reference to this TextureSource at least
// for the duration of this frame.
// If the compositable already has a TextureSource (the aTextureSource parameter),
// that is compatible and is not in use by several compositable, we try to
// attach to it. This has the effect of unlocking the previous TextureHost that
// we attached to the TextureSource (the previous frame)
// If the TextureSource used by the compositable is also used by other
// compositables (see NumCompositableRefs), we have to create a new TextureSource,
// because otherwise we would be modifying the content of every layer that uses
// the TextureSource in question, even thoug they don't use this TextureHost.
MOZ_ASSERT(!mTilingTextureSource);
android::GraphicBuffer* graphicBuffer = GetGraphicBufferFromDesc(mGrallocHandle).get();
MOZ_ASSERT(graphicBuffer);
if (!graphicBuffer) {
mGLTextureSource = nullptr;
return;
}
if (mBackendDatas)
{
// Handle a case that TextureHost has ownership of TextureSharedDataGonkOGL.
mBackendDatas->erase(aBackendData->GetId());
if (mBackendDatas->size() == 0) {
mCompositableBackendData = nullptr;
mTextureBackendSpecificData = nullptr;
}
} else {
// Handle a case that CompositableHost has ownership of TextureSharedDataGonkOGL.
mCompositableBackendData = nullptr;
mTextureBackendSpecificData = nullptr;
if (mGLTextureSource && !mGLTextureSource->IsValid()) {
mGLTextureSource = nullptr;
}
if (mTextureSource) {
mTextureSource->SetTextureBackendSpecificData(mTextureBackendSpecificData);
if (mGLTextureSource) {
// We are already attached to a TextureSource, nothing to do except tell
// the compositable to use it.
aTextureSource = mGLTextureSource.get();
return;
}
gl::GLContext* gl = GetGLContext();
if (!gl || !gl->MakeCurrent()) {
mGLTextureSource = nullptr;
return;
}
if (mEGLImage == EGL_NO_IMAGE) {
// Should only happen the first time.
mEGLImage = EGLImageCreateFromNativeBuffer(gl, graphicBuffer->getNativeBuffer());
}
GLenum textureTarget = GetTextureTarget(gl, graphicBuffer->getPixelFormat());
GLTextureSource* glSource = aTextureSource.get() ?
aTextureSource->AsSourceOGL()->AsGLTextureSource() : nullptr;
bool shouldCreateTextureSource = !glSource || !glSource->IsValid()
|| glSource->NumCompositableRefs() > 1
|| glSource->GetTextureTarget() != textureTarget;
if (shouldCreateTextureSource) {
GLuint textureHandle;
gl->fGenTextures(1, &textureHandle);
gl->fBindTexture(textureTarget, textureHandle);
gl->fTexParameteri(textureTarget, LOCAL_GL_TEXTURE_WRAP_T, LOCAL_GL_CLAMP_TO_EDGE);
gl->fTexParameteri(textureTarget, LOCAL_GL_TEXTURE_WRAP_S, LOCAL_GL_CLAMP_TO_EDGE);
gl->fEGLImageTargetTexture2D(textureTarget, mEGLImage);
mGLTextureSource = new GLTextureSource(mCompositor, textureHandle, textureTarget,
mSize, mFormat);
aTextureSource = mGLTextureSource.get();
} else {
gl->fBindTexture(textureTarget, glSource->GetTextureHandle());
gl->fEGLImageTargetTexture2D(textureTarget, mEGLImage);
glSource->SetSize(mSize);
glSource->SetFormat(mFormat);
mGLTextureSource = glSource;
}
}
bool
GrallocTextureHostOGL::BindTextureSource(CompositableTextureSourceRef& aTextureSource)
{
// This happens at composition time.
// If mGLTextureSource is null it means PrepareTextureSource failed.
if (!mGLTextureSource) {
return false;
}
// If Prepare didn't fail, we expect our TextureSource to be the same as aTextureSource,
// otherwise it means something has fiddled with the TextureSource between Prepare and
// now.
MOZ_ASSERT(mGLTextureSource == aTextureSource);
aTextureSource = mGLTextureSource.get();
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
// Wait until it's ready.
WaitAcquireFenceSyncComplete();
#endif
return true;
}
} // namepsace layers

View File

@ -17,6 +17,7 @@ namespace layers {
class GrallocTextureHostOGL;
// Progressively getting replaced by GLTextureSource
class GrallocTextureSourceOGL : public TextureSource
, public TextureSourceOGL
{
@ -47,8 +48,6 @@ public:
return LOCAL_GL_CLAMP_TO_EDGE;
}
virtual void SetTextureBackendSpecificData(TextureSharedDataGonkOGL* aBackendData);
void DeallocateDeviceData();
gl::GLContext* gl() const;
@ -75,7 +74,6 @@ public:
bool Lock();
protected:
RefPtr<TextureSharedDataGonkOGL> mTextureBackendSpecificData;
RefPtr<CompositorOGL> mCompositor;
GrallocTextureHostOGL* mTextureHost;
android::sp<android::GraphicBuffer> mGraphicBuffer;
@ -113,14 +111,17 @@ public:
virtual gfx::SurfaceFormat GetFormat() const;
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mSize; }
virtual gfx::IntSize GetSize() const MOZ_OVERRIDE { return mDescriptorSize; }
virtual LayerRenderState GetRenderState() MOZ_OVERRIDE;
virtual TextureSource* GetTextureSources() MOZ_OVERRIDE
{
return mTextureSource;
}
virtual void PrepareTextureSource(CompositableTextureSourceRef& aTextureSource) MOZ_OVERRIDE;
virtual bool BindTextureSource(CompositableTextureSourceRef& aTextureSource) MOZ_OVERRIDE;
virtual void UnbindTextureSource() MOZ_OVERRIDE;
virtual TextureSource* GetTextureSources() MOZ_OVERRIDE;
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
virtual TextureHostOGL* AsHostOGL() MOZ_OVERRIDE
@ -131,21 +132,27 @@ public:
virtual TemporaryRef<gfx::DataSourceSurface> GetAsSurface() MOZ_OVERRIDE;
virtual void SetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData) MOZ_OVERRIDE;
virtual void UnsetCompositableBackendSpecificData(CompositableBackendSpecificData* aBackendData) MOZ_OVERRIDE;
bool IsValid() const;
virtual const char* Name() MOZ_OVERRIDE { return "GrallocTextureHostOGL"; }
private:
NewSurfaceDescriptorGralloc mGrallocHandle;
RefPtr<GrallocTextureSourceOGL> mTextureSource;
gfx::IntSize mSize; // See comment in textureClientOGL.h
gl::GLContext* GetGLContext() const { return mCompositor ? mCompositor->gl() : nullptr; }
RefPtr<TextureSharedDataGonkOGL> mTextureBackendSpecificData;
UniquePtr<std::map<uint64_t, RefPtr<CompositableBackendSpecificData> > > mBackendDatas;
private:
void DestroyEGLImage();
NewSurfaceDescriptorGralloc mGrallocHandle;
RefPtr<GLTextureSource> mGLTextureSource;
RefPtr<CompositorOGL> mCompositor;
// only used for tiling, will be removed.
RefPtr<GrallocTextureSourceOGL> mTilingTextureSource;
// Size reported by the GraphicBuffer
gfx::IntSize mSize;
// Size reported by TextureClient, can be different in some cases (video?),
// used by LayerRenderState.
gfx::IntSize mDescriptorSize;
gfx::SurfaceFormat mFormat;
EGLImage mEGLImage;
};
} // namespace layers

View File

@ -40,16 +40,6 @@ namespace layers {
class Compositor;
TemporaryRef<CompositableBackendSpecificData>
CreateCompositableBackendSpecificDataOGL()
{
#ifdef MOZ_WIDGET_GONK
return new CompositableDataGonkOGL();
#else
return nullptr;
#endif
}
TemporaryRef<TextureHost>
CreateTextureHostOGL(const SurfaceDescriptor& aDesc,
ISurfaceAllocator* aDeallocator,
@ -119,174 +109,6 @@ FlagsToGLFlags(TextureFlags aFlags)
return static_cast<gl::TextureImage::Flags>(result);
}
CompositableDataGonkOGL::CompositableDataGonkOGL()
{
}
CompositableDataGonkOGL::~CompositableDataGonkOGL()
{
ClearData();
}
void
CompositableDataGonkOGL::ClearData()
{
CompositableBackendSpecificData::ClearData();
mTextureBackendSpecificData = nullptr;
mCompositor = nullptr;
}
void
CompositableDataGonkOGL::SetCompositor(Compositor* aCompositor)
{
mCompositor = static_cast<CompositorOGL*>(aCompositor);
if (mTextureBackendSpecificData) {
mTextureBackendSpecificData->SetCompositor(aCompositor);
}
}
TextureSharedDataGonkOGL*
CompositableDataGonkOGL::GetTextureBackendSpecificData()
{
if (!mTextureBackendSpecificData) {
mTextureBackendSpecificData = new TextureSharedDataGonkOGL();
mTextureBackendSpecificData->SetCompositor(mCompositor);
mTextureBackendSpecificData->SetAllowSharingTextureHost(IsAllowingSharingTextureHost());
}
return mTextureBackendSpecificData;
}
TextureSharedDataGonkOGL::TextureSharedDataGonkOGL()
: mOwnedByCompositableHost(true)
, mAllowSharingTextureHost(false)
, mTexture(0)
, mBoundEGLImage(EGL_NO_IMAGE)
{
}
TextureSharedDataGonkOGL::TextureSharedDataGonkOGL(GLuint aTexture, EGLImage aImage, CompositorOGL* aCompositor)
: mOwnedByCompositableHost(true)
, mAllowSharingTextureHost(false)
, mCompositor(aCompositor)
, mTexture(aTexture)
, mBoundEGLImage(aImage)
{
}
TextureSharedDataGonkOGL::~TextureSharedDataGonkOGL()
{
DeleteTextureIfPresent();
}
gl::GLContext*
TextureSharedDataGonkOGL::gl() const
{
return mCompositor ? mCompositor->gl() : nullptr;
}
void
TextureSharedDataGonkOGL::SetCompositor(Compositor* aCompositor)
{
if (gl() && mCompositor != aCompositor) {
DeleteTextureIfPresent();
}
mCompositor = static_cast<CompositorOGL*>(aCompositor);
}
void
TextureSharedDataGonkOGL::ClearData()
{
DeleteTextureIfPresent();
}
TemporaryRef<TextureSharedDataGonkOGL>
TextureSharedDataGonkOGL::GetNewTextureBackendSpecificData(EGLImage aImage)
{
MOZ_ASSERT(IsAllowingSharingTextureHost());
if (IsEGLImageBound(aImage))
{
// If EGLImage is already bound to OpenGL Texture,
// handover the OpenGL Texture to caller
GLuint textureId = GetAndResetGLTextureOwnership();
RefPtr<TextureSharedDataGonkOGL> data = new TextureSharedDataGonkOGL(textureId, aImage, mCompositor);
data->SetCompositor(mCompositor);
data->SetAllowSharingTextureHost(true);
return data;
}
// Create brand new TextureSharedDataGonkOGL
RefPtr<TextureSharedDataGonkOGL> data = new TextureSharedDataGonkOGL();
data->SetCompositor(mCompositor);
data->SetAllowSharingTextureHost(true);
return data;
}
GLuint
TextureSharedDataGonkOGL::GetTexture()
{
if (!mTexture) {
if (gl() && gl()->MakeCurrent()) {
gl()->fGenTextures(1, &mTexture);
}
}
return mTexture;
}
GLuint
TextureSharedDataGonkOGL::GetAndResetGLTextureOwnership()
{
GLuint texture = mTexture;
mTexture = 0;
mBoundEGLImage = EGL_NO_IMAGE;
return texture;
}
void
TextureSharedDataGonkOGL::DeleteTextureIfPresent()
{
if (mTexture) {
MOZ_ASSERT(mCompositor);
if (gl() && gl()->MakeCurrent()) {
gl()->fDeleteTextures(1, &mTexture);
}
mTexture = 0;
mBoundEGLImage = EGL_NO_IMAGE;
}
}
void
TextureSharedDataGonkOGL::BindEGLImage(GLuint aTarget, EGLImage aImage)
{
if (mBoundEGLImage != aImage) {
MOZ_ASSERT(gl());
if (gl()) {
gl()->fEGLImageTargetTexture2D(aTarget, aImage);
}
mBoundEGLImage = aImage;
}
}
void
TextureSharedDataGonkOGL::ClearBoundEGLImage(EGLImage aImage)
{
if (mBoundEGLImage == aImage) {
DeleteTextureIfPresent();
mBoundEGLImage = EGL_NO_IMAGE;
}
}
bool
TextureSharedDataGonkOGL::IsEGLImageBound(EGLImage aImage)
{
if (mTexture != 0 &&
aImage != EGL_NO_IMAGE &&
aImage == mBoundEGLImage) {
return true;
}
return false;
}
#if defined(MOZ_WIDGET_GONK) && ANDROID_VERSION >= 17
bool
TextureHostOGL::SetReleaseFence(const android::sp<android::Fence>& aReleaseFence)
@ -529,27 +351,56 @@ TextureImageTextureSourceOGL::BindTexture(GLenum aTextureUnit, gfx::Filter aFilt
// GLTextureSource
GLTextureSource::GLTextureSource(CompositorOGL* aCompositor,
GLuint aTex,
gfx::SurfaceFormat aFormat,
GLuint aTextureHandle,
GLenum aTarget,
gfx::IntSize aSize)
: mSize(aSize)
, mCompositor(aCompositor)
, mTex(aTex)
, mFormat(aFormat)
gfx::IntSize aSize,
gfx::SurfaceFormat aFormat,
bool aExternallyOwned)
: mCompositor(aCompositor)
, mTextureHandle(aTextureHandle)
, mTextureTarget(aTarget)
, mSize(aSize)
, mFormat(aFormat)
, mExternallyOwned(aExternallyOwned)
{
MOZ_COUNT_CTOR(GLTextureSource);
}
GLTextureSource::~GLTextureSource()
{
MOZ_COUNT_DTOR(GLTextureSource);
if (!mExternallyOwned) {
DeleteTextureHandle();
}
}
void
GLTextureSource::DeallocateDeviceData()
{
if (!mExternallyOwned) {
DeleteTextureHandle();
}
}
void
GLTextureSource::DeleteTextureHandle()
{
if (mTextureHandle != 0 && gl() && gl()->MakeCurrent()) {
gl()->fDeleteTextures(1, &mTextureHandle);
}
mTextureHandle = 0;
}
void
GLTextureSource::BindTexture(GLenum aTextureUnit, gfx::Filter aFilter)
{
MOZ_ASSERT(gl());
MOZ_ASSERT(mTextureHandle != 0);
if (!gl()) {
NS_WARNING("Trying to bind a texture without a GLContext");
return;
}
gl()->fActiveTexture(aTextureUnit);
gl()->fBindTexture(mTextureTarget, mTex);
gl()->fBindTexture(mTextureTarget, mTextureHandle);
ApplyFilterToBoundTexture(gl(), aFilter, mTextureTarget);
}
@ -562,7 +413,7 @@ GLTextureSource::SetCompositor(Compositor* aCompositor)
bool
GLTextureSource::IsValid() const
{
return !!gl();
return !!gl() && mTextureHandle != 0;
}
gl::GLContext*
@ -614,6 +465,10 @@ SurfaceTextureSource::BindTexture(GLenum aTextureUnit, gfx::Filter aFilter)
void
SurfaceTextureSource::SetCompositor(Compositor* aCompositor)
{
if (mCompositor != aCompositor) {
DeallocateDeviceData();
}
mCompositor = static_cast<CompositorOGL*>(aCompositor);
}

View File

@ -58,99 +58,7 @@ class Compositor;
class CompositorOGL;
class TextureImageTextureSourceOGL;
class TextureSharedDataGonkOGL;
/**
* CompositableBackendSpecificData implementation for the Gonk OpenGL backend.
* Share a same texture between TextureHosts in the same CompositableHost.
* By shareing the texture among the TextureHosts, number of texture allocations
* can be reduced than texture allocation in every TextureHosts.
* From Bug 912134, use only one texture among all TextureHosts degrade
* the rendering performance.
* CompositableDataGonkOGL chooses in a middile of them.
*/
class CompositableDataGonkOGL : public CompositableBackendSpecificData
{
protected:
virtual ~CompositableDataGonkOGL();
public:
CompositableDataGonkOGL();
virtual void ClearData() MOZ_OVERRIDE;
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
TextureSharedDataGonkOGL* GetTextureBackendSpecificData();
protected:
nsRefPtr<TextureSharedDataGonkOGL> mTextureBackendSpecificData;
RefPtr<CompositorOGL> mCompositor;
};
/**
* Manage actual shared resources of CompositableDataGonkOGL.
* The resources are split from CompositableDataGonkOGL to handle two use cases.
* Normally TextureHost is used from one CompositableHost at the same time.
* In this case, performance is good if the resources are owned by CompositableDataGonkOGL.
* But TextureHost could be shared among multiple ImageHosts.
* If it happens, performance is good if the resource is owned by TextureHost.
* The resources ownership is carryed over from CompositableDataGonkOGL to TextureHost.
* See Bug 1017351.
*/
class TextureSharedDataGonkOGL
{
protected:
virtual ~TextureSharedDataGonkOGL();
public:
NS_INLINE_DECL_REFCOUNTING(TextureSharedDataGonkOGL)
TextureSharedDataGonkOGL();
TextureSharedDataGonkOGL(GLuint aTexture, EGLImage aImage, CompositorOGL* aCompositor);
void SetCompositor(Compositor* aCompositor);
void ClearData();
// Mark TextureSharedDataGonkOGL as owned by TextureHost.
void SetOwnedByTextureHost()
{
mOwnedByCompositableHost = false;
}
// Check if this is owned by CompositableHost or TextureHost.
bool IsOwnedByCompositableHost()
{
return mOwnedByCompositableHost;
}
bool IsAllowingSharingTextureHost()
{
return mAllowSharingTextureHost;
}
void SetAllowSharingTextureHost(bool aAllow)
{
mAllowSharingTextureHost = aAllow;
}
// Create new TextureSharedDataGonkOGL.
// If aImage is already bound to OpenGL texture, the OpenGL textre is carried over
// to a new object. It could reduce calling fEGLImageTargetTexture2D()
// during resources ownership carry over from CompositableHost to TextureHost.
TemporaryRef<TextureSharedDataGonkOGL> GetNewTextureBackendSpecificData(EGLImage aImage);
GLuint GetTexture();
void DeleteTextureIfPresent();
gl::GLContext* gl() const;
void BindEGLImage(GLuint aTarget, EGLImage aImage);
void ClearBoundEGLImage(EGLImage aImage);
bool IsEGLImageBound(EGLImage aImage);
protected:
GLuint GetAndResetGLTextureOwnership();
bool mOwnedByCompositableHost;
bool mAllowSharingTextureHost;
RefPtr<CompositorOGL> mCompositor;
GLuint mTexture;
EGLImage mBoundEGLImage;
};
class GLTextureSource;
inline void ApplyFilterToBoundTexture(gl::GLContext* aGL,
gfx::Filter aFilter,
@ -205,6 +113,8 @@ public:
virtual TextureImageTextureSourceOGL* AsTextureImageTextureSource() { return nullptr; }
virtual GLTextureSource* AsGLTextureSource() { return nullptr; }
void SetFilter(gl::GLContext* aGL, gfx::Filter aFilter)
{
if (mHasCachedFilter &&
@ -373,10 +283,15 @@ class GLTextureSource : public TextureSource
{
public:
GLTextureSource(CompositorOGL* aCompositor,
GLuint aTex,
gfx::SurfaceFormat aFormat,
GLuint aTextureHandle,
GLenum aTarget,
gfx::IntSize aSize);
gfx::IntSize aSize,
gfx::SurfaceFormat aFormat,
bool aExternallyOwned = false);
~GLTextureSource();
virtual GLTextureSource* AsGLTextureSource() MOZ_OVERRIDE { return this; }
virtual TextureSourceOGL* AsSourceOGL() MOZ_OVERRIDE { return this; }
@ -392,18 +307,29 @@ public:
virtual GLenum GetWrapMode() const MOZ_OVERRIDE { return LOCAL_GL_CLAMP_TO_EDGE; }
virtual void DeallocateDeviceData() MOZ_OVERRIDE {}
virtual void DeallocateDeviceData() MOZ_OVERRIDE;
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
void SetSize(gfx::IntSize aSize) { mSize = aSize; }
void SetFormat(gfx::SurfaceFormat aFormat) { mFormat = aFormat; }
GLuint GetTextureHandle() const { return mTextureHandle; }
gl::GLContext* gl() const;
protected:
const gfx::IntSize mSize;
void DeleteTextureHandle();
RefPtr<CompositorOGL> mCompositor;
const GLuint mTex;
const gfx::SurfaceFormat mFormat;
const GLenum mTextureTarget;
GLuint mTextureHandle;
GLenum mTextureTarget;
gfx::IntSize mSize;
gfx::SurfaceFormat mFormat;
// If the texture is externally owned, the gl handle will not be deleted
// in the destructor.
bool mExternallyOwned;
};
////////////////////////////////////////////////////////////////////////

View File

@ -391,7 +391,10 @@ gfxWindowsPlatform::UpdateRenderMode()
tryD2D = false;
}
if (isVistaOrHigher && !safeMode && tryD2D) {
ID3D11Device *device = GetD3D11Device();
if (isVistaOrHigher && !safeMode && tryD2D && device &&
DoesD3D11DeviceSupportResourceSharing(device)) {
VerifyD2DDevice(d2dForceEnabled);
if (mD2DDevice) {
mRenderMode = RENDER_DIRECT2D;
@ -1500,6 +1503,70 @@ gfxWindowsPlatform::GetDXGIAdapter()
return mAdapter;
}
// See bug 1083071. On some drivers, Direct3D 11 CreateShaderResourceView fails
// with E_OUTOFMEMORY.
bool DoesD3D11DeviceSupportResourceSharing(ID3D11Device *device)
{
static bool checked;
static bool result;
if (checked)
return result;
checked = true;
RefPtr<ID3D11Texture2D> texture;
D3D11_TEXTURE2D_DESC desc;
desc.Width = 32;
desc.Height = 32;
desc.MipLevels = 1;
desc.ArraySize = 1;
desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.CPUAccessFlags = 0;
desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX;
desc.BindFlags = D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE;
if (FAILED(device->CreateTexture2D(&desc, NULL, byRef(texture)))) {
return false;
}
HANDLE shareHandle;
nsRefPtr<IDXGIResource> otherResource;
if (FAILED(texture->QueryInterface(__uuidof(IDXGIResource),
getter_AddRefs(otherResource))))
{
return false;
}
if (FAILED(otherResource->GetSharedHandle(&shareHandle))) {
return false;
}
nsRefPtr<ID3D11Resource> sharedResource;
nsRefPtr<ID3D11Texture2D> sharedTexture;
if (FAILED(device->OpenSharedResource(shareHandle, __uuidof(ID3D11Resource),
getter_AddRefs(sharedResource))))
{
return false;
}
if (FAILED(sharedResource->QueryInterface(__uuidof(ID3D11Texture2D),
getter_AddRefs(sharedTexture))))
{
return false;
}
RefPtr<ID3D11ShaderResourceView> sharedView;
// This if(FAILED()) is the one that actually fails on systems affected by bug 1083071.
if (FAILED(device->CreateShaderResourceView(sharedTexture, NULL, byRef(sharedView)))) {
return false;
}
result = true;
return true;
}
void
gfxWindowsPlatform::InitD3D11Devices()
{

View File

@ -305,4 +305,6 @@ private:
nsDataHashtable<nsCStringHashKey, nsTArray<nsRefPtr<gfxFontEntry> > > mPrefFonts;
};
bool DoesD3D11DeviceSupportResourceSharing(ID3D11Device *device);
#endif /* GFX_WINDOWS_PLATFORM_H */

View File

@ -189,8 +189,8 @@ if CONFIG['MOZ_GAMEPAD']:
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
# So that we can call nsScreenManagerGonk::GetConfiguration().
LOCAL_INCLUDES += [
'/widget',
'/widget/gonk',
'/widget/xpwidgets'
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':

View File

@ -71,7 +71,10 @@ NS_IMETHODIMP nsIconProtocolHandler::NewURI(const nsACString &aSpec,
return NS_OK;
}
NS_IMETHODIMP nsIconProtocolHandler::NewChannel(nsIURI* url, nsIChannel* *result)
NS_IMETHODIMP
nsIconProtocolHandler::NewChannel2(nsIURI* url,
nsILoadInfo* aLoadInfo,
nsIChannel** result)
{
NS_ENSURE_ARG_POINTER(url);
nsIconChannel* channel = new nsIconChannel;
@ -89,4 +92,9 @@ NS_IMETHODIMP nsIconProtocolHandler::NewChannel(nsIURI* url, nsIChannel* *result
return NS_OK;
}
NS_IMETHODIMP nsIconProtocolHandler::NewChannel(nsIURI* url, nsIChannel* *result)
{
return NewChannel2(url, nullptr, result);
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,12 @@
// Indexed getters can add new properties that slice should not ignore.
var arr = [];
Object.defineProperty(arr, 10000, {get: function() {
arr[10001] = 4;
return 3;
}});
arr[10010] = 6;
var res = arr.slice(8000);
assertEq(res[2000], 3);
assertEq(res[2001], 4);
assertEq(res[2010], 6);

View File

@ -2715,6 +2715,136 @@ js::array_concat(JSContext *cx, unsigned argc, Value *vp)
return SetLengthProperty(cx, narr, length);
}
struct SortComparatorIndexes
{
bool operator()(uint32_t a, uint32_t b, bool *lessOrEqualp) {
*lessOrEqualp = (a <= b);
return true;
}
};
// Returns all indexed properties in the range [begin, end) found on |obj| or
// its proto chain. This function does not handle proxies, objects with
// resolve/lookupGeneric hooks or indexed getters, as those can introduce
// new properties. In those cases, *success is set to |false|.
static bool
GetIndexedPropertiesInRange(JSContext *cx, HandleObject obj, uint32_t begin, uint32_t end,
Vector<uint32_t> &indexes, bool *success)
{
*success = false;
// First, look for proxies or class hooks that can introduce extra
// properties.
JSObject *pobj = obj;
do {
if (!pobj->isNative() ||
pobj->getClass()->resolve != JS_ResolveStub ||
pobj->getOps()->lookupGeneric)
{
return true;
}
} while ((pobj = pobj->getProto()));
// Collect indexed property names.
pobj = obj;
do {
// Append dense elements.
NativeObject *nativeObj = &pobj->as<NativeObject>();
uint32_t initLen = nativeObj->getDenseInitializedLength();
for (uint32_t i = begin; i < initLen && i < end; i++) {
if (nativeObj->getDenseElement(i).isMagic(JS_ELEMENTS_HOLE))
continue;
if (!indexes.append(i))
return false;
}
// Append typed array elements.
if (IsAnyTypedArray(pobj)) {
uint32_t len = AnyTypedArrayLength(pobj);
for (uint32_t i = begin; i < len && i < end; i++) {
if (!indexes.append(i))
return false;
}
}
// Append sparse elements.
if (pobj->isIndexed()) {
Shape::Range<NoGC> r(pobj->lastProperty());
for (; !r.empty(); r.popFront()) {
Shape &shape = r.front();
jsid id = shape.propid();
if (!JSID_IS_INT(id))
continue;
uint32_t i = uint32_t(JSID_TO_INT(id));
if (!(begin <= i && i < end))
continue;
// Watch out for getters, they can add new properties.
if (!shape.hasDefaultGetter())
return true;
if (!indexes.append(i))
return false;
}
}
} while ((pobj = pobj->getProto()));
// Sort the indexes.
Vector<uint32_t> tmp(cx);
size_t n = indexes.length();
if (!tmp.resize(n))
return false;
if (!MergeSort(indexes.begin(), n, tmp.begin(), SortComparatorIndexes()))
return false;
// Remove duplicates.
if (!indexes.empty()) {
uint32_t last = 0;
for (size_t i = 1, len = indexes.length(); i < len; i++) {
uint32_t elem = indexes[i];
if (indexes[last] != elem) {
last++;
indexes[last] = elem;
}
}
if (!indexes.resize(last + 1))
return false;
}
*success = true;
return true;
}
static bool
SliceSparse(JSContext *cx, HandleObject obj, uint32_t begin, uint32_t end, HandleObject result)
{
MOZ_ASSERT(begin <= end);
Vector<uint32_t> indexes(cx);
bool success;
if (!GetIndexedPropertiesInRange(cx, obj, begin, end, indexes, &success))
return false;
if (!success)
return SliceSlowly(cx, obj, obj, begin, end, result);
RootedValue value(cx);
for (size_t i = 0, len = indexes.length(); i < len; i++) {
uint32_t index = indexes[i];
MOZ_ASSERT(begin <= index && index < end);
bool hole;
if (!GetElement(cx, obj, obj, index, &hole, &value))
return false;
if (!hole && !JSObject::defineElement(cx, result, index - begin, value))
return false;
}
return true;
}
bool
js::array_slice(JSContext *cx, unsigned argc, Value *vp)
{
@ -2761,12 +2891,13 @@ js::array_slice(JSContext *cx, unsigned argc, Value *vp)
begin = end;
Rooted<ArrayObject*> narr(cx);
narr = NewDenseFullyAllocatedArray(cx, end - begin);
if (!narr)
return false;
TryReuseArrayType(obj, narr);
if (obj->is<ArrayObject>() && !ObjectMayHaveExtraIndexedProperties(obj)) {
narr = NewDenseFullyAllocatedArray(cx, end - begin);
if (!narr)
return false;
TryReuseArrayType(obj, narr);
ArrayObject *aobj = &obj->as<ArrayObject>();
if (aobj->getDenseInitializedLength() > begin) {
uint32_t numSourceElements = aobj->getDenseInitializedLength() - begin;
@ -2778,6 +2909,11 @@ js::array_slice(JSContext *cx, unsigned argc, Value *vp)
return true;
}
narr = NewDensePartlyAllocatedArray(cx, end - begin);
if (!narr)
return false;
TryReuseArrayType(obj, narr);
if (js::SliceOp op = obj->getOps()->slice) {
// Ensure that we have dense elements, so that DOM can use js::UnsafeDefineElement.
NativeObject::EnsureDenseResult result = narr->ensureDenseElements(cx, 0, end - begin);
@ -2796,9 +2932,13 @@ js::array_slice(JSContext *cx, unsigned argc, Value *vp)
MOZ_ASSERT(result == NativeObject::ED_SPARSE);
}
if (!SliceSlowly(cx, obj, obj, begin, end, narr))
return false;
if (obj->isNative() && obj->isIndexed() && end - begin > 1000) {
if (!SliceSparse(cx, obj, begin, end, narr))
return false;
} else {
if (!SliceSlowly(cx, obj, obj, begin, end, narr))
return false;
}
args.rval().setObject(*narr);
return true;

View File

@ -2656,8 +2656,10 @@ ToLocaleFormatHelper(JSContext *cx, HandleObject obj, const char *format, Mutabl
/* ...but not if starts with 4-digit year, like 2022/3/11. */
!(isdigit(buf[0]) && isdigit(buf[1]) &&
isdigit(buf[2]) && isdigit(buf[3]))) {
double localtime = obj->as<DateObject>().cachedLocalTime(&cx->runtime()->dateTimeInfo);
int year = IsNaN(localtime) ? 0 : (int) YearFromTime(localtime);
JS_snprintf(buf + (result_len - 2), (sizeof buf) - (result_len - 2),
"%d", js_DateGetYear(cx, obj));
"%d", year);
}
}
@ -3060,84 +3062,37 @@ js_NewDateObject(JSContext *cx, int year, int mon, int mday,
}
JS_FRIEND_API(bool)
js_DateIsValid(JSObject *obj)
js::DateIsValid(JSContext *cx, JSObject *objArg)
{
return obj->is<DateObject>() && !IsNaN(obj->as<DateObject>().UTCTime().toNumber());
}
RootedObject obj(cx, objArg);
if (!ObjectClassIs(obj, ESClass_Date, cx))
return false;
JS_FRIEND_API(int)
js_DateGetYear(JSContext *cx, JSObject *obj)
{
/* Preserve legacy API behavior of returning 0 for invalid dates. */
MOZ_ASSERT(obj);
double localtime = obj->as<DateObject>().cachedLocalTime(&cx->runtime()->dateTimeInfo);
if (IsNaN(localtime))
return 0;
RootedValue unboxed(cx);
if (!Unbox(cx, obj, &unboxed)) {
// This can't actually happen, so we don't force consumers to deal with
// a clunky out-param API. Do something sane-ish if it does happen.
cx->clearPendingException();
return false;
}
return (int) YearFromTime(localtime);
}
JS_FRIEND_API(int)
js_DateGetMonth(JSContext *cx, JSObject *obj)
{
MOZ_ASSERT(obj);
double localtime = obj->as<DateObject>().cachedLocalTime(&cx->runtime()->dateTimeInfo);
if (IsNaN(localtime))
return 0;
return (int) MonthFromTime(localtime);
}
JS_FRIEND_API(int)
js_DateGetDate(JSContext *cx, JSObject *obj)
{
MOZ_ASSERT(obj);
double localtime = obj->as<DateObject>().cachedLocalTime(&cx->runtime()->dateTimeInfo);
if (IsNaN(localtime))
return 0;
return (int) DateFromTime(localtime);
}
JS_FRIEND_API(int)
js_DateGetHours(JSContext *cx, JSObject *obj)
{
MOZ_ASSERT(obj);
double localtime = obj->as<DateObject>().cachedLocalTime(&cx->runtime()->dateTimeInfo);
if (IsNaN(localtime))
return 0;
return (int) HourFromTime(localtime);
}
JS_FRIEND_API(int)
js_DateGetMinutes(JSContext *cx, JSObject *obj)
{
MOZ_ASSERT(obj);
double localtime = obj->as<DateObject>().cachedLocalTime(&cx->runtime()->dateTimeInfo);
if (IsNaN(localtime))
return 0;
return (int) MinFromTime(localtime);
}
JS_FRIEND_API(int)
js_DateGetSeconds(JSObject *obj)
{
if (!obj->is<DateObject>())
return 0;
double utctime = obj->as<DateObject>().UTCTime().toNumber();
if (IsNaN(utctime))
return 0;
return (int) SecFromTime(utctime);
return !IsNaN(unboxed.toNumber());
}
JS_FRIEND_API(double)
js_DateGetMsecSinceEpoch(JSObject *obj)
js::DateGetMsecSinceEpoch(JSContext *cx, JSObject *objArg)
{
obj = CheckedUnwrap(obj);
if (!obj || !obj->is<DateObject>())
RootedObject obj(cx, objArg);
if (!ObjectClassIs(obj, ESClass_Date, cx))
return 0;
return obj->as<DateObject>().UTCTime().toNumber();
RootedValue unboxed(cx);
if (!Unbox(cx, obj, &unboxed)) {
// This can't actually happen, so we don't force consumers to deal with
// a clunky out-param API. Do something sane-ish if it does happen.
cx->clearPendingException();
return 0;
}
return unboxed.toNumber();
}

View File

@ -38,24 +38,6 @@ extern JS_FRIEND_API(JSObject *)
js_NewDateObject(JSContext* cx, int year, int mon, int mday,
int hour, int min, int sec);
extern JS_FRIEND_API(int)
js_DateGetYear(JSContext *cx, JSObject *obj);
extern JS_FRIEND_API(int)
js_DateGetMonth(JSContext *cx, JSObject *obj);
extern JS_FRIEND_API(int)
js_DateGetDate(JSContext *cx, JSObject *obj);
extern JS_FRIEND_API(int)
js_DateGetHours(JSContext *cx, JSObject *obj);
extern JS_FRIEND_API(int)
js_DateGetMinutes(JSContext *cx, JSObject *obj);
extern JS_FRIEND_API(int)
js_DateGetSeconds(JSObject *obj);
/* Date constructor native. Exposed only so the JIT can know its address. */
bool
js_Date(JSContext *cx, unsigned argc, JS::Value *vp);

View File

@ -1257,8 +1257,6 @@ const void *GetDOMProxyHandlerFamily();
uint32_t GetDOMProxyExpandoSlot();
DOMProxyShadowsCheck GetDOMProxyShadowsCheck();
} /* namespace js */
/* Implemented in jsdate.cpp. */
/*
@ -1266,10 +1264,12 @@ DOMProxyShadowsCheck GetDOMProxyShadowsCheck();
* out-of-band for js_DateGet*)
*/
extern JS_FRIEND_API(bool)
js_DateIsValid(JSObject* obj);
DateIsValid(JSContext *cx, JSObject* obj);
extern JS_FRIEND_API(double)
js_DateGetMsecSinceEpoch(JSObject *obj);
DateGetMsecSinceEpoch(JSContext *cx, JSObject *obj);
} /* namespace js */
/* Implemented in jscntxt.cpp. */

View File

@ -801,6 +801,8 @@ Unbox(JSContext *cx, HandleObject obj, MutableHandleValue vp)
vp.setNumber(obj->as<NumberObject>().unbox());
else if (obj->is<StringObject>())
vp.setString(obj->as<StringObject>().unbox());
else if (obj->is<DateObject>())
vp.set(obj->as<DateObject>().UTCTime());
else
vp.setUndefined();

View File

@ -1060,8 +1060,10 @@ JSStructuredCloneWriter::startWrite(HandleValue v)
return out.writePair(SCTAG_REGEXP_OBJECT, re->getFlags()) &&
writeString(SCTAG_STRING, re->getSource());
} else if (ObjectClassIs(obj, ESClass_Date, context())) {
double d = js_DateGetMsecSinceEpoch(obj);
return out.writePair(SCTAG_DATE_OBJECT, 0) && out.writeDouble(d);
RootedValue unboxed(context());
if (!Unbox(context(), obj, &unboxed))
return false;
return out.writePair(SCTAG_DATE_OBJECT, 0) && out.writeDouble(unboxed.toNumber());
} else if (JS_IsTypedArrayObject(obj)) {
return writeTypedArray(obj);
} else if (JS_IsArrayBufferObject(obj) && JS_ArrayBufferHasData(obj)) {

View File

@ -25,7 +25,6 @@
#include "nsXMLHttpRequest.h"
#include "WrapperFactory.h"
#include "xpcprivate.h"
#include "XPCQuickStubs.h"
#include "XPCWrapper.h"
#include "XrayWrapper.h"
#include "mozilla/dom/BindingUtils.h"

View File

@ -3216,8 +3216,12 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
// 1MB is the default stack size on Windows, so use 900k. And since 32-bit
// Windows stack frames are 3.4k each, let's use a buffer of 48k and double
// that for 64-bit.
//
// Note - Frames on Win32 PGO builds seem to have grown recently, and 48k
// stacks seem about 20-30% too small - so we bump it to 64k.
const size_t kStackQuota = 900 * 1024;
const size_t kTrustedScriptBuffer = 12 * sizeof(size_t) * 1024;
const size_t kTrustedScriptBuffer = (sizeof(size_t) == 8) ? 96 * 1024
: 64 * 1024;
// The following two configurations are linux-only. Given the numbers above,
// we use 50k and 100k trusted buffers on 32-bit and 64-bit respectively.
#elif defined(DEBUG)

View File

@ -1,68 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=4 et sw=4 tw=99: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "jsapi.h"
#include "jsfriendapi.h"
#include "jsprf.h"
#include "nsCOMPtr.h"
#include "AccessCheck.h"
#include "WrapperFactory.h"
#include "xpcprivate.h"
#include "XPCInlines.h"
#include "XPCQuickStubs.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/Exceptions.h"
using namespace mozilla;
using namespace JS;
nsresult
xpc_qsUnwrapArgImpl(JSContext *cx,
HandleObject src,
const nsIID &iid,
void **ppArg)
{
nsISupports *iface = xpc::UnwrapReflectorToISupports(src);
if (iface) {
if (NS_FAILED(iface->QueryInterface(iid, ppArg))) {
return NS_ERROR_XPC_BAD_CONVERT_JS;
}
return NS_OK;
}
nsRefPtr<nsXPCWrappedJS> wrappedJS;
nsresult rv = nsXPCWrappedJS::GetNewOrUsed(src, iid, getter_AddRefs(wrappedJS));
if (NS_FAILED(rv) || !wrappedJS) {
return rv;
}
// We need to go through the QueryInterface logic to make this return
// the right thing for the various 'special' interfaces; e.g.
// nsIPropertyBag. We must use AggregatedQueryInterface in cases where
// there is an outer to avoid nasty recursion.
return wrappedJS->QueryInterface(iid, ppArg);
}
namespace xpc {
bool
NonVoidStringToJsval(JSContext *cx, nsAString &str, MutableHandleValue rval)
{
nsStringBuffer* sharedBuffer;
if (!XPCStringConvert::ReadableToJSVal(cx, str, &sharedBuffer, rval))
return false;
if (sharedBuffer) {
// The string was shared but ReadableToJSVal didn't addref it.
// Move the ownership from str to jsstr.
str.ForgetSharedBuffer();
}
return true;
}
} // namespace xpc

View File

@ -1,18 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=4 et sw=4 tw=99: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef xpcquickstubs_h___
#define xpcquickstubs_h___
#include "XPCForwards.h"
/* XPCQuickStubs.h - Support functions used only by Web IDL bindings, for now. */
nsresult
xpc_qsUnwrapArgImpl(JSContext *cx, JS::HandleObject src, const nsIID &iid,
void **ppArg);
#endif /* xpcquickstubs_h___ */

View File

@ -106,3 +106,22 @@ XPCStringConvert::ReadableToJSVal(JSContext *cx,
vp.setString(str);
return true;
}
namespace xpc {
bool
NonVoidStringToJsval(JSContext *cx, nsAString &str, MutableHandleValue rval)
{
nsStringBuffer* sharedBuffer;
if (!XPCStringConvert::ReadableToJSVal(cx, str, &sharedBuffer, rval))
return false;
if (sharedBuffer) {
// The string was shared but ReadableToJSVal didn't addref it.
// Move the ownership from str to jsstr.
str.ForgetSharedBuffer();
}
return true;
}
} // namespace xpc

View File

@ -30,7 +30,6 @@ UNIFIED_SOURCES += [
'XPCLog.cpp',
'XPCMaps.cpp',
'XPCModule.cpp',
'XPCQuickStubs.cpp',
'XPCRuntimeService.cpp',
'XPCShellImpl.cpp',
'XPCString.cpp',

View File

@ -20,8 +20,6 @@
#include "WrapperFactory.h"
#include "AccessCheck.h"
#include "XPCQuickStubs.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/Exceptions.h"
#include "mozilla/dom/PromiseBinding.h"

View File

@ -1,16 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set ts=8 sts=4 et sw=4 tw=99: */
/* 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/. */
// Undefines for stupid windows macros
#ifdef GetClassName
#undef GetClassName
#endif
#ifdef CreateEvent
#undef CreateEvent
#endif
#ifdef GetBinaryType
#undef GetBinaryType
#endif

View File

@ -1243,16 +1243,23 @@ XPCWrappedNativeXrayTraits::resolveNativeProperty(JSContext *cx, HandleObject wr
}
static bool
wrappedJSObject_getter(JSContext *cx, HandleObject wrapper, HandleId id, MutableHandleValue vp)
wrappedJSObject_getter(JSContext *cx, unsigned argc, Value *vp)
{
if (!IsWrapper(wrapper) || !WrapperFactory::IsXrayWrapper(wrapper)) {
CallArgs args = CallArgsFromVp(argc, vp);
if (!args.thisv().isObject()) {
JS_ReportError(cx, "This value not an object");
return false;
}
RootedObject wrapper(cx, &args.thisv().toObject());
if (!IsWrapper(wrapper) || !WrapperFactory::IsXrayWrapper(wrapper) ||
!AccessCheck::wrapperSubsumes(wrapper)) {
JS_ReportError(cx, "Unexpected object");
return false;
}
vp.set(OBJECT_TO_JSVAL(wrapper));
args.rval().setObject(*wrapper);
return WrapperFactory::WaiveXrayAndWrap(cx, vp);
return WrapperFactory::WaiveXrayAndWrap(cx, args.rval());
}
bool
@ -1313,8 +1320,10 @@ XrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper,
if (!JS_AlreadyHasOwnPropertyById(cx, holder, id, &found))
return false;
if (!found && !JS_DefinePropertyById(cx, holder, id, UndefinedHandleValue,
JSPROP_ENUMERATE | JSPROP_SHARED,
wrappedJSObject_getter)) {
JSPROP_ENUMERATE | JSPROP_SHARED |
JSPROP_NATIVE_ACCESSORS,
JS_CAST_NATIVE_TO(wrappedJSObject_getter,
JSPropertyOp))) {
return false;
}
if (!JS_GetPropertyDescriptorById(cx, holder, id, desc))

View File

@ -976,9 +976,9 @@ GetStatesForPseudoClass(const nsAString& aStatePseudo)
// An array of the states that are relevant for various pseudoclasses.
// XXXbz this duplicates code in nsCSSRuleProcessor
static const EventStates sPseudoClassStates[] = {
#define CSS_PSEUDO_CLASS(_name, _value, _pref) \
#define CSS_PSEUDO_CLASS(_name, _value, _flags, _pref) \
EventStates(),
#define CSS_STATE_PSEUDO_CLASS(_name, _value, _pref, _states) \
#define CSS_STATE_PSEUDO_CLASS(_name, _value, _flags, _pref, _states) \
_states,
#include "nsCSSPseudoClassList.h"
#undef CSS_STATE_PSEUDO_CLASS

View File

@ -5394,9 +5394,11 @@ CSSParserImpl::ParsePseudoSelector(int32_t& aDataMask,
nsCSSPseudoClasses::IsUserActionPseudoClass(pseudoClassType);
if (!mUnsafeRulesEnabled &&
pseudoElementType < nsCSSPseudoElements::ePseudo_PseudoElementCount &&
nsCSSPseudoElements::PseudoElementIsChromeOnly(pseudoElementType)) {
// This pseudo-element is not exposed to content.
((pseudoElementType < nsCSSPseudoElements::ePseudo_PseudoElementCount &&
nsCSSPseudoElements::PseudoElementIsUASheetOnly(pseudoElementType)) ||
(pseudoClassType != nsCSSPseudoClasses::ePseudoClass_NotPseudoClass &&
nsCSSPseudoClasses::PseudoClassIsUASheetOnly(pseudoClassType)))) {
// This pseudo-element or pseudo-class is not exposed to content.
REPORT_UNEXPECTED_TOKEN(PEPseudoSelUnknown);
UngetToken();
return eSelectorParsingStatus_Error;

View File

@ -12,18 +12,25 @@
* All entries must be enclosed in the macros CSS_PSEUDO_CLASS,
* CSS_STATE_DEPENDENT_PSEUDO_CLASS, or CSS_STATE_PSEUDO_CLASS which
* will have cruel and unusual things done to them. The entries should
* be kept in some sort of logical order. The first argument to
* CSS_PSEUDO_CLASS is the C++ identifier of the atom. The second
* argument is the string value of the atom. The third argument is the
* name of the preference controlling whether the pseudo-class is
* recognized by the parser, or the empty string if it's unconditional.
*
* CSS_STATE_DEPENDENT_PSEUDO_CLASS and CSS_STATE_PSEUDO_CLASS also take
* the name of the state bits that the class corresponds to. Only one
* of the bits needs to match for a CSS_STATE_PSEUDO_CLASS to match;
* CSS_STATE_DEPENDENT_PSEUDO_CLASS matching depends on a customized per-class
* algorithm which should be defined in SelectorMatches() in
* nsCSSRuleProcessor.cpp.
* be kept in some sort of logical order. The common arguments to these
* macros are:
* name_ : The C++ identifier used for the atom (which will be a member
* of nsCSSPseudoClasses)
* value_ : The pseudo-class as a string, including the initial colon,
* used as the string value of the atom.
* flags_ : A bitfield containing flags defined in nsCSSPseudoClasses.h
* pref_ : The name of the preference controlling whether the
* pseudo-class is recognized by the parser, or the empty
* string if it's unconditional.
* CSS_STATE_PSEUDO_CLASS has an additional argument:
* bit_ : The event state bit or bits that corresponds to the
* pseudo-class, i.e., causes it to match (only one bit
* required to match).
* CSS_STATE_DEPENDENT_PSEUDO_CLASS has an additional argument:
* bit_ : The event state bits that affect whether the pseudo-class
* matches. Matching depends on a customized per-class
* algorithm which should be defined in SelectorMatches() in
* nsCSSRuleProcessor.cpp.
*
* If CSS_STATE_PSEUDO_CLASS is not defined, it'll be automatically
* defined to CSS_STATE_DEPENDENT_PSEUDO_CLASS;
@ -39,8 +46,8 @@
#endif
#ifndef CSS_STATE_DEPENDENT_PSEUDO_CLASS
#define CSS_STATE_DEPENDENT_PSEUDO_CLASS(_name, _value, _pref, _bit) \
CSS_PSEUDO_CLASS(_name, _value, _pref)
#define CSS_STATE_DEPENDENT_PSEUDO_CLASS(_name, _value, _flags, _pref, _bit) \
CSS_PSEUDO_CLASS(_name, _value, _flags, _pref)
#define DEFINED_CSS_STATE_DEPENDENT_PSEUDO_CLASS
#endif
@ -49,8 +56,8 @@
#endif
#ifndef CSS_STATE_PSEUDO_CLASS
#define CSS_STATE_PSEUDO_CLASS(_name, _value, _pref, _bit) \
CSS_STATE_DEPENDENT_PSEUDO_CLASS(_name, _value, _pref, _bit)
#define CSS_STATE_PSEUDO_CLASS(_name, _value, _flags, _pref, _bit) \
CSS_STATE_DEPENDENT_PSEUDO_CLASS(_name, _value, _flags, _pref, _bit)
#define DEFINED_CSS_STATE_PSEUDO_CLASS
#endif
@ -59,155 +66,161 @@
// must be the same as the order of cases in SelectorMatches. :not
// must be the last CSS_PSEUDO_CLASS.
CSS_PSEUDO_CLASS(empty, ":empty", "")
CSS_PSEUDO_CLASS(mozOnlyWhitespace, ":-moz-only-whitespace", "")
CSS_PSEUDO_CLASS(mozEmptyExceptChildrenWithLocalname, ":-moz-empty-except-children-with-localname", "")
CSS_PSEUDO_CLASS(lang, ":lang", "")
CSS_PSEUDO_CLASS(mozBoundElement, ":-moz-bound-element", "")
CSS_PSEUDO_CLASS(root, ":root", "")
CSS_PSEUDO_CLASS(any, ":-moz-any", "")
CSS_PSEUDO_CLASS(empty, ":empty", 0, "")
CSS_PSEUDO_CLASS(mozOnlyWhitespace, ":-moz-only-whitespace", 0, "")
CSS_PSEUDO_CLASS(mozEmptyExceptChildrenWithLocalname, ":-moz-empty-except-children-with-localname", 0, "")
CSS_PSEUDO_CLASS(lang, ":lang", 0, "")
CSS_PSEUDO_CLASS(mozBoundElement, ":-moz-bound-element", 0, "")
CSS_PSEUDO_CLASS(root, ":root", 0, "")
CSS_PSEUDO_CLASS(any, ":-moz-any", 0, "")
CSS_PSEUDO_CLASS(firstChild, ":first-child", "")
CSS_PSEUDO_CLASS(firstNode, ":-moz-first-node", "")
CSS_PSEUDO_CLASS(lastChild, ":last-child", "")
CSS_PSEUDO_CLASS(lastNode, ":-moz-last-node", "")
CSS_PSEUDO_CLASS(onlyChild, ":only-child", "")
CSS_PSEUDO_CLASS(firstOfType, ":first-of-type", "")
CSS_PSEUDO_CLASS(lastOfType, ":last-of-type", "")
CSS_PSEUDO_CLASS(onlyOfType, ":only-of-type", "")
CSS_PSEUDO_CLASS(nthChild, ":nth-child", "")
CSS_PSEUDO_CLASS(nthLastChild, ":nth-last-child", "")
CSS_PSEUDO_CLASS(nthOfType, ":nth-of-type", "")
CSS_PSEUDO_CLASS(nthLastOfType, ":nth-last-of-type", "")
CSS_PSEUDO_CLASS(firstChild, ":first-child", 0, "")
CSS_PSEUDO_CLASS(firstNode, ":-moz-first-node", 0, "")
CSS_PSEUDO_CLASS(lastChild, ":last-child", 0, "")
CSS_PSEUDO_CLASS(lastNode, ":-moz-last-node", 0, "")
CSS_PSEUDO_CLASS(onlyChild, ":only-child", 0, "")
CSS_PSEUDO_CLASS(firstOfType, ":first-of-type", 0, "")
CSS_PSEUDO_CLASS(lastOfType, ":last-of-type", 0, "")
CSS_PSEUDO_CLASS(onlyOfType, ":only-of-type", 0, "")
CSS_PSEUDO_CLASS(nthChild, ":nth-child", 0, "")
CSS_PSEUDO_CLASS(nthLastChild, ":nth-last-child", 0, "")
CSS_PSEUDO_CLASS(nthOfType, ":nth-of-type", 0, "")
CSS_PSEUDO_CLASS(nthLastOfType, ":nth-last-of-type", 0, "")
// Match nodes that are HTML but not XHTML
CSS_PSEUDO_CLASS(mozIsHTML, ":-moz-is-html", "")
CSS_PSEUDO_CLASS(mozIsHTML, ":-moz-is-html", 0, "")
// Matches nodes that are in a native-anonymous subtree (i.e., nodes in
// a subtree of C++ anonymous content constructed by Gecko for its own
// purposes).
CSS_PSEUDO_CLASS(mozNativeAnonymous, ":-moz-native-anonymous",
CSS_PSEUDO_CLASS_UA_SHEET_ONLY, "")
// Matches anything when the specified look-and-feel metric is set
CSS_PSEUDO_CLASS(mozSystemMetric, ":-moz-system-metric", "")
CSS_PSEUDO_CLASS(mozSystemMetric, ":-moz-system-metric", 0, "")
// -moz-locale-dir(ltr) and -moz-locale-dir(rtl) may be used
// to match based on the locale's chrome direction
CSS_PSEUDO_CLASS(mozLocaleDir, ":-moz-locale-dir", "")
CSS_PSEUDO_CLASS(mozLocaleDir, ":-moz-locale-dir", 0, "")
// -moz-lwtheme may be used to match a document that has a lightweight theme
CSS_PSEUDO_CLASS(mozLWTheme, ":-moz-lwtheme", "")
CSS_PSEUDO_CLASS(mozLWTheme, ":-moz-lwtheme", 0, "")
// -moz-lwtheme-brighttext matches a document that has a dark lightweight theme
CSS_PSEUDO_CLASS(mozLWThemeBrightText, ":-moz-lwtheme-brighttext", "")
CSS_PSEUDO_CLASS(mozLWThemeBrightText, ":-moz-lwtheme-brighttext", 0, "")
// -moz-lwtheme-darktext matches a document that has a bright lightweight theme
CSS_PSEUDO_CLASS(mozLWThemeDarkText, ":-moz-lwtheme-darktext", "")
CSS_PSEUDO_CLASS(mozLWThemeDarkText, ":-moz-lwtheme-darktext", 0, "")
// Matches anything when the containing window is inactive
CSS_PSEUDO_CLASS(mozWindowInactive, ":-moz-window-inactive", "")
CSS_PSEUDO_CLASS(mozWindowInactive, ":-moz-window-inactive", 0, "")
// Matches any table elements that have a nonzero border attribute,
// according to HTML integer attribute parsing rules.
CSS_PSEUDO_CLASS(mozTableBorderNonzero, ":-moz-table-border-nonzero", "")
CSS_PSEUDO_CLASS(mozTableBorderNonzero, ":-moz-table-border-nonzero", 0, "")
// Matches whatever the contextual reference elements are for the
// matching operation.
CSS_PSEUDO_CLASS(scope, ":scope", "layout.css.scope-pseudo.enabled")
CSS_PSEUDO_CLASS(scope, ":scope", 0, "layout.css.scope-pseudo.enabled")
// :not needs to come at the end of the non-bit pseudo-class list, since
// it doesn't actually get directly matched on in SelectorMatches.
CSS_PSEUDO_CLASS(notPseudo, ":not", "")
CSS_PSEUDO_CLASS(notPseudo, ":not", 0, "")
// :-moz-dir(ltr) and :-moz-dir(rtl) match elements whose resolved
// directionality in the markup language is ltr or rtl respectively
CSS_STATE_DEPENDENT_PSEUDO_CLASS(dir, ":-moz-dir", "",
CSS_STATE_DEPENDENT_PSEUDO_CLASS(dir, ":-moz-dir", 0, "",
NS_EVENT_STATE_LTR | NS_EVENT_STATE_RTL)
CSS_STATE_PSEUDO_CLASS(link, ":link", "", NS_EVENT_STATE_UNVISITED)
CSS_STATE_PSEUDO_CLASS(link, ":link", 0, "", NS_EVENT_STATE_UNVISITED)
// what matches :link or :visited
CSS_STATE_PSEUDO_CLASS(mozAnyLink, ":-moz-any-link", "",
CSS_STATE_PSEUDO_CLASS(mozAnyLink, ":-moz-any-link", 0, "",
NS_EVENT_STATE_VISITED | NS_EVENT_STATE_UNVISITED)
CSS_STATE_PSEUDO_CLASS(visited, ":visited", "", NS_EVENT_STATE_VISITED)
CSS_STATE_PSEUDO_CLASS(visited, ":visited", 0, "", NS_EVENT_STATE_VISITED)
CSS_STATE_PSEUDO_CLASS(active, ":active", "", NS_EVENT_STATE_ACTIVE)
CSS_STATE_PSEUDO_CLASS(checked, ":checked", "", NS_EVENT_STATE_CHECKED)
CSS_STATE_PSEUDO_CLASS(disabled, ":disabled", "", NS_EVENT_STATE_DISABLED)
CSS_STATE_PSEUDO_CLASS(enabled, ":enabled", "", NS_EVENT_STATE_ENABLED)
CSS_STATE_PSEUDO_CLASS(focus, ":focus", "", NS_EVENT_STATE_FOCUS)
CSS_STATE_PSEUDO_CLASS(hover, ":hover", "", NS_EVENT_STATE_HOVER)
CSS_STATE_PSEUDO_CLASS(mozDragOver, ":-moz-drag-over", "", NS_EVENT_STATE_DRAGOVER)
CSS_STATE_PSEUDO_CLASS(target, ":target", "", NS_EVENT_STATE_URLTARGET)
CSS_STATE_PSEUDO_CLASS(indeterminate, ":indeterminate", "",
CSS_STATE_PSEUDO_CLASS(active, ":active", 0, "", NS_EVENT_STATE_ACTIVE)
CSS_STATE_PSEUDO_CLASS(checked, ":checked", 0, "", NS_EVENT_STATE_CHECKED)
CSS_STATE_PSEUDO_CLASS(disabled, ":disabled", 0, "", NS_EVENT_STATE_DISABLED)
CSS_STATE_PSEUDO_CLASS(enabled, ":enabled", 0, "", NS_EVENT_STATE_ENABLED)
CSS_STATE_PSEUDO_CLASS(focus, ":focus", 0, "", NS_EVENT_STATE_FOCUS)
CSS_STATE_PSEUDO_CLASS(hover, ":hover", 0, "", NS_EVENT_STATE_HOVER)
CSS_STATE_PSEUDO_CLASS(mozDragOver, ":-moz-drag-over", 0, "", NS_EVENT_STATE_DRAGOVER)
CSS_STATE_PSEUDO_CLASS(target, ":target", 0, "", NS_EVENT_STATE_URLTARGET)
CSS_STATE_PSEUDO_CLASS(indeterminate, ":indeterminate", 0, "",
NS_EVENT_STATE_INDETERMINATE)
CSS_STATE_PSEUDO_CLASS(mozDevtoolsHighlighted, ":-moz-devtools-highlighted", "",
CSS_STATE_PSEUDO_CLASS(mozDevtoolsHighlighted, ":-moz-devtools-highlighted", 0, "",
NS_EVENT_STATE_DEVTOOLS_HIGHLIGHTED)
// Matches the element which is being displayed full-screen, and
// any containing frames.
CSS_STATE_PSEUDO_CLASS(mozFullScreen, ":-moz-full-screen", "", NS_EVENT_STATE_FULL_SCREEN)
CSS_STATE_PSEUDO_CLASS(mozFullScreen, ":-moz-full-screen", 0, "", NS_EVENT_STATE_FULL_SCREEN)
// Matches any element which is an ancestor of the DOM full-screen element,
// or an ancestor of a containing frame of the full-screen element.
CSS_STATE_PSEUDO_CLASS(mozFullScreenAncestor, ":-moz-full-screen-ancestor", "", NS_EVENT_STATE_FULL_SCREEN_ANCESTOR)
CSS_STATE_PSEUDO_CLASS(mozFullScreenAncestor, ":-moz-full-screen-ancestor", 0, "", NS_EVENT_STATE_FULL_SCREEN_ANCESTOR)
// Matches if the element is focused and should show a focus ring
CSS_STATE_PSEUDO_CLASS(mozFocusRing, ":-moz-focusring", "", NS_EVENT_STATE_FOCUSRING)
CSS_STATE_PSEUDO_CLASS(mozFocusRing, ":-moz-focusring", 0, "", NS_EVENT_STATE_FOCUSRING)
// Image, object, etc state pseudo-classes
CSS_STATE_PSEUDO_CLASS(mozBroken, ":-moz-broken", "", NS_EVENT_STATE_BROKEN)
CSS_STATE_PSEUDO_CLASS(mozUserDisabled, ":-moz-user-disabled", "",
CSS_STATE_PSEUDO_CLASS(mozBroken, ":-moz-broken", 0, "", NS_EVENT_STATE_BROKEN)
CSS_STATE_PSEUDO_CLASS(mozUserDisabled, ":-moz-user-disabled", 0, "",
NS_EVENT_STATE_USERDISABLED)
CSS_STATE_PSEUDO_CLASS(mozSuppressed, ":-moz-suppressed", "",
CSS_STATE_PSEUDO_CLASS(mozSuppressed, ":-moz-suppressed", 0, "",
NS_EVENT_STATE_SUPPRESSED)
CSS_STATE_PSEUDO_CLASS(mozLoading, ":-moz-loading", "", NS_EVENT_STATE_LOADING)
CSS_STATE_PSEUDO_CLASS(mozTypeUnsupported, ":-moz-type-unsupported", "",
CSS_STATE_PSEUDO_CLASS(mozLoading, ":-moz-loading", 0, "", NS_EVENT_STATE_LOADING)
CSS_STATE_PSEUDO_CLASS(mozTypeUnsupported, ":-moz-type-unsupported", 0, "",
NS_EVENT_STATE_TYPE_UNSUPPORTED)
CSS_STATE_PSEUDO_CLASS(mozTypeUnsupportedPlatform, ":-moz-type-unsupported-platform", "",
CSS_STATE_PSEUDO_CLASS(mozTypeUnsupportedPlatform, ":-moz-type-unsupported-platform", 0, "",
NS_EVENT_STATE_TYPE_UNSUPPORTED_PLATFORM)
CSS_STATE_PSEUDO_CLASS(mozHandlerClickToPlay, ":-moz-handler-clicktoplay", "",
CSS_STATE_PSEUDO_CLASS(mozHandlerClickToPlay, ":-moz-handler-clicktoplay", 0, "",
NS_EVENT_STATE_TYPE_CLICK_TO_PLAY)
CSS_STATE_PSEUDO_CLASS(mozHandlerPlayPreview, ":-moz-handler-playpreview", "",
CSS_STATE_PSEUDO_CLASS(mozHandlerPlayPreview, ":-moz-handler-playpreview", 0, "",
NS_EVENT_STATE_TYPE_PLAY_PREVIEW)
CSS_STATE_PSEUDO_CLASS(mozHandlerVulnerableUpdatable, ":-moz-handler-vulnerable-updatable", "",
CSS_STATE_PSEUDO_CLASS(mozHandlerVulnerableUpdatable, ":-moz-handler-vulnerable-updatable", 0, "",
NS_EVENT_STATE_VULNERABLE_UPDATABLE)
CSS_STATE_PSEUDO_CLASS(mozHandlerVulnerableNoUpdate, ":-moz-handler-vulnerable-no-update", "",
CSS_STATE_PSEUDO_CLASS(mozHandlerVulnerableNoUpdate, ":-moz-handler-vulnerable-no-update", 0, "",
NS_EVENT_STATE_VULNERABLE_NO_UPDATE)
CSS_STATE_PSEUDO_CLASS(mozHandlerDisabled, ":-moz-handler-disabled", "",
CSS_STATE_PSEUDO_CLASS(mozHandlerDisabled, ":-moz-handler-disabled", 0, "",
NS_EVENT_STATE_HANDLER_DISABLED)
CSS_STATE_PSEUDO_CLASS(mozHandlerBlocked, ":-moz-handler-blocked", "",
CSS_STATE_PSEUDO_CLASS(mozHandlerBlocked, ":-moz-handler-blocked", 0, "",
NS_EVENT_STATE_HANDLER_BLOCKED)
CSS_STATE_PSEUDO_CLASS(mozHandlerCrashed, ":-moz-handler-crashed", "",
CSS_STATE_PSEUDO_CLASS(mozHandlerCrashed, ":-moz-handler-crashed", 0, "",
NS_EVENT_STATE_HANDLER_CRASHED)
CSS_STATE_PSEUDO_CLASS(mozMathIncrementScriptLevel,
":-moz-math-increment-script-level", "",
":-moz-math-increment-script-level", 0, "",
NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL)
// CSS 3 UI
// http://www.w3.org/TR/2004/CR-css3-ui-20040511/#pseudo-classes
CSS_STATE_PSEUDO_CLASS(required, ":required", "", NS_EVENT_STATE_REQUIRED)
CSS_STATE_PSEUDO_CLASS(optional, ":optional", "", NS_EVENT_STATE_OPTIONAL)
CSS_STATE_PSEUDO_CLASS(valid, ":valid", "", NS_EVENT_STATE_VALID)
CSS_STATE_PSEUDO_CLASS(invalid, ":invalid", "", NS_EVENT_STATE_INVALID)
CSS_STATE_PSEUDO_CLASS(inRange, ":in-range", "", NS_EVENT_STATE_INRANGE)
CSS_STATE_PSEUDO_CLASS(outOfRange, ":out-of-range", "", NS_EVENT_STATE_OUTOFRANGE)
CSS_STATE_PSEUDO_CLASS(defaultPseudo, ":default", "", NS_EVENT_STATE_DEFAULT)
CSS_STATE_PSEUDO_CLASS(mozReadOnly, ":-moz-read-only", "",
CSS_STATE_PSEUDO_CLASS(required, ":required", 0, "", NS_EVENT_STATE_REQUIRED)
CSS_STATE_PSEUDO_CLASS(optional, ":optional", 0, "", NS_EVENT_STATE_OPTIONAL)
CSS_STATE_PSEUDO_CLASS(valid, ":valid", 0, "", NS_EVENT_STATE_VALID)
CSS_STATE_PSEUDO_CLASS(invalid, ":invalid", 0, "", NS_EVENT_STATE_INVALID)
CSS_STATE_PSEUDO_CLASS(inRange, ":in-range", 0, "", NS_EVENT_STATE_INRANGE)
CSS_STATE_PSEUDO_CLASS(outOfRange, ":out-of-range", 0, "", NS_EVENT_STATE_OUTOFRANGE)
CSS_STATE_PSEUDO_CLASS(defaultPseudo, ":default", 0, "", NS_EVENT_STATE_DEFAULT)
CSS_STATE_PSEUDO_CLASS(mozReadOnly, ":-moz-read-only", 0, "",
NS_EVENT_STATE_MOZ_READONLY)
CSS_STATE_PSEUDO_CLASS(mozReadWrite, ":-moz-read-write", "",
CSS_STATE_PSEUDO_CLASS(mozReadWrite, ":-moz-read-write", 0, "",
NS_EVENT_STATE_MOZ_READWRITE)
CSS_STATE_PSEUDO_CLASS(mozSubmitInvalid, ":-moz-submit-invalid", "",
CSS_STATE_PSEUDO_CLASS(mozSubmitInvalid, ":-moz-submit-invalid", 0, "",
NS_EVENT_STATE_MOZ_SUBMITINVALID)
CSS_STATE_PSEUDO_CLASS(mozUIInvalid, ":-moz-ui-invalid", "",
CSS_STATE_PSEUDO_CLASS(mozUIInvalid, ":-moz-ui-invalid", 0, "",
NS_EVENT_STATE_MOZ_UI_INVALID)
CSS_STATE_PSEUDO_CLASS(mozUIValid, ":-moz-ui-valid", "",
CSS_STATE_PSEUDO_CLASS(mozUIValid, ":-moz-ui-valid", 0, "",
NS_EVENT_STATE_MOZ_UI_VALID)
CSS_STATE_PSEUDO_CLASS(mozMeterOptimum, ":-moz-meter-optimum", "",
CSS_STATE_PSEUDO_CLASS(mozMeterOptimum, ":-moz-meter-optimum", 0, "",
NS_EVENT_STATE_OPTIMUM)
CSS_STATE_PSEUDO_CLASS(mozMeterSubOptimum, ":-moz-meter-sub-optimum", "",
CSS_STATE_PSEUDO_CLASS(mozMeterSubOptimum, ":-moz-meter-sub-optimum", 0, "",
NS_EVENT_STATE_SUB_OPTIMUM)
CSS_STATE_PSEUDO_CLASS(mozMeterSubSubOptimum, ":-moz-meter-sub-sub-optimum", "",
CSS_STATE_PSEUDO_CLASS(mozMeterSubSubOptimum, ":-moz-meter-sub-sub-optimum", 0, "",
NS_EVENT_STATE_SUB_SUB_OPTIMUM)
// Those values should be parsed but do nothing.
CSS_STATE_PSEUDO_CLASS(mozPlaceholder, ":-moz-placeholder", "", NS_EVENT_STATE_IGNORE)
CSS_STATE_PSEUDO_CLASS(mozPlaceholder, ":-moz-placeholder", 0, "", NS_EVENT_STATE_IGNORE)
#ifdef DEFINED_CSS_STATE_PSEUDO_CLASS
#undef DEFINED_CSS_STATE_PSEUDO_CLASS

View File

@ -15,25 +15,36 @@
using namespace mozilla;
// define storage for all atoms
#define CSS_PSEUDO_CLASS(_name, _value, _pref) \
#define CSS_PSEUDO_CLASS(_name, _value, _flags, _pref) \
static nsIAtom* sPseudoClass_##_name;
#include "nsCSSPseudoClassList.h"
#undef CSS_PSEUDO_CLASS
#define CSS_PSEUDO_CLASS(name_, value_, pref_) \
#define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
NS_STATIC_ATOM_BUFFER(name_##_pseudo_class_buffer, value_)
#include "nsCSSPseudoClassList.h"
#undef CSS_PSEUDO_CLASS
// Array of nsStaticAtom for each of the pseudo-classes.
static const nsStaticAtom CSSPseudoClasses_info[] = {
#define CSS_PSEUDO_CLASS(name_, value_, pref_) \
#define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
NS_STATIC_ATOM(name_##_pseudo_class_buffer, &sPseudoClass_##name_),
#include "nsCSSPseudoClassList.h"
#undef CSS_PSEUDO_CLASS
};
// Flags data for each of the pseudo-classes, which must be separate
// from the previous array since there's no place for it in
// nsStaticAtom.
static const uint32_t CSSPseudoClasses_flags[] = {
#define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
flags_,
#include "nsCSSPseudoClassList.h"
#undef CSS_PSEUDO_CLASS
};
static bool sPseudoClassEnabled[] = {
#define CSS_PSEUDO_CLASS(name_, value_, pref_) \
#define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
true,
#include "nsCSSPseudoClassList.h"
#undef CSS_PSEUDO_CLASS
@ -43,7 +54,7 @@ void nsCSSPseudoClasses::AddRefAtoms()
{
NS_RegisterStaticAtoms(CSSPseudoClasses_info);
#define CSS_PSEUDO_CLASS(name_, value_, pref_) \
#define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
if (pref_[0]) { \
Preferences::AddBoolVarCache(&sPseudoClassEnabled[ePseudoClass_##name_], \
pref_); \
@ -99,3 +110,13 @@ nsCSSPseudoClasses::IsUserActionPseudoClass(Type aType)
aType == ePseudoClass_active ||
aType == ePseudoClass_focus;
}
/* static */ uint32_t
nsCSSPseudoClasses::FlagsForPseudoClass(const Type aType)
{
size_t index = static_cast<size_t>(aType);
NS_ASSERTION(index < ArrayLength(CSSPseudoClasses_flags),
"argument must be a pseudo-class");
return CSSPseudoClasses_flags[index];
}

View File

@ -10,6 +10,9 @@
#include "nsStringFwd.h"
// This pseudo-element is accepted only in UA style sheets.
#define CSS_PSEUDO_CLASS_UA_SHEET_ONLY (1<<0)
class nsIAtom;
class nsCSSPseudoClasses {
@ -18,7 +21,7 @@ public:
static void AddRefAtoms();
enum Type {
#define CSS_PSEUDO_CLASS(_name, _value, _pref) \
#define CSS_PSEUDO_CLASS(_name, _value, _flags, _pref) \
ePseudoClass_##_name,
#include "nsCSSPseudoClassList.h"
#undef CSS_PSEUDO_CLASS
@ -35,8 +38,21 @@ public:
}
static bool IsUserActionPseudoClass(Type aType);
static bool PseudoClassIsUASheetOnly(Type aType) {
return PseudoClassHasFlags(aType, CSS_PSEUDO_CLASS_UA_SHEET_ONLY);
}
// Should only be used on types other than Count and NotPseudoClass
static void PseudoTypeToString(Type aType, nsAString& aString);
private:
static uint32_t FlagsForPseudoClass(const Type aType);
// Does the given pseudo-class have all of the flags given?
static bool PseudoClassHasFlags(const Type aType, uint32_t aFlags)
{
return (FlagsForPseudoClass(aType) & aFlags) == aFlags;
}
};
#endif /* nsCSSPseudoClasses_h___ */

View File

@ -53,19 +53,19 @@ CSS_PSEUDO_ELEMENT(mozMathAnonymous, ":-moz-math-anonymous", 0)
// HTML5 Forms pseudo elements
CSS_PSEUDO_ELEMENT(mozNumberWrapper, ":-moz-number-wrapper",
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE |
CSS_PSEUDO_ELEMENT_IS_CHROME_ONLY)
CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY)
CSS_PSEUDO_ELEMENT(mozNumberText, ":-moz-number-text",
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE |
CSS_PSEUDO_ELEMENT_IS_CHROME_ONLY)
CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY)
CSS_PSEUDO_ELEMENT(mozNumberSpinBox, ":-moz-number-spin-box",
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE |
CSS_PSEUDO_ELEMENT_IS_CHROME_ONLY)
CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY)
CSS_PSEUDO_ELEMENT(mozNumberSpinUp, ":-moz-number-spin-up",
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE |
CSS_PSEUDO_ELEMENT_IS_CHROME_ONLY)
CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY)
CSS_PSEUDO_ELEMENT(mozNumberSpinDown, ":-moz-number-spin-down",
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE |
CSS_PSEUDO_ELEMENT_IS_CHROME_ONLY)
CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY)
CSS_PSEUDO_ELEMENT(mozProgressBar, ":-moz-progress-bar",
CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE)
CSS_PSEUDO_ELEMENT(mozRangeTrack, ":-moz-range-track",

View File

@ -25,6 +25,7 @@ using namespace mozilla;
#include "nsCSSPseudoElementList.h"
#undef CSS_PSEUDO_ELEMENT
// Array of nsStaticAtom for each of the pseudo-elements.
static const nsStaticAtom CSSPseudoElements_info[] = {
#define CSS_PSEUDO_ELEMENT(name_, value_, flags_) \
NS_STATIC_ATOM(name_##_pseudo_element_buffer, (nsIAtom**)&nsCSSPseudoElements::name_),
@ -32,11 +33,9 @@ static const nsStaticAtom CSSPseudoElements_info[] = {
#undef CSS_PSEUDO_ELEMENT
};
// Separate from the array above so that we can have an array of
// nsStaticAtom (to pass to NS_RegisterStaticAtoms and
// nsAtomListUtils::IsMember), but with corresponding indices (so the
// i-th element of this array is the flags for the i-th pseudo-element
// in the previous array).
// Flags data for each of the pseudo-elements, which must be separate
// from the previous array since there's no place for it in
// nsStaticAtom.
static const uint32_t CSSPseudoElements_flags[] = {
#define CSS_PSEUDO_ELEMENT(name_, value_, flags_) \
flags_,

View File

@ -33,7 +33,7 @@
// http://dev.w3.org/csswg/selectors4/#pseudo-elements.
#define CSS_PSEUDO_ELEMENT_SUPPORTS_USER_ACTION_STATE (1<<3)
// Is content prevented from parsing selectors containing this pseudo-element?
#define CSS_PSEUDO_ELEMENT_IS_CHROME_ONLY (1<<4)
#define CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY (1<<4)
// Empty class derived from nsIAtom so that function signatures can
// require an atom from this atom list.
@ -85,9 +85,9 @@ public:
static bool PseudoElementSupportsUserActionState(const Type aType);
static bool PseudoElementIsChromeOnly(const Type aType) {
static bool PseudoElementIsUASheetOnly(const Type aType) {
MOZ_ASSERT(aType < ePseudo_PseudoElementCount);
return PseudoElementHasFlags(aType, CSS_PSEUDO_ELEMENT_IS_CHROME_ONLY);
return PseudoElementHasFlags(aType, CSS_PSEUDO_ELEMENT_UA_SHEET_ONLY);
}
private:

View File

@ -1630,9 +1630,9 @@ checkGenericEmptyMatches(Element* aElement,
// Arrays of the states that are relevant for various pseudoclasses.
static const EventStates sPseudoClassStateDependences[] = {
#define CSS_PSEUDO_CLASS(_name, _value, _pref) \
#define CSS_PSEUDO_CLASS(_name, _value, _flags, _pref) \
EventStates(),
#define CSS_STATE_DEPENDENT_PSEUDO_CLASS(_name, _value, _pref, _states) \
#define CSS_STATE_DEPENDENT_PSEUDO_CLASS(_name, _value, _flags, _pref, _states) \
_states,
#include "nsCSSPseudoClassList.h"
#undef CSS_STATE_DEPENDENT_PSEUDO_CLASS
@ -1644,9 +1644,9 @@ static const EventStates sPseudoClassStateDependences[] = {
};
static const EventStates sPseudoClassStates[] = {
#define CSS_PSEUDO_CLASS(_name, _value, _pref) \
#define CSS_PSEUDO_CLASS(_name, _value, _flags, _pref) \
EventStates(),
#define CSS_STATE_PSEUDO_CLASS(_name, _value, _pref, _states) \
#define CSS_STATE_PSEUDO_CLASS(_name, _value, _flags, _pref, _states) \
_states,
#include "nsCSSPseudoClassList.h"
#undef CSS_STATE_PSEUDO_CLASS
@ -2085,6 +2085,12 @@ static bool SelectorMatches(Element* aElement,
}
break;
case nsCSSPseudoClasses::ePseudoClass_mozNativeAnonymous:
if (!aElement->IsInNativeAnonymousSubtree()) {
return false;
}
break;
case nsCSSPseudoClasses::ePseudoClass_mozSystemMetric:
{
nsCOMPtr<nsIAtom> metric = do_GetAtom(pseudoClass->u.mString);

View File

@ -1019,6 +1019,9 @@ function run() {
test_parseable(":-moz-handler-blocked");
test_parseable(":-moz-handler-crashed");
// We're not in a UA sheet, so this should be invalid.
test_balanced_unparseable(":-moz-native-anonymous");
// Case sensitivity of tag selectors
function setup_cased_spans(body) {
var data = [

View File

@ -208,7 +208,9 @@ nsJARProtocolHandler::NewURI(const nsACString &aSpec,
}
NS_IMETHODIMP
nsJARProtocolHandler::NewChannel(nsIURI *uri, nsIChannel **result)
nsJARProtocolHandler::NewChannel2(nsIURI* uri,
nsILoadInfo* aLoadInfo,
nsIChannel** result)
{
nsJARChannel *chan = new nsJARChannel();
if (!chan)
@ -225,6 +227,12 @@ nsJARProtocolHandler::NewChannel(nsIURI *uri, nsIChannel **result)
return NS_OK;
}
NS_IMETHODIMP
nsJARProtocolHandler::NewChannel(nsIURI *uri, nsIChannel **result)
{
return NewChannel2(uri, nullptr, result);
}
NS_IMETHODIMP
nsJARProtocolHandler::AllowPort(int32_t port, const char *scheme, bool *_retval)

View File

@ -9,6 +9,8 @@ interface nsIProtocolHandler;
interface nsIChannel;
interface nsIURI;
interface nsIFile;
interface nsIDOMNode;
interface nsIPrincipal;
/**
* nsIIOService provides a set of network utility functions. This interface
@ -19,7 +21,7 @@ interface nsIFile;
* as a convenience to the programmer and in some cases to improve performance
* by eliminating intermediate data structures and interfaces.
*/
[scriptable, uuid(2d19475d-7557-43f7-9682-0c44417b6c0f)]
[scriptable, uuid(d8555f58-203a-465a-a33e-442ae4c6c4cf)]
interface nsIIOService : nsISupports
{
/**
@ -62,6 +64,19 @@ interface nsIIOService : nsISupports
*/
nsIURI newFileURI(in nsIFile aFile);
/**
* Creates a channel for a given URI.
*
* @param aURI nsIURI from which to make a channel
* @return reference to the new nsIChannel object
*/
nsIChannel newChannelFromURI2(in nsIURI aURI,
in nsIDOMNode aLoadingNode,
in nsIPrincipal aLoadingPrincipal,
in nsIPrincipal aTriggeringPrincipal,
in unsigned long aSecurityFlags,
in unsigned long aContentPolicyType);
/**
* Creates a channel for a given URI.
*
@ -70,6 +85,18 @@ interface nsIIOService : nsISupports
*/
nsIChannel newChannelFromURI(in nsIURI aURI);
/**
* Equivalent to newChannelFromURI(newURI(...))
*/
nsIChannel newChannel2(in AUTF8String aSpec,
in string aOriginCharset,
in nsIURI aBaseURI,
in nsIDOMNode aLoadingNode,
in nsIPrincipal aLoadingPrincipal,
in nsIPrincipal aTriggeringPrincipal,
in unsigned long aSecurityFlags,
in unsigned long aContentPolicyType);
/**
* Equivalent to newChannelFromURI(newURI(...))
*/

Some files were not shown because too many files have changed in this diff Show More