Merge m-c to f-t

This commit is contained in:
Phil Ringnalda 2014-03-22 17:48:30 -07:00
commit 6b1d7eec4c
156 changed files with 4173 additions and 2968 deletions

View File

@ -187,7 +187,8 @@ pref("privacy.item.syncAccount", true);
// base url for the wifi geolocation network provider
pref("geo.provider.use_mls", false);
pref("geo.wifi.uri", "https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%");
pref("geo.cell.scan", true);
pref("geo.wifi.uri", "https://location.services.mozilla.com/v1/geolocate?key=%MOZ_MOZILLA_API_KEY%");
// enable geo
pref("geo.enabled", true);

View File

@ -34,11 +34,6 @@ var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptS
let permissionSpecificChecker = {};
XPCOMUtils.defineLazyServiceGetter(this,
"PermSettings",
"@mozilla.org/permissionSettings;1",
"nsIDOMPermissionSettings");
XPCOMUtils.defineLazyServiceGetter(this,
"AudioManager",
"@mozilla.org/telephony/audiomanager;1",

View File

@ -1369,6 +1369,11 @@ pref("dom.debug.propagate_gesture_events_through_content", false);
// The request URL of the GeoLocation backend.
pref("geo.wifi.uri", "https://www.googleapis.com/geolocation/v1/geolocate?key=%GOOGLE_API_KEY%");
#ifdef RELEASE_BUILD
pref("geo.wifi.logging.enabled", false);
#else
pref("geo.wifi.logging.enabled", true);
#endif
// Necko IPC security checks only needed for app isolation for cookies/cache/etc:
// currently irrelevant for desktop e10s

View File

@ -22,6 +22,9 @@ export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/Lib/win8/um/x86:${_VSPAT
## paths: win8 sdk x86 (32-bit) tools, msvc 10 (32-bit) build toolchain, moz tools ##
export PATH="/c/Program Files (x86)/Windows Kits/8.0/bin/x86:${_VSPATH}/Common7/IDE:${_VSPATH}/VC/BIN:${_VSPATH}/Common7/Tools:${_VSPATH}/VC/VCPackages:/c/mozilla-build/moztools:${PATH}"
## WindowsSDKDir ##
export WINDOWSSDKDIR="/c/Program Files (x86)/Windows Kits/8.0/"
. $topsrcdir/build/mozconfig.vs2010-common
mk_export_correct_style LIB

View File

@ -19,6 +19,9 @@ export LIB=/c/Program\ Files\ \(x86\)/Windows\ Kits/8.0/Lib/win8/um/x64:${_VSPAT
## paths: win8 sdk x64 (64-bit) tools, msvc 10 (64-bit) build toolchain, moz tools ##
export PATH="/c/Program Files (x86)/Windows Kits/8.0/bin/x64:${_VSPATH}/Common7/IDE:${_VSPATH}/VC/BIN/amd64:${_VSPATH}/VC/BIN/x86_amd64:${_VSPATH}/VC/BIN:${_VSPATH}/Common7/Tools:${_VSPATH}/VC/VCPackages:${PATH}"
## WindowsSDKDir ##
export WINDOWSSDKDIR="/c/Program Files (x86)/Windows Kits/8.0/"
# Use 32bit linker for PGO crash bug.
# https://connect.microsoft.com/VisualStudio/feedback/details/686117/
if [ -f /c/PROGRA~2/MICROS~2.0/VC/BIN/x86_amd64/link.exe ]; then

View File

@ -903,7 +903,6 @@ LOCAL_INCLUDES += \
ifeq (WINNT,$(OS_TARGET))
# These get set via VC project file settings for normal GYP builds.
DEFINES += -DUNICODE -D_UNICODE
LOCAL_INCLUDES += -I'$(MOZ_DIRECTX_SDK_PATH)/include'
endif
DISABLE_STL_WRAPPING := 1

View File

@ -5770,10 +5770,12 @@ dnl = * only applies to win32
dnl = * enabled by default (shipping build); requires explicit --disable to disable
dnl ========================================================
MOZ_ANGLE_RENDERER=
MOZ_DIRECTX_SDK_PATH=
MOZ_DIRECTX_SDK_CPU_SUFFIX=
MOZ_D3DCOMPILER_CAB=
MOZ_DIRECTX_SDK_PATH=
MOZ_D3DCOMPILER_DLL=
MOZ_HAS_WINSDK_WITH_D3D=
MOZ_D3DCOMPILER_DLL_PATH=
MOZ_D3DCOMPILER_CAB=
case "$target_os" in
*mingw*)
MOZ_ANGLE_RENDERER=1
@ -5795,6 +5797,11 @@ MOZ_ARG_DISABLE_BOOL(webgl,
MOZ_WEBGL_DISABLED=1,
MOZ_WEBGL_DISABLED=)
MOZ_ARG_ENABLE_BOOL(winsdk-directx,
[ --enable-winsdk-directx use DirectX SDK in Windows SDK],
MOZ_WINSDK_DIRECTX=1,
MOZ_WINSDK_DIRECTX=)
if test -n "$MOZ_WEBGL_DISABLED"; then
MOZ_WEBGL=
MOZ_ANGLE_RENDERER=
@ -5808,6 +5815,7 @@ if test -n "$MOZ_WEBGL_CONFORMANT"; then
AC_DEFINE(MOZ_WEBGL_CONFORMANT)
fi
# Locate a DirectX SDK here so we can use it for both ANGLE and
# Joystick support.
if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then
@ -5819,37 +5827,95 @@ if test "$OS_TARGET" = "WINNT" -a -z "$CROSS_COMPILE"; then
MOZ_DIRECTX_SDK_REG_KEY=`reg query 'HKLM\Software\Microsoft\DirectX' //s | grep 'Microsoft DirectX SDK' | head -n 1`
fi
MOZ_DIRECTX_SDK_PATH=`reg query "$MOZ_DIRECTX_SDK_REG_KEY" //v InstallPath | grep REG_SZ | sed 's/.*\([[a-zA-Z]]\)\\:\\\\/\\1\\:\\\\/' | sed 's,\\\\,/,g'`
fi
if test -n "$MOZ_ANGLE_RENDERER" -a -z "$CROSS_COMPILE"; then
if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
AC_MSG_ERROR([Found the February 2010 DirectX SDK. Need the June 2010 DirectX SDK, or newer. Upgrade your SDK or reconfigure with --disable-webgl.])
fi
if test -n "$MOZ_DIRECTX_SDK_PATH" &&
test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
AC_MSG_RESULT([Found DirectX SDK via registry, using $MOZ_DIRECTX_SDK_PATH])
else
AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for WebGL. Either install it (June 2010 version or newer), or reconfigure with --disable-webgl.])
AC_MSG_RESULT([Couldn't find the DirectX SDK.])
fi
# Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'`
if test -z "$MOZ_D3DX9_VERSION" ; then
AC_MSG_ERROR([Couldn't determine the D3DX9 version, needed for WebGL. Either reinstall the DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
fi
MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
if test -z "$MOZ_D3DCOMPILER_CAB"; then
AC_MSG_ERROR([Couldn't find the DirectX redistributable files. Either reinstall the DirectX SDK (making sure the "DirectX Redistributable Files" option is selected), or reconfigure with --disable-webgl.])
fi
MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
fi
dnl ========================================================
dnl D3D compiler DLL
dnl ========================================================
if test -n "$MOZ_ANGLE_RENDERER"; then
# Check that our DirectX SDK is acceptable.
if test -n "$MOZ_DIRECTX_SDK_PATH"; then
if test -n "`echo $MOZ_DIRECTX_SDK_REG_KEY | grep 'February 2010'`" ; then
AC_MSG_RESULT([Found the February 2010 DirectX SDK, which is unacceptable to ANGLE.])
MOZ_DIRECTX_SDK_PATH_BAD=1
fi
if test -n "$MOZ_DIRECTX_SDK_PATH" &&
test -f "$MOZ_DIRECTX_SDK_PATH"/include/d3dx9.h &&
test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
AC_MSG_RESULT([Found acceptable DirectX SDK for ANGLE.])
else
AC_MSG_RESULT([Found DirectX SDK is unacceptable for ANGLE.])
MOZ_DIRECTX_SDK_PATH_BAD=1
fi
fi
if test -n "$MOZ_DIRECTX_SDK_PATH_BAD"; then
AC_MSG_ERROR([Couldn't find an acceptable DirectX SDK for ANGLE. Either install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
fi
# Find a D3D compiler DLL in a Windows SDK.
MOZ_D3DCOMPILER_DLL=
if test -n "$MOZ_WINSDK_DIRECTX"; then
case "$MOZ_WINSDK_MAXVER" in
0x0603*)
MOZ_D3DCOMPILER_DLL=d3dcompiler_47.dll
AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.1.])
;;
0x0602*)
MOZ_D3DCOMPILER_DLL=d3dcompiler_46.dll
AC_MSG_RESULT([Found D3D compiler in Windows SDK 8.0.])
;;
esac
fi
if test -n "$MOZ_D3DCOMPILER_DLL"; then
# We have a name, now track down the path.
if test -n "$WINDOWSSDKDIR"; then
MOZ_D3DCOMPILER_DLL_PATH="$WINDOWSSDKDIR/Redist/D3D/$MOZ_DIRECTX_SDK_CPU_SUFFIX/$MOZ_D3DCOMPILER_DLL"
if test -f "$MOZ_D3DCOMPILER_DLL_PATH"; then
MOZ_HAS_WINSDK_WITH_D3D=1
AC_MSG_RESULT([Found MOZ_D3DCOMPILER_DLL_PATH: $MOZ_D3DCOMPILER_DLL_PATH])
else
AC_MSG_RESULT([MOZ_D3DCOMPILER_DLL_PATH doesn't exist: $MOZ_D3DCOMPILER_DLL_PATH])
fi
else
AC_MSG_RESULT([WINDOWSSDKDIR is missing.])
fi
fi
# Find a D3D compiler DLL in the DirectX SDK, if we didn't find one already.
# Get the SDK numeric version (e.g. 43) by looking at the dependencies of d3dx9.lib
if test -z "$MOZ_HAS_WINSDK_WITH_D3D"; then
MOZ_D3DX9_VERSION=`dumpbin //headers "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/d3dx9.lib | egrep d3dx9_[[0-9]][[0-9]]\.dll | head -n1 | sed 's/.*\([[0-9]][[0-9]]\).*/\\1/g'`
if test -n "$MOZ_D3DX9_VERSION" ; then
MOZ_D3DCOMPILER_CAB=`find "$MOZ_DIRECTX_SDK_PATH"/Redist -name *D3DCompiler_${MOZ_D3DX9_VERSION}_${MOZ_DIRECTX_SDK_CPU_SUFFIX}.cab | head -n1`
MOZ_D3DCOMPILER_DLL=D3DCompiler_$MOZ_D3DX9_VERSION.dll
else
AC_MSG_RESULT([Couldn't determine the D3DX9 version for the DirectX SDK.])
fi
if test -z "$MOZ_D3DCOMPILER_CAB"; then
AC_MSG_RESULT([Couldn't find a CAB containing the D3D compiler DLL.])
fi
fi
if test -z "$MOZ_D3DCOMPILER_DLL_PATH" -a -z "$MOZ_D3DCOMPILER_CAB"; then
AC_MSG_ERROR([Couldn't find an acceptable D3D compiler DLL. Either install Windows SDK 8.0+ and reconfigure with --enable-winsdk-directx, install DirectX SDK (June 2010 version or newer), or reconfigure with --disable-webgl.])
fi
fi
dnl ========================================================
dnl Gamepad support
dnl ========================================================
@ -5876,12 +5942,14 @@ if test "$MOZ_GAMEPAD"; then
MOZ_GAMEPAD_BACKEND=cocoa
;;
WINNT)
if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
MOZ_GAMEPAD=
if test -z "$MOZ_HAS_WINSDK_WITH_D3D"; then
if test -n "$MOZ_DIRECTX_SDK_PATH" ; then
if ! test -f "$MOZ_DIRECTX_SDK_PATH"/lib/$MOZ_DIRECTX_SDK_CPU_SUFFIX/dxguid.lib ; then
MOZ_GAMEPAD=
fi
elif test "$GCC" != "yes"; then
MOZ_GAMEPAD=
fi
elif test "$GCC" != "yes"; then
MOZ_GAMEPAD=
fi
if test -z "$MOZ_GAMEPAD"; then
AC_MSG_ERROR([Couldn't find the DirectX SDK, needed for gamepad support. Please install it or, reconfigure with --disable-gamepad to disable gamepad support.])
@ -8388,12 +8456,15 @@ AC_SUBST(MOZ_STUB_INSTALLER)
AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
AC_SUBST(MOZ_ENABLE_SIGNMAR)
AC_SUBST(MOZ_UPDATER)
AC_SUBST(MOZ_ANGLE_RENDERER)
AC_SUBST(MOZ_DIRECTX_SDK_PATH)
AC_SUBST(MOZ_DIRECTX_SDK_CPU_SUFFIX)
AC_SUBST(MOZ_D3DX9_VERSION)
AC_SUBST(MOZ_D3DCOMPILER_CAB)
AC_SUBST(MOZ_DIRECTX_SDK_PATH)
AC_SUBST(MOZ_D3DCOMPILER_DLL)
AC_SUBST(MOZ_HAS_WINSDK_WITH_D3D)
AC_SUBST(MOZ_D3DCOMPILER_DLL_PATH)
AC_SUBST(MOZ_D3DCOMPILER_CAB)
AC_SUBST(MOZ_METRO)
AC_SUBST(MOZ_ANDROID_HISTORY)

View File

@ -1772,9 +1772,6 @@ this.CSPNonceSource = function CSPNonceSource() {
}
CSPNonceSource.fromString = function(aStr, aCSPRep) {
if (!CSPPrefObserver.experimentalEnabled)
return null;
let nonce = R_NONCESRC.exec(aStr)[1];
if (!nonce) {
cspError(aCSPRep, "Error in parsing nonce-source from string: nonce was empty");
@ -1789,8 +1786,6 @@ CSPNonceSource.fromString = function(aStr, aCSPRep) {
CSPNonceSource.prototype = {
permits: function(aContext) {
if (!CSPPrefObserver.experimentalEnabled) return false;
if (aContext instanceof Ci.nsIDOMHTMLElement) {
return this._nonce === aContext.getAttribute('nonce');
} else if (typeof aContext === 'string') {
@ -1822,9 +1817,6 @@ this.CSPHashSource = function CSPHashSource() {
}
CSPHashSource.fromString = function(aStr, aCSPRep) {
if (!CSPPrefObserver.experimentalEnabled)
return null;
let hashSrcMatch = R_HASHSRC.exec(aStr);
let algo = hashSrcMatch[1];
let hash = hashSrcMatch[2];
@ -1846,8 +1838,6 @@ CSPHashSource.fromString = function(aStr, aCSPRep) {
CSPHashSource.prototype = {
permits: function(aContext) {
if (!CSPPrefObserver.experimentalEnabled) return false;
let ScriptableUnicodeConverter =
Components.Constructor("@mozilla.org/intl/scriptableunicodeconverter",
"nsIScriptableUnicodeConverter");

View File

@ -208,9 +208,6 @@ ContentSecurityPolicy.prototype = {
},
getAllowsNonce: function(aNonce, aContentType, shouldReportViolation) {
if (!CSPPrefObserver.experimentalEnabled)
return false;
if (!(aContentType == Ci.nsIContentPolicy.TYPE_SCRIPT ||
aContentType == Ci.nsIContentPolicy.TYPE_STYLESHEET)) {
CSPdebug("Nonce check requested for an invalid content type (not script or style): " + aContentType);
@ -223,7 +220,9 @@ ContentSecurityPolicy.prototype = {
shouldReportViolation.value = this._policies.some(function(policy, i) {
// Don't report a violation if the policy didn't use nonce-source
return policy._directives[directive]._hasNonceSource && !policyAllowsNonce[i];
return policy._directives.hasOwnProperty(directive) &&
policy._directives[directive]._hasNonceSource &&
!policyAllowsNonce[i];
});
// allow it to execute? (Do all the policies allow it to execute)?
@ -233,9 +232,6 @@ ContentSecurityPolicy.prototype = {
},
getAllowsHash: function(aContent, aContentType, shouldReportViolation) {
if (!CSPPrefObserver.experimentalEnabled)
return false;
if (!(aContentType == Ci.nsIContentPolicy.TYPE_SCRIPT ||
aContentType == Ci.nsIContentPolicy.TYPE_STYLESHEET)) {
CSPdebug("Hash check requested for an invalid content type (not script or style): " + aContentType);
@ -248,7 +244,9 @@ ContentSecurityPolicy.prototype = {
shouldReportViolation.value = this._policies.some(function(policy, i) {
// Don't report a violation if the policy didn't use hash-source
return policy._directives[directive]._hasHashSource && !policyAllowsHash[i];
return policy._directives.hasOwnProperty(directive) &&
policy._directives[directive]._hasHashSource &&
!policyAllowsHash[i];
});
// allow it to execute? (Do all the policies allow it to execute)?

View File

@ -126,8 +126,7 @@ function checkInline () {
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true],
["security.csp.experimentalEnabled", true]]},
{'set':[["security.csp.speccompliant", true]]},
function() {
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.

View File

@ -113,8 +113,7 @@ window.examiner = new examiner();
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{'set':[["security.csp.speccompliant", true],
["security.csp.experimentalEnabled", true]]},
{'set':[["security.csp.speccompliant", true]]},
function() {
// save this for last so that our listeners are registered.
// ... this loads the testbed of good and bad requests.

View File

@ -89,6 +89,22 @@ VideoData::~VideoData()
MOZ_COUNT_DTOR(VideoData);
}
size_t
VideoData::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
{
size_t size = aMallocSizeOf(this);
// Currently only PLANAR_YCBCR has a well defined function for determining
// it's size, so reporting is limited to that type.
if (mImage && mImage->GetFormat() == ImageFormat::PLANAR_YCBCR) {
const mozilla::layers::PlanarYCbCrImage* img =
static_cast<const mozilla::layers::PlanarYCbCrImage*>(mImage.get());
size += img->SizeOfIncludingThis(aMallocSizeOf);
}
return size;
}
/* static */
VideoData* VideoData::ShallowCopyUpdateDuration(VideoData* aOther,
int64_t aDuration)

View File

@ -225,6 +225,8 @@ public:
~VideoData();
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
// Dimensions at which to display the video frame. The picture region
// will be scaled to this size. This is should be the picture region's
// dimensions scaled with respect to its aspect ratio.

View File

@ -1564,9 +1564,9 @@ nsresult MediaDecoder::GetBuffered(dom::TimeRanges* aBuffered) {
return NS_ERROR_FAILURE;
}
int64_t MediaDecoder::VideoQueueMemoryInUse() {
size_t MediaDecoder::SizeOfVideoQueue() {
if (mDecoderStateMachine) {
return mDecoderStateMachine->VideoQueueMemoryInUse();
return mDecoderStateMachine->SizeOfVideoQueue();
}
return 0;
}
@ -1836,7 +1836,7 @@ MediaMemoryTracker::CollectReports(nsIHandleReportCallback* aHandleReport,
DecodersArray& decoders = Decoders();
for (size_t i = 0; i < decoders.Length(); ++i) {
MediaDecoder* decoder = decoders[i];
video += decoder->VideoQueueMemoryInUse();
video += decoder->SizeOfVideoQueue();
audio += decoder->SizeOfAudioQueue();
if (decoder->GetResource()) {

View File

@ -646,7 +646,7 @@ public:
// Returns the size, in bytes, of the heap memory used by the currently
// queued decoded video and audio data.
virtual int64_t VideoQueueMemoryInUse();
size_t SizeOfVideoQueue();
size_t SizeOfAudioQueue();
VideoFrameContainer* GetVideoFrameContainer() MOZ_FINAL MOZ_OVERRIDE

View File

@ -31,18 +31,36 @@ extern PRLogModuleInfo* gMediaDecoderLog;
#define SEEK_LOG(type, msg)
#endif
void* MediaDecoderReader::VideoQueueMemoryFunctor::operator()(void* anObject) {
const VideoData* v = static_cast<const VideoData*>(anObject);
if (!v->mImage) {
class VideoQueueMemoryFunctor : public nsDequeFunctor {
public:
VideoQueueMemoryFunctor() : mSize(0) {}
MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf);
virtual void* operator()(void* aObject) {
const VideoData* v = static_cast<const VideoData*>(aObject);
mSize += v->SizeOfIncludingThis(MallocSizeOf);
return nullptr;
}
if (v->mImage->GetFormat() == ImageFormat::PLANAR_YCBCR) {
mozilla::layers::PlanarYCbCrImage* vi = static_cast<mozilla::layers::PlanarYCbCrImage*>(v->mImage.get());
mResult += vi->GetDataSize();
size_t mSize;
};
class AudioQueueMemoryFunctor : public nsDequeFunctor {
public:
AudioQueueMemoryFunctor() : mSize(0) {}
MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf);
virtual void* operator()(void* aObject) {
const AudioData* audioData = static_cast<const AudioData*>(aObject);
mSize += audioData->SizeOfIncludingThis(MallocSizeOf);
return nullptr;
}
return nullptr;
}
size_t mSize;
};
MediaDecoderReader::MediaDecoderReader(AbstractMediaDecoder* aDecoder)
: mAudioCompactor(mAudioQueue),
@ -58,6 +76,20 @@ MediaDecoderReader::~MediaDecoderReader()
MOZ_COUNT_DTOR(MediaDecoderReader);
}
size_t MediaDecoderReader::SizeOfVideoQueueInBytes() const
{
VideoQueueMemoryFunctor functor;
mVideoQueue.LockedForEach(functor);
return functor.mSize;
}
size_t MediaDecoderReader::SizeOfAudioQueueInBytes() const
{
AudioQueueMemoryFunctor functor;
mAudioQueue.LockedForEach(functor);
return functor.mSize;
}
nsresult MediaDecoderReader::ResetDecode()
{
nsresult res = NS_OK;

View File

@ -132,41 +132,13 @@ public:
virtual nsresult GetBuffered(dom::TimeRanges* aBuffered,
int64_t aStartTime);
class VideoQueueMemoryFunctor : public nsDequeFunctor {
public:
VideoQueueMemoryFunctor() : mResult(0) {}
// Returns the number of bytes of memory allocated by structures/frames in
// the video queue.
size_t SizeOfVideoQueueInBytes() const;
virtual void* operator()(void* anObject);
int64_t mResult;
};
virtual int64_t VideoQueueMemoryInUse() {
VideoQueueMemoryFunctor functor;
mVideoQueue.LockedForEach(functor);
return functor.mResult;
}
class AudioQueueMemoryFunctor : public nsDequeFunctor {
public:
AudioQueueMemoryFunctor() : mSize(0) {}
MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf);
virtual void* operator()(void* anObject) {
const AudioData* audioData = static_cast<const AudioData*>(anObject);
mSize += audioData->SizeOfIncludingThis(MallocSizeOf);
return nullptr;
}
size_t mSize;
};
size_t SizeOfAudioQueue() {
AudioQueueMemoryFunctor functor;
mAudioQueue.LockedForEach(functor);
return functor.mSize;
}
// Returns the number of bytes of memory allocated by structures/frames in
// the audio queue.
size_t SizeOfAudioQueueInBytes() const;
// Only used by WebMReader and MediaOmxReader for now, so stub here rather
// than in every reader than inherits from MediaDecoderReader.

View File

@ -266,16 +266,16 @@ public:
void SetPlaybackRate(double aPlaybackRate);
void SetPreservesPitch(bool aPreservesPitch);
int64_t VideoQueueMemoryInUse() {
size_t SizeOfVideoQueue() {
if (mReader) {
return mReader->VideoQueueMemoryInUse();
return mReader->SizeOfVideoQueueInBytes();
}
return 0;
}
size_t SizeOfAudioQueue() {
if (mReader) {
return mReader->SizeOfAudioQueue();
return mReader->SizeOfAudioQueueInBytes();
}
return 0;
}

View File

@ -13,6 +13,20 @@ using mozilla::AudioDataValue;
using mozilla::MediaDecoderReader;
using mozilla::MediaQueue;
class MemoryFunctor : public nsDequeFunctor {
public:
MemoryFunctor() : mSize(0) {}
MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf);
virtual void* operator()(void* anObject) {
const AudioData* audioData = static_cast<const AudioData*>(anObject);
mSize += audioData->SizeOfIncludingThis(MallocSizeOf);
return nullptr;
}
size_t mSize;
};
class TestCopy
{
public:
@ -60,7 +74,7 @@ static void TestAudioCompactor(size_t aBytes)
EXPECT_GT(callCount, 0U) << "copy functor never called";
EXPECT_EQ(frames, frameCount) << "incorrect number of frames copied";
MediaDecoderReader::AudioQueueMemoryFunctor memoryFunc;
MemoryFunctor memoryFunc;
queue.LockedForEach(memoryFunc);
size_t allocSize = memoryFunc.mSize - (callCount * sizeof(AudioData));
size_t slop = allocSize - aBytes;

View File

@ -10,14 +10,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500261
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=500261">Mozilla Bug 500261</a>
<p id="display"></p>
<div id="content">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="1" id="svg">
<image width="1" height="1" xlink:href="http://localhost/serverGone.gif" onerror="run()"/>
</svg>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
<![CDATA[
@ -31,6 +23,14 @@ function run()
]]>
</script>
<div id="content">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="1" id="svg">
<image width="1" height="1" xlink:href="http://localhost/serverGone.gif" onerror="run()"/>
</svg>
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -7,7 +7,6 @@
XPIDL_SOURCES += [
'nsIActivityProxy.idl',
'nsIActivityUIGlue.idl',
'nsIDOMActivityRequestHandler.idl',
]
XPIDL_MODULE = 'dom_activities'

View File

@ -1,13 +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/. */
#include "domstubs.idl"
[scriptable, uuid(e93c4df2-af49-4421-8d75-1237b51c555b)]
interface nsIDOMMozActivityRequestHandler : nsISupports
{
void postResult(in jsval result);
void postError(in DOMString error);
readonly attribute jsval source;
};

View File

@ -4,7 +4,6 @@
"use strict";
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
@ -25,30 +24,28 @@ function debug(aMsg) {
function ActivityRequestHandler() {
debug("ActivityRequestHandler");
this.wrappedJSObject = this;
// When a system message of type 'activity' is emitted, it forces the
// creation of an ActivityWrapper which in turns replace the default
// system message callback. The newly created wrapper then create a
// nsIDOMActivityRequestHandler object and fills up the properties of
// this object as well as the properties of the ActivityOptions
// dictionary contained by the request handler.
this._id = null;
this._options = null;
// system message callback. The newly created wrapper then create an
// ActivityRequestHandler object.
}
ActivityRequestHandler.prototype = {
__exposedProps__: {
source: "r",
postResult: "r",
postError: "r"
},
init: function arh_init(aWindow) {
this._window = aWindow;
},
__init: function arh___init(aId, aOptions) {
this._id = aId;
this._options = aOptions;
},
get source() {
if (this._options === null) {
Cu.reportError("ActivityRequestHandler._options must be initialized at this point");
}
return this._options;
// We need to clone this object because the this._options.data has
// the type any in WebIDL which will cause the binding layer to pass
// the value which is a COW unmodified to content.
return Cu.cloneInto(this._options, this._window);
},
postResult: function arh_postResult(aResult) {
@ -70,16 +67,8 @@ ActivityRequestHandler.prototype = {
classID: Components.ID("{9326952a-dbe3-4d81-a51f-d9c160d96d6b}"),
QueryInterface: XPCOMUtils.generateQI([
Ci.nsIDOMMozActivityRequestHandler
]),
classInfo: XPCOMUtils.generateCI({
classID: Components.ID("{9326952a-dbe3-4d81-a51f-d9c160d96d6b}"),
contractID: "@mozilla.org/dom/activities/request-handler;1",
interfaces: [Ci.nsIDOMMozActivityRequestHandler],
flags: Ci.nsIClassInfo.DOM_OBJECT,
classDescription: "Activity Request Handler"
})
Ci.nsIDOMGlobalPropertyInitializer
])
}
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ActivityRequestHandler]);

View File

@ -37,15 +37,7 @@ ActivityWrapper.prototype = {
// Activity workflow.
cpmm.sendAsyncMessage("Activity:Ready", { id: aMessage.id });
let handler = Cc["@mozilla.org/dom/activities/request-handler;1"]
.createInstance(Ci.nsIDOMMozActivityRequestHandler);
handler.wrappedJSObject._id = aMessage.id;
// options is an ActivityOptions dictionary.
handler.wrappedJSObject._options = Cu.cloneInto({
name: aMessage.payload.name,
data: Cu.cloneInto(aMessage.payload.data, aWindow),
}, aWindow);
let handler = new aWindow.ActivityRequestHandler(aMessage.id, aMessage.payload);
// When the activity window is closed, fire an error to notify the activity
// caller of the situation.

View File

@ -2296,6 +2296,14 @@ Navigator::HasDownloadsSupport(JSContext* aCx, JSObject* aGlobal)
Preferences::GetBool("dom.mozDownloads.enabled");
}
/* static */
bool
Navigator::HasPermissionSettingsSupport(JSContext* /* unused */, JSObject* aGlobal)
{
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
return CheckPermission(win, "permissions");
}
/* static */
already_AddRefed<nsPIDOMWindow>
Navigator::GetWindowFromGlobal(JSObject* aGlobal)

View File

@ -306,6 +306,8 @@ public:
static bool HasDownloadsSupport(JSContext* aCx, JSObject* aGlobal);
static bool HasPermissionSettingsSupport(JSContext* aCx, JSObject* aGlobal);
nsPIDOMWindow* GetParentObject() const
{
return GetWindow();

View File

@ -162,6 +162,23 @@ nsDOMWindowUtils::GetDocument()
return window->GetExtantDoc();
}
LayerTransactionChild*
nsDOMWindowUtils::GetLayerTransaction()
{
nsIWidget* widget = GetWidget();
if (!widget)
return nullptr;
LayerManager* manager = widget->GetLayerManager();
if (!manager)
return nullptr;
ShadowLayerForwarder* forwarder = manager->AsShadowForwarder();
return forwarder && forwarder->HasShadowManager() ?
forwarder->GetShadowManager() :
nullptr;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetImageAnimationMode(uint16_t *aMode)
{
@ -2552,12 +2569,9 @@ nsDOMWindowUtils::AdvanceTimeAndRefresh(int64_t aMilliseconds)
nsRefreshDriver* driver = GetPresContext()->RefreshDriver();
driver->AdvanceTimeAndRefresh(aMilliseconds);
nsIWidget* widget = GetWidget();
if (widget) {
CompositorChild* compositor = widget->GetRemoteRenderer();
if (compositor) {
compositor->SendSetTestSampleTime(driver->MostRecentRefresh());
}
LayerTransactionChild* transaction = GetLayerTransaction();
if (transaction) {
transaction->SendSetTestSampleTime(driver->MostRecentRefresh());
}
return NS_OK;
@ -2573,12 +2587,9 @@ nsDOMWindowUtils::RestoreNormalRefresh()
// Kick the compositor out of test mode before the refresh driver, so that
// the refresh driver doesn't send an update that gets ignored by the
// compositor.
nsIWidget* widget = GetWidget();
if (widget) {
CompositorChild* compositor = widget->GetRemoteRenderer();
if (compositor) {
compositor->SendLeaveTestMode();
}
LayerTransactionChild* transaction = GetLayerTransaction();
if (transaction) {
transaction->SendLeaveTestMode();
}
nsRefreshDriver* driver = GetPresContext()->RefreshDriver();

View File

@ -19,6 +19,12 @@ class nsPresContext;
class nsPoint;
class nsIDocument;
namespace mozilla {
namespace layers {
class LayerTransactionChild;
}
}
class nsDOMWindowUtils MOZ_FINAL : public nsIDOMWindowUtils,
public nsSupportsWeakReference
{
@ -41,6 +47,7 @@ protected:
nsIPresShell* GetPresShell();
nsPresContext* GetPresContext();
nsIDocument* GetDocument();
mozilla::layers::LayerTransactionChild* GetLayerTransaction();
NS_IMETHOD SendMouseEventCommon(const nsAString& aType,
float aX,

View File

@ -27,8 +27,8 @@ class nsIDOMWindow;
class nsIURI;
#define NS_ISCRIPTCONTEXT_IID \
{ 0x7cf47061, 0x745d, 0x4c6c, \
{ 0xa0, 0xe5, 0x9f, 0xef, 0xa8, 0xcc, 0x2a, 0xf0 } }
{ 0x274840b6, 0x7349, 0x4798, \
{ 0xbe, 0x24, 0xbd, 0x75, 0xa6, 0x46, 0x99, 0xb7 } }
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
know what language we have is a little silly... */
@ -45,32 +45,6 @@ class nsIScriptContext : public nsISupports
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTCONTEXT_IID)
/**
* Bind an already-compiled event handler function to the given
* target. Scripting languages with static scoping must re-bind the
* scope chain for aHandler to begin (after the activation scope for
* aHandler itself, typically) with aTarget's scope.
*
* The result of the bind operation is a new handler object, with
* principals now set and scope set as above. This is returned in
* aBoundHandler. When this function is called, aBoundHandler is
* expected to not be holding an object.
*
* @param aTarget an object telling the scope in which to bind the compiled
* event handler function. The context will presumably associate
* this nsISupports with a native script object.
* @param aScope the scope in which the script object for aTarget should be
* looked for.
* @param aHandler the function object to bind, created by an earlier call to
* CompileEventHandler
* @param aBoundHandler [out] the result of the bind operation.
* @return NS_OK if the function was successfully bound
*/
virtual nsresult BindCompiledEventHandler(nsISupports* aTarget,
JS::Handle<JSObject*> aScope,
JS::Handle<JSObject*> aHandler,
JS::MutableHandle<JSObject*> aBoundHandler) = 0;
/**
* Return the global object.
*

View File

@ -909,95 +909,6 @@ AtomIsEventHandlerName(nsIAtom *aName)
}
#endif
// Helper function to find the JSObject associated with a (presumably DOM)
// interface.
nsresult
nsJSContext::JSObjectFromInterface(nsISupports* aTarget,
JS::Handle<JSObject*> aScope,
JSObject** aRet)
{
// It is legal to specify a null target.
if (!aTarget) {
*aRet = nullptr;
return NS_OK;
}
AutoJSContext cx;
// Get the jsobject associated with this target
// We don't wrap here because we trust the JS engine to wrap the target
// later.
JS::Rooted<JS::Value> v(cx);
nsresult rv = nsContentUtils::WrapNative(cx, aScope, aTarget, &v);
NS_ENSURE_SUCCESS(rv, rv);
JSObject* obj = v.toObjectOrNull();
if (obj) {
JS::ExposeObjectToActiveJS(obj);
}
#ifdef DEBUG
JS::Rooted<JSObject*> rootedObj(cx, obj);
nsCOMPtr<nsISupports> targetSupp = do_QueryInterface(aTarget);
nsCOMPtr<nsISupports> native =
nsContentUtils::XPConnect()->GetNativeOfWrapper(cx, rootedObj);
NS_ASSERTION(native == targetSupp, "Native should be the target!");
obj = rootedObj;
#endif
*aRet = obj;
return NS_OK;
}
nsresult
nsJSContext::BindCompiledEventHandler(nsISupports* aTarget,
JS::Handle<JSObject*> aScope,
JS::Handle<JSObject*> aHandler,
JS::MutableHandle<JSObject*> aBoundHandler)
{
NS_ENSURE_ARG(aHandler);
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_NOT_INITIALIZED);
NS_PRECONDITION(!aBoundHandler, "Shouldn't already have a bound handler!");
if (aScope) {
JS::ExposeObjectToActiveJS(aScope);
}
JS::ExposeObjectToActiveJS(aHandler);
AutoPushJSContext cx(mContext);
// Get the jsobject associated with this target
JS::Rooted<JSObject*> target(cx);
JS::Rooted<JSObject*> scope(cx, aScope);
nsresult rv = JSObjectFromInterface(aTarget, scope, target.address());
NS_ENSURE_SUCCESS(rv, rv);
#ifdef DEBUG
{
JSAutoCompartment ac(cx, aHandler);
JS::Rooted<JS::Value> val(cx, JS::ObjectValue(*aHandler));
NS_ASSERTION(JS_TypeOfValue(cx, val) == JSTYPE_FUNCTION,
"Event handler object not a function");
}
#endif
JSAutoCompartment ac(cx, target);
JSObject* funobj;
// Make sure the handler function is parented by its event target object
if (aHandler) {
funobj = JS_CloneFunctionObject(cx, aHandler, target);
if (!funobj) {
rv = NS_ERROR_OUT_OF_MEMORY;
}
} else {
funobj = nullptr;
}
aBoundHandler.set(funobj);
return rv;
}
nsIScriptGlobalObject *
nsJSContext::GetGlobalObject()
{

View File

@ -44,11 +44,6 @@ public:
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsJSContext,
nsIScriptContext)
virtual nsresult BindCompiledEventHandler(nsISupports *aTarget,
JS::Handle<JSObject*> aScope,
JS::Handle<JSObject*> aHandler,
JS::MutableHandle<JSObject*> aBoundHandler) MOZ_OVERRIDE;
virtual nsIScriptGlobalObject *GetGlobalObject() MOZ_OVERRIDE;
inline nsIScriptGlobalObject *GetGlobalObjectRef() { return mGlobalObjectRef; }
@ -145,12 +140,6 @@ protected:
nsresult AddSupportsPrimitiveTojsvals(nsISupports *aArg, JS::Value *aArgv);
// given an nsISupports object (presumably an event target or some other
// DOM object), get (or create) the JSObject wrapping it.
nsresult JSObjectFromInterface(nsISupports *aSup,
JS::Handle<JSObject*> aScript,
JSObject **aRet);
// Report the pending exception on our mContext, if any. This
// function will set aside the frame chain on mContext before
// reporting.
@ -168,8 +157,6 @@ private:
bool mGCOnDestruction;
bool mProcessingScriptTag;
PRTime mOperationCallbackTime;
PRTime mModalStateTime;
uint32_t mModalStateDepth;

View File

@ -260,7 +260,15 @@ class IDLScope(IDLObject):
isinstance(newObject, IDLExternalInterface) and \
originalObject.identifier.name == newObject.identifier.name:
return originalObject
if (isinstance(originalObject, IDLExternalInterface) or
isinstance(newObject, IDLExternalInterface)):
raise WebIDLError(
"Name collision between "
"interface declarations for identifier '%s' at '%s' and '%s'"
% (identifier.name,
originalObject.location, newObject.location), [])
# We do the merging of overloads here as opposed to in IDLInterface
# because we need to merge overloads of NamedConstructors and we need to
# detect conflicts in those across interfaces. See also the comment in

View File

@ -597,14 +597,11 @@ EventListenerManager::FindEventHandler(uint32_t aEventType,
EventListenerManager::Listener*
EventListenerManager::SetEventHandlerInternal(
JS::Handle<JSObject*> aScopeObject,
nsIAtom* aName,
const nsAString& aTypeString,
const nsEventHandler& aHandler,
bool aPermitUntrustedEvents)
{
MOZ_ASSERT(aScopeObject || aHandler.HasEventHandler(),
"Must have one or the other!");
MOZ_ASSERT(aName || !aTypeString.IsEmpty());
uint32_t eventType = nsContentUtils::GetEventId(aName);
@ -617,7 +614,7 @@ EventListenerManager::SetEventHandlerInternal(
flags.mListenerIsJSListener = true;
nsCOMPtr<nsIJSEventListener> jsListener;
NS_NewJSEventListener(aScopeObject, mTarget, aName,
NS_NewJSEventListener(mTarget, aName,
aHandler, getter_AddRefs(jsListener));
EventListenerHolder listenerHolder(jsListener);
AddEventListenerInternal(listenerHolder, eventType, aName, aTypeString,
@ -631,7 +628,7 @@ EventListenerManager::SetEventHandlerInternal(
bool same = jsListener->GetHandler() == aHandler;
// Possibly the same listener, but update still the context and scope.
jsListener->SetHandler(aHandler, aScopeObject);
jsListener->SetHandler(aHandler);
if (mTarget && !same && aName) {
mTarget->EventListenerRemoved(aName);
mTarget->EventListenerAdded(aName);
@ -746,14 +743,9 @@ EventListenerManager::SetEventHandler(nsIAtom* aName,
nsIScriptContext* context = global->GetScriptContext();
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
NS_ENSURE_STATE(global->GetGlobalJSObject());
JSAutoRequest ar(context->GetNativeContext());
JS::Rooted<JSObject*> scope(context->GetNativeContext(),
global->GetGlobalJSObject());
Listener* listener = SetEventHandlerInternal(scope, aName,
Listener* listener = SetEventHandlerInternal(aName,
EmptyString(),
nsEventHandler(),
aPermitUntrustedEvents);
@ -791,17 +783,12 @@ EventListenerManager::CompileEventHandlerInternal(Listener* aListener,
const nsAString* aBody,
Element* aElement)
{
NS_PRECONDITION(aListener->GetJSListener(),
"Why do we not have a JS listener?");
NS_PRECONDITION(aListener->mHandlerIsString,
"Why are we compiling a non-string JS listener?");
MOZ_ASSERT(aListener->GetJSListener());
MOZ_ASSERT(aListener->mHandlerIsString, "Why are we compiling a non-string JS listener?");
nsIJSEventListener* jsListener = aListener->GetJSListener();
MOZ_ASSERT(!jsListener->GetHandler().HasEventHandler(), "What is there to compile?");
nsresult result = NS_OK;
nsIJSEventListener* jsListener = aListener->GetJSListener();
NS_ASSERTION(!jsListener->GetHandler().HasEventHandler(),
"What is there to compile?");
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<nsIScriptGlobalObject> global =
GetScriptGlobalAndDocument(getter_AddRefs(doc));
@ -812,132 +799,127 @@ EventListenerManager::CompileEventHandlerInternal(Listener* aListener,
// Push a context to make sure exceptions are reported in the right place.
AutoPushJSContextForErrorReporting cx(context->GetNativeContext());
JS::Rooted<JSObject*> handler(cx);
JS::Rooted<JSObject*> scope(cx, jsListener->GetEventScope());
nsCOMPtr<nsIAtom> typeAtom = aListener->mTypeAtom;
nsIAtom* attrName = typeAtom;
if (aListener->mHandlerIsString) {
// OK, we didn't find an existing compiled event handler. Flag us
// as not a string so we don't keep trying to compile strings
// which can't be compiled
aListener->mHandlerIsString = false;
// Flag us as not a string so we don't keep trying to compile strings which
// can't be compiled.
aListener->mHandlerIsString = false;
// mTarget may not be an Element if it's a window and we're
// getting an inline event listener forwarded from <html:body> or
// <html:frameset> or <xul:window> or the like.
// XXX I don't like that we have to reference content from
// here. The alternative is to store the event handler string on
// the nsIJSEventListener itself, and that still doesn't address
// the arg names issue.
nsCOMPtr<Element> element = do_QueryInterface(mTarget);
MOZ_ASSERT(element || aBody, "Where will we get our body?");
nsAutoString handlerBody;
const nsAString* body = aBody;
if (!aBody) {
if (aListener->mTypeAtom == nsGkAtoms::onSVGLoad) {
attrName = nsGkAtoms::onload;
} else if (aListener->mTypeAtom == nsGkAtoms::onSVGUnload) {
attrName = nsGkAtoms::onunload;
} else if (aListener->mTypeAtom == nsGkAtoms::onSVGResize) {
attrName = nsGkAtoms::onresize;
} else if (aListener->mTypeAtom == nsGkAtoms::onSVGScroll) {
attrName = nsGkAtoms::onscroll;
} else if (aListener->mTypeAtom == nsGkAtoms::onSVGZoom) {
attrName = nsGkAtoms::onzoom;
} else if (aListener->mTypeAtom == nsGkAtoms::onbeginEvent) {
attrName = nsGkAtoms::onbegin;
} else if (aListener->mTypeAtom == nsGkAtoms::onrepeatEvent) {
attrName = nsGkAtoms::onrepeat;
} else if (aListener->mTypeAtom == nsGkAtoms::onendEvent) {
attrName = nsGkAtoms::onend;
}
element->GetAttr(kNameSpaceID_None, attrName, handlerBody);
body = &handlerBody;
aElement = element;
}
aListener = nullptr;
uint32_t lineNo = 0;
nsAutoCString url (NS_LITERAL_CSTRING("-moz-evil:lying-event-listener"));
MOZ_ASSERT(body);
MOZ_ASSERT(aElement);
nsIURI *uri = aElement->OwnerDoc()->GetDocumentURI();
if (uri) {
uri->GetSpec(url);
lineNo = 1;
// mTarget may not be an Element if it's a window and we're
// getting an inline event listener forwarded from <html:body> or
// <html:frameset> or <xul:window> or the like.
// XXX I don't like that we have to reference content from
// here. The alternative is to store the event handler string on
// the nsIJSEventListener itself, and that still doesn't address
// the arg names issue.
nsCOMPtr<Element> element = do_QueryInterface(mTarget);
MOZ_ASSERT(element || aBody, "Where will we get our body?");
nsAutoString handlerBody;
const nsAString* body = aBody;
if (!aBody) {
if (aListener->mTypeAtom == nsGkAtoms::onSVGLoad) {
attrName = nsGkAtoms::onload;
} else if (aListener->mTypeAtom == nsGkAtoms::onSVGUnload) {
attrName = nsGkAtoms::onunload;
} else if (aListener->mTypeAtom == nsGkAtoms::onSVGResize) {
attrName = nsGkAtoms::onresize;
} else if (aListener->mTypeAtom == nsGkAtoms::onSVGScroll) {
attrName = nsGkAtoms::onscroll;
} else if (aListener->mTypeAtom == nsGkAtoms::onSVGZoom) {
attrName = nsGkAtoms::onzoom;
} else if (aListener->mTypeAtom == nsGkAtoms::onbeginEvent) {
attrName = nsGkAtoms::onbegin;
} else if (aListener->mTypeAtom == nsGkAtoms::onrepeatEvent) {
attrName = nsGkAtoms::onrepeat;
} else if (aListener->mTypeAtom == nsGkAtoms::onendEvent) {
attrName = nsGkAtoms::onend;
}
uint32_t argCount;
const char **argNames;
nsContentUtils::GetEventArgNames(aElement->GetNameSpaceID(),
typeAtom,
&argCount, &argNames);
element->GetAttr(kNameSpaceID_None, attrName, handlerBody);
body = &handlerBody;
aElement = element;
}
aListener = nullptr;
JSAutoCompartment ac(cx, context->GetWindowProxy());
JS::CompileOptions options(cx);
options.setIntroductionType("eventHandler")
.setFileAndLine(url.get(), lineNo)
.setVersion(SCRIPTVERSION_DEFAULT);
JS::Rooted<JS::Value> targetVal(cx);
// Go ahead and wrap into the current compartment of cx directly.
JS::Rooted<JSObject*> wrapScope(cx, JS::CurrentGlobalOrNull(cx));
if (WrapNewBindingObject(cx, wrapScope, aElement, &targetVal)) {
MOZ_ASSERT(targetVal.isObject());
nsDependentAtomString str(attrName);
// Most of our names are short enough that we don't even have to malloc
// the JS string stuff, so don't worry about playing games with
// refcounting XPCOM stringbuffers.
JS::Rooted<JSString*> jsStr(cx, JS_NewUCStringCopyN(cx,
str.BeginReading(),
str.Length()));
NS_ENSURE_TRUE(jsStr, NS_ERROR_OUT_OF_MEMORY);
options.setElement(&targetVal.toObject())
.setElementAttributeName(jsStr);
}
JS::Rooted<JSObject*> handlerFun(cx);
result = nsJSUtils::CompileFunction(cx, JS::NullPtr(), options,
nsAtomCString(typeAtom),
argCount, argNames, *body, handlerFun.address());
NS_ENSURE_SUCCESS(result, result);
handler = handlerFun;
NS_ENSURE_TRUE(handler, NS_ERROR_FAILURE);
} else {
aListener = nullptr;
uint32_t lineNo = 0;
nsAutoCString url (NS_LITERAL_CSTRING("-moz-evil:lying-event-listener"));
MOZ_ASSERT(body);
MOZ_ASSERT(aElement);
nsIURI *uri = aElement->OwnerDoc()->GetDocumentURI();
if (uri) {
uri->GetSpec(url);
lineNo = 1;
}
if (handler) {
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(mTarget);
// Bind it
JS::Rooted<JSObject*> boundHandler(cx);
context->BindCompiledEventHandler(mTarget, scope, handler, &boundHandler);
// Note - We pass null for aIncumbentGlobal below. We could also pass the
// compilation global, but since the handler is guaranteed to be scripted,
// there's no need to use an override, since the JS engine will always give
// us the right answer.
if (!boundHandler) {
jsListener->ForgetHandler();
} else if (jsListener->EventName() == nsGkAtoms::onerror && win) {
nsRefPtr<OnErrorEventHandlerNonNull> handlerCallback =
new OnErrorEventHandlerNonNull(boundHandler, /* aIncumbentGlobal = */ nullptr);
jsListener->SetHandler(handlerCallback);
} else if (jsListener->EventName() == nsGkAtoms::onbeforeunload && win) {
nsRefPtr<OnBeforeUnloadEventHandlerNonNull> handlerCallback =
new OnBeforeUnloadEventHandlerNonNull(boundHandler, /* aIncumbentGlobal = */ nullptr);
jsListener->SetHandler(handlerCallback);
} else {
nsRefPtr<EventHandlerNonNull> handlerCallback =
new EventHandlerNonNull(boundHandler, /* aIncumbentGlobal = */ nullptr);
jsListener->SetHandler(handlerCallback);
uint32_t argCount;
const char **argNames;
nsContentUtils::GetEventArgNames(aElement->GetNameSpaceID(),
typeAtom,
&argCount, &argNames);
// Wrap the event target, so that we can use it as the scope for the event
// handler. Note that mTarget is different from aElement in the <body> case,
// where mTarget is a Window.
//
// The wrapScope doesn't really matter here, because the target will create
// its reflector in the proper scope, and then we'll enter that compartment.
JS::Rooted<JSObject*> wrapScope(cx, context->GetWindowProxy());
JS::Rooted<JS::Value> v(cx);
{
JSAutoCompartment ac(cx, wrapScope);
nsresult rv = nsContentUtils::WrapNative(cx, wrapScope, mTarget, &v,
/* aAllowWrapping = */ false);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
}
JS::Rooted<JSObject*> target(cx, &v.toObject());
JSAutoCompartment ac(cx, target);
nsDependentAtomString str(attrName);
// Most of our names are short enough that we don't even have to malloc
// the JS string stuff, so don't worry about playing games with
// refcounting XPCOM stringbuffers.
JS::Rooted<JSString*> jsStr(cx, JS_NewUCStringCopyN(cx,
str.BeginReading(),
str.Length()));
NS_ENSURE_TRUE(jsStr, NS_ERROR_OUT_OF_MEMORY);
// Get the reflector for |aElement|, so that we can pass to setElement.
if (NS_WARN_IF(!WrapNewBindingObject(cx, target, aElement, &v))) {
return NS_ERROR_FAILURE;
}
JS::CompileOptions options(cx);
options.setIntroductionType("eventHandler")
.setFileAndLine(url.get(), lineNo)
.setVersion(SCRIPTVERSION_DEFAULT)
.setElement(&v.toObject())
.setElementAttributeName(jsStr)
.setDefineOnScope(false);
JS::Rooted<JSObject*> handler(cx);
result = nsJSUtils::CompileFunction(cx, target, options,
nsAtomCString(typeAtom),
argCount, argNames, *body, handler.address());
NS_ENSURE_SUCCESS(result, result);
NS_ENSURE_TRUE(handler, NS_ERROR_FAILURE);
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(mTarget);
if (jsListener->EventName() == nsGkAtoms::onerror && win) {
nsRefPtr<OnErrorEventHandlerNonNull> handlerCallback =
new OnErrorEventHandlerNonNull(handler, /* aIncumbentGlobal = */ nullptr);
jsListener->SetHandler(handlerCallback);
} else if (jsListener->EventName() == nsGkAtoms::onbeforeunload && win) {
nsRefPtr<OnBeforeUnloadEventHandlerNonNull> handlerCallback =
new OnBeforeUnloadEventHandlerNonNull(handler, /* aIncumbentGlobal = */ nullptr);
jsListener->SetHandler(handlerCallback);
} else {
nsRefPtr<EventHandlerNonNull> handlerCallback =
new EventHandlerNonNull(handler, /* aIncumbentGlobal = */ nullptr);
jsListener->SetHandler(handlerCallback);
}
return result;
}
@ -1240,8 +1222,7 @@ EventListenerManager::SetEventHandler(nsIAtom* aEventName,
// Untrusted events are always permitted for non-chrome script
// handlers.
SetEventHandlerInternal(JS::NullPtr(), aEventName,
aTypeString, nsEventHandler(aHandler),
SetEventHandlerInternal(aEventName, aTypeString, nsEventHandler(aHandler),
!mIsMainThreadELM ||
!nsContentUtils::IsCallerChrome());
}
@ -1257,8 +1238,8 @@ EventListenerManager::SetEventHandler(OnErrorEventHandlerNonNull* aHandler)
// Untrusted events are always permitted for non-chrome script
// handlers.
SetEventHandlerInternal(JS::NullPtr(), nsGkAtoms::onerror,
EmptyString(), nsEventHandler(aHandler),
SetEventHandlerInternal(nsGkAtoms::onerror, EmptyString(),
nsEventHandler(aHandler),
!nsContentUtils::IsCallerChrome());
} else {
if (!aHandler) {
@ -1267,8 +1248,7 @@ EventListenerManager::SetEventHandler(OnErrorEventHandlerNonNull* aHandler)
}
// Untrusted events are always permitted.
SetEventHandlerInternal(JS::NullPtr(), nullptr,
NS_LITERAL_STRING("error"),
SetEventHandlerInternal(nullptr, NS_LITERAL_STRING("error"),
nsEventHandler(aHandler), true);
}
}
@ -1284,8 +1264,8 @@ EventListenerManager::SetEventHandler(
// Untrusted events are always permitted for non-chrome script
// handlers.
SetEventHandlerInternal(JS::NullPtr(), nsGkAtoms::onbeforeunload,
EmptyString(), nsEventHandler(aHandler),
SetEventHandlerInternal(nsGkAtoms::onbeforeunload, EmptyString(),
nsEventHandler(aHandler),
!mIsMainThreadELM ||
!nsContentUtils::IsCallerChrome());
}
@ -1341,9 +1321,6 @@ EventListenerManager::MarkForCC()
if (jsListener->GetHandler().HasEventHandler()) {
JS::ExposeObjectToActiveJS(jsListener->GetHandler().Ptr()->Callable());
}
if (JSObject* scope = jsListener->GetEventScope()) {
JS::ExposeObjectToActiveJS(scope);
}
} else if (listener.mListenerType == Listener::eWrappedJSListener) {
xpc_TryUnmarkWrappedGrayObject(listener.mListener.GetXPCOMCallback());
} else if (listener.mListenerType == Listener::eWebIDLListener) {

View File

@ -447,8 +447,7 @@ protected:
* aScopeGlobal must be non-null. Otherwise, aContext and aScopeGlobal are
* allowed to be null.
*/
Listener* SetEventHandlerInternal(JS::Handle<JSObject*> aScopeGlobal,
nsIAtom* aName,
Listener* SetEventHandlerInternal(nsIAtom* aName,
const nsAString& aTypeString,
const nsEventHandler& aHandler,
bool aPermitUntrustedEvents);

View File

@ -14,8 +14,8 @@
#include "mozilla/dom/EventHandlerBinding.h"
#define NS_IJSEVENTLISTENER_IID \
{ 0x5077b12a, 0x5a1f, 0x4583, \
{ 0xbb, 0xa7, 0x78, 0x84, 0x94, 0x0e, 0x5e, 0xff } }
{ 0x8f06b4af, 0xbd0d, 0x486b, \
{ 0x81, 0xc8, 0x20, 0x42, 0x40, 0x2b, 0xf1, 0xef } }
class nsEventHandler
{
@ -172,10 +172,9 @@ class nsIJSEventListener : public nsIDOMEventListener
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IJSEVENTLISTENER_IID)
nsIJSEventListener(JSObject* aScopeObject,
nsISupports *aTarget, nsIAtom* aType,
nsIJSEventListener(nsISupports *aTarget, nsIAtom* aType,
const nsEventHandler& aHandler)
: mScopeObject(aScopeObject), mEventName(aType), mHandler(aHandler)
: mEventName(aType), mHandler(aHandler)
{
nsCOMPtr<nsISupports> base = do_QueryInterface(aTarget);
mTarget = base.get();
@ -191,17 +190,6 @@ public:
mTarget = nullptr;
}
// Can return null if we already have a handler.
JSObject* GetEventScope() const
{
if (!mScopeObject) {
return nullptr;
}
JS::ExposeObjectToActiveJS(mScopeObject);
return mScopeObject;
}
const nsEventHandler& GetHandler() const
{
return mHandler;
@ -219,11 +207,9 @@ public:
// Set a handler for this event listener. The handler must already
// be bound to the right target.
void SetHandler(const nsEventHandler& aHandler,
JS::Handle<JSObject*> aScopeObject)
void SetHandler(const nsEventHandler& aHandler)
{
mHandler.SetHandler(aHandler);
UpdateScopeObject(aScopeObject);
}
void SetHandler(mozilla::dom::EventHandlerNonNull* aHandler)
{
@ -247,8 +233,6 @@ public:
// - mTarget
//
// The following members are not measured:
// - mScopeObject: because they're measured by the JS memory
// reporters
// - mHandler: may be shared with others
// - mEventName: shared with others
}
@ -264,11 +248,6 @@ protected:
NS_ASSERTION(!mTarget, "Should have called Disconnect()!");
}
// Update our mScopeObject; we have to make sure we properly handle
// the hold/drop stuff, so have to do it in nsJSEventListener.
virtual void UpdateScopeObject(JS::Handle<JSObject*> aScopeObject) = 0;
JS::Heap<JSObject*> mScopeObject;
nsISupports* mTarget;
nsCOMPtr<nsIAtom> mEventName;
nsEventHandler mHandler;
@ -279,8 +258,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIJSEventListener, NS_IJSEVENTLISTENER_IID)
/* factory function. aHandler must already be bound to aTarget.
aContext is allowed to be null if aHandler is already set up.
*/
nsresult NS_NewJSEventListener(JSObject* aScopeObject, nsISupports* aTarget,
nsIAtom* aType, const nsEventHandler& aHandler,
nsresult NS_NewJSEventListener(nsISupports* aTarget, nsIAtom* aType,
const nsEventHandler& aHandler,
nsIJSEventListener **aReturn);
#endif // nsIJSEventListener_h__

View File

@ -43,45 +43,16 @@ using namespace mozilla::dom;
/*
* nsJSEventListener implementation
*/
nsJSEventListener::nsJSEventListener(JSObject* aScopeObject,
nsISupports *aTarget,
nsJSEventListener::nsJSEventListener(nsISupports *aTarget,
nsIAtom* aType,
const nsEventHandler& aHandler)
: nsIJSEventListener(aScopeObject, aTarget, aType, aHandler)
: nsIJSEventListener(aTarget, aType, aHandler)
{
if (mScopeObject) {
mozilla::HoldJSObjects(this);
}
}
nsJSEventListener::~nsJSEventListener()
{
if (mScopeObject) {
mScopeObject = nullptr;
mozilla::DropJSObjects(this);
}
}
/* virtual */
void
nsJSEventListener::UpdateScopeObject(JS::Handle<JSObject*> aScopeObject)
{
if (mScopeObject && !aScopeObject) {
mScopeObject = nullptr;
mozilla::DropJSObjects(this);
} else if (aScopeObject && !mScopeObject) {
mozilla::HoldJSObjects(this);
}
mScopeObject = aScopeObject;
}
NS_IMPL_CYCLE_COLLECTION_CLASS(nsJSEventListener)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsJSEventListener)
if (tmp->mScopeObject) {
tmp->mScopeObject = nullptr;
mozilla::DropJSObjects(tmp);
}
tmp->mHandler.ForgetHandler();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsJSEventListener)
@ -98,10 +69,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsJSEventListener)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsJSEventListener)
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mScopeObject)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsJSEventListener)
if (tmp->IsBlackForCC()) {
return true;
@ -143,12 +110,7 @@ nsJSEventListener::IsBlackForCC()
{
// We can claim to be black if all the things we reference are
// effectively black already.
if ((!mScopeObject || !xpc_IsGrayGCThing(mScopeObject)) &&
(!mHandler.HasEventHandler() ||
!mHandler.Ptr()->HasGrayCallable())) {
return true;
}
return false;
return !mHandler.HasEventHandler() || !mHandler.Ptr()->HasGrayCallable();
}
nsresult
@ -274,14 +236,13 @@ nsJSEventListener::HandleEvent(nsIDOMEvent* aEvent)
*/
nsresult
NS_NewJSEventListener(JSObject* aScopeObject,
nsISupports*aTarget, nsIAtom* aEventType,
NS_NewJSEventListener(nsISupports*aTarget, nsIAtom* aEventType,
const nsEventHandler& aHandler,
nsIJSEventListener** aReturn)
{
NS_ENSURE_ARG(aEventType || !NS_IsMainThread());
nsJSEventListener* it =
new nsJSEventListener(aScopeObject, aTarget, aEventType, aHandler);
new nsJSEventListener(aTarget, aEventType, aHandler);
NS_ADDREF(*aReturn = it);
return NS_OK;

View File

@ -21,9 +21,8 @@
class nsJSEventListener : public nsIJSEventListener
{
public:
nsJSEventListener(JSObject* aScopeObject, nsISupports* aTarget,
nsIAtom* aType, const nsEventHandler& aHandler);
virtual ~nsJSEventListener();
nsJSEventListener(nsISupports* aTarget, nsIAtom* aType,
const nsEventHandler& aHandler);
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@ -37,10 +36,7 @@ public:
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsJSEventListener)
protected:
virtual void UpdateScopeObject(JS::Handle<JSObject*> aScopeObject);
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_CLASS(nsJSEventListener)
bool IsBlackForCC();
};

View File

@ -1,14 +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/.
SUPPORT_FILES = \
testharness.js \
testharnessreport.js \
testharness.css \
idlharness.js \
WebIDLParser.js \
$(NULL)
SUPPORT_DEST = $(DEPTH)/_tests/testing/mochitest/resources
INSTALL_TARGETS += SUPPORT

View File

@ -0,0 +1,7 @@
[DEFAULT]
support-files =
/resources/testharness.js
/resources/testharnessreport.js
/resources/testharness.css
/resources/idlharness.js
/resources/WebIDLParser.js

View File

@ -7,6 +7,7 @@
MOCHITEST_MANIFESTS += [
'editing/mochitest.ini',
'html/mochitest.ini',
'mochitest.ini',
'webapps/mochitest.ini',
]

View File

@ -5,7 +5,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
XPIDL_SOURCES += [
'nsIDOMPermissionSettings.idl',
'nsIPermissionPromptService.idl',
]

View File

@ -1,21 +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/. */
#include "domstubs.idl"
interface nsIDOMDOMRequest;
[scriptable, uuid(18390770-02ab-11e2-a21f-0800200c9a66)]
interface nsIDOMPermissionSettings : nsISupports
{
DOMString get(in DOMString permission, in DOMString manifestURI, in DOMString origin, in bool browserFlag);
void set(in DOMString permission, in DOMString value, in DOMString manifestURI, in DOMString origin, in bool browserFlag);
bool isExplicit(in DOMString permission, in DOMString manifestURI, in DOMString origin, in bool browserFlag);
// Removing a permission is only allowed for pages with a different origin than the app
// and pages that have browserFlag=true, so remove() doesn't have a browserFlag parameter.
void remove(in DOMString permission, in DOMString manifestURI, in DOMString origin);
};

View File

@ -14,7 +14,7 @@ interface nsIPermissionPromptService : nsISupports
{
/**
* Checks if the capability requires a permission, fires the corresponding cancel()
* or allow() method in aRequest after consulting nsIDOMPermissionSettings, etc.
* or allow() method in aRequest after consulting PermissionSettings, etc.
*/
void getPermission(in nsIContentPermissionRequest aRequest);
};

View File

@ -628,7 +628,7 @@ TabChild::HandlePossibleViewportChange()
defaultZoom <= viewportInfo.GetMaxZoom());
metrics.SetZoom(defaultZoom);
metrics.mScrollId = viewId;
metrics.SetScrollId(viewId);
}
metrics.mCumulativeResolution = metrics.GetZoom() / metrics.mDevPixelsPerCSSPixel * ScreenToLayerScale(1);
@ -1472,7 +1472,7 @@ TabChild::DispatchMessageManagerMessage(const nsAString& aMessageName,
bool
TabChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics)
{
MOZ_ASSERT(aFrameMetrics.mScrollId != FrameMetrics::NULL_SCROLL_ID);
MOZ_ASSERT(aFrameMetrics.GetScrollId() != FrameMetrics::NULL_SCROLL_ID);
if (aFrameMetrics.mIsRoot) {
nsCOMPtr<nsIDOMWindowUtils> utils(GetDOMWindowUtils());
@ -1485,7 +1485,7 @@ TabChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics)
// aFrameMetrics.mIsRoot is false, so we are trying to update a subframe.
// This requires special handling.
nsCOMPtr<nsIContent> content = nsLayoutUtils::FindContentFor(
aFrameMetrics.mScrollId);
aFrameMetrics.GetScrollId());
if (content) {
FrameMetrics newSubFrameMetrics(aFrameMetrics);
APZCCallbackHelper::UpdateSubFrame(content, newSubFrameMetrics);

View File

@ -26,11 +26,6 @@ const PERMISSIONPROMPTSERVICE_CONTRACTID = "@mozilla.org/permission-prompt-servi
const PERMISSIONPROMPTSERVICE_CID = Components.ID("{e5f953b3-a6ca-444e-a88d-cdc81383741c}");
const permissionPromptService = Ci.nsIPermissionPromptService;
XPCOMUtils.defineLazyServiceGetter(this,
"PermSettings",
"@mozilla.org/permissionSettings;1",
"nsIDOMPermissionSettings");
var permissionManager = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager);
var secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci.nsIScriptSecurityManager);

View File

@ -22,7 +22,6 @@ var cpm = Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci.nsISyncM
const PERMISSIONSETTINGS_CONTRACTID = "@mozilla.org/permissionSettings;1";
const PERMISSIONSETTINGS_CID = Components.ID("{cd2cf7a1-f4c1-487b-8c1b-1a71c7097431}");
const nsIDOMPermissionSettings = Ci.nsIDOMPermissionSettings;
function PermissionSettings()
{
@ -129,27 +128,8 @@ PermissionSettings.prototype = {
});
},
init: function init(aWindow) {
debug("init");
// Set navigator.mozPermissionSettings to null.
let perm = Services.perms.testExactPermissionFromPrincipal(aWindow.document.nodePrincipal, "permissions");
if (!Services.prefs.getBoolPref("dom.mozPermissionSettings.enabled")
|| perm != Ci.nsIPermissionManager.ALLOW_ACTION) {
return null;
}
debug("Permission to get/set permissions granted!");
},
classID : PERMISSIONSETTINGS_CID,
QueryInterface : XPCOMUtils.generateQI([nsIDOMPermissionSettings, Ci.nsIDOMGlobalPropertyInitializer]),
classInfo : XPCOMUtils.generateCI({classID: PERMISSIONSETTINGS_CID,
contractID: PERMISSIONSETTINGS_CONTRACTID,
classDescription: "PermissionSettings",
interfaces: [nsIDOMPermissionSettings],
flags: Ci.nsIClassInfo.DOM_OBJECT})
QueryInterface : XPCOMUtils.generateQI([])
}
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PermissionSettings])

View File

@ -1,3 +1,2 @@
component {cd2cf7a1-f4c1-487b-8c1b-1a71c7097431} PermissionSettings.js
contract @mozilla.org/permissionSettings;1 {cd2cf7a1-f4c1-487b-8c1b-1a71c7097431}
category JavaScript-navigator-property mozPermissionSettings @mozilla.org/permissionSettings;1

View File

@ -20,7 +20,7 @@ var gData = [
{
perm: ["permissions"],
obj: "mozPermissionSettings",
idl: "nsIDOMPermissionSettings",
webidl: "PermissionSettings",
settings: [["dom.mozPermissionSettings.enabled", true]],
},
]

View File

@ -181,13 +181,7 @@ SettingsServiceLock.prototype = {
},
classID : SETTINGSSERVICELOCK_CID,
QueryInterface : XPCOMUtils.generateQI([nsISettingsServiceLock]),
classInfo : XPCOMUtils.generateCI({ classID: SETTINGSSERVICELOCK_CID,
contractID: SETTINGSSERVICELOCK_CONTRACTID,
classDescription: "SettingsServiceLock",
interfaces: [nsISettingsServiceLock],
flags: nsIClassInfo.DOM_OBJECT })
QueryInterface : XPCOMUtils.generateQI([nsISettingsServiceLock])
};
const SETTINGSSERVICE_CID = Components.ID("{f656f0c0-f776-11e1-a21f-0800200c9a66}");
@ -221,13 +215,7 @@ SettingsService.prototype = {
},
classID : SETTINGSSERVICE_CID,
QueryInterface : XPCOMUtils.generateQI([Ci.nsISettingsService]),
classInfo: XPCOMUtils.generateCI({
classID: SETTINGSSERVICE_CID,
contractID: "@mozilla.org/settingsService;1",
interfaces: [Ci.nsISettingsService],
flags: nsIClassInfo.DOM_OBJECT
})
QueryInterface : XPCOMUtils.generateQI([Ci.nsISettingsService])
}
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SettingsService, SettingsServiceLock])

View File

@ -28,7 +28,7 @@ LOCAL_INCLUDES += [
if CONFIG['MOZ_ENABLE_QT5GEOPOSITION']:
LOCAL_INCLUDES += [
'/dom/system/unix',
'/dom/system/qt',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':

View File

@ -684,7 +684,7 @@ nsresult nsGeolocationService::Init()
#endif
#ifdef MOZ_WIDGET_GONK
mProvider = do_GetService(GONK_GPS_GEOLOCATION_PROVIDER_CONTRACTID);
mProvider = do_CreateInstance(GONK_GPS_GEOLOCATION_PROVIDER_CONTRACTID);
#endif
#ifdef MOZ_WIDGET_COCOA
@ -694,7 +694,7 @@ nsresult nsGeolocationService::Init()
#endif
if (Preferences::GetBool("geo.provider.use_mls", false)) {
mProvider = do_GetService("@mozilla.org/geolocation/mls-provider;1");
mProvider = do_CreateInstance("@mozilla.org/geolocation/mls-provider;1");
}
// Override platform-specific providers with the default (network)

View File

@ -87,6 +87,8 @@ WifiGeoPositionProvider.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIGeolocationProvider,
Ci.nsIWifiListener,
Ci.nsITimerCallback]),
listener: null,
startup: function() {
if (this.started)
return;
@ -104,6 +106,7 @@ WifiGeoPositionProvider.prototype = {
},
watch: function(c) {
this.listener = c;
},
shutdown: function() {
@ -121,6 +124,7 @@ WifiGeoPositionProvider.prototype = {
this.wifiService.stopWatching(this);
this.wifiService = null;
}
this.listener = null;
this.started = false;
},
@ -186,17 +190,18 @@ WifiGeoPositionProvider.prototype = {
notify: function (timeoutTimer) {
let url = Services.urlFormatter.formatURLPref("geo.wifi.uri");
let listener = this.listener;
LOG("Sending request: " + url + "\n");
let xhr = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
getGeoService().locationUpdatePending();
listener.locationUpdatePending();
try {
xhr.open("POST", url, true);
} catch (e) {
getGeoService().notifyError(POSITION_UNAVAILABLE);
listener.notifyError(POSITION_UNAVAILABLE);
return;
}
xhr.setRequestHeader("Content-Type", "application/json; charset=UTF-8");
@ -204,13 +209,13 @@ WifiGeoPositionProvider.prototype = {
xhr.mozBackgroundRequest = true;
xhr.channel.loadFlags = Ci.nsIChannel.LOAD_ANONYMOUS;
xhr.onerror = function() {
getGeoService().notifyError(POSITION_UNAVAILABLE);
listener.notifyError(POSITION_UNAVAILABLE);
};
xhr.onload = function() {
LOG("gls returned status: " + xhr.status + " --> " + JSON.stringify(xhr.response));
if ((xhr.channel instanceof Ci.nsIHttpChannel && xhr.status != 200) ||
!xhr.response || !xhr.response.location) {
getGeoService().notifyError(POSITION_UNAVAILABLE);
listener.notifyError(POSITION_UNAVAILABLE);
return;
}
@ -218,7 +223,7 @@ WifiGeoPositionProvider.prototype = {
xhr.response.location.lng,
xhr.response.accuracy);
getGeoService().update(newLocation);
listener.update(newLocation);
};
if (gCellScanningEnabled) {
@ -239,8 +244,4 @@ WifiGeoPositionProvider.prototype = {
},
};
function getGeoService() {
return Cc["@mozilla.org/geolocation/service;1"].getService(Ci.nsIGeolocationUpdate);
}
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([WifiGeoPositionProvider]);

View File

@ -26,6 +26,7 @@
#include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h"
#include "nsContentUtils.h"
#include "prtime.h"
#ifdef MOZ_B2G_RIL
#include "nsIDOMIccInfo.h"
@ -98,6 +99,7 @@ GonkGPSGeolocationProvider::LocationCallback(GpsLocation* location)
NS_IMETHOD Run() {
nsRefPtr<GonkGPSGeolocationProvider> provider =
GonkGPSGeolocationProvider::GetSingleton();
provider->mLastGPSDerivedLocationTime = PR_Now();
nsCOMPtr<nsIGeolocationUpdate> callback = provider->mLocationCallback;
if (callback) {
callback->Update(mPosition);
@ -285,8 +287,8 @@ GonkGPSGeolocationProvider::GonkGPSGeolocationProvider()
: mStarted(false)
, mSupportsScheduling(false)
#ifdef MOZ_B2G_RIL
, mSupportsMSB(false)
, mSupportsMSA(false)
, mSupportsMSB(false)
, mSupportsMSA(false)
#endif
, mSupportsSingleShot(false)
, mSupportsTimeInjection(false)
@ -523,8 +525,29 @@ GonkGPSGeolocationProvider::SetReferenceLocation()
}
}
}
#endif // MOZ_B2G_RIL
void
GonkGPSGeolocationProvider::InjectLocation(double latitude,
double longitude,
float accuracy)
{
#ifdef DEBUG_GPS
printf_stderr("*** injecting location\n");
printf_stderr("*** lat: %f\n", latitude);
printf_stderr("*** lon: %f\n", longitude);
printf_stderr("*** accuracy: %f\n", accuracy);
#endif
MOZ_ASSERT(NS_IsMainThread());
if (!mGpsInterface) {
return;
}
mGpsInterface->inject_location(latitude, longitude, accuracy);
}
void
GonkGPSGeolocationProvider::Init()
{
@ -626,6 +649,49 @@ GonkGPSGeolocationProvider::SetupAGPS()
}
#endif // MOZ_B2G_RIL
NS_IMPL_ISUPPORTS1(GonkGPSGeolocationProvider::NetworkLocationUpdate,
nsIGeolocationUpdate)
NS_IMETHODIMP
GonkGPSGeolocationProvider::NetworkLocationUpdate::Update(nsIDOMGeoPosition *position)
{
nsRefPtr<GonkGPSGeolocationProvider> provider =
GonkGPSGeolocationProvider::GetSingleton();
nsCOMPtr<nsIDOMGeoPositionCoords> coords;
position->GetCoords(getter_AddRefs(coords));
if (!coords) {
return NS_ERROR_FAILURE;
}
// if we haven't seen anything from the GPS device for 1s,
// use this network derived location.
int64_t diff = PR_Now() - provider->mLastGPSDerivedLocationTime;
if (provider->mLocationCallback && diff > kDefaultPeriod) {
provider->mLocationCallback->Update(position);
}
double lat, lon, acc;
coords->GetLatitude(&lat);
coords->GetLongitude(&lon);
coords->GetAccuracy(&acc);
provider->InjectLocation(lat, lon, acc);
return NS_OK;
}
NS_IMETHODIMP
GonkGPSGeolocationProvider::NetworkLocationUpdate::LocationUpdatePending()
{
return NS_OK;
}
NS_IMETHODIMP
GonkGPSGeolocationProvider::NetworkLocationUpdate::NotifyError(uint16_t error)
{
return NS_OK;
}
NS_IMETHODIMP
GonkGPSGeolocationProvider::Startup()
{
@ -643,6 +709,16 @@ GonkGPSGeolocationProvider::Startup()
mInitThread->Dispatch(NS_NewRunnableMethod(this, &GonkGPSGeolocationProvider::Init),
NS_DISPATCH_NORMAL);
mNetworkLocationProvider = do_CreateInstance("@mozilla.org/geolocation/mls-provider;1");
if (mNetworkLocationProvider) {
nsresult rv = mNetworkLocationProvider->Startup();
if (NS_SUCCEEDED(rv)) {
nsRefPtr<NetworkLocationUpdate> update = new NetworkLocationUpdate();
mNetworkLocationProvider->Watch(update);
}
}
mLastGPSDerivedLocationTime = 0;
mStarted = true;
return NS_OK;
}
@ -665,6 +741,7 @@ GonkGPSGeolocationProvider::Shutdown()
return NS_OK;
}
mStarted = false;
mNetworkLocationProvider = nullptr;
#ifdef MOZ_B2G_RIL
if (mRadioInterface) {

View File

@ -55,7 +55,7 @@ private:
GonkGPSGeolocationProvider();
GonkGPSGeolocationProvider(const GonkGPSGeolocationProvider &);
GonkGPSGeolocationProvider & operator = (const GonkGPSGeolocationProvider &);
~GonkGPSGeolocationProvider();
virtual ~GonkGPSGeolocationProvider();
static void LocationCallback(GpsLocation* location);
static void StatusCallback(GpsStatus* status);
@ -81,6 +81,7 @@ private:
void Init();
void StartGPS();
void ShutdownGPS();
void InjectLocation(double latitude, double longitude, float accuracy);
#ifdef MOZ_B2G_RIL
void SetupAGPS();
int32_t GetDataConnectionState();
@ -113,7 +114,21 @@ private:
nsCOMPtr<nsIRadioInterface> mRadioInterface;
#endif
nsCOMPtr<nsIGeolocationUpdate> mLocationCallback;
PRTime mLastGPSDerivedLocationTime;
nsCOMPtr<nsIThread> mInitThread;
nsCOMPtr<nsIGeolocationProvider> mNetworkLocationProvider;
class NetworkLocationUpdate : public nsIGeolocationUpdate
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIGEOLOCATIONUPDATE
NetworkLocationUpdate() {}
private:
virtual ~NetworkLocationUpdate() {}
};
};
#endif /* GonkGPSGeolocationProvider_h */

View File

@ -743,6 +743,8 @@ var interfaceNamesInGlobalScope =
"PerformanceTiming",
// IMPORTANT: Do not change this list without review from a DOM peer!
"PeriodicWave",
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "PermissionSettings", b2g: true, permission: "permissions"},
// IMPORTANT: Do not change this list without review from a DOM peer!
"PhoneNumberService",
// IMPORTANT: Do not change this list without review from a DOM peer!

View File

@ -0,0 +1,15 @@
/* 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/. */
[Pref="dom.sysmsg.enabled",
JSImplementation="@mozilla.org/dom/activities/request-handler;1",
ChromeConstructor(DOMString id, optional ActivityOptions options),
ChromeOnly]
interface ActivityRequestHandler
{
void postResult(any result);
void postError(DOMString error);
[Pure, Cached, Frozen]
readonly attribute ActivityOptions source;
};

View File

@ -0,0 +1,20 @@
/* 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 at http://mozilla.org/MPL/2.0/. */
[JSImplementation="@mozilla.org/permissionSettings;1",
Func="Navigator::HasPermissionSettingsSupport",
Pref="dom.mozPermissionSettings.enabled",
NavigatorProperty="mozPermissionSettings"]
interface PermissionSettings
{
DOMString get(DOMString permission, DOMString manifestURI, DOMString origin, boolean browserFlag);
void set(DOMString permission, DOMString value, DOMString manifestURI, DOMString origin, boolean browserFlag);
boolean isExplicit(DOMString permission, DOMString manifestURI, DOMString origin, boolean browserFlag);
// Removing a permission is only allowed for pages with a different origin than the app
// and pages that have browserFlag=true, so remove() doesn't have a browserFlag parameter.
void remove(DOMString permission, DOMString manifestURI, DOMString origin);
};

View File

@ -16,6 +16,7 @@ PREPROCESSED_WEBIDL_FILES = [
WEBIDL_FILES = [
'AbstractWorker.webidl',
'ActivityRequestHandler.webidl',
'AnalyserNode.webidl',
'AnimationEvent.webidl',
'AppInfo.webidl',
@ -270,6 +271,7 @@ WEBIDL_FILES = [
'PerformanceNavigation.webidl',
'PerformanceTiming.webidl',
'PeriodicWave.webidl',
'PermissionSettings.webidl',
'PhoneNumberService.webidl',
'Plugin.webidl',
'PluginArray.webidl',
@ -615,7 +617,7 @@ if CONFIG['MOZ_B2G_BT']:
'BluetoothStatusChangedEvent.webidl',
]
if CONFIG['MOZ_BUILD_APP'] in ['browser', 'xulrunner']:
if CONFIG['MOZ_BUILD_APP'] == 'browser':
WEBIDL_FILES += [
'BrowserFeedWriter.webidl',
]

View File

@ -326,8 +326,7 @@ nsXBLPrototypeHandler::ExecuteHandler(EventTarget* aTarget,
// Execute it.
nsCOMPtr<nsIJSEventListener> eventListener;
rv = NS_NewJSEventListener(globalObject,
scriptTarget, onEventAtom,
rv = NS_NewJSEventListener(scriptTarget, onEventAtom,
eventHandler,
getter_AddRefs(eventListener));
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -1108,8 +1108,8 @@ FilterNodeTransformSoftware::Render(const IntRect& aRect)
return nullptr;
}
Matrix transform = Matrix().Translate(srcRect.x, srcRect.y) * mMatrix *
Matrix().Translate(-aRect.x, -aRect.y);
Matrix transform = Matrix::Translation(srcRect.x, srcRect.y) * mMatrix *
Matrix::Translation(-aRect.x, -aRect.y);
if (transform.IsIdentity() && srcRect.Size() == aRect.Size()) {
return input;
}

View File

@ -10,6 +10,15 @@
namespace mozilla {
namespace gfx {
static float CubicRoot(float aValue) {
if (aValue < 0.0) {
return -CubicRoot(-aValue);
}
else {
return powf(aValue, 1.0f / 3.0f);
}
}
struct BezierControlPoints
{
BezierControlPoints() {}
@ -269,8 +278,8 @@ FindInflectionApproximationRange(BezierControlPoints aControlPoints,
if (cp21.x == 0 && cp21.y == 0) {
// In this case s3 becomes lim[n->0] (cp41.x * n) / n - (cp41.y * n) / n = cp41.x - cp41.y.
*aMin = aT - pow(aTolerance / (cp41.x - cp41.y), Float(1. / 3.));
*aMax = aT + pow(aTolerance / (cp41.x - cp41.y), Float(1. / 3.));;
*aMin = aT - CubicRoot(double(aTolerance / (cp41.x - cp41.y)));
*aMax = aT + CubicRoot(aTolerance / (cp41.x - cp41.y));
return;
}
@ -285,7 +294,7 @@ FindInflectionApproximationRange(BezierControlPoints aControlPoints,
return;
}
Float tf = pow(abs(aTolerance / s3), Float(1. / 3.));
Float tf = CubicRoot(abs(aTolerance / s3));
*aMin = aT - tf * (1 - aT);
*aMax = aT + tf * (1 - aT);
@ -445,7 +454,7 @@ FlattenBezier(const BezierControlPoints &aControlPoints,
&remainingCP, t1min);
FlattenBezierCurveSegment(prevCPs, aSink, aTolerance);
}
if (t1max < 1.0 && (count == 1 || t2min > t1max)) {
if (t1max >= 0 && t1max < 1.0 && (count == 1 || t2min > t1max)) {
// The second inflection point's approximation range begins after the end
// of the first, approximate the first inflection point by a line and
// subsequently flatten up until the end or the next inflection point.

View File

@ -5,9 +5,13 @@
ifdef MOZ_ANGLE_RENDERER
libs::
ifdef MOZ_HAS_WINSDK_WITH_D3D
cp -fp "$(MOZ_D3DCOMPILER_DLL_PATH)" "$(DIST)/bin"
else
ifdef MOZ_D3DCOMPILER_CAB
expand '$(MOZ_D3DCOMPILER_CAB)' -F:$(MOZ_D3DCOMPILER_DLL) '$(DIST)/bin'
endif
endif
endif

View File

@ -13,7 +13,9 @@ endif
include $(topsrcdir)/config/rules.mk
ifndef MOZ_HAS_WINSDK_WITH_D3D
CXXFLAGS += -I'$(MOZ_DIRECTX_SDK_PATH)/include'
endif
#OS_LIBS += $(call EXPAND_LIBNAME,dwmapi)
@ -24,8 +26,12 @@ OS_LIBS += -ld3d9 -llibGLESv2
else
ifdef MOZ_HAS_WINSDK_WITH_D3D
EXTRA_DSO_LDOPTS = d3d9.lib "$(DIST)/lib/libGLESv2.lib" delayimp.lib
else
EXTRA_DSO_LDOPTS = '$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib' \
'$(DIST)/lib/libGLESv2.lib' \
delayimp.lib
endif
endif

View File

@ -11,7 +11,9 @@ endif
include $(topsrcdir)/config/rules.mk
ifndef MOZ_HAS_WINSDK_WITH_D3D
CXXFLAGS += -I'$(MOZ_DIRECTX_SDK_PATH)/include'
endif
ifdef GNU_CC
@ -20,8 +22,12 @@ OS_LIBS += -ld3d9 -ldxguid
else
ifdef MOZ_HAS_WINSDK_WITH_D3D
EXTRA_DSO_LDOPTS = d3d9.lib dxguid.lib delayimp.lib
else
EXTRA_DSO_LDOPTS = '$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib' \
'$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/dxguid.lib' \
delayimp.lib
endif
endif

View File

@ -71,7 +71,6 @@ public:
, mDisplayPort(0, 0, 0, 0)
, mCriticalDisplayPort(0, 0, 0, 0)
, mViewport(0, 0, 0, 0)
, mScrollId(NULL_SCROLL_ID)
, mScrollableRect(0, 0, 0, 0)
, mResolution(1)
, mCumulativeResolution(1)
@ -81,6 +80,7 @@ public:
, mMayHaveTouchListeners(false)
, mIsRoot(false)
, mHasScrollgrab(false)
, mScrollId(NULL_SCROLL_ID)
, mScrollOffset(0, 0)
, mZoom(1)
, mUpdateScrollOffset(false)
@ -97,7 +97,6 @@ public:
mDisplayPort.IsEqualEdges(aOther.mDisplayPort) &&
mCriticalDisplayPort.IsEqualEdges(aOther.mCriticalDisplayPort) &&
mViewport.IsEqualEdges(aOther.mViewport) &&
mScrollId == aOther.mScrollId &&
mScrollableRect.IsEqualEdges(aOther.mScrollableRect) &&
mResolution == aOther.mResolution &&
mCumulativeResolution == aOther.mCumulativeResolution &&
@ -105,6 +104,7 @@ public:
mMayHaveTouchListeners == aOther.mMayHaveTouchListeners &&
mPresShellId == aOther.mPresShellId &&
mIsRoot == aOther.mIsRoot &&
mScrollId == aOther.mScrollId &&
mScrollOffset == aOther.mScrollOffset &&
mHasScrollgrab == aOther.mHasScrollgrab &&
mUpdateScrollOffset == aOther.mUpdateScrollOffset;
@ -265,9 +265,6 @@ public:
// meaningless and invalid.
CSSRect mViewport;
// A unique ID assigned to each scrollable frame.
ViewID mScrollId;
// The scrollable bounds of a frame. This is determined by reflow.
// Ordinarily the x and y will be 0 and the width and height will be the
// size of the element being scrolled. However for RTL pages or elements
@ -370,10 +367,23 @@ public:
mContentDescription = aContentDescription;
}
ViewID GetScrollId() const
{
return mScrollId;
}
void SetScrollId(ViewID scrollId)
{
mScrollId = scrollId;
}
private:
// New fields from now on should be made private and old fields should
// be refactored to be private.
// A unique ID assigned to each scrollable frame.
ViewID mScrollId;
// The position of the top-left of the CSS viewport, relative to the document
// (or the document relative to the viewport, if that helps understand it).
//
@ -441,7 +451,7 @@ struct ScrollableLayerGuid {
ScrollableLayerGuid(uint64_t aLayersId, const FrameMetrics& aMetrics)
: mLayersId(aLayersId)
, mPresShellId(aMetrics.mPresShellId)
, mScrollId(aMetrics.mScrollId)
, mScrollId(aMetrics.GetScrollId())
{
MOZ_COUNT_CTOR(ScrollableLayerGuid);
}

View File

@ -472,6 +472,26 @@ PlanarYCbCrImage::~PlanarYCbCrImage()
}
}
size_t
PlanarYCbCrImage::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{
// Ignoring:
// - mData - just wraps mBuffer
// - Surfaces should be reported under gfx-surfaces-*:
// - mDeprecatedSurface
// - mSourceSurface
// - Base class:
// - mImplData is not used
// Not owned:
// - mRecycleBin
size_t size = mBuffer.SizeOfExcludingThis(aMallocSizeOf);
// Could add in the future:
// - mBackendData (from base class)
return size;
}
uint8_t*
PlanarYCbCrImage::AllocateBuffer(uint32_t aSize)
{

View File

@ -863,6 +863,12 @@ public:
virtual SharedPlanarYCbCrImage *AsSharedPlanarYCbCrImage() { return nullptr; }
virtual DeprecatedSharedPlanarYCbCrImage *AsDeprecatedSharedPlanarYCbCrImage() { return nullptr; }
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const {
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const;
protected:
/**
* Make a copy of the YCbCr data into local storage.

View File

@ -500,16 +500,16 @@ Layer::SnapTransformTranslation(const Matrix4x4& aTransform,
!matrix2D.HasNonTranslation() &&
matrix2D.HasNonIntegerTranslation()) {
IntPoint snappedTranslation = RoundedToInt(matrix2D.GetTranslation());
Matrix snappedMatrix = Matrix().Translate(snappedTranslation.x,
snappedTranslation.y);
Matrix snappedMatrix = Matrix::Translation(snappedTranslation.x,
snappedTranslation.y);
result = Matrix4x4::From2D(snappedMatrix);
if (aResidualTransform) {
// set aResidualTransform so that aResidual * snappedMatrix == matrix2D.
// (I.e., appying snappedMatrix after aResidualTransform gives the
// ideal transform.)
*aResidualTransform =
Matrix().Translate(matrix2D._31 - snappedTranslation.x,
matrix2D._32 - snappedTranslation.y);
Matrix::Translation(matrix2D._31 - snappedTranslation.x,
matrix2D._32 - snappedTranslation.y);
}
} else {
result = aTransform;

View File

@ -121,7 +121,7 @@ AppendToString(nsACString& s, const FrameMetrics& m,
AppendToString(s, m.GetScrollOffset(), " viewportScroll=");
AppendToString(s, m.mDisplayPort, " displayport=");
AppendToString(s, m.mScrollableRect, " scrollableRect=");
AppendToString(s, m.mScrollId, " scrollId=", " }");
AppendToString(s, m.GetScrollId(), " scrollId=", " }");
return s += sfx;
}

View File

@ -55,6 +55,18 @@ public:
already_AddRefed<gfxASurface> DeprecatedGetAsSurface();
TemporaryRef<gfx::SourceSurface> GetAsSourceSurface();
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE
{
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE
{
size_t size = PlanarYCbCrImage::SizeOfExcludingThis(aMallocSizeOf);
size += mDecodedBuffer.SizeOfExcludingThis(aMallocSizeOf);
return size;
}
private:
nsAutoArrayPtr<uint8_t> mDecodedBuffer;
gfx::IntSize mScaleHint;

View File

@ -29,7 +29,7 @@ ClientTiledThebesLayer::ClientTiledThebesLayer(ClientLayerManager* const aManage
, mContentClient()
{
MOZ_COUNT_CTOR(ClientTiledThebesLayer);
mPaintData.mLastScrollOffset = ScreenPoint(0, 0);
mPaintData.mLastScrollOffset = ParentLayerPoint(0, 0);
mPaintData.mFirstPaint = true;
}
@ -67,73 +67,106 @@ ClientTiledThebesLayer::BeginPaint()
mPaintData.mLowPrecisionPaintCount = 0;
mPaintData.mPaintFinished = false;
mPaintData.mCompositionBounds.SetEmpty();
mPaintData.mCriticalDisplayPort.SetEmpty();
// Get the metrics of the nearest scroll container.
if (!GetBaseTransform().Is2DIntegerTranslation()) {
// Give up if the layer is transformed. The code below assumes that there
// is no transform set, and not making that assumption would cause huge
// complication to handle a quite rare case.
//
// FIXME The intention is to bail out of this function when there's a CSS
// transform set on the layer, but unfortunately there's no way to
// distinguish transforms due to scrolling from transforms due to
// CSS transforms.
//
// Because of this, there may be unintended behaviour when setting
// 2d CSS translations on the children of scrollable displayport
// layers.
return;
}
// Get the metrics of the nearest scrollable layer and the nearest layer
// with a displayport.
ContainerLayer* displayPortParent = nullptr;
ContainerLayer* scrollParent = nullptr;
for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
const FrameMetrics& metrics = parent->GetFrameMetrics();
if (metrics.mScrollId != FrameMetrics::NULL_SCROLL_ID) {
if (!scrollParent && metrics.GetScrollId() != FrameMetrics::NULL_SCROLL_ID) {
scrollParent = parent;
}
if (!metrics.mDisplayPort.IsEmpty()) {
displayPortParent = parent;
// Any layer that has a displayport must be scrollable, so we can break
// here.
break;
}
}
if (!scrollParent) {
// XXX I don't think this can happen, but if it does, warn and set the
// composition bounds to empty so that progressive updates are disabled.
if (!displayPortParent || !scrollParent) {
// No displayport or scroll parent, so we can't do progressive rendering.
// Just set the composition bounds to empty and return.
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_B2G)
// Both Android and b2g are guaranteed to have a displayport set, so this
// should never happen.
NS_WARNING("Tiled Thebes layer with no scrollable container parent");
mPaintData.mCompositionBounds.SetEmpty();
#endif
return;
}
const FrameMetrics& metrics = scrollParent->GetFrameMetrics();
// Note, not handling transformed layers lets us assume that LayoutDevice
// space of the scroll parent layer is the same as LayoutDevice space of
// this layer.
const FrameMetrics& scrollMetrics = scrollParent->GetFrameMetrics();
const FrameMetrics& displayportMetrics = displayPortParent->GetFrameMetrics();
// Calculate the transform required to convert parent layer space into
// transformed layout device space.
gfx::Matrix4x4 effectiveTransform = GetEffectiveTransform();
for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
if (parent->UseIntermediateSurface()) {
effectiveTransform = effectiveTransform * parent->GetEffectiveTransform();
}
// Calculate the transform required to convert ParentLayer space of our
// display port parent to LayoutDevice space of this layer.
gfx::Matrix4x4 transform = scrollParent->GetTransform();
ContainerLayer* displayPortParentParent = displayPortParent->GetParent() ?
displayPortParent->GetParent()->GetParent() : nullptr;
for (ContainerLayer* parent = scrollParent->GetParent();
parent != displayPortParentParent;
parent = parent->GetParent()) {
transform = transform * parent->GetTransform();
}
gfx3DMatrix layoutToParentLayer;
gfx::To3DMatrix(effectiveTransform, layoutToParentLayer);
layoutToParentLayer.ScalePost(metrics.GetParentResolution().scale,
metrics.GetParentResolution().scale,
1.f);
gfx3DMatrix layoutDeviceToScrollParentLayer;
gfx::To3DMatrix(transform, layoutDeviceToScrollParentLayer);
layoutDeviceToScrollParentLayer.ScalePost(scrollMetrics.mCumulativeResolution.scale,
scrollMetrics.mCumulativeResolution.scale,
1.f);
mPaintData.mTransformParentLayerToLayout = layoutToParentLayer.Inverse();
mPaintData.mTransformParentLayerToLayoutDevice = layoutDeviceToScrollParentLayer.Inverse();
// Compute the critical display port in layer space.
mPaintData.mLayoutCriticalDisplayPort.SetEmpty();
if (!metrics.mCriticalDisplayPort.IsEmpty()) {
// Convert the display port to screen space first so that we can transform
// it into layout device space.
const ParentLayerRect& criticalDisplayPort = metrics.mCriticalDisplayPort
* metrics.mDevPixelsPerCSSPixel
* metrics.GetParentResolution();
LayoutDeviceRect transformedCriticalDisplayPort =
ApplyParentLayerToLayoutTransform(mPaintData.mTransformParentLayerToLayout, criticalDisplayPort);
mPaintData.mLayoutCriticalDisplayPort =
LayoutDeviceIntRect::ToUntyped(RoundedOut(transformedCriticalDisplayPort));
}
// Compute the critical display port of the display port layer in
// LayoutDevice space of this layer.
ParentLayerRect criticalDisplayPort =
(displayportMetrics.mCriticalDisplayPort + displayportMetrics.GetScrollOffset()) *
displayportMetrics.GetZoomToParent();
mPaintData.mCriticalDisplayPort = LayoutDeviceIntRect::ToUntyped(RoundedOut(
ApplyParentLayerToLayoutTransform(mPaintData.mTransformParentLayerToLayoutDevice,
criticalDisplayPort)));
// Calculate the frame resolution. Because this is Gecko-side, before any
// async transforms have occurred, we can use mZoom for this.
mPaintData.mResolution = metrics.GetZoom();
// Compute the viewport of the display port layer in LayoutDevice space of
// this layer.
ParentLayerRect viewport =
(displayportMetrics.mViewport + displayportMetrics.GetScrollOffset()) *
displayportMetrics.GetZoomToParent();
mPaintData.mViewport = ApplyParentLayerToLayoutTransform(
mPaintData.mTransformParentLayerToLayoutDevice, viewport);
// Calculate the scroll offset since the last transaction, and the
// composition bounds.
mPaintData.mCompositionBounds.SetEmpty();
mPaintData.mScrollOffset.MoveTo(0, 0);
Layer* primaryScrollable = ClientManager()->GetPrimaryScrollableLayer();
if (primaryScrollable) {
const FrameMetrics& metrics = primaryScrollable->AsContainerLayer()->GetFrameMetrics();
mPaintData.mScrollOffset = metrics.GetScrollOffset() * metrics.GetZoom();
mPaintData.mCompositionBounds =
ApplyParentLayerToLayoutTransform(mPaintData.mTransformParentLayerToLayout,
ParentLayerRect(metrics.mCompositionBounds));
}
// Store the scroll parent resolution. Because this is Gecko-side, before any
// async transforms have occurred, we can use the zoom for this.
mPaintData.mResolution = displayportMetrics.GetZoomToParent();
// Store the parent composition bounds in LayoutDevice units.
// This is actually in LayoutDevice units of the scrollParent's parent layer,
// but because there is no transform, we can assume that these are the same.
mPaintData.mCompositionBounds =
scrollMetrics.mCompositionBounds / scrollMetrics.GetParentResolution();
// Calculate the scroll offset since the last transaction
mPaintData.mScrollOffset = displayportMetrics.GetScrollOffset() * displayportMetrics.GetZoomToParent();
}
void
@ -213,15 +246,15 @@ ClientTiledThebesLayer::RenderLayer()
// discarded on the first update.
if (!ClientManager()->IsRepeatTransaction()) {
mValidRegion.And(mValidRegion, mVisibleRegion);
if (!mPaintData.mLayoutCriticalDisplayPort.IsEmpty()) {
if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
// Make sure that tiles that fall outside of the critical displayport are
// discarded on the first update.
mValidRegion.And(mValidRegion, mPaintData.mLayoutCriticalDisplayPort);
mValidRegion.And(mValidRegion, mPaintData.mCriticalDisplayPort);
}
}
nsIntRegion lowPrecisionInvalidRegion;
if (!mPaintData.mLayoutCriticalDisplayPort.IsEmpty()) {
if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
if (gfxPrefs::UseLowPrecisionBuffer()) {
// Calculate the invalid region for the low precision buffer
lowPrecisionInvalidRegion.Sub(mVisibleRegion, mLowPrecisionValidRegion);
@ -232,7 +265,7 @@ ClientTiledThebesLayer::RenderLayer()
}
// Clip the invalid region to the critical display-port
invalidRegion.And(invalidRegion, mPaintData.mLayoutCriticalDisplayPort);
invalidRegion.And(invalidRegion, mPaintData.mCriticalDisplayPort);
if (invalidRegion.IsEmpty() && lowPrecisionInvalidRegion.IsEmpty()) {
EndPaint(true);
return;
@ -250,8 +283,8 @@ ClientTiledThebesLayer::RenderLayer()
// used to decide stale content (currently valid and previously visible)
nsIntRegion oldValidRegion = mContentClient->mTiledBuffer.GetValidRegion();
oldValidRegion.And(oldValidRegion, mVisibleRegion);
if (!mPaintData.mLayoutCriticalDisplayPort.IsEmpty()) {
oldValidRegion.And(oldValidRegion, mPaintData.mLayoutCriticalDisplayPort);
if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
oldValidRegion.And(oldValidRegion, mPaintData.mCriticalDisplayPort);
}
updatedBuffer =
@ -261,8 +294,8 @@ ClientTiledThebesLayer::RenderLayer()
} else {
updatedBuffer = true;
mValidRegion = mVisibleRegion;
if (!mPaintData.mLayoutCriticalDisplayPort.IsEmpty()) {
mValidRegion.And(mValidRegion, mPaintData.mLayoutCriticalDisplayPort);
if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
mValidRegion.And(mValidRegion, mPaintData.mCriticalDisplayPort);
}
mContentClient->mTiledBuffer.SetFrameResolution(mPaintData.mResolution);
mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion,
@ -292,7 +325,7 @@ ClientTiledThebesLayer::RenderLayer()
// visible region is larger than the critical display port.
bool updatedLowPrecision = false;
if (!lowPrecisionInvalidRegion.IsEmpty() &&
!nsIntRegion(mPaintData.mLayoutCriticalDisplayPort).Contains(mVisibleRegion)) {
!nsIntRegion(mPaintData.mCriticalDisplayPort).Contains(mVisibleRegion)) {
nsIntRegion oldValidRegion =
mContentClient->mLowPrecisionTiledBuffer.GetValidRegion();
oldValidRegion.And(oldValidRegion, mVisibleRegion);

View File

@ -248,9 +248,6 @@ SimpleClientTiledThebesLayer::SimpleClientTiledThebesLayer(ClientLayerManager* a
, mContentClient()
{
MOZ_COUNT_CTOR(SimpleClientTiledThebesLayer);
mPaintData.mLastScrollOffset = ScreenPoint(0, 0);
mPaintData.mFirstPaint = true;
}
SimpleClientTiledThebesLayer::~SimpleClientTiledThebesLayer()
@ -264,102 +261,6 @@ SimpleClientTiledThebesLayer::FillSpecificAttributes(SpecificLayerAttributes& aA
aAttrs = ThebesLayerAttributes(GetValidRegion());
}
static LayoutDeviceRect
ApplyParentLayerToLayoutTransform(const gfx3DMatrix& aTransform, const ParentLayerRect& aParentLayerRect)
{
return TransformTo<LayoutDevicePixel>(aTransform, aParentLayerRect);
}
void
SimpleClientTiledThebesLayer::BeginPaint()
{
if (ClientManager()->IsRepeatTransaction()) {
return;
}
mPaintData.mLowPrecisionPaintCount = 0;
mPaintData.mPaintFinished = false;
// Get the metrics of the nearest scroll container.
ContainerLayer* scrollParent = nullptr;
for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
const FrameMetrics& metrics = parent->GetFrameMetrics();
if (metrics.mScrollId != FrameMetrics::NULL_SCROLL_ID) {
scrollParent = parent;
break;
}
}
if (!scrollParent) {
// XXX I don't think this can happen, but if it does, warn and set the
// composition bounds to empty so that progressive updates are disabled.
NS_WARNING("Tiled Thebes layer with no scrollable container parent");
mPaintData.mCompositionBounds.SetEmpty();
return;
}
const FrameMetrics& metrics = scrollParent->GetFrameMetrics();
// Calculate the transform required to convert screen space into transformed
// layout device space.
gfx::Matrix4x4 effectiveTransform = GetEffectiveTransform();
for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
if (parent->UseIntermediateSurface()) {
effectiveTransform = effectiveTransform * parent->GetEffectiveTransform();
}
}
gfx3DMatrix layoutToParentLayer;
gfx::To3DMatrix(effectiveTransform, layoutToParentLayer);
layoutToParentLayer.ScalePost(metrics.GetParentResolution().scale,
metrics.GetParentResolution().scale,
1.f);
mPaintData.mTransformParentLayerToLayout = layoutToParentLayer.Inverse();
// Compute the critical display port in layer space.
mPaintData.mLayoutCriticalDisplayPort.SetEmpty();
if (!metrics.mCriticalDisplayPort.IsEmpty()) {
// Convert the display port to screen space first so that we can transform
// it into layout device space.
const ParentLayerRect& criticalDisplayPort = metrics.mCriticalDisplayPort
* metrics.mDevPixelsPerCSSPixel
* metrics.GetParentResolution();
LayoutDeviceRect transformedCriticalDisplayPort =
ApplyParentLayerToLayoutTransform(mPaintData.mTransformParentLayerToLayout, criticalDisplayPort);
mPaintData.mLayoutCriticalDisplayPort =
LayoutDeviceIntRect::ToUntyped(RoundedOut(transformedCriticalDisplayPort));
}
// Calculate the frame resolution. Because this is Gecko-side, before any
// async transforms have occurred, we can use mZoom for this.
mPaintData.mResolution = metrics.GetZoom();
// Calculate the scroll offset since the last transaction, and the
// composition bounds.
mPaintData.mCompositionBounds.SetEmpty();
mPaintData.mScrollOffset.MoveTo(0, 0);
Layer* primaryScrollable = ClientManager()->GetPrimaryScrollableLayer();
if (primaryScrollable) {
const FrameMetrics& metrics = primaryScrollable->AsContainerLayer()->GetFrameMetrics();
mPaintData.mScrollOffset = metrics.GetScrollOffset() * metrics.GetZoom();
mPaintData.mCompositionBounds =
ApplyParentLayerToLayoutTransform(mPaintData.mTransformParentLayerToLayout,
ParentLayerRect(metrics.mCompositionBounds));
}
}
void
SimpleClientTiledThebesLayer::EndPaint(bool aFinish)
{
if (!aFinish && !mPaintData.mPaintFinished) {
return;
}
mPaintData.mLastScrollOffset = mPaintData.mScrollOffset;
mPaintData.mPaintFinished = true;
mPaintData.mFirstPaint = false;
}
void
SimpleClientTiledThebesLayer::RenderLayer()
{
@ -388,83 +289,29 @@ SimpleClientTiledThebesLayer::RenderLayer()
nsIntRegion invalidRegion = mVisibleRegion;
invalidRegion.Sub(invalidRegion, mValidRegion);
if (invalidRegion.IsEmpty()) {
EndPaint(true);
return;
}
const FrameMetrics& parentMetrics = GetParent()->GetFrameMetrics();
nsIntRegion wantToPaintRegion = mVisibleRegion;
// Only paint the mask layer on the first transaction.
if (GetMaskLayer() && !ClientManager()->IsRepeatTransaction()) {
ToClientLayer(GetMaskLayer())->RenderLayer();
}
// Fast path for no progressive updates, no low-precision updates and no
// critical display-port set, or no display-port set.
if (parentMetrics.mCriticalDisplayPort.IsEmpty() ||
parentMetrics.mDisplayPort.IsEmpty())
{
mValidRegion = wantToPaintRegion;
// SimpleTiledContentClient doesn't support progressive updates or the low
// precision buffer yet.
MOZ_ASSERT(!gfxPrefs::UseProgressiveTilePainting() &&
!gfxPrefs::UseLowPrecisionBuffer());
NS_ASSERTION(!ClientManager()->IsRepeatTransaction(), "Didn't paint our mask layer");
mValidRegion = mVisibleRegion;
mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion,
callback, data);
NS_ASSERTION(!ClientManager()->IsRepeatTransaction(), "Didn't paint our mask layer");
ClientManager()->Hold(this);
mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion,
callback, data);
mContentClient->UseTiledLayerBuffer();
ClientManager()->Hold(this);
return;
}
// Calculate everything we need to perform the paint.
BeginPaint();
if (mPaintData.mPaintFinished) {
return;
}
// Make sure that tiles that fall outside of the visible region are
// discarded on the first update.
if (!ClientManager()->IsRepeatTransaction()) {
mValidRegion.And(mValidRegion, wantToPaintRegion);
if (!mPaintData.mLayoutCriticalDisplayPort.IsEmpty()) {
// Make sure that tiles that fall outside of the critical displayport are
// discarded on the first update.
mValidRegion.And(mValidRegion, mPaintData.mLayoutCriticalDisplayPort);
}
}
nsIntRegion lowPrecisionInvalidRegion;
if (!mPaintData.mLayoutCriticalDisplayPort.IsEmpty()) {
// Clip the invalid region to the critical display-port
invalidRegion.And(invalidRegion, mPaintData.mLayoutCriticalDisplayPort);
if (invalidRegion.IsEmpty() && lowPrecisionInvalidRegion.IsEmpty()) {
EndPaint(true);
return;
}
}
if (!invalidRegion.IsEmpty()) {
mValidRegion = wantToPaintRegion;
if (!mPaintData.mLayoutCriticalDisplayPort.IsEmpty()) {
mValidRegion.And(mValidRegion, mPaintData.mLayoutCriticalDisplayPort);
}
mContentClient->mTiledBuffer.SetFrameResolution(mPaintData.mResolution);
mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion,
callback, data);
ClientManager()->Hold(this);
mContentClient->UseTiledLayerBuffer();
EndPaint(false);
return;
}
EndPaint(false);
mContentClient->UseTiledLayerBuffer();
}

View File

@ -106,8 +106,8 @@ public:
}
}
const CSSToScreenScale& GetFrameResolution() const { return mFrameResolution; }
void SetFrameResolution(const CSSToScreenScale& aResolution) { mFrameResolution = aResolution; }
const CSSToParentLayerScale& GetFrameResolution() const { return mFrameResolution; }
void SetFrameResolution(const CSSToParentLayerScale& aResolution) { mFrameResolution = aResolution; }
bool HasFormatChanged() const;
private:
@ -116,7 +116,7 @@ private:
ClientLayerManager* mManager;
LayerManager::DrawThebesLayerCallback mCallback;
void* mCallbackData;
CSSToScreenScale mFrameResolution;
CSSToParentLayerScale mFrameResolution;
bool mLastPaintOpaque;
gfxContentType GetContentType() const;
@ -180,11 +180,7 @@ public:
protected:
ClientLayerManager* ClientManager() { return static_cast<ClientLayerManager*>(mManager); }
void BeginPaint();
void EndPaint(bool aFinish);
RefPtr<SimpleTiledContentClient> mContentClient;
BasicTiledLayerPaintData mPaintData;
};
} // mozilla

View File

@ -156,7 +156,7 @@ SharedFrameMetricsHelper::UpdateFromCompositorFrameMetrics(
const FrameMetrics& contentMetrics = aLayer->GetFrameMetrics();
FrameMetrics compositorMetrics;
if (!compositor->LookupCompositorFrameMetrics(contentMetrics.mScrollId,
if (!compositor->LookupCompositorFrameMetrics(contentMetrics.GetScrollId(),
compositorMetrics)) {
FindFallbackContentFrameMetrics(aLayer, aCompositionBounds, aZoom);
return false;
@ -861,18 +861,18 @@ ClientTiledLayerBuffer::ValidateTile(TileClient aTile,
static LayoutDeviceRect
TransformCompositionBounds(const ParentLayerRect& aCompositionBounds,
const CSSToParentLayerScale& aZoom,
const ScreenPoint& aScrollOffset,
const CSSToScreenScale& aResolution,
const gfx3DMatrix& aTransformScreenToLayout)
const ParentLayerPoint& aScrollOffset,
const CSSToParentLayerScale& aResolution,
const gfx3DMatrix& aTransformParentLayerToLayoutDevice)
{
// Transform the current composition bounds into transformed layout device
// space by compensating for the difference in resolution and subtracting the
// Transform the current composition bounds into ParentLayer coordinates
// by compensating for the difference in resolution and subtracting the
// old composition bounds origin.
ScreenRect offsetViewportRect = (aCompositionBounds / aZoom) * aResolution;
ParentLayerRect offsetViewportRect = (aCompositionBounds / aZoom) * aResolution;
offsetViewportRect.MoveBy(-aScrollOffset);
gfxRect transformedViewport =
aTransformScreenToLayout.TransformBounds(
aTransformParentLayerToLayoutDevice.TransformBounds(
gfxRect(offsetViewportRect.x, offsetViewportRect.y,
offsetViewportRect.width, offsetViewportRect.height));
@ -884,10 +884,10 @@ TransformCompositionBounds(const ParentLayerRect& aCompositionBounds,
bool
ClientTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& aInvalidRegion,
const nsIntRegion& aOldValidRegion,
nsIntRegion& aRegionToPaint,
BasicTiledLayerPaintData* aPaintData,
bool aIsRepeated)
const nsIntRegion& aOldValidRegion,
nsIntRegion& aRegionToPaint,
BasicTiledLayerPaintData* aPaintData,
bool aIsRepeated)
{
aRegionToPaint = aInvalidRegion;
@ -942,20 +942,27 @@ ClientTiledLayerBuffer::ComputeProgressiveUpdateRegion(const nsIntRegion& aInval
}
}
// Transform the screen coordinates into transformed layout device coordinates.
// Transform the composition bounds, which is in the ParentLayer coordinates
// of the nearest ContainerLayer with a valid displayport to LayoutDevice
// coordinates relative to this layer.
LayoutDeviceRect transformedCompositionBounds =
TransformCompositionBounds(compositionBounds, zoom, aPaintData->mScrollOffset,
aPaintData->mResolution, aPaintData->mTransformParentLayerToLayout);
aPaintData->mResolution, aPaintData->mTransformParentLayerToLayoutDevice);
// Paint tiles that have stale content or that intersected with the screen
// at the time of issuing the draw command in a single transaction first.
// This is to avoid rendering glitches on animated page content, and when
// layers change size/shape.
LayoutDeviceRect coherentUpdateRect =
LayoutDeviceRect typedCoherentUpdateRect =
transformedCompositionBounds.Intersect(aPaintData->mCompositionBounds);
// Offset by the viewport origin, as the composition bounds are stored in
// Layer space and not LayoutDevice space.
typedCoherentUpdateRect.MoveBy(aPaintData->mViewport.TopLeft());
// Convert to untyped to intersect with the invalid region.
nsIntRect roundedCoherentUpdateRect =
LayoutDeviceIntRect::ToUntyped(RoundedOut(coherentUpdateRect));
LayoutDeviceIntRect::ToUntyped(RoundedOut(typedCoherentUpdateRect));
aRegionToPaint.And(aInvalidRegion, roundedCoherentUpdateRect);
aRegionToPaint.Or(aRegionToPaint, staleRegion);

View File

@ -244,41 +244,46 @@ struct BasicTiledLayerPaintData {
* The scroll offset of the content from the nearest ancestor layer that
* represents scrollable content with a display port set.
*/
ScreenPoint mScrollOffset;
ParentLayerPoint mScrollOffset;
/*
* The scroll offset of the content from the nearest ancestor layer that
* represents scrollable content with a display port set, for the last
* layer update transaction.
*/
ScreenPoint mLastScrollOffset;
ParentLayerPoint mLastScrollOffset;
/*
* The transform matrix to go from ParentLayer units to transformed
* LayoutDevice units.
* The transform matrix to go from Screen units to ParentLayer units.
*/
gfx3DMatrix mTransformParentLayerToLayout;
gfx3DMatrix mTransformParentLayerToLayoutDevice;
/*
* The critical displayport of the content from the nearest ancestor layer
* that represents scrollable content with a display port set. Empty if a
* critical displayport is not set.
*
* This is in transformed LayoutDevice coordinates, but is stored as an
* nsIntRect for convenience when intersecting with the layer's mValidRegion.
* This is in LayoutDevice coordinates, but is stored as an nsIntRect for
* convenience when intersecting with the layer's mValidRegion.
*/
nsIntRect mLayoutCriticalDisplayPort;
nsIntRect mCriticalDisplayPort;
/*
* The viewport of the content from the nearest ancestor layer that
* represents scrollable content with a display port set.
*/
LayoutDeviceRect mViewport;
/*
* The render resolution of the document that the content this layer
* represents is in.
*/
CSSToScreenScale mResolution;
CSSToParentLayerScale mResolution;
/*
* The composition bounds of the primary scrollable layer, in transformed
* layout device coordinates. This is used to make sure that tiled updates to
* regions that are visible to the user are grouped coherently.
* The composition bounds of the layer, in LayoutDevice coordinates. This is
* used to make sure that tiled updates to regions that are visible to the
* user are grouped coherently.
*/
LayoutDeviceRect mCompositionBounds;
@ -381,9 +386,9 @@ public:
void DiscardBackBuffers();
const CSSToScreenScale& GetFrameResolution() { return mFrameResolution; }
const CSSToParentLayerScale& GetFrameResolution() { return mFrameResolution; }
void SetFrameResolution(const CSSToScreenScale& aResolution) { mFrameResolution = aResolution; }
void SetFrameResolution(const CSSToParentLayerScale& aResolution) { mFrameResolution = aResolution; }
bool HasFormatChanged() const;
@ -424,7 +429,7 @@ private:
ClientLayerManager* mManager;
LayerManager::DrawThebesLayerCallback mCallback;
void* mCallbackData;
CSSToScreenScale mFrameResolution;
CSSToParentLayerScale mFrameResolution;
bool mLastPaintOpaque;
// The DrawTarget we use when UseSinglePaintBuffer() above is true.

View File

@ -211,7 +211,7 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor,
apzc->SetPrevSibling(nullptr);
apzc->SetLastChild(nullptr);
}
APZC_LOG("Using APZC %p for layer %p with identifiers %lld %lld\n", apzc, aLayer, aLayersId, container->GetFrameMetrics().mScrollId);
APZC_LOG("Using APZC %p for layer %p with identifiers %lld %lld\n", apzc, aLayer, aLayersId, container->GetFrameMetrics().GetScrollId());
apzc->NotifyLayersUpdated(metrics,
aIsFirstPaint && (aLayersId == aFirstPaintLayersId));

View File

@ -244,7 +244,7 @@ AsyncCompositionManager::AlignFixedAndStickyLayers(Layer* aLayer,
bool isStickyForSubtree = aLayer->GetIsStickyPosition() &&
aTransformedSubtreeRoot->AsContainerLayer() &&
aLayer->GetStickyScrollContainerId() ==
aTransformedSubtreeRoot->AsContainerLayer()->GetFrameMetrics().mScrollId;
aTransformedSubtreeRoot->AsContainerLayer()->GetFrameMetrics().GetScrollId();
if (aLayer != aTransformedSubtreeRoot && (isRootFixed || isStickyForSubtree)) {
// Insert a translation so that the position of the anchor point is the same
// before and after the change to the transform of aTransformedSubtreeRoot.
@ -606,7 +606,7 @@ AsyncCompositionManager::ApplyAsyncTransformToScrollbar(ContainerLayer* aLayer)
continue;
}
const FrameMetrics& metrics = scrollTarget->AsContainerLayer()->GetFrameMetrics();
if (metrics.mScrollId != aLayer->GetScrollbarTargetContainerId()) {
if (metrics.GetScrollId() != aLayer->GetScrollbarTargetContainerId()) {
continue;
}
if (!LayerHasNonContainerDescendants(scrollTarget->AsContainerLayer())) {

View File

@ -182,7 +182,7 @@ ThebesLayerComposite::GetEffectiveResolution()
{
for (ContainerLayer* parent = GetParent(); parent; parent = parent->GetParent()) {
const FrameMetrics& metrics = parent->GetFrameMetrics();
if (metrics.mScrollId != FrameMetrics::NULL_SCROLL_ID) {
if (metrics.GetScrollId() != FrameMetrics::NULL_SCROLL_ID) {
return metrics.GetZoom();
}
}

View File

@ -42,7 +42,7 @@ TiledLayerBufferComposite::TiledLayerBufferComposite(ISurfaceAllocator* aAllocat
mRetainedWidth = aDescriptor.retainedWidth();
mRetainedHeight = aDescriptor.retainedHeight();
mResolution = aDescriptor.resolution();
mFrameResolution = CSSToScreenScale(aDescriptor.frameResolution());
mFrameResolution = CSSToParentLayerScale(aDescriptor.frameResolution());
// Combine any valid content that wasn't already uploaded
nsIntRegion oldPaintedRegion(aOldPaintedRegion);
@ -379,8 +379,8 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
// We assume that the current frame resolution is the one used in our primary
// layer buffer. Compensate for a changing frame resolution.
if (aLayerBuffer.GetFrameResolution() != mTiledBuffer.GetFrameResolution()) {
const CSSToScreenScale& layerResolution = aLayerBuffer.GetFrameResolution();
const CSSToScreenScale& localResolution = mTiledBuffer.GetFrameResolution();
const CSSToParentLayerScale& layerResolution = aLayerBuffer.GetFrameResolution();
const CSSToParentLayerScale& localResolution = mTiledBuffer.GetFrameResolution();
layerScale.width = layerScale.height = layerResolution.scale / localResolution.scale;
aVisibleRect.ScaleRoundOut(layerScale.width, layerScale.height);
}

View File

@ -114,7 +114,7 @@ public:
// Stores the absolute resolution of the containing frame, calculated
// by the sum of the resolutions of all parent layers' FrameMetrics.
const CSSToScreenScale& GetFrameResolution() { return mFrameResolution; }
const CSSToParentLayerScale& GetFrameResolution() { return mFrameResolution; }
void ReadUnlock();
@ -144,7 +144,7 @@ protected:
void SwapTiles(TileHost& aTileA, TileHost& aTileB) { std::swap(aTileA, aTileB); }
private:
CSSToScreenScale mFrameResolution;
CSSToParentLayerScale mFrameResolution;
bool mHasDoubleBufferedTiles;
bool mUninitialized;
};

View File

@ -69,7 +69,7 @@
" i=(%ld %lld) cb=(%d %d %d %d) dp=(%.3f %.3f %.3f %.3f) v=(%.3f %.3f %.3f %.3f) " \
"s=(%.3f %.3f) sr=(%.3f %.3f %.3f %.3f) z=(%.3f %.3f %.3f %.3f) u=(%d %llu)\n", \
__VA_ARGS__, \
fm.mPresShellId, fm.mScrollId, \
fm.mPresShellId, fm.GetScrollId(), \
fm.mCompositionBounds.x, fm.mCompositionBounds.y, fm.mCompositionBounds.width, fm.mCompositionBounds.height, \
fm.mDisplayPort.x, fm.mDisplayPort.y, fm.mDisplayPort.width, fm.mDisplayPort.height, \
fm.mViewport.x, fm.mViewport.y, fm.mViewport.width, fm.mViewport.height, \
@ -325,7 +325,7 @@ static inline void LogRendertraceRect(const ScrollableLayerGuid& aGuid, const ch
static const TimeStamp sRenderStart = TimeStamp::Now();
TimeDuration delta = TimeStamp::Now() - sRenderStart;
printf_stderr("(%llu,%lu,%llu)%s RENDERTRACE %f rect %s %f %f %f %f\n",
aGuid.mLayersId, aGuid.mPresShellId, aGuid.mScrollId,
aGuid.mLayersId, aGuid.mPresShellId, aGuid.GetScrollId(),
aDesc, delta.ToMilliseconds(), aColor,
aRect.x, aRect.y, aRect.width, aRect.height);
#endif
@ -480,7 +480,7 @@ AsyncPanZoomController::~AsyncPanZoomController() {
// Only send the release message if the SharedFrameMetrics has been created.
if (compositor && mSharedFrameMetricsBuffer) {
unused << compositor->SendReleaseSharedCompositorFrameMetrics(mFrameMetrics.mScrollId, mAPZCId);
unused << compositor->SendReleaseSharedCompositorFrameMetrics(mFrameMetrics.GetScrollId(), mAPZCId);
}
delete mSharedFrameMetricsBuffer;
@ -1778,7 +1778,7 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
// more "legitimate" sources like content scripts.
nsRefPtr<GeckoContentController> controller = GetGeckoContentController();
if (controller) {
controller->AcknowledgeScrollUpdate(aLayerMetrics.mScrollId,
controller->AcknowledgeScrollUpdate(aLayerMetrics.GetScrollId(),
aLayerMetrics.GetScrollGeneration());
}
}
@ -1989,10 +1989,10 @@ void AsyncPanZoomController::SetState(PanZoomState aNewState) {
if (mGeckoContentController) {
if (!IsTransformingState(oldState) && IsTransformingState(aNewState)) {
mGeckoContentController->NotifyTransformBegin(
ScrollableLayerGuid(mLayersId, mFrameMetrics.mPresShellId, mFrameMetrics.mScrollId));
ScrollableLayerGuid(mLayersId, mFrameMetrics.mPresShellId, mFrameMetrics.GetScrollId()));
} else if (IsTransformingState(oldState) && !IsTransformingState(aNewState)) {
mGeckoContentController->NotifyTransformEnd(
ScrollableLayerGuid(mLayersId, mFrameMetrics.mPresShellId, mFrameMetrics.mScrollId));
ScrollableLayerGuid(mLayersId, mFrameMetrics.mPresShellId, mFrameMetrics.GetScrollId()));
}
}
}

View File

@ -211,7 +211,7 @@ CompositorChild::SharedFrameMetricsData::GetViewID()
MOZ_ASSERT(frame);
// Not locking to read of mScrollId since it should not change after being
// initially set.
return frame->mScrollId;
return frame->GetScrollId();
}
uint32_t

View File

@ -366,34 +366,6 @@ CompositorParent::RecvStopFrameTimeRecording(const uint32_t& aStartIndex,
return true;
}
bool
CompositorParent::RecvSetTestSampleTime(const TimeStamp& aTime)
{
if (aTime.IsNull()) {
return false;
}
mIsTesting = true;
mTestTime = aTime;
// Update but only if we were already scheduled to animate
if (mCompositionManager && mCurrentCompositeTask) {
bool requestNextFrame = mCompositionManager->TransformShadowTree(aTime);
if (!requestNextFrame) {
CancelCurrentCompositeTask();
}
}
return true;
}
bool
CompositorParent::RecvLeaveTestMode()
{
mIsTesting = false;
return true;
}
void
CompositorParent::ActorDestroy(ActorDestroyReason why)
{
@ -789,6 +761,7 @@ CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
// scheduled in order to better match the behavior under regular sampling
// conditions.
if (mIsTesting && root && mCurrentCompositeTask) {
AutoResolveRefLayers resolve(mCompositionManager);
bool requestNextFrame =
mCompositionManager->TransformShadowTree(mTestTime);
if (!requestNextFrame) {
@ -805,6 +778,35 @@ CompositorParent::ForceComposite(LayerTransactionParent* aLayerTree)
ScheduleComposition();
}
bool
CompositorParent::SetTestSampleTime(LayerTransactionParent* aLayerTree,
const TimeStamp& aTime)
{
if (aTime.IsNull()) {
return false;
}
mIsTesting = true;
mTestTime = aTime;
// Update but only if we were already scheduled to animate
if (mCompositionManager && mCurrentCompositeTask) {
AutoResolveRefLayers resolve(mCompositionManager);
bool requestNextFrame = mCompositionManager->TransformShadowTree(aTime);
if (!requestNextFrame) {
CancelCurrentCompositeTask();
}
}
return true;
}
void
CompositorParent::LeaveTestMode(LayerTransactionParent* aLayerTree)
{
mIsTesting = false;
}
void
CompositorParent::InitializeLayerManager(const nsTArray<LayersBackend>& aBackendHints)
{
@ -1067,8 +1069,6 @@ public:
virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) { return true; }
virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) MOZ_OVERRIDE { return true; }
virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) MOZ_OVERRIDE { return true; }
virtual bool RecvSetTestSampleTime(const TimeStamp& aTime) MOZ_OVERRIDE { return true; }
virtual bool RecvLeaveTestMode() MOZ_OVERRIDE { return true; }
virtual PLayerTransactionParent*
AllocPLayerTransactionParent(const nsTArray<LayersBackend>& aBackendHints,
@ -1083,6 +1083,9 @@ public:
bool aIsFirstPaint,
bool aScheduleComposite) MOZ_OVERRIDE;
virtual void ForceComposite(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE;
virtual bool SetTestSampleTime(LayerTransactionParent* aLayerTree,
const TimeStamp& aTime) MOZ_OVERRIDE;
virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE;
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aParent) MOZ_OVERRIDE;
@ -1243,6 +1246,23 @@ CrossProcessCompositorParent::ForceComposite(LayerTransactionParent* aLayerTree)
sIndirectLayerTrees[id].mParent->ForceComposite(aLayerTree);
}
bool
CrossProcessCompositorParent::SetTestSampleTime(
LayerTransactionParent* aLayerTree, const TimeStamp& aTime)
{
uint64_t id = aLayerTree->GetId();
MOZ_ASSERT(id != 0);
return sIndirectLayerTrees[id].mParent->SetTestSampleTime(aLayerTree, aTime);
}
void
CrossProcessCompositorParent::LeaveTestMode(LayerTransactionParent* aLayerTree)
{
uint64_t id = aLayerTree->GetId();
MOZ_ASSERT(id != 0);
sIndirectLayerTrees[id].mParent->LeaveTestMode(aLayerTree);
}
AsyncCompositionManager*
CrossProcessCompositorParent::GetCompositionManager(LayerTransactionParent* aLayerTree)
{
@ -1253,8 +1273,12 @@ CrossProcessCompositorParent::GetCompositionManager(LayerTransactionParent* aLay
void
CrossProcessCompositorParent::DeferredDestroy()
{
mSelfRef = nullptr;
// |this| was just destroyed, hands off
CrossProcessCompositorParent* self;
mSelfRef.forget(&self);
nsCOMPtr<nsIRunnable> runnable =
NS_NewNonOwningRunnableMethod(self, &CrossProcessCompositorParent::Release);
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
}
CrossProcessCompositorParent::~CrossProcessCompositorParent()

View File

@ -92,8 +92,6 @@ public:
virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) MOZ_OVERRIDE;
virtual bool RecvStartFrameTimeRecording(const int32_t& aBufferSize, uint32_t* aOutStartIndex) MOZ_OVERRIDE;
virtual bool RecvStopFrameTimeRecording(const uint32_t& aStartIndex, InfallibleTArray<float>* intervals) MOZ_OVERRIDE;
virtual bool RecvSetTestSampleTime(const TimeStamp& aTime) MOZ_OVERRIDE;
virtual bool RecvLeaveTestMode() MOZ_OVERRIDE;
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
@ -102,7 +100,11 @@ public:
bool aIsFirstPaint,
bool aScheduleComposite) MOZ_OVERRIDE;
virtual void ForceComposite(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE;
virtual bool SetTestSampleTime(LayerTransactionParent* aLayerTree,
const TimeStamp& aTime) MOZ_OVERRIDE;
virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE;
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aLayerTree) MOZ_OVERRIDE { return mCompositionManager; }
/**
* This forces the is-first-paint flag to true. This is intended to
* be called by the widget code when it loses its viewport information

View File

@ -1,3 +1,4 @@
/* vim: set ts=2 sw=2 et tw=80: */
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
@ -31,6 +32,7 @@
#include "nsTArrayForwardDeclare.h" // for InfallibleTArray
#include "nsXULAppAPI.h" // for XRE_GetIOMessageLoop
#include "mozilla/layers/TextureHost.h"
#include "nsThreadUtils.h"
using namespace base;
using namespace mozilla::ipc;
@ -218,11 +220,32 @@ MessageLoop * ImageBridgeParent::GetMessageLoop() {
return mMessageLoop;
}
class ReleaseRunnable : public nsRunnable
{
public:
ReleaseRunnable(ImageBridgeParent* aRef)
: mRef(aRef)
{
}
NS_IMETHOD Run()
{
mRef->Release();
return NS_OK;
}
private:
ImageBridgeParent* mRef;
};
void
ImageBridgeParent::DeferredDestroy()
{
mSelfRef = nullptr;
// |this| was just destroyed, hands off
ImageBridgeParent* self;
mSelfRef.forget(&self);
nsCOMPtr<nsIRunnable> runnable = new ReleaseRunnable(self);
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToMainThread(runnable)));
}
IToplevelProtocol*

View File

@ -559,6 +559,19 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
return true;
}
bool
LayerTransactionParent::RecvSetTestSampleTime(const TimeStamp& aTime)
{
return mShadowLayersManager->SetTestSampleTime(this, aTime);
}
bool
LayerTransactionParent::RecvLeaveTestMode()
{
mShadowLayersManager->LeaveTestMode(this);
return true;
}
bool
LayerTransactionParent::RecvGetOpacity(PLayerParent* aParent,
float* aOpacity)

View File

@ -93,6 +93,8 @@ protected:
virtual bool RecvClearCachedResources() MOZ_OVERRIDE;
virtual bool RecvForceComposite() MOZ_OVERRIDE;
virtual bool RecvSetTestSampleTime(const TimeStamp& aTime) MOZ_OVERRIDE;
virtual bool RecvLeaveTestMode() MOZ_OVERRIDE;
virtual bool RecvGetOpacity(PLayerParent* aParent,
float* aOpacity) MOZ_OVERRIDE;
virtual bool RecvGetAnimationTransform(PLayerParent* aParent,

View File

@ -75,12 +75,6 @@ parent:
sync StopFrameTimeRecording(uint32_t startIndex)
returns (float[] intervals);
// Enter test mode, set the sample time to sampleTime, and resample animations.
// sampleTime must not be null.
sync SetTestSampleTime(TimeStamp sampleTime);
// Leave test mode and resume normal compositing
sync LeaveTestMode();
// layersBackendHints is an ordered list of preffered backends where
// layersBackendHints[0] is the best backend. If any hints are LayersBackend::LAYERS_NONE
// that hint is ignored.

View File

@ -82,6 +82,13 @@ parent:
returns (EditReply[] reply);
// Testing APIs
// Enter test mode, set the sample time to sampleTime, and resample
// animations. sampleTime must not be null.
sync SetTestSampleTime(TimeStamp sampleTime);
// Leave test mode and resume normal compositing
sync LeaveTestMode();
sync GetOpacity(PLayer layer) returns (float opacity);
// Returns the value of the transform applied to the layer by animation after

View File

@ -25,6 +25,9 @@ public:
virtual AsyncCompositionManager* GetCompositionManager(LayerTransactionParent* aLayerTree) { return nullptr; }
virtual void ForceComposite(LayerTransactionParent* aLayerTree) { }
virtual bool SetTestSampleTime(LayerTransactionParent* aLayerTree,
const TimeStamp& aTime) { return true; }
virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) { }
};
} // layers

View File

@ -62,6 +62,17 @@ DeprecatedSharedPlanarYCbCrImage::~DeprecatedSharedPlanarYCbCrImage() {
}
}
size_t
SharedPlanarYCbCrImage::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{
// NB: Explicitly skipping mTextureClient, the memory is already reported
// at time of allocation in GfxMemoryImageReporter.
// Not owned:
// - mCompositable
size_t size = PlanarYCbCrImage::SizeOfExcludingThis(aMallocSizeOf);
return size;
}
TextureClient*
SharedPlanarYCbCrImage::GetTextureClient(CompositableClient* aClient)
{

View File

@ -113,6 +113,13 @@ public:
virtual bool IsValid() MOZ_OVERRIDE;
virtual size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE
{
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
private:
RefPtr<BufferTextureClient> mTextureClient;
RefPtr<ImageClient> mCompositable;

View File

@ -71,7 +71,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gonk'):
if (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android') or \
(CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa') or \
(CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk') or \
CONFIG['MOZ_WIDGET_QT'] or \
(CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt') or \
CONFIG['MOZ_WIDGET_GTK']:
DEFINES['SK_FONTHOST_DOES_NOT_USE_FONTMGR'] = 1
@ -321,7 +321,7 @@ def write_mozbuild(includes, sources):
f.write("if CONFIG['MOZ_WIDGET_GTK']:\n")
write_list(f, 'SOURCES', sources['linux'], 4)
f.write("if CONFIG['MOZ_WIDGET_QT']:\n")
f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':\n")
write_list(f, 'SOURCES', sources['linux'], 4)
f.write("if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':\n")

View File

@ -729,7 +729,7 @@ if CONFIG['MOZ_WIDGET_GTK']:
'trunk/src/ports/SkTLS_pthread.cpp',
'trunk/src/utils/SkThreadUtils_pthread.cpp',
]
if CONFIG['MOZ_WIDGET_QT']:
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
SOURCES += [
'trunk/src/ports/SkDebug_stdio.cpp',
'trunk/src/ports/SkFontHost_cairo.cpp',
@ -868,7 +868,7 @@ if CONFIG['INTEL_ARCHITECTURE'] and CONFIG['HAVE_TOOLCHAIN_SUPPORT_MSSSE3']:
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gonk'):
DEFINES['SK_FONTHOST_CAIRO_STANDALONE'] = 0
if (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android') or (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa') or (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk') or CONFIG['MOZ_WIDGET_QT'] or CONFIG['MOZ_WIDGET_GTK']:
if (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android') or (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa') or (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk') or (CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt') or CONFIG['MOZ_WIDGET_GTK']:
DEFINES['SK_FONTHOST_DOES_NOT_USE_FONTMGR'] = 1
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':

View File

@ -158,7 +158,7 @@ namespace FilterWrappers {
Offset(DrawTarget* aDT, FilterNode* aInputFilter, const IntPoint& aOffset)
{
RefPtr<FilterNode> filter = aDT->CreateFilter(FilterType::TRANSFORM);
filter->SetAttribute(ATT_TRANSFORM_MATRIX, Matrix().Translate(aOffset.x, aOffset.y));
filter->SetAttribute(ATT_TRANSFORM_MATRIX, Matrix::Translation(aOffset.x, aOffset.y));
filter->SetInput(IN_TRANSFORM_IN, aInputFilter);
return filter;
}
@ -199,7 +199,7 @@ namespace FilterWrappers {
{
RefPtr<FilterNode> filter = aDT->CreateFilter(FilterType::TRANSFORM);
filter->SetAttribute(ATT_TRANSFORM_MATRIX,
Matrix().Translate(aSurfacePosition.x, aSurfacePosition.y));
Matrix::Translation(aSurfacePosition.x, aSurfacePosition.y));
filter->SetInput(IN_TRANSFORM_IN, aSurface);
return filter;
}

View File

@ -511,10 +511,10 @@ TEST(AsyncPanZoomController, ComplexTransform) {
metrics.mResolution = ParentLayerToLayerScale(2);
metrics.SetZoom(CSSToScreenScale(6));
metrics.mDevPixelsPerCSSPixel = CSSToLayoutDeviceScale(3);
metrics.mScrollId = FrameMetrics::START_SCROLL_ID;
metrics.SetScrollId(FrameMetrics::START_SCROLL_ID);
FrameMetrics childMetrics = metrics;
childMetrics.mScrollId = FrameMetrics::START_SCROLL_ID + 1;
childMetrics.SetScrollId(FrameMetrics::START_SCROLL_ID + 1);
layers[0]->AsContainerLayer()->SetFrameMetrics(metrics);
layers[1]->AsContainerLayer()->SetFrameMetrics(childMetrics);
@ -927,7 +927,7 @@ SetScrollableFrameMetrics(Layer* aLayer, FrameMetrics::ViewID aScrollId,
{
ContainerLayer* container = aLayer->AsContainerLayer();
FrameMetrics metrics;
metrics.mScrollId = aScrollId;
metrics.SetScrollId(aScrollId);
nsIntRect layerBound = aLayer->GetVisibleRegion().GetBounds();
metrics.mCompositionBounds = ParentLayerIntRect(layerBound.x, layerBound.y,
layerBound.width, layerBound.height);

View File

@ -1370,7 +1370,7 @@ SnapshotIterator::allocationReadable(const RValueAllocation &alloc)
return hasRegister(alloc.fpuReg());
case RValueAllocation::TYPED_REG:
return hasRegister(alloc.reg());
return hasRegister(alloc.reg2());
#if defined(JS_NUNBOX32)
case RValueAllocation::UNTYPED_REG_REG:

View File

@ -4622,7 +4622,7 @@ JS::CompileFunction(JSContext *cx, HandleObject obj, const ReadOnlyCompileOption
if (!frontend::CompileFunctionBody(cx, &fun, options, formals, chars, length))
return nullptr;
if (obj && funAtom) {
if (obj && funAtom && options.defineOnScope) {
Rooted<jsid> id(cx, AtomToId(funAtom));
RootedValue value(cx, ObjectValue(*fun));
if (!JSObject::defineGeneric(cx, obj, id, value, nullptr, nullptr, JSPROP_ENUMERATE))

View File

@ -3377,6 +3377,7 @@ class JS_FRIEND_API(ReadOnlyCompileOptions)
column(0),
compileAndGo(false),
forEval(false),
defineOnScope(true),
noScriptRval(false),
selfHostingMode(false),
canLazilyParse(true),
@ -3416,6 +3417,7 @@ class JS_FRIEND_API(ReadOnlyCompileOptions)
unsigned column;
bool compileAndGo;
bool forEval;
bool defineOnScope;
bool noScriptRval;
bool selfHostingMode;
bool canLazilyParse;
@ -3517,6 +3519,7 @@ class JS_FRIEND_API(OwningCompileOptions) : public ReadOnlyCompileOptions
OwningCompileOptions &setColumn(unsigned c) { column = c; return *this; }
OwningCompileOptions &setCompileAndGo(bool cng) { compileAndGo = cng; return *this; }
OwningCompileOptions &setForEval(bool eval) { forEval = eval; return *this; }
OwningCompileOptions &setDefineOnScope(bool define) { defineOnScope = define; return *this; }
OwningCompileOptions &setNoScriptRval(bool nsr) { noScriptRval = nsr; return *this; }
OwningCompileOptions &setSelfHostingMode(bool shm) { selfHostingMode = shm; return *this; }
OwningCompileOptions &setCanLazilyParse(bool clp) { canLazilyParse = clp; return *this; }
@ -3602,6 +3605,7 @@ class MOZ_STACK_CLASS JS_FRIEND_API(CompileOptions) : public ReadOnlyCompileOpti
CompileOptions &setColumn(unsigned c) { column = c; return *this; }
CompileOptions &setCompileAndGo(bool cng) { compileAndGo = cng; return *this; }
CompileOptions &setForEval(bool eval) { forEval = eval; return *this; }
CompileOptions &setDefineOnScope(bool define) { defineOnScope = define; return *this; }
CompileOptions &setNoScriptRval(bool nsr) { noScriptRval = nsr; return *this; }
CompileOptions &setSelfHostingMode(bool shm) { selfHostingMode = shm; return *this; }
CompileOptions &setCanLazilyParse(bool clp) { canLazilyParse = clp; return *this; }

View File

@ -207,6 +207,6 @@ function AsmJSArrayBuffer(size) {
' var i32 = new global.Int32Array(buffer);' +
' function g() {};' +
' return g;' +
''))(this,null,ab);
''))(Function("return this")(),null,ab);
return ab;
}

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