Merge m-c to fx-team.
Merge m-c to fx-team.
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -7,17 +7,17 @@
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
<remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
<default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
<!-- Gonk specific things and forks -->
<project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
<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="258ae6472bd0e87ae074a6b9b464273dc9cfc8d6"/>
+ <project name="gaia.git" path="gaia" remote="mozillaorg" revision="ac06cfbd2baf6494ffbb668cc599e3892cd5e17b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="78b908b493bfe0b477e3d4f6edec8c46a2c0d096"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="eda08beb3ba9a159843c70ffde0f9660ec351eb9"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="87aa8679560ce09f6445621d6f370d9de722cdba"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a314508e397c8f1814228d36259ea8708034444e"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
@@ -86,16 +86,16 @@
<project name="platform/system/bluetooth" path="system/bluetooth" revision="507e46e553586bec971551322f20d066c80a0788"/>
<project name="platform/system/core" path="system/core" revision="91e5551f88aea5aa64e1b4f8b4b52d7be2b28b64"/>
<project name="platform/system/extras" path="system/extras" revision="0205c49fedf29620165c6b4e6db3d13739c93396"/>
<project name="platform/system/media" path="system/media" revision="7f17e3995d1588cfcc309b56525652794b6513ef"/>
<project name="platform/system/netd" path="system/netd" revision="3d298fde142bee3fc4f07f63f16f2d8ce42339c0"/>
<project name="platform/system/vold" path="system/vold" revision="919829940468066a32f403980b43f6ebfee5d314"/>
<!-- Emulator specific things -->
<project name="android-development" path="development" remote="b2g" revision="4e236e65a5d652a66ac32590f69f2123d17cb4ad"/>
- <project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="5be0a9c4b3c6c004786917fdb5bee248960d045b"/>
+ <project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="e7e8734fdd8bf41e48a56c1c85e0f7dac60aaa9f"/>
<project name="platform/external/iproute2" path="external/iproute2" revision="c66c5716d5335e450f7a7b71ccc6a604fb2f41d2"/>
<project 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="d2685281e2e54ca14d1df304867aa82c37b27162"/>
<project 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="627f9b20fc518937b93747a7ff1ed4f5ed46e06f"/>
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="c16df012d9649be75d6590f93aeacbdc24b29d53"/>
<project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="11663426672fcc46e2a0f29239afa736b90635ba"/>
<project name="android-sdk" path="sdk" remote="b2g" revision="5701d3cb45c2e848cc57003cda2e1141288ecae4"/>
</manifest>
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -6,17 +6,17 @@
<remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
<!-- B2G specific things. -->
<project name="platform_build" path="build" remote="b2g" revision="97a5b461686757dbb8ecab2aac5903e41d2e1afe">
<copyfile dest="Makefile" src="core/root.mk"/>
</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="258ae6472bd0e87ae074a6b9b464273dc9cfc8d6"/>
+ <project name="gaia" path="gaia" remote="mozillaorg" revision="ac06cfbd2baf6494ffbb668cc599e3892cd5e17b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="78b908b493bfe0b477e3d4f6edec8c46a2c0d096"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a314508e397c8f1814228d36259ea8708034444e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="905bfa3548eb75cf1792d0d8412b92113bbd4318"/>
<project name="vex" path="external/VEX" remote="b2g" revision="c3d7efc45414f1b44cd9c479bb2758c91c4707c0"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="5c45f43419d5582949284eee9cef0c43d866e03b"/>
<project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="3748b4168e7bd8d46457d4b6786003bc6a5223ce"/>
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -7,17 +7,17 @@
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
<remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
<default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
<!-- Gonk specific things and forks -->
<project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
<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="258ae6472bd0e87ae074a6b9b464273dc9cfc8d6"/>
+ <project name="gaia.git" path="gaia" remote="mozillaorg" revision="ac06cfbd2baf6494ffbb668cc599e3892cd5e17b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="78b908b493bfe0b477e3d4f6edec8c46a2c0d096"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="eda08beb3ba9a159843c70ffde0f9660ec351eb9"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="87aa8679560ce09f6445621d6f370d9de722cdba"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a314508e397c8f1814228d36259ea8708034444e"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
@@ -86,16 +86,16 @@
<project name="platform/system/bluetooth" path="system/bluetooth" revision="507e46e553586bec971551322f20d066c80a0788"/>
<project name="platform/system/core" path="system/core" revision="91e5551f88aea5aa64e1b4f8b4b52d7be2b28b64"/>
<project name="platform/system/extras" path="system/extras" revision="0205c49fedf29620165c6b4e6db3d13739c93396"/>
<project name="platform/system/media" path="system/media" revision="7f17e3995d1588cfcc309b56525652794b6513ef"/>
<project name="platform/system/netd" path="system/netd" revision="3d298fde142bee3fc4f07f63f16f2d8ce42339c0"/>
<project name="platform/system/vold" path="system/vold" revision="919829940468066a32f403980b43f6ebfee5d314"/>
<!-- Emulator specific things -->
<project name="android-development" path="development" remote="b2g" revision="4e236e65a5d652a66ac32590f69f2123d17cb4ad"/>
- <project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="5be0a9c4b3c6c004786917fdb5bee248960d045b"/>
+ <project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="e7e8734fdd8bf41e48a56c1c85e0f7dac60aaa9f"/>
<project name="platform/external/iproute2" path="external/iproute2" revision="c66c5716d5335e450f7a7b71ccc6a604fb2f41d2"/>
<project 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="d2685281e2e54ca14d1df304867aa82c37b27162"/>
<project 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="627f9b20fc518937b93747a7ff1ed4f5ed46e06f"/>
<project name="platform/prebuilts/tools" path="prebuilts/tools" revision="c16df012d9649be75d6590f93aeacbdc24b29d53"/>
<project name="platform_prebuilts_qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="11663426672fcc46e2a0f29239afa736b90635ba"/>
<project name="android-sdk" path="sdk" remote="b2g" revision="5701d3cb45c2e848cc57003cda2e1141288ecae4"/>
</manifest>
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,4 +1,4 @@
{
- "revision": "8d15cd3ac0d07cde9ff36ce611ae47e6ef30d9b0",
+ "revision": "a8b221aeef715c5d8159faa5b31f3ee15e5c3c5a",
"repo_path": "/integration/gaia-central"
}
--- a/b2g/config/hamachi/sources.xml
+++ b/b2g/config/hamachi/sources.xml
@@ -6,17 +6,17 @@
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
<remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
<default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
<!-- Gonk specific things and forks -->
<project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
<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="258ae6472bd0e87ae074a6b9b464273dc9cfc8d6"/>
+ <project name="gaia.git" path="gaia" remote="mozillaorg" revision="ac06cfbd2baf6494ffbb668cc599e3892cd5e17b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="78b908b493bfe0b477e3d4f6edec8c46a2c0d096"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a314508e397c8f1814228d36259ea8708034444e"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
<project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
--- a/b2g/config/helix/sources.xml
+++ b/b2g/config/helix/sources.xml
@@ -5,17 +5,17 @@
<remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
<default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
<!-- Gonk specific things and forks -->
<project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
<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="258ae6472bd0e87ae074a6b9b464273dc9cfc8d6"/>
+ <project name="gaia.git" path="gaia" remote="mozillaorg" revision="ac06cfbd2baf6494ffbb668cc599e3892cd5e17b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="78b908b493bfe0b477e3d4f6edec8c46a2c0d096"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
<project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
--- a/b2g/config/inari/sources.xml
+++ b/b2g/config/inari/sources.xml
@@ -7,17 +7,17 @@
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
<remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
<default remote="caf" revision="ics_chocolate_rb4.2" sync-j="4"/>
<!-- Gonk specific things and forks -->
<project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
<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="258ae6472bd0e87ae074a6b9b464273dc9cfc8d6"/>
+ <project name="gaia.git" path="gaia" remote="mozillaorg" revision="ac06cfbd2baf6494ffbb668cc599e3892cd5e17b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="78b908b493bfe0b477e3d4f6edec8c46a2c0d096"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a314508e397c8f1814228d36259ea8708034444e"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
<project name="platform/bionic" path="bionic" revision="cd5dfce80bc3f0139a56b58aca633202ccaee7f8"/>
--- a/b2g/config/leo/sources.xml
+++ b/b2g/config/leo/sources.xml
@@ -6,17 +6,17 @@
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
<remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
<default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
<!-- Gonk specific things and forks -->
<project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
<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="258ae6472bd0e87ae074a6b9b464273dc9cfc8d6"/>
+ <project name="gaia.git" path="gaia" remote="mozillaorg" revision="ac06cfbd2baf6494ffbb668cc599e3892cd5e17b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="78b908b493bfe0b477e3d4f6edec8c46a2c0d096"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a314508e397c8f1814228d36259ea8708034444e"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
--- a/b2g/config/mako/sources.xml
+++ b/b2g/config/mako/sources.xml
@@ -6,17 +6,17 @@
<remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
<!-- B2G specific things. -->
<project name="platform_build" path="build" remote="b2g" revision="97a5b461686757dbb8ecab2aac5903e41d2e1afe">
<copyfile dest="Makefile" src="core/root.mk"/>
</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="258ae6472bd0e87ae074a6b9b464273dc9cfc8d6"/>
+ <project name="gaia" path="gaia" remote="mozillaorg" revision="ac06cfbd2baf6494ffbb668cc599e3892cd5e17b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="78b908b493bfe0b477e3d4f6edec8c46a2c0d096"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a314508e397c8f1814228d36259ea8708034444e"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="905bfa3548eb75cf1792d0d8412b92113bbd4318"/>
<project name="vex" path="external/VEX" remote="b2g" revision="c3d7efc45414f1b44cd9c479bb2758c91c4707c0"/>
<!-- Stock Android things -->
<project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="5c45f43419d5582949284eee9cef0c43d866e03b"/>
<project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="3748b4168e7bd8d46457d4b6786003bc6a5223ce"/>
--- a/b2g/config/wasabi/sources.xml
+++ b/b2g/config/wasabi/sources.xml
@@ -6,17 +6,17 @@
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
<remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
<default remote="caf" revision="ics_chocolate_rb4.2" sync-j="4"/>
<!-- Gonk specific things and forks -->
<project name="platform_build" path="build" remote="b2g" revision="59605a7c026ff06cc1613af3938579b1dddc6cfe">
<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="258ae6472bd0e87ae074a6b9b464273dc9cfc8d6"/>
+ <project name="gaia.git" path="gaia" remote="mozillaorg" revision="ac06cfbd2baf6494ffbb668cc599e3892cd5e17b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="78b908b493bfe0b477e3d4f6edec8c46a2c0d096"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="84f2f2fce22605e17d511ff1767e54770067b5b5"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="3d5c964015967ca8c86abe6dbbebee3cb82b1609"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a314508e397c8f1814228d36259ea8708034444e"/>
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
<!-- Stock Android things -->
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -242,17 +242,17 @@ var gPrivacyPane = {
{
let mode = document.getElementById("historyMode");
let autoStart = document.getElementById("privateBrowsingAutoStart");
this._lastMode = mode.selectedIndex;
this._lastCheckState = autoStart.hasAttribute('checked');
},
_lastMode: null,
- _lasCheckState: null,
+ _lastCheckState: null,
updateAutostart: function PPP_updateAutostart() {
let mode = document.getElementById("historyMode");
let autoStart = document.getElementById("privateBrowsingAutoStart");
let pref = document.getElementById("browser.privatebrowsing.autostart");
if ((mode.value == "custom" && this._lastCheckState == autoStart.checked) ||
(mode.value == "remember" && !this._lastCheckState) ||
(mode.value == "dontremember" && this._lastCheckState)) {
// These are all no-op changes, so we don't need to prompt.
@@ -294,16 +294,17 @@ var gPrivacyPane = {
this._shouldPromptForRestart = false;
if (this._lastCheckState) {
autoStart.checked = "checked";
} else {
autoStart.removeAttribute('checked');
}
+ pref.value = autoStart.hasAttribute('checked');
mode.selectedIndex = this._lastMode;
mode.doCommand();
this._shouldPromptForRestart = true;
},
// HISTORY
--- a/browser/components/preferences/privacy.js
+++ b/browser/components/preferences/privacy.js
@@ -244,17 +244,17 @@ var gPrivacyPane = {
{
let mode = document.getElementById("historyMode");
let autoStart = document.getElementById("privateBrowsingAutoStart");
this._lastMode = mode.selectedIndex;
this._lastCheckState = autoStart.hasAttribute('checked');
},
_lastMode: null,
- _lasCheckState: null,
+ _lastCheckState: null,
updateAutostart: function PPP_updateAutostart() {
let mode = document.getElementById("historyMode");
let autoStart = document.getElementById("privateBrowsingAutoStart");
let pref = document.getElementById("browser.privatebrowsing.autostart");
if ((mode.value == "custom" && this._lastCheckState == autoStart.checked) ||
(mode.value == "remember" && !this._lastCheckState) ||
(mode.value == "dontremember" && this._lastCheckState)) {
// These are all no-op changes, so we don't need to prompt.
@@ -296,16 +296,17 @@ var gPrivacyPane = {
this._shouldPromptForRestart = false;
if (this._lastCheckState) {
autoStart.checked = "checked";
} else {
autoStart.removeAttribute('checked');
}
+ pref.value = autoStart.hasAttribute('checked');
mode.selectedIndex = this._lastMode;
mode.doCommand();
this._shouldPromptForRestart = true;
},
// HISTORY
--- a/browser/devtools/profiler/test/browser.ini
+++ b/browser/devtools/profiler/test/browser.ini
@@ -1,9 +1,11 @@
[DEFAULT]
+# Crashes/timeouts on all platforms (bug 973974)
+skip-if = true
support-files =
head.js
mock_console_api.html
mock_profiler_bug_834878_page.html
mock_profiler_bug_834878_script.js
[browser_profiler_bug_834878_source_buttons.js]
[browser_profiler_bug_855244_multiple_tabs.js]
--- a/browser/modules/webrtcUI.jsm
+++ b/browser/modules/webrtcUI.jsm
@@ -61,41 +61,42 @@ function getBrowserForWindow(aContentWin
return aContentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler;
}
function handleRequest(aSubject, aTopic, aData) {
let constraints = aSubject.getConstraints();
+ let contentWindow = Services.wm.getOuterWindowWithId(aSubject.windowID);
- Services.wm.getMostRecentWindow(null).navigator.mozGetUserMediaDevices(
+ contentWindow.navigator.mozGetUserMediaDevices(
constraints,
function (devices) {
- prompt(aSubject.windowID, aSubject.callID, constraints.audio,
+ prompt(contentWindow, aSubject.callID, constraints.audio,
constraints.video || constraints.picture, devices);
},
function (error) {
// bug 827146 -- In the future, the UI should catch NO_DEVICES_FOUND
// and allow the user to plug in a device, instead of immediately failing.
denyRequest(aSubject.callID, error);
- }
- );
+ },
+ aSubject.innerWindowID);
}
function denyRequest(aCallID, aError) {
let msg = null;
if (aError) {
msg = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
msg.data = aError;
}
Services.obs.notifyObservers(msg, "getUserMedia:response:deny", aCallID);
}
-function prompt(aWindowID, aCallID, aAudioRequested, aVideoRequested, aDevices) {
+function prompt(aContentWindow, aCallID, aAudioRequested, aVideoRequested, aDevices) {
let audioDevices = [];
let videoDevices = [];
for (let device of aDevices) {
device = device.QueryInterface(Ci.nsIMediaDevice);
switch (device.type) {
case "audio":
if (aAudioRequested)
audioDevices.push(device);
@@ -114,19 +115,18 @@ function prompt(aWindowID, aCallID, aAud
requestType = "Microphone";
else if (videoDevices.length)
requestType = "Camera";
else {
denyRequest(aCallID, "NO_DEVICES_FOUND");
return;
}
- let contentWindow = Services.wm.getOuterWindowWithId(aWindowID);
- let host = contentWindow.document.documentURIObject.host;
- let browser = getBrowserForWindow(contentWindow);
+ let host = aContentWindow.document.documentURIObject.host;
+ let browser = getBrowserForWindow(aContentWindow);
let chromeDoc = browser.ownerDocument;
let chromeWin = chromeDoc.defaultView;
let stringBundle = chromeWin.gNavigatorBundle;
let message = stringBundle.getFormattedString("getUserMedia.share" + requestType + ".message",
[ host ]);
let mainAction = {
label: PluralForm.get(requestType == "CameraAndMicrophone" ? 2 : 1,
--- a/build/autoconf/icu.m4
+++ b/build/autoconf/icu.m4
@@ -144,16 +144,18 @@ if test -z "$BUILDING_JS" -o -n "$JS_STA
ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_USING_ICU_NAMESPACE=0"
# don't include obsolete header files
ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1"
# remove chunks of the library that we don't need (yet)
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_LEGACY_CONVERSION"
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_TRANSLITERATION"
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_REGULAR_EXPRESSIONS"
ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_BREAK_ITERATION"
+ # make sure to not accidentally pick up system-icu headers
+ ICU_CPPFLAGS="$ICU_CPPFLAGS -I$icudir/common -I$icudir/i18n"
ICU_CROSS_BUILD_OPT=""
ICU_SRCDIR=""
if test "$HOST_OS_ARCH" = "WINNT"; then
ICU_SRCDIR="--srcdir=$(cd $srcdir/intl/icu/source; pwd -W)"
fi
if test "$CROSS_COMPILE"; then
--- a/build/mach_bootstrap.py
+++ b/build/mach_bootstrap.py
@@ -50,16 +50,17 @@ SEARCH_PATHS = [
'testing/mozbase/mozlog',
'testing/mozbase/moznetwork',
'testing/mozbase/mozprocess',
'testing/mozbase/mozprofile',
'testing/mozbase/mozrunner',
'testing/mozbase/mozsystemmonitor',
'testing/mozbase/mozinfo',
'testing/mozbase/moztest',
+ 'testing/mozbase/mozversion',
'testing/mozbase/manifestdestiny',
'xpcom/idl-parser',
]
# Individual files providing mach commands.
MACH_MODULES = [
'addon-sdk/mach_commands.py',
'build/valgrind/mach_commands.py',
--- a/content/base/src/nsDocumentEncoder.cpp
+++ b/content/base/src/nsDocumentEncoder.cpp
@@ -554,16 +554,22 @@ ConvertAndWrite(const nsAString& aString
const char16_t* unicodeBuf = flat.get();
int32_t unicodeLength = aString.Length();
int32_t startLength = unicodeLength;
rv = aEncoder->GetMaxLength(unicodeBuf, unicodeLength, &charLength);
startCharLength = charLength;
NS_ENSURE_SUCCESS(rv, rv);
+ if (!charLength) {
+ // Nothing to write. Besides, a length 0 string has an immutable buffer, so
+ // attempts to null-terminate it will crash.
+ return NS_OK;
+ }
+
nsAutoCString charXferString;
if (!charXferString.SetLength(charLength, fallible_t()))
return NS_ERROR_OUT_OF_MEMORY;
char* charXferBuf = charXferString.BeginWriting();
nsresult convert_rv = NS_OK;
do {
rename from content/base/test/file_bug548193.sjs
rename to content/base/test/csp/file_csp_report.sjs
--- a/content/base/test/file_bug548193.sjs
+++ b/content/base/test/csp/file_csp_report.sjs
@@ -1,9 +1,10 @@
// SJS file for CSP violation report test
+// https://bugzilla.mozilla.org/show_bug.cgi?id=548193
function handleRequest(request, response)
{
var query = {};
request.queryString.split('&').forEach(function (val) {
var [name, value] = val.split('=');
query[name] = unescape(value);
});
rename from content/base/test/file_bug717511.html
rename to content/base/test/csp/file_multi_policy_injection_bypass.html
--- a/content/base/test/file_bug717511.html
+++ b/content/base/test/csp/file_multi_policy_injection_bypass.html
@@ -1,9 +1,12 @@
<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=717511
+-->
<body>
<!-- these should be stopped by CSP after fixing bug 717511. :) -->
<img src="http://example.org/tests/content/base/test/file_CSP.sjs?testid=img_bad&type=img/png"> </img>
<script src='http://example.org/tests/content/base/test/file_CSP.sjs?testid=script_bad&type=text/javascript'></script>
<!-- these should load ok after fixing bug 717511. :) -->
<img src="file_CSP.sjs?testid=img_good&type=img/png" />
<script src='file_CSP.sjs?testid=script_good&type=text/javascript'></script>
rename from content/base/test/file_bug717511.html^headers^
rename to content/base/test/csp/file_multi_policy_injection_bypass.html^headers^
rename from content/base/test/file_bug717511_2.html
rename to content/base/test/csp/file_multi_policy_injection_bypass_2.html
--- a/content/base/test/file_bug717511_2.html
+++ b/content/base/test/csp/file_multi_policy_injection_bypass_2.html
@@ -1,9 +1,12 @@
<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=717511
+-->
<body>
<!-- these should be stopped by CSP after fixing bug 717511. :) -->
<img src="http://example.org/tests/content/base/test/file_CSP.sjs?testid=img2_bad&type=img/png"> </img>
<script src='http://example.org/tests/content/base/test/file_CSP.sjs?testid=script2_bad&type=text/javascript'></script>
<!-- these should load ok after fixing bug 717511. :) -->
<img src="file_CSP.sjs?testid=img2_good&type=img/png" />
<script src='file_CSP.sjs?testid=script2_good&type=text/javascript'></script>
rename from content/base/test/file_bug717511_2.html^headers^
rename to content/base/test/csp/file_multi_policy_injection_bypass_2.html^headers^
rename from content/base/test/file_bug558431.html
rename to content/base/test/csp/file_policyuri_async_fetch.html
--- a/content/base/test/file_bug558431.html
+++ b/content/base/test/csp/file_policyuri_async_fetch.html
@@ -1,2 +1,5 @@
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=558431
+-->
<iframe id="inner"
src="/tests/content/base/test/file_CSP.sjs?content=%3Cdiv%20id%3D%22test%22%3Etest%20558431%3C/div%3E"></iframe>
rename from content/base/test/file_bug558431.html^headers^
rename to content/base/test/csp/file_policyuri_async_fetch.html^headers^
rename from content/base/test/file_bug650386_content.sjs
rename to content/base/test/csp/file_redirect_content.sjs
--- a/content/base/test/file_bug650386_content.sjs
+++ b/content/base/test/csp/file_redirect_content.sjs
@@ -1,11 +1,12 @@
-// SJS file for tests for bug650386, serves file_bug650386_content.html
+// https://bugzilla.mozilla.org/show_bug.cgi?id=650386
+// This SJS file serves file_redirect_content.html
// with a CSP that will trigger a violation and that will report it
-// to file_bug650386_report.sjs
+// to file_redirect_report.sjs
//
// This handles 301, 302, 303 and 307 redirects. The HTTP status code
// returned/type of redirect to do comes from the query string
// parameter passed in from the test_bug650386_* files and then also
// uses that value in the report-uri parameter of the CSP
function handleRequest(request, response) {
response.setHeader("Cache-Control", "no-cache", false);
@@ -17,17 +18,17 @@ function handleRequest(request, response
// do a 302 redirect to the same URL as the report URI
// redirects to - this will fail the test.
var loc = "http://example.com/some/fake/path";
response.setStatusLine("1.1", 302, "Found");
response.setHeader("Location", loc, false);
return;
}
- var csp = "default-src \'self\';report-uri http://mochi.test:8888/tests/content/base/test/file_bug650386_report.sjs?" + redirect;
+ var csp = "default-src \'self\';report-uri http://mochi.test:8888/tests/content/base/test/csp/file_redirect_report.sjs?" + redirect;
response.setHeader("X-Content-Security-Policy", csp, false);
// the actual file content.
// this image load will (intentionally) fail due to the CSP policy of default-src: 'self'
// specified by the CSP string above.
var content = "<!DOCTYPE HTML><html><body><img src = \"http://some.other.domain.example.com\"></body></html>";
rename from content/base/test/file_bug650386_report.sjs
rename to content/base/test/csp/file_redirect_report.sjs
--- a/content/base/test/file_bug650386_report.sjs
+++ b/content/base/test/csp/file_redirect_report.sjs
@@ -1,9 +1,10 @@
-// SJS file for tests for bug650386, this serves as CSP violation report target
+// https://bugzilla.mozilla.org/show_bug.cgi?id=650386
+// This SJS file serves as CSP violation report target
// and issues a redirect, to make sure the browser does not post to the target
// of the redirect, per CSP spec.
// This handles 301, 302, 303 and 307 redirects. The HTTP status code
// returned/type of redirect to do comes from the query string
// parameter
function handleRequest(request, response) {
response.setHeader("Cache-Control", "no-cache", false);
rename from content/base/test/file_bug702439.html
rename to content/base/test/csp/file_subframe_run_js_if_allowed.html
--- a/content/base/test/file_bug702439.html
+++ b/content/base/test/csp/file_subframe_run_js_if_allowed.html
@@ -1,11 +1,13 @@
<html>
<!--
- This document is a child frame of a CSP document and the
- test verifies that it is permitted to run javascript: URLs
- if the parent has a policy that allows them.
+https://bugzilla.mozilla.org/show_bug.cgi?id=702439
+
+This document is a child frame of a CSP document and the
+test verifies that it is permitted to run javascript: URLs
+if the parent has a policy that allows them.
-->
<body onload="document.getElementById('a').click()">
<a id="a" href="javascript:parent.javascript_link_ran = true;
parent.checkResult();">click</a>
</body>
</html>
rename from content/base/test/test_bug702439.html^headers^
rename to content/base/test/csp/file_subframe_run_js_if_allowed.html^headers^
--- a/content/base/test/csp/mochitest.ini
+++ b/content/base/test/csp/mochitest.ini
@@ -108,16 +108,27 @@ support-files =
file_dual_headers_warning.html^headers^
file_self_none_as_hostname_confusion.html
file_self_none_as_hostname_confusion.html^headers^
file_csp_testserver.sjs
file_csp_regexp_parsing.html
file_csp_regexp_parsing.js
file_report_uri_missing_in_report_only_header.html
file_report_uri_missing_in_report_only_header.html^headers^
+ file_csp_report.sjs
+ file_policyuri_async_fetch.html
+ file_policyuri_async_fetch.html^headers^
+ file_redirect_content.sjs
+ file_redirect_report.sjs
+ file_subframe_run_js_if_allowed.html
+ file_subframe_run_js_if_allowed.html^headers^
+ file_multi_policy_injection_bypass.html
+ file_multi_policy_injection_bypass.html^headers^
+ file_multi_policy_injection_bypass_2.html
+ file_multi_policy_injection_bypass_2.html^headers^
[test_CSP.html]
skip-if = toolkit == 'android' #TIMED_OUT
[test_CSP_bug663567.html]
[test_CSP_bug802872.html]
[test_CSP_bug885433.html]
[test_CSP_bug888172.html]
[test_CSP_bug916446.html]
@@ -140,8 +151,16 @@ skip-if = toolkit == 'android' #TIMED_OU
[test_nonce_source.html]
[test_CSP_bug941404.html]
[test_hash_source.html]
[test_dual_headers_warning.html]
[test_self_none_as_hostname_confusion.html]
[test_bug949549.html]
[test_csp_regexp_parsing.html]
[test_report_uri_missing_in_report_only_header.html]
+[test_csp_report.html]
+[test_policyuri_async_fetch.html]
+[test_301_redirect.html]
+[test_302_redirect.html]
+[test_303_redirect.html]
+[test_307_redirect.html]
+[test_subframe_run_js_if_allowed.html]
+[test_multi_policy_injection_bypass.html]
rename from content/base/test/test_bug650386_redirect_301.html
rename to content/base/test/csp/test_301_redirect.html
--- a/content/base/test/test_bug650386_redirect_301.html
+++ b/content/base/test/csp/test_301_redirect.html
@@ -66,13 +66,13 @@ window.done = function(result) {
// clean up observers and finish the test
window.examiner.remove();
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
// save this for last so that our listeners are registered.
-document.getElementById('content_iframe').src = 'file_bug650386_content.sjs?301';
+document.getElementById('content_iframe').src = 'file_redirect_content.sjs?301';
</script>
</pre>
</body>
</html>
rename from content/base/test/test_bug650386_redirect_302.html
rename to content/base/test/csp/test_302_redirect.html
--- a/content/base/test/test_bug650386_redirect_302.html
+++ b/content/base/test/csp/test_302_redirect.html
@@ -66,13 +66,13 @@ window.done = function(result) {
// clean up observers and finish the test
window.examiner.remove();
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
// save this for last so that our listeners are registered.
-document.getElementById('content_iframe').src = 'file_bug650386_content.sjs?302';
+document.getElementById('content_iframe').src = 'file_redirect_content.sjs?302';
</script>
</pre>
</body>
</html>
rename from content/base/test/test_bug650386_redirect_303.html
rename to content/base/test/csp/test_303_redirect.html
--- a/content/base/test/test_bug650386_redirect_303.html
+++ b/content/base/test/csp/test_303_redirect.html
@@ -66,13 +66,13 @@ window.done = function(result) {
// clean up observers and finish the test
window.examiner.remove();
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
// save this for last so that our listeners are registered.
-document.getElementById('content_iframe').src = 'file_bug650386_content.sjs?303';
+document.getElementById('content_iframe').src = 'file_redirect_content.sjs?303';
</script>
</pre>
</body>
</html>
rename from content/base/test/test_bug650386_redirect_307.html
rename to content/base/test/csp/test_307_redirect.html
--- a/content/base/test/test_bug650386_redirect_307.html
+++ b/content/base/test/csp/test_307_redirect.html
@@ -66,13 +66,13 @@ window.done = function(result) {
// clean up observers and finish the test
window.examiner.remove();
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
// save this for last so that our listeners are registered.
-document.getElementById('content_iframe').src = 'file_bug650386_content.sjs?307';
+document.getElementById('content_iframe').src = 'file_redirect_content.sjs?307';
</script>
</pre>
</body>
</html>
rename from content/base/test/test_bug548193.html
rename to content/base/test/csp/test_csp_report.html
--- a/content/base/test/test_bug548193.html
+++ b/content/base/test/csp/test_csp_report.html
@@ -1,12 +1,15 @@
<!DOCTYPE HTML>
<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=548193
+-->
<head>
- <title>Test for CSP JSON violation report</title>
+ <title>Test for Bug 548193</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
@@ -68,23 +71,23 @@ examiner.prototype = {
// remove the listener
remove: function() {
SpecialPowers.removeObserver(this, "http-on-opening-request");
}
}
// content file that triggers a violation report
-var testFile = "file_bug548193.sjs";
+var testFile = "file_csp_report.sjs";
window.checkResults = function(reportObj) {
var cspReport = reportObj["csp-report"];
// correct violating request
is(cspReport["document-uri"],
- "http://mochi.test:8888/tests/content/base/test/" + testFile,
+ "http://mochi.test:8888/tests/content/base/test/csp/" + testFile,
"Incorrect violating request");
// correct blocked-uri
is(cspReport["blocked-uri"],
"http://example.org/tests/content/base/test/file_CSP.sjs?testid=img_bad&type=img/png",
"Incorrect blocked uri");
// correct violated-directive
is(cspReport["violated-directive"], "default-src http://mochi.test:8888",
"Incorrect violated directive");
rename from content/base/test/test_bug717511.html
rename to content/base/test/csp/test_multi_policy_injection_bypass.html
--- a/content/base/test/test_bug717511.html
+++ b/content/base/test/csp/test_multi_policy_injection_bypass.html
@@ -110,15 +110,15 @@ window.testResult = function(testname, r
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.
-document.getElementById('cspframe').src = 'file_bug717511.html';
-document.getElementById('cspframe2').src = 'file_bug717511_2.html';
+document.getElementById('cspframe').src = 'file_multi_policy_injection_bypass.html';
+document.getElementById('cspframe2').src = 'file_multi_policy_injection_bypass_2.html';
</script>
</pre>
</body>
</html>
rename from content/base/test/test_bug558431.html
rename to content/base/test/csp/test_policyuri_async_fetch.html
--- a/content/base/test/test_bug558431.html
+++ b/content/base/test/csp/test_policyuri_async_fetch.html
@@ -1,13 +1,16 @@
<!DOCTYPE HTML>
<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=558431
+-->
<head>
- <title>Test for CSP async policy-uri</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <title>Test for Bug 558431</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<iframe id="cspframe"></iframe>
<script type="text/javascript">
// This tests that a policy is still attempted to be fetched
// asynchronously (bug 558431) and that a default policy of
// |allow 'none'| is applied when the fetching fails.
@@ -19,13 +22,13 @@ f.addEventListener('load', function() {
var test = inner.contentDocument.getElementById("test");
// the inner document should not exist because it has an invalid
// policy-uri and should have been blocked by the default
// |allow 'none'| policy that was applied
is(test, null, "test inner document");
SimpleTest.finish();
}, false);
// load the test frame
-f.src = "file_bug558431.html";
+f.src = "file_policyuri_async_fetch.html";
SimpleTest.waitForExplicitFinish();
</script>
</body>
</html>
rename from content/base/test/test_bug702439.html
rename to content/base/test/csp/test_subframe_run_js_if_allowed.html
--- a/content/base/test/test_bug702439.html
+++ b/content/base/test/csp/test_subframe_run_js_if_allowed.html
@@ -3,17 +3,17 @@
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=702439
This test verifies that child iframes of CSP documents are
permitted to execute javascript: URLs assuming the policy
allows this.
-->
<head>
- <title>Test for Bug 428847</title>
+ <title>Test for Bug 702439</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<script class="testbody" type="text/javascript">
var javascript_link_ran = false;
// check that the script in the child frame's javascript: URL ran
@@ -22,11 +22,11 @@ function checkResult()
is(javascript_link_ran, true,
"javascript URL didn't execute");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
</script>
-<iframe id="i" src="file_bug702439.html"></iframe>
+<iframe id="i" src="file_subframe_run_js_if_allowed.html"></iframe>
</body>
</html>
--- a/content/base/test/mochitest.ini
+++ b/content/base/test/mochitest.ini
@@ -89,56 +89,46 @@ support-files =
file_bug428847-2.xhtml
file_bug498897.css
file_bug498897.html
file_bug498897.html^headers^
file_bug503481.sjs
file_bug503481b_inner.html
file_bug541937.html
file_bug541937.xhtml
- file_bug548193.sjs
file_bug557892.html
- file_bug558431.html
- file_bug558431.html^headers^
file_bug562137.txt
file_bug590812-ref.xhtml
file_bug590812.xml
file_bug590870.html
file_bug601803a.html
file_bug601803b.html
file_bug604660-1.xml
file_bug604660-2.xsl
file_bug604660-3.js
file_bug604660-4.js
file_bug604660-5.xml
file_bug604660-6.xsl
file_bug622088.sjs
file_bug622088_inner.html
- file_bug650386_content.sjs
- file_bug650386_report.sjs
file_bug675121.sjs
file_bug687859-16.js
file_bug687859-16.js^headers^
file_bug687859-bom.js
file_bug687859-bom.js^headers^
file_bug687859-charset.js
file_bug687859-http.js
file_bug687859-http.js^headers^
file_bug687859-inherit.js
file_bug692434.xml
- file_bug702439.html
file_bug707142_baseline.json
file_bug707142_bom.json
file_bug707142_utf-16.json
file_bug708620-2.html
file_bug708620.html
- file_bug717511.html
- file_bug717511.html^headers^
- file_bug717511_2.html
- file_bug717511_2.html^headers^
file_bug782342.txt
file_bug787778.sjs
file_bug804395.jar
file_bug869432.eventsource
file_bug869432.eventsource^headers^
file_bug902350.html
file_bug902350_frame.html
file_bug907892.html
@@ -417,21 +407,19 @@ skip-if = toolkit == 'android' #TIMED_OU
[test_bug515401.html]
[test_bug518104.html]
[test_bug527896.html]
[test_bug540854.html]
[test_bug541937.html]
[test_bug544642.html]
[test_bug545644.html]
[test_bug545644.xhtml]
-[test_bug548193.html]
[test_bug548463.html]
[test_bug553896.xhtml]
[test_bug557892.html]
-[test_bug558431.html]
[test_bug558726.html]
[test_bug559526.html]
[test_bug560780.html]
[test_bug562137.html]
[test_bug562169-1.html]
[test_bug562169-2.html]
[test_bug562652.html]
[test_bug564047.html]
@@ -460,20 +448,16 @@ skip-if = toolkit == 'android' #bug 6870
[test_bug622117.html]
[test_bug622246.html]
[test_bug625722.html]
[test_bug626262.html]
[test_bug628938.html]
[test_bug631615.html]
[test_bug638112.html]
[test_bug647518.html]
-[test_bug650386_redirect_301.html]
-[test_bug650386_redirect_302.html]
-[test_bug650386_redirect_303.html]
-[test_bug650386_redirect_307.html]
[test_bug656283.html]
[test_bug664916.html]
[test_bug666604.html]
[test_bug675121.html]
[test_bug675166.html]
[test_bug682463.html]
[test_bug682554.html]
[test_bug682592.html]
@@ -485,24 +469,21 @@ skip-if = toolkit == 'android' #bug 6870
[test_bug692434.html]
[test_bug693615.html]
[test_bug693875.html]
[test_bug694754.xhtml]
[test_bug696301-1.html]
[test_bug696301-2.html]
[test_bug698381.html]
[test_bug698384.html]
-[test_bug702439.html]
-[test_bug702439.html^headers^]
[test_bug704063.html]
[test_bug707142.html]
[test_bug708620.html]
[test_bug711047.html]
[test_bug711180.html]
-[test_bug717511.html]
[test_bug719533.html]
[test_bug726364.html]
[test_bug737087.html]
[test_bug737565.html]
[test_bug737612.html]
[test_bug738108.html]
[test_bug744830.html]
[test_bug749367.html]
--- a/content/html/content/src/HTMLInputElement.cpp
+++ b/content/html/content/src/HTMLInputElement.cpp
@@ -2788,25 +2788,26 @@ HTMLInputElement::SetValueInternal(const
if (mType == NS_FORM_INPUT_EMAIL) {
UpdateAllValidityStates(mParserCreating);
}
} else {
mInputData.mValue = ToNewUnicode(value);
if (aSetValueChanged) {
SetValueChanged(true);
}
- OnValueChanged(!mParserCreating);
-
if (mType == NS_FORM_INPUT_NUMBER) {
+ // This has to happen before OnValueChanged is called because that
+ // method needs the new value of our frame's anon text control.
nsNumberControlFrame* numberControlFrame =
do_QueryFrame(GetPrimaryFrame());
if (numberControlFrame) {
numberControlFrame->SetValueOfAnonTextControl(value);
}
}
+ OnValueChanged(!mParserCreating);
}
// Call parent's SetAttr for color input so its control frame is notified
// and updated
if (mType == NS_FORM_INPUT_COLOR) {
return nsGenericHTMLFormElement::SetAttr(kNameSpaceID_None,
nsGkAtoms::value, aValue,
true);
@@ -3628,16 +3629,30 @@ HTMLInputElement::StopNumberControlSpinn
numberControlFrame->SpinnerStateChanged();
}
}
}
void
HTMLInputElement::StepNumberControlForUserEvent(int32_t aDirection)
{
+ if (!IsValid()) {
+ // If the user has typed a value into the control and inadvertently made a
+ // mistake (e.g. put a thousand separator at the wrong point) we do not
+ // want to wipe out what they typed if they try to increment/decrement the
+ // value. Better is to highlight the value as being invalid so that they
+ // can correct what they typed.
+ // We pass 'true' for UpdateValidityUIBits' aIsFocused argument regardless
+ // because we need the UI to update _now_ or the user will wonder why the
+ // step behavior isn't functioning.
+ UpdateValidityUIBits(true);
+ UpdateState(true);
+ return;
+ }
+
Decimal newValue = Decimal::nan(); // unchanged if value will not change
nsresult rv = GetValueIfStepped(aDirection, CALLED_FOR_USER_EVENT, &newValue);
if (NS_FAILED(rv) || !newValue.isFinite()) {
return; // value should not or will not change
}
--- a/content/html/content/test/forms/test_input_number_key_events.html
+++ b/content/html/content/test/forms/test_input_number_key_events.html
@@ -141,20 +141,20 @@ function test() {
elem.min = -3;
elem.max = 3;
elem.step = 2;
var defaultValue = 0;
var oldVal, expectedVal;
for (key of ["VK_UP", "VK_DOWN"]) {
// Start at middle:
- oldVal = elem.value = 0;
+ oldVal = elem.value = -1;
expectedVal = expectedValAfterKeyEvent(key, elem);
synthesizeKey(key, {});
- is(elem.value, expectedVal, "Test " + key + " for number control with value set to the midpoint (" + oldVal + ")");
+ is(elem.value, expectedVal, "Test " + key + " for number control with value set between min/max (" + oldVal + ")");
// Same again:
expectedVal = expectedValAfterKeyEvent(key, elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test repeat of " + key + " for number control");
// Start at maximum:
oldVal = elem.value = elem.max;
@@ -191,15 +191,22 @@ function test() {
// Test step="any" behavior:
var oldStep = elem.step;
elem.step = "any";
oldVal = elem.value = 0;
expectedVal = expectedValAfterKeyEvent(key, elem);
synthesizeKey(key, {});
is(elem.value, expectedVal, "Test " + key + " for number control with value set to the midpoint and step='any' (" + oldVal + ")");
elem.step = oldStep; // restore
+
+ // Test that invalid input blocks UI initiated stepping:
+ oldVal = elem.value = "";
+ elem.select();
+ sendString("abc");
+ synthesizeKey(key, {});
+ is(elem.value, "", "Test " + key + " does nothing when the input is invalid");
}
}
</script>
</pre>
</body>
</html>
--- a/content/media/MediaData.cpp
+++ b/content/media/MediaData.cpp
@@ -37,17 +37,17 @@ static bool
ValidatePlane(const VideoData::YCbCrBuffer::Plane& aPlane)
{
return aPlane.mWidth <= PlanarYCbCrImage::MAX_DIMENSION &&
aPlane.mHeight <= PlanarYCbCrImage::MAX_DIMENSION &&
aPlane.mWidth * aPlane.mHeight < MAX_VIDEO_WIDTH * MAX_VIDEO_HEIGHT &&
aPlane.mStride > 0;
}
-#if 0
+#ifdef MOZ_WIDGET_GONK
static bool
IsYV12Format(const VideoData::YCbCrBuffer::Plane& aYPlane,
const VideoData::YCbCrBuffer::Plane& aCbPlane,
const VideoData::YCbCrBuffer::Plane& aCrPlane)
{
return
aYPlane.mWidth % 2 == 0 &&
aYPlane.mHeight % 2 == 0 &&
@@ -98,16 +98,55 @@ VideoData* VideoData::ShallowCopyUpdateD
aDuration,
aOther->mKeyframe,
aOther->mTimecode,
aOther->mDisplay);
v->mImage = aOther->mImage;
return v;
}
+/* static */
+void VideoData::SetVideoDataToImage(PlanarYCbCrImage* aVideoImage,
+ VideoInfo& aInfo,
+ const YCbCrBuffer &aBuffer,
+ const IntRect& aPicture,
+ bool aCopyData)
+{
+ if (!aVideoImage) {
+ return;
+ }
+ const YCbCrBuffer::Plane &Y = aBuffer.mPlanes[0];
+ const YCbCrBuffer::Plane &Cb = aBuffer.mPlanes[1];
+ const YCbCrBuffer::Plane &Cr = aBuffer.mPlanes[2];
+
+ PlanarYCbCrData data;
+ data.mYChannel = Y.mData + Y.mOffset;
+ data.mYSize = IntSize(Y.mWidth, Y.mHeight);
+ data.mYStride = Y.mStride;
+ data.mYSkip = Y.mSkip;
+ data.mCbChannel = Cb.mData + Cb.mOffset;
+ data.mCrChannel = Cr.mData + Cr.mOffset;
+ data.mCbCrSize = IntSize(Cb.mWidth, Cb.mHeight);
+ data.mCbCrStride = Cb.mStride;
+ data.mCbSkip = Cb.mSkip;
+ data.mCrSkip = Cr.mSkip;
+ data.mPicX = aPicture.x;
+ data.mPicY = aPicture.y;
+ data.mPicSize = aPicture.Size();
+ data.mStereoMode = aInfo.mStereoMode;
+
+ aVideoImage->SetDelayedConversion(true);
+ if (aCopyData) {
+ aVideoImage->SetData(data);
+ } else {
+ aVideoImage->SetDataNoCopy(data);
+ }
+}
+
+/* static */
VideoData* VideoData::Create(VideoInfo& aInfo,
ImageContainer* aContainer,
Image* aImage,
int64_t aOffset,
int64_t aTime,
int64_t aDuration,
const YCbCrBuffer& aBuffer,
bool aKeyframe,
@@ -159,24 +198,26 @@ VideoData* VideoData::Create(VideoInfo&
}
nsAutoPtr<VideoData> v(new VideoData(aOffset,
aTime,
aDuration,
aKeyframe,
aTimecode,
aInfo.mDisplay.ToIntSize()));
+#ifdef MOZ_WIDGET_GONK
const YCbCrBuffer::Plane &Y = aBuffer.mPlanes[0];
const YCbCrBuffer::Plane &Cb = aBuffer.mPlanes[1];
const YCbCrBuffer::Plane &Cr = aBuffer.mPlanes[2];
+#endif
if (!aImage) {
// Currently our decoder only knows how to output to ImageFormat::PLANAR_YCBCR
// format.
-#if 0
+#ifdef MOZ_WIDGET_GONK
if (IsYV12Format(Y, Cb, Cr)) {
v->mImage = aContainer->CreateImage(ImageFormat::GRALLOC_PLANAR_YCBCR);
}
#endif
if (!v->mImage) {
v->mImage = aContainer->CreateImage(ImageFormat::PLANAR_YCBCR);
}
} else {
@@ -186,70 +227,70 @@ VideoData* VideoData::Create(VideoInfo&
if (!v->mImage) {
return nullptr;
}
NS_ASSERTION(v->mImage->GetFormat() == ImageFormat::PLANAR_YCBCR ||
v->mImage->GetFormat() == ImageFormat::GRALLOC_PLANAR_YCBCR,
"Wrong format?");
PlanarYCbCrImage* videoImage = static_cast<PlanarYCbCrImage*>(v->mImage.get());
- PlanarYCbCrData data;
- data.mYChannel = Y.mData + Y.mOffset;
- data.mYSize = IntSize(Y.mWidth, Y.mHeight);
- data.mYStride = Y.mStride;
- data.mYSkip = Y.mSkip;
- data.mCbChannel = Cb.mData + Cb.mOffset;
- data.mCrChannel = Cr.mData + Cr.mOffset;
- data.mCbCrSize = IntSize(Cb.mWidth, Cb.mHeight);
- data.mCbCrStride = Cb.mStride;
- data.mCbSkip = Cb.mSkip;
- data.mCrSkip = Cr.mSkip;
- data.mPicX = aPicture.x;
- data.mPicY = aPicture.y;
- data.mPicSize = aPicture.Size();
- data.mStereoMode = aInfo.mStereoMode;
-
- videoImage->SetDelayedConversion(true);
if (!aImage) {
- videoImage->SetData(data);
+ VideoData::SetVideoDataToImage(videoImage, aInfo, aBuffer, aPicture,
+ true /* aCopyData */);
} else {
- videoImage->SetDataNoCopy(data);
+ VideoData::SetVideoDataToImage(videoImage, aInfo, aBuffer, aPicture,
+ false /* aCopyData */);
}
+#ifdef MOZ_WIDGET_GONK
+ if (!videoImage->IsValid() && !aImage && IsYV12Format(Y, Cb, Cr)) {
+ // Failed to allocate gralloc. Try fallback.
+ v->mImage = aContainer->CreateImage(ImageFormat::PLANAR_YCBCR);
+ if (!v->mImage) {
+ return nullptr;
+ }
+ videoImage = static_cast<PlanarYCbCrImage*>(v->mImage.get());
+ VideoData::SetVideoDataToImage(videoImage, aInfo, aBuffer, aPicture,
+ true /* aCopyData */);
+ }
+#endif
return v.forget();
}
+/* static */
VideoData* VideoData::Create(VideoInfo& aInfo,
ImageContainer* aContainer,
int64_t aOffset,
int64_t aTime,
int64_t aDuration,
const YCbCrBuffer& aBuffer,
bool aKeyframe,
int64_t aTimecode,
const IntRect& aPicture)
{
return Create(aInfo, aContainer, nullptr, aOffset, aTime, aDuration, aBuffer,
aKeyframe, aTimecode, aPicture);
}
+/* static */
VideoData* VideoData::Create(VideoInfo& aInfo,
Image* aImage,
int64_t aOffset,
int64_t aTime,
int64_t aDuration,
const YCbCrBuffer& aBuffer,
bool aKeyframe,
int64_t aTimecode,
const IntRect& aPicture)
{
return Create(aInfo, nullptr, aImage, aOffset, aTime, aDuration, aBuffer,
aKeyframe, aTimecode, aPicture);
}
+/* static */
VideoData* VideoData::CreateFromImage(VideoInfo& aInfo,
ImageContainer* aContainer,
int64_t aOffset,
int64_t aTime,
int64_t aDuration,
const nsRefPtr<Image>& aImage,
bool aKeyframe,
int64_t aTimecode,
@@ -261,16 +302,17 @@ VideoData* VideoData::CreateFromImage(Vi
aKeyframe,
aTimecode,
aInfo.mDisplay.ToIntSize()));
v->mImage = aImage;
return v.forget();
}
#ifdef MOZ_OMX_DECODER
+/* static */
VideoData* VideoData::Create(VideoInfo& aInfo,
ImageContainer* aContainer,
int64_t aOffset,
int64_t aTime,
int64_t aDuration,
mozilla::layers::GraphicBufferLocked* aBuffer,
bool aKeyframe,
int64_t aTimecode,
--- a/content/media/MediaData.h
+++ b/content/media/MediaData.h
@@ -97,27 +97,29 @@ public:
// mChannels channels, each with mFrames frames
nsRefPtr<SharedBuffer> mAudioBuffer;
// mFrames frames, each with mChannels values
nsAutoArrayPtr<AudioDataValue> mAudioData;
};
namespace layers {
class GraphicBufferLocked;
+class PlanarYCbCrImage;
}
class VideoInfo;
// Holds a decoded video frame, in YCbCr format. These are queued in the reader.
class VideoData : public MediaData {
public:
typedef gfx::IntRect IntRect;
typedef gfx::IntSize IntSize;
typedef layers::ImageContainer ImageContainer;
typedef layers::Image Image;
+ typedef layers::PlanarYCbCrImage PlanarYCbCrImage;
// YCbCr data obtained from decoding the video. The index's are:
// 0 = Y
// 1 = Cb
// 2 = Cr
struct YCbCrBuffer {
struct Plane {
uint8_t* mData;
@@ -197,16 +199,24 @@ public:
// VideoData. The new VideoData's mImage field holds a reference to
// aOther's mImage, i.e. the Image is not copied. This function is useful
// in reader backends that can't determine the duration of a VideoData
// until the next frame is decoded, i.e. it's a way to change the const
// duration field on a VideoData.
static VideoData* ShallowCopyUpdateDuration(VideoData* aOther,
int64_t aDuration);
+ // Initialize PlanarYCbCrImage. Only When aCopyData is true,
+ // video data is copied to PlanarYCbCrImage.
+ static void SetVideoDataToImage(PlanarYCbCrImage* aVideoImage,
+ VideoInfo& aInfo,
+ const YCbCrBuffer &aBuffer,
+ const IntRect& aPicture,
+ bool aCopyData);
+
// Constructs a duplicate VideoData object. This intrinsically tells the
// player that it does not need to update the displayed frame when this
// frame is played; this frame is identical to the previous.
static VideoData* CreateDuplicate(int64_t aOffset,
int64_t aTime,
int64_t aDuration,
int64_t aTimecode)
{
--- a/content/media/encoder/OmxTrackEncoder.cpp
+++ b/content/media/encoder/OmxTrackEncoder.cpp
@@ -107,22 +107,26 @@ OmxVideoTrackEncoder::GetEncodedTrack(En
mLastFrame.TakeFrom(&chunk.mFrame);
mTotalFrameDuration += chunk.GetDuration();
iter.Next();
}
// Send the EOS signal to OMXCodecWrapper.
if (mEndOfStream && iter.IsEnded() && !mEosSetInEncoder) {
- mEosSetInEncoder = true;
uint64_t totalDurationUs = mTotalFrameDuration * USECS_PER_S / mTrackRate;
layers::Image* img = (!mLastFrame.GetImage() || mLastFrame.GetForceBlack())
? nullptr : mLastFrame.GetImage();
- mEncoder->Encode(img, mFrameWidth, mFrameHeight, totalDurationUs,
- OMXCodecWrapper::BUFFER_EOS);
+ nsresult result = mEncoder->Encode(img, mFrameWidth, mFrameHeight,
+ totalDurationUs,
+ OMXCodecWrapper::BUFFER_EOS);
+ // Keep sending EOS signal until OMXVideoEncoder gets it.
+ if (result == NS_OK) {
+ mEosSetInEncoder = true;
+ }
}
// Dequeue an encoded frame from the output buffers of OMXCodecWrapper.
nsresult rv;
nsTArray<uint8_t> buffer;
int outFlags = 0;
int64_t outTimeStampUs = 0;
mEncoder->GetNextEncodedFrame(&buffer, &outTimeStampUs, &outFlags,
--- a/content/media/gstreamer/GStreamerReader.cpp
+++ b/content/media/gstreamer/GStreamerReader.cpp
@@ -221,25 +221,16 @@ void GStreamerReader::PlayBinSourceSetup
}
void GStreamerReader::PlayBinSourceSetup(GstAppSrc* aSource)
{
mSource = GST_APP_SRC(aSource);
gst_app_src_set_callbacks(mSource, &mSrcCallbacks, (gpointer) this, nullptr);
MediaResource* resource = mDecoder->GetResource();
- /* do a short read to trigger a network request so that GetLength() below
- * returns something meaningful and not -1
- */
- char buf[512];
- unsigned int size = 0;
- resource->Read(buf, sizeof(buf), &size);
- resource->Seek(SEEK_SET, 0);
-
- /* now we should have a length */
int64_t resourceLength = resource->GetLength();
gst_app_src_set_size(mSource, resourceLength);
if (resource->IsDataCachedToEndOfResource(0) ||
(resourceLength != -1 && resourceLength <= SHORT_FILE_SIZE)) {
/* let the demuxer work in pull mode for local files (or very short files)
* so that we get optimal seeking accuracy/performance
*/
LOG(PR_LOG_DEBUG, ("configuring random access, len %lld", resourceLength));
--- a/content/media/omx/OMXCodecWrapper.cpp
+++ b/content/media/omx/OMXCodecWrapper.cpp
@@ -3,16 +3,17 @@
* 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 "OMXCodecWrapper.h"
#include "OMXCodecDescriptorUtil.h"
#include "TrackEncoder.h"
#include <binder/ProcessState.h>
+#include <cutils/properties.h>
#include <media/ICrypto.h>
#include <media/IOMX.h>
#include <OMX_Component.h>
#include <stagefright/MediaDefs.h>
#include <stagefright/MediaErrors.h>
#include "AudioChannelFormat.h"
#include <mozilla/Monitor.h>
@@ -105,36 +106,58 @@ OMXCodecWrapper::Stop()
NS_ENSURE_TRUE(mStarted, OK);
status_t result = mCodec->stop();
mStarted = !(result == OK);
return result;
}
+// Check system property to see if we're running on emulator.
+static
+bool IsRunningOnEmulator()
+{
+ char qemu[PROPERTY_VALUE_MAX];
+ property_get("ro.kernel.qemu", qemu, "");
+ return strncmp(qemu, "1", 1) == 0;
+}
+
nsresult
OMXVideoEncoder::Configure(int aWidth, int aHeight, int aFrameRate)
{
MOZ_ASSERT(!mStarted, "Configure() was called already.");
NS_ENSURE_TRUE(aWidth > 0 && aHeight > 0 && aFrameRate > 0,
NS_ERROR_INVALID_ARG);
+ OMX_VIDEO_AVCLEVELTYPE level = OMX_VIDEO_AVCLevel3;
+ OMX_VIDEO_CONTROLRATETYPE bitrateMode = OMX_Video_ControlRateConstant;
+ // Limitation of soft AVC/H.264 encoder running on emulator in stagefright.
+ static bool emu = IsRunningOnEmulator();
+ if (emu) {
+ if (aWidth > 352 || aHeight > 288) {
+ CODEC_ERROR("SoftAVCEncoder doesn't support resolution larger than CIF");
+ return NS_ERROR_INVALID_ARG;
+ }
+ level = OMX_VIDEO_AVCLevel2;
+ bitrateMode = OMX_Video_ControlRateVariable;
+ }
+
// Set up configuration parameters for AVC/H.264 encoder.
sp<AMessage> format = new AMessage;
// Fixed values
format->setString("mime", MEDIA_MIMETYPE_VIDEO_AVC);
format->setInt32("bitrate", ENCODER_CONFIG_BITRATE);
format->setInt32("i-frame-interval", ENCODER_CONFIG_I_FRAME_INTERVAL);
// See mozilla::layers::GrallocImage, supports YUV 4:2:0, CbCr width and
// height is half that of Y
format->setInt32("color-format", OMX_COLOR_FormatYUV420SemiPlanar);
format->setInt32("profile", OMX_VIDEO_AVCProfileBaseline);
- format->setInt32("level", OMX_VIDEO_AVCLevel3);
- format->setInt32("bitrate-mode", OMX_Video_ControlRateConstant);
+ format->setInt32("level", level);
+ format->setInt32("bitrate-mode", bitrateMode);
format->setInt32("store-metadata-in-buffers", 0);
format->setInt32("prepend-sps-pps-to-idr-frames", 0);
// Input values.
format->setInt32("width", aWidth);
format->setInt32("height", aHeight);
format->setInt32("stride", aWidth);
format->setInt32("slice-height", aHeight);
format->setInt32("frame-rate", aFrameRate);
--- a/content/svg/content/test/test_getSubStringLength.xhtml
+++ b/content/svg/content/test/test_getSubStringLength.xhtml
@@ -54,37 +54,34 @@ function runTests(text, charWidth)
catch (e)
{
ok(false,
"unexpected exception for " +
"text.getSubStringLength(" + charnum + "," + nchars + ")");
}
}
- expectThrow(-1, 2);
- expectThrow(-1, 0);
- expectThrow(1, 3);
- expectThrow(0, 4);
+ expectThrow(100, 2);
+ expectThrow(100, 0);
expectThrow(3, 0);
+ expectThrow(3, 1);
+ expectValue(1, 3, chars(2));
+ expectValue(0, 4, chars(3));
expectValue(0, 0, chars(0));
expectValue(1, 0, chars(0));
expectValue(2, 0, chars(0));
expectValue(0, 1, chars(1));
expectValue(1, 1, chars(1));
expectValue(2, 1, chars(1));
expectValue(0, 2, chars(2));
expectValue(1, 2, chars(2));
expectValue(0, 3, chars(3));
-
- expectThrow(1, -1);
- expectThrow(2, -1);
- expectThrow(3, -1);
- expectThrow(3, -3);
- expectThrow(-1, -1);
+ expectValue(1, 100, chars(2));
+ expectValue(2, 100, chars(1));
}
function run()
{
try
{
var document = $("svg").contentWindow.document;
--- a/content/svg/content/test/test_selectSubString.xhtml
+++ b/content/svg/content/test/test_selectSubString.xhtml
@@ -25,41 +25,58 @@ function runTests()
var text = document.getElementById("text");
function expectThrow(charnum, nchars)
{
try
{
text.selectSubString(charnum, nchars);
ok(false,
- "text.selectSubString(" + charnum + "," + nchars + ") " +
- "should have thrown");
+ "text.selectSubString(" + charnum + "," + nchars + ") " +
+ "should have thrown");
}
catch (e)
{
is(e.name, "IndexSizeError",
- "expected an index error for " +
- "text.selectSubString(" + charnum + "," + nchars + ")");
+ "expected an index error for " +
+ "text.selectSubString(" + charnum + "," + nchars + ")");
is(e.code, DOMException.INDEX_SIZE_ERR,
- "expected an index error for " +
- "text.selectSubString(" + charnum + "," + nchars + ")");
+ "expected an index error for " +
+ "text.selectSubString(" + charnum + "," + nchars + ")");
+ }
+ }
+
+ function expectNoThrow(charnum, nchars, expected)
+ {
+ try
+ {
+ text.selectSubString(charnum, nchars);
+ ok(true,
+ "text.selectSubString(" + charnum + "," + nchars + ") " +
+ "should not have thrown");
+ }
+ catch (e)
+ {
+ ok(false,
+ "unexpected exception for " +
+ "text.selectSubString(" + charnum + "," + nchars + ")");
}
}
- expectThrow(-1, 2);
- expectThrow(-1, 0);
- expectThrow(1, 3);
- expectThrow(0, 4);
+ expectThrow(100, 2);
+ expectThrow(100, 0);
expectThrow(3, 0);
+ expectThrow(3, 100);
+ expectThrow(3, 100);
+ expectThrow(100, 100);
- expectThrow(1, -1);
- expectThrow(2, -1);
- expectThrow(3, -1);
- expectThrow(3, -3);
- expectThrow(-1, -1);
+ expectNoThrow(1, 100);
+ expectNoThrow(2, 100);
+ expectNoThrow(1, 3);
+ expectNoThrow(0, 4);
SimpleTest.finish();
}
window.addEventListener("load", runTests, false);
</script>
</pre>
</body>
--- a/db/sqlite3/src/Makefile.in
+++ b/db/sqlite3/src/Makefile.in
@@ -40,11 +40,8 @@ endif
# Force /O2 optimisation on Windows because using the default /O1 causes
# crashes with MSVC2005 and PGO. See bug 719584.
ifeq ($(OS_ARCH),WINNT)
MODULE_OPTIMIZE_FLAGS = -O2
endif
include $(topsrcdir)/config/rules.mk
-
-# next line allows use of MOZ_OBJDIR in .mozconfig with older gcc on BeOS, maybe others
-LOCAL_INCLUDES += -I$(srcdir)
--- a/dom/audiochannel/AudioChannelService.cpp
+++ b/dom/audiochannel/AudioChannelService.cpp
@@ -443,17 +443,17 @@ AudioChannelService::SendAudioChannelCha
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
obs->NotifyObservers(static_cast<nsIWritablePropertyBag*>(props),
"audio-channel-process-changed", nullptr);
}
// Calculating the most important active channel.
- AudioChannelType higher = AUDIO_CHANNEL_LAST;
+ AudioChannelType higher = AUDIO_CHANNEL_DEFAULT;
// Top-Down in the hierarchy for visible elements
if (!mChannelCounters[AUDIO_CHANNEL_INT_PUBLICNOTIFICATION].IsEmpty()) {
higher = AUDIO_CHANNEL_PUBLICNOTIFICATION;
}
else if (!mChannelCounters[AUDIO_CHANNEL_INT_RINGER].IsEmpty()) {
higher = AUDIO_CHANNEL_RINGER;
@@ -477,63 +477,52 @@ AudioChannelService::SendAudioChannelCha
else if (!mChannelCounters[AUDIO_CHANNEL_INT_NORMAL].IsEmpty()) {
higher = AUDIO_CHANNEL_NORMAL;
}
AudioChannelType visibleHigher = higher;
// Top-Down in the hierarchy for non-visible elements
- if (higher == AUDIO_CHANNEL_LAST) {
- if (!mChannelCounters[AUDIO_CHANNEL_INT_PUBLICNOTIFICATION_HIDDEN].IsEmpty()) {
- higher = AUDIO_CHANNEL_PUBLICNOTIFICATION;
- }
-
- else if (!mChannelCounters[AUDIO_CHANNEL_INT_RINGER_HIDDEN].IsEmpty()) {
- higher = AUDIO_CHANNEL_RINGER;
+ // And we can ignore normal channel because it can't play in the background.
+ for (int i = AUDIO_CHANNEL_LAST - 1;
+ i > higher && i > AUDIO_CHANNEL_NORMAL; i--) {
+ if (i == AUDIO_CHANNEL_CONTENT &&
+ mPlayableHiddenContentChildID != CONTENT_PROCESS_ID_UNKNOWN) {
+ higher = static_cast<AudioChannelType>(i);
}
- else if (!mChannelCounters[AUDIO_CHANNEL_INT_TELEPHONY_HIDDEN].IsEmpty()) {
- higher = AUDIO_CHANNEL_TELEPHONY;
- }
-
- else if (!mChannelCounters[AUDIO_CHANNEL_INT_ALARM_HIDDEN].IsEmpty()) {
- higher = AUDIO_CHANNEL_ALARM;
- }
-
- else if (!mChannelCounters[AUDIO_CHANNEL_INT_NOTIFICATION_HIDDEN].IsEmpty()) {
- higher = AUDIO_CHANNEL_NOTIFICATION;
- }
-
- // Check whether there is any playable hidden content channel or not.
- else if (mPlayableHiddenContentChildID != CONTENT_PROCESS_ID_UNKNOWN) {
- higher = AUDIO_CHANNEL_CONTENT;
+ // Each channel type will be split to fg and bg for recording the state,
+ // so here need to do a translation.
+ if (!mChannelCounters[i * 2 + 1].IsEmpty()) {
+ higher = static_cast<AudioChannelType>(i);
+ break;
}
}
if (higher != mCurrentHigherChannel) {
mCurrentHigherChannel = higher;
nsString channelName;
- if (mCurrentHigherChannel != AUDIO_CHANNEL_LAST) {
+ if (mCurrentHigherChannel != AUDIO_CHANNEL_DEFAULT) {
channelName.AssignASCII(ChannelName(mCurrentHigherChannel));
} else {
channelName.AssignLiteral("none");
}
if (obs) {
obs->NotifyObservers(nullptr, "audio-channel-changed", channelName.get());
}
}
if (visibleHigher != mCurrentVisibleHigherChannel) {
mCurrentVisibleHigherChannel = visibleHigher;
nsString channelName;
- if (mCurrentVisibleHigherChannel != AUDIO_CHANNEL_LAST) {
+ if (mCurrentVisibleHigherChannel != AUDIO_CHANNEL_DEFAULT) {
channelName.AssignASCII(ChannelName(mCurrentVisibleHigherChannel));
} else {
channelName.AssignLiteral("none");
}
if (obs) {
obs->NotifyObservers(nullptr, "visible-audio-channel-changed", channelName.get());
}
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -1017,16 +1017,17 @@ Navigator::MozGetUserMedia(JSContext* aC
aRv = manager->GetUserMedia(aCx, privileged, mWindow, aConstraints,
onsuccess, onerror);
}
void
Navigator::MozGetUserMediaDevices(const MediaStreamConstraintsInternal& aConstraints,
MozGetUserMediaDevicesSuccessCallback& aOnSuccess,
NavigatorUserMediaErrorCallback& aOnError,
+ uint64_t aInnerWindowID,
ErrorResult& aRv)
{
CallbackObjectHolder<MozGetUserMediaDevicesSuccessCallback,
nsIGetUserMediaDevicesSuccessCallback> holder1(&aOnSuccess);
nsCOMPtr<nsIGetUserMediaDevicesSuccessCallback> onsuccess =
holder1.ToXPCOMCallback();
CallbackObjectHolder<NavigatorUserMediaErrorCallback,
@@ -1035,17 +1036,18 @@ Navigator::MozGetUserMediaDevices(const
if (!mWindow || !mWindow->GetOuterWindow() ||
mWindow->GetOuterWindow()->GetCurrentInnerWindow() != mWindow) {
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
return;
}
MediaManager* manager = MediaManager::Get();
- aRv = manager->GetUserMediaDevices(mWindow, aConstraints, onsuccess, onerror);
+ aRv = manager->GetUserMediaDevices(mWindow, aConstraints, onsuccess, onerror,
+ aInnerWindowID);
}
#endif
DesktopNotificationCenter*
Navigator::GetMozNotification(ErrorResult& aRv)
{
if (mNotification) {
return mNotification;
--- a/dom/base/Navigator.h
+++ b/dom/base/Navigator.h
@@ -225,16 +225,17 @@ public:
void MozGetUserMedia(JSContext* aCx,
const MediaStreamConstraints& aConstraints,
NavigatorUserMediaSuccessCallback& aOnSuccess,
NavigatorUserMediaErrorCallback& aOnError,
ErrorResult& aRv);
void MozGetUserMediaDevices(const MediaStreamConstraintsInternal& aConstraints,
MozGetUserMediaDevicesSuccessCallback& aOnSuccess,
NavigatorUserMediaErrorCallback& aOnError,
+ uint64_t aInnerWindowID,
ErrorResult& aRv);
#endif // MOZ_MEDIA_NAVIGATOR
bool DoNewResolve(JSContext* aCx, JS::Handle<JSObject*> aObject,
JS::Handle<jsid> aId,
JS::MutableHandle<JSPropertyDescriptor> aDesc);
void GetOwnPropertyNames(JSContext* aCx, nsTArray<nsString>& aNames,
ErrorResult& aRv);
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -2191,30 +2191,35 @@ nsJSContext::EndCycleCollectionCallback(
gCCStats.FinishCycleCollectionSlice();
sCCollectedWaitingForGC += aResults.mFreedRefCounted + aResults.mFreedGCed;
if (NeedsGCAfterCC()) {
PokeGC(JS::gcreason::CC_WAITING);
}
- TimeStamp endCCTime = TimeStamp::Now();
+ TimeStamp endCCTimeStamp = TimeStamp::Now();
+
+ PRTime endCCTime;
+ if (sPostGCEventsToObserver) {
+ endCCTime = PR_Now();
+ }
// Log information about the CC via telemetry, JSON and the console.
- uint32_t ccNowDuration = TimeBetween(gCCStats.mBeginTime, endCCTime);
+ uint32_t ccNowDuration = TimeBetween(gCCStats.mBeginTime, endCCTimeStamp);
Telemetry::Accumulate(Telemetry::CYCLE_COLLECTOR_FINISH_IGC, gCCStats.mAnyLockedOut);
Telemetry::Accumulate(Telemetry::CYCLE_COLLECTOR_SYNC_SKIPPABLE, gCCStats.mRanSyncForgetSkippable);
Telemetry::Accumulate(Telemetry::CYCLE_COLLECTOR_FULL, ccNowDuration);
Telemetry::Accumulate(Telemetry::CYCLE_COLLECTOR_MAX_PAUSE, gCCStats.mMaxSliceTime);
if (!sLastCCEndTime.IsNull()) {
uint32_t timeBetween = TimeBetween(sLastCCEndTime, gCCStats.mBeginTime);
Telemetry::Accumulate(Telemetry::CYCLE_COLLECTOR_TIME_BETWEEN, timeBetween);
}
- sLastCCEndTime = endCCTime;
+ sLastCCEndTime = endCCTimeStamp;
Telemetry::Accumulate(Telemetry::FORGET_SKIPPABLE_MAX,
sMaxForgetSkippableTime / PR_USEC_PER_MSEC);
PRTime delta = GetCollectionTimeDelta();
uint32_t cleanups = sForgetSkippableBeforeCC ? sForgetSkippableBeforeCC : 1;
uint32_t minForgetSkippableTime = (sMinForgetSkippableTime == UINT32_MAX)
--- a/dom/bindings/test/Makefile.in
+++ b/dom/bindings/test/Makefile.in
@@ -8,17 +8,17 @@ include ../webidlsrcs.mk
# TODO Update this variable in backend.mk.
CPPSRCS += $(addprefix ../,$(test_sources))
ifdef GNU_CC
OS_CXXFLAGS += -Wno-uninitialized
endif
# Bug 932082 tracks having bindings use namespaced includes.
-LOCAL_INCLUDES += -I$(DIST)/include/mozilla/dom -I..
+LOCAL_INCLUDES += -I$(DIST)/include/mozilla/dom
# Include rules.mk before any of our targets so our first target is coming from
# rules.mk and running make with no target in this dir does the right thing.
include $(topsrcdir)/config/rules.mk
check::
PYTHONDONTWRITEBYTECODE=1 $(PYTHON) $(topsrcdir)/config/pythonpath.py \
$(PLY_INCLUDE) $(srcdir)/../parser/runtests.py
--- a/dom/bindings/test/moz.build
+++ b/dom/bindings/test/moz.build
@@ -31,13 +31,14 @@ PREPROCESSED_TEST_WEBIDL_FILES += [
'TestJSImplGen.webidl',
]
WEBIDL_EXAMPLE_INTERFACES += [
'TestExampleInterface',
'TestExampleProxyInterface',
]
+GENERATED_INCLUDES += ['..']
LOCAL_INCLUDES += [
'/dom/bindings',
'/js/xpconnect/src',
'/js/xpconnect/wrappers',
]
--- a/dom/events/TextComposition.cpp
+++ b/dom/events/TextComposition.cpp
@@ -109,34 +109,34 @@ TextComposition::NotityUpdateComposition
}
}
}
NotifyIME(NOTIFY_IME_OF_COMPOSITION_UPDATE);
}
void
-TextComposition::DispatchCompsotionEventRunnable(uint32_t aEventMessage,
- const nsAString& aData)
+TextComposition::DispatchCompositionEventRunnable(uint32_t aEventMessage,
+ const nsAString& aData)
{
nsContentUtils::AddScriptRunner(
new CompositionEventDispatcher(mPresContext, mNode,
aEventMessage, aData));
}
void
TextComposition::SynthesizeCommit(bool aDiscard)
{
nsRefPtr<TextComposition> kungFuDeathGrip(this);
nsAutoString data(aDiscard ? EmptyString() : mLastData);
if (mLastData != data) {
- DispatchCompsotionEventRunnable(NS_COMPOSITION_UPDATE, data);
- DispatchCompsotionEventRunnable(NS_TEXT_TEXT, data);
+ DispatchCompositionEventRunnable(NS_COMPOSITION_UPDATE, data);
+ DispatchCompositionEventRunnable(NS_TEXT_TEXT, data);
}
- DispatchCompsotionEventRunnable(NS_COMPOSITION_END, data);
+ DispatchCompositionEventRunnable(NS_COMPOSITION_END, data);
}
nsresult
TextComposition::NotifyIME(IMEMessage aMessage)
{
NS_ENSURE_TRUE(mPresContext, NS_ERROR_NOT_AVAILABLE);
return nsIMEStateManager::NotifyIME(aMessage, mPresContext);
}
--- a/dom/events/TextComposition.h
+++ b/dom/events/TextComposition.h
@@ -214,30 +214,30 @@ private:
nsCOMPtr<nsIWidget> mWidget;
uint32_t mEventMessage;
nsString mData;
CompositionEventDispatcher() {};
};
/**
- * DispatchCompsotionEventRunnable() dispatches a composition or text event
+ * DispatchCompositionEventRunnable() dispatches a composition or text event
* to the content. Be aware, if you use this method, nsPresShellEventCB
* isn't used. That means that nsIFrame::HandleEvent() is never called.
* WARNING: The instance which is managed by nsIMEStateManager may be
* destroyed by this method call.
*
* @param aEventMessage Must be one of composition event or text event.
* @param aData Used for data value if aEventMessage is
* NS_COMPOSITION_UPDATE or NS_COMPOSITION_END.
* Used for theText value if aEventMessage is
* NS_TEXT_TEXT.
*/
- void DispatchCompsotionEventRunnable(uint32_t aEventMessage,
- const nsAString& aData);
+ void DispatchCompositionEventRunnable(uint32_t aEventMessage,
+ const nsAString& aData);
};
/**
* TextCompositionArray manages the instances of TextComposition class.
* Managing with array is enough because only one composition is typically
* there. Even if user switches native IME context, it's very rare that
* second or more composition is started.
* It's assumed that this is used by nsIMEStateManager for storing all active
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -129,16 +129,17 @@
#include "StructuredCloneUtils.h"
#include "URIUtils.h"
#include "nsContentUtils.h"
#include "nsIPrincipal.h"
#include "nsDeviceStorage.h"
#include "AudioChannelService.h"
#include "JavaScriptChild.h"
#include "mozilla/dom/telephony/PTelephonyChild.h"
+#include "mozilla/dom/time/DateCacheCleaner.h"
#include "mozilla/net/NeckoMessageUtils.h"
using namespace base;
using namespace mozilla;
using namespace mozilla::docshell;
using namespace mozilla::dom::bluetooth;
using namespace mozilla::dom::devicestorage;
using namespace mozilla::dom::ipc;
@@ -306,16 +307,25 @@ SystemMessageHandledObserver::Observe(ns
}
return NS_OK;
}
NS_IMPL_ISUPPORTS1(SystemMessageHandledObserver, nsIObserver)
ContentChild* ContentChild::sSingleton;
+// Performs initialization that is not fork-safe, i.e. that must be done after
+// forking from the Nuwa process.
+static void
+InitOnContentProcessCreated()
+{
+ // This will register cross-process observer.
+ mozilla::dom::time::InitializeDateCacheCleaner();
+}
+
ContentChild::ContentChild()
: mID(uint64_t(-1))
#ifdef ANDROID
,mScreenSize(0, 0)
#endif
{
// This process is a content process, so it's clearly running in
// multiprocess mode!
@@ -457,16 +467,20 @@ ContentChild::InitXPCOM()
DebugOnly<FileUpdateDispatcher*> observer = FileUpdateDispatcher::GetSingleton();
NS_ASSERTION(observer, "FileUpdateDispatcher is null");
// This object is held alive by the observer service.
nsRefPtr<SystemMessageHandledObserver> sysMsgObserver =
new SystemMessageHandledObserver();
sysMsgObserver->Init();
+
+#ifndef MOZ_NUWA_PROCESS
+ InitOnContentProcessCreated();
+#endif
}
PMemoryReportRequestChild*
ContentChild::AllocPMemoryReportRequestChild(const uint32_t& generation)
{
return new MemoryReportRequestChild();
}
@@ -1618,16 +1632,20 @@ public:
IToplevelProtocol* toplevel = child->GetFirstOpenedActors();
while (toplevel != nullptr) {
transport = toplevel->GetTransport();
fd = transport->GetFileDescriptor();
transport->ResetFileDescriptor(fd);
toplevel = toplevel->getNext();
}
+
+ // Perform other after-fork initializations.
+ InitOnContentProcessCreated();
+
return NS_OK;
}
};
static void
DoNuwaFork()
{
NS_ASSERTION(NuwaSpawnPrepare != nullptr,
--- a/dom/ipc/CrashReporterParent.cpp
+++ b/dom/ipc/CrashReporterParent.cpp
@@ -61,17 +61,17 @@ CrashReporterParent::CloneProtocol(Chann
#endif
}
CrashReporterParent::CrashReporterParent()
:
#ifdef MOZ_CRASHREPORTER
mNotes(4),
#endif
- mStartTime(time(nullptr))
+ mStartTime(::time(nullptr))
, mInitialized(false)
{
MOZ_COUNT_CTOR(CrashReporterParent);
}
CrashReporterParent::~CrashReporterParent()
{
MOZ_COUNT_DTOR(CrashReporterParent);
--- a/dom/media/GetUserMediaRequest.cpp
+++ b/dom/media/GetUserMediaRequest.cpp
@@ -12,51 +12,56 @@
namespace mozilla {
namespace dom {
GetUserMediaRequest::GetUserMediaRequest(
nsPIDOMWindow* aInnerWindow,
const nsAString& aCallID,
const MediaStreamConstraintsInternal& aConstraints)
- : mInnerWindow(aInnerWindow)
- , mWindowID(aInnerWindow->GetOuterWindow()->WindowID())
+ : mInnerWindowID(aInnerWindow->WindowID())
+ , mOuterWindowID(aInnerWindow->GetOuterWindow()->WindowID())
, mCallID(aCallID)
, mConstraints(aConstraints)
{
SetIsDOMBinding();
}
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(GetUserMediaRequest, mInnerWindow)
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(GetUserMediaRequest)
NS_IMPL_CYCLE_COLLECTING_ADDREF(GetUserMediaRequest)
NS_IMPL_CYCLE_COLLECTING_RELEASE(GetUserMediaRequest)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(GetUserMediaRequest)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
JSObject*
GetUserMediaRequest::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
{
return GetUserMediaRequestBinding::Wrap(aCx, aScope, this);
}
nsISupports* GetUserMediaRequest::GetParentObject()
{
- return mInnerWindow;
+ return nullptr;
}
void GetUserMediaRequest::GetCallID(nsString& retval)
{
retval = mCallID;
}
uint64_t GetUserMediaRequest::WindowID()
{
- return mWindowID;
+ return mOuterWindowID;
+}
+
+uint64_t GetUserMediaRequest::InnerWindowID()
+{
+ return mInnerWindowID;
}
void
GetUserMediaRequest::GetConstraints(MediaStreamConstraintsInternal &result)
{
result = mConstraints;
}
--- a/dom/media/GetUserMediaRequest.h
+++ b/dom/media/GetUserMediaRequest.h
@@ -15,34 +15,35 @@
namespace mozilla {
namespace dom {
class MediaStreamConstraintsInternal;
class GetUserMediaRequest : public nsISupports, public nsWrapperCache
{
public:
- GetUserMediaRequest(nsPIDOMWindow* aInnerWindow, const nsAString& aCallID,
+ GetUserMediaRequest(nsPIDOMWindow* aInnerWindow,
+ const nsAString& aCallID,
const MediaStreamConstraintsInternal& aConstraints);
virtual ~GetUserMediaRequest() {};
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(GetUserMediaRequest)
virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> scope)
MOZ_OVERRIDE;
nsISupports* GetParentObject();
uint64_t WindowID();
+ uint64_t InnerWindowID();
void GetCallID(nsString& retval);
void GetConstraints(MediaStreamConstraintsInternal &result);
private:
- nsCOMPtr<nsPIDOMWindow> mInnerWindow;
- uint64_t mWindowID;
+ uint64_t mInnerWindowID, mOuterWindowID;
const nsString mCallID;
MediaStreamConstraintsInternal mConstraints;
};
} // namespace dom
} // namespace mozilla
#endif // GetUserMediaRequest_h__
--- a/dom/media/MediaManager.cpp
+++ b/dom/media/MediaManager.cpp
@@ -220,31 +220,39 @@ private:
* Invoke the GetUserMediaDevices success callback. Wrapped in a runnable
* so that it may be called on the main thread. The error callback is also
* passed so it can be released correctly.
*/
class DeviceSuccessCallbackRunnable: public nsRunnable
{
public:
DeviceSuccessCallbackRunnable(
+ uint64_t aWindowID,
already_AddRefed<nsIGetUserMediaDevicesSuccessCallback> aSuccess,
already_AddRefed<nsIDOMGetUserMediaErrorCallback> aError,
nsTArray<nsCOMPtr<nsIMediaDevice> >* aDevices)
: mSuccess(aSuccess)
, mError(aError)
- , mDevices(aDevices) {}
+ , mDevices(aDevices)
+ , mWindowID(aWindowID)
+ , mManager(MediaManager::GetInstance()) {}
NS_IMETHOD
Run()
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
nsCOMPtr<nsIGetUserMediaDevicesSuccessCallback> success(mSuccess);
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> error(mError);
+ // Only run if window is still on our active list.
+ if (!mManager->IsWindowStillActive(mWindowID)) {
+ return NS_OK;
+ }
+
nsCOMPtr<nsIWritableVariant> devices =
do_CreateInstance("@mozilla.org/variant;1");
int32_t len = mDevices->Length();
if (len == 0) {
// XXX
// We should in the future return an empty array, and dynamically add
// devices to the dropdowns if things are hotplugged while the
@@ -268,16 +276,18 @@ public:
success->OnSuccess(devices);
return NS_OK;
}
private:
already_AddRefed<nsIGetUserMediaDevicesSuccessCallback> mSuccess;
already_AddRefed<nsIDOMGetUserMediaErrorCallback> mError;
nsAutoPtr<nsTArray<nsCOMPtr<nsIMediaDevice> > > mDevices;
+ uint64_t mWindowID;
+ nsRefPtr<MediaManager> mManager;
};
// Handle removing GetUserMediaCallbackMediaStreamListener from main thread
class GetUserMediaListenerRemove: public nsRunnable
{
public:
GetUserMediaListenerRemove(uint64_t aWindowID,
GetUserMediaCallbackMediaStreamListener *aListener)
@@ -1071,27 +1081,29 @@ public:
&MediaEngine::EnumerateVideoDevices,
mLoopbackVideoDevice));
{
ScopedDeletePtr<SourceSet> s (GetSources(backend, mConstraints.mAudiom,
&MediaEngine::EnumerateAudioDevices,
mLoopbackAudioDevice));
final->MoveElementsFrom(*s);
}
- NS_DispatchToMainThread(new DeviceSuccessCallbackRunnable(mSuccess, mError,
+ NS_DispatchToMainThread(new DeviceSuccessCallbackRunnable(mWindowId,
+ mSuccess, mError,
final.forget()));
return NS_OK;
}
private:
MediaStreamConstraintsInternal mConstraints;
already_AddRefed<nsIGetUserMediaDevicesSuccessCallback> mSuccess;
already_AddRefed<nsIDOMGetUserMediaErrorCallback> mError;
nsRefPtr<MediaManager> mManager;
uint64_t mWindowId;
+ const nsString mCallId;
// Audio & Video loopback devices to be used based on
// the preference settings. This is currently used for
// automated media tests only.
char* mLoopbackAudioDevice;
char* mLoopbackVideoDevice;
};
MediaManager::MediaManager()
@@ -1444,17 +1456,18 @@ MediaManager::GetUserMedia(JSContext* aC
return NS_OK;
}
nsresult
MediaManager::GetUserMediaDevices(nsPIDOMWindow* aWindow,
const MediaStreamConstraintsInternal& aConstraints,
nsIGetUserMediaDevicesSuccessCallback* aOnSuccess,
- nsIDOMGetUserMediaErrorCallback* aOnError)
+ nsIDOMGetUserMediaErrorCallback* aOnError,
+ uint64_t aInnerWindowID)
{
NS_ASSERTION(NS_IsMainThread(), "Only call on main thread");
NS_ENSURE_TRUE(aOnError, NS_ERROR_NULL_POINTER);
NS_ENSURE_TRUE(aOnSuccess, NS_ERROR_NULL_POINTER);
nsCOMPtr<nsIGetUserMediaDevicesSuccessCallback> onSuccess(aOnSuccess);
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> onError(aOnError);
@@ -1469,19 +1482,19 @@ MediaManager::GetUserMediaDevices(nsPIDO
if (branch) {
branch->GetCharPref("media.audio_loopback_dev", &loopbackAudioDevice);
branch->GetCharPref("media.video_loopback_dev", &loopbackVideoDevice);
}
}
#endif
nsCOMPtr<nsIRunnable> gUMDRunnable = new GetUserMediaDevicesRunnable(
- aConstraints, onSuccess.forget(), onError.forget(), aWindow->WindowID(),
- loopbackAudioDevice, loopbackVideoDevice
- );
+ aConstraints, onSuccess.forget(), onError.forget(),
+ (aInnerWindowID ? aInnerWindowID : aWindow->WindowID()),
+ loopbackAudioDevice, loopbackVideoDevice);
nsCOMPtr<nsIThread> deviceThread;
rv = NS_NewThread(getter_AddRefs(deviceThread));
NS_ENSURE_SUCCESS(rv, rv);
deviceThread->Dispatch(gUMDRunnable, NS_DISPATCH_NORMAL);
return NS_OK;
--- a/dom/media/MediaManager.h
+++ b/dom/media/MediaManager.h
@@ -489,17 +489,18 @@ public:
nsPIDOMWindow* aWindow,
const dom::MediaStreamConstraints& aRawConstraints,
nsIDOMGetUserMediaSuccessCallback* onSuccess,
nsIDOMGetUserMediaErrorCallback* onError);
nsresult GetUserMediaDevices(nsPIDOMWindow* aWindow,
const dom::MediaStreamConstraintsInternal& aConstraints,
nsIGetUserMediaDevicesSuccessCallback* onSuccess,
- nsIDOMGetUserMediaErrorCallback* onError);
+ nsIDOMGetUserMediaErrorCallback* onError,
+ uint64_t aInnerWindowID = 0);
void OnNavigation(uint64_t aWindowID);
MediaEnginePrefs mPrefs;
private:
WindowTable *GetActiveWindows() {
NS_ASSERTION(NS_IsMainThread(), "Only access windowlist on main thread");
return &mActiveWindows;
--- a/dom/media/MediaPermissionGonk.cpp
+++ b/dom/media/MediaPermissionGonk.cpp
@@ -168,31 +168,33 @@ MediaPermissionRequest::GetTypes(nsIArra
return NS_OK;
}
NS_IMETHODIMP
MediaPermissionRequest::GetPrincipal(nsIPrincipal **aRequestingPrincipal)
{
NS_ENSURE_ARG_POINTER(aRequestingPrincipal);
- nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(mRequest->GetParentObject());
+ nsCOMPtr<nsPIDOMWindow> window = static_cast<nsPIDOMWindow*>
+ (nsGlobalWindow::GetInnerWindowWithId(mRequest->InnerWindowID()));
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
NS_ADDREF(*aRequestingPrincipal = doc->NodePrincipal());
return NS_OK;
}
NS_IMETHODIMP
MediaPermissionRequest::GetWindow(nsIDOMWindow** aRequestingWindow)
{
NS_ENSURE_ARG_POINTER(aRequestingWindow);
- nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(mRequest->GetParentObject());
+ nsCOMPtr<nsPIDOMWindow> window = static_cast<nsPIDOMWindow*>
+ (nsGlobalWindow::GetInnerWindowWithId(mRequest->InnerWindowID()));
window.forget(aRequestingWindow);
return NS_OK;
}
NS_IMETHODIMP
MediaPermissionRequest::GetElement(nsIDOMElement** aRequestingElement)
{
NS_ENSURE_ARG_POINTER(aRequestingElement);
@@ -216,17 +218,18 @@ MediaPermissionRequest::Allow()
mRequest->GetCallID(callID);
NotifyPermissionAllow(callID, mDevices);
return NS_OK;
}
already_AddRefed<nsPIDOMWindow>
MediaPermissionRequest::GetOwner()
{
- nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(mRequest->GetParentObject());
+ nsCOMPtr<nsPIDOMWindow> window = static_cast<nsPIDOMWindow*>
+ (nsGlobalWindow::GetInnerWindowWithId(mRequest->InnerWindowID()));
return window.forget();
}
//PCOMContentPermissionRequestChild
bool
MediaPermissionRequest::Recv__delete__(const bool& allow)
{
if (allow) {
@@ -429,17 +432,18 @@ MediaPermissionManager::Observe(nsISuppo
// Handle GetUserMediaRequest, query available media device first.
nsresult
MediaPermissionManager::HandleRequest(nsRefPtr<dom::GetUserMediaRequest> &req)
{
nsString callID;
req->GetCallID(callID);
- nsCOMPtr<nsPIDOMWindow> innerWindow = do_QueryInterface(req->GetParentObject());
+ nsCOMPtr<nsPIDOMWindow> innerWindow = static_cast<nsPIDOMWindow*>
+ (nsGlobalWindow::GetInnerWindowWithId(req->InnerWindowID()));
if (!innerWindow) {
MOZ_ASSERT(false, "No inner window");
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIGetUserMediaDevicesSuccessCallback> onSuccess =
new MediaDeviceSuccessCallback(req);
nsCOMPtr<nsIDOMGetUserMediaErrorCallback> onError =
--- a/dom/media/tests/mochitest/pc.js
+++ b/dom/media/tests/mochitest/pc.js
@@ -1096,20 +1096,26 @@ function PeerConnectionWrapper(label, co
/**
* Callback for native peer connection 'onaddstream' events.
*
* @param {Object} event
* Event data which includes the stream to be added
*/
this._pc.onaddstream = function (event) {
- info(self + ": 'onaddstream' event fired for " + event.stream);
+ info(self + ": 'onaddstream' event fired for " + JSON.stringify(event.stream));
- // TODO: Bug 834835 - Assume type is video until we get get{Audio,Video}Tracks.
- self.attachMedia(event.stream, 'video', 'remote');
+ var type = '';
+ if (event.stream.getAudioTracks().length > 0) {
+ type = 'audio';
+ }
+ if (event.stream.getVideoTracks().length > 0) {
+ type += 'video';
+ }
+ self.attachMedia(event.stream, type, 'remote');
};
/**
* Callback for native peer connection 'ondatachannel' events. If no custom handler
* has been specified via 'this.ondatachannel', a failure will be raised if an
* event of this type gets caught.
*
* @param {Object} event
--- a/dom/network/src/NetworkStatsDB.jsm
+++ b/dom/network/src/NetworkStatsDB.jsm
@@ -74,17 +74,25 @@ NetworkStatsDB.prototype = {
// In order to support per-app traffic data storage, the original
// objectStore needs to be replaced by a new objectStore with new
// key path ("appId") and new index ("appId").
// Also, since now networks are identified by their
// [networkId, networkType] not just by their connectionType,
// to modify the keyPath is mandatory to delete the object store
// and create it again. Old data is going to be deleted because the
// networkId for each sample can not be set.
- db.deleteObjectStore(DEPRECATED_STORE_NAME);
+
+ // In version 1.2 objectStore name was 'net_stats_v2', to avoid errors when
+ // upgrading from 1.2 to 1.3 objectStore name should be checked.
+ let stores = db.objectStoreNames;
+ if(stores.contains("net_stats_v2")) {
+ db.deleteObjectStore("net_stats_v2");
+ } else {
+ db.deleteObjectStore(DEPRECATED_STORE_NAME);
+ }
objectStore = db.createObjectStore(DEPRECATED_STORE_NAME, { keyPath: ["appId", "network", "timestamp"] });
objectStore.createIndex("appId", "appId", { unique: false });
objectStore.createIndex("network", "network", { unique: false });
objectStore.createIndex("networkType", "networkType", { unique: false });
objectStore.createIndex("timestamp", "timestamp", { unique: false });
objectStore.createIndex("rxBytes", "rxBytes", { unique: false });
objectStore.createIndex("txBytes", "txBytes", { unique: false });
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -17,16 +17,17 @@
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Sntp.jsm");
Cu.import("resource://gre/modules/systemlibs.js");
Cu.import("resource://gre/modules/Promise.jsm");
+Cu.import("resource://gre/modules/FileUtils.jsm");
var RIL = {};
Cu.import("resource://gre/modules/ril_consts.js", RIL);
// set to true in ril_consts.js to see debug messages
var DEBUG = RIL.DEBUG_RIL;
// Read debug setting from pref
@@ -3294,16 +3295,26 @@ RadioInterface.prototype = {
Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED) {
// Set the latest cached SNTP time if it's available.
if (!this._sntp.isExpired()) {
this.setClockBySntp(this._sntp.getOffset());
} else {
// Or refresh the SNTP.
this._sntp.request();
}
+ } else {
+ // Set a sane minimum time.
+ let buildTime = libcutils.property_get("ro.build.date.utc", "0") * 1000;
+ let file = FileUtils.File("/system/b2g/b2g");
+ if (file.lastModifiedTime > buildTime) {
+ buildTime = file.lastModifiedTime;
+ }
+ if (buildTime > Date.now()) {
+ gTimeService.set(buildTime);
+ }
}
break;
case kSettingsTimezoneAutoUpdateEnabled:
this._timezoneAutoUpdateEnabled = aResult;
if (this._timezoneAutoUpdateEnabled) {
// Apply the latest cached NITZ for timezone if it's available.
if (this._timezoneAutoUpdateEnabled && this._lastNitzMessage) {
--- a/dom/webidl/GetUserMediaRequest.webidl
+++ b/dom/webidl/GetUserMediaRequest.webidl
@@ -4,11 +4,12 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This is an internal IDL file
*/
[NoInterfaceObject]
interface GetUserMediaRequest {
readonly attribute unsigned long long windowID;
+ readonly attribute unsigned long long innerWindowID;
readonly attribute DOMString callID;
MediaStreamConstraintsInternal getConstraints();
};
--- a/dom/webidl/Navigator.webidl
+++ b/dom/webidl/Navigator.webidl
@@ -335,11 +335,15 @@ partial interface Navigator {
};
// nsINavigatorUserMedia
callback MozGetUserMediaDevicesSuccessCallback = void (nsIVariant? devices);
partial interface Navigator {
[Throws, ChromeOnly]
void mozGetUserMediaDevices(MediaStreamConstraintsInternal constraints,
MozGetUserMediaDevicesSuccessCallback onsuccess,
- NavigatorUserMediaErrorCallback onerror);
+ NavigatorUserMediaErrorCallback onerror,
+ // The originating innerWindowID is needed to
+ // avoid calling the callbacks if the window has
+ // navigated away. It is optional only as legacy.
+ optional unsigned long long innerWindowID = 0);
};
#endif // MOZ_MEDIA_NAVIGATOR
--- a/dom/webidl/RTCStatsReport.webidl
+++ b/dom/webidl/RTCStatsReport.webidl
@@ -32,16 +32,17 @@ dictionary RTCRTPStreamStats : RTCStats
DOMString transportId;
DOMString codecId;
};
dictionary RTCInboundRTPStreamStats : RTCRTPStreamStats {
unsigned long packetsReceived;
unsigned long long bytesReceived;
double jitter;
+ unsigned long packetsLost;
};
dictionary RTCOutboundRTPStreamStats : RTCRTPStreamStats {
unsigned long packetsSent;
unsigned long long bytesSent;
};
dictionary RTCMediaStreamTrackStats : RTCStats {
--- a/gfx/gl/GLReadTexImageHelper.cpp
+++ b/gfx/gl/GLReadTexImageHelper.cpp
@@ -77,23 +77,22 @@ readTextureImageFS_TEXTURE_RECTANGLE[] =
"#ifdef GL_ES\n"
"precision mediump float;\n"
"#endif\n"
"varying vec2 vTexCoord;\n"
"uniform sampler2DRect uTexture;\n"
"void main() { gl_FragColor = texture2DRect(uTexture, vTexCoord).bgra; }";
GLuint
-GLReadTexImageHelper::TextureImageProgramFor(GLenum aTextureTarget, int aShader) {
+GLReadTexImageHelper::TextureImageProgramFor(GLenum aTextureTarget, int aConfig) {
int variant = 0;
const GLchar* readTextureImageFS = nullptr;
if (aTextureTarget == LOCAL_GL_TEXTURE_2D)
{
- if (aShader == layers::BGRALayerProgramType ||
- aShader == layers::BGRXLayerProgramType)
+ if (aConfig & mozilla::layers::ENABLE_TEXTURE_RB_SWAP)
{ // Need to swizzle R/B.
readTextureImageFS = readTextureImageFS_TEXTURE_2D_BGRA;
variant = 1;
}
else
{
readTextureImageFS = readTextureImageFS_TEXTURE_2D;
variant = 0;
@@ -519,22 +518,19 @@ ReadScreenIntoImageSurface(GLContext* gl
isurf = nullptr; \
break; \
}
already_AddRefed<gfxImageSurface>
GLReadTexImageHelper::ReadTexImage(GLuint aTextureId,
GLenum aTextureTarget,
const gfxIntSize& aSize,
- /* ShaderProgramType */ int aShaderProgram,
+ /* ShaderConfigOGL.mFeature */ int aConfig,
bool aYInvert)
{
- // Check aShaderProgram is in bounds for a layers::ShaderProgramType
- MOZ_ASSERT(0 <= aShaderProgram && aShaderProgram < layers::NumProgramTypes);
-
MOZ_ASSERT(aTextureTarget == LOCAL_GL_TEXTURE_2D ||
aTextureTarget == LOCAL_GL_TEXTURE_EXTERNAL ||
aTextureTarget == LOCAL_GL_TEXTURE_RECTANGLE_ARB);
mGL->MakeCurrent();
/* Allocate resulting image surface */
nsRefPtr<gfxImageSurface> isurf = new gfxImageSurface(aSize, gfxImageFormat::ARGB32);
@@ -585,18 +581,17 @@ GLReadTexImageHelper::ReadTexImage(GLuin
mGL->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, fb);
mGL->fFramebufferRenderbuffer(LOCAL_GL_FRAMEBUFFER, LOCAL_GL_COLOR_ATTACHMENT0,
LOCAL_GL_RENDERBUFFER, rb);
CLEANUP_IF_GLERROR_OCCURRED("when binding and creating framebuffer");
MOZ_ASSERT(mGL->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER) == LOCAL_GL_FRAMEBUFFER_COMPLETE);
/* Setup vertex and fragment shader */
- layers::ShaderProgramType shaderProgram = (layers::ShaderProgramType) aShaderProgram;
- GLuint program = TextureImageProgramFor(aTextureTarget, shaderProgram);
+ GLuint program = TextureImageProgramFor(aTextureTarget, aConfig);
MOZ_ASSERT(program);
mGL->fUseProgram(program);
CLEANUP_IF_GLERROR_OCCURRED("when using program");
mGL->fUniform1i(mGL->fGetUniformLocation(program, "uTexture"), 0);
CLEANUP_IF_GLERROR_OCCURRED("when setting uniform location");
/* Setup quad geometry */
--- a/gfx/gl/SharedSurfaceGralloc.cpp
+++ b/gfx/gl/SharedSurfaceGralloc.cpp
@@ -75,17 +75,17 @@ SharedSurface_Gralloc::Create(GLContext*
return nullptr;
gfxContentType type = hasAlpha ? gfxContentType::COLOR_ALPHA
: gfxContentType::COLOR;
gfxImageFormat format
= gfxPlatform::GetPlatform()->OptimalFormatForContent(type);
- GrallocTextureClientOGL* grallocTC =
+ RefPtr<GrallocTextureClientOGL> grallocTC =
new GrallocTextureClientOGL(
allocator,
gfx::ImageFormatToSurfaceFormat(format),
TEXTURE_FLAGS_DEFAULT);
if (!grallocTC->AllocateForGLRendering(size)) {
return nullptr;
}
@@ -97,17 +97,16 @@ SharedSurface_Gralloc::Create(GLContext*
EGLint attrs[] = {
LOCAL_EGL_NONE, LOCAL_EGL_NONE
};
EGLImage image = egl->fCreateImage(display,
EGL_NO_CONTEXT,
LOCAL_EGL_NATIVE_BUFFER_ANDROID,
clientBuffer, attrs);
if (!image) {
- grallocTC->DropTextureData()->DeallocateSharedData(allocator);
return nullptr;
}
prodGL->MakeCurrent();
GLuint prodTex = 0;
prodGL->fGenTextures(1, &prodTex);
ScopedBindTexture autoTex(prodGL, prodTex);
--- a/gfx/layers/CompositorTypes.h
+++ b/gfx/layers/CompositorTypes.h
@@ -119,20 +119,17 @@ const DiagnosticFlags DIAGNOSTIC_REGION_
/**
* See gfx/layers/Effects.h
*/
enum EffectTypes
{
EFFECT_MASK,
EFFECT_MAX_SECONDARY, // sentinel for the count of secondary effect types
- EFFECT_BGRX,
- EFFECT_RGBX,
- EFFECT_BGRA,
- EFFECT_RGBA,
+ EFFECT_RGB,
EFFECT_YCBCR,
EFFECT_COMPONENT_ALPHA,
EFFECT_SOLID_COLOR,
EFFECT_RENDER_TARGET,
EFFECT_MAX //sentinel for the count of all effect types
};
/**
--- a/gfx/layers/Effects.h
+++ b/gfx/layers/Effects.h
@@ -100,59 +100,26 @@ struct EffectRenderTarget : public Textu
{}
virtual const char* Name() { return "EffectRenderTarget"; }
virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
RefPtr<CompositingRenderTarget> mRenderTarget;
};
-struct EffectBGRX : public TexturedEffect
+struct EffectRGB : public TexturedEffect
{
- EffectBGRX(TextureSource *aBGRXTexture,
- bool aPremultiplied,
- gfx::Filter aFilter,
- bool aFlipped = false)
- : TexturedEffect(EFFECT_BGRX, aBGRXTexture, aPremultiplied, aFilter)
- {}
-
- virtual const char* Name() { return "EffectBGRX"; }
-};
-
-struct EffectRGBX : public TexturedEffect
-{
- EffectRGBX(TextureSource *aRGBXTexture,
- bool aPremultiplied,
- gfx::Filter aFilter)
- : TexturedEffect(EFFECT_RGBX, aRGBXTexture, aPremultiplied, aFilter)
+ EffectRGB(TextureSource *aTexture,
+ bool aPremultiplied,
+ gfx::Filter aFilter,
+ bool aFlipped = false)
+ : TexturedEffect(EFFECT_RGB, aTexture, aPremultiplied, aFilter)
{}
- virtual const char* Name() { return "EffectRGBX"; }
-};
-
-struct EffectBGRA : public TexturedEffect
-{
- EffectBGRA(TextureSource *aBGRATexture,
- bool aPremultiplied,
- gfx::Filter aFilter)
- : TexturedEffect(EFFECT_BGRA, aBGRATexture, aPremultiplied, aFilter)
- {}
-
- virtual const char* Name() { return "EffectBGRA"; }
-};
-
-struct EffectRGBA : public TexturedEffect
-{
- EffectRGBA(TextureSource *aRGBATexture,
- bool aPremultiplied,
- gfx::Filter aFilter)
- : TexturedEffect(EFFECT_RGBA, aRGBATexture, aPremultiplied, aFilter)
- {}
-
- virtual const char* Name() { return "EffectRGBA"; }
+ virtual const char* Name() { return "EffectRGB"; }
};
struct EffectYCbCr : public TexturedEffect
{
EffectYCbCr(TextureSource *aSource, gfx::Filter aFilter)
: TexturedEffect(EFFECT_YCBCR, aSource, false, aFilter)
{}
@@ -210,29 +177,21 @@ inline TemporaryRef<TexturedEffect>
CreateTexturedEffect(gfx::SurfaceFormat aFormat,
TextureSource* aSource,
const gfx::Filter& aFilter)
{
MOZ_ASSERT(aSource);
RefPtr<TexturedEffect> result;
switch (aFormat) {
case gfx::SurfaceFormat::B8G8R8A8:
- result = new EffectBGRA(aSource, true, aFilter);
- break;
case gfx::SurfaceFormat::B8G8R8X8:
- result = new EffectBGRX(aSource, true, aFilter);
- break;
case gfx::SurfaceFormat::R8G8B8X8:
- result = new EffectRGBX(aSource, true, aFilter);
- break;
case gfx::SurfaceFormat::R5G6B5:
- result = new EffectRGBX(aSource, true, aFilter);
- break;
case gfx::SurfaceFormat::R8G8B8A8:
- result = new EffectRGBA(aSource, true, aFilter);
+ result = new EffectRGB(aSource, true, aFilter);
break;
case gfx::SurfaceFormat::YUV:
result = new EffectYCbCr(aSource, aFilter);
break;
default:
NS_WARNING("unhandled program type");
break;
}
--- a/gfx/layers/GrallocImages.cpp
+++ b/gfx/layers/GrallocImages.cpp
@@ -87,16 +87,19 @@ GrallocImage::SetData(const Data& aData)
SurfaceDescriptor desc;
ImageBridgeChild *ibc = ImageBridgeChild::GetSingleton();
ibc->AllocSurfaceDescriptorGralloc(aData.mYSize,
HAL_PIXEL_FORMAT_YV12,
GraphicBuffer::USAGE_SW_READ_OFTEN |
GraphicBuffer::USAGE_SW_WRITE_OFTEN |
GraphicBuffer::USAGE_HW_TEXTURE,
&desc);
+ if (desc.type() == SurfaceDescriptor::T__None) {
+ return;
+ }
mBufferAllocated = true;
mGraphicBufferLocked = new GraphicBufferLocked(desc);
}
sp<GraphicBuffer> graphicBuffer =
GrallocBufferActor::GetFrom(
mGraphicBufferLocked->GetSurfaceDescriptor().get_SurfaceDescriptorGralloc());
if (!graphicBuffer.get()) {
--- a/gfx/layers/ImageContainer.cpp
+++ b/gfx/layers/ImageContainer.cpp
@@ -43,23 +43,16 @@ using namespace mozilla::gfx;
namespace mozilla {
namespace layers {
Atomic<int32_t> Image::sSerialCounter(0);
-TemporaryRef<gfx::SourceSurface>
-Image::GetAsSourceSurface()
-{
- nsRefPtr<gfxASurface> surface = DeprecatedGetAsSurface();
- return gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(nullptr, surface);
-}
-
already_AddRefed<Image>
ImageFactory::CreateImage(ImageFormat aFormat,
const gfx::IntSize &,
BufferRecycleBin *aRecycleBin)
{
nsRefPtr<Image> img;
#ifdef MOZ_WIDGET_GONK
if (aFormat == ImageFormat::GRALLOC_PLANAR_YCBCR) {
--- a/gfx/layers/ImageContainer.h
+++ b/gfx/layers/ImageContainer.h
@@ -208,17 +208,17 @@ public:
void SetBackendData(LayersBackend aBackend, ImageBackendData* aData)
{ mBackendData[size_t(aBackend)] = aData; }
int32_t GetSerial() { return mSerial; }
void MarkSent() { mSent = true; }
bool IsSentToCompositor() { return mSent; }
- virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface();
+ virtual TemporaryRef<gfx::SourceSurface> GetAsSourceSurface() = 0;
protected:
Image(void* aImplData, ImageFormat aFormat) :
mImplData(aImplData),
mSerial(++sSerialCounter),
mFormat(aFormat),
mSent(false)
{}
--- a/gfx/layers/LayerScope.cpp
+++ b/gfx/layers/LayerScope.cpp
@@ -696,19 +696,19 @@ SendColor(void* aLayerRef, const gfxRGBA
static void
SendTextureSource(GLContext* aGLContext,
void* aLayerRef,
TextureSourceOGL* aSource,
bool aFlipY)
{
GLenum textureTarget = aSource->GetTextureTarget();
- int shaderProgram =
- (int) ShaderProgramFromTargetAndFormat(textureTarget,
- aSource->GetFormat());
+ ShaderConfigOGL config = ShaderConfigFromTargetAndFormat(textureTarget,
+ aSource->GetFormat());
+ int shaderConfig = config.mFeatures;
aSource->BindTexture(LOCAL_GL_TEXTURE0);
GLuint textureId = 0;
// This is horrid hack. It assumes that aGLContext matches the context
// aSource has bound to.
if (textureTarget == LOCAL_GL_TEXTURE_2D) {
aGLContext->GetUIntegerv(LOCAL_GL_TEXTURE_BINDING_2D, &textureId);
@@ -720,17 +720,17 @@ SendTextureSource(GLContext* aGLContext,
gfx::IntSize size = aSource->GetSize();
// By sending 0 to ReadTextureImage rely upon aSource->BindTexture binding
// texture correctly. textureId is used for tracking in DebugGLTextureData.
nsRefPtr<gfxImageSurface> img =
aGLContext->ReadTexImageHelper()->ReadTexImage(0, textureTarget,
gfxIntSize(size.width, size.height),
- shaderProgram, aFlipY);
+ shaderConfig, aFlipY);
gLayerScopeWebSocketManager->AppendDebugData(
new DebugGLTextureData(aGLContext, aLayerRef, textureTarget,
textureId, img));
}
static void
SendTexturedEffect(GLContext* aGLContext,
@@ -770,20 +770,17 @@ LayerScope::SendEffectChain(GLContext* a
const EffectChain& aEffectChain,
int aWidth, int aHeight)
{
if (!CheckSender())
return;
const Effect* primaryEffect = aEffectChain.mPrimaryEffect;
switch (primaryEffect->mType) {
- case EFFECT_BGRX:
- case EFFECT_RGBX:
- case EFFECT_BGRA:
- case EFFECT_RGBA:
+ case EFFECT_RGB:
{
const TexturedEffect* texturedEffect =
static_cast<const TexturedEffect*>(primaryEffect);
SendTexturedEffect(aGLContext, aEffectChain.mLayerRef, texturedEffect);
}
break;
case EFFECT_YCBCR:
{
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -477,20 +477,17 @@ BasicCompositor::DrawQuad(const gfx::Rec
EffectSolidColor* effectSolidColor =
static_cast<EffectSolidColor*>(aEffectChain.mPrimaryEffect.get());
dest->FillRect(aRect,
ColorPattern(effectSolidColor->mColor),
DrawOptions(aOpacity));
break;
}
- case EFFECT_BGRA:
- case EFFECT_BGRX:
- case EFFECT_RGBA:
- case EFFECT_RGBX: {
+ case EFFECT_RGB: {
TexturedEffect* texturedEffect =
static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
TextureSourceBasic* source = texturedEffect->mTexture->AsSourceBasic();
DrawSurfaceWithTextureCoords(dest, aRect,
source->GetSurface(),
texturedEffect->mTextureCoords,
texturedEffect->mFilter,
--- a/gfx/layers/client/CanvasClient.cpp
+++ b/gfx/layers/client/CanvasClient.cpp
@@ -127,17 +127,17 @@ CanvasClientSurfaceStream::Update(gfx::I
if (surf->Type() != SharedSurfaceType::Gralloc) {
printf_stderr("Unexpected non-Gralloc SharedSurface in IPC path!");
MOZ_ASSERT(false);
return;
}
SharedSurface_Gralloc* grallocSurf = SharedSurface_Gralloc::Cast(surf);
- GrallocTextureClientOGL* grallocTextureClient =
+ RefPtr<GrallocTextureClientOGL> grallocTextureClient =
static_cast<GrallocTextureClientOGL*>(grallocSurf->GetTextureClient());
// If IPDLActor is null means this TextureClient didn't AddTextureClient yet
if (!grallocTextureClient->GetIPDLActor()) {
grallocTextureClient->SetTextureFlags(mTextureInfo.mTextureFlags);
AddTextureClient(grallocTextureClient);
}
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -456,28 +456,29 @@ CompositorD3D11::SetRenderTarget(Composi
static_cast<CompositingRenderTargetD3D11*>(aRenderTarget);
ID3D11RenderTargetView* view = newRT->mRTView;
mCurrentRT = newRT;
mContext->OMSetRenderTargets(1, &view, nullptr);
PrepareViewport(newRT->GetSize(), gfx::Matrix());
}
void
-CompositorD3D11::SetPSForEffect(Effect* aEffect, MaskType aMaskType)
+CompositorD3D11::SetPSForEffect(Effect* aEffect, MaskType aMaskType, gfx::SurfaceFormat aFormat)
{
switch (aEffect->mType) {
case EFFECT_SOLID_COLOR:
mContext->PSSetShader(mAttachments->mSolidColorShader[aMaskType], nullptr, 0);
return;
- case EFFECT_BGRA:
case EFFECT_RENDER_TARGET:
mContext->PSSetShader(mAttachments->mRGBAShader[aMaskType], nullptr, 0);
return;
- case EFFECT_BGRX:
- mContext->PSSetShader(mAttachments->mRGBShader[aMaskType], nullptr, 0);
+ case EFFECT_RGB:
+ mContext->PSSetShader((aFormat == SurfaceFormat::B8G8R8A8 || aFormat == SurfaceFormat::R8G8B8A8)
+ ? mAttachments->mRGBAShader[aMaskType]
+ : mAttachments->mRGBShader[aMaskType], nullptr, 0);
return;
case EFFECT_YCBCR:
mContext->PSSetShader(mAttachments->mYCbCrShader[aMaskType], nullptr, 0);
return;
case EFFECT_COMPONENT_ALPHA:
mContext->PSSetShader(mAttachments->mComponentAlphaShader[aMaskType], nullptr, 0);
return;
default:
@@ -505,17 +506,17 @@ CompositorD3D11::DrawQuad(const gfx::Rec
bool restoreBlendMode = false;
MaskType maskType = MaskNone;
if (aEffectChain.mSecondaryEffects[EFFECT_MASK]) {
if (aTransform.Is2D()) {
maskType = Mask2d;
} else {
- MOZ_ASSERT(aEffectChain.mPrimaryEffect->mType == EFFECT_BGRA);
+ MOZ_ASSERT(aEffectChain.mPrimaryEffect->mType == EFFECT_RGB);
maskType = Mask3d;
}
EffectMask* maskEffect =
static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EFFECT_MASK].get());
TextureSourceD3D11* source = maskEffect->mMaskTexture->AsSourceD3D11();
if (!source) {
@@ -541,35 +542,35 @@ CompositorD3D11::DrawQuad(const gfx::Rec
scissor.left = aClipRect.x;
scissor.right = aClipRect.XMost();
scissor.top = aClipRect.y;
scissor.bottom = aClipRect.YMost();
mContext->RSSetScissorRects(1, &scissor);
mContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
mContext->VSSetShader(mAttachments->mVSQuadShader[maskType], nullptr, 0);
- SetPSForEffect(aEffectChain.mPrimaryEffect, maskType);
switch (aEffectChain.mPrimaryEffect->mType) {
case EFFECT_SOLID_COLOR: {
Color color =
static_cast<EffectSolidColor*>(aEffectChain.mPrimaryEffect.get())->mColor;
mPSConstants.layerColor[0] = color.r * color.a * aOpacity;
mPSConstants.layerColor[1] = color.g * color.a * aOpacity;
mPSConstants.layerColor[2] = color.b * color.a * aOpacity;
mPSConstants.layerColor[3] = color.a * aOpacity;
}
break;
- case EFFECT_BGRX:
- case EFFECT_BGRA:
+ case EFFECT_RGB:
case EFFECT_RENDER_TARGET:
{
TexturedEffect* texturedEffect =
static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
+ SetPSForEffect(aEffectChain.mPrimaryEffect, maskType, texturedEffect->mTexture->GetFormat());
+
mVSConstants.textureCoords = texturedEffect->mTextureCoords;
TextureSourceD3D11* source = texturedEffect->mTexture->AsSourceD3D11();
if (!source) {
NS_WARNING("Missing texture source!");
return;
}
@@ -587,16 +588,17 @@ CompositorD3D11::DrawQuad(const gfx::Rec
SetSamplerForFilter(texturedEffect->mFilter);
}
break;
case EFFECT_YCBCR: {
EffectYCbCr* ycbcrEffect =
static_cast<EffectYCbCr*>(aEffectChain.mPrimaryEffect.get());
+ SetPSForEffect(aEffectChain.mPrimaryEffect, maskType, ycbcrEffect->mTexture->GetFormat());
SetSamplerForFilter(Filter::LINEAR);
mVSConstants.textureCoords = ycbcrEffect->mTextureCoords;
const int Y = 0, Cb = 1, Cr = 2;
TextureSource* source = ycbcrEffect->mTexture;
if (!source) {
@@ -627,16 +629,18 @@ CompositorD3D11::DrawQuad(const gfx::Rec
}
break;
case EFFECT_COMPONENT_ALPHA:
{
MOZ_ASSERT(gfxPlatform::ComponentAlphaEnabled());
MOZ_ASSERT(mAttachments->mComponentBlendState);
EffectComponentAlpha* effectComponentAlpha =
static_cast<EffectComponentAlpha*>(aEffectChain.mPrimaryEffect.get());
+
+ SetPSForEffect(aEffectChain.mPrimaryEffect, maskType, effectComponentAlpha->mTexture->GetFormat());
TextureSourceD3D11* sourceOnWhite = effectComponentAlpha->mOnWhite->AsSourceD3D11();
TextureSourceD3D11* sourceOnBlack = effectComponentAlpha->mOnBlack->AsSourceD3D11();
if (!sourceOnWhite || !sourceOnBlack) {
NS_WARNING("Missing texture source(s)!");
return;
}
--- a/gfx/layers/d3d11/CompositorD3D11.h
+++ b/gfx/layers/d3d11/CompositorD3D11.h
@@ -147,17 +147,17 @@ public:
private:
// ensure mSize is up to date with respect to mWidget
void EnsureSize();
void VerifyBufferSize();
void UpdateRenderTarget();
bool CreateShaders();
void UpdateConstantBuffers();
void SetSamplerForFilter(gfx::Filter aFilter);
- void SetPSForEffect(Effect *aEffect, MaskType aMaskType);
+ void SetPSForEffect(Effect *aEffect, MaskType aMaskType, gfx::SurfaceFormat aFormat);
void PaintToTarget();
RefPtr<ID3D11DeviceContext> mContext;
RefPtr<ID3D11Device> mDevice;
RefPtr<IDXGISwapChain> mSwapChain;
RefPtr<CompositingRenderTargetD3D11> mDefaultRT;
RefPtr<CompositingRenderTargetD3D11> mCurrentRT;
--- a/gfx/layers/d3d9/CompositorD3D9.cpp
+++ b/gfx/layers/d3d9/CompositorD3D9.cpp
@@ -186,25 +186,26 @@ CompositorD3D9::SetRenderTarget(Composit
MOZ_ASSERT(aRenderTarget && mDeviceManager);
RefPtr<CompositingRenderTargetD3D9> oldRT = mCurrentRT;
mCurrentRT = static_cast<CompositingRenderTargetD3D9*>(aRenderTarget);
mCurrentRT->BindRenderTarget(device());
PrepareViewport(mCurrentRT->GetSize(), Matrix());
}
static DeviceManagerD3D9::ShaderMode
-ShaderModeForEffectType(EffectTypes aEffectType)
+ShaderModeForEffectType(EffectTypes aEffectType, gfx::SurfaceFormat aFormat)
{
switch (aEffectType) {
case EFFECT_SOLID_COLOR:
return DeviceManagerD3D9::SOLIDCOLORLAYER;
- case EFFECT_BGRA:
case EFFECT_RENDER_TARGET:
return DeviceManagerD3D9::RGBALAYER;
- case EFFECT_BGRX:
+ case EFFECT_RGB:
+ if (aFormat == SurfaceFormat::B8G8R8A8 || aFormat == SurfaceFormat::R8G8B8A8)
+ return DeviceManagerD3D9::RGBALAYER;
return DeviceManagerD3D9::RGBLAYER;
case EFFECT_YCBCR:
return DeviceManagerD3D9::YCBCRLAYER;
}
MOZ_CRASH("Bad effect type");
}
@@ -282,18 +283,17 @@ CompositorD3D9::DrawQuad(const gfx::Rect
d3d9Device->SetPixelShaderConstantF(CBvColor, color, 1);
maskTexture = mDeviceManager
->SetShaderMode(DeviceManagerD3D9::SOLIDCOLORLAYER, maskType);
}
break;
case EFFECT_RENDER_TARGET:
- case EFFECT_BGRX:
- case EFFECT_BGRA:
+ case EFFECT_RGB:
{
TexturedEffect* texturedEffect =
static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
Rect textureCoords = texturedEffect->mTextureCoords;
d3d9Device->SetVertexShaderConstantF(CBvTextureCoords,
ShaderConstantRect(
textureCoords.x,
@@ -303,17 +303,18 @@ CompositorD3D9::DrawQuad(const gfx::Rect
1);
SetSamplerForFilter(texturedEffect->mFilter);
TextureSourceD3D9* source = texturedEffect->mTexture->AsSourceD3D9();
d3d9Device->SetTexture(0, source->GetD3D9Texture());
maskTexture = mDeviceManager
- ->SetShaderMode(ShaderModeForEffectType(aEffectChain.mPrimaryEffect->mType),
+ ->SetShaderMode(ShaderModeForEffectType(aEffectChain.mPrimaryEffect->mType,
+ texturedEffect->mTexture->GetFormat()),
maskType);
isPremultiplied = texturedEffect->mPremultiplied;
}
break;
case EFFECT_YCBCR:
{
EffectYCbCr* ycbcrEffect =
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -29,17 +29,16 @@ EXPORTS += [
'ipc/ShadowLayersManager.h',
'Layers.h',
'LayerScope.h',
'LayersLogging.h',
'LayerSorter.h',
'LayerTreeInvalidation.h',
'opengl/Composer2D.h',
'opengl/OGLShaderProgram.h',
- 'opengl/OGLShaders.h',
'opengl/TexturePoolOGL.h',
'ReadbackLayer.h',
'SharedTextureImage.h',
'TiledLayerBuffer.h',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
UNIFIED_SOURCES += [
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -47,16 +47,17 @@
#include "TexturePoolOGL.h"
#endif
#include "GeckoProfiler.h"
#define BUFFER_OFFSET(i) ((char *)nullptr + (i))
namespace mozilla {
+using namespace std;
using namespace gfx;
namespace layers {
using namespace mozilla::gl;
static inline IntSize ns2gfxSize(const nsIntSize& s) {
return IntSize(s.width, s.height);
@@ -172,29 +173,16 @@ CompositorOGL::CreateContext()
if (!context) {
NS_WARNING("Failed to create CompositorOGL context");
}
return context.forget();
}
-void
-CompositorOGL::AddPrograms(ShaderProgramType aType)
-{
- for (uint32_t maskType = MaskNone; maskType < NumMaskTypes; ++maskType) {
- if (ProgramProfileOGL::ProgramExists(aType, static_cast<MaskType>(maskType))) {
- mPrograms[aType].mVariations[maskType] = new ShaderProgramOGL(this->gl(),
- ProgramProfileOGL::GetProfileFor(aType, static_cast<MaskType>(maskType)));
- } else {
- mPrograms[aType].mVariations[maskType] = nullptr;
- }
- }
-}
-
GLuint
CompositorOGL::GetTemporaryTexture(GLenum aTextureUnit)
{
size_t index = aTextureUnit - LOCAL_GL_TEXTURE0;
// lazily grow the array of temporary textures
if (mTextures.Length() <= index) {
size_t prevLength = mTextures.Length();
mTextures.SetLength(index + 1);
@@ -234,17 +222,22 @@ CompositorOGL::CleanupResources()
if (!mGLContext)
return;
nsRefPtr<GLContext> ctx = mGLContext->GetSharedContext();
if (!ctx) {
ctx = mGLContext;
}
- mPrograms.Clear();
+ for (std::map<ShaderConfigOGL, ShaderProgramOGL *>::iterator iter = mPrograms.begin();
+ iter != mPrograms.end();
+ iter++) {
+ delete iter->second;
+ }
+ mPrograms.clear();
if (!ctx->MakeCurrent()) {
mQuadVBO = 0;
mGLContext = nullptr;
return;
}
ctx->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, 0);
@@ -280,23 +273,20 @@ CompositorOGL::Initialize()
mHasBGRA =
mGLContext->IsExtensionSupported(gl::GLContext::EXT_texture_format_BGRA8888) ||
mGLContext->IsExtensionSupported(gl::GLContext::EXT_bgra);
mGLContext->fBlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE_MINUS_SRC_ALPHA,
LOCAL_GL_ONE, LOCAL_GL_ONE);
mGLContext->fEnable(LOCAL_GL_BLEND);
- mPrograms.AppendElements(NumProgramTypes);
- for (int type = 0; type < NumProgramTypes; ++type) {
- AddPrograms(static_cast<ShaderProgramType>(type));
- }
-
// initialise a common shader to check that we can actually compile a shader
- if (!mPrograms[RGBALayerProgramType].mVariations[MaskNone]->Initialize()) {
+ RefPtr<EffectSolidColor> effect = new EffectSolidColor(Color(0, 0, 0, 0));
+ ShaderConfigOGL config = GetShaderConfigFor(effect);
+ if (!GetShaderProgramFor(config)) {
return false;
}
if (mGLContext->WorkAroundDriverBugs()) {
/**
* We'll test the ability here to bind NPOT textures to a framebuffer, if
* this fails we'll try ARB_texture_rectangle.
*/
@@ -538,31 +528,17 @@ CompositorOGL::PrepareViewport(const gfx
viewMatrix.Translate(mRenderOffset.x, mRenderOffset.y);
}
viewMatrix = aWorldTransform * viewMatrix;
Matrix4x4 matrix3d = Matrix4x4::From2D(viewMatrix);
matrix3d._33 = 0.0f;
- SetLayerProgramProjectionMatrix(matrix3d);
-}
-
-void
-CompositorOGL::SetLayerProgramProjectionMatrix(const Matrix4x4& aMatrix)
-{
- // Update the projection matrix in all of the programs, without activating them.
- // The uniform will actually be set the next time the program is activated.
- for (unsigned int i = 0; i < mPrograms.Length(); ++i) {
- for (uint32_t mask = MaskNone; mask < NumMaskTypes; ++mask) {
- if (mPrograms[i].mVariations[mask]) {
- mPrograms[i].mVariations[mask]->DelayedSetProjectionMatrix(aMatrix);
- }
- }
- }
+ mProjMatrix = matrix3d;
}
TemporaryRef<CompositingRenderTarget>
CompositorOGL::CreateRenderTarget(const IntRect &aRect, SurfaceInitMode aInit)
{
GLuint tex = 0;
GLuint fbo = 0;
CreateFBOWithTexture(aRect, false, 0, &fbo, &tex);
@@ -830,41 +806,72 @@ CompositorOGL::CreateFBOWithTexture(cons
mGLContext->fBindTexture(mFBOTextureTarget, 0);
mGLContext->fGenFramebuffers(1, &fbo);
*aFBO = fbo;
*aTexture = tex;
}
-ShaderProgramType
-CompositorOGL::GetProgramTypeForEffect(Effect *aEffect) const
+ShaderConfigOGL
+CompositorOGL::GetShaderConfigFor(Effect *aEffect, MaskType aMask) const
{
+ ShaderConfigOGL config;
+
switch(aEffect->mType) {
case EFFECT_SOLID_COLOR:
- return ColorLayerProgramType;
- case EFFECT_RGBA:
- case EFFECT_RGBX:
- case EFFECT_BGRA:
- case EFFECT_BGRX:
+ config.SetRenderColor(true);
+ break;
+ case EFFECT_YCBCR:
+ config.SetYCbCr(true);
+ break;
+ case EFFECT_COMPONENT_ALPHA:
+ config.SetComponentAlpha(true);
+ break;
+ case EFFECT_RENDER_TARGET:
+ config.SetTextureTarget(mFBOTextureTarget);
+ break;
+ default:
{
+ MOZ_ASSERT(aEffect->mType == EFFECT_RGB);
TexturedEffect* texturedEffect =
static_cast<TexturedEffect*>(aEffect);
TextureSourceOGL* source = texturedEffect->mTexture->AsSourceOGL();
-
- return ShaderProgramFromTargetAndFormat(source->GetTextureTarget(),
- source->GetFormat());
+ MOZ_ASSERT_IF(source->GetTextureTarget() == LOCAL_GL_TEXTURE_EXTERNAL,
+ source->GetFormat() == gfx::SurfaceFormat::R8G8B8A8);
+ MOZ_ASSERT_IF(source->GetTextureTarget() == LOCAL_GL_TEXTURE_RECTANGLE_ARB,
+ source->GetFormat() == gfx::SurfaceFormat::R8G8B8A8 ||
+ source->GetFormat() == gfx::SurfaceFormat::R8G8B8X8 ||
+ source->GetFormat() == gfx::SurfaceFormat::R5G6B5);
+ config = ShaderConfigFromTargetAndFormat(source->GetTextureTarget(),
+ source->GetFormat());
+ break;
+ }
}
- case EFFECT_YCBCR:
- return YCbCrLayerProgramType;
- case EFFECT_RENDER_TARGET:
- return GetFBOLayerProgramType();
- default:
- return RGBALayerProgramType;
+ config.SetMask2D(aMask == Mask2d);
+ config.SetMask3D(aMask == Mask3d);
+ return config;
+}
+
+ShaderProgramOGL*
+CompositorOGL::GetShaderProgramFor(const ShaderConfigOGL &aConfig)
+{
+ std::map<ShaderConfigOGL, ShaderProgramOGL *>::iterator iter = mPrograms.find(aConfig);
+ if (iter != mPrograms.end())
+ return iter->second;
+
+ ProgramProfileOGL profile = ProgramProfileOGL::GetProfileFor(aConfig);
+ ShaderProgramOGL *shader = new ShaderProgramOGL(gl(), profile);
+ if (!shader->Initialize()) {
+ delete shader;
+ return nullptr;
}
+
+ mPrograms[aConfig] = shader;
+ return shader;
}
struct MOZ_STACK_CLASS AutoBindTexture
: public ScopedGLWrapper<AutoBindTexture>
{
friend struct ScopedGLWrapper<AutoBindTexture>;
protected:
@@ -1024,67 +1031,69 @@ CompositorOGL::DrawQuadInternal(const Re
? Mask3d
: Mask2d;
} else {
maskType = MaskNone;
}
mPixelsFilled += aRect.width * aRect.height;
- ShaderProgramType programType = GetProgramTypeForEffect(aEffectChain.mPrimaryEffect);
- ShaderProgramOGL *program = GetProgram(programType, maskType);
+ // Determine the color if this is a color shader and fold the opacity into
+ // the color since color shaders don't have an opacity uniform.
+ Color color;
+ if (aEffectChain.mPrimaryEffect->mType == EFFECT_SOLID_COLOR) {
+ EffectSolidColor* effectSolidColor =
+ static_cast<EffectSolidColor*>(aEffectChain.mPrimaryEffect.get());
+ color = effectSolidColor->mColor;
+
+ Float opacity = aOpacity * color.a;
+ color.r *= opacity;
+ color.g *= opacity;
+ color.b *= opacity;
+ color.a = opacity;
+
+ // We can fold opacity into the color, so no need to consider it further.
+ aOpacity = 1.f;
+ }
+
+ ShaderConfigOGL config = GetShaderConfigFor(aEffectChain.mPrimaryEffect, maskType);
+ config.SetOpacity(aOpacity != 1.f);
+ ShaderProgramOGL *program = GetShaderProgramFor(config);
program->Activate();
- if (programType == RGBARectLayerProgramType ||
- programType == RGBXRectLayerProgramType) {
+ program->SetProjectionMatrix(mProjMatrix);
+ program->SetLayerQuadRect(aRect);
+ program->SetLayerTransform(aTransform);
+ IntPoint offset = mCurrentRenderTarget->GetOrigin();
+ program->SetRenderOffset(offset.x, offset.y);
+ if (aOpacity != 1.f)
+ program->SetLayerOpacity(aOpacity);
+ if (config.mFeatures & ENABLE_TEXTURE_RECT) {
TexturedEffect* texturedEffect =
static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
TextureSourceOGL* source = texturedEffect->mTexture->AsSourceOGL();
// This is used by IOSurface that use 0,0...w,h coordinate rather then 0,0..1,1.
program->SetTexCoordMultiplier(source->GetSize().width, source->GetSize().height);
}
- program->SetLayerQuadRect(aRect);
- program->SetLayerTransform(aTransform);
- IntPoint offset = mCurrentRenderTarget->GetOrigin();
- program->SetRenderOffset(offset.x, offset.y);
switch (aEffectChain.mPrimaryEffect->mType) {
case EFFECT_SOLID_COLOR: {
- EffectSolidColor* effectSolidColor =
- static_cast<EffectSolidColor*>(aEffectChain.mPrimaryEffect.get());
-
- Color color = effectSolidColor->mColor;
- /* Multiply color by the layer opacity, as the shader
- * ignores layer opacity and expects a final color to
- * write to the color buffer. This saves a needless
- * multiply in the fragment shader.
- */
- Float opacity = aOpacity * color.a;
- color.r *= opacity;
- color.g *= opacity;
- color.b *= opacity;
- color.a = opacity;
-
program->SetRenderColor(color);
AutoSaveTexture bindMask(mGLContext, LOCAL_GL_TEXTURE0);
if (maskType != MaskNone) {
BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE0, maskQuadTransform);
}
BindAndDrawQuad(program, false, aDrawMode);
}
break;
- case EFFECT_BGRA:
- case EFFECT_BGRX:
- case EFFECT_RGBA:
- case EFFECT_RGBX: {
+ case EFFECT_RGB: {
TexturedEffect* texturedEffect =
static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
- Rect textureCoords;
TextureSource *source = texturedEffect->mTexture;
if (!texturedEffect->mPremultiplied) {
mGLContext->fBlendFuncSeparate(LOCAL_GL_SRC_ALPHA, LOCAL_GL_ONE_MINUS_SRC_ALPHA,
LOCAL_GL_ONE, LOCAL_GL_ONE);
}
AutoBindTexture bindSource(mGLContext, source->AsSourceOGL(), LOCAL_GL_TEXTURE0);
@@ -1104,17 +1113,16 @@ CompositorOGL::DrawQuadInternal(const Re
// code should not be needed!
filter = GraphicsFilter::FILTER_NEAREST;
}
#endif
ApplyFilterToBoundTexture(mGLContext, filter,
source->AsSourceOGL()->GetTextureTarget());
program->SetTextureUnit(0);
- program->SetLayerOpacity(aOpacity);
AutoSaveTexture bindMask(mGLContext, LOCAL_GL_TEXTURE1);
if (maskType != MaskNone) {
BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE1, maskQuadTransform);
}
BindAndDrawQuadWithTextureRect(program, textureTransform,
texturedEffect->mTextureCoords, source);
@@ -1144,17 +1152,16 @@ CompositorOGL::DrawQuadInternal(const Re
AutoBindTexture bindY(mGLContext, sourceY, LOCAL_GL_TEXTURE0);
ApplyFilterToBoundTexture(mGLContext, filter);
AutoBindTexture bindCb(mGLContext, sourceCb, LOCAL_GL_TEXTURE1);
ApplyFilterToBoundTexture(mGLContext, filter);
AutoBindTexture bindCr(mGLContext, sourceCr, LOCAL_GL_TEXTURE2);
ApplyFilterToBoundTexture(mGLContext, filter);
program->SetYCbCrTextureUnits(Y, Cb, Cr);
- program->SetLayerOpacity(aOpacity);
AutoSaveTexture bindMask(mGLContext, LOCAL_GL_TEXTURE3);
if (maskType != MaskNone) {
BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE3, maskQuadTransform);
}
BindAndDrawQuadWithTextureRect(program,
gfx3DMatrix(),
effectYCbCr->mTextureCoords,
@@ -1162,33 +1169,29 @@ CompositorOGL::DrawQuadInternal(const Re
}
break;
case EFFECT_RENDER_TARGET: {
EffectRenderTarget* effectRenderTarget =
static_cast<EffectRenderTarget*>(aEffectChain.mPrimaryEffect.get());
RefPtr<CompositingRenderTargetOGL> surface
= static_cast<CompositingRenderTargetOGL*>(effectRenderTarget->mRenderTarget.get());
- ShaderProgramOGL *program = GetProgram(GetFBOLayerProgramType(), maskType);
-
surface->BindTexture(LOCAL_GL_TEXTURE0, mFBOTextureTarget);
- program->Activate();
+ program->SetTextureTransform(Matrix4x4());
program->SetTextureUnit(0);
- program->SetLayerOpacity(aOpacity);
- program->SetTextureTransform(Matrix4x4());
AutoSaveTexture bindMask(mGLContext, LOCAL_GL_TEXTURE1);
if (maskType != MaskNone) {
sourceMask->BindTexture(LOCAL_GL_TEXTURE1);
program->SetMaskTextureUnit(1);
program->SetMaskLayerTransform(maskQuadTransform);
}
- if (program->GetTexCoordMultiplierUniformLocation() != -1) {
+ if (config.mFeatures & ENABLE_TEXTURE_RECT) {
// 2DRect case, get the multiplier right for a sampler2DRect
program->SetTexCoordMultiplier(aRect.width, aRect.height);
}
// Drawing is always flipped, but when copying between surfaces we want to avoid
// this. Pass true for the flip parameter to introduce a second flip
// that cancels the other one out.
BindAndDrawQuad(program, true);
@@ -1202,57 +1205,47 @@ CompositorOGL::DrawQuadInternal(const Re
TextureSourceOGL* sourceOnBlack = effectComponentAlpha->mOnBlack->AsSourceOGL();
if (!sourceOnBlack->IsValid() ||
!sourceOnWhite->IsValid()) {
NS_WARNING("Invalid layer texture for component alpha");
return;
}
- for (int32_t pass = 1; pass <=2; ++pass) {
- ShaderProgramOGL* program;
- if (pass == 1) {
- ShaderProgramType type = gl()->GetPreferredARGB32Format() == LOCAL_GL_BGRA ?
- ComponentAlphaPass1RGBProgramType :
- ComponentAlphaPass1ProgramType;
- program = GetProgram(type, maskType);
- gl()->fBlendFuncSeparate(LOCAL_GL_ZERO, LOCAL_GL_ONE_MINUS_SRC_COLOR,
- LOCAL_GL_ONE, LOCAL_GL_ONE);
- } else {
- ShaderProgramType type = gl()->GetPreferredARGB32Format() == LOCAL_GL_BGRA ?
- ComponentAlphaPass2RGBProgramType :
- ComponentAlphaPass2ProgramType;
- program = GetProgram(type, maskType);
- gl()->fBlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE,
- LOCAL_GL_ONE, LOCAL_GL_ONE);
- }
+ AutoBindTexture bindSourceOnBlack(mGLContext, sourceOnBlack, LOCAL_GL_TEXTURE0);
+ AutoBindTexture bindSourceOnWhite(mGLContext, sourceOnWhite, LOCAL_GL_TEXTURE1);
- AutoBindTexture bindSourceOnBlack(mGLContext, sourceOnBlack, LOCAL_GL_TEXTURE0);
- AutoBindTexture bindSourceOnWhite(mGLContext, sourceOnWhite, LOCAL_GL_TEXTURE1);
+ program->SetBlackTextureUnit(0);
+ program->SetWhiteTextureUnit(1);
+ program->SetTextureTransform(gfx::Matrix4x4());
- program->Activate();
- program->SetBlackTextureUnit(0);
- program->SetWhiteTextureUnit(1);
- program->SetLayerOpacity(aOpacity);
- program->SetLayerTransform(aTransform);
- program->SetRenderOffset(offset.x, offset.y);
- program->SetLayerQuadRect(aRect);
- AutoSaveTexture bindMask(mGLContext, LOCAL_GL_TEXTURE2);
- if (maskType != MaskNone) {
- BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE2, maskQuadTransform);
- }
+ AutoBindTexture bindMask(mGLContext);
+ if (maskType != MaskNone) {
+ BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE2, maskQuadTransform);
+ }
+ // Pass 1.
+ gl()->fBlendFuncSeparate(LOCAL_GL_ZERO, LOCAL_GL_ONE_MINUS_SRC_COLOR,
+ LOCAL_GL_ONE, LOCAL_GL_ONE);
+ program->SetTexturePass2(false);
+ BindAndDrawQuadWithTextureRect(program,
+ gfx3DMatrix(),
+ effectComponentAlpha->mTextureCoords,
+ effectComponentAlpha->mOnBlack);
- BindAndDrawQuadWithTextureRect(program,
- gfx3DMatrix(),
- effectComponentAlpha->mTextureCoords,
- effectComponentAlpha->mOnBlack);
+ // Pass 2.
+ gl()->fBlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE,
+ LOCAL_GL_ONE, LOCAL_GL_ONE);
+ program->SetTexturePass2(true);
+ BindAndDrawQuadWithTextureRect(program,
+ gfx3DMatrix(),
+ effectComponentAlpha->mTextureCoords,
+ effectComponentAlpha->mOnBlack);
- mGLContext->fBlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE_MINUS_SRC_ALPHA,
- LOCAL_GL_ONE, LOCAL_GL_ONE);
- }
+ mGLContext->fBlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE_MINUS_SRC_ALPHA,
+ LOCAL_GL_ONE, LOCAL_GL_ONE);
}
break;
default:
MOZ_ASSERT(false, "Unhandled effect type");
break;
}
mGLContext->fActiveTexture(LOCAL_GL_TEXTURE0);
--- a/gfx/layers/opengl/CompositorOGL.h
+++ b/gfx/layers/opengl/CompositorOGL.h
@@ -50,20 +50,20 @@ class DataTextureSource;
class GLManagerCompositor;
class TextureSource;
struct Effect;
struct EffectChain;
class CompositorOGL : public Compositor
{
typedef mozilla::gl::GLContext GLContext;
- typedef ShaderProgramType ProgramType;
friend class GLManagerCompositor;
+ std::map<ShaderConfigOGL, ShaderProgramOGL*> mPrograms;
public:
CompositorOGL(nsIWidget *aWidget, int aSurfaceWidth = -1, int aSurfaceHeight = -1,
bool aUseExternalSurfaceSize = false);
virtual ~CompositorOGL();
virtual TemporaryRef<DataTextureSource>
CreateDataTextureSource(TextureFlags aFlags = 0) MOZ_OVERRIDE;
@@ -155,31 +155,31 @@ public:
}
virtual void Pause() MOZ_OVERRIDE;
virtual bool Resume() MOZ_OVERRIDE;
virtual nsIWidget* GetWidget() const MOZ_OVERRIDE { return mWidget; }
GLContext* gl() const { return mGLContext; }
- ShaderProgramType GetFBOLayerProgramType() const {
- return mFBOTextureTarget == LOCAL_GL_TEXTURE_RECTANGLE_ARB ?
- RGBARectLayerProgramType : RGBALayerProgramType;
- }
gfx::SurfaceFormat GetFBOFormat() const {
return gfx::SurfaceFormat::R8G8B8A8;
}
/**
* The compositor provides with temporary textures for use with direct
* textruing like gralloc texture.
* Doing so lets us use gralloc the way it has been designed to be used
* (see https://wiki.mozilla.org/Platform/GFX/Gralloc)
*/
GLuint GetTemporaryTexture(GLenum aUnit);
+
+ const gfx::Matrix4x4& GetProjMatrix() const {
+ return mProjMatrix;
+ }
private:
virtual void DrawQuadInternal(const gfx::Rect& aRect,
const gfx::Rect& aClipRect,
const EffectChain &aEffectChain,
gfx::Float aOpacity,
const gfx::Matrix4x4 &aTransformi,
GLuint aDrawMode);
@@ -187,37 +187,25 @@ private:
* Context target, nullptr when drawing directly to our swap chain.
*/
RefPtr<gfx::DrawTarget> mTarget;
/** Widget associated with this compositor */
nsIWidget *mWidget;
nsIntSize mWidgetSize;
nsRefPtr<GLContext> mGLContext;
+ gfx::Matrix4x4 mProjMatrix;
/** The size of the surface we are rendering to */
nsIntSize mSurfaceSize;
ScreenPoint mRenderOffset;
already_AddRefed<mozilla::gl::GLContext> CreateContext();
- /** Shader Programs */
- struct ShaderProgramVariations {
- nsAutoTArray<nsAutoPtr<ShaderProgramOGL>, NumMaskTypes> mVariations;
- ShaderProgramVariations() {
- MOZ_COUNT_CTOR(ShaderProgramVariations);
- mVariations.SetLength(NumMaskTypes);
- }
- ~ShaderProgramVariations() {
- MOZ_COUNT_DTOR(ShaderProgramVariations);
- }
- };
- nsTArray<ShaderProgramVariations> mPrograms;
-
/** Texture target to use for FBOs */
GLenum mFBOTextureTarget;
/** Currently bound render target */
RefPtr<CompositingRenderTargetOGL> mCurrentRenderTarget;
#ifdef DEBUG
CompositingRenderTargetOGL* mWindowRenderTarget;
#endif
@@ -256,35 +244,18 @@ private:
*/
virtual void BeginFrame(const nsIntRegion& aInvalidRegion,
const gfx::Rect *aClipRectIn,
const gfx::Matrix& aTransform,
const gfx::Rect& aRenderBounds,
gfx::Rect *aClipRectOut = nullptr,
gfx::Rect *aRenderBoundsOut = nullptr) MOZ_OVERRIDE;
- ShaderProgramType GetProgramTypeForEffect(Effect* aEffect) const;
-
- /**
- * Updates all layer programs with a new projection matrix.
- */
- void SetLayerProgramProjectionMatrix(const gfx::Matrix4x4& aMatrix);
-
- /**
- * Helper method for Initialize, creates all valid variations of a program
- * and adds them to mPrograms
- */
- void AddPrograms(ShaderProgramType aType);
-
- ShaderProgramOGL* GetProgram(ShaderProgramType aType,
- MaskType aMask = MaskNone) {
- MOZ_ASSERT(ProgramProfileOGL::ProgramExists(aType, aMask),
- "Invalid program type.");
- return mPrograms[aType].mVariations[aMask];
- }
+ ShaderConfigOGL GetShaderConfigFor(Effect *aEffect, MaskType aMask = MaskNone) const;
+ ShaderProgramOGL* GetShaderProgramFor(const ShaderConfigOGL &aConfig);
/**
* Create a FBO backed by a texture.
* Note that the texture target type will be
* of the type returned by FBOTextureTarget; different
* shaders are required to sample from the different
* texture types.
*/
--- a/gfx/layers/opengl/GLManager.cpp
+++ b/gfx/layers/opengl/GLManager.cpp
@@ -27,19 +27,25 @@ public:
: mImpl(aCompositor)
{}
virtual GLContext* gl() const MOZ_OVERRIDE
{
return mImpl->gl();
}
- virtual ShaderProgramOGL* GetProgram(ShaderProgramType aType) MOZ_OVERRIDE
+ virtual ShaderProgramOGL* GetProgram(GLenum aTarget, gfx::SurfaceFormat aFormat) MOZ_OVERRIDE
{
- return mImpl->GetProgram(aType);
+ ShaderConfigOGL config = ShaderConfigFromTargetAndFormat(aTarget, aFormat);
+ return mImpl->GetShaderProgramFor(config);
+ }
+
+ virtual const gfx::Matrix4x4& GetProjMatrix() const MOZ_OVERRIDE
+ {
+ return mImpl->GetProjMatrix();
}
virtual void BindAndDrawQuad(ShaderProgramOGL *aProg) MOZ_OVERRIDE
{
mImpl->BindAndDrawQuad(aProg);
}
private:
--- a/gfx/layers/opengl/GLManager.h
+++ b/gfx/layers/opengl/GLManager.h
@@ -26,19 +26,16 @@ class LayerManagerComposite;
class GLManager
{
public:
static GLManager* CreateGLManager(LayerManagerComposite* aManager);
virtual ~GLManager() {}
virtual gl::GLContext* gl() const = 0;
- virtual ShaderProgramOGL* GetProgram(ShaderProgramType aType) = 0;
+ virtual ShaderProgramOGL* GetProgram(GLenum aTarget, gfx::SurfaceFormat aFormat) = 0;
+ virtual const gfx::Matrix4x4& GetProjMatrix() const = 0;
virtual void BindAndDrawQuad(ShaderProgramOGL *aProg) = 0;
-
- ShaderProgramOGL* GetProgram(gfx::SurfaceFormat aFormat) {
- return GetProgram(ShaderProgramFromSurfaceFormat(aFormat));
- }
};
}
}
#endif
--- a/gfx/layers/opengl/OGLShaderProgram.cpp
+++ b/gfx/layers/opengl/OGLShaderProgram.cpp
@@ -1,31 +1,36 @@
/* 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 "OGLShaderProgram.h"
#include <stdint.h> // for uint32_t
+#include <sstream> // for ostringstream
#include "gfxRect.h" // for gfxRect
#include "mozilla/DebugOnly.h" // for DebugOnly
#include "nsAString.h"
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsString.h" // for nsAutoCString
#include "prenv.h" // for PR_GetEnv
-#include "OGLShaders.h"
#include "Layers.h"
#include "GLContext.h"
struct gfxRGBA;
namespace mozilla {
namespace layers {
+using namespace std;
+
typedef ProgramProfileOGL::Argument Argument;
+#define GAUSSIAN_KERNEL_HALF_WIDTH 11
+#define GAUSSIAN_KERNEL_STEP 0.2
+
void
AddUniforms(ProgramProfileOGL& aProfile)
{
static const char *sKnownUniformNames[] = {
"uLayerTransform",
"uMaskQuadTransform",
"uLayerQuadTransform",
"uMatrixProj",
@@ -36,253 +41,333 @@ AddUniforms(ProgramProfileOGL& aProfile)
"uYTexture",
"uCbTexture",
"uCrTexture",
"uBlackTexture",
"uWhiteTexture",
"uMaskTexture",
"uRenderColor",
"uTexCoordMultiplier",
+ "uTexturePass2",
nullptr
};
for (int i = 0; sKnownUniformNames[i] != nullptr; ++i) {
aProfile.mUniforms[i].mNameString = sKnownUniformNames[i];
aProfile.mUniforms[i].mName = (KnownUniform::KnownUniformName) i;
}
}
void
-AddCommonArgs(ProgramProfileOGL& aProfile)
+ShaderConfigOGL::SetRenderColor(bool aEnabled)
+{
+ SetFeature(ENABLE_RENDER_COLOR, aEnabled);
+}
+
+void
+ShaderConfigOGL::SetTextureTarget(GLenum aTarget)
{
- aProfile.mAttributes.AppendElement(Argument("aVertexCoord"));
+ SetFeature(ENABLE_TEXTURE_EXTERNAL | ENABLE_TEXTURE_RECT, false);
+ switch (aTarget) {
+ case LOCAL_GL_TEXTURE_EXTERNAL:
+ SetFeature(ENABLE_TEXTURE_EXTERNAL, true);
+ break;
+ case LOCAL_GL_TEXTURE_RECTANGLE_ARB:
+ SetFeature(ENABLE_TEXTURE_RECT, true);
+ break;
+ }
+}
+
+void
+ShaderConfigOGL::SetRBSwap(bool aEnabled)
+{
+ SetFeature(ENABLE_TEXTURE_RB_SWAP, aEnabled);
+}
+
+void
+ShaderConfigOGL::SetNoAlpha(bool aEnabled)
+{
+ SetFeature(ENABLE_TEXTURE_NO_ALPHA, aEnabled);
+}
+
+void
+ShaderConfigOGL::SetOpacity(bool aEnabled)
+{
+ SetFeature(ENABLE_OPACITY, aEnabled);
}
+
void
-AddCommonTextureArgs(ProgramProfileOGL& aProfile)
+ShaderConfigOGL::SetYCbCr(bool aEnabled)
+{
+ SetFeature(ENABLE_TEXTURE_YCBCR, aEnabled);
+}
+
+void
+ShaderConfigOGL::SetComponentAlpha(bool aEnabled)
+{
+ SetFeature(ENABLE_TEXTURE_COMPONENT_ALPHA, aEnabled);
+}
+
+void
+ShaderConfigOGL::SetColorMatrix(bool aEnabled)
{
- aProfile.mAttributes.AppendElement(Argument("aTexCoord"));
+ SetFeature(ENABLE_COLOR_MATRIX, aEnabled);
+}
+
+void
+ShaderConfigOGL::SetBlur(bool aEnabled)
+{
+ SetFeature(ENABLE_BLUR, aEnabled);
+}
+
+void
+ShaderConfigOGL::SetMask2D(bool aEnabled)
+{
+ SetFeature(ENABLE_MASK_2D, aEnabled);
+}
+
+void
+ShaderConfigOGL::SetMask3D(bool aEnabled)
+{
+ SetFeature(ENABLE_MASK_3D, aEnabled);
}
/* static */ ProgramProfileOGL
-ProgramProfileOGL::GetProfileFor(ShaderProgramType aType,
- MaskType aMask)
+ProgramProfileOGL::GetProfileFor(ShaderConfigOGL aConfig)
{
- NS_ASSERTION(ProgramExists(aType, aMask), "Invalid program type.");
ProgramProfileOGL result;
+ ostringstream fs, vs;
AddUniforms(result);
- switch (aType) {
- case RGBALayerProgramType:
- if (aMask == Mask3d) {
- result.mVertexShaderString = sLayerMask3DVS;
- result.mFragmentShaderString = sRGBATextureLayerMask3DFS;
- } else if (aMask == Mask2d) {
- result.mVertexShaderString = sLayerMaskVS;
- result.mFragmentShaderString = sRGBATextureLayerMaskFS;
- } else {
- result.mVertexShaderString = sLayerVS;
- result.mFragmentShaderString = sRGBATextureLayerFS;
- }
- AddCommonArgs(result);
- AddCommonTextureArgs(result);
- result.mTextureCount = 1;
- break;
- case BGRALayerProgramType:
- if (aMask == Mask2d) {
- result.mVertexShaderString = sLayerMaskVS;
- result.mFragmentShaderString = sBGRATextureLayerMaskFS;
- } else {
- result.mVertexShaderString = sLayerVS;
- result.mFragmentShaderString = sBGRATextureLayerFS;
- }
- AddCommonArgs(result);
- AddCommonTextureArgs(result);
- result.mTextureCount = 1;
- break;
- case RGBXLayerProgramType:
- if (aMask == Mask2d) {
- result.mVertexShaderString = sLayerMaskVS;
- result.mFragmentShaderString = sRGBXTextureLayerMaskFS;
- } else {
- result.mVertexShaderString = sLayerVS;
- result.mFragmentShaderString = sRGBXTextureLayerFS;
- }
- AddCommonArgs(result);
- AddCommonTextureArgs(result);
- result.mTextureCount = 1;
- break;
- case BGRXLayerProgramType:
- if (aMask == Mask2d) {
- result.mVertexShaderString = sLayerMaskVS;
- result.mFragmentShaderString = sBGRXTextureLayerMaskFS;
- } else {
- result.mVertexShaderString = sLayerVS;
- result.mFragmentShaderString = sBGRXTextureLayerFS;
- }
- AddCommonArgs(result);
- AddCommonTextureArgs(result);
- result.mTextureCount = 1;
- break;
- case RGBARectLayerProgramType:
- if (aMask == Mask3d) {
- result.mVertexShaderString = sLayerMask3DVS;
- result.mFragmentShaderString = sRGBARectTextureLayerMask3DFS;
- } else if (aMask == Mask2d) {
- result.mVertexShaderString = sLayerMaskVS;
- result.mFragmentShaderString = sRGBARectTextureLayerMaskFS;
- } else {
- result.mVertexShaderString = sLayerVS;
- result.mFragmentShaderString = sRGBARectTextureLayerFS;
- }
- AddCommonArgs(result);
- AddCommonTextureArgs(result);
- result.mTextureCount = 1;
- break;
- case RGBXRectLayerProgramType:
- if (aMask == Mask3d) {
- result.mVertexShaderString = sLayerMask3DVS;
- result.mFragmentShaderString = sRGBXRectTextureLayerMask3DFS;
- } else if (aMask == Mask2d) {
- result.mVertexShaderString = sLayerMaskVS;
- result.mFragmentShaderString = sRGBXRectTextureLayerMaskFS;
- } else {
- result.mVertexShaderString = sLayerVS;
- result.mFragmentShaderString = sRGBXRectTextureLayerFS;
+ vs << "uniform mat4 uMatrixProj;" << endl;
+ vs << "uniform mat4 uLayerQuadTransform;" << endl;
+ vs << "uniform mat4 uLayerTransform;" << endl;
+ vs << "uniform vec4 uRenderTargetOffset;" << endl;
+
+ vs << "attribute vec4 aVertexCoord;" << endl;
+
+ if (!(aConfig.mFeatures & ENABLE_RENDER_COLOR)) {
+ vs << "uniform mat4 uTextureTransform;" << endl;
+ vs << "attribute vec2 aTexCoord;" << endl;
+ vs << "varying vec2 vTexCoord;" << endl;
+ }
+
+ if (aConfig.mFeatures & ENABLE_MASK_2D ||
+ aConfig.mFeatures & ENABLE_MASK_3D) {
+ vs << "uniform mat4 uMaskQuadTransform;" << endl;
+ vs << "varying vec3 vMaskCoord;" << endl;
+ }
+
+ vs << "void main() {" << endl;
+ vs << " vec4 finalPosition = aVertexCoord;" << endl;
+ vs << " finalPosition = uLayerQuadTransform * finalPosition;" << endl;
+ vs << " finalPosition = uLayerTransform * finalPosition;" << endl;
+ vs << " finalPosition.xyz /= finalPosition.w;" << endl;
+
+ if (aConfig.mFeatures & ENABLE_MASK_3D) {
+ vs << " vMaskCoord.xy = (uMaskQuadTransform * vec4(finalPosition.xyz, 1.0)).xy;" << endl;
+ // correct for perspective correct interpolation, see comment in D3D10 shader
+ vs << " vMaskCoord.z = 1.0;" << endl;
+ vs << " vMaskCoord *= finalPosition.w;" << endl;
+ } else if (aConfig.mFeatures & ENABLE_MASK_2D) {
+ vs << " vMaskCoord.xy = (uMaskQuadTransform * finalPosition).xy;" << endl;
+ }
+
+ vs << " finalPosition = finalPosition - uRenderTargetOffset;" << endl;
+ vs << " finalPosition.xyz *= finalPosition.w;" << endl;
+ vs << " finalPosition = uMatrixProj * finalPosition;" << endl;
+
+ if (!(aConfig.mFeatures & ENABLE_RENDER_COLOR)) {
+ vs << " vTexCoord = (uTextureTransform * vec4(aTexCoord.x, aTexCoord.y, 0.0, 1.0)).xy;" << endl;
+ }
+
+ vs << " gl_Position = finalPosition;" << endl;
+ vs << "}" << endl;
+
+ fs << "#ifdef GL_ES" << endl;
+ fs << "precision mediump float;" << endl;
+ fs << "#define COLOR_PRECISION lowp" << endl;
+ fs << "#else" << endl;
+ fs << "#define COLOR_PRECISION" << endl;
+ fs << "#endif" << endl;
+ if (aConfig.mFeatures & ENABLE_RENDER_COLOR) {
+ fs << "uniform COLOR_PRECISION vec4 uRenderColor;" << endl;
+ } else {
+ // for tiling, texcoord can be greater than the lowfp range
+ fs << "varying vec2 vTexCoord;" << endl;
+ if (aConfig.mFeatures & ENABLE_BLUR) {
+ fs << "uniform bool uBlurAlpha;" << endl;
+ fs << "uniform vec2 uBlurRadius;" << endl;
+ fs << "uniform vec2 uBlurOffset;" << endl;
+ fs << "uniform float uBlurGaussianKernel[" << GAUSSIAN_KERNEL_HALF_WIDTH << "];" << endl;
}
- AddCommonArgs(result);
- AddCommonTextureArgs(result);
- result.mTextureCount = 1;
- break;
- case BGRARectLayerProgramType:
- MOZ_ASSERT(aMask == MaskNone, "BGRARectLayerProgramType can't handle masks.");
- result.mVertexShaderString = sLayerVS;
- result.mFragmentShaderString = sBGRARectTextureLayerFS;
- AddCommonArgs(result);
- AddCommonTextureArgs(result);
- result.mTextureCount = 1;
- break;
- case RGBAExternalLayerProgramType:
- if (aMask == Mask3d) {
- result.mVertexShaderString = sLayerMask3DVS;
- result.mFragmentShaderString = sRGBAExternalTextureLayerMask3DFS;
- } else if (aMask == Mask2d) {
- result.mVertexShaderString = sLayerMaskVS;
- result.mFragmentShaderString = sRGBAExternalTextureLayerMaskFS;
- } else {
- result.mVertexShaderString = sLayerVS;
- result.mFragmentShaderString = sRGBAExternalTextureLayerFS;
+ if (aConfig.mFeatures & ENABLE_COLOR_MATRIX) {
+ fs << "uniform mat4 uColorMatrix;" << endl;
+ fs << "uniform vec4 uColorMatrixVector;" << endl;
}
- AddCommonArgs(result);
- AddCommonTextureArgs(result);
- result.mTextureCount = 1;
- break;
- case ColorLayerProgramType:
- if (aMask == Mask2d) {
- result.mVertexShaderString = sLayerMaskVS;
- result.mFragmentShaderString = sSolidColorLayerMaskFS;
- } else {
- result.mVertexShaderString = sLayerVS;
- result.mFragmentShaderString = sSolidColorLayerFS;
- }
- AddCommonArgs(result);
- break;
- case YCbCrLayerProgramType:
- if (aMask == Mask2d) {
- result.mVertexShaderString = sLayerMaskVS;
- result.mFragmentShaderString = sYCbCrTextureLayerMaskFS;
- } else {
- result.mVertexShaderString = sLayerVS;
- result.mFragmentShaderString = sYCbCrTextureLayerFS;
- }
- AddCommonArgs(result);
- result.mAttributes.AppendElement(Argument("aTexCoord"));
- result.mTextureCount = 3;
- break;
- case ComponentAlphaPass1ProgramType:
- if (aMask == Mask2d) {
- result.mVertexShaderString = sLayerMaskVS;
- result.mFragmentShaderString = sComponentPassMask1FS;
- } else {
- result.mVertexShaderString = sLayerVS;
- result.mFragmentShaderString = sComponentPass1FS;
+ if (aConfig.mFeatures & ENABLE_OPACITY) {
+ fs << "uniform COLOR_PRECISION float uLayerOpacity;" << endl;
}
- AddCommonArgs(result);
- result.mAttributes.AppendElement(Argument("aTexCoord"));
- result.mTextureCount = 2;
- break;
- case ComponentAlphaPass1RGBProgramType:
- if (aMask == Mask2d) {
- result.mVertexShaderString = sLayerMaskVS;
- result.mFragmentShaderString = sComponentPassMask1RGBFS;
- } else {
- result.mVertexShaderString = sLayerVS;
- result.mFragmentShaderString = sComponentPass1RGBFS;
- }
- AddCommonArgs(result);
- result.mAttributes.AppendElement(Argument("aTexCoord"));
- result.mTextureCount = 2;
- break;
- case ComponentAlphaPass2ProgramType:
- if (aMask == Mask2d) {
- result.mVertexShaderString = sLayerMaskVS;
- result.mFragmentShaderString = sComponentPassMask2FS;
- } else {
- result.mVertexShaderString = sLayerVS;
- result.mFragmentShaderString = sComponentPass2FS;
- }
- AddCommonArgs(result);
- result.mAttributes.AppendElement(Argument("aTexCoord"));
- result.mTextureCount = 2;
- break;
- case ComponentAlphaPass2RGBProgramType:
- if (aMask == Mask2d) {
- result.mVertexShaderString = sLayerMaskVS;
- result.mFragmentShaderString = sComponentPassMask2RGBFS;
- } else {
- result.mVertexShaderString = sLayerVS;
- result.mFragmentShaderString = sComponentPass2RGBFS;
- }
- AddCommonArgs(result);
- result.mAttributes.AppendElement(Argument("aTexCoord"));
- result.mTextureCount = 2;
- break;
- case Copy2DProgramType:
- NS_ASSERTION(!aMask, "Program does not have masked variant.");
- result.mVertexShaderString = sCopyVS;
- result.mFragmentShaderString = sCopy2DFS;
- result.mAttributes.AppendElement(Argument("aVertexCoord"));
- result.mAttributes.AppendElement(Argument("aTexCoord"));
- result.mTextureCount = 1;
- break;
- case Copy2DRectProgramType:
- NS_ASSERTION(!aMask, "Program does not have masked variant.");
- result.mVertexShaderString = sCopyVS;
- result.mFragmentShaderString = sCopy2DRectFS;
- result.mAttributes.AppendElement(Argument("aVertexCoord"));
- result.mAttributes.AppendElement(Argument("aTexCoord"));
- result.mTextureCount = 1;
- break;
- default:
- NS_NOTREACHED("Unknown shader program type.");
+ }
+
+ const char *sampler2D = "sampler2D";
+ const char *texture2D = "texture2D";
+
+ if (aConfig.mFeatures & ENABLE_TEXTURE_RECT) {
+ fs << "#extension GL_ARB_texture_rectangle : require" << endl;
+ fs << "uniform vec2 uTexCoordMultiplier;" << endl;
+ sampler2D = "sampler2DRect";
+ texture2D = "texture2DRect";
+ }
+
+ if (aConfig.mFeatures & ENABLE_TEXTURE_EXTERNAL) {
+ fs << "#extension GL_OES_EGL_image_external : require" << endl;
+ sampler2D = "samplerExternalOES";
+ }
+
+ if (aConfig.mFeatures & ENABLE_TEXTURE_YCBCR) {
+ fs << "uniform sampler2D uYTexture;" << endl;
+ fs << "uniform sampler2D uCbTexture;" << endl;
+ fs << "uniform sampler2D uCrTexture;" << endl;
+ } else if (aConfig.mFeatures & ENABLE_TEXTURE_COMPONENT_ALPHA) {
+ fs << "uniform sampler2D uBlackTexture;" << endl;
+ fs << "uniform sampler2D uWhiteTexture;" << endl;
+ fs << "uniform bool uTexturePass2;" << endl;
+ } else {
+ fs << "uniform " << sampler2D << " uTexture;" << endl;
+ }
+
+ if (aConfig.mFeatures & ENABLE_MASK_2D ||
+ aConfig.mFeatures & ENABLE_MASK_3D) {
+ fs << "varying vec3 vMaskCoord;" << endl;
+ fs << "uniform sampler2D uMaskTexture;" << endl;
}
- if (aMask > MaskNone) {
- result.mTextureCount += 1;
+ if (!(aConfig.mFeatures & ENABLE_RENDER_COLOR)) {
+ fs << "vec4 sample(vec2 coord) {" << endl;
+ fs << " vec4 color;" << endl;
+ if (aConfig.mFeatures & ENABLE_TEXTURE_YCBCR) {
+ fs << " COLOR_PRECISION float y = texture2D(uYTexture, coord).r;" << endl;
+ fs << " COLOR_PRECISION float cb = texture2D(uCbTexture, coord).r;" << endl;
+ fs << " COLOR_PRECISION float cr = texture2D(uCrTexture, coord).r;" << endl;
+ fs << " y = (y - 0.0625) * 1.164;" << endl;
+ fs << " cb = cb - 0.5;" << endl;
+ fs << " cr = cr - 0.5;" << endl;
+ fs << " color.r = y + cr * 1.596;" << endl;
+ fs << " color.g = y - 0.813 * cr - 0.391 * cb;" << endl;
+ fs << " color.b = y + cb * 2.018;" << endl;
+ fs << " color.a = 1.0;" << endl;
+ } else if (aConfig.mFeatures & ENABLE_TEXTURE_COMPONENT_ALPHA) {
+ fs << " COLOR_PRECISION vec3 onBlack = texture2D(uBlackTexture, coord).rgb;" << endl;
+ fs << " COLOR_PRECISION vec3 onWhite = texture2D(uWhiteTexture, coord).rgb;" << endl;
+ fs << " COLOR_PRECISION vec4 alphas = (1.0 - onWhite + onBlack).rgbg;" << endl;
+ fs << " if (uTexturePass2)" << endl;
+ fs << " color = vec4(onBlack, alphas.a);" << endl;
+ fs << " else" << endl;
+ fs << " color = alphas;" << endl;
+ } else {
+ fs << " color = " << texture2D << "(uTexture, coord);" << endl;
+ }
+ if (aConfig.mFeatures & ENABLE_TEXTURE_RB_SWAP) {
+ fs << " color = color.bgra;" << endl;
+ }
+ if (aConfig.mFeatures & ENABLE_TEXTURE_NO_ALPHA) {
+ fs << " color = vec4(color.rgb, 1.0);" << endl;
+ }
+ fs << " return color;" << endl;
+ fs << "}" << endl;
+ if (aConfig.mFeatures & ENABLE_BLUR) {
+ fs << "vec4 sampleAtRadius(vec2 coord, float radius) {" << endl;
+ fs << " coord += uBlurOffset;" << endl;
+ fs << " coord += radius * uBlurRadius;" << endl;
+ fs << " if (coord.x < 0. || coord.y < 0. || coord.x > 1. || coord.y > 1.)" << endl;
+ fs << " return vec4(0, 0, 0, 0);" << endl;
+ fs << " return sample(coord);" << endl;
+ fs << "}" << endl;
+ fs << "vec4 blur(vec4 color, vec2 coord) {" << endl;
+ fs << " vec4 total = color * uBlurGaussianKernel[0];" << endl;
+ fs << " for (int i = 1; i < " << GAUSSIAN_KERNEL_HALF_WIDTH << "; ++i) {" << endl;
+ fs << " float r = float(i) * " << GAUSSIAN_KERNEL_STEP << " << endl;" << endl;
+ fs << " float k = uBlurGaussianKernel[i];" << endl;
+ fs << " total += sampleAtRadius(coord, r) * k;" << endl;
+ fs << " total += sampleAtRadius(coord, -r) * k;" << endl;
+ fs << " }" << endl;
+ fs << " if (uBlurAlpha) {" << endl;
+ fs << " color *= total.a;" << endl;
+ fs << " } else {" << endl;
+ fs << " color = total;" << endl;
+ fs << " }" << endl;
+ fs << " return color;" << endl;
+ fs << "}" << endl;
+ }
+ }
+ fs << "void main() {" << endl;
+ if (aConfig.mFeatures & ENABLE_RENDER_COLOR) {
+ fs << " vec4 color = uRenderColor;" << endl;
+ } else {
+ if (aConfig.mFeatures & ENABLE_TEXTURE_RECT) {
+ fs << " vec4 color = sample(vTexCoord * uTexCoordMultiplier);" << endl;
+ } else {
+ fs << " vec4 color = sample(vTexCoord);" << endl;
+ }
+ if (aConfig.mFeatures & ENABLE_BLUR) {
+ fs << " color = blur(color, vTexCoord);" << endl;
+ }
+ if (aConfig.mFeatures & ENABLE_COLOR_MATRIX) {
+ fs << " color = uColorMatrix * vec4(color.rgb / color.a, color.a) + uColorMatrixVector;" << endl;
+ fs << " color.rgb *= color.a;" << endl;
+ }
+ if (aConfig.mFeatures & ENABLE_OPACITY) {
+ fs << " color *= uLayerOpacity;" << endl;
+ }
+ }
+ if (aConfig.mFeatures & ENABLE_MASK_3D) {
+ fs << " vec2 maskCoords = vMaskCoord.xy / vMaskCoord.z;" << endl;
+ fs << " COLOR_PRECISION float mask = texture2D(uMaskTexture, maskCoords).r;" << endl;
+ fs << " color *= mask;" << endl;
+ } else if (aConfig.mFeatures & ENABLE_MASK_2D) {
+ fs << " COLOR_PRECISION float mask = texture2D(uMaskTexture, vMaskCoord.xy).r;" << endl;
+ fs << " color *= mask;" << endl;
+ } else {
+ fs << " COLOR_PRECISION float mask = 1.0;" << endl;
+ fs << " color *= mask;" << endl;
+ }
+ fs << " gl_FragColor = color;" << endl;
+ fs << "}" << endl;
+
+ result.mVertexShaderString = vs.str();
+ result.mFragmentShaderString = fs.str();
+
+ result.mAttributes.AppendElement(Argument("aVertexCoord"));
+ if (aConfig.mFeatures & ENABLE_RENDER_COLOR) {
+ result.mTextureCount = 0;
+ } else {
+ result.mAttributes.AppendElement(Argument("aTexCoord"));
+ if (aConfig.mFeatures & ENABLE_TEXTURE_YCBCR) {
+ result.mTextureCount = 3;
+ } else if (aConfig.mFeatures & ENABLE_TEXTURE_COMPONENT_ALPHA) {
+ result.mTextureCount = 2;
+ } else {
+ result.mTextureCount = 1;
+ }
+ }
+ if (aConfig.mFeatures & ENABLE_MASK_2D ||
+ aConfig.mFeatures & ENABLE_MASK_3D) {
+ result.mTextureCount = 1;
}
return result;
}
const char* const ShaderProgramOGL::VertexCoordAttrib = "aVertexCoord";
const char* const ShaderProgramOGL::TexCoordAttrib = "aTexCoord";
ShaderProgramOGL::ShaderProgramOGL(GLContext* aGL, const ProgramProfileOGL& aProfile)
- : mIsProjectionMatrixStale(false)
- , mGL(aGL)
+ : mGL(aGL)
, mProgram(0)
, mProfile(aProfile)
, mProgramState(STATE_NEW)
{
}
ShaderProgramOGL::~ShaderProgramOGL()
{
@@ -298,18 +383,25 @@ ShaderProgramOGL::~ShaderProgramOGL()
ctx->fDeleteProgram(mProgram);
}
bool
ShaderProgramOGL::Initialize()
{
NS_ASSERTION(mProgramState == STATE_NEW, "Shader program has already been initialised");
- if (!CreateProgram(mProfile.mVertexShaderString,
- mProfile.mFragmentShaderString)) {
+ ostringstream vs, fs;
+ for (uint32_t i = 0; i < mProfile.mDefines.Length(); ++i) {
+ vs << mProfile.mDefines[i] << endl;
+ fs << mProfile.mDefines[i] << endl;
+ }
+ vs << mProfile.mVertexShaderString << endl;
+ fs << mProfile.mFragmentShaderString << endl;
+
+ if (!CreateProgram(vs.str().c_str(), fs.str().c_str())) {
mProgramState = STATE_ERROR;
return false;
}
mProgramState = STATE_OK;
for (uint32_t i = 0; i < KnownUniform::KnownUniformCount; ++i) {
mProfile.mUniforms[i].mLocation =
@@ -317,17 +409,17 @@ ShaderProgramOGL::Initialize()
}
for (uint32_t i = 0; i < mProfile.mAttributes.Length(); ++i) {
mProfile.mAttributes[i].mLocation =
mGL->fGetAttribLocation(mProgram, mProfile.mAttributes[i].mName);
NS_ASSERTION(mProfile.mAttributes[i].mLocation >= 0, "Bad attribute location.");
}
- mProfile.mHasMatrixProj = mProfile.mUniforms[KnownUniform::MatrixProj].mLocation != -1;
+ //mProfile.mHasMatrixProj = mProfile.mUniforms[KnownUniform::MatrixProj].mLocation != -1;
return true;
}
GLint
ShaderProgramOGL::CreateShader(GLenum aShaderType, const char *aShaderSource)
{
GLint success, len = 0;
@@ -434,17 +526,12 @@ ShaderProgramOGL::Activate()
if (mProgramState == STATE_NEW) {
if (!Initialize()) {
NS_WARNING("Shader could not be initialised");
return;
}
}
NS_ASSERTION(HasInitialized(), "Attempting to activate a program that's not in use!");
mGL->fUseProgram(mProgram);
-
- // check if we need to set the projection matrix
- if (mIsProjectionMatrixStale) {
- SetProjectionMatrix(mProjectionMatrix);
- }
}
} /* layers */
} /* mozilla */
--- a/gfx/layers/opengl/OGLShaderProgram.h
+++ b/gfx/layers/opengl/OGLShaderProgram.h
@@ -14,42 +14,39 @@
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
#include "mozilla/gfx/Rect.h" // for Rect
#include "mozilla/gfx/Types.h"
#include "nsDebug.h" // for NS_ASSERTION
#include "nsPoint.h" // for nsIntPoint
#include "nsTArray.h" // for nsTArray
#include "mozilla/layers/CompositorTypes.h"
+#include <string>
+
struct gfxRGBA;
struct nsIntRect;
namespace mozilla {
namespace layers {
class Layer;
-enum ShaderProgramType {
- RGBALayerProgramType,
- BGRALayerProgramType,
- RGBXLayerProgramType,
- BGRXLayerProgramType,
- RGBARectLayerProgramType,
- RGBXRectLayerProgramType,
- BGRARectLayerProgramType,
- RGBAExternalLayerProgramType,
- ColorLayerProgramType,
- YCbCrLayerProgramType,
- ComponentAlphaPass1ProgramType,
- ComponentAlphaPass1RGBProgramType,
- ComponentAlphaPass2ProgramType,
- ComponentAlphaPass2RGBProgramType,
- Copy2DProgramType,
- Copy2DRectProgramType,
- NumProgramTypes
+enum ShaderFeatures {
+ ENABLE_RENDER_COLOR=0x01,
+ ENABLE_TEXTURE_RECT=0x02,
+ ENABLE_TEXTURE_EXTERNAL=0x04,
+ ENABLE_TEXTURE_YCBCR=0x08,
+ ENABLE_TEXTURE_COMPONENT_ALPHA=0x10,
+ ENABLE_TEXTURE_NO_ALPHA=0x20,
+ ENABLE_TEXTURE_RB_SWAP=0x40,
+ ENABLE_OPACITY=0x80,
+ ENABLE_BLUR=0x100,
+ ENABLE_COLOR_MATRIX=0x200,
+ ENABLE_MASK_2D=0x400,
+ ENABLE_MASK_3D=0x800
};
class KnownUniform {
public:
enum KnownUniformName {
NotAKnownUniform = -1,
LayerTransform = 0,
@@ -63,16 +60,17 @@ public:
YTexture,
CbTexture,
CrTexture,
BlackTexture,
WhiteTexture,
MaskTexture,
RenderColor,
TexCoordMultiplier,
+ TexturePass2,
KnownUniformCount
};
KnownUniform()
{
mName = NotAKnownUniform;
mNameString = nullptr;
@@ -151,109 +149,76 @@ public:
union {
int i1;
float f1;
float f16v[16];
} mValue;
};
-static inline ShaderProgramType
-ShaderProgramFromSurfaceFormat(gfx::SurfaceFormat aFormat)
+class ShaderConfigOGL
{
- switch (aFormat) {
- case gfx::SurfaceFormat::B8G8R8A8:
- return BGRALayerProgramType;
- case gfx::SurfaceFormat::B8G8R8X8:
- return BGRXLayerProgramType;
- case gfx::SurfaceFormat::R8G8B8A8:
- return RGBALayerProgramType;
- case gfx::SurfaceFormat::R8G8B8X8:
- case gfx::SurfaceFormat::R5G6B5:
- return RGBXLayerProgramType;
- case gfx::SurfaceFormat::A8:
- // We don't have a specific luminance shader
- break;
- default:
- NS_ASSERTION(false, "Unhandled surface format!");
+public:
+ ShaderConfigOGL() :
+ mFeatures(0) {}
+
+ void SetRenderColor(bool aEnabled);
+ void SetTextureTarget(GLenum aTarget);
+ void SetRBSwap(bool aEnabled);
+ void SetNoAlpha(bool aEnabled);
+ void SetOpacity(bool aEnabled);
+ void SetYCbCr(bool aEnabled);
+ void SetComponentAlpha(bool aEnabled);
+ void SetColorMatrix(bool aEnabled);
+ void SetBlur(bool aEnabled);
+ void SetMask2D(bool aEnabled);
+ void SetMask3D(bool aEnabled);
+
+ bool operator< (const ShaderConfigOGL& other) const {
+ return mFeatures < other.mFeatures;
}
- return ShaderProgramType(0);
-}
-static inline ShaderProgramType
-ShaderProgramFromTargetAndFormat(GLenum aTarget,
- gfx::SurfaceFormat aFormat)
+public:
+ void SetFeature(int aBitmask, bool aState) {
+ if (aState)
+ mFeatures |= aBitmask;
+ else
+ mFeatures &= (~aBitmask);
+ }
+
+ int mFeatures;
+};
+
+static inline ShaderConfigOGL
+ShaderConfigFromTargetAndFormat(GLenum aTarget,
+ gfx::SurfaceFormat aFormat)
{
- switch(aTarget) {
- case LOCAL_GL_TEXTURE_EXTERNAL:
- MOZ_ASSERT(aFormat == gfx::SurfaceFormat::R8G8B8A8);
- return RGBAExternalLayerProgramType;
- case LOCAL_GL_TEXTURE_RECTANGLE_ARB:
- MOZ_ASSERT(aFormat == gfx::SurfaceFormat::R8G8B8A8 ||
- aFormat == gfx::SurfaceFormat::R8G8B8X8);
- if (aFormat == gfx::SurfaceFormat::R8G8B8A8)
- return RGBARectLayerProgramType;
- else
- return RGBXRectLayerProgramType;
- default:
- return ShaderProgramFromSurfaceFormat(aFormat);
- }
-}
-
-static inline ShaderProgramType
-ShaderProgramFromContentType(gfxContentType aContentType)
-{
- if (aContentType == gfxContentType::COLOR_ALPHA)
- return RGBALayerProgramType;
- return RGBXLayerProgramType;
+ ShaderConfigOGL config;
+ config.SetTextureTarget(aTarget);
+ config.SetRBSwap(aFormat == gfx::SurfaceFormat::B8G8R8A8 ||
+ aFormat == gfx::SurfaceFormat::B8G8R8X8);
+ config.SetNoAlpha(aFormat == gfx::SurfaceFormat::B8G8R8X8 ||
+ aFormat == gfx::SurfaceFormat::R8G8B8X8 ||
+ aFormat == gfx::SurfaceFormat::R5G6B5);
+ return config;
}
/**
* This struct represents the shaders that make up a program and the uniform
* and attribute parmeters that those shaders take.
* It is used by ShaderProgramOGL.
* Use the factory method GetProfileFor to create instances.
*/
struct ProgramProfileOGL
{
/**
* Factory method; creates an instance of this class for the given
- * ShaderProgramType
- */
- static ProgramProfileOGL GetProfileFor(ShaderProgramType aType,
- MaskType aMask);
-
- /**
- * returns true if such a shader program exists
+ * ShaderConfigOGL
*/
- static bool ProgramExists(ShaderProgramType aType, MaskType aMask)
- {
- if (aType < 0 ||
- aType >= NumProgramTypes)
- return false;
-
- if (aMask < MaskNone ||
- aMask >= NumMaskTypes)
- return false;
-
- if (aMask == Mask2d &&
- (aType == Copy2DProgramType ||
- aType == Copy2DRectProgramType))
- return false;
-
- if (aMask != MaskNone &&
- aType == BGRARectLayerProgramType)
- return false;
-
- return aMask != Mask3d ||
- aType == RGBARectLayerProgramType ||
- aType == RGBXRectLayerProgramType ||
- aType == RGBALayerProgramType;
- }
-
+ static ProgramProfileOGL GetProfileFor(ShaderConfigOGL aConfig);
/**
* These two methods lookup the location of a uniform and attribute,
* respectively. Returns -1 if the named uniform/attribute does not
* have a location for the shaders represented by this profile.
*/
GLint LookupAttributeLocation(const char* aName)
{
@@ -271,27 +236,27 @@ struct ProgramProfileOGL
{
Argument(const char* aName) :
mName(aName) {}
const char* mName;
GLint mLocation;
};
// the source code for the program's shaders
- const char *mVertexShaderString;
- const char *mFragmentShaderString;
+ std::string mVertexShaderString;
+ std::string mFragmentShaderString;
KnownUniform mUniforms[KnownUniform::KnownUniformCount];
nsTArray<Argument> mAttributes;
+ nsTArray<const char *> mDefines;
uint32_t mTextureCount;
- bool mHasMatrixProj;
-private:
+
ProgramProfileOGL() :
- mTextureCount(0),
- mHasMatrixProj(false) {}
+ mTextureCount(0)
+ {}
};
#if defined(DEBUG)
#define CHECK_CURRENT_PROGRAM 1
#define ASSERT_THIS_PROGRAM \
do { \
GLuint currentProgram; \
@@ -336,20 +301,16 @@ public:
/**
* Lookup the location of an attribute
*/
GLint AttribLocation(const char* aName) {
return mProfile.LookupAttributeLocation(aName);
}
- GLint GetTexCoordMultiplierUniformLocation() {
- return mProfile.mUniforms[KnownUniform::TexCoordMultiplier].mLocation;
- }
-
/**
* The following set of methods set a uniform argument to the shader program.
* Not all uniforms may be set for all programs, and such uses will throw
* an assertion.
*/
void SetLayerTransform(const gfx::Matrix4x4& aMatrix) {
SetMatrixUniform(KnownUniform::LayerTransform, aMatrix);
}
@@ -371,27 +332,18 @@ public:
gfx3DMatrix m;
m._11 = aRect.width;
m._22 = aRect.height;
m._41 = aRect.x;
m._42 = aRect.y;
SetMatrixUniform(KnownUniform::LayerQuadTransform, m);
}
- // Set a projection matrix on the program to be set the next time
- // the program is activated.
- void DelayedSetProjectionMatrix(const gfx::Matrix4x4& aMatrix)
- {
- mIsProjectionMatrixStale = true;
- mProjectionMatrix = aMatrix;
- }
-
void SetProjectionMatrix(const gfx::Matrix4x4& aMatrix) {
SetMatrixUniform(KnownUniform::MatrixProj, aMatrix);
- mIsProjectionMatrixStale = false;
}
// sets this program's texture transform, if it uses one
void SetTextureTransform(const gfx::Matrix4x4& aMatrix) {
SetMatrixUniform(KnownUniform::TextureTransform, aMatrix);
}
void SetRenderOffset(const nsIntPoint& aOffset) {
@@ -449,35 +401,42 @@ public:
SetUniform(KnownUniform::RenderColor, aColor);
}
void SetTexCoordMultiplier(float aWidth, float aHeight) {
float f[] = {aWidth, aHeight};
SetUniform(KnownUniform::TexCoordMultiplier, 2, f);
}
+ // Set whether we want the component alpha shader to return the color
+ // vector (pass 1, false) or the alpha vector (pass2, true). With support
+ // for multiple render targets we wouldn't need two passes here.
+ void SetTexturePass2(bool aFlag) {
+ SetUniform(KnownUniform::TexturePass2, aFlag ? 1 : 0);
+ }
+
// the names of attributes
static const char* const VertexCoordAttrib;
static const char* const TexCoordAttrib;
protected:
- gfx::Matrix4x4 mProjectionMatrix;
- // true if the projection matrix needs setting
- bool mIsProjectionMatrixStale;
-
RefPtr<GLContext> mGL;
// the OpenGL id of the program
GLuint mProgram;
ProgramProfileOGL mProfile;
enum {
STATE_NEW,
STATE_OK,
STATE_ERROR
} mProgramState;
+#ifdef CHECK_CURRENT_PROGRAM
+ static int sCurrentProgramKey;
+#endif
+
void SetUniform(KnownUniform::KnownUniformName aKnownUniform, float aFloatValue)
{
ASSERT_THIS_PROGRAM;
NS_ASSERTION(aKnownUniform >= 0 && aKnownUniform < KnownUniform::KnownUniformCount, "Invalid known uniform");
KnownUniform& ku(mProfile.mUniforms[aKnownUniform]);
if (ku.UpdateUniform(aFloatValue)) {
mGL->fUniform1f(ku.mLocation, aFloatValue);
deleted file mode 100644
--- a/gfx/layers/opengl/OGLShaders.h
+++ /dev/null
@@ -1,1045 +0,0 @@
-/* AUTOMATICALLY GENERATED from OGLShaders.txt */
-/* DO NOT EDIT! */
-
-static const char sLayerVS[] = "/* sLayerVS */\n\
-/* Vertex Shader */\n\
-uniform mat4 uMatrixProj;\n\
-uniform mat4 uLayerQuadTransform;\n\
-uniform mat4 uLayerTransform;\n\
-uniform mat4 uTextureTransform;\n\
-uniform vec4 uRenderTargetOffset;\n\
-attribute vec4 aVertexCoord;\n\
-attribute vec2 aTexCoord;\n\
-varying vec2 vTexCoord;\n\
-\n\
-void main()\n\
-{\n\
-vec4 finalPosition = aVertexCoord;\n\
-finalPosition = uLayerQuadTransform * finalPosition;\n\
-finalPosition = uLayerTransform * finalPosition;\n\
-finalPosition.xyz /= finalPosition.w;\n\
-\n\
-\n\
-finalPosition = finalPosition - uRenderTargetOffset;\n\
-finalPosition.xyz *= finalPosition.w;\n\
-finalPosition = uMatrixProj * finalPosition;\n\
-vTexCoord = (uTextureTransform * vec4(aTexCoord.x, aTexCoord.y, 0.0, 1.0)).xy;\n\
-gl_Position = finalPosition;\n\
-}\n\
-";
-
-static const char sLayerMaskVS[] = "/* sLayerMaskVS */\n\
-/* Vertex Shader */\n\
-uniform mat4 uMatrixProj;\n\
-uniform mat4 uLayerQuadTransform;\n\
-uniform mat4 uLayerTransform;\n\
-uniform mat4 uTextureTransform;\n\
-uniform vec4 uRenderTargetOffset;\n\
-attribute vec4 aVertexCoord;\n\
-attribute vec2 aTexCoord;\n\
-varying vec2 vTexCoord;\n\
-\n\
-uniform mat4 uMaskQuadTransform;\n\
-varying vec2 vMaskCoord;\n\
-\n\
-void main()\n\
-{\n\
-vec4 finalPosition = aVertexCoord;\n\
-finalPosition = uLayerQuadTransform * finalPosition;\n\
-finalPosition = uLayerTransform * finalPosition;\n\
-finalPosition.xyz /= finalPosition.w;\n\
-vMaskCoord = (uMaskQuadTransform * finalPosition).xy;\n\
-\n\
-finalPosition = finalPosition - uRenderTargetOffset;\n\
-finalPosition.xyz *= finalPosition.w;\n\
-finalPosition = uMatrixProj * finalPosition;\n\
-vTexCoord = (uTextureTransform * vec4(aTexCoord.x, aTexCoord.y, 0.0, 1.0)).xy;\n\
-gl_Position = finalPosition;\n\
-}\n\
-";
-
-static const char sLayerMask3DVS[] = "/* sLayerMask3DVS */\n\
-/* Vertex Shader */\n\
-uniform mat4 uMatrixProj;\n\
-uniform mat4 uLayerQuadTransform;\n\
-uniform mat4 uLayerTransform;\n\
-uniform mat4 uTextureTransform;\n\
-uniform vec4 uRenderTargetOffset;\n\
-attribute vec4 aVertexCoord;\n\
-attribute vec2 aTexCoord;\n\
-varying vec2 vTexCoord;\n\
-\n\
-uniform mat4 uMaskQuadTransform;\n\
-varying vec3 vMaskCoord;\n\
-\n\
-void main()\n\
-{\n\
-vec4 finalPosition = aVertexCoord;\n\
-finalPosition = uLayerQuadTransform * finalPosition;\n\
-finalPosition = uLayerTransform * finalPosition;\n\
-finalPosition.xyz /= finalPosition.w;\n\
-vMaskCoord.xy = (uMaskQuadTransform * vec4(finalPosition.xyz, 1.0)).xy;\n\
-// correct for perspective correct interpolation, see comment in D3D10 shader\n\
-vMaskCoord.z = 1.0;\n\
-vMaskCoord *= finalPosition.w;\n\
-\n\
-finalPosition = finalPosition - uRenderTargetOffset;\n\
-finalPosition.xyz *= finalPosition.w;\n\
-finalPosition = uMatrixProj * finalPosition;\n\
-vTexCoord = (uTextureTransform * vec4(aTexCoord.x, aTexCoord.y, 0.0, 1.0)).xy;\n\
-gl_Position = finalPosition;\n\
-}\n\
-";
-
-static const char sSolidColorLayerFS[] = "/* sSolidColorLayerFS */\n\
-#define NO_LAYER_OPACITY 1\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-uniform COLOR_PRECISION vec4 uRenderColor;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION float mask = 1.0;\n\
-\n\
-gl_FragColor = mask * uRenderColor;\n\
-}\n\
-";
-
-static const char sSolidColorLayerMaskFS[] = "/* sSolidColorLayerMaskFS */\n\
-#define NO_LAYER_OPACITY 1\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-varying vec2 vMaskCoord;\n\
-uniform sampler2D uMaskTexture;\n\
-\n\
-uniform COLOR_PRECISION vec4 uRenderColor;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION float mask = texture2D(uMaskTexture, vMaskCoord).r;\n\
-\n\
-gl_FragColor = mask * uRenderColor;\n\
-}\n\
-";
-
-static const char sRGBATextureLayerFS[] = "/* sRGBATextureLayerFS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-uniform sampler2D uTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION float mask = 1.0;\n\
-\n\
-gl_FragColor = texture2D(uTexture, vTexCoord) * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sRGBATextureLayerMaskFS[] = "/* sRGBATextureLayerMaskFS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-varying vec2 vMaskCoord;\n\
-uniform sampler2D uMaskTexture;\n\
-\n\
-uniform sampler2D uTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION float mask = texture2D(uMaskTexture, vMaskCoord).r;\n\
-\n\
-gl_FragColor = texture2D(uTexture, vTexCoord) * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sRGBATextureLayerMask3DFS[] = "/* sRGBATextureLayerMask3DFS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-varying vec3 vMaskCoord;\n\
-uniform sampler2D uMaskTexture;\n\
-\n\
-uniform sampler2D uTexture;\n\
-void main()\n\
-{\n\
-vec2 maskCoords = vMaskCoord.xy / vMaskCoord.z;\n\
-COLOR_PRECISION float mask = texture2D(uMaskTexture, maskCoords).r;\n\
-\n\
-gl_FragColor = texture2D(uTexture, vTexCoord) * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sRGBARectTextureLayerFS[] = "/* sRGBARectTextureLayerFS */\n\
-#extension GL_ARB_texture_rectangle : enable\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-/* This should not be used on GL ES */\n\
-#ifndef GL_ES\n\
-uniform sampler2DRect uTexture;\n\
-uniform vec2 uTexCoordMultiplier;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION float mask = 1.0;\n\
-\n\
-gl_FragColor = texture2DRect(uTexture, vec2(vTexCoord * uTexCoordMultiplier)) * uLayerOpacity * mask;\n\
-}\n\
-#else\n\
-void main()\n\
-{\n\
-gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n\
-}\n\
-#endif\n\
-";
-
-static const char sRGBARectTextureLayerMaskFS[] = "/* sRGBARectTextureLayerMaskFS */\n\
-#extension GL_ARB_texture_rectangle : enable\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-varying vec2 vMaskCoord;\n\
-uniform sampler2D uMaskTexture;\n\
-\n\
-/* This should not be used on GL ES */\n\
-#ifndef GL_ES\n\
-uniform sampler2DRect uTexture;\n\
-uniform vec2 uTexCoordMultiplier;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION float mask = texture2D(uMaskTexture, vMaskCoord).r;\n\
-\n\
-gl_FragColor = texture2DRect(uTexture, vec2(vTexCoord * uTexCoordMultiplier)) * uLayerOpacity * mask;\n\
-}\n\
-#else\n\
-void main()\n\
-{\n\
-gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n\
-}\n\
-#endif\n\
-";
-
-static const char sRGBARectTextureLayerMask3DFS[] = "/* sRGBARectTextureLayerMask3DFS */\n\
-#extension GL_ARB_texture_rectangle : enable\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-varying vec3 vMaskCoord;\n\
-uniform sampler2D uMaskTexture;\n\
-\n\
-/* This should not be used on GL ES */\n\
-#ifndef GL_ES\n\
-uniform sampler2DRect uTexture;\n\
-uniform vec2 uTexCoordMultiplier;\n\
-void main()\n\
-{\n\
-vec2 maskCoords = vMaskCoord.xy / vMaskCoord.z;\n\
-COLOR_PRECISION float mask = texture2D(uMaskTexture, maskCoords).r;\n\
-\n\
-gl_FragColor = texture2DRect(uTexture, vec2(vTexCoord * uTexCoordMultiplier)) * uLayerOpacity * mask;\n\
-}\n\
-#else\n\
-void main()\n\
-{\n\
-gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n\
-}\n\
-#endif\n\
-";
-
-static const char sRGBXRectTextureLayerFS[] = "/* sRGBXRectTextureLayerFS */\n\
-#extension GL_ARB_texture_rectangle : enable\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-/* This should not be used on GL ES */\n\
-#ifndef GL_ES\n\
-uniform sampler2DRect uTexture;\n\
-uniform vec2 uTexCoordMultiplier;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION float mask = 1.0;\n\
-\n\
-gl_FragColor = vec4(texture2DRect(uTexture, vec2(vTexCoord * uTexCoordMultiplier)).rgb, 1.0) * uLayerOpacity * mask;\n\
-}\n\
-#else\n\
-void main()\n\
-{\n\
-gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n\
-}\n\
-#endif\n\
-";
-
-static const char sRGBXRectTextureLayerMaskFS[] = "/* sRGBXRectTextureLayerMaskFS */\n\
-#extension GL_ARB_texture_rectangle : enable\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-varying vec2 vMaskCoord;\n\
-uniform sampler2D uMaskTexture;\n\
-\n\
-/* This should not be used on GL ES */\n\
-#ifndef GL_ES\n\
-uniform sampler2DRect uTexture;\n\
-uniform vec2 uTexCoordMultiplier;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION float mask = texture2D(uMaskTexture, vMaskCoord).r;\n\
-\n\
-gl_FragColor = vec4(texture2DRect(uTexture, vec2(vTexCoord * uTexCoordMultiplier)).rgb, 1.0) * uLayerOpacity * mask;\n\
-}\n\
-#else\n\
-void main()\n\
-{\n\
-gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n\
-}\n\
-#endif\n\
-";
-
-static const char sRGBXRectTextureLayerMask3DFS[] = "/* sRGBXRectTextureLayerMask3DFS */\n\
-#extension GL_ARB_texture_rectangle : enable\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-varying vec3 vMaskCoord;\n\
-uniform sampler2D uMaskTexture;\n\
-\n\
-/* This should not be used on GL ES */\n\
-#ifndef GL_ES\n\
-uniform sampler2DRect uTexture;\n\
-uniform vec2 uTexCoordMultiplier;\n\
-void main()\n\
-{\n\
-vec2 maskCoords = vMaskCoord.xy / vMaskCoord.z;\n\
-COLOR_PRECISION float mask = texture2D(uMaskTexture, maskCoords).r;\n\
-\n\
-gl_FragColor = vec4(texture2DRect(uTexture, vec2(vTexCoord * uTexCoordMultiplier)).rgb, 1.0) * uLayerOpacity * mask;\n\
-}\n\
-#else\n\
-void main()\n\
-{\n\
-gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n\
-}\n\
-#endif\n\
-";
-
-static const char sBGRARectTextureLayerFS[] = "/* sBGRARectTextureLayerFS */\n\
-#extension GL_ARB_texture_rectangle : enable\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-uniform sampler2DRect uTexture;\n\
-uniform vec2 uTexCoordMultiplier;\n\
-void main()\n\
-{\n\
-gl_FragColor = texture2DRect(uTexture, vec2(vTexCoord * uTexCoordMultiplier)).bgra * uLayerOpacity;\n\
-}\n\
-";
-
-static const char sRGBAExternalTextureLayerFS[] = "/* sRGBAExternalTextureLayerFS */\n\
-#extension GL_OES_EGL_image_external : require\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-uniform samplerExternalOES uTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION float mask = 1.0;\n\
-\n\
-gl_FragColor = texture2D(uTexture, vTexCoord) * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sRGBAExternalTextureLayerMaskFS[] = "/* sRGBAExternalTextureLayerMaskFS */\n\
-#extension GL_OES_EGL_image_external : require\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-varying vec2 vMaskCoord;\n\
-uniform sampler2D uMaskTexture;\n\
-\n\
-uniform samplerExternalOES uTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION float mask = texture2D(uMaskTexture, vMaskCoord).r;\n\
-\n\
-gl_FragColor = texture2D(uTexture, vTexCoord) * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sRGBAExternalTextureLayerMask3DFS[] = "/* sRGBAExternalTextureLayerMask3DFS */\n\
-#extension GL_OES_EGL_image_external : require\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-varying vec3 vMaskCoord;\n\
-uniform sampler2D uMaskTexture;\n\
-\n\
-uniform samplerExternalOES uTexture;\n\
-void main()\n\
-{\n\
-vec2 maskCoords = vMaskCoord.xy / vMaskCoord.z;\n\
-COLOR_PRECISION float mask = texture2D(uMaskTexture, maskCoords).r;\n\
-\n\
-gl_FragColor = texture2D(uTexture, vTexCoord) * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sBGRATextureLayerFS[] = "/* sBGRATextureLayerFS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-uniform sampler2D uTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION float mask = 1.0;\n\
-\n\
-gl_FragColor = texture2D(uTexture, vTexCoord).bgra * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sBGRATextureLayerMaskFS[] = "/* sBGRATextureLayerMaskFS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-varying vec2 vMaskCoord;\n\
-uniform sampler2D uMaskTexture;\n\
-\n\
-uniform sampler2D uTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION float mask = texture2D(uMaskTexture, vMaskCoord).r;\n\
-\n\
-gl_FragColor = texture2D(uTexture, vTexCoord).bgra * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sRGBXTextureLayerFS[] = "/* sRGBXTextureLayerFS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-uniform sampler2D uTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION float mask = 1.0;\n\
-\n\
-gl_FragColor = vec4(texture2D(uTexture, vTexCoord).rgb, 1.0) * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sRGBXTextureLayerMaskFS[] = "/* sRGBXTextureLayerMaskFS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-varying vec2 vMaskCoord;\n\
-uniform sampler2D uMaskTexture;\n\
-\n\
-uniform sampler2D uTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION float mask = texture2D(uMaskTexture, vMaskCoord).r;\n\
-\n\
-gl_FragColor = vec4(texture2D(uTexture, vTexCoord).rgb, 1.0) * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sBGRXTextureLayerFS[] = "/* sBGRXTextureLayerFS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-uniform sampler2D uTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION float mask = 1.0;\n\
-\n\
-gl_FragColor = vec4(texture2D(uTexture, vTexCoord).bgr, 1.0) * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sBGRXTextureLayerMaskFS[] = "/* sBGRXTextureLayerMaskFS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-varying vec2 vMaskCoord;\n\
-uniform sampler2D uMaskTexture;\n\
-\n\
-uniform sampler2D uTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION float mask = texture2D(uMaskTexture, vMaskCoord).r;\n\
-\n\
-gl_FragColor = vec4(texture2D(uTexture, vTexCoord).bgr, 1.0) * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sYCbCrTextureLayerFS[] = "/* sYCbCrTextureLayerFS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#endif\n\
-uniform sampler2D uYTexture;\n\
-uniform sampler2D uCbTexture;\n\
-uniform sampler2D uCrTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION vec4 color;\n\
-COLOR_PRECISION float y = texture2D(uYTexture, vTexCoord).r;\n\
-COLOR_PRECISION float cb = texture2D(uCbTexture, vTexCoord).r;\n\
-COLOR_PRECISION float cr = texture2D(uCrTexture, vTexCoord).r;\n\
-y = (y - 0.0625) * 1.164;\n\
-cb = cb - 0.5;\n\
-cr = cr - 0.5;\n\
-color.r = y + cr * 1.596;\n\
-color.g = y - 0.813 * cr - 0.391 * cb;\n\
-color.b = y + cb * 2.018;\n\
-color.a = 1.0;\n\
-COLOR_PRECISION float mask = 1.0;\n\
-\n\
-gl_FragColor = color * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sYCbCrTextureLayerMaskFS[] = "/* sYCbCrTextureLayerMaskFS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-varying vec2 vMaskCoord;\n\
-uniform sampler2D uMaskTexture;\n\
-\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#endif\n\
-uniform sampler2D uYTexture;\n\
-uniform sampler2D uCbTexture;\n\
-uniform sampler2D uCrTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION vec4 color;\n\
-COLOR_PRECISION float y = texture2D(uYTexture, vTexCoord).r;\n\
-COLOR_PRECISION float cb = texture2D(uCbTexture, vTexCoord).r;\n\
-COLOR_PRECISION float cr = texture2D(uCrTexture, vTexCoord).r;\n\
-y = (y - 0.0625) * 1.164;\n\
-cb = cb - 0.5;\n\
-cr = cr - 0.5;\n\
-color.r = y + cr * 1.596;\n\
-color.g = y - 0.813 * cr - 0.391 * cb;\n\
-color.b = y + cb * 2.018;\n\
-color.a = 1.0;\n\
-COLOR_PRECISION float mask = texture2D(uMaskTexture, vMaskCoord).r;\n\
-\n\
-gl_FragColor = color * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sComponentPass1FS[] = "/* sComponentPass1FS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-uniform sampler2D uBlackTexture;\n\
-uniform sampler2D uWhiteTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION vec3 onBlack = texture2D(uBlackTexture, vTexCoord).bgr;\n\
-COLOR_PRECISION vec3 onWhite = texture2D(uWhiteTexture, vTexCoord).bgr;\n\
-COLOR_PRECISION vec4 alphas = (1.0 - onWhite + onBlack).rgbg;\n\
-COLOR_PRECISION float mask = 1.0;\n\
-\n\
-gl_FragColor = alphas * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sComponentPassMask1FS[] = "/* sComponentPassMask1FS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-varying vec2 vMaskCoord;\n\
-uniform sampler2D uMaskTexture;\n\
-\n\
-uniform sampler2D uBlackTexture;\n\
-uniform sampler2D uWhiteTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION vec3 onBlack = texture2D(uBlackTexture, vTexCoord).bgr;\n\
-COLOR_PRECISION vec3 onWhite = texture2D(uWhiteTexture, vTexCoord).bgr;\n\
-COLOR_PRECISION vec4 alphas = (1.0 - onWhite + onBlack).rgbg;\n\
-COLOR_PRECISION float mask = texture2D(uMaskTexture, vMaskCoord).r;\n\
-\n\
-gl_FragColor = alphas * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sComponentPass1RGBFS[] = "/* sComponentPass1RGBFS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-uniform sampler2D uBlackTexture;\n\
-uniform sampler2D uWhiteTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION vec3 onBlack = texture2D(uBlackTexture, vTexCoord).rgb;\n\
-COLOR_PRECISION vec3 onWhite = texture2D(uWhiteTexture, vTexCoord).rgb;\n\
-COLOR_PRECISION vec4 alphas = (1.0 - onWhite + onBlack).rgbg;\n\
-COLOR_PRECISION float mask = 1.0;\n\
-\n\
-gl_FragColor = alphas * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sComponentPassMask1RGBFS[] = "/* sComponentPassMask1RGBFS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-varying vec2 vMaskCoord;\n\
-uniform sampler2D uMaskTexture;\n\
-\n\
-uniform sampler2D uBlackTexture;\n\
-uniform sampler2D uWhiteTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION vec3 onBlack = texture2D(uBlackTexture, vTexCoord).rgb;\n\
-COLOR_PRECISION vec3 onWhite = texture2D(uWhiteTexture, vTexCoord).rgb;\n\
-COLOR_PRECISION vec4 alphas = (1.0 - onWhite + onBlack).rgbg;\n\
-COLOR_PRECISION float mask = texture2D(uMaskTexture, vMaskCoord).r;\n\
-\n\
-gl_FragColor = alphas * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sComponentPass2FS[] = "/* sComponentPass2FS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-uniform sampler2D uBlackTexture;\n\
-uniform sampler2D uWhiteTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION vec3 onBlack = texture2D(uBlackTexture, vTexCoord).bgr;\n\
-COLOR_PRECISION vec3 onWhite = texture2D(uWhiteTexture, vTexCoord).bgr;\n\
-COLOR_PRECISION vec4 alphas = (1.0 - onWhite + onBlack).rgbg;\n\
-COLOR_PRECISION float mask = 1.0;\n\
-\n\
-gl_FragColor = vec4(onBlack, alphas.a) * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sComponentPassMask2FS[] = "/* sComponentPassMask2FS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-varying vec2 vMaskCoord;\n\
-uniform sampler2D uMaskTexture;\n\
-\n\
-uniform sampler2D uBlackTexture;\n\
-uniform sampler2D uWhiteTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION vec3 onBlack = texture2D(uBlackTexture, vTexCoord).bgr;\n\
-COLOR_PRECISION vec3 onWhite = texture2D(uWhiteTexture, vTexCoord).bgr;\n\
-COLOR_PRECISION vec4 alphas = (1.0 - onWhite + onBlack).rgbg;\n\
-COLOR_PRECISION float mask = texture2D(uMaskTexture, vMaskCoord).r;\n\
-\n\
-gl_FragColor = vec4(onBlack, alphas.a) * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sComponentPass2RGBFS[] = "/* sComponentPass2RGBFS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-uniform sampler2D uBlackTexture;\n\
-uniform sampler2D uWhiteTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION vec3 onBlack = texture2D(uBlackTexture, vTexCoord).rgb;\n\
-COLOR_PRECISION vec3 onWhite = texture2D(uWhiteTexture, vTexCoord).rgb;\n\
-COLOR_PRECISION vec4 alphas = (1.0 - onWhite + onBlack).rgbg;\n\
-COLOR_PRECISION float mask = 1.0;\n\
-\n\
-gl_FragColor = vec4(onBlack, alphas.a) * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sComponentPassMask2RGBFS[] = "/* sComponentPassMask2RGBFS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-#ifndef NO_LAYER_OPACITY\n\
-uniform COLOR_PRECISION float uLayerOpacity;\n\
-#endif\n\
-varying vec2 vTexCoord;\n\
-\n\
-varying vec2 vMaskCoord;\n\
-uniform sampler2D uMaskTexture;\n\
-\n\
-uniform sampler2D uBlackTexture;\n\
-uniform sampler2D uWhiteTexture;\n\
-void main()\n\
-{\n\
-COLOR_PRECISION vec3 onBlack = texture2D(uBlackTexture, vTexCoord).rgb;\n\
-COLOR_PRECISION vec3 onWhite = texture2D(uWhiteTexture, vTexCoord).rgb;\n\
-COLOR_PRECISION vec4 alphas = (1.0 - onWhite + onBlack).rgbg;\n\
-COLOR_PRECISION float mask = texture2D(uMaskTexture, vMaskCoord).r;\n\
-\n\
-gl_FragColor = vec4(onBlack, alphas.a) * uLayerOpacity * mask;\n\
-}\n\
-";
-
-static const char sCopyVS[] = "/* sCopyVS */\n\
-/* Vertex Shader */\n\
-attribute vec4 aVertexCoord;\n\
-attribute vec2 aTexCoord;\n\
-varying vec2 vTexCoord;\n\
-void main()\n\
-{\n\
-gl_Position = aVertexCoord;\n\
-vTexCoord = aTexCoord;\n\
-}\n\
-";
-
-static const char sCopy2DFS[] = "/* sCopy2DFS */\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-varying vec2 vTexCoord;\n\
-uniform sampler2D uTexture;\n\
-void main()\n\
-{\n\
-gl_FragColor = texture2D(uTexture, vTexCoord);\n\
-}\n\
-";
-
-static const char sCopy2DRectFS[] = "/* sCopy2DRectFS */\n\
-#extension GL_ARB_texture_rectangle : enable\n\
-/* Fragment Shader */\n\
-#ifdef GL_ES\n\
-precision mediump float;\n\
-#define COLOR_PRECISION lowp\n\
-#else\n\
-#define COLOR_PRECISION\n\
-#endif\n\
-\n\
-varying vec2 vTexCoord;\n\
-uniform vec2 uTexCoordMultiplier;\n\
-#ifndef GL_ES\n\
-uniform sampler2DRect uTexture;\n\
-void main()\n\
-{\n\
-gl_FragColor = texture2DRect(uTexture, vTexCoord * uTexCoordMultiplier);\n\
-}\n\
-#else\n\
-void main()\n\
-{\n\
-gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n\
-}\n\
-#endif\n\
-";
-
deleted file mode 100644
--- a/gfx/layers/opengl/OGLShaders.txt
+++ /dev/null
@@ -1,495 +0,0 @@
-// -*- Mode: glsl; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40; -*-
-
-// 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/.
-
-// This file is compiled by genshaders.py, use genshaders.sh, no arguments necessary.
-// The compiled shaders will be in LayerManagerOGLShaders.h.
-// This file must be compiled after editing, it is not compiled as part of the
-// build process.
-//
-// Syntax:
-//
-// // comments (only at the start of a line)
-//
-// (@ is used because # is valid inside GLSL)
-//
-// multi-line:
-// @define FOO
-// ...
-// @end
-//
-// single:
-// @define FOO 123
-//
-// $FOO$ to paste
-//
-// To generate a constant string named ShaderName (shader name should not
-// use '<', '>', ',', ':', except for parameters, see below):
-// @shader ShaderName
-// ...
-// @end
-//
-// @shader may have a single parameter with multiple values using
-// <param:val1,val2> an empty value is allowed. The shader is expanded for
-// each value, <param> in the body of the shader will be expanded to
-// the current value, as will the declaration of the parameter. The name of
-// defines may include <...> and this should work as expected.
-//
-// For example:
-//
-// @Shader<name:Name1,Name2>
-// string name = "<name>";
-// @end
-//
-// will be expanded to
-//
-// @ShaderName1
-// string name = "Name1";
-// @end
-// @ShaderName2
-// string name = "Name2";
-// @end
-//
-// This will be straightaway compiled to two constant strings named
-// ShaderName1 and ShaderName2.
-//
-
-@define VERTEX_SHADER_HEADER<>
-/* Vertex Shader */
-
-uniform mat4 uMatrixProj;
-uniform mat4 uLayerQuadTransform;
-uniform mat4 uLayerTransform;
-uniform mat4 uTextureTransform;
-uniform vec4 uRenderTargetOffset;
-
-attribute vec4 aVertexCoord;
-attribute vec2 aTexCoord;
-
-varying vec2 vTexCoord;
-@end
-
-@define VERTEX_SHADER_HEADER<Mask>
-$VERTEX_SHADER_HEADER<>$
-
-uniform mat4 uMaskQuadTransform;
-varying vec2 vMaskCoord;
-@end
-
-@define VERTEX_SHADER_HEADER<Mask3D>
-$VERTEX_SHADER_HEADER<>$
-
-uniform mat4 uMaskQuadTransform;
-varying vec3 vMaskCoord;
-@end
-
-@define VERTEX_MASK_STUFF<>
-@end
-
-@define VERTEX_MASK_STUFF<Mask>
- vMaskCoord = (uMaskQuadTransform * finalPosition).xy;
-@end
-
-@define VERTEX_MASK_STUFF<Mask3D>
- vMaskCoord.xy = (uMaskQuadTransform * vec4(finalPosition.xyz, 1.0)).xy;
- // correct for perspective correct interpolation, see comment in D3D10 shader
- vMaskCoord.z = 1.0;
- vMaskCoord *= finalPosition.w;
-@end
-
-
-// This is a basic Layer vertex shader. It's used for all
-// Layer programs.
-
-@shader sLayer<mask:,Mask,Mask3D>VS
-$VERTEX_SHADER_HEADER<mask>$
-
-
-void main()
-{
- vec4 finalPosition = aVertexCoord;
- finalPosition = uLayerQuadTransform * finalPosition;
- finalPosition = uLayerTransform * finalPosition;
- finalPosition.xyz /= finalPosition.w;
-
-$VERTEX_MASK_STUFF<mask>$
-
- finalPosition = finalPosition - uRenderTargetOffset;
- finalPosition.xyz *= finalPosition.w;
- finalPosition = uMatrixProj * finalPosition;
-
- vTexCoord = (uTextureTransform * vec4(aTexCoord.x, aTexCoord.y, 0.0, 1.0)).xy;
-
- gl_Position = finalPosition;
-}
-@end
-
-
-/*
- * Fragment shaders
- */
-
-@define FRAGMENT_SHADER_HEADER
-/* Fragment Shader */
-#ifdef GL_ES
-precision mediump float;
-#define COLOR_PRECISION lowp
-#else
-#define COLOR_PRECISION
-#endif
-@end
-
-// fragment shader header for layers
-@define LAYER_FRAGMENT<>
-$FRAGMENT_SHADER_HEADER$
-
-#ifndef NO_LAYER_OPACITY
-uniform COLOR_PRECISION float uLayerOpacity;
-#endif
-
-varying vec2 vTexCoord;
-@end
-
-// fragment shader header for layers with masks
-@define LAYER_FRAGMENT<Mask>
-$LAYER_FRAGMENT<>$
-
-varying vec2 vMaskCoord;
-uniform sampler2D uMaskTexture;
-@end
-
-// fragment shader header for layers with masks and 3D transforms
-@define LAYER_FRAGMENT<Mask3D>
-$LAYER_FRAGMENT<>$
-
-varying vec3 vMaskCoord;
-uniform sampler2D uMaskTexture;
-@end
-
-@define FRAGMENT_CALC_MASK<>
- COLOR_PRECISION float mask = 1.0;
-@end
-
-@define FRAGMENT_CALC_MASK<Mask>
- COLOR_PRECISION float mask = texture2D(uMaskTexture, vMaskCoord).r;
-@end
-
-@define FRAGMENT_CALC_MASK<Mask3D>
- vec2 maskCoords = vMaskCoord.xy / vMaskCoord.z;
- COLOR_PRECISION float mask = texture2D(uMaskTexture, maskCoords).r;
-@end
-
-// Solid color rendering.
-// texcoords are ignored (no texture to sample).
-// The layer opacity is baked in to the color.
-@shader sSolidColorLayer<mask:,Mask>FS
-#define NO_LAYER_OPACITY 1
-$LAYER_FRAGMENT<mask>$
-uniform COLOR_PRECISION vec4 uRenderColor;
-
-void main()
-{
-$FRAGMENT_CALC_MASK<mask>$
- gl_FragColor = mask * uRenderColor;
-}
-@end
-
-// Single texture in RGBA format
-@shader sRGBATextureLayer<mask:,Mask,Mask3D>FS
-$LAYER_FRAGMENT<mask>$
-uniform sampler2D uTexture;
-
-void main()
-{
-$FRAGMENT_CALC_MASK<mask>$
- gl_FragColor = texture2D(uTexture, vTexCoord) * uLayerOpacity * mask;
-}
-@end
-
-// Single texture in RGBA format, but with a Rect texture.
-// Container layer needs this to render a FBO group.
-@shader sRGBARectTextureLayer<mask:,Mask,Mask3D>FS
-#extension GL_ARB_texture_rectangle : enable
-
-$LAYER_FRAGMENT<mask>$
-
-/* This should not be used on GL ES */
-#ifndef GL_ES
-uniform sampler2DRect uTexture;
-uniform vec2 uTexCoordMultiplier;
-void main()
-{
-$FRAGMENT_CALC_MASK<mask>$
- gl_FragColor = texture2DRect(uTexture, vec2(vTexCoord * uTexCoordMultiplier)) * uLayerOpacity * mask;
-}
-#else
-void main()
-{
- gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
-}
-#endif
-@end
-
-@shader sRGBXRectTextureLayer<mask:,Mask,Mask3D>FS
-#extension GL_ARB_texture_rectangle : enable
-
-$LAYER_FRAGMENT<mask>$
-
-/* This should not be used on GL ES */
-#ifndef GL_ES
-uniform sampler2DRect uTexture;
-uniform vec2 uTexCoordMultiplier;
-void main()
-{
-$FRAGMENT_CALC_MASK<mask>$
- gl_FragColor = vec4(texture2DRect(uTexture, vec2(vTexCoord * uTexCoordMultiplier)).rgb, 1.0) * uLayerOpacity * mask;
-}
-#else
-void main()
-{
- gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
-}
-#endif
-@end
-
-// Single texture in BGRA format, but with a Rect texture.
-// nsChildView needs this for old Mac hardware.
-@shader sBGRARectTextureLayerFS
-#extension GL_ARB_texture_rectangle : enable
-
-$LAYER_FRAGMENT<>$
-
-uniform sampler2DRect uTexture;
-uniform vec2 uTexCoordMultiplier;
-void main()
-{
- gl_FragColor = texture2DRect(uTexture, vec2(vTexCoord * uTexCoordMultiplier)).bgra * uLayerOpacity;
-}
-@end
-
-
-// Single texture in RGBA format, but uses external image. External
-// image is an EGLImage which have internal formats not otherwise
-// supported by OpenGL ES. It is up to the implementation exactly what
-// formats are accepted. It is specified in the OES_EGL_image_external
-// extension.
-@shader sRGBAExternalTextureLayer<mask:,Mask,Mask3D>FS
-#extension GL_OES_EGL_image_external : require
-
-$LAYER_FRAGMENT<mask>$
-uniform samplerExternalOES uTexture;
-
-void main()
-{
-$FRAGMENT_CALC_MASK<mask>$
- gl_FragColor = texture2D(uTexture, vTexCoord) * uLayerOpacity * mask;
-}
-@end
-
-
-// Single texture in BGRA format (via swizzle)
-@shader sBGRATextureLayer<mask:,Mask>FS
-$LAYER_FRAGMENT<mask>$
-uniform sampler2D uTexture;
-
-void main()
-{
-$FRAGMENT_CALC_MASK<mask>$
- gl_FragColor = texture2D(uTexture, vTexCoord).bgra * uLayerOpacity * mask;
-}
-@end
-
-// Single texture in RGBX format
-@shader sRGBXTextureLayer<mask:,Mask>FS
-$LAYER_FRAGMENT<mask>$
-uniform sampler2D uTexture;
-
-void main()
-{
-$FRAGMENT_CALC_MASK<mask>$
- gl_FragColor = vec4(texture2D(uTexture, vTexCoord).rgb, 1.0) * uLayerOpacity * mask;
-}
-@end
-
-// Single texture in BGRX format (via swizzle)
-@shader sBGRXTextureLayer<mask:,Mask>FS
-$LAYER_FRAGMENT<mask>$
-uniform sampler2D uTexture;
-
-void main()
-{
-$FRAGMENT_CALC_MASK<mask>$
- gl_FragColor = vec4(texture2D(uTexture, vTexCoord).bgr, 1.0) * uLayerOpacity * mask;
-}
-@end
-
-// Three textures, representing YCbCr planes of a video image.
-//
-// Some older versions of the Tegra 2 android driver have a bug
-// where arithmetic ops on a texture read are just ignored. So,
-// if the below was |cb = texture2D(...).r - 0.5|, the "- 0.5" was
-// just being ignored/skipped. This, of course, lead to crappy
-// rendering -- see bug 765150. Doing them separately like below
-// makes it all OK. We don't know if this is special to constants,
-// special to 0.5, special to addition/subtraction, etc.
-@shader sYCbCrTextureLayer<mask:,Mask>FS
-$LAYER_FRAGMENT<mask>$
-#ifdef GL_ES
-precision mediump float;
-#endif
-uniform sampler2D uYTexture;
-uniform sampler2D uCbTexture;
-uniform sampler2D uCrTexture;
-
-void main()
-{
- COLOR_PRECISION vec4 color;
-
- COLOR_PRECISION float y = texture2D(uYTexture, vTexCoord).r;
- COLOR_PRECISION float cb = texture2D(uCbTexture, vTexCoord).r;
- COLOR_PRECISION float cr = texture2D(uCrTexture, vTexCoord).r;
-
- y = (y - 0.0625) * 1.164;
- cb = cb - 0.5;
- cr = cr - 0.5;
-
- color.r = y + cr * 1.596;
- color.g = y - 0.813 * cr - 0.391 * cb;
- color.b = y + cb * 2.018;
- color.a = 1.0;
-$FRAGMENT_CALC_MASK<mask>$
- gl_FragColor = color * uLayerOpacity * mask;
-}
-@end
-
-// Two textures and two passes for component alpha rendering
-@shader sComponentPass<mask:,Mask>1FS
-
-$LAYER_FRAGMENT<mask>$
-uniform sampler2D uBlackTexture;
-uniform sampler2D uWhiteTexture;
-
-void main()
-{
- COLOR_PRECISION vec3 onBlack = texture2D(uBlackTexture, vTexCoord).bgr;
- COLOR_PRECISION vec3 onWhite = texture2D(uWhiteTexture, vTexCoord).bgr;
- COLOR_PRECISION vec4 alphas = (1.0 - onWhite + onBlack).rgbg;
-$FRAGMENT_CALC_MASK<mask>$
- gl_FragColor = alphas * uLayerOpacity * mask;
-}
-@end
-
-@shader sComponentPass<mask:,Mask>1RGBFS
-
-$LAYER_FRAGMENT<mask>$
-uniform sampler2D uBlackTexture;
-uniform sampler2D uWhiteTexture;
-
-void main()
-{
- COLOR_PRECISION vec3 onBlack = texture2D(uBlackTexture, vTexCoord).rgb;
- COLOR_PRECISION vec3 onWhite = texture2D(uWhiteTexture, vTexCoord).rgb;
- COLOR_PRECISION vec4 alphas = (1.0 - onWhite + onBlack).rgbg;
-$FRAGMENT_CALC_MASK<mask>$
- gl_FragColor = alphas * uLayerOpacity * mask;
-}
-@end
-
-@shader sComponentPass<mask:,Mask>2FS
-
-$LAYER_FRAGMENT<mask>$
-uniform sampler2D uBlackTexture;
-uniform sampler2D uWhiteTexture;
-
-void main()
-{
- COLOR_PRECISION vec3 onBlack = texture2D(uBlackTexture, vTexCoord).bgr;
- COLOR_PRECISION vec3 onWhite = texture2D(uWhiteTexture, vTexCoord).bgr;
- COLOR_PRECISION vec4 alphas = (1.0 - onWhite + onBlack).rgbg;
-$FRAGMENT_CALC_MASK<mask>$
- gl_FragColor = vec4(onBlack, alphas.a) * uLayerOpacity * mask;
-}
-@end
-
-@shader sComponentPass<mask:,Mask>2RGBFS
-
-$LAYER_FRAGMENT<mask>$
-uniform sampler2D uBlackTexture;
-uniform sampler2D uWhiteTexture;
-
-void main()
-{
- COLOR_PRECISION vec3 onBlack = texture2D(uBlackTexture, vTexCoord).rgb;
- COLOR_PRECISION vec3 onWhite = texture2D(uWhiteTexture, vTexCoord).rgb;
- COLOR_PRECISION vec4 alphas = (1.0 - onWhite + onBlack).rgbg;
-$FRAGMENT_CALC_MASK<mask>$
- gl_FragColor = vec4(onBlack, alphas.a) * uLayerOpacity * mask;
-}
-@end
-
-
-//
-// The "Copy" program is used for blitting a texture to a destination
-// with no transforms or any other manipulation. They're used for
-// blitting the contents of a FBO-rendered texture to a destination.
-//
-// There are two variants of the fragment shader: one that uses 2D
-// textures and one that uses 2DRect textures (for when
-// EXT_TEXTURE_RECTANGLE is used for FBOs).
-//
-// On GL ES, EXT_TEXTURE_RECTANGLE isn't available, so we still
-// compile the shader but have it render pure red. It should never
-// be used.
-//
-
-@shader sCopyVS
-/* Vertex Shader */
-
-attribute vec4 aVertexCoord;
-attribute vec2 aTexCoord;
-
-varying vec2 vTexCoord;
-
-void main()
-{
- gl_Position = aVertexCoord;
- vTexCoord = aTexCoord;
-}
-@end
-
-@shader sCopy2DFS
-$FRAGMENT_SHADER_HEADER$
-
-varying vec2 vTexCoord;
-
-uniform sampler2D uTexture;
-void main()
-{
- gl_FragColor = texture2D(uTexture, vTexCoord);
-}
-@end
-
-@shader sCopy2DRectFS
-#extension GL_ARB_texture_rectangle : enable
-
-$FRAGMENT_SHADER_HEADER$
-
-varying vec2 vTexCoord;
-uniform vec2 uTexCoordMultiplier;
-
-#ifndef GL_ES
-uniform sampler2DRect uTexture;
-void main()
-{
- gl_FragColor = texture2DRect(uTexture, vTexCoord * uTexCoordMultiplier);
-}
-#else
-void main()
-{
- gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
-}
-#endif
-@end
-
--- a/gfx/layers/opengl/TextureHostOGL.h
+++ b/gfx/layers/opengl/TextureHostOGL.h
@@ -88,39 +88,16 @@ protected:
* released. At the moment the teardown sequence happens in the middle of
* the nsBaseWidget's destructor, meaning that at a given moment we must be
* able to easily find and release all the GL resources.
* The point is: be careful about the ownership model and limit the number
* of objects sharing references to GL resources to make the tear down
* sequence as simple as possible.
*/
-inline ShaderProgramType
-GetProgramTypeForSurfaceFormat(gfx::SurfaceFormat aFormat)
- {
- switch (aFormat) {
- case gfx::SurfaceFormat::B8G8R8A8:
- return BGRALayerProgramType;;
- case gfx::SurfaceFormat::B8G8R8X8:
- return BGRXLayerProgramType;;
- case gfx::SurfaceFormat::R8G8B8X8:
- return RGBXLayerProgramType;;
- case gfx::SurfaceFormat::R8G8B8A8:
- return RGBALayerProgramType;;
- default:
- MOZ_CRASH("unhandled program type");
- }
-}
-
-inline ShaderProgramType
-GetProgramTypeForTexture(const DeprecatedTextureHost *aDeprecatedTextureHost)
-{
- return GetProgramTypeForSurfaceFormat(aDeprecatedTextureHost->GetFormat());
-}
-
/**
* TextureSourceOGL provides the necessary API for CompositorOGL to composite
* a TextureSource.
*/
class TextureSourceOGL
{
public:
virtual bool IsValid() const = 0;
deleted file mode 100644
--- a/gfx/layers/opengl/genshaders.py
+++ /dev/null
@@ -1,158 +0,0 @@
-# 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/.
-
-
-import sys
-import re
-import string
-
-defines = dict()
-
-def parseShaderName(shadername):
- name = ""
- params = {}
- inparams = None
- inparam = None
- curparams = []
- for c in shadername:
- if c == '<':
- inparams = ''
- elif c == ':':
- if inparams is None:
- raise Exception(": in shader name")
- inparam = ''
- elif c == ',':
- if inparams is None:
- raise Exception(", in shader name")
- if inparam is None:
- raise Exception("no values for parameter " + inparams)
- curparams.append(inparam)
- inparam = ''
- elif c == '>':
- if inparams is None:
- raise Exception("> in shader name")
- if inparam is None:
- raise Exception("no values for parameter " + inparams)
- curparams.append(inparam)
- params[inparams] = curparams
- name += '$' + inparams + '$'
- inparams = None
- inparam = None
- else:
- if inparam is not None:
- inparam += c
- elif inparams is not None:
- inparams += c
- else:
- name += c
- return (name, params)
-
-def emitShader(fp, shadername, shaderlines):
- (parsedname, params) = parseShaderName(shadername)
- eolContinue = "\\n\\\n";
- pvals = ['']
- pname = ''
- pnames = params.keys()
- if len(pnames) > 1:
- raise Exception("Currently only supports zero or one parameters to a @shader")
- if pnames:
- pname = pnames[0]
- pvals = params[pname]
- for pval in pvals:
- name = parsedname.replace('$' + pname + '$', pval, 1);
- fp.write("static const char %s[] = \"/* %s */%s" % (name,name,eolContinue))
- for line in shaderlines:
- line = line.replace("\\", "\\\\")
- while line.find('$') != -1:
- expansions = re.findall('\$\S+\$', line)
- for m in expansions:
- mkey = m[1:-1]
- mkey = mkey.replace('<' + pname + '>', '<' + pval + '>')
- if not defines.has_key(mkey):
- print "Error: Undefined expansion used: '%s'" % (m,)
- sys.exit(1)
- mval = defines[mkey]
- if type(mval) == str:
- line = line.replace(m, mval)
- elif type(mval) == list:
- line = line.replace(m, eolContinue.join(mval) + eolContinue);
- else:
- print "Internal Error: Unknown type in defines array: '%s'" % (str(type(mval)),)
-
- fp.write("%s%s" % (line,eolContinue))
- fp.write("\";\n\n");
-
-def genShaders(infile, outfile):
- source = open(infile, "r").readlines()
- desthdr = open(outfile, "w+")
-
- desthdr.write("/* AUTOMATICALLY GENERATED from " + infile + " */\n");
- desthdr.write("/* DO NOT EDIT! */\n\n");
-
- global defines
-
- indefine = None
- inshader = None
-
- inblock = False
- linebuffer = []
-
- for line in source:
- # strip comments, if not inblock
- if not inblock and line.startswith("//"):
- continue
- line = string.strip(line)
-
- if len(line) == 0:
- continue
-
- if line[0] == '@':
- cmd = line
- rest = ''
-
- if line.find(' ') != -1:
- cmd = line[0:line.find(' ')]
- rest = string.strip(line[len(cmd) + 1:])
-
- if cmd == "@define":
- if inblock:
- raise Exception("@define inside a block!")
- space = rest.find(' ')
- if space != -1:
- defines[rest[0:space]] = rest[space+1:]
- else:
- indefine = rest
- inblock = True
- elif cmd == "@shader":
- if inblock:
- raise Exception("@shader inside a block!")
- if len(rest) == 0:
- raise Exception("@shader without a name!")
- inshader = rest
- inblock = True
- elif cmd == "@end":
- if indefine is not None:
- if type(linebuffer) == list:
- for i in range(len(linebuffer)):
- linebuffer[i] = linebuffer[i].replace("\\", "\\\\")
- defines[indefine] = linebuffer
- elif inshader is not None:
- emitShader(desthdr, inshader, linebuffer)
- else:
- raise Exception("@end outside of a block!")
- indefine = None
- inshader = None
- inblock = None
- linebuffer = []
- else:
- raise Exception("Unknown command: %s" % (cmd,))
- else:
- if inblock:
- linebuffer.append(line)
-
-if (len(sys.argv) != 3):
- print "Usage: %s infile.txt outfile.h" % (sys.argv[0],)
- sys.exit(1)
-
-genShaders(sys.argv[1], sys.argv[2])
deleted file mode 100644
--- a/gfx/layers/opengl/genshaders.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-# 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/.
-
-python genshaders.py OGLShaders.txt OGLShaders.h
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -7998,18 +7998,18 @@ CodeGenerator::visitHaveSameClass(LHaveS
return true;
}
bool
CodeGenerator::visitAsmJSCall(LAsmJSCall *ins)
{
MAsmJSCall *mir = ins->mir();
-#if defined(JS_CODEGEN_ARM) && !defined(JS_CODEGEN_ARM_HARDFP)
- if (mir->callee().which() == MAsmJSCall::Callee::Builtin) {
+#if defined(JS_CODEGEN_ARM)
+ if (!useHardFpABI() && mir->callee().which() == MAsmJSCall::Callee::Builtin) {
for (unsigned i = 0, e = ins->numOperands(); i < e; i++) {
LAllocation *a = ins->getOperand(i);
if (a->isFloatReg()) {
FloatRegister fr = ToFloatRegister(a);
int srcId = fr.code() * 2;
masm.ma_vxfer(fr, Register::FromCode(srcId), Register::FromCode(srcId+1));
}
}
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -2874,12 +2874,14 @@ AutoDebugModeInvalidation::~AutoDebugMod
} else if (script->hasBaselineScript()) {
script->baselineScript()->resetActive();
}
}
if (comp_) {
FinishDiscardJitCode(fop, comp_);
} else {
- for (CompartmentsInZoneIter comp(zone_); !comp.done(); comp.next())
- FinishDiscardJitCode(fop, comp);
+ for (CompartmentsInZoneIter comp(zone_); !comp.done(); comp.next()) {
+ if (comp->principals)
+ FinishDiscardJitCode(fop, comp);
+ }
}
}
--- a/js/src/jit/arm/Architecture-arm.cpp
+++ b/js/src/jit/arm/Architecture-arm.cpp
@@ -10,16 +10,18 @@
#include <elf.h>
#endif
#include <fcntl.h>
#include <unistd.h>
#include "jit/arm/Assembler-arm.h"
+#define HWCAP_USE_HARDFP_ABI (1 << 28)
+
#if !(defined(ANDROID) || defined(MOZ_B2G)) && !defined(JS_ARM_SIMULATOR)
#define HWCAP_ARMv7 (1 << 29)
#include <asm/hwcap.h>
#else
#define HWCAP_VFP (1<<0)
#define HWCAP_VFPv3 (1<<1)
#define HWCAP_VFPv3D16 (1<<2)
#define HWCAP_VFPv4 (1<<3)
@@ -34,16 +36,20 @@ namespace jit {
uint32_t GetARMFlags()
{
static bool isSet = false;
static uint32_t flags = 0;
if (isSet)
return flags;
+#ifdef JS_CODEGEN_ARM_HARDFP
+ flags |= HWCAP_USE_HARDFP_ABI;
+#endif
+
static const char *env = getenv("ARMHWCAP");
if (env && env[0]) {
if (strstr(env, "help")) {
fflush(NULL);
printf(
"\n"
"usage: ARMHWCAP=option,option,option,... where options can be:\n"
@@ -51,16 +57,19 @@ uint32_t GetARMFlags()
" armv7 \n"
" vfp \n"
" neon \n"
" vfpv3 \n"
" vfpv3d16 \n"
" vfpv4 \n"
" idiva \n"
" idivt \n"
+#if defined(JS_ARM_SIMULATOR)
+ " hardfp \n"
+#endif
"\n"
);
exit(0);
/*NOTREACHED*/
} else {
// Canonicalize each token to have a leading and trailing space.
const char *start = env; // Token start.
for (;;) {
@@ -93,16 +102,20 @@ uint32_t GetARMFlags()
else if (count == 5 && strncmp(start, "idiva", 5) == 0)
flags |= HWCAP_IDIVA;
else if (count == 5 && strncmp(start, "idivt", 5) == 0)
flags |= HWCAP_IDIVT;
else if (count == 4 && strncmp(start, "neon", 4) == 0)
flags |= HWCAP_NEON;
else if (count == 5 && strncmp(start, "armv7", 5) == 0)
flags |= HWCAP_ARMv7;
+#if defined(JS_ARM_SIMULATOR)
+ else if (count == 6 && strncmp(start, "hardfp", 6) == 0)
+ flags |= HWCAP_USE_HARDFP_ABI;
+#endif
else
fprintf(stderr, "Warning: unexpected ARMHWCAP flag at: %s\n", start);
start = end;
}
#ifdef DEBUG
IonSpew(IonSpew_Codegen, "ARMHWCAP: '%s'\n flags: 0x%x\n", env, flags);
#endif
isSet = true;
@@ -231,16 +244,24 @@ bool hasIDIV()
{
#if defined HWCAP_IDIVA
return GetARMFlags() & HWCAP_IDIVA;
#else
return false;
#endif
}
+// This is defined in the header and inlined when not using the simulator.
+#if defined(JS_ARM_SIMULATOR)
+bool useHardFpABI()
+{
+ return GetARMFlags() & HWCAP_USE_HARDFP_ABI;
+}
+#endif
+
Registers::Code
Registers::FromName(const char *name)
{
// Check for some register aliases first.
if (strcmp(name, "ip") == 0)
return ip;
if (strcmp(name, "r13") == 0)
return r13;
--- a/js/src/jit/arm/Architecture-arm.h
+++ b/js/src/jit/arm/Architecture-arm.h
@@ -8,19 +8,20 @@
#define jit_arm_Architecture_arm_h
#include <limits.h>
#include <stdint.h>
#include "js/Utility.h"
// gcc appears to use __ARM_PCS_VFP to denote that the target is a hard-float target.
-#ifdef __ARM_PCS_VFP
+#if defined(__ARM_PCS_VFP)
#define JS_CODEGEN_ARM_HARDFP
#endif
+
namespace js {
namespace jit {
// In bytes: slots needed for potential memory->memory move spills.
// +8 for cycles
// +4 for gpr spills
// +8 for double spills
static const uint32_t ION_FRAME_SLACK_SIZE = 20;
@@ -227,12 +228,27 @@ class FloatRegisters
uint32_t GetARMFlags();
bool hasMOVWT();
bool hasVFPv3();
bool hasVFP();
bool has16DP();
bool hasIDIV();
+// If the simulator is used then the ABI choice is dynamic. Otherwise the ABI is static
+// and useHardFpABI is inlined so that unused branches can be optimized away.
+#if defined(JS_ARM_SIMULATOR)
+bool useHardFpABI();
+#else
+static inline bool useHardFpABI()
+{
+#if defined(JS_CODEGEN_ARM_HARDFP)
+ return true;
+#else
+ return false;
+#endif
+}
+#endif
+
} // namespace jit
} // namespace js
#endif /* jit_arm_Architecture_arm_h */
--- a/js/src/jit/arm/Assembler-arm.h
+++ b/js/src/jit/arm/Assembler-arm.h
@@ -2088,21 +2088,20 @@ class InstructionIterator {
Instruction *cur() const {
return i;
}
};
static const uint32_t NumIntArgRegs = 4;
static const uint32_t NumFloatArgRegs = 8;
-#ifdef JS_CODEGEN_ARM_HARDFP
static inline bool
GetIntArgReg(uint32_t usedIntArgs, uint32_t usedFloatArgs, Register *out)
{
- if (usedIntArgs >= NumIntArgRegs)
+ if (usedIntArgs >= NumIntArgRegs)
return false;
*out = Register::FromCode(usedIntArgs);
return true;
}
// Get a register in which we plan to put a quantity that will be used as an
// integer argument. This differs from GetIntArgReg in that if we have no more
// actual argument registers to use we will fall back on using whatever
@@ -2118,100 +2117,85 @@ GetTempRegForIntArg(uint32_t usedIntArgs
// can allocate.
usedIntArgs -= NumIntArgRegs;
if (usedIntArgs >= NumCallTempNonArgRegs)
return false;
*out = CallTempNonArgRegs[usedIntArgs];
return true;
}
+
+#if !defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_ARM_SIMULATOR)
+
+static inline uint32_t
+GetArgStackDisp(uint32_t arg)
+{
+ JS_ASSERT(!useHardFpABI());
+ JS_ASSERT(arg >= NumIntArgRegs);
+ return (arg - NumIntArgRegs) * sizeof(intptr_t);
+}
+
+#endif
+
+
+#if defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_ARM_SIMULATOR)
+
static inline bool
GetFloatArgReg(uint32_t usedIntArgs, uint32_t usedFloatArgs, FloatRegister *out)
{
+ JS_ASSERT(useHardFpABI());
if (usedFloatArgs >= NumFloatArgRegs)
return false;
*out = FloatRegister::FromCode(usedFloatArgs);
return true;
}
static inline uint32_t
GetIntArgStackDisp(uint32_t usedIntArgs, uint32_t usedFloatArgs, uint32_t *padding)
{
+ JS_ASSERT(useHardFpABI());
JS_ASSERT(usedIntArgs >= NumIntArgRegs);
uint32_t doubleSlots = Max(0, (int32_t)usedFloatArgs - (int32_t)NumFloatArgRegs);
doubleSlots *= 2;
int intSlots = usedIntArgs - NumIntArgRegs;
return (intSlots + doubleSlots + *padding) * sizeof(intptr_t);
}
static inline uint32_t
GetFloat32ArgStackDisp(uint32_t usedIntArgs, uint32_t usedFloatArgs, uint32_t *padding)
{
+ JS_ASSERT(useHardFpABI());
JS_ASSERT(usedFloatArgs >= NumFloatArgRegs);
uint32_t intSlots = 0;
if (usedIntArgs > NumIntArgRegs)
intSlots = usedIntArgs - NumIntArgRegs;
uint32_t float32Slots = usedFloatArgs - NumFloatArgRegs;
return (intSlots + float32Slots + *padding) * sizeof(intptr_t);
}
static inline uint32_t
GetDoubleArgStackDisp(uint32_t usedIntArgs, uint32_t usedFloatArgs, uint32_t *padding)
{
+ JS_ASSERT(useHardFpABI());
JS_ASSERT(usedFloatArgs >= NumFloatArgRegs);
uint32_t intSlots = 0;
if (usedIntArgs > NumIntArgRegs) {
intSlots = usedIntArgs - NumIntArgRegs;
// update the amount of padding required.
*padding += (*padding + usedIntArgs) % 2;
}
uint32_t doubleSlots = usedFloatArgs - NumFloatArgRegs;
doubleSlots *= 2;
return (intSlots + doubleSlots + *padding) * sizeof(intptr_t);
}
-#else
-static inline bool
-GetIntArgReg(uint32_t arg, uint32_t floatArg, Register *out)
-{
- if (arg < NumIntArgRegs) {
- *out = Register::FromCode(arg);
- return true;
- }
- return false;
-}
-
-// Get a register in which we plan to put a quantity that will be used as an
-// integer argument. This differs from GetIntArgReg in that if we have no more
-// actual argument registers to use we will fall back on using whatever
-// CallTempReg* don't overlap the argument registers, and only fail once those
-// run out too.
-static inline bool
-GetTempRegForIntArg(uint32_t usedIntArgs, uint32_t usedFloatArgs, Register *out)
-{
- if (GetIntArgReg(usedIntArgs, usedFloatArgs, out))
- return true;
- // Unfortunately, we have to assume things about the point at which
- // GetIntArgReg returns false, because we need to know how many registers it
- // can allocate.
- usedIntArgs -= NumIntArgRegs;
- if (usedIntArgs >= NumCallTempNonArgRegs)
- return false;
- *out = CallTempNonArgRegs[usedIntArgs];
- return true;
-}
-
-static inline uint32_t
-GetArgStackDisp(uint32_t arg)
-{
- JS_ASSERT(arg >= NumIntArgRegs);
- return (arg - NumIntArgRegs) * sizeof(intptr_t);
-}
#endif
+
+
class DoubleEncoder {
uint32_t rep(bool b, uint32_t count) {
uint32_t ret = 0;
for (uint32_t i = 0; i < count; i++)
ret = (ret << 1) | b;
return ret;
}
--- a/js/src/jit/arm/CodeGenerator-arm.h
+++ b/js/src/jit/arm/CodeGenerator-arm.h
@@ -171,31 +171,29 @@ class CodeGeneratorARM : public CodeGene
bool visitAsmJSLoadFuncPtr(LAsmJSLoadFuncPtr *ins);
bool visitAsmJSLoadFFIFunc(LAsmJSLoadFFIFunc *ins);
bool visitAsmJSPassStackArg(LAsmJSPassStackArg *ins);
bool generateInvalidateEpilogue();
protected:
void postAsmJSCall(LAsmJSCall *lir) {
-#ifndef JS_CODEGEN_ARM_HARDFP
- if (lir->mir()->callee().which() == MAsmJSCall::Callee::Builtin) {
+ if (!useHardFpABI() && lir->mir()->callee().which() == MAsmJSCall::Callee::Builtin) {
switch (lir->mir()->type()) {
case MIRType_Double:
masm.ma_vxfer(r0, r1, d0);
break;
case MIRType_Float32:
masm.as_vxfer(r0, InvalidReg, VFPRegister(d0).singleOverlay(),
Assembler::CoreToFloat);
break;
default:
break;
}
}
-#endif
}
bool visitEffectiveAddress(LEffectiveAddress *ins);
bool visitUDiv(LUDiv *ins);
bool visitUMod(LUMod *ins);
bool visitSoftUDivOrMod(LSoftUDivOrMod *ins);
};
--- a/js/src/jit/arm/MacroAssembler-arm.cpp
+++ b/js/src/jit/arm/MacroAssembler-arm.cpp
@@ -3485,23 +3485,21 @@ MacroAssemblerARMCompat::breakpoint(Cond
void
MacroAssemblerARMCompat::setupABICall(uint32_t args)
{
JS_ASSERT(!inCall_);
inCall_ = true;
args_ = args;
passedArgs_ = 0;
passedArgTypes_ = 0;
-#ifdef JS_CODEGEN_ARM_HARDFP
usedIntSlots_ = 0;
+#if defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_ARM_SIMULATOR)
usedFloatSlots_ = 0;
usedFloat32_ = false;
padding_ = 0;
-#else
- usedSlots_ = 0;
#endif
floatArgsInGPR[0] = MoveOperand();
floatArgsInGPR[1] = MoveOperand();
floatArgsInGPRValid[0] = false;
floatArgsInGPRValid[1] = false;
}
void
@@ -3520,19 +3518,19 @@ MacroAssemblerARMCompat::setupUnalignedA
ma_mov(sp, scratch);
// Force sp to be aligned
ma_and(Imm32(~(StackAlignment - 1)), sp, sp);
ma_push(scratch);
}
-#ifdef JS_CODEGEN_ARM_HARDFP
-void
-MacroAssemblerARMCompat::passABIArg(const MoveOperand &from, MoveOp::Type type)
+#if defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_ARM_SIMULATOR)
+void
+MacroAssemblerARMCompat::passHardFpABIArg(const MoveOperand &from, MoveOp::Type type)
{
MoveOperand to;
++passedArgs_;
if (!enoughMemory_)
return;
switch (type) {
case MoveOp::FLOAT32:
case MoveOp::DOUBLE: {
@@ -3591,68 +3589,84 @@ MacroAssemblerARMCompat::passABIArg(cons
break;
}
default:
MOZ_ASSUME_UNREACHABLE("Unexpected argument type");
}
enoughMemory_ = moveResolver_.addMove(from, to, type);
}
-
-#else
-void
-MacroAssemblerARMCompat::passABIArg(const MoveOperand &from, MoveOp::Type type)
+#endif
+
+#if !defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_ARM_SIMULATOR)
+void
+MacroAssemblerARMCompat::passSoftFpABIArg(const MoveOperand &from, MoveOp::Type type)
{
MoveOperand to;
uint32_t increment = 1;
bool useResolver = true;
++passedArgs_;
switch (type) {
case MoveOp::DOUBLE:
// Double arguments need to be rounded up to the nearest doubleword
// boundary, even if it is in a register!
- usedSlots_ = (usedSlots_ + 1) & ~1;
+ usedIntSlots_ = (usedIntSlots_ + 1) & ~1;
increment = 2;
passedArgTypes_ = (passedArgTypes_ << ArgType_Shift) | ArgType_Double;
break;
case MoveOp::FLOAT32:
passedArgTypes_ = (passedArgTypes_ << ArgType_Shift) | ArgType_Float32;
break;
case MoveOp::GENERAL:
passedArgTypes_ = (passedArgTypes_ << ArgType_Shift) | ArgType_General;
break;
default:
MOZ_ASSUME_UNREACHABLE("Unexpected argument type");
}
Register destReg;
MoveOperand dest;
- if (GetIntArgReg(usedSlots_, 0, &destReg)) {
+ if (GetIntArgReg(usedIntSlots_, 0, &destReg)) {
if (type == MoveOp::DOUBLE || type == MoveOp::FLOAT32) {
floatArgsInGPR[destReg.code() >> 1] = from;
floatArgsInGPRValid[destReg.code() >> 1] = true;
useResolver = false;
} else if (from.isGeneralReg() && from.reg() == destReg) {
// No need to move anything
useResolver = false;
} else {
dest = MoveOperand(destReg);
}
} else {
- uint32_t disp = GetArgStackDisp(usedSlots_);
+ uint32_t disp = GetArgStackDisp(usedIntSlots_);
dest = MoveOperand(sp, disp);
}
if (useResolver)
enoughMemory_ = enoughMemory_ && moveResolver_.addMove(from, dest, type);
- usedSlots_ += increment;
+ usedIntSlots_ += increment;
}
#endif
void
+MacroAssemblerARMCompat::passABIArg(const MoveOperand &from, MoveOp::Type type)
+{
+#if defined(JS_ARM_SIMULATOR)
+ if (useHardFpABI())
+ MacroAssemblerARMCompat::passHardFpABIArg(from, type);
+ else
+ MacroAssemblerARMCompat::passSoftFpABIArg(from, type);
+#elif defined(JS_CODEGEN_ARM_HARDFP)
+ MacroAssemblerARMCompat::passHardFpABIArg(from, type);
+#else
+ MacroAssemblerARMCompat::passSoftFpABIArg(from, type);
+#endif
+}
+
+void
MacroAssemblerARMCompat::passABIArg(const Register ®)
{
passABIArg(MoveOperand(reg), MoveOp::GENERAL);
}
void
MacroAssemblerARMCompat::passABIArg(const FloatRegister &freg, MoveOp::Type type)
{
@@ -3666,21 +3680,21 @@ void MacroAssemblerARMCompat::checkStack
breakpoint(NonZero);
#endif
}
void
MacroAssemblerARMCompat::callWithABIPre(uint32_t *stackAdjust)
{
JS_ASSERT(inCall_);
-#ifdef JS_CODEGEN_ARM_HARDFP
+
*stackAdjust = ((usedIntSlots_ > NumIntArgRegs) ? usedIntSlots_ - NumIntArgRegs : 0) * sizeof(intptr_t);
- *stackAdjust += 2*((usedFloatSlots_ > NumFloatArgRegs) ? usedFloatSlots_ - NumFloatArgRegs : 0) * sizeof(intptr_t);
-#else
- *stackAdjust = ((usedSlots_ > NumIntArgRegs) ? usedSlots_ - NumIntArgRegs : 0) * sizeof(intptr_t);
+#if defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_ARM_SIMULATOR)
+ if (useHardFpABI())
+ *stackAdjust += 2*((usedFloatSlots_ > NumFloatArgRegs) ? usedFloatSlots_ - NumFloatArgRegs : 0) * sizeof(intptr_t);
#endif
if (!dynamicAlignment_) {
*stackAdjust += ComputeByteAlignment(framePushed_ + *stackAdjust, StackAlignment);
} else {
// sizeof(intptr_t) account for the saved stack pointer pushed by setupUnalignedABICall
*stackAdjust += ComputeByteAlignment(*stackAdjust + sizeof(intptr_t), StackAlignment);
}
@@ -3728,27 +3742,27 @@ MacroAssemblerARMCompat::callWithABIPre(
void
MacroAssemblerARMCompat::callWithABIPost(uint32_t stackAdjust, MoveOp::Type result)
{
if (secondScratchReg_ != lr)
ma_mov(secondScratchReg_, lr);
switch (result) {
case MoveOp::DOUBLE:
-#ifndef JS_CODEGEN_ARM_HARDFP
- // Move double from r0/r1 to ReturnFloatReg.
- as_vxfer(r0, r1, ReturnFloatReg, CoreToFloat);
- break;
-#endif
+ if (!useHardFpABI()) {
+ // Move double from r0/r1 to ReturnFloatReg.
+ as_vxfer(r0, r1, ReturnFloatReg, CoreToFloat);
+ break;
+ }
case MoveOp::FLOAT32:
-#ifndef JS_CODEGEN_ARM_HARDFP
- // Move float32 from r0 to ReturnFloatReg.
- as_vxfer(r0, InvalidReg, VFPRegister(d0).singleOverlay(), CoreToFloat);
- break;
-#endif
+ if (!useHardFpABI()) {
+ // Move float32 from r0 to ReturnFloatReg.
+ as_vxfer(r0, InvalidReg, VFPRegister(d0).singleOverlay(), CoreToFloat);
+ break;
+ }
case MoveOp::GENERAL:
break;
default:
MOZ_ASSUME_UNREACHABLE("unexpected callWithABI result");
}
freeStack(stackAdjust);
--- a/js/src/jit/arm/MacroAssembler-arm.h
+++ b/js/src/jit/arm/MacroAssembler-arm.h
@@ -440,29 +440,27 @@ class MacroAssemblerARMCompat : public M
// not be nested.
bool inCall_;
uint32_t args_;
// The actual number of arguments that were passed, used to assert that
// the initial number of arguments declared was correct.
uint32_t passedArgs_;
uint32_t passedArgTypes_;
-#ifdef JS_CODEGEN_ARM_HARDFP
+ // ARM treats arguments as a vector in registers/memory, that looks like:
+ // { r0, r1, r2, r3, [sp], [sp,+4], [sp,+8] ... }
+ // usedIntSlots_ keeps track of how many of these have been used.
+ // It bears a passing resemblance to passedArgs_, but a single argument
+ // can effectively use between one and three slots depending on its size and
+ // alignment requirements
uint32_t usedIntSlots_;
+#if defined(JS_CODEGEN_ARM_HARDFP) || defined(JS_ARM_SIMULATOR)
uint32_t usedFloatSlots_;
bool usedFloat32_;
uint32_t padding_;
-#else
- // ARM treats arguments as a vector in registers/memory, that looks like:
- // { r0, r1, r2, r3, [sp], [sp,+4], [sp,+8] ... }
- // usedSlots_ keeps track of how many of these have been used.
- // It bears a passing resemblance to passedArgs_, but a single argument
- // can effectively use between one and three slots depending on its size and
- // alignment requirements
- uint32_t usedSlots_;
#endif
bool dynamicAlignment_;
bool enoughMemory_;
// Used to work around the move resolver's lack of support for
// moving into register pairs, which the softfp ABI needs.
mozilla::Array<MoveOperand, 2> floatArgsInGPR;
@@ -1406,16 +1404,20 @@ class MacroAssemblerARMCompat : public M
// automatically adjusted. It is extremely important that esp-relative
// addresses are computed *after* setupABICall(). Furthermore, no
// operations should be emitted while setting arguments.
void passABIArg(const MoveOperand &from, MoveOp::Type type);
void passABIArg(const Register ®);
void passABIArg(const FloatRegister ®, MoveOp::Type type);
void passABIArg(const ValueOperand ®s);
+ private:
+ void passHardFpABIArg(const MoveOperand &from, MoveOp::Type type);
+ void passSoftFpABIArg(const MoveOperand &from, MoveOp::Type type);
+
protected:
bool buildOOLFakeExitFrame(void *fakeReturnAddr);
private:
void callWithABIPre(uint32_t *stackAdjust);
void callWithABIPost(uint32_t stackAdjust, MoveOp::Type result);
public:
--- a/js/src/jit/arm/Simulator-arm.cpp
+++ b/js/src/jit/arm/Simulator-arm.cpp
@@ -1411,49 +1411,52 @@ ReturnType Simulator::getFromVFPRegister
register_size * sizeof(vfp_registers_[0]));
memcpy(&value, buffer, register_size * sizeof(vfp_registers_[0]));
return value;
}
void
Simulator::getFpArgs(double *x, double *y, int32_t *z)
{
- if (use_eabi_hardfloat()) {
+ if (useHardFpABI()) {
*x = get_double_from_d_register(0);
*y = get_double_from_d_register(1);
*z = get_register(0);
} else {
*x = get_double_from_register_pair(0);
*y = get_double_from_register_pair(2);
*z = get_register(2);
}
}
void
Simulator::setCallResultDouble(double result)
{
// The return value is either in r0/r1 or d0.
- if (use_eabi_hardfloat()) {
+ if (useHardFpABI()) {
char buffer[2 * sizeof(vfp_registers_[0])];
memcpy(buffer, &result, sizeof(buffer));
// Copy result to d0.
memcpy(vfp_registers_, buffer, sizeof(buffer));
} else {
char buffer[2 * sizeof(registers_[0])];
memcpy(buffer, &result, sizeof(buffer));
// Copy result to r0 and r1.
memcpy(registers_, buffer, sizeof(buffer));
}
}
void
Simulator::setCallResultFloat(float result)
{
- if (use_eabi_hardfloat()) {
- MOZ_ASSUME_UNREACHABLE("NYI");
+ if (useHardFpABI()) {
+ char buffer[sizeof(registers_[0])];
+ memcpy(buffer, &result, sizeof(buffer));
+ // Copy result to s0.
+ memcpy(vfp_registers_, buffer, sizeof(buffer));
} else {
char buffer[sizeof(registers_[0])];
memcpy(buffer, &result, sizeof(buffer));
// Copy result to r0.
memcpy(registers_, buffer, sizeof(buffer));
}
}
@@ -2197,17 +2200,21 @@ Simulator::softwareInterrupt(SimInstruct
getFpArgs(&dval0, &dval1, &ival);
Prototype_Double_Double target = reinterpret_cast<Prototype_Double_Double>(external);
double dresult = target(dval0);
scratchVolatileRegisters(/* scratchFloat = true */);
setCallResultDouble(dresult);
break;
}
case Args_Float32_Float32: {
- float fval0 = mozilla::BitwiseCast<float>(arg0);
+ float fval0;
+ if (useHardFpABI())
+ fval0 = get_float_from_s_register(0);
+ else
+ fval0 = mozilla::BitwiseCast<float>(arg0);
Prototype_Float32_Float32 target = reinterpret_cast<Prototype_Float32_Float32>(external);
float fresult = target(fval0);
scratchVolatileRegisters(/* scratchFloat = true */);
setCallResultFloat(fresult);
break;
}
case Args_Double_Int: {
Prototype_Double_Int target = reinterpret_cast<Prototype_Double_Int>(external);
@@ -2232,29 +2239,35 @@ Simulator::softwareInterrupt(SimInstruct
getFpArgs(&dval0, &dval1, &ival);
Prototype_Double_DoubleDouble target = reinterpret_cast<Prototype_Double_DoubleDouble>(external);
double dresult = target(dval0, dval1);
scratchVolatileRegisters(/* scratchFloat = true */);
setCallResultDouble(dresult);
break;
}
case Args_Double_IntDouble: {
- MOZ_ASSERT(!use_eabi_hardfloat()); // NYI
int32_t ival = get_register(0);
- double dval0 = get_double_from_register_pair(2);
+ double dval0;
+ if (useHardFpABI())
+ dval0 = get_double_from_d_register(0);
+ else
+ dval0 = get_double_from_register_pair(2);
Prototype_Double_IntDouble target = reinterpret_cast<Prototype_Double_IntDouble>(external);
double dresult = target(ival, dval0);
scratchVolatileRegisters(/* scratchFloat = true */);
setCallResultDouble(dresult);
break;
}
case Args_Int_IntDouble: {
- MOZ_ASSERT(!use_eabi_hardfloat()); // NYI
int32_t ival = get_register(0);
- double dval0 = get_double_from_register_pair(2);
+ double dval0;
+ if (useHardFpABI())
+ dval0 = get_double_from_d_register(0);
+ else
+ dval0 = get_double_from_register_pair(2);
Prototype_Int_IntDouble target = reinterpret_cast<Prototype_Int_IntDouble>(external);
int32_t result = target(ival, dval0);
scratchVolatileRegisters(/* scratchFloat = true */);
set_register(r0, result);
break;
}
default:
MOZ_ASSUME_UNREACHABLE("call");
--- a/js/src/jit/arm/Simulator-arm.h
+++ b/js/src/jit/arm/Simulator-arm.h
@@ -26,16 +26,17 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef jit_arm_Simulator_arm_h
#define jit_arm_Simulator_arm_h
#ifdef JS_ARM_SIMULATOR
+#include "jit/arm/Architecture-arm.h"
#include "jit/IonTypes.h"
namespace js {
namespace jit {
class SimulatorRuntime;
SimulatorRuntime *CreateSimulatorRuntime();
void DestroySimulatorRuntime(SimulatorRuntime *srt);
@@ -161,25 +162,16 @@ class Simulator
// Debugger input.
void setLastDebuggerInput(char *input);
char *lastDebuggerInput() { return lastDebuggerInput_; }
// Returns true if pc register contains one of the 'special_values' defined
// below (bad_lr, end_sim_pc).
bool has_bad_pc() const;
- // EABI variant for double arguments in use.
- bool use_eabi_hardfloat() {
-#if USE_EABI_HARDFLOAT
- return true;
-#else
- return false;
-#endif
- }
-
private:
enum special_values {
// Known bad pc value to ensure that the simulator does not execute
// without being properly setup.
bad_lr = -1,
// A pc value used to signal the simulator to stop execution. Generally
// the lr is set to this value on transition from native C code to
// simulated execution, so that the simulator can "return" to the native
--- a/js/src/vm/ForkJoin.cpp
+++ b/js/src/vm/ForkJoin.cpp
@@ -20,22 +20,25 @@
#include "builtin/TypedObject.h"
#ifdef JS_THREADSAFE
# include "jit/BaselineJIT.h"
# include "vm/Monitor.h"
#endif
-#if defined(DEBUG) && defined(JS_THREADSAFE) && defined(JS_ION)
-# include "jit/Ion.h"
-# include "jit/JitCompartment.h"
-# include "jit/MIR.h"
-# include "jit/MIRGraph.h"
-#endif // DEBUG && THREADSAFE && ION
+#if defined(JS_THREADSAFE) && defined(JS_ION)
+# include "jit/JitCommon.h"
+# ifdef DEBUG
+# include "jit/Ion.h"
+# include "jit/JitCompartment.h"
+# include "jit/MIR.h"
+# include "jit/MIRGraph.h"
+# endif
+#endif // THREADSAFE && ION
#include "vm/Interpreter-inl.h"
using namespace js;
using namespace js::parallel;
using namespace js::jit;
using mozilla::ThreadLocal;
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -2288,26 +2288,28 @@ ContainerState::ChooseAnimatedGeometryRo
* of ContainerState::Finish.
*/
void
ContainerState::ProcessDisplayItems(const nsDisplayList& aList,
uint32_t aFlags)
{
PROFILER_LABEL("ContainerState", "ProcessDisplayItems");
- const nsIFrame* lastAnimatedGeometryRoot = mContainerReferenceFrame;
- nsPoint topLeft(0,0);
+ const nsIFrame* lastAnimatedGeometryRoot = nullptr;
+ nsPoint topLeft;
// When NO_COMPONENT_ALPHA is set, items will be flattened into a single
// layer, so we need to choose which active scrolled root to use for all
// items.
if (aFlags & NO_COMPONENT_ALPHA) {
- if (ChooseAnimatedGeometryRoot(aList, &lastAnimatedGeometryRoot)) {
- topLeft = lastAnimatedGeometryRoot->GetOffsetToCrossDoc(mContainerReferenceFrame);
+ if (!ChooseAnimatedGeometryRoot(aList, &lastAnimatedGeometryRoot)) {
+ lastAnimatedGeometryRoot = mContainerReferenceFrame;
}
+
+ topLeft = lastAnimatedGeometryRoot->GetOffsetToCrossDoc(mContainerReferenceFrame);
}
int32_t maxLayers = nsDisplayItem::MaxActiveLayers();
int layerCount = 0;
for (nsDisplayItem* item = aList.GetBottom(); item; item = item->GetAbove()) {
NS_ASSERTION(mAppUnitsPerDevPixel == AppUnitsPerDevPixel(item),
"items in a container layer should all have the same app units per dev pixel");
@@ -2337,24 +2339,17 @@ ContainerState::ProcessDisplayItems(cons
bool forceInactive;
const nsIFrame* animatedGeometryRoot;
if (aFlags & NO_COMPONENT_ALPHA) {
forceInactive = true;
animatedGeometryRoot = lastAnimatedGeometryRoot;
} else {
forceInactive = false;
- if (mManager->IsWidgetLayerManager()) {
- animatedGeometryRoot = nsLayoutUtils::GetAnimatedGeometryRootFor(item, mBuilder);
- } else {
- // For inactive layer subtrees, splitting content into ThebesLayers
- // based on animated geometry roots is pointless. It's more efficient
- // to build the minimum number of layers.
- animatedGeometryRoot = mContainerReferenceFrame;
- }
+ animatedGeometryRoot = nsLayoutUtils::GetAnimatedGeometryRootFor(item, mBuilder);
if (animatedGeometryRoot != lastAnimatedGeometryRoot) {
lastAnimatedGeometryRoot = animatedGeometryRoot;
topLeft = animatedGeometryRoot->GetOffsetToCrossDoc(mContainerReferenceFrame);
}
}
if (maxLayers != -1 && layerCount >= maxLayers) {
forceInactive = true;
@@ -2994,22 +2989,22 @@ ChooseScaleAndSetTransform(FrameLayerBui
if (transform.IsSingular()) {
return false;
}
bool canDraw2D = transform.CanDraw2D(&transform2d);
gfxSize scale;
// XXX Should we do something for 3D transforms?
if (canDraw2D) {
-// // If the container's transform is animated off main thread, then use the
- // maximum scale.
+ // If the container's transform is animated off main thread, fix a suitable scale size
+ // for animation
if (aContainerFrame->GetContent() &&
nsLayoutUtils::HasAnimationsForCompositor(
aContainerFrame->GetContent(), eCSSProperty_transform)) {
- scale = nsLayoutUtils::GetMaximumAnimatedScale(aContainerFrame->GetContent());
+ scale = nsLayoutUtils::ComputeSuitableScaleForAnimation(aContainerFrame->GetContent());
} else {
// Scale factors are normalized to a power of 2 to reduce the number of resolution changes
scale = RoundToFloatPrecision(transform2d.ScaleFactors(true));
// For frames with a changing transform that's not just a translation,
// round scale factors up to nearest power-of-2 boundary so that we don't
// keep having to redraw the content as it scales up and down. Rounding up to nearest
// power-of-2 boundary ensures we never scale up, only down --- avoiding
// jaggies. It also ensures we never scale down by more than a factor of 2,
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -2960,59 +2960,66 @@ bool nsDisplayWrapList::IsVaryingRelativ
return true;
}
void nsDisplayWrapList::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx) {
NS_ERROR("nsDisplayWrapList should have been flattened away for painting");
}
-/**
- * Returns true if all descendant display items can be placed in the same
- * ThebesLayer --- GetLayerState returns LAYER_INACTIVE or LAYER_NONE,
- * and they all have the expected animated geometry root.
- */
static LayerState
-RequiredLayerStateForChildren(nsDisplayListBuilder* aBuilder,
- LayerManager* aManager,
- const ContainerLayerParameters& aParameters,
- const nsDisplayList& aList,
- nsIFrame* aExpectedAnimatedGeometryRootForChildren)
+RequiredLayerStateForChildrenInternal(nsDisplayListBuilder* aBuilder,
+ LayerManager* aManager,
+ const ContainerLayerParameters& aParameters,
+ const nsDisplayList& aList,
+ nsIFrame* aAnimatedGeometryRoot)
{
LayerState result = LAYER_INACTIVE;
for (nsDisplayItem* i = aList.GetBottom(); i; i = i->GetAbove()) {
+ nsIFrame* f = i->Frame();
if (result == LAYER_INACTIVE &&
- nsLayoutUtils::GetAnimatedGeometryRootFor(i, aBuilder) !=
- aExpectedAnimatedGeometryRootForChildren) {
+ nsLayoutUtils::GetAnimatedGeometryRootFor(f) != aAnimatedGeometryRoot) {
result = LAYER_ACTIVE;
}
LayerState state = i->GetLayerState(aBuilder, aManager, aParameters);
if ((state == LAYER_ACTIVE || state == LAYER_ACTIVE_FORCE) &&
state > result) {
result = state;
}
if (state == LAYER_ACTIVE_EMPTY && state > result) {
result = LAYER_ACTIVE_FORCE;
}
if (state == LAYER_NONE) {
nsDisplayList* list = i->GetSameCoordinateSystemChildren();
if (list) {
LayerState childState =
- RequiredLayerStateForChildren(aBuilder, aManager, aParameters, *list,
- aExpectedAnimatedGeometryRootForChildren);
+ RequiredLayerStateForChildrenInternal(aBuilder, aManager, aParameters, *list,
+ aAnimatedGeometryRoot);
if (childState > result) {
result = childState;
}
}
}
}
return result;
}
+LayerState
+nsDisplayWrapList::RequiredLayerStateForChildren(nsDisplayListBuilder* aBuilder,
+ LayerManager* aManager,
+ const ContainerLayerParameters& aParameters,
+ const nsDisplayList& aList,
+ nsIFrame* aItemFrame)
+{
+ return RequiredLayerStateForChildrenInternal(
+ aBuilder, aManager, aParameters, aList,
+ nsLayoutUtils::GetAnimatedGeometryRootFor(aItemFrame));
+}
+
nsRect nsDisplayWrapList::GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder)
{
nsRect bounds;
for (nsDisplayItem* i = mList.GetBottom(); i; i = i->GetAbove()) {
bounds.UnionRect(bounds, i->GetComponentAlphaBounds(aBuilder));
}
return bounds;
}
@@ -3178,18 +3185,17 @@ nsDisplayOpacity::ShouldFlattenAway(nsDi
nsDisplayItem::LayerState
nsDisplayOpacity::GetLayerState(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
const ContainerLayerParameters& aParameters) {
if (NeedsActiveLayer())
return LAYER_ACTIVE;
- return RequiredLayerStateForChildren(aBuilder, aManager, aParameters, mList,
- nsLayoutUtils::GetAnimatedGeometryRootFor(this, aBuilder));
+ return RequiredLayerStateForChildren(aBuilder, aManager, aParameters, mList, mFrame);
}
bool
nsDisplayOpacity::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) {
// Our children are translucent so we should not allow them to subtract
// area from aVisibleRegion. We do need to find out what is visible under
@@ -4467,22 +4473,21 @@ nsDisplayTransform::GetLayerState(nsDisp
}
}
const nsStyleDisplay* disp = mFrame->StyleDisplay();
if ((disp->mWillChangeBitField & NS_STYLE_WILL_CHANGE_TRANSFORM)) {
return LAYER_ACTIVE;
}
- // Expect the child display items to have this frame as their animated
- // geometry root (since it will be their reference frame). If they have a
- // different animated geometry root, we'll make this an active layer so the
- // animation can be accelerated.
- return RequiredLayerStateForChildren(aBuilder, aManager, aParameters,
- *mStoredList.GetChildren(), Frame());
+ return mStoredList.RequiredLayerStateForChildren(aBuilder,
+ aManager,
+ aParameters,
+ *mStoredList.GetChildren(),
+ mFrame);
}
bool nsDisplayTransform::ComputeVisibility(nsDisplayListBuilder *aBuilder,
nsRegion *aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion)
{
/* As we do this, we need to be sure to
* untransform the visible rect, since we want everything that's painting to
--- a/layout/base/nsDisplayList.h
+++ b/layout/base/nsDisplayList.h
@@ -2485,16 +2485,27 @@ public:
* GetUnderlyingFrame().
*/
virtual nsDisplayWrapList* WrapWithClone(nsDisplayListBuilder* aBuilder,
nsDisplayItem* aItem) {
NS_NOTREACHED("We never returned nullptr for GetUnderlyingFrame!");
return nullptr;
}
+ /**
+ * Returns true if all descendant display items can be placed in the same
+ * ThebesLayer --- GetLayerState returns LAYER_INACTIVE or LAYER_NONE,
+ * and they all have the given aAnimatedGeometryRoot.
+ */
+ static LayerState RequiredLayerStateForChildren(nsDisplayListBuilder* aBuilder,
+ LayerManager* aManager,
+ const ContainerLayerParameters& aParameters,
+ const nsDisplayList& aList,
+ nsIFrame* aItemFrame);
+
protected:
nsDisplayWrapList() {}
void MergeFrom(nsDisplayWrapList* aOther)
{
mList.AppendToBottom(&aOther->mList);
mBounds.UnionRect(mBounds, aOther->mBounds);
}
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -304,73 +304,93 @@ GetScaleForValue(const nsStyleAnimation:
bool canDraw2D = transform.CanDraw2D(&transform2d);
if (!canDraw2D) {
return gfxSize();
}
return transform2d.ScaleFactors(true);
}
+float
+GetSuitableScale(float aMaxScale, float aMinScale)
+{
+ // If the minimum scale >= 1.0f, use it; if the maximum <= 1.0f, use it;
+ // otherwise use 1.0f.
+ if (aMinScale >= 1.0f) {
+ return aMinScale;
+ }
+ else if (aMaxScale <= 1.0f) {
+ return aMaxScale;
+ }
+
+ return 1.0f;
+}
+
gfxSize
-nsLayoutUtils::GetMaximumAnimatedScale(nsIContent* aContent)
-{
- gfxSize result;
+nsLayoutUtils::ComputeSuitableScaleForAnimation(nsIContent* aContent)
+{
+ gfxSize maxScale(1.0f, 1.0f);
+ gfxSize minScale(1.0f, 1.0f);
+
ElementAnimations* animations = HasAnimationOrTransitionForCompositor<ElementAnimations>
(aContent, nsGkAtoms::animationsProperty, eCSSProperty_transform);
if (animations) {
for (uint32_t animIdx = animations->mAnimations.Length(); animIdx-- != 0; ) {
ElementAnimation& anim = animations->mAnimations[animIdx];
for (uint32_t propIdx = anim.mProperties.Length(); propIdx-- != 0; ) {
AnimationProperty& prop = anim.mProperties[propIdx];
if (prop.mProperty == eCSSProperty_transform) {
for (uint32_t segIdx = prop.mSegments.Length(); segIdx-- != 0; ) {
AnimationPropertySegment& segment = prop.mSegments[segIdx];
gfxSize from = GetScaleForValue(segment.mFromValue,
aContent->GetPrimaryFrame());
- result.width = std::max<float>(result.width, from.width);
- result.height = std::max<float>(result.height, from.height);
+ maxScale.width = std::max<float>(maxScale.width, from.width);
+ maxScale.height = std::max<float>(maxScale.height, from.height);
+ minScale.width = std::min<float>(minScale.width, from.width);
+ minScale.height = std::min<float>(minScale.height, from.height);
gfxSize to = GetScaleForValue(segment.mToValue,
aContent->GetPrimaryFrame());
- result.width = std::max<float>(result.width, to.width);
- result.height = std::max<float>(result.height, to.height);
+ maxScale.width = std::max<float>(maxScale.width, to.width);
+ maxScale.height = std::max<float>(maxScale.height, to.height);
+ minScale.width = std::min<float>(minScale.width, to.width);
+ minScale.height = std::min<float>(minScale.height, to.height);
}
}
}
}
}
+
ElementTransitions* transitions = HasAnimationOrTransitionForCompositor<ElementTransitions>
(aContent, nsGkAtoms::transitionsProperty, eCSSProperty_transform);
if (transitions) {
for (uint32_t i = 0, i_end = transitions->mPropertyTransitions.Length();
- i < i_end; ++i)
- {
+ i < i_end; ++i){
ElementPropertyTransition &pt = transitions->mPropertyTransitions[i];
if (pt.IsRemovedSentinel()) {
continue;
}
-
if (pt.mProperty == eCSSProperty_transform) {
gfxSize start = GetScaleForValue(pt.mStartValue,
aContent->GetPrimaryFrame());
- result.width = std::max<float>(result.width, start.width);
- result.height = std::max<float>(result.height, start.height);
+ maxScale.width = std::max<float>(maxScale.width, start.width);
+ maxScale.height = std::max<float>(maxScale.height, start.height);
+ minScale.width = std::min<float>(minScale.width, start.width);
+ minScale.height = std::min<float>(minScale.height, start.height);
gfxSize end = GetScaleForValue(pt.mEndValue,
aContent->GetPrimaryFrame());
- result.width = std::max<float>(result.width, end.width);
- result.height = std::max<float>(result.height, end.height);
+ maxScale.width = std::max<float>(maxScale.width, end.width);
+ maxScale.height = std::max<float>(maxScale.height, end.height);
+ minScale.width = std::min<float>(minScale.width, end.width);
+ minScale.height = std::min<float>(minScale.height, end.height);
}
}
}
- // If we didn't manage to find a max scale, use no scale rather than 0,0
- if (result == gfxSize()) {
- return gfxSize(1, 1);
- }
-
- return result;
+ return gfxSize(GetSuitableScale(maxScale.width, minScale.width),
+ GetSuitableScale(maxScale.height, minScale.height));
}
bool
nsLayoutUtils::AreAsyncAnimationsEnabled()
{
static bool sAreAsyncAnimationsEnabled;
static bool sAsyncPrefCached = false;
@@ -1299,34 +1319,33 @@ nsLayoutUtils::IsFixedPosFrameInDisplayP
nsIFrame* parent = aFrame->GetParent();
if (!parent || parent->GetParent() ||
aFrame->StyleDisplay()->mPosition != NS_STYLE_POSITION_FIXED) {
return false;
}
return ViewportHasDisplayPort(aFrame->PresContext(), aDisplayPort);
}
-static nsIFrame*
-GetAnimatedGeometryRootForFrame(nsIFrame* aFrame,
- const nsIFrame* aStopAtAncestor)
+nsIFrame*
+nsLayoutUtils::GetAnimatedGeometryRootFor(nsIFrame* aFrame,
+ const nsIFrame* aStopAtAncestor)
{
nsIFrame* f = aFrame;
nsIFrame* stickyFrame = nullptr;
while (f != aStopAtAncestor) {
- if (nsLayoutUtils::IsPopup(f))
+ if (IsPopup(f))
break;
if (ActiveLayerTracker::IsOffsetOrMarginStyleAnimated(f))
break;
- if (!f->GetParent() &&
- nsLayoutUtils::ViewportHasDisplayPort(f->PresContext())) {
+ if (!f->GetParent() && ViewportHasDisplayPort(f->PresContext())) {
// Viewport frames in a display port need to be animated geometry roots
// for background-attachment:fixed elements.
break;
}
- nsIFrame* parent = nsLayoutUtils::GetCrossDocParentFrame(f);
+ nsIFrame* parent = GetCrossDocParentFrame(f);
if (!parent)
break;
nsIAtom* parentType = parent->GetType();
#ifdef ANDROID
// Treat the slider thumb as being as an active scrolled root
// on mobile so that it can move without repainting.
if (parentType == nsGkAtoms::sliderFrame)
break;
@@ -1347,48 +1366,48 @@ GetAnimatedGeometryRootForFrame(nsIFrame
return stickyFrame;
}
return f;
} else {
stickyFrame = nullptr;
}
}
// Fixed-pos frames are parented by the viewport frame, which has no parent
- if (nsLayoutUtils::IsFixedPosFrameInDisplayPort(f)) {
+ if (IsFixedPosFrameInDisplayPort(f)) {
return f;
}
f = parent;
}
return f;
}
nsIFrame*
nsLayoutUtils::GetAnimatedGeometryRootFor(nsDisplayItem* aItem,
nsDisplayListBuilder* aBuilder)
{
nsIFrame* f = aItem->Frame();
if (aItem->GetType() == nsDisplayItem::TYPE_SCROLL_LAYER) {
nsDisplayScrollLayer* scrollLayerItem =
static_cast<nsDisplayScrollLayer*>(aItem);
nsIFrame* scrolledFrame = scrollLayerItem->GetScrolledFrame();
- return GetAnimatedGeometryRootForFrame(scrolledFrame,
+ return nsLayoutUtils::GetAnimatedGeometryRootFor(scrolledFrame,
aBuilder->FindReferenceFrameFor(scrolledFrame));
}
if (aItem->ShouldFixToViewport(aBuilder)) {
// Make its active scrolled root be the active scrolled root of
// the enclosing viewport, since it shouldn't be scrolled by scrolled
// frames in its document. InvalidateFixedBackgroundFramesFromList in
// nsGfxScrollFrame will not repaint this item when scrolling occurs.
nsIFrame* viewportFrame =
nsLayoutUtils::GetClosestFrameOfType(f, nsGkAtoms::viewportFrame);
NS_ASSERTION(viewportFrame, "no viewport???");
- return GetAnimatedGeometryRootForFrame(viewportFrame,
+ return nsLayoutUtils::GetAnimatedGeometryRootFor(viewportFrame,
aBuilder->FindReferenceFrameFor(viewportFrame));
}
- return GetAnimatedGeometryRootForFrame(f, aItem->ReferenceFrame());
+ return nsLayoutUtils::GetAnimatedGeometryRootFor(f, aItem->ReferenceFrame());
}
// static
nsIScrollableFrame*
nsLayoutUtils::GetNearestScrollableFrameForDirection(nsIFrame* aFrame,
Direction aDirection)
{
NS_ASSERTION(aFrame, "GetNearestScrollableFrameForDirection expects a non-null frame");
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -403,32 +403,38 @@ public:
* which has a displayport. These frames get special treatment from the compositor.
* aDisplayPort, if non-null, is set to the display port rectangle (relative to
* the viewport).
*/
static bool IsFixedPosFrameInDisplayPort(const nsIFrame* aFrame,
nsRect* aDisplayPort = nullptr);
/**
- * Finds the nearest ancestor frame to aItem that is considered to have (or
- * will have) "animated geometry". For example the scrolled frames of
- * scrollframes which are actively being scrolled fall into this category.
- * Frames with certain CSS properties that are being animated (e.g.
- * 'left'/'top' etc) are also placed in this category.
+ * Finds the nearest ancestor frame that is considered to have (or will have)
+ * "animated geometry". For example the scrolled frames of scrollframes which
+ * are actively being scrolled fall into this category. Frames with certain
+ * CSS properties that are being animated (e.g. 'left'/'top' etc) are also
+ * placed in this category. Frames with animated CSS transforms are not
+ * put in this category because they can be handled directly by
+ * nsDisplayTransform.
+ * Stop searching at aStopAtAncestor if there is no such ancestor before it
+ * in the ancestor chain.
* Frames with different active geometry roots are in different ThebesLayers,
* so that we can animate the geometry root by changing its transform (either
* on the main thread or in the compositor).
- * The animated geometry root is required to be a descendant (or equal to)
- * aItem's ReferenceFrame(), which means that we will fall back to
- * returning aItem->ReferenceFrame() when we can't find another animated
- * geometry root.
+ * This function is idempotent: a frame returned by GetAnimatedGeometryRootFor
+ * is always returned again if you pass it to GetAnimatedGeometryRootFor.
*/
+ static nsIFrame* GetAnimatedGeometryRootFor(nsIFrame* aFrame,
+ const nsIFrame* aStopAtAncestor = nullptr);
+
static nsIFrame* GetAnimatedGeometryRootFor(nsDisplayItem* aItem,
nsDisplayListBuilder* aBuilder);
+
/**
* GetScrollableFrameFor returns the scrollable frame for a scrolled frame
*/
static nsIScrollableFrame* GetScrollableFrameFor(const nsIFrame *aScrolledFrame);
/**
* GetNearestScrollableFrameForDirection locates the first ancestor of
* aFrame (or aFrame itself) that is scrollable with overflow:scroll or
@@ -1717,21 +1723,24 @@ public:
static bool AreAsyncAnimationsEnabled();
/**
* Checks if we should warn about animations that can't be async
*/
static bool IsAnimationLoggingEnabled();
/**
- * Find the maximum scale for an element (aContent) over the course of any
- * animations and transitions on the element. Will return 1,1 if there is no
- * animated scaling.
+ * Find a suitable scale for an element (aContent) over the course of any
+ * animations and transitions on the element.
+ * It will check the maximum and minimum scale during the animations and
+ * transitions and return a suitable value for performance and quality.
+ * Will return scale(1,1) if there is no animated scaling.
+ * Always return positive value.
*/
- static gfxSize GetMaximumAnimatedScale(nsIContent* aContent);
+ static gfxSize ComputeSuitableScaleForAnimation(nsIContent* aContent);
/**
* Checks if we should forcibly use nearest pixel filtering for the
* background.
*/
static bool UseBackgroundNearestFiltering();
/**
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -125,17 +125,16 @@ using namespace mozilla::system;
#include "mozilla/dom/HTMLVideoElement.h"
extern void NS_ShutdownEventTargetChainRecycler();
using namespace mozilla;
using namespace mozilla::net;
using namespace mozilla::dom;
using namespace mozilla::dom::ipc;
-using namespace mozilla::dom::time;
nsrefcnt nsLayoutStatics::sLayoutStaticRefcnt = 0;
nsresult
nsLayoutStatics::Initialize()
{
NS_ASSERTION(sLayoutStaticRefcnt == 0,
"nsLayoutStatics isn't zero!");
@@ -275,18 +274,16 @@ nsLayoutStatics::Initialize()
nsSVGUtils::Init();
ProcessPriorityManager::Init();
nsPermissionManager::AppClearDataObserverInit();
nsCookieService::AppClearDataObserverInit();
nsApplicationCacheService::AppClearDataObserverInit();
- InitializeDateCacheCleaner();
-
HTMLVideoElement::Init();
CacheObserver::Init();
return NS_OK;
}
void
--- a/layout/forms/nsColorControlFrame.h
+++ b/layout/forms/nsColorControlFrame.h
@@ -36,18 +36,18 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
// nsIFrame
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
- nsIAtom* aAttribute,
- int32_t aModType) MOZ_OVERRIDE;
+ nsIAtom* aAttribute,
+ int32_t aModType) MOZ_OVERRIDE;
virtual bool IsLeaf() const MOZ_OVERRIDE { return true; }
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE;
virtual Element* GetPseudoElement(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;
private:
nsColorControlFrame(nsStyleContext* aContext);
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -1222,19 +1222,19 @@ public:
virtual bool IsFrameOfType(uint32_t aFlags) const
{
return nsBlockFrame::IsFrameOfType(aFlags &
~(nsIFrame::eReplacedContainsBlock));
}
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus);
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus);
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
protected:
nsComboboxControlFrame* mComboBox;
};
--- a/layout/forms/nsComboboxControlFrame.h
+++ b/layout/forms/nsComboboxControlFrame.h
@@ -64,24 +64,24 @@ public:
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
#endif
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
- virtual nsresult Reflow(nsPresContext* aCX,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ virtual nsresult Reflow(nsPresContext* aCX,
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual nsresult HandleEvent(nsPresContext* aPresContext,
- mozilla::WidgetGUIEvent* aEvent,
- nsEventStatus* aEventStatus);
+ mozilla::WidgetGUIEvent* aEvent,
+ nsEventStatus* aEventStatus);
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
void PaintFocus(nsRenderingContext& aRenderingContext, nsPoint aPt);
// XXXbz this is only needed to prevent the quirk percent height stuff from
@@ -99,17 +99,17 @@ public:
return do_QueryFrame(mDropdownFrame);
}
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
#endif
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
virtual nsresult SetInitialChildList(ChildListID aListID,
- nsFrameList& aChildList) MOZ_OVERRIDE;
+ nsFrameList& aChildList) MOZ_OVERRIDE;
virtual const nsFrameList& GetChildList(ChildListID aListID) const MOZ_OVERRIDE;
virtual void GetChildLists(nsTArray<ChildList>* aLists) const MOZ_OVERRIDE;
virtual nsIFrame* GetContentInsertionFrame();
// nsIFormControlFrame
virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue) MOZ_OVERRIDE;
/**
--- a/layout/forms/nsFieldSetFrame.h
+++ b/layout/forms/nsFieldSetFrame.h
@@ -28,34 +28,34 @@ public:
/**
* The area to paint box-shadows around. It's the border rect except
* when there's a <legend> we offset the y-position to the center of it.
*/
virtual nsRect VisualBorderRectRelativeToSelf() const MOZ_OVERRIDE;
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus);
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus);
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
void PaintBorderBackground(nsRenderingContext& aRenderingContext,
nsPoint aPt, const nsRect& aDirtyRect, uint32_t aBGFlags);
virtual nsresult AppendFrames(ChildListID aListID,
- nsFrameList& aFrameList);
+ nsFrameList& aFrameList);
virtual nsresult InsertFrames(ChildListID aListID,
- nsIFrame* aPrevFrame,
- nsFrameList& aFrameList);
+ nsIFrame* aPrevFrame,
+ nsFrameList& aFrameList);
virtual nsresult RemoveFrame(ChildListID aListID,
- nsIFrame* aOldFrame);
+ nsIFrame* aOldFrame);
virtual nsIAtom* GetType() const;
virtual bool IsFrameOfType(uint32_t aFlags) const
{
return nsContainerFrame::IsFrameOfType(aFlags &
~nsIFrame::eCanContainOverflowContainers);
}
virtual nsIScrollableFrame* GetScrollTargetFrame() MOZ_OVERRIDE
@@ -64,17 +64,17 @@ public:
}
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
#endif
#ifdef DEBUG
virtual nsresult SetInitialChildList(ChildListID aListID,
- nsFrameList& aChildList);
+ nsFrameList& aChildList);
#endif
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const {
return MakeFrameName(NS_LITERAL_STRING("FieldSet"), aResult);
}
#endif
--- a/layout/forms/nsFileControlFrame.h
+++ b/layout/forms/nsFileControlFrame.h
@@ -42,18 +42,18 @@ public:
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
#endif
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
- nsIAtom* aAttribute,
- int32_t aModType) MOZ_OVERRIDE;
+ nsIAtom* aAttribute,
+ int32_t aModType) MOZ_OVERRIDE;
virtual void ContentStatesChanged(nsEventStates aStates);
virtual bool IsLeaf() const
{
return true;
}
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
--- a/layout/forms/nsFormControlFrame.h
+++ b/layout/forms/nsFormControlFrame.h
@@ -37,29 +37,29 @@ public:
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
/**
* Respond to a gui event
* @see nsIFrame::HandleEvent
*/
virtual nsresult HandleEvent(nsPresContext* aPresContext,
- mozilla::WidgetGUIEvent* aEvent,
- nsEventStatus* aEventStatus) MOZ_OVERRIDE;
+ mozilla::WidgetGUIEvent* aEvent,
+ nsEventStatus* aEventStatus) MOZ_OVERRIDE;
virtual nscoord GetBaseline() const MOZ_OVERRIDE;
/**
* Respond to the request to resize and/or reflow
* @see nsIFrame::Reflow
*/
virtual nsresult Reflow(nsPresContext* aCX,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
// new behavior
virtual void SetFocus(bool aOn = true, bool aRepaint = false) MOZ_OVERRIDE;
// nsIFormControlFrame
--- a/layout/forms/nsGfxButtonControlFrame.h
+++ b/layout/forms/nsGfxButtonControlFrame.h
@@ -22,36 +22,36 @@ class nsGfxButtonControlFrame : public n
public:
NS_DECL_FRAMEARENA_HELPERS
nsGfxButtonControlFrame(nsStyleContext* aContext);
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
virtual nsresult HandleEvent(nsPresContext* aPresContext,
- mozilla::WidgetGUIEvent* aEvent,
- nsEventStatus* aEventStatus) MOZ_OVERRIDE;
+ mozilla::WidgetGUIEvent* aEvent,
+ nsEventStatus* aEventStatus) MOZ_OVERRIDE;
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
#endif
NS_DECL_QUERYFRAME
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
virtual nsIFrame* CreateFrameFor(nsIContent* aContent) MOZ_OVERRIDE;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
- nsIAtom* aAttribute,
- int32_t aModType) MOZ_OVERRIDE;
+ nsIAtom* aAttribute,
+ int32_t aModType) MOZ_OVERRIDE;
virtual bool IsLeaf() const MOZ_OVERRIDE;
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE;
protected:
nsresult GetDefaultLabel(nsXPIDLString& aLabel) const;
--- a/layout/forms/nsHTMLButtonControlFrame.h
+++ b/layout/forms/nsHTMLButtonControlFrame.h
@@ -29,42 +29,42 @@ public:
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
- virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ virtual nsresult Reflow(nsPresContext* aPresContext,
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual nsresult HandleEvent(nsPresContext* aPresContext,
- mozilla::WidgetGUIEvent* aEvent,
- nsEventStatus* aEventStatus) MOZ_OVERRIDE;
+ mozilla::WidgetGUIEvent* aEvent,
+ nsEventStatus* aEventStatus) MOZ_OVERRIDE;
virtual void Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* asPrevInFlow) MOZ_OVERRIDE;
virtual nsStyleContext* GetAdditionalStyleContext(int32_t aIndex) const MOZ_OVERRIDE;
virtual void SetAdditionalStyleContext(int32_t aIndex,
nsStyleContext* aStyleContext) MOZ_OVERRIDE;
virtual nsresult AppendFrames(ChildListID aListID,
- nsFrameList& aFrameList) MOZ_OVERRIDE;
+ nsFrameList& aFrameList) MOZ_OVERRIDE;
virtual nsresult InsertFrames(ChildListID aListID,
- nsIFrame* aPrevFrame,
- nsFrameList& aFrameList) MOZ_OVERRIDE;
+ nsIFrame* aPrevFrame,
+ nsFrameList& aFrameList) MOZ_OVERRIDE;
virtual nsresult RemoveFrame(ChildListID aListID,
- nsIFrame* aOldFrame) MOZ_OVERRIDE;
+ nsIFrame* aOldFrame) MOZ_OVERRIDE;
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
#endif
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
#ifdef DEBUG_FRAME_DUMP
--- a/layout/forms/nsImageControlFrame.cpp
+++ b/layout/forms/nsImageControlFrame.cpp
@@ -33,39 +33,39 @@ public:
virtual void DestroyFrom(nsIFrame* aDestructRoot);
virtual void Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
- virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus);
+ virtual nsresult Reflow(nsPresContext* aPresContext,
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus);
virtual nsresult HandleEvent(nsPresContext* aPresContext,
- WidgetGUIEvent* aEvent,
- nsEventStatus* aEventStatus);
+ WidgetGUIEvent* aEvent,
+ nsEventStatus* aEventStatus);
virtual nsIAtom* GetType() const;
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
#endif
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const {
return MakeFrameName(NS_LITERAL_STRING("ImageControl"), aResult);
}
#endif
virtual nsresult GetCursor(const nsPoint& aPoint,
- nsIFrame::Cursor& aCursor);
+ nsIFrame::Cursor& aCursor);
// nsIFormContromFrame
virtual void SetFocus(bool aOn, bool aRepaint);
virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue);
};
nsImageControlFrame::nsImageControlFrame(nsStyleContext* aContext):
nsImageControlFrameSuper(aContext)
--- a/layout/forms/nsLegendFrame.h
+++ b/layout/forms/nsLegendFrame.h
@@ -13,19 +13,19 @@ class nsLegendFrame : public nsBlockFram
public:
NS_DECL_QUERYFRAME_TARGET(nsLegendFrame)
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
nsLegendFrame(nsStyleContext* aContext) : nsBlockFrame(aContext) {}
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
#endif
--- a/layout/forms/nsListControlFrame.h
+++ b/layout/forms/nsListControlFrame.h
@@ -54,37 +54,37 @@ class nsListControlFrame : public nsHTML
public:
friend nsIFrame* NS_NewListControlFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
// nsIFrame
virtual nsresult HandleEvent(nsPresContext* aPresContext,
- mozilla::WidgetGUIEvent* aEvent,
- nsEventStatus* aEventStatus) MOZ_OVERRIDE;
+ mozilla::WidgetGUIEvent* aEvent,
+ nsEventStatus* aEventStatus) MOZ_OVERRIDE;
virtual nsresult SetInitialChildList(ChildListID aListID,
- nsFrameList& aChildList) MOZ_OVERRIDE;
+ nsFrameList& aChildList) MOZ_OVERRIDE;
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
- virtual nsresult Reflow(nsPresContext* aCX,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ virtual nsresult Reflow(nsPresContext* aCX,
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual void Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
- virtual nsresult DidReflow(nsPresContext* aPresContext,
- const nsHTMLReflowState* aReflowState,
- nsDidReflowStatus aStatus) MOZ_OVERRIDE;
+ virtual nsresult DidReflow(nsPresContext* aPresContext,
+ const nsHTMLReflowState* aReflowState,
+ nsDidReflowStatus aStatus) MOZ_OVERRIDE;
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE;
--- a/layout/forms/nsMeterFrame.h
+++ b/layout/forms/nsMeterFrame.h
@@ -23,36 +23,36 @@ public:
NS_DECL_FRAMEARENA_HELPERS
nsMeterFrame(nsStyleContext* aContext);
virtual ~nsMeterFrame();
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
virtual nsresult Reflow(nsPresContext* aCX,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE {
return MakeFrameName(NS_LITERAL_STRING("Meter"), aResult);
}
#endif
virtual bool IsLeaf() const MOZ_OVERRIDE { return true; }
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
- nsIAtom* aAttribute,
- int32_t aModType) MOZ_OVERRIDE;
+ nsIAtom* aAttribute,
+ int32_t aModType) MOZ_OVERRIDE;
virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
nsSize aCBSize, nscoord aAvailableWidth,
nsSize aMargin, nsSize aBorder,
nsSize aPadding, bool aShrinkWrap) MOZ_OVERRIDE;
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
--- a/layout/forms/nsNumberControlFrame.cpp
+++ b/layout/forms/nsNumberControlFrame.cpp
@@ -55,16 +55,52 @@ nsNumberControlFrame::DestroyFrom(nsIFra
NS_ASSERTION(!GetPrevContinuation() && !GetNextContinuation(),
"nsNumberControlFrame should not have continuations; if it does we "
"need to call RegUnregAccessKey only for the first");
nsFormControlFrame::RegUnRegAccessKey(static_cast<nsIFrame*>(this), false);
nsContentUtils::DestroyAnonymousContent(&mOuterWrapper);
nsContainerFrame::DestroyFrom(aDestructRoot);
}
+nscoord
+nsNumberControlFrame::GetMinWidth(nsRenderingContext* aRenderingContext)
+{
+ nscoord result;
+ DISPLAY_MIN_WIDTH(this, result);
+
+ nsIFrame* kid = mFrames.FirstChild();
+ if (kid) { // display:none?
+ result = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
+ kid,
+ nsLayoutUtils::MIN_WIDTH);
+ } else {
+ result = 0;
+ }
+
+ return result;
+}
+
+nscoord
+nsNumberControlFrame::GetPrefWidth(nsRenderingContext* aRenderingContext)
+{
+ nscoord result;
+ DISPLAY_PREF_WIDTH(this, result);
+
+ nsIFrame* kid = mFrames.FirstChild();
+ if (kid) { // display:none?
+ result = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
+ kid,
+ nsLayoutUtils::PREF_WIDTH);
+ } else {
+ result = 0;
+ }
+
+ return result;
+}
+
nsresult
nsNumberControlFrame::Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsNumberControlFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
@@ -78,88 +114,104 @@ nsNumberControlFrame::Reflow(nsPresConte
NS_ASSERTION(!mFrames.FirstChild() ||
!mFrames.FirstChild()->GetNextSibling(),
"We expect at most one direct child frame");
if (mState & NS_FRAME_FIRST_REFLOW) {
nsFormControlFrame::RegUnRegAccessKey(this, true);
}
- nsHTMLReflowMetrics wrappersDesiredSize(aReflowState.GetWritingMode());
+ // The width of our content box, which is the available width
+ // for our anonymous content:
+ const nscoord contentBoxWidth = aReflowState.ComputedWidth();
+ nscoord contentBoxHeight = aReflowState.ComputedHeight();
+
nsIFrame* outerWrapperFrame = mOuterWrapper->GetPrimaryFrame();
- if (outerWrapperFrame) { // display:none?
+
+ if (!outerWrapperFrame) { // display:none?
+ if (contentBoxHeight == NS_INTRINSICSIZE) {
+ contentBoxHeight = 0;
+ }
+ } else {
NS_ASSERTION(outerWrapperFrame == mFrames.FirstChild(), "huh?");
- nsresult rv =
- ReflowAnonymousContent(aPresContext, wrappersDesiredSize,
- aReflowState, outerWrapperFrame);
+
+ nsHTMLReflowMetrics wrappersDesiredSize(aReflowState.GetWritingMode());
+
+ nsHTMLReflowState wrapperReflowState(aPresContext, aReflowState,
+ outerWrapperFrame,
+ nsSize(contentBoxWidth,
+ NS_UNCONSTRAINEDSIZE));
+
+ // offsets of wrapper frame
+ nscoord xoffset = aReflowState.ComputedPhysicalBorderPadding().left +
+ wrapperReflowState.ComputedPhysicalMargin().left;
+ nscoord yoffset = aReflowState.ComputedPhysicalBorderPadding().top +
+ wrapperReflowState.ComputedPhysicalMargin().top;
+
+ nsReflowStatus childStatus;
+ nsresult rv = ReflowChild(outerWrapperFrame, aPresContext,
+ wrappersDesiredSize, wrapperReflowState,
+ xoffset, yoffset, 0, childStatus);
NS_ENSURE_SUCCESS(rv, rv);
- ConsiderChildOverflow(aDesiredSize.mOverflowAreas, outerWrapperFrame);
+ MOZ_ASSERT(NS_FRAME_IS_FULLY_COMPLETE(childStatus),
+ "We gave our child unconstrained height, so it should be complete");
+
+ nscoord wrappersMarginBoxHeight = wrappersDesiredSize.Height() +
+ wrapperReflowState.ComputedPhysicalMargin().TopBottom();
+
+ if (contentBoxHeight == NS_INTRINSICSIZE) {
+ // We are intrinsically sized -- we should shrinkwrap the outer wrapper's
+ // height:
+ contentBoxHeight = wrappersMarginBoxHeight;
+
+ // Make sure we obey min/max-height in the case when we're doing intrinsic
+ // sizing (we get it for free when we have a non-intrinsic
+ // aReflowState.ComputedHeight()). Note that we do this before
+ // adjusting for borderpadding, since mComputedMaxHeight and
+ // mComputedMinHeight are content heights.
+ contentBoxHeight =
+ NS_CSS_MINMAX(contentBoxHeight,
+ aReflowState.ComputedMinHeight(),
+ aReflowState.ComputedMaxHeight());
+ }
+
+ // Center child vertically
+ nscoord extraSpace = contentBoxHeight - wrappersMarginBoxHeight;
+ yoffset += std::max(0, extraSpace / 2);
+
+ // Place the child
+ rv = FinishReflowChild(outerWrapperFrame, aPresContext,
+ wrappersDesiredSize, &wrapperReflowState,
+ xoffset, yoffset, 0);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ aDesiredSize.SetTopAscent(wrappersDesiredSize.TopAscent() +
+ outerWrapperFrame->GetPosition().y);
}
- nscoord computedHeight = aReflowState.ComputedHeight();
- if (computedHeight == NS_AUTOHEIGHT) {
- computedHeight =
- outerWrapperFrame ? outerWrapperFrame->GetSize().height : 0;
- }
- aDesiredSize.Width() = aReflowState.ComputedWidth() +
+ aDesiredSize.Width() = contentBoxWidth +
aReflowState.ComputedPhysicalBorderPadding().LeftRight();
- aDesiredSize.Height() = computedHeight +
+ aDesiredSize.Height() = contentBoxHeight +
aReflowState.ComputedPhysicalBorderPadding().TopBottom();
+ aDesiredSize.SetOverflowAreasToDesiredBounds();
+
if (outerWrapperFrame) {
- aDesiredSize.SetTopAscent(wrappersDesiredSize.TopAscent() +
- outerWrapperFrame->GetPosition().y);
+ ConsiderChildOverflow(aDesiredSize.mOverflowAreas, outerWrapperFrame);
}
- aDesiredSize.SetOverflowAreasToDesiredBounds();
-
FinishAndStoreOverflow(&aDesiredSize);
aStatus = NS_FRAME_COMPLETE;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
return NS_OK;
}
-nsresult
-nsNumberControlFrame::
- ReflowAnonymousContent(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aWrappersDesiredSize,
- const nsHTMLReflowState& aParentReflowState,
- nsIFrame* aOuterWrapperFrame)
-{
- MOZ_ASSERT(aOuterWrapperFrame);
-
- // The width of our content box, which is the available width
- // for our anonymous content:
- nscoord inputFrameContentBoxWidth = aParentReflowState.ComputedWidth();
-
- nsHTMLReflowState wrapperReflowState(aPresContext, aParentReflowState,
- aOuterWrapperFrame,
- nsSize(inputFrameContentBoxWidth,
- NS_UNCONSTRAINEDSIZE));
-
- nscoord xoffset = aParentReflowState.ComputedPhysicalBorderPadding().left +
- wrapperReflowState.ComputedPhysicalMargin().left;
- nscoord yoffset = aParentReflowState.ComputedPhysicalBorderPadding().top +
- wrapperReflowState.ComputedPhysicalMargin().top;
-
- nsReflowStatus childStatus;
- nsresult rv = ReflowChild(aOuterWrapperFrame, aPresContext,
- aWrappersDesiredSize, wrapperReflowState,
- xoffset, yoffset, 0, childStatus);
- NS_ENSURE_SUCCESS(rv, rv);
- MOZ_ASSERT(NS_FRAME_IS_FULLY_COMPLETE(childStatus),
- "We gave our child unconstrained height, so it should be complete");
- return FinishReflowChild(aOuterWrapperFrame, aPresContext,
- aWrappersDesiredSize, &wrapperReflowState,
- xoffset, yoffset, 0);
-}
-
void
nsNumberControlFrame::SyncDisabledState()
{
nsEventStates eventStates = mContent->AsElement()->State();
if (eventStates.HasState(NS_EVENT_STATE_DISABLED)) {
mTextField->SetAttr(kNameSpaceID_None, nsGkAtoms::disabled, EmptyString(),
true);
} else {
--- a/layout/forms/nsNumberControlFrame.h
+++ b/layout/forms/nsNumberControlFrame.h
@@ -45,24 +45,28 @@ public:
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
virtual void ContentStatesChanged(nsEventStates aStates);
virtual bool IsLeaf() const MOZ_OVERRIDE { return true; }
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
#endif
+ virtual nscoord GetMinWidth(nsRenderingContext* aRenderingContext) MOZ_OVERRIDE;
+
+ virtual nscoord GetPrefWidth(nsRenderingContext* aRenderingContext) MOZ_OVERRIDE;
+
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
- nsIAtom* aAttribute,
- int32_t aModType) MOZ_OVERRIDE;
+ nsIAtom* aAttribute,
+ int32_t aModType) MOZ_OVERRIDE;
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE {
@@ -154,21 +158,16 @@ public:
private:
nsresult MakeAnonymousElement(Element** aResult,
nsTArray<ContentInfo>& aElements,
nsIAtom* aTagName,
nsCSSPseudoElements::Type aPseudoType,
nsStyleContext* aParentContext);
- nsresult ReflowAnonymousContent(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aWrappersDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsIFrame* aOuterWrapperFrame);
-
class SyncDisabledStateEvent;
friend class SyncDisabledStateEvent;
class SyncDisabledStateEvent : public nsRunnable
{
public:
SyncDisabledStateEvent(nsNumberControlFrame* aFrame)
: mFrame(aFrame)
{}
--- a/layout/forms/nsProgressFrame.h
+++ b/layout/forms/nsProgressFrame.h
@@ -28,36 +28,36 @@ public:
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
virtual nsresult Reflow(nsPresContext* aCX,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE {
return MakeFrameName(NS_LITERAL_STRING("Progress"), aResult);
}
#endif
virtual bool IsLeaf() const MOZ_OVERRIDE { return true; }
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
- nsIAtom* aAttribute,
- int32_t aModType) MOZ_OVERRIDE;
+ nsIAtom* aAttribute,
+ int32_t aModType) MOZ_OVERRIDE;
virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
nsSize aCBSize, nscoord aAvailableWidth,
nsSize aMargin, nsSize aBorder,
nsSize aPadding, bool aShrinkWrap) MOZ_OVERRIDE;
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
--- a/layout/forms/nsRangeFrame.h
+++ b/layout/forms/nsRangeFrame.h
@@ -38,19 +38,19 @@ public:
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE {
return MakeFrameName(NS_LITERAL_STRING("Range"), aResult);
}
#endif
virtual bool IsLeaf() const MOZ_OVERRIDE { return true; }
@@ -60,18 +60,18 @@ public:
#endif
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
- nsIAtom* aAttribute,
- int32_t aModType) MOZ_OVERRIDE;
+ nsIAtom* aAttribute,
+ int32_t aModType) MOZ_OVERRIDE;
virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
nsSize aCBSize, nscoord aAvailableWidth,
nsSize aMargin, nsSize aBorder,
nsSize aPadding, bool aShrinkWrap) MOZ_OVERRIDE;
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
--- a/layout/forms/nsSelectsAreaFrame.h
+++ b/layout/forms/nsSelectsAreaFrame.h
@@ -18,20 +18,20 @@ public:
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
void BuildDisplayListInternal(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists);
- virtual nsresult Reflow(nsPresContext* aCX,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ virtual nsresult Reflow(nsPresContext* aCX,
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
nscoord HeightOfARow() const { return mHeightOfARow; }
protected:
nsSelectsAreaFrame(nsStyleContext* aContext) :
nsBlockFrame(aContext),
mHeightOfARow(0)
{}
--- a/layout/forms/nsTextControlFrame.h
+++ b/layout/forms/nsTextControlFrame.h
@@ -45,20 +45,20 @@ public:
virtual nscoord GetMinWidth(nsRenderingContext* aRenderingContext) MOZ_OVERRIDE;
virtual nscoord GetPrefWidth(nsRenderingContext* aRenderingContext) MOZ_OVERRIDE;
virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
nsSize aCBSize, nscoord aAvailableWidth,
nsSize aMargin, nsSize aBorder,
nsSize aPadding, bool aShrinkWrap) MOZ_OVERRIDE;
- virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ virtual nsresult Reflow(nsPresContext* aPresContext,
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
virtual bool IsCollapsed() MOZ_OVERRIDE;
virtual bool IsLeaf() const MOZ_OVERRIDE;
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
@@ -83,17 +83,17 @@ public:
// nsIAnonymousContentCreator
virtual nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) MOZ_OVERRIDE;
virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
uint32_t aFilter) MOZ_OVERRIDE;
// Utility methods to set current widget state
virtual nsresult SetInitialChildList(ChildListID aListID,
- nsFrameList& aChildList) MOZ_OVERRIDE;
+ nsFrameList& aChildList) MOZ_OVERRIDE;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
virtual mozilla::dom::Element* GetPseudoElement(nsCSSPseudoElements::Type aType) MOZ_OVERRIDE;
//==== BEGIN NSIFORMCONTROLFRAME
@@ -134,18 +134,18 @@ public:
//=== END NSISTATEFULFRAME
//==== OVERLOAD of nsIFrame
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
/** handler for attribute changes to mContent */
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
- nsIAtom* aAttribute,
- int32_t aModType) MOZ_OVERRIDE;
+ nsIAtom* aAttribute,
+ int32_t aModType) MOZ_OVERRIDE;
nsresult GetText(nsString& aText);
virtual nsresult PeekOffset(nsPeekOffsetStruct *aPos) MOZ_OVERRIDE;
NS_DECL_QUERYFRAME
// Temp reference to scriptrunner
--- a/layout/generic/moz.build
+++ b/layout/generic/moz.build
@@ -74,17 +74,17 @@ UNIFIED_SOURCES += [
'nsInlineFrame.cpp',
'nsIntervalSet.cpp',
'nsLeafFrame.cpp',
'nsLineBox.cpp',
'nsPageContentFrame.cpp',
'nsPageFrame.cpp',
'nsPlaceholderFrame.cpp',
'nsSelection.cpp',
- 'nsSimplePageSequence.cpp',
+ 'nsSimplePageSequenceFrame.cpp',
'nsSplittableFrame.cpp',
'nsSubDocumentFrame.cpp',
'nsTextFrame.cpp',
'nsTextFrameUtils.cpp',
'nsTextRunTransformations.cpp',
'nsVideoFrame.cpp',
'nsViewportFrame.cpp',
'ScrollbarActivity.cpp',
--- a/layout/generic/nsBRFrame.cpp
+++ b/layout/generic/nsBRFrame.cpp
@@ -30,19 +30,19 @@ public:
virtual bool PeekOffsetNoAmount(bool aForward, int32_t* aOffset);
virtual bool PeekOffsetCharacter(bool aForward, int32_t* aOffset,
bool aRespectClusters = true);
virtual bool PeekOffsetWord(bool aForward, bool aWordSelectEatSpace, bool aIsKeyboardSelect,
int32_t* aOffset, PeekWordState* aState);
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus);
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus);
virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
InlineMinWidthData *aData);
virtual void AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
InlinePrefWidthData *aData);
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
virtual nsIAtom* GetType() const;
virtual nscoord GetBaseline() const;
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -104,24 +104,24 @@ public:
// nsQueryFrame
NS_DECL_QUERYFRAME
// nsIFrame
virtual void Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
virtual nsresult SetInitialChildList(ChildListID aListID,
- nsFrameList& aChildList) MOZ_OVERRIDE;
+ nsFrameList& aChildList) MOZ_OVERRIDE;
virtual nsresult AppendFrames(ChildListID aListID,
- nsFrameList& aFrameList) MOZ_OVERRIDE;
+ nsFrameList& aFrameList) MOZ_OVERRIDE;
virtual nsresult InsertFrames(ChildListID aListID,
- nsIFrame* aPrevFrame,
- nsFrameList& aFrameList) MOZ_OVERRIDE;
+ nsIFrame* aPrevFrame,
+ nsFrameList& aFrameList) MOZ_OVERRIDE;
virtual nsresult RemoveFrame(ChildListID aListID,
- nsIFrame* aOldFrame) MOZ_OVERRIDE;
+ nsIFrame* aOldFrame) MOZ_OVERRIDE;
virtual const nsFrameList& GetChildList(ChildListID aListID) const MOZ_OVERRIDE;
virtual void GetChildLists(nsTArray<ChildList>* aLists) const MOZ_OVERRIDE;
virtual nscoord GetBaseline() const MOZ_OVERRIDE;
virtual nscoord GetCaretBaseline() const MOZ_OVERRIDE;
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
virtual nsSplittableType GetSplittableType() const MOZ_OVERRIDE;
virtual bool IsFloatContainingBlock() const MOZ_OVERRIDE;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
@@ -256,24 +256,24 @@ public:
*/
void ComputeFinalHeight(const nsHTMLReflowState& aReflowState,
nsReflowStatus* aStatus,
nscoord aContentHeight,
const nsMargin& aBorderPadding,
nsHTMLReflowMetrics& aMetrics,
nscoord aConsumed);
- virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ virtual nsresult Reflow(nsPresContext* aPresContext,
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
- nsIAtom* aAttribute,
- int32_t aModType) MOZ_OVERRIDE;
+ nsIAtom* aAttribute,
+ int32_t aModType) MOZ_OVERRIDE;
/**
* Move any frames on our overflow list to the end of our principal list.
* @return true if there were any overflow frames
*/
virtual bool DrainSelfOverflowList() MOZ_OVERRIDE;
virtual nsresult StealFrame(nsIFrame* aChild,
--- a/layout/generic/nsBulletFrame.h
+++ b/layout/generic/nsBulletFrame.h
@@ -61,19 +61,19 @@ public:
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) MOZ_OVERRIDE;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
#endif
// nsIHTMLReflow
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aMetrics,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ nsHTMLReflowMetrics& aMetrics,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
// nsBulletFrame
int32_t SetListItemOrdinal(int32_t aNextOrdinal, bool* aChanged,
int32_t aIncrement);
--- a/layout/generic/nsCanvasFrame.h
+++ b/layout/generic/nsCanvasFrame.h
@@ -36,31 +36,31 @@ public:
NS_DECL_QUERYFRAME_TARGET(nsCanvasFrame)
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
virtual nsresult SetInitialChildList(ChildListID aListID,
- nsFrameList& aChildList) MOZ_OVERRIDE;
+ nsFrameList& aChildList) MOZ_OVERRIDE;
virtual nsresult AppendFrames(ChildListID aListID,
- nsFrameList& aFrameList) MOZ_OVERRIDE;
+ nsFrameList& aFrameList) MOZ_OVERRIDE;
virtual nsresult InsertFrames(ChildListID aListID,
- nsIFrame* aPrevFrame,
- nsFrameList& aFrameList) MOZ_OVERRIDE;
+ nsIFrame* aPrevFrame,
+ nsFrameList& aFrameList) MOZ_OVERRIDE;
virtual nsresult RemoveFrame(ChildListID aListID,
- nsIFrame* aOldFrame) MOZ_OVERRIDE;
+ nsIFrame* aOldFrame) MOZ_OVERRIDE;
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
- virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ virtual nsresult Reflow(nsPresContext* aPresContext,
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
{
return nsContainerFrame::IsFrameOfType(aFlags &
~(nsIFrame::eCanContainOverflowContainers));
}
/** SetHasFocus tells the CanvasFrame to draw with focus ring
* @param aHasFocus true to show focus ring, false to hide it
@@ -96,17 +96,17 @@ public:
}
return rv;
}
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
#endif
virtual nsresult GetContentForEvent(mozilla::WidgetEvent* aEvent,
- nsIContent** aContent) MOZ_OVERRIDE;
+ nsIContent** aContent) MOZ_OVERRIDE;
nsRect CanvasArea() const;
protected:
// Data members
bool mDoPaintFocus;
bool mAddedScrollPositionListener;
};
--- a/layout/generic/nsColumnSetFrame.h
+++ b/layout/generic/nsColumnSetFrame.h
@@ -10,30 +10,30 @@
class nsColumnSetFrame : public nsContainerFrame {
public:
NS_DECL_FRAMEARENA_HELPERS
nsColumnSetFrame(nsStyleContext* aContext);
virtual nsresult SetInitialChildList(ChildListID aListID,
- nsFrameList& aChildList) MOZ_OVERRIDE;
+ nsFrameList& aChildList) MOZ_OVERRIDE;
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual nsresult AppendFrames(ChildListID aListID,
- nsFrameList& aFrameList) MOZ_OVERRIDE;
+ nsFrameList& aFrameList) MOZ_OVERRIDE;
virtual nsresult InsertFrames(ChildListID aListID,
- nsIFrame* aPrevFrame,
- nsFrameList& aFrameList) MOZ_OVERRIDE;
+ nsIFrame* aPrevFrame,
+ nsFrameList& aFrameList) MOZ_OVERRIDE;
virtual nsresult RemoveFrame(ChildListID aListID,
- nsIFrame* aOldFrame) MOZ_OVERRIDE;
+ nsIFrame* aOldFrame) MOZ_OVERRIDE;
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
/**
* Retrieve the available height for content of this frame. The available content
* height is the available height for the frame, minus borders and padding.
*/
--- a/layout/generic/nsContainerFrame.h
+++ b/layout/generic/nsContainerFrame.h
@@ -51,24 +51,24 @@ public:
NS_DECL_QUERYFRAME_TARGET(nsContainerFrame)
NS_DECL_QUERYFRAME
// nsIFrame overrides
virtual void Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
virtual nsresult SetInitialChildList(ChildListID aListID,
- nsFrameList& aChildList) MOZ_OVERRIDE;
+ nsFrameList& aChildList) MOZ_OVERRIDE;
virtual nsresult AppendFrames(ChildListID aListID,
- nsFrameList& aFrameList) MOZ_OVERRIDE;
+ nsFrameList& aFrameList) MOZ_OVERRIDE;
virtual nsresult InsertFrames(ChildListID aListID,
- nsIFrame* aPrevFrame,
- nsFrameList& aFrameList) MOZ_OVERRIDE;
+ nsIFrame* aPrevFrame,
+ nsFrameList& aFrameList) MOZ_OVERRIDE;
virtual nsresult RemoveFrame(ChildListID aListID,
- nsIFrame* aOldFrame) MOZ_OVERRIDE;
+ nsIFrame* aOldFrame) MOZ_OVERRIDE;
virtual const nsFrameList& GetChildList(ChildListID aList) const MOZ_OVERRIDE;
virtual void GetChildLists(nsTArray<ChildList>* aLists) const MOZ_OVERRIDE;
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
virtual void ChildIsDirty(nsIFrame* aChild) MOZ_OVERRIDE;
virtual bool IsLeaf() const MOZ_OVERRIDE;
virtual bool PeekOffsetNoAmount(bool aForward, int32_t* aOffset) MOZ_OVERRIDE;
--- a/layout/generic/nsFirstLetterFrame.h
+++ b/layout/generic/nsFirstLetterFrame.h
@@ -22,17 +22,17 @@ public:
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
virtual void Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
virtual nsresult SetInitialChildList(ChildListID aListID,
- nsFrameList& aChildList) MOZ_OVERRIDE;
+ nsFrameList& aChildList) MOZ_OVERRIDE;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
#endif
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
bool IsFloating() const { return GetStateBits() & NS_FRAME_OUT_OF_FLOW; }
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
@@ -48,30 +48,30 @@ public:
virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
InlineMinWidthData *aData) MOZ_OVERRIDE;
virtual void AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
InlinePrefWidthData *aData) MOZ_OVERRIDE;
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
nsSize aCBSize, nscoord aAvailableWidth,
nsSize aMargin, nsSize aBorder, nsSize aPadding,
uint32_t aFlags) MOZ_OVERRIDE;
- virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ virtual nsresult Reflow(nsPresContext* aPresContext,
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual bool CanContinueTextRun() const MOZ_OVERRIDE;
virtual nscoord GetBaseline() const MOZ_OVERRIDE;
virtual int GetSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE;
//override of nsFrame method
virtual nsresult GetChildFrameContainingOffset(int32_t inContentOffset,
- bool inHint,
- int32_t* outFrameContentOffset,
- nsIFrame **outChildFrame) MOZ_OVERRIDE;
+ bool inHint,
+ int32_t* outFrameContentOffset,
+ nsIFrame** outChildFrame) MOZ_OVERRIDE;
nscoord GetFirstLetterBaseline() const { return mBaseline; }
// For floating first letter frames, create a continuation for aChild and
// place it in the correct place. aContinuation is an outparam for the
// continuation that is created. aIsFluid determines if the continuation is
// fluid or not.
nsresult CreateContinuationForFloatingParent(nsPresContext* aPresContext,
--- a/layout/generic/nsFlexContainerFrame.h
+++ b/layout/generic/nsFlexContainerFrame.h
@@ -36,19 +36,19 @@ public:
class StrutInfo;
// nsIFrame overrides
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual nscoord
GetMinWidth(nsRenderingContext* aRenderingContext) MOZ_OVERRIDE;
virtual nscoord
GetPrefWidth(nsRenderingContext* aRenderingContext) MOZ_OVERRIDE;
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
#ifdef DEBUG_FRAME_DUMP
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -139,61 +139,61 @@ public:
// nsQueryFrame
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
// nsIFrame
virtual void Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* asPrevInFlow) MOZ_OVERRIDE;
- virtual nsresult SetInitialChildList(ChildListID aListID,
- nsFrameList& aChildList) MOZ_OVERRIDE;
+ virtual nsresult SetInitialChildList(ChildListID aListID,
+ nsFrameList& aChildList) MOZ_OVERRIDE;
virtual nsresult AppendFrames(ChildListID aListID,
- nsFrameList& aFrameList) MOZ_OVERRIDE;
+ nsFrameList& aFrameList) MOZ_OVERRIDE;
virtual nsresult InsertFrames(ChildListID aListID,
- nsIFrame* aPrevFrame,
- nsFrameList& aFrameList) MOZ_OVERRIDE;
+ nsIFrame* aPrevFrame,
+ nsFrameList& aFrameList) MOZ_OVERRIDE;
virtual nsresult RemoveFrame(ChildListID aListID,
- nsIFrame* aOldFrame) MOZ_OVERRIDE;
+ nsIFrame* aOldFrame) MOZ_OVERRIDE;
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
virtual nsStyleContext* GetAdditionalStyleContext(int32_t aIndex) const MOZ_OVERRIDE;
virtual void SetAdditionalStyleContext(int32_t aIndex,
nsStyleContext* aStyleContext) MOZ_OVERRIDE;
virtual void SetParent(nsIFrame* aParent) MOZ_OVERRIDE;
virtual nscoord GetBaseline() const MOZ_OVERRIDE;
virtual const nsFrameList& GetChildList(ChildListID aListID) const MOZ_OVERRIDE;
virtual void GetChildLists(nsTArray<ChildList>* aLists) const MOZ_OVERRIDE;
virtual nsresult HandleEvent(nsPresContext* aPresContext,
- mozilla::WidgetGUIEvent* aEvent,
- nsEventStatus* aEventStatus) MOZ_OVERRIDE;
+ mozilla::WidgetGUIEvent* aEvent,
+ nsEventStatus* aEventStatus) MOZ_OVERRIDE;
virtual nsresult GetContentForEvent(mozilla::WidgetEvent* aEvent,
- nsIContent** aContent) MOZ_OVERRIDE;
+ nsIContent** aContent) MOZ_OVERRIDE;
virtual nsresult GetCursor(const nsPoint& aPoint,
- nsIFrame::Cursor& aCursor) MOZ_OVERRIDE;
+ nsIFrame::Cursor& aCursor) MOZ_OVERRIDE;
- virtual nsresult GetPointFromOffset(int32_t inOffset,
- nsPoint* outPoint) MOZ_OVERRIDE;
+ virtual nsresult GetPointFromOffset(int32_t inOffset,
+ nsPoint* outPoint) MOZ_OVERRIDE;
- virtual nsresult GetChildFrameContainingOffset(int32_t inContentOffset,
- bool inHint,
- int32_t* outFrameContentOffset,
- nsIFrame* *outChildFrame) MOZ_OVERRIDE;
+ virtual nsresult GetChildFrameContainingOffset(int32_t inContentOffset,
+ bool inHint,
+ int32_t* outFrameContentOffset,
+ nsIFrame** outChildFrame) MOZ_OVERRIDE;
static nsresult GetNextPrevLineFromeBlockFrame(nsPresContext* aPresContext,
nsPeekOffsetStruct *aPos,
nsIFrame *aBlockFrame,
int32_t aLineStart,
int8_t aOutSideLimit
);
virtual nsresult CharacterDataChanged(CharacterDataChangeInfo* aInfo) MOZ_OVERRIDE;
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
- nsIAtom* aAttribute,
- int32_t aModType) MOZ_OVERRIDE;
+ nsIAtom* aAttribute,
+ int32_t aModType) MOZ_OVERRIDE;
virtual nsSplittableType GetSplittableType() const MOZ_OVERRIDE;
virtual nsIFrame* GetPrevContinuation() const MOZ_OVERRIDE;
virtual void SetPrevContinuation(nsIFrame*) MOZ_OVERRIDE;
virtual nsIFrame* GetNextContinuation() const MOZ_OVERRIDE;
virtual void SetNextContinuation(nsIFrame*) MOZ_OVERRIDE;
virtual nsIFrame* GetPrevInFlowVirtual() const MOZ_OVERRIDE;
virtual void SetPrevInFlow(nsIFrame*) MOZ_OVERRIDE;
virtual nsIFrame* GetNextInFlowVirtual() const MOZ_OVERRIDE;
@@ -313,23 +313,23 @@ public:
* them), whereas a change in its height might not.
* (nsHTMLReflowState::ShouldReflowAllKids may be helpful in deciding whether
* to reflow all the children, but for some frame types it might result in
* over-reflow.)
*
* Note: if it's only the overflow rect(s) of a frame that need to be
* updated, then UpdateOverflow should be called instead of Reflow.
*/
- virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ virtual nsresult Reflow(nsPresContext* aPresContext,
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual nsresult DidReflow(nsPresContext* aPresContext,
- const nsHTMLReflowState* aReflowState,
- nsDidReflowStatus aStatus) MOZ_OVERRIDE;
+ const nsHTMLReflowState* aReflowState,
+ nsDidReflowStatus aStatus) MOZ_OVERRIDE;
/**
* NOTE: aStatus is assumed to be already-initialized. The reflow statuses of
* any reflowed absolute children will be merged into aStatus; aside from
* that, this method won't modify aStatus.
*/
void ReflowAbsoluteFrames(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
@@ -670,17 +670,17 @@ public:
* Called to dump out regression data that describes the layout
* of the frame and its children, and so on. The format of the
* data is dictated to be XML (using a specific DTD); the
* specific kind of data dumped is up to the frame itself, with
* the caveat that some base types are defined.
* For more information, see XXX.
*/
virtual nsresult DumpRegressionData(nsPresContext* aPresContext,
- FILE* out, int32_t aIndent) MOZ_OVERRIDE;
+ FILE* out, int32_t aIndent) MOZ_OVERRIDE;
/**
* See if style tree verification is enabled. To enable style tree
* verification add "styleverifytree:1" to your NSPR_LOG_MODULES
* environment variable (any non-zero debug level will work). Or,
* call SetVerifyStyleTreeEnable with true.
*/
static bool GetVerifyStyleTreeEnable();
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -82,30 +82,30 @@ class nsHTMLFramesetBorderFrame : public
public:
NS_DECL_FRAMEARENA_HELPERS
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const;
#endif
virtual nsresult HandleEvent(nsPresContext* aPresContext,
- WidgetGUIEvent* aEvent,
- nsEventStatus* aEventStatus);
+ WidgetGUIEvent* aEvent,
+ nsEventStatus* aEventStatus);
virtual nsresult GetCursor(const nsPoint& aPoint,
- nsIFrame::Cursor& aCursor);
+ nsIFrame::Cursor& aCursor);
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus);
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus);
bool GetVisibility() { return mVisibility || mVisibilityOverride; }
void SetVisibility(bool aVisibility);
void SetColor(nscolor aColor);
void PaintBorder(nsRenderingContext& aRenderingContext, nsPoint aPt);
protected:
@@ -143,19 +143,19 @@ public:
}
#endif
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus);
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus);
protected:
nsHTMLFramesetBlankFrame(nsStyleContext* aContext) : nsLeafFrame(aContext) {}
virtual ~nsHTMLFramesetBlankFrame();
virtual nscoord GetIntrinsicWidth();
virtual nscoord GetIntrinsicHeight();
friend class nsHTMLFramesetFrame;
--- a/layout/generic/nsFrameSetFrame.h
+++ b/layout/generic/nsFrameSetFrame.h
@@ -72,41 +72,41 @@ public:
virtual ~nsHTMLFramesetFrame();
virtual void Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
virtual nsresult SetInitialChildList(ChildListID aListID,
- nsFrameList& aChildList) MOZ_OVERRIDE;
+ nsFrameList& aChildList) MOZ_OVERRIDE;
static bool gDragInProgress;
void GetSizeOfChild(nsIFrame* aChild, nsSize& aSize);
void GetSizeOfChildAt(int32_t aIndexInParent,
nsSize& aSize,
nsIntPoint& aCellIndex);
virtual nsresult HandleEvent(nsPresContext* aPresContext,
- mozilla::WidgetGUIEvent* aEvent,
- nsEventStatus* aEventStatus) MOZ_OVERRIDE;
+ mozilla::WidgetGUIEvent* aEvent,
+ nsEventStatus* aEventStatus) MOZ_OVERRIDE;
virtual nsresult GetCursor(const nsPoint& aPoint,
- nsIFrame::Cursor& aCursor) MOZ_OVERRIDE;
+ nsIFrame::Cursor& aCursor) MOZ_OVERRIDE;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
- virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ virtual nsresult Reflow(nsPresContext* aPresContext,
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
#endif
virtual bool IsLeaf() const MOZ_OVERRIDE;
--- a/layout/generic/nsGfxScrollFrame.h
+++ b/layout/generic/nsGfxScrollFrame.h
@@ -441,17 +441,17 @@ public:
friend nsIFrame* NS_NewHTMLScrollFrame(nsIPresShell* aPresShell, nsStyleContext* aContext, bool aIsRoot);
NS_DECL_QUERYFRAME
NS_DECL_FRAMEARENA_HELPERS
// Called to set the child frames. We typically have three: the scroll area,
// the vertical scrollbar, and the horizontal scrollbar.
virtual nsresult SetInitialChildList(ChildListID aListID,
- nsFrameList& aChildList) MOZ_OVERRIDE;
+ nsFrameList& aChildList) MOZ_OVERRIDE;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE {
mHelper.BuildDisplayList(aBuilder, aDirtyRect, aLists);
}
bool TryLayout(ScrollReflowState* aState,
@@ -474,38 +474,38 @@ public:
return mHelper.GetBorderRadii(aRadii);
}
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
virtual nsresult GetPadding(nsMargin& aPadding) MOZ_OVERRIDE;
virtual bool IsCollapsed() MOZ_OVERRIDE;
- virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ virtual nsresult Reflow(nsPresContext* aPresContext,
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual bool UpdateOverflow() MOZ_OVERRIDE {
return mHelper.UpdateOverflow();
}
// Because there can be only one child frame, these two function return
// NS_ERROR_FAILURE
virtual nsresult AppendFrames(ChildListID aListID,
- nsFrameList& aFrameList) MOZ_OVERRIDE;
+ nsFrameList& aFrameList) MOZ_OVERRIDE;
virtual nsresult InsertFrames(ChildListID aListID,
- nsIFrame* aPrevFrame,
- nsFrameList& aFrameList) MOZ_OVERRIDE;
+ nsIFrame* aPrevFrame,
+ nsFrameList& aFrameList) MOZ_OVERRIDE;
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
virtual nsresult RemoveFrame(ChildListID aListID,
- nsIFrame* aOldFrame) MOZ_OVERRIDE;
+ nsIFrame* aOldFrame) MOZ_OVERRIDE;
virtual nsIScrollableFrame* GetScrollTargetFrame() MOZ_OVERRIDE {
return this;
}
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
return mHelper.GetScrolledFrame()->GetContentInsertionFrame();
}
@@ -738,17 +738,17 @@ public:
NS_DECL_FRAMEARENA_HELPERS
friend nsIFrame* NS_NewXULScrollFrame(nsIPresShell* aPresShell, nsStyleContext* aContext,
bool aIsRoot, bool aClipAllDescendants);
// Called to set the child frames. We typically have three: the scroll area,
// the vertical scrollbar, and the horizontal scrollbar.
virtual nsresult SetInitialChildList(ChildListID aListID,
- nsFrameList& aChildList) MOZ_OVERRIDE;
+ nsFrameList& aChildList) MOZ_OVERRIDE;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE {
mHelper.BuildDisplayList(aBuilder, aDirtyRect, aLists);
}
// XXXldb Is this actually used?
@@ -758,25 +758,25 @@ public:
virtual bool UpdateOverflow() MOZ_OVERRIDE {
return mHelper.UpdateOverflow();
}
// Because there can be only one child frame, these two function return
// NS_ERROR_FAILURE
virtual nsresult AppendFrames(ChildListID aListID,
- nsFrameList& aFrameList) MOZ_OVERRIDE;
+ nsFrameList& aFrameList) MOZ_OVERRIDE;
virtual nsresult InsertFrames(ChildListID aListID,
- nsIFrame* aPrevFrame,
- nsFrameList& aFrameList) MOZ_OVERRIDE;
+ nsIFrame* aPrevFrame,
+ nsFrameList& aFrameList) MOZ_OVERRIDE;
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
virtual nsresult RemoveFrame(ChildListID aListID,
- nsIFrame* aOldFrame) MOZ_OVERRIDE;
+ nsIFrame* aOldFrame) MOZ_OVERRIDE;
virtual nsIScrollableFrame* GetScrollTargetFrame() MOZ_OVERRIDE {
return this;
}
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
return mHelper.GetScrolledFrame()->GetContentInsertionFrame();
}
--- a/layout/generic/nsHTMLCanvasFrame.h
+++ b/layout/generic/nsHTMLCanvasFrame.h
@@ -58,20 +58,20 @@ public:
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
virtual nsSize GetIntrinsicRatio() MOZ_OVERRIDE;
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
nsSize aCBSize, nscoord aAvailableWidth,
nsSize aMargin, nsSize aBorder, nsSize aPadding,
uint32_t aFlags) MOZ_OVERRIDE;
- virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ virtual nsresult Reflow(nsPresContext* aPresContext,
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
nsRect GetInnerArea() const;
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
#endif
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -479,17 +479,17 @@ public:
* NS_ERROR_UNEXPECTED if the frame is an atomic frame or if the
* initial list of frames has already been set for that child list,
* NS_OK otherwise. In this case, SetInitialChildList empties out
* aChildList in the process of moving the frames over to its own
* child list.
* @see #Init()
*/
virtual nsresult SetInitialChildList(ChildListID aListID,
- nsFrameList& aChildList) = 0;
+ nsFrameList& aChildList) = 0;
/**
* This method is responsible for appending frames to the frame
* list. The implementation should append the frames to the specified
* child list and then generate a reflow command.
*
* @param aListID the child list identifier.
* @param aFrameList list of child frames to append. Each of the frames has
@@ -497,17 +497,17 @@ public:
* @return NS_ERROR_INVALID_ARG if there is no child list with the specified
* name,
* NS_ERROR_UNEXPECTED if the frame is an atomic frame,
* NS_OK otherwise. In this case, AppendFrames empties out
* aFrameList in the process of moving the frames over to its own
* child list.
*/
virtual nsresult AppendFrames(ChildListID aListID,
- nsFrameList& aFrameList) = 0;
+ nsFrameList& aFrameList) = 0;
/**
* This method is responsible for inserting frames into the frame
* list. The implementation should insert the new frames into the specified
* child list and then generate a reflow command.
*
* @param aListID the child list identifier.
* @param aPrevFrame the frame to insert frames <b>after</b>
@@ -516,18 +516,18 @@ public:
* @return NS_ERROR_INVALID_ARG if there is no child list with the specified
* name,
* NS_ERROR_UNEXPECTED if the frame is an atomic frame,
* NS_OK otherwise. In this case, InsertFrames empties out
* aFrameList in the process of moving the frames over to its own
* child list.
*/
virtual nsresult InsertFrames(ChildListID aListID,
- nsIFrame* aPrevFrame,
- nsFrameList& aFrameList) = 0;
+ nsIFrame* aPrevFrame,
+ nsFrameList& aFrameList) = 0;
/**
* This method is responsible for removing a frame in the frame
* list. The implementation should do something with the removed frame
* and then generate a reflow command. The implementation is responsible
* for destroying aOldFrame (the caller mustn't destroy aOldFrame).
*
* @param aListID the child list identifier.
@@ -535,17 +535,17 @@ public:
* @return NS_ERROR_INVALID_ARG if there is no child list with the specified
* name,
* NS_ERROR_FAILURE if the child frame is not in the specified
* child list,
* NS_ERROR_UNEXPECTED if the frame is an atomic frame,
* NS_OK otherwise
*/
virtual nsresult RemoveFrame(ChildListID aListID,
- nsIFrame* aOldFrame) = 0;
+ nsIFrame* aOldFrame) = 0;
/**
* Get the content object associated with this frame. Does not add a reference.
*/
nsIContent* GetContent() const { return mContent; }
/**
* Get the frame that should be the parent for the frames of child elements
@@ -1202,21 +1202,21 @@ public:
* XXX From a frame's perspective it's unclear what the effect of the event status
* is. Does it cause the event to continue propagating through the frame hierarchy
* or is it just returned to the widgets?
*
* @see WidgetGUIEvent
* @see nsEventStatus
*/
virtual nsresult HandleEvent(nsPresContext* aPresContext,
- mozilla::WidgetGUIEvent* aEvent,
- nsEventStatus* aEventStatus) = 0;
+ mozilla::WidgetGUIEvent* aEvent,
+ nsEventStatus* aEventStatus) = 0;
virtual nsresult GetContentForEvent(mozilla::WidgetEvent* aEvent,
- nsIContent** aContent) = 0;
+ nsIContent** aContent) = 0;
// This structure keeps track of the content node and offsets associated with
// a point; there is a primary and a secondary offset associated with any
// point. The primary and secondary offsets differ when the point is over a
// non-text object. The primary offset is the expected position of the
// cursor calculated from a point; the secondary offset, when it is different,
// indicates that the point is in the boundaries of some selectable object.
// Note that the primary offset can be after the secondary offset; for places
@@ -1274,38 +1274,38 @@ public:
int32_t mCursor;
bool mHaveHotspot;
float mHotspotX, mHotspotY;
};
/**
* Get the cursor for a given frame.
*/
virtual nsresult GetCursor(const nsPoint& aPoint,
- Cursor& aCursor) = 0;
+ Cursor& aCursor) = 0;
/**
* Get a point (in the frame's coordinate space) given an offset into
* the content. This point should be on the baseline of text with
* the correct horizontal offset
*/
virtual nsresult GetPointFromOffset(int32_t inOffset,
- nsPoint* outPoint) = 0;
+ nsPoint* outPoint) = 0;
/**
* Get the child frame of this frame which contains the given
* content offset. outChildFrame may be this frame, or nullptr on return.
* outContentOffset returns the content offset relative to the start
* of the returned node. You can also pass a hint which tells the method
* to stick to the end of the first found frame or the beginning of the
* next in case the offset falls on a boundary.
*/
- virtual nsresult GetChildFrameContainingOffset(int32_t inContentOffset,
- bool inHint,//false stick left
- int32_t* outFrameContentOffset,
- nsIFrame* *outChildFrame) = 0;
+ virtual nsresult GetChildFrameContainingOffset(int32_t inContentOffset,
+ bool inHint,//false stick left
+ int32_t* outFrameContentOffset,
+ nsIFrame** outChildFrame) = 0;
/**
* Get the current frame-state value for this frame. aResult is
* filled in with the state bits.
*/
nsFrameState GetStateBits() const { return mState; }
/**
@@ -1337,18 +1337,18 @@ public:
* with the change by doing whatever is appropriate.
*
* @param aNameSpaceID the namespace of the attribute
* @param aAttribute the atom name of the attribute
* @param aModType Whether or not the attribute was added, changed, or removed.
* The constants are defined in nsIDOMMutationEvent.h.
*/
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
- nsIAtom* aAttribute,
- int32_t aModType) = 0;
+ nsIAtom* aAttribute,
+ int32_t aModType) = 0;
/**
* When the content states of a content object change, this method is invoked
* on the primary frame of that content object.
*
* @param aStates the changed states
*/
virtual void ContentStatesChanged(nsEventStates aStates) { }
@@ -1739,19 +1739,19 @@ public:
* still must return an accurate desired size. If you're a container
* you must <b>always</b> reflow at least one frame regardless of the
* available space
*
* @param aStatus a return value indicating whether the frame is complete
* and whether the next-in-flow is dirty and needs to be reflowed
*/
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aReflowMetrics,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) = 0;
+ nsHTMLReflowMetrics& aReflowMetrics,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) = 0;
/**
* Post-reflow hook. After a frame is reflowed this method will be called
* informing the frame that this reflow process is complete, and telling the
* frame the status returned by the Reflow member function.
*
* This call may be invoked many times, while NS_FRAME_IN_REFLOW is set, before
* it is finally called once with a NS_FRAME_REFLOW_COMPLETE value. When called
@@ -1759,18 +1759,18 @@ public:
* frame state will be cleared.
*
* XXX This doesn't make sense. If the frame is reflowed but not complete, then
* the status should be NS_FRAME_NOT_COMPLETE and not NS_FRAME_COMPLETE
* XXX Don't we want the semantics to dictate that we only call this once for
* a given reflow?
*/
virtual nsresult DidReflow(nsPresContext* aPresContext,
- const nsHTMLReflowState* aReflowState,
- nsDidReflowStatus aStatus) = 0;
+ const nsHTMLReflowState* aReflowState,
+ nsDidReflowStatus aStatus) = 0;
// XXX Maybe these three should be a separate interface?
/**
* Updates the overflow areas of the frame. This can be called if an
* overflow area of the frame's children has changed without reflowing.
* @return true if either of the overflow areas for this frame have changed.
*/
@@ -3079,17 +3079,17 @@ public:
virtual nsresult GetFrameName(nsAString& aResult) const = 0;
#endif
#ifdef DEBUG
public:
virtual nsFrameState GetDebugStateBits() const = 0;
virtual nsresult DumpRegressionData(nsPresContext* aPresContext,
- FILE* out, int32_t aIndent) = 0;
+ FILE* out, int32_t aIndent) = 0;
#endif
};
//----------------------------------------------------------------------
/**
* nsWeakFrame can be used to keep a reference to a nsIFrame in a safe way.
* Whenever an nsIFrame object is deleted, the nsWeakFrames pointing
--- a/layout/generic/nsImageFrame.h
+++ b/layout/generic/nsImageFrame.h
@@ -77,30 +77,30 @@ public:
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
virtual mozilla::IntrinsicSize GetIntrinsicSize();
virtual nsSize GetIntrinsicRatio();
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus);
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus);
virtual nsresult GetContentForEvent(mozilla::WidgetEvent* aEvent,
- nsIContent** aContent);
+ nsIContent** aContent);
virtual nsresult HandleEvent(nsPresContext* aPresContext,
- mozilla::WidgetGUIEvent* aEvent,
- nsEventStatus* aEventStatus);
+ mozilla::WidgetGUIEvent* aEvent,
+ nsEventStatus* aEventStatus);
virtual nsresult GetCursor(const nsPoint& aPoint,
- nsIFrame::Cursor& aCursor);
+ nsIFrame::Cursor& aCursor);
virtual nsresult AttributeChanged(int32_t aNameSpaceID,
- nsIAtom* aAttribute,
- int32_t aModType);
+ nsIAtom* aAttribute,
+ int32_t aModType);
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() MOZ_OVERRIDE;
#endif
virtual nsIAtom* GetType() const;
virtual bool IsFrameOfType(uint32_t aFlags) const
--- a/layout/generic/nsInlineFrame.h
+++ b/layout/generic/nsInlineFrame.h
@@ -68,19 +68,19 @@ public:
virtual void AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
InlinePrefWidthData *aData) MOZ_OVERRIDE;
virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
nsSize aCBSize, nscoord aAvailableWidth,
nsSize aMargin, nsSize aBorder, nsSize aPadding,
uint32_t aFlags) MOZ_OVERRIDE;
virtual nsRect ComputeTightBounds(gfxContext* aContext) const MOZ_OVERRIDE;
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual bool CanContinueTextRun() const MOZ_OVERRIDE;
virtual void PullOverflowsFromPrevInFlow() MOZ_OVERRIDE;
virtual nscoord GetBaseline() const MOZ_OVERRIDE;
virtual bool DrainSelfOverflowList() MOZ_OVERRIDE;
/**
@@ -189,19 +189,19 @@ public:
friend nsIFrame* NS_NewFirstLineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
#endif
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual void Init(nsIContent* aContent, nsIFrame* aParent,
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
virtual void PullOverflowsFromPrevInFlow() MOZ_OVERRIDE;
virtual bool DrainSelfOverflowList() MOZ_OVERRIDE;
protected:
nsFirstLineFrame(nsStyleContext* aContext) : nsInlineFrame(aContext) {}
--- a/layout/generic/nsLeafFrame.h
+++ b/layout/generic/nsLeafFrame.h
@@ -47,27 +47,27 @@ public:
/**
* Reflow our frame. This will use the computed width plus borderpadding for
* the desired width, and use the return value of GetIntrinsicHeight plus
* borderpadding for the desired height. Ascent will be set to the height,
* and descent will be set to 0.
*/
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
/**
* This method does most of the work that Reflow() above need done.
*/
virtual nsresult DoReflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus);
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus);
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
{
// We don't actually contain a block, but we do always want a
// computed width, so tell a little white lie here.
return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplacedContainsBlock));
}
--- a/layout/generic/nsObjectFrame.h
+++ b/layout/generic/nsObjectFrame.h
@@ -54,29 +54,29 @@ public:
NS_DECL_QUERYFRAME_TARGET(nsObjectFrame)
virtual void Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aReflowState,
- nsReflowStatus& aStatus);
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aReflowState,
+ nsReflowStatus& aStatus);
virtual nsresult DidReflow(nsPresContext* aPresContext,
- const nsHTMLReflowState* aReflowState,
- nsDidReflowStatus aStatus);
+ const nsHTMLReflowState* aReflowState,
+ nsDidReflowStatus aStatus);
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
virtual nsresult HandleEvent(nsPresContext* aPresContext,
- mozilla::WidgetGUIEvent* aEvent,
- nsEventStatus* aEventStatus);
+ mozilla::WidgetGUIEvent* aEvent,
+ nsEventStatus* aEventStatus);
virtual nsIAtom* GetType() const;
virtual bool IsFrameOfType(uint32_t aFlags) const
{
return nsObjectFrameSuper::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced));
}
--- a/layout/generic/nsPageContentFrame.cpp
+++ b/layout/generic/nsPageContentFrame.cpp
@@ -2,17 +2,17 @@
/* 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 "nsPageContentFrame.h"
#include "nsCSSFrameConstructor.h"
#include "nsPresContext.h"
#include "nsGkAtoms.h"
#include "nsIPresShell.h"
-#include "nsSimplePageSequence.h"
+#include "nsSimplePageSequenceFrame.h"
nsIFrame*
NS_NewPageContentFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
return new (aPresShell) nsPageContentFrame(aContext);
}
NS_IMPL_FRAMEARENA_HELPERS(nsPageContentFrame)
--- a/layout/generic/nsPageContentFrame.h
+++ b/layout/generic/nsPageContentFrame.h
@@ -16,19 +16,19 @@ class nsPageContentFrame : public Viewpo
public:
NS_DECL_FRAMEARENA_HELPERS
friend nsIFrame* NS_NewPageContentFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
friend class nsPageFrame;
// nsIFrame
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aMaxSize,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+ nsHTMLReflowMetrics& aDesiredSize,
+ const nsHTMLReflowState& aMaxSize,
+ nsReflowStatus& aStatus) MOZ_OVERRIDE;
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
{
return ViewportFrame::IsFrameOfType(aFlags &
~(nsIFrame::eCanContainOverflowContainers));
}
virtual void SetSharedPageData(nsSharedPageData* aPD) { mPD = aPD; }
--- a/layout/generic/nsPageFrame.cpp
+++ b/layout/generic/nsPageFrame.cpp
@@ -6,17 +6,17 @@
#include "nsPageFrame.h"
#include "nsPresContext.h"
#include "nsRenderingContext.h"
#include "nsGkAtoms.h"
#include "nsIPresShell.h"
#include "nsPageContentFrame.h"
#include "nsDisplayList.h"
#include "nsLayoutUtils.h" // for function BinarySearchForPosition
-#include "nsSimplePageSequence.h" // for nsSharedPageData
+#include "nsSimplePageSequenceFrame.h" // for nsSharedPageData
#include "nsTextFormatter.h" // for page number localization formatting
#ifdef IBMBIDI
#include "nsBidiUtils.h"
#endif
#include "nsIPrintSettings.h"
#include "prlog.h"
#ifdef PR_LOGGING
--- a/layout/generic/nsPageFrame.h
+++ b/layout/generic/nsPageFrame.h
@@ -15,19 +15,19 @@ class nsSharedPageData;
class nsPageFrame : public nsContainerFrame {
public:
NS_DECL_FRAMEARENA_HELPERS
friend nsIFrame* NS_NewPageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
virtual nsresult Reflow(nsPresContext* aPresContext,
- nsHTMLReflowMetrics& aDesiredSize,
- const nsHTMLReflowState& aMaxSize,
- nsReflowStatus& aStatus) MOZ_OVERRIDE;
+