Merge latest green b2g-inbound changeset and mozilla-central

This commit is contained in:
Ed Morley 2013-09-02 14:57:00 +01:00
commit eb75a15901
171 changed files with 1050 additions and 1821 deletions

View File

@ -16,18 +16,6 @@ XPCOMUtils.defineLazyModuleGetter(this,
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
// Bug 671101 - directly using webNavigation in this context
// causes docshells to leak
this.__defineGetter__("webNavigation", function () {
return docShell.QueryInterface(Ci.nsIWebNavigation);
});
addMessageListener("WebNavigation:LoadURI", function (message) {
let flags = message.json.flags || webNavigation.LOAD_FLAGS_NONE;
webNavigation.loadURI(message.json.uri, flags, null, null, null);
});
addMessageListener("Browser:HideSessionRestoreButton", function (message) {
// Hide session restore button on about:home
let doc = content.document;

View File

@ -8,7 +8,6 @@
#include "nsISerializable.idl"
%{C++
struct JSContext;
struct JSPrincipals;
#include "nsCOMPtr.h"
#include "nsTArray.h"

View File

@ -18,13 +18,10 @@
#include "pldhash.h"
#include "plstr.h"
#include "nsIScriptExternalNameSet.h"
#include "js/TypeDecls.h"
#include <stdint.h>
namespace JS {
template <typename T> class Handle;
template <typename T> class MutableHandle;
}
class nsIDocShell;
class nsString;
class nsIClassInfo;

View File

@ -18,6 +18,7 @@
#include <ieeefp.h>
#endif
#include "js/TypeDecls.h"
#include "js/RootingAPI.h"
#include "mozilla/Assertions.h"
#include "mozilla/GuardObjects.h"
@ -92,7 +93,6 @@ class nsTextFragment;
class nsViewportInfo;
class nsWrapperCache;
struct JSContext;
struct JSPropertyDescriptor;
struct JSRuntime;
struct nsIntMargin;
@ -103,10 +103,6 @@ template<class K, class V> class nsDataHashtable;
template<class K, class V> class nsRefPtrHashtable;
template<class T> class nsReadingIterator;
namespace JS {
class Value;
} // namespace JS
namespace mozilla {
class ErrorResult;
class Selection;

View File

@ -19,6 +19,7 @@
#include "mozilla/ErrorResult.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/EventTarget.h" // for base class
#include "js/TypeDecls.h" // for Handle, Value, JSObject, JSContext
// Including 'windows.h' will #define GetClassInfo to something else.
#ifdef XP_WIN
@ -67,11 +68,6 @@ template<typename T> class Optional;
} // namespace dom
} // namespace mozilla
namespace JS {
class Value;
template<typename T> class Handle;
}
#define NODE_FLAG_BIT(n_) (1U << (WRAPPER_CACHE_FLAGS_BITS_USED + (n_)))
enum {

View File

@ -108,8 +108,6 @@ StructuredCloneData UnpackClonedMessageDataForChild(const ClonedMessageData& aDa
} // namespace mozilla
class nsAXPCNativeCallContext;
struct JSContext;
class JSObject;
struct nsMessageListenerInfo
{

View File

@ -8,10 +8,9 @@
#include "nsIContent.h" // for use in inline function (ParentChainChanged)
#include "nsIMutationObserver.h" // for use in inline function (ParentChainChanged)
#include "js/TypeDecls.h"
struct CharacterDataChangeInfo;
struct JSContext;
class JSObject;
class nsIVariant;
class nsIDOMNode;
class nsIDOMUserDataHandler;

View File

@ -9,12 +9,7 @@
#include "WebGLTypes.h"
#include "nsISupports.h"
#include "nsString.h"
struct JSContext;
class JSObject;
namespace JS {
template <typename T> class Handle;
}
#include "js/TypeDecls.h"
namespace mozilla {

View File

@ -18,12 +18,11 @@
#include "mozilla/dom/EventBinding.h"
#include "nsIScriptGlobalObject.h"
#include "Units.h"
#include "js/TypeDecls.h"
class nsIContent;
class nsIDOMEventTarget;
class nsPresContext;
struct JSContext;
class JSObject;
namespace mozilla {
namespace dom {

View File

@ -348,7 +348,7 @@ nsDOMUIEvent::IsChar() const
case NS_KEY_EVENT:
return static_cast<nsKeyEvent*>(mEvent)->isChar;
case NS_TEXT_EVENT:
return static_cast<nsKeyEvent*>(mEvent)->isChar;
return static_cast<nsTextEvent*>(mEvent)->isChar;
default:
return false;
}

View File

@ -8,9 +8,8 @@
#include "nsIDOMHTMLCollection.h"
#include "nsWrapperCache.h"
#include "js/TypeDecls.h"
struct JSContext;
class JSObject;
class nsINode;
class nsString;
template<class> class nsTArray;

View File

@ -5,7 +5,7 @@
#include "mozilla/dom/HTMLCanvasElement.h"
#include "BasicLayers.h"
#include "Layers.h"
#include "imgIEncoder.h"
#include "jsapi.h"
#include "jsfriendapi.h"

View File

@ -54,7 +54,7 @@
#include "nsICachingChannel.h"
#include "nsLayoutUtils.h"
#include "nsVideoFrame.h"
#include "BasicLayers.h"
#include "Layers.h"
#include <limits>
#include "nsIAsyncVerifyRedirectCallback.h"
#include "nsIAppShell.h"

View File

@ -9,9 +9,7 @@
#include "nsIDOMValidityState.h"
#include "nsIConstraintValidation.h"
#include "nsWrapperCache.h"
class JSObject;
struct JSContext;
#include "js/TypeDecls.h"
namespace mozilla {
namespace dom {

View File

@ -174,77 +174,53 @@ AudioBlockPanStereoToStereo_NEON(const float aInputL[WEBAUDIO_BLOCK_SIZE],
ASSERT_ALIGNED(aOutputL);
ASSERT_ALIGNED(aOutputR);
float32x4_t vinL0, vinL1, vinL2, vinL3;
float32x4_t vinR0, vinR1, vinR2, vinR3;
float32x4_t voutL0, voutL1, voutL2, voutL3;
float32x4_t voutR0, voutR1, voutR2, voutR3;
float32x4_t vinL0, vinL1;
float32x4_t vinR0, vinR1;
float32x4_t voutL0, voutL1;
float32x4_t voutR0, voutR1;
float32x4_t vscaleL = vmovq_n_f32(aGainL);
float32x4_t vscaleR = vmovq_n_f32(aGainR);
if (aIsOnTheLeft) {
for (uint32_t i = 0; i < WEBAUDIO_BLOCK_SIZE; i+=16) {
for (uint32_t i = 0; i < WEBAUDIO_BLOCK_SIZE; i+=8) {
vinL0 = vld1q_f32(ADDRESS_OF(aInputL, i));
vinL1 = vld1q_f32(ADDRESS_OF(aInputL, i+4));
vinL2 = vld1q_f32(ADDRESS_OF(aInputL, i+8));
vinL3 = vld1q_f32(ADDRESS_OF(aInputL, i+12));
vinR0 = vld1q_f32(ADDRESS_OF(aInputR, i));
vinR1 = vld1q_f32(ADDRESS_OF(aInputR, i+4));
vinR2 = vld1q_f32(ADDRESS_OF(aInputR, i+8));
vinR3 = vld1q_f32(ADDRESS_OF(aInputR, i+12));
voutL0 = vmlaq_f32(vinL0, vinR0, vscaleL);
voutL1 = vmlaq_f32(vinL1, vinR1, vscaleL);
voutL2 = vmlaq_f32(vinL2, vinR2, vscaleL);
voutL3 = vmlaq_f32(vinL3, vinR3, vscaleL);
vst1q_f32(ADDRESS_OF(aOutputL, i), voutL0);
vst1q_f32(ADDRESS_OF(aOutputL, i+4), voutL1);
vst1q_f32(ADDRESS_OF(aOutputL, i+8), voutL2);
vst1q_f32(ADDRESS_OF(aOutputL, i+12), voutL3);
voutR0 = vmulq_f32(vinR0, vscaleR);
voutR1 = vmulq_f32(vinR1, vscaleR);
voutR2 = vmulq_f32(vinR2, vscaleR);
voutR3 = vmulq_f32(vinR3, vscaleR);
vst1q_f32(ADDRESS_OF(aOutputR, i), voutR0);
vst1q_f32(ADDRESS_OF(aOutputR, i+4), voutR1);
vst1q_f32(ADDRESS_OF(aOutputR, i+8), voutR2);
vst1q_f32(ADDRESS_OF(aOutputR, i+12), voutR3);
}
} else {
for (uint32_t i = 0; i < WEBAUDIO_BLOCK_SIZE; i+=16) {
for (uint32_t i = 0; i < WEBAUDIO_BLOCK_SIZE; i+=8) {
vinL0 = vld1q_f32(ADDRESS_OF(aInputL, i));
vinL1 = vld1q_f32(ADDRESS_OF(aInputL, i+4));
vinL2 = vld1q_f32(ADDRESS_OF(aInputL, i+8));
vinL3 = vld1q_f32(ADDRESS_OF(aInputL, i+12));
vinR0 = vld1q_f32(ADDRESS_OF(aInputR, i));
vinR1 = vld1q_f32(ADDRESS_OF(aInputR, i+4));
vinR2 = vld1q_f32(ADDRESS_OF(aInputR, i+8));
vinR3 = vld1q_f32(ADDRESS_OF(aInputR, i+12));
voutL0 = vmulq_f32(vinL0, vscaleL);
voutL1 = vmulq_f32(vinL1, vscaleL);
voutL2 = vmulq_f32(vinL2, vscaleL);
voutL3 = vmulq_f32(vinL3, vscaleL);
vst1q_f32(ADDRESS_OF(aOutputL, i), voutL0);
vst1q_f32(ADDRESS_OF(aOutputL, i+4), voutL1);
vst1q_f32(ADDRESS_OF(aOutputL, i+8), voutL2);
vst1q_f32(ADDRESS_OF(aOutputL, i+12), voutL3);
voutR0 = vmlaq_f32(vinR0, vinL0, vscaleR);
voutR1 = vmlaq_f32(vinR1, vinL1, vscaleR);
voutR2 = vmlaq_f32(vinR2, vinL2, vscaleR);
voutR3 = vmlaq_f32(vinR3, vinL3, vscaleR);
vst1q_f32(ADDRESS_OF(aOutputR, i), voutR0);
vst1q_f32(ADDRESS_OF(aOutputR, i+4), voutR1);
vst1q_f32(ADDRESS_OF(aOutputR, i+8), voutR2);
vst1q_f32(ADDRESS_OF(aOutputR, i+12), voutR3);
}
}
}
}
}

View File

@ -14,9 +14,7 @@
#include "nsAutoPtr.h"
#include "nsTArray.h"
#include "AudioContext.h"
struct JSContext;
class JSObject;
#include "js/TypeDecls.h"
namespace mozilla {

View File

@ -17,6 +17,7 @@
#include "nsDOMEventTargetHelper.h"
#include "nsHashKeys.h"
#include "nsTHashtable.h"
#include "js/TypeDecls.h"
// X11 has a #define for CurrentTime. Unbelievable :-(.
// See content/media/DOMMediaStream.h for more fun!
@ -24,8 +25,6 @@
#undef CurrentTime
#endif
struct JSContext;
class JSObject;
class nsPIDOMWindow;
namespace mozilla {

View File

@ -16,8 +16,7 @@
#include "AudioContext.h"
#include "PannerNode.h"
#include "WebAudioUtils.h"
struct JSContext;
#include "js/TypeDecls.h"
namespace mozilla {

View File

@ -15,8 +15,7 @@
#include "AudioNode.h"
#include "mozilla/dom/TypedArray.h"
#include "WebAudioUtils.h"
struct JSContext;
#include "js/TypeDecls.h"
namespace mozilla {

View File

@ -38,9 +38,7 @@ DelayProcessor::Process(const double *aPerFrameDelays,
0.0, static_cast<double>(mMaxDelayFrames));
// Write the input sample to the correct location in our buffer
if (input) {
buffer[writeIndex] = input[i];
}
buffer[writeIndex] = input ? input[i] : 0.0f;
// Now, determine the correct read position. We adjust the read position to be
// from currentDelayFrames frames in the past. We also interpolate the two input
@ -109,7 +107,10 @@ DelayProcessor::EnsureBuffer(uint32_t aNumberOfChannels)
if (!mBuffer.SetLength(aNumberOfChannels)) {
return false;
}
const int numFrames = mMaxDelayFrames;
// The length of the buffer is one greater than the maximum delay so that
// writing an input frame does not overwrite the frame that would
// subsequently be read at maximum delay.
const int numFrames = mMaxDelayFrames + 1;
for (uint32_t channel = 0; channel < aNumberOfChannels; ++channel) {
if (!mBuffer[channel].SetLength(numFrames)) {
return false;

View File

@ -57,9 +57,11 @@ MOCHITEST_FILES := \
test_channelSplitterNode.html \
test_channelSplitterNodeWithVolume.html \
test_convolverNode.html \
test_convolverNodeWithGain.html \
test_convolverNode_mono_mono.html \
test_currentTime.html \
test_delayNode.html \
test_delayNodeAtMax.html \
test_delayNodeSmallMaxDelay.html \
test_delayNodeWithGain.html \
test_dynamicsCompressorNode.html \

View File

@ -0,0 +1,62 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test ConvolverNode after a GainNode - Bug 891254 </title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script src="webaudio.js" type="text/javascript"></script>
<script class="testbody" type="text/javascript">
const signalLength = 2048;
const responseLength = 100;
const outputLength = 4096; // > signalLength + responseLength
var gTest = {
length: outputLength,
numberOfChannels: 1,
createGraph: function(context) {
var buffer = context.createBuffer(1, signalLength, context.sampleRate);
for (var i = 0; i < signalLength; ++i) {
buffer.getChannelData(0)[i] = Math.sin(2 * Math.PI * i / signalLength);
}
var source = context.createBufferSource();
source.buffer = buffer;
source.start(0);
var response = context.createBuffer(1, responseLength, context.sampleRate);
for (var i = 0; i < responseLength; ++i) {
response.getChannelData(0)[i] = i / responseLength;
}
var gain = context.createGain();
gain.gain.value = -1;
source.connect(gain);
var convolver1 = context.createConvolver();
convolver1.buffer = response;
gain.connect(convolver1);
var convolver2 = context.createConvolver();
convolver2.buffer = response;
source.connect(convolver2);
// The output of convolver1 should be the inverse of convolver2, so blend
// them together and expect silence.
var blend = context.createGain();
convolver1.connect(blend);
convolver2.connect(blend);
return blend;
},
};
runTest();
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,53 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test DelayNode with maxDelayTime delay - bug 890528</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<pre id="test">
<script src="webaudio.js" type="text/javascript"></script>
<script class="testbody" type="text/javascript">
const signalLength = 2048;
const delayLength = 1000; // Not on a block boundary
const outputLength = 4096 // > signalLength + 2 * delayLength;
function applySignal(buffer, offset) {
for (var i = 0; i < signalLength; ++i) {
buffer.getChannelData(0)[offset + i] = Math.cos(Math.PI * i / signalLength);
}
}
var gTest = {
numberOfChannels: 1,
createGraph: function(context) {
var buffer = context.createBuffer(1, signalLength, context.sampleRate);
applySignal(buffer, 0);
var source = context.createBufferSource();
source.buffer = buffer;
const delayTime = delayLength / context.sampleRate;
var delay = context.createDelay(delayTime);
delay.delayTime.value = delayTime;
source.connect(delay);
source.start(0);
return delay;
},
createExpectedBuffers: function(context) {
var expectedBuffer = context.createBuffer(1, outputLength, context.sampleRate);
applySignal(expectedBuffer, delayLength);
return expectedBuffer;
},
};
runTest();
</script>
</pre>
</body>
</html>

View File

@ -68,8 +68,6 @@ function getEmptyBuffer(context, length) {
* This function assumes that the test file defines a single gTest variable with
* the following properties and methods:
*
* + length: mandatory property equal to the total number of frames which we
* are waiting to see in the output.
* + numberOfChannels: optional property which specifies the number of channels
* in the output. The default value is 2.
* + createGraph: mandatory method which takes a context object and does
@ -84,9 +82,17 @@ function getEmptyBuffer(context, length) {
* returns either one expected buffer or an array of
* them, designating what is expected to be observed
* in the output. If omitted, the output is expected
* to be silence. The sum of the length of the expected
* buffers should be equal to gTest.length. This
* function is guaranteed to be called before createGraph.
* to be silence. All buffers must have the same
* length, which must be a bufferSize supported by
* ScriptProcessorNode. This function is guaranteed
* to be called before createGraph.
* + length: property equal to the total number of frames which we are waiting
* to see in the output, mandatory if createExpectedBuffers is not
* provided, in which case it must be a bufferSize supported by
* ScriptProcessorNode (256, 512, 1024, 2048, 4096, 8192, or 16384).
* If createExpectedBuffers is provided then this must be equal to
* the number of expected buffers * the expected buffer length.
*
* + skipOfflineContextTests: optional. when true, skips running tests on an offline
* context by circumventing testOnOfflineContext.
*/
@ -120,7 +126,9 @@ function runTest()
"Correct number of channels for expected buffer " + i);
expectedFrames += expectedBuffers[i].length;
}
is(expectedFrames, gTest.length, "Correct number of expected frames");
if (gTest.length && gTest.createExpectedBuffers) {
is(expectedFrames, gTest.length, "Correct number of expected frames");
}
if (gTest.createGraphAsync) {
gTest.createGraphAsync(context, function(nodeToInspect) {

View File

@ -10,14 +10,13 @@
#include "nsCycleCollectionParticipant.h"
#include "nsString.h"
#include "nsWrapperCache.h"
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "mozilla/ErrorResult.h"
#include "EnableWebSpeechRecognitionCheck.h"
struct JSContext;
namespace mozilla {
namespace dom {

View File

@ -9,6 +9,7 @@
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "mozilla/dom/BindingUtils.h"
@ -16,8 +17,6 @@
#include "EnableWebSpeechRecognitionCheck.h"
#include "SpeechGrammar.h"
struct JSContext;
namespace mozilla {
namespace dom {

View File

@ -12,6 +12,7 @@
#include "nsString.h"
#include "nsWrapperCache.h"
#include "nsTArray.h"
#include "js/TypeDecls.h"
#include "nsIDOMNavigatorUserMedia.h"
#include "nsITimer.h"
@ -30,7 +31,6 @@
#include "mozilla/dom/SpeechRecognitionError.h"
struct JSContext;
class nsIDOMWindow;
namespace mozilla {

View File

@ -10,13 +10,12 @@
#include "nsString.h"
#include "nsWrapperCache.h"
#include "nsAutoPtr.h"
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "EnableWebSpeechRecognitionCheck.h"
struct JSContext;
namespace mozilla {
namespace dom {

View File

@ -11,14 +11,13 @@
#include "nsWrapperCache.h"
#include "nsAutoPtr.h"
#include "nsTArray.h"
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "EnableWebSpeechRecognitionCheck.h"
#include "SpeechRecognitionAlternative.h"
struct JSContext;
namespace mozilla {
namespace dom {

View File

@ -10,14 +10,13 @@
#include "nsWrapperCache.h"
#include "nsAutoPtr.h"
#include "nsTArray.h"
#include "js/TypeDecls.h"
#include "mozilla/Attributes.h"
#include "EnableWebSpeechRecognitionCheck.h"
#include "SpeechRecognitionResult.h"
struct JSContext;
namespace mozilla {
namespace dom {

View File

@ -10,12 +10,12 @@
#include "nsString.h"
#include "nsWrapperCache.h"
#include "nsRefPtrHashtable.h"
#include "js/TypeDecls.h"
#include "EnableSpeechSynthesisCheck.h"
#include "SpeechSynthesisUtterance.h"
#include "SpeechSynthesisVoice.h"
struct JSContext;
class nsIDOMWindow;
namespace mozilla {

View File

@ -9,12 +9,11 @@
#include "nsCOMPtr.h"
#include "nsDOMEventTargetHelper.h"
#include "nsString.h"
#include "js/TypeDecls.h"
#include "EnableSpeechSynthesisCheck.h"
#include "nsSpeechTask.h"
struct JSContext;
namespace mozilla {
namespace dom {

View File

@ -9,12 +9,11 @@
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsWrapperCache.h"
#include "js/TypeDecls.h"
#include "EnableSpeechSynthesisCheck.h"
#include "nsISpeechService.h"
struct JSContext;
namespace mozilla {
namespace dom {

View File

@ -15,6 +15,7 @@
#include "nsTArray.h"
#include "nsCycleCollectionParticipant.h"
#include "nsISupportsImpl.h"
#include "js/TypeDecls.h"
class nsXBLPrototypeBinding;
class nsIContent;
@ -31,8 +32,6 @@ class XBLChildrenElement;
}
class nsAnonymousContentList;
struct JSContext;
class JSObject;
// *********************************************************************/
// The XBLBinding class

View File

@ -15,8 +15,8 @@
#include "nsIWeakReference.h"
#include "nsIScriptGlobalObject.h"
#include "nsCycleCollectionParticipant.h"
#include "js/TypeDecls.h"
class JSObject;
class nsIDOMEvent;
class nsIContent;
class nsIDOMUIEvent;
@ -26,10 +26,6 @@ class nsIObjectInputStream;
class nsIObjectOutputStream;
class nsXBLPrototypeBinding;
namespace JS {
template <typename T> class MutableHandle;
}
namespace mozilla {
namespace dom {
class EventTarget;

View File

@ -9,11 +9,7 @@
#include "nsIObjectInputStream.h"
#include "nsIObjectOutputStream.h"
#include "nsINameSpaceManager.h"
namespace JS {
template <typename T> class Handle;
template <typename T> class MutableHandle;
}
#include "js/TypeDecls.h"
typedef uint8_t XBLBindingSerializeDetails;

View File

@ -25,6 +25,8 @@
#include "mozilla/Attributes.h"
#include "js/TypeDecls.h"
class nsIRDFResource;
class nsIRDFService;
class nsPIWindowRoot;
@ -40,7 +42,6 @@ class nsIXULPrototypeScript;
#include "nsURIHashKey.h"
#include "nsInterfaceHashtable.h"
class JSObject;
struct JSTracer;
struct PRLogModuleInfo;

View File

@ -9,9 +9,9 @@
#include "nsIAtom.idl"
%{ C++
#include "js/TypeDecls.h"
class nsPresContext;
class nsIPresShell;
struct JSContext;
%}
/**

View File

@ -8,8 +8,7 @@
#include "nsISupports.h"
#include "nsIScriptObjectPrincipal.h"
class JSObject;
#include "js/TypeDecls.h"
#define NS_IGLOBALOBJECT_IID \
{ 0x8503e9a9, 0x530, 0x4b26, \

View File

@ -10,11 +10,11 @@
#include "nsISupports.h"
#include "nsEvent.h"
#include "nsIGlobalObject.h"
#include "js/TypeDecls.h"
class nsIScriptContext;
class nsScriptErrorEvent;
class nsIScriptGlobalObject;
class JSObject;
// A helper function for nsIScriptGlobalObject implementations to use
// when handling a script error. Generally called by the global when a context

View File

@ -7,10 +7,8 @@
#define nsIScriptTimeoutHandler_h___
#include "nsTArray.h"
#include "js/TypeDecls.h"
namespace JS {
class Value;
} // namespace JS
namespace mozilla {
namespace dom {
class Function;

View File

@ -12,10 +12,10 @@
#include "nsIWeakReferenceUtils.h"
#include "nsWrapperCache.h"
#include "nsCycleCollectionParticipant.h"
#include "js/TypeDecls.h"
class nsIURI;
class nsIDocShell;
struct JSContext;
class nsIDocShellLoadInfo;
//*****************************************************************************

View File

@ -14,12 +14,12 @@
#include "nsAutoPtr.h"
#include "nsTArray.h"
#include "mozilla/dom/EventTarget.h"
#include "js/TypeDecls.h"
#define DOM_WINDOW_DESTROYED_TOPIC "dom-window-destroyed"
#define DOM_WINDOW_FROZEN_TOPIC "dom-window-frozen"
#define DOM_WINDOW_THAWED_TOPIC "dom-window-thawed"
class JSObject;
class nsIArray;
class nsIContent;
class nsIDocShell;
@ -33,10 +33,6 @@ class nsPIWindowRoot;
class nsXBLPrototypeHandler;
struct nsTimeout;
namespace JS {
template<typename> class Handle;
}
namespace mozilla {
namespace dom {
class AudioContext;

View File

@ -13,7 +13,6 @@
class nsPIDOMWindow;
class nsIControllers;
class nsIController;
struct JSContext;
#define NS_IWINDOWROOT_IID \
{ 0x3f71f50c, 0xa7e0, 0x43bc, \

View File

@ -12,11 +12,10 @@
#include "nsDOMNavigationTiming.h"
#include "nsContentUtils.h"
#include "nsIDOMWindow.h"
#include "js/TypeDecls.h"
class nsITimedChannel;
class nsPerformance;
class JSObject;
struct JSContext;
// Script "performance.timing" object
class nsPerformanceTiming MOZ_FINAL : public nsWrapperCache

View File

@ -13,8 +13,6 @@
#include "js/RootingAPI.h"
struct JSTracer;
class JSObject;
struct JSContext;
class XPCWrappedNativeScope;
namespace mozilla {

View File

@ -23,8 +23,6 @@
#include "nsTArray.h"
#include "nsAutoPtr.h" // for nsRefPtr member variables
struct JSContext;
class JSObject;
class nsWrapperCache;
// nsGlobalWindow implements nsWrapperCache, but doesn't always use it. Don't

View File

@ -9,13 +9,7 @@
#ifndef mozilla_dom_Date_h
#define mozilla_dom_Date_h
class JSObject;
struct JSContext;
namespace JS {
class Value;
template<typename> class MutableHandle;
} // namespace JS
#include "js/TypeDecls.h"
namespace mozilla {
namespace dom {

View File

@ -18,8 +18,6 @@
#include "nsStringGlue.h"
#include "mozilla/Assertions.h"
struct JSContext;
namespace mozilla {
namespace dom {

View File

@ -8,9 +8,7 @@
#define mozilla_dom_bluetooth_bluetoothutils_h__
#include "BluetoothCommon.h"
struct JSContext;
class JSObject;
#include "js/TypeDecls.h"
BEGIN_BLUETOOTH_NAMESPACE

View File

@ -10,9 +10,7 @@
#include "mozilla/ErrorResult.h"
#include "nsDOMEventTargetHelper.h"
#include "nsICellBroadcastProvider.h"
class JSObject;
struct JSContext;
#include "js/TypeDecls.h"
class nsPIDOMWindow;

View File

@ -5,10 +5,6 @@
#include "domstubs.idl"
%{ C++
struct JSContext;
%}
[scriptable, uuid(55226663-fe68-48ba-addf-08e32eaab569)]
interface nsIDOMHistory : nsISupports
{

View File

@ -11,7 +11,7 @@ interface nsIVariant;
interface nsIDocument;
%{C++
struct JSContext;
#include "js/TypeDecls.h"
%}
/**

View File

@ -8,6 +8,7 @@
%{C++
#include "nsEvent.h"
#include "mozilla/dom/Nullable.h"
#include "js/TypeDecls.h"
using mozilla::dom::Nullable;
@ -20,7 +21,6 @@ class EventTarget;
class nsPresContext;
class nsEventChainPreVisitor;
class nsEventChainPostVisitor;
struct JSContext;
class nsEventListenerManager;
%}

View File

@ -13,7 +13,7 @@ interface nsIScriptGlobalObject;
[ptr] native JSContext(JSContext);
%{C++
namespace JS { class Value; }
#include "js/TypeDecls.h"
%}
/**

View File

@ -8,7 +8,7 @@
#include "TabChild.h"
#include "BasicLayers.h"
#include "Layers.h"
#include "Blob.h"
#include "ContentChild.h"
#include "IndexedDBChild.h"

View File

@ -22,10 +22,9 @@
#include "nsITabParent.h"
#include "nsWeakReference.h"
#include "Units.h"
#include "js/TypeDecls.h"
struct gfxMatrix;
struct JSContext;
class JSObject;
class mozIApplication;
class nsFrameLoader;
class nsIURI;

View File

@ -11,8 +11,6 @@
{ 0x41a77ec8, 0xfd86, 0x409e, { 0xae, 0xa9, 0xaf, 0x2c, 0xa4, 0x07, 0xef, 0x8e } }
class nsITCPServerSocketInternal;
struct JSContext;
struct JSObject;
namespace mozilla {
namespace dom {

View File

@ -10,9 +10,6 @@
#include "nsCOMPtr.h"
#include "nsIDOMTCPSocket.h"
struct JSContext;
struct JSObject;
namespace mozilla {
namespace dom {

View File

@ -6,13 +6,12 @@
#include "nsITCPSocketChild.h"
#include "nsCycleCollectionParticipant.h"
#include "nsCOMPtr.h"
#include "js/TypeDecls.h"
#define TCPSOCKETCHILD_CID \
{ 0xa589d96f, 0x7e09, 0x4edf, { 0xa0, 0x1a, 0xeb, 0x49, 0x51, 0xf4, 0x2f, 0x37 } }
class nsITCPSocketInternal;
struct JSContext;
class JSObject;
namespace mozilla {
namespace dom {

View File

@ -7,9 +7,7 @@
#include "nsCycleCollectionParticipant.h"
#include "nsCOMPtr.h"
#include "nsIDOMTCPSocket.h"
struct JSContext;
class JSObject;
#include "js/TypeDecls.h"
#define TCPSOCKETPARENT_CID \
{ 0x4e7246c6, 0xa8b3, 0x426d, { 0x9c, 0x17, 0x76, 0xda, 0xb1, 0xe1, 0xe1, 0x4a } }

View File

@ -16,6 +16,7 @@
#include "nsInterfaceHashtable.h"
#include "nsHashKeys.h"
#include <prinrval.h>
#include "js/TypeDecls.h"
#ifdef MOZ_WIDGET_ANDROID
#include "nsAutoPtr.h"
#include "nsIRunnable.h"
@ -30,8 +31,6 @@ class SharedPluginTexture;
#include "mozilla/TimeStamp.h"
#include "mozilla/PluginLibrary.h"
class JSObject;
class nsPluginStreamListenerPeer; // browser-initiated stream class
class nsNPAPIPluginStreamListener; // plugin-initiated stream class
class nsIPluginInstanceOwner;

View File

@ -15,8 +15,7 @@
#include "nsWrapperCache.h"
#include "nsAutoPtr.h"
#include "nsPIDOMWindow.h"
struct JSContext;
#include "js/TypeDecls.h"
namespace mozilla {
namespace dom {

View File

@ -12,8 +12,7 @@
#include "mozilla/dom/BindingDeclarations.h"
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
struct JSContext;
#include "js/TypeDecls.h"
namespace mozilla {
namespace dom {

View File

@ -14,8 +14,7 @@
#include "nsCycleCollectionParticipant.h"
#include "nsWrapperCache.h"
#include "mozilla/dom/Nullable.h"
struct JSContext;
#include "js/TypeDecls.h"
////////////////////////////////////////////////////
// nsGeoPositionCoords

View File

@ -93,7 +93,6 @@ MOCHITEST_FILES = \
test_xhr_parameters.js \
test_xhr_system.html \
test_xhr_system.js \
test_xhr_timeout.html \
test_blobConstructor.html \
test_csp.html \
test_csp.js \
@ -109,6 +108,13 @@ MOCHITEST_FILES = \
url_worker.js \
$(NULL)
# Bug 842386 - Disabled on OSX due to intermittent failures.
ifneq ($(OS_ARCH), Darwin)
MOCHITEST_FILES += \
test_xhr_timeout.html \
$(NULL)
endif
MOCHITEST_CHROME_FILES = \
test_chromeWorker.xul \
test_chromeWorkerJSM.xul \

View File

@ -17,6 +17,7 @@
#include "nsIPromptFactory.h"
#include "nsPIWindowWatcher.h"
#include "nsTArray.h"
#include "js/TypeDecls.h"
class nsIURI;
class nsIDocShellTreeItem;
@ -26,8 +27,6 @@ class nsString;
class nsWatcherWindowEnumerator;
class nsIScriptContext;
class nsPromptService;
struct JSContext;
class JSObject;
struct nsWatcherWindowEntry;
struct SizeSpec;

View File

@ -712,6 +712,121 @@ ContainerLayer::ContainerLayer(LayerManager* aManager, void* aImplData)
ContainerLayer::~ContainerLayer() {}
void
ContainerLayer::InsertAfter(Layer* aChild, Layer* aAfter)
{
NS_ASSERTION(aChild->Manager() == Manager(),
"Child has wrong manager");
NS_ASSERTION(!aChild->GetParent(),
"aChild already in the tree");
NS_ASSERTION(!aChild->GetNextSibling() && !aChild->GetPrevSibling(),
"aChild already has siblings?");
NS_ASSERTION(!aAfter ||
(aAfter->Manager() == Manager() &&
aAfter->GetParent() == this),
"aAfter is not our child");
aChild->SetParent(this);
if (aAfter == mLastChild) {
mLastChild = aChild;
}
if (!aAfter) {
aChild->SetNextSibling(mFirstChild);
if (mFirstChild) {
mFirstChild->SetPrevSibling(aChild);
}
mFirstChild = aChild;
NS_ADDREF(aChild);
DidInsertChild(aChild);
return;
}
Layer* next = aAfter->GetNextSibling();
aChild->SetNextSibling(next);
aChild->SetPrevSibling(aAfter);
if (next) {
next->SetPrevSibling(aChild);
}
aAfter->SetNextSibling(aChild);
NS_ADDREF(aChild);
DidInsertChild(aChild);
}
void
ContainerLayer::RemoveChild(Layer *aChild)
{
NS_ASSERTION(aChild->Manager() == Manager(),
"Child has wrong manager");
NS_ASSERTION(aChild->GetParent() == this,
"aChild not our child");
Layer* prev = aChild->GetPrevSibling();
Layer* next = aChild->GetNextSibling();
if (prev) {
prev->SetNextSibling(next);
} else {
this->mFirstChild = next;
}
if (next) {
next->SetPrevSibling(prev);
} else {
this->mLastChild = prev;
}
aChild->SetNextSibling(nullptr);
aChild->SetPrevSibling(nullptr);
aChild->SetParent(nullptr);
this->DidRemoveChild(aChild);
NS_RELEASE(aChild);
}
void
ContainerLayer::RepositionChild(Layer* aChild, Layer* aAfter)
{
NS_ASSERTION(aChild->Manager() == Manager(),
"Child has wrong manager");
NS_ASSERTION(aChild->GetParent() == this,
"aChild not our child");
NS_ASSERTION(!aAfter ||
(aAfter->Manager() == Manager() &&
aAfter->GetParent() == this),
"aAfter is not our child");
Layer* prev = aChild->GetPrevSibling();
Layer* next = aChild->GetNextSibling();
if (prev == aAfter) {
// aChild is already in the correct position, nothing to do.
return;
}
if (prev) {
prev->SetNextSibling(next);
}
if (next) {
next->SetPrevSibling(prev);
}
if (!aAfter) {
aChild->SetPrevSibling(nullptr);
aChild->SetNextSibling(mFirstChild);
if (mFirstChild) {
mFirstChild->SetPrevSibling(aChild);
}
mFirstChild = aChild;
return;
}
Layer* afterNext = aAfter->GetNextSibling();
if (afterNext) {
afterNext->SetPrevSibling(aChild);
} else {
mLastChild = aChild;
}
aAfter->SetNextSibling(aChild);
aChild->SetPrevSibling(aAfter);
aChild->SetNextSibling(afterNext);
}
void
ContainerLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
{
@ -827,6 +942,16 @@ ContainerLayer::ComputeEffectiveTransformsForChildren(const gfx3DMatrix& aTransf
}
}
/* static */ bool
ContainerLayer::HasOpaqueAncestorLayer(Layer* aLayer)
{
for (Layer* l = aLayer->GetParent(); l; l = l->GetParent()) {
if (l->GetContentFlags() & Layer::CONTENT_OPAQUE)
return true;
}
return false;
}
void
ContainerLayer::DidRemoveChild(Layer* aLayer)
{

View File

@ -1411,13 +1411,13 @@ public:
* If aAfter is non-null, it must be a child of this container and
* we insert after that layer. If it's null we insert at the start.
*/
virtual void InsertAfter(Layer* aChild, Layer* aAfter) = 0;
virtual void InsertAfter(Layer* aChild, Layer* aAfter);
/**
* CONSTRUCTION PHASE ONLY
* Remove aChild from the child list of this container. aChild must
* be a child of this container.
*/
virtual void RemoveChild(Layer* aChild) = 0;
virtual void RemoveChild(Layer* aChild);
/**
* CONSTRUCTION PHASE ONLY
* Reposition aChild from the child list of this container. aChild must
@ -1425,7 +1425,7 @@ public:
* If aAfter is non-null, it must be a child of this container and we
* reposition after that layer. If it's null, we reposition at the start.
*/
virtual void RepositionChild(Layer* aChild, Layer* aAfter) = 0;
virtual void RepositionChild(Layer* aChild, Layer* aAfter);
/**
* CONSTRUCTION PHASE ONLY
@ -1530,6 +1530,8 @@ public:
protected:
friend class ReadbackProcessor;
static bool HasOpaqueAncestorLayer(Layer* aLayer);
void DidInsertChild(Layer* aLayer);
void DidRemoveChild(Layer* aLayer);

View File

@ -15,6 +15,9 @@
#include "nsISupportsImpl.h" // for Layer::AddRef, etc
#include "nsPoint.h" // for nsIntPoint
#include "nsRect.h" // for nsIntRect
#include "gfx3DMatrix.h" // for gfx3DMatrix
#include "gfxMatrix.h" // for gfxMatrix
#include "nsRegion.h" // for nsIntRegion
using namespace mozilla::gfx;
@ -24,12 +27,48 @@ namespace layers {
BasicContainerLayer::~BasicContainerLayer()
{
while (mFirstChild) {
ContainerRemoveChild(mFirstChild, this);
ContainerLayer::RemoveChild(mFirstChild);
}
MOZ_COUNT_DTOR(BasicContainerLayer);
}
void
BasicContainerLayer::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface)
{
// We push groups for container layers if we need to, which always
// are aligned in device space, so it doesn't really matter how we snap
// containers.
gfxMatrix residual;
gfx3DMatrix idealTransform = GetLocalTransform()*aTransformToSurface;
idealTransform.ProjectTo2D();
if (!idealTransform.CanDraw2D()) {
mEffectiveTransform = idealTransform;
ComputeEffectiveTransformsForChildren(gfx3DMatrix());
ComputeEffectiveTransformForMaskLayer(gfx3DMatrix());
mUseIntermediateSurface = true;
return;
}
mEffectiveTransform = SnapTransformTranslation(idealTransform, &residual);
// We always pass the ideal matrix down to our children, so there is no
// need to apply any compensation using the residual from SnapTransformTranslation.
ComputeEffectiveTransformsForChildren(idealTransform);
ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
/* If we have a single child, it can just inherit our opacity,
* otherwise we need a PushGroup and we need to mark ourselves as using
* an intermediate surface so our children don't inherit our opacity
* via GetEffectiveOpacity.
* Having a mask layer always forces our own push group
*/
mUseIntermediateSurface =
GetMaskLayer() || (GetEffectiveOpacity() != 1.0 &&
HasMultipleChildren());
}
bool
BasicContainerLayer::ChildrenPartitionVisibleRegion(const nsIntRect& aInRect)
{

View File

@ -9,181 +9,15 @@
#include "BasicImplData.h" // for BasicImplData
#include "BasicLayers.h" // for BasicLayerManager
#include "Layers.h" // for Layer, ContainerLayer
#include "gfx3DMatrix.h" // for gfx3DMatrix
#include "gfxMatrix.h" // for gfxMatrix
#include "nsDebug.h" // for NS_ASSERTION
#include "nsISupportsUtils.h" // for NS_ADDREF, NS_RELEASE
#include "nsRegion.h" // for nsIntRegion
#include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR
struct nsIntRect;
namespace mozilla {
namespace layers {
template<class Container> void
ContainerInsertAfter(Layer* aChild, Layer* aAfter, Container* aContainer)
{
NS_ASSERTION(aChild->Manager() == aContainer->Manager(),
"Child has wrong manager");
NS_ASSERTION(!aChild->GetParent(),
"aChild already in the tree");
NS_ASSERTION(!aChild->GetNextSibling() && !aChild->GetPrevSibling(),
"aChild already has siblings?");
NS_ASSERTION(!aAfter ||
(aAfter->Manager() == aContainer->Manager() &&
aAfter->GetParent() == aContainer),
"aAfter is not our child");
aChild->SetParent(aContainer);
if (aAfter == aContainer->mLastChild) {
aContainer->mLastChild = aChild;
}
if (!aAfter) {
aChild->SetNextSibling(aContainer->mFirstChild);
if (aContainer->mFirstChild) {
aContainer->mFirstChild->SetPrevSibling(aChild);
}
aContainer->mFirstChild = aChild;
NS_ADDREF(aChild);
aContainer->DidInsertChild(aChild);
return;
}
Layer* next = aAfter->GetNextSibling();
aChild->SetNextSibling(next);
aChild->SetPrevSibling(aAfter);
if (next) {
next->SetPrevSibling(aChild);
}
aAfter->SetNextSibling(aChild);
NS_ADDREF(aChild);
aContainer->DidInsertChild(aChild);
}
template<class Container> void
ContainerRemoveChild(Layer* aChild, Container* aContainer)
{
NS_ASSERTION(aChild->Manager() == aContainer->Manager(),
"Child has wrong manager");
NS_ASSERTION(aChild->GetParent() == aContainer,
"aChild not our child");
Layer* prev = aChild->GetPrevSibling();
Layer* next = aChild->GetNextSibling();
if (prev) {
prev->SetNextSibling(next);
} else {
aContainer->mFirstChild = next;
}
if (next) {
next->SetPrevSibling(prev);
} else {
aContainer->mLastChild = prev;
}
aChild->SetNextSibling(nullptr);
aChild->SetPrevSibling(nullptr);
aChild->SetParent(nullptr);
aContainer->DidRemoveChild(aChild);
NS_RELEASE(aChild);
}
template<class Container> void
ContainerRepositionChild(Layer* aChild, Layer* aAfter, Container* aContainer)
{
NS_ASSERTION(aChild->Manager() == aContainer->Manager(),
"Child has wrong manager");
NS_ASSERTION(aChild->GetParent() == aContainer,
"aChild not our child");
NS_ASSERTION(!aAfter ||
(aAfter->Manager() == aContainer->Manager() &&
aAfter->GetParent() == aContainer),
"aAfter is not our child");
Layer* prev = aChild->GetPrevSibling();
Layer* next = aChild->GetNextSibling();
if (prev == aAfter) {
// aChild is already in the correct position, nothing to do.
return;
}
if (prev) {
prev->SetNextSibling(next);
}
if (next) {
next->SetPrevSibling(prev);
}
if (!aAfter) {
aChild->SetPrevSibling(nullptr);
aChild->SetNextSibling(aContainer->mFirstChild);
if (aContainer->mFirstChild) {
aContainer->mFirstChild->SetPrevSibling(aChild);
}
aContainer->mFirstChild = aChild;
return;
}
Layer* afterNext = aAfter->GetNextSibling();
if (afterNext) {
afterNext->SetPrevSibling(aChild);
} else {
aContainer->mLastChild = aChild;
}
aAfter->SetNextSibling(aChild);
aChild->SetPrevSibling(aAfter);
aChild->SetNextSibling(afterNext);
}
template<class Container>
static void
ContainerComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface,
Container* aContainer)
{
// We push groups for container layers if we need to, which always
// are aligned in device space, so it doesn't really matter how we snap
// containers.
gfxMatrix residual;
gfx3DMatrix idealTransform = aContainer->GetLocalTransform()*aTransformToSurface;
idealTransform.ProjectTo2D();
if (!idealTransform.CanDraw2D()) {
aContainer->mEffectiveTransform = idealTransform;
aContainer->ComputeEffectiveTransformsForChildren(gfx3DMatrix());
aContainer->ComputeEffectiveTransformForMaskLayer(gfx3DMatrix());
aContainer->mUseIntermediateSurface = true;
return;
}
aContainer->mEffectiveTransform =
aContainer->SnapTransformTranslation(idealTransform, &residual);
// We always pass the ideal matrix down to our children, so there is no
// need to apply any compensation using the residual from SnapTransformTranslation.
aContainer->ComputeEffectiveTransformsForChildren(idealTransform);
aContainer->ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
/* If we have a single child, it can just inherit our opacity,
* otherwise we need a PushGroup and we need to mark ourselves as using
* an intermediate surface so our children don't inherit our opacity
* via GetEffectiveOpacity.
* Having a mask layer always forces our own push group
*/
aContainer->mUseIntermediateSurface =
aContainer->GetMaskLayer() || (aContainer->GetEffectiveOpacity() != 1.0 &&
aContainer->HasMultipleChildren());
}
class BasicContainerLayer : public ContainerLayer, public BasicImplData {
template<class Container>
friend void ContainerInsertAfter(Layer* aChild, Layer* aAfter, Container* aContainer);
template<class Container>
friend void ContainerRemoveChild(Layer* aChild, Container* aContainer);
template<class Container>
friend void ContainerRepositionChild(Layer* aChild, Layer* aAfter, Container* aContainer);
template<class Container>
friend void ContainerComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface,
Container* aContainer);
public:
BasicContainerLayer(BasicLayerManager* aManager) :
ContainerLayer(aManager,
@ -204,27 +38,24 @@ public:
{
NS_ASSERTION(BasicManager()->InConstruction(),
"Can only set properties in construction phase");
ContainerInsertAfter(aChild, aAfter, this);
ContainerLayer::InsertAfter(aChild, aAfter);
}
virtual void RemoveChild(Layer* aChild)
{
NS_ASSERTION(BasicManager()->InConstruction(),
"Can only set properties in construction phase");
ContainerRemoveChild(aChild, this);
ContainerLayer::RemoveChild(aChild);
}
virtual void RepositionChild(Layer* aChild, Layer* aAfter)
{
NS_ASSERTION(BasicManager()->InConstruction(),
"Can only set properties in construction phase");
ContainerRepositionChild(aChild, aAfter, this);
ContainerLayer::RepositionChild(aChild, aAfter);
}
virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface)
{
ContainerComputeEffectiveTransforms(aTransformToSurface, this);
}
virtual void ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface);
/**
* Returns true when:

View File

@ -23,140 +23,9 @@ namespace layers {
class ShadowableLayer;
template<class Container> void
ContainerInsertAfter(Layer* aChild, Layer* aAfter, Container* aContainer)
{
NS_ASSERTION(aChild->Manager() == aContainer->Manager(),
"Child has wrong manager");
NS_ASSERTION(!aChild->GetParent(),
"aChild already in the tree");
NS_ASSERTION(!aChild->GetNextSibling() && !aChild->GetPrevSibling(),
"aChild already has siblings?");
NS_ASSERTION(!aAfter ||
(aAfter->Manager() == aContainer->Manager() &&
aAfter->GetParent() == aContainer),
"aAfter is not our child");
aChild->SetParent(aContainer);
if (aAfter == aContainer->mLastChild) {
aContainer->mLastChild = aChild;
}
if (!aAfter) {
aChild->SetNextSibling(aContainer->mFirstChild);
if (aContainer->mFirstChild) {
aContainer->mFirstChild->SetPrevSibling(aChild);
}
aContainer->mFirstChild = aChild;
NS_ADDREF(aChild);
aContainer->DidInsertChild(aChild);
return;
}
Layer* next = aAfter->GetNextSibling();
aChild->SetNextSibling(next);
aChild->SetPrevSibling(aAfter);
if (next) {
next->SetPrevSibling(aChild);
}
aAfter->SetNextSibling(aChild);
NS_ADDREF(aChild);
aContainer->DidInsertChild(aChild);
}
template<class Container> void
ContainerRemoveChild(Layer* aChild, Container* aContainer)
{
NS_ASSERTION(aChild->Manager() == aContainer->Manager(),
"Child has wrong manager");
NS_ASSERTION(aChild->GetParent() == aContainer,
"aChild not our child");
Layer* prev = aChild->GetPrevSibling();
Layer* next = aChild->GetNextSibling();
if (prev) {
prev->SetNextSibling(next);
} else {
aContainer->mFirstChild = next;
}
if (next) {
next->SetPrevSibling(prev);
} else {
aContainer->mLastChild = prev;
}
aChild->SetNextSibling(nullptr);
aChild->SetPrevSibling(nullptr);
aChild->SetParent(nullptr);
aContainer->DidRemoveChild(aChild);
NS_RELEASE(aChild);
}
template<class Container> void
ContainerRepositionChild(Layer* aChild, Layer* aAfter, Container* aContainer)
{
NS_ASSERTION(aChild->Manager() == aContainer->Manager(),
"Child has wrong manager");
NS_ASSERTION(aChild->GetParent() == aContainer,
"aChild not our child");
NS_ASSERTION(!aAfter ||
(aAfter->Manager() == aContainer->Manager() &&
aAfter->GetParent() == aContainer),
"aAfter is not our child");
Layer* prev = aChild->GetPrevSibling();
Layer* next = aChild->GetNextSibling();
if (prev == aAfter) {
// aChild is already in the correct position, nothing to do.
return;
}
if (prev) {
prev->SetNextSibling(next);
}
if (next) {
next->SetPrevSibling(prev);
}
if (!aAfter) {
aChild->SetPrevSibling(nullptr);
aChild->SetNextSibling(aContainer->mFirstChild);
if (aContainer->mFirstChild) {
aContainer->mFirstChild->SetPrevSibling(aChild);
}
aContainer->mFirstChild = aChild;
return;
}
Layer* afterNext = aAfter->GetNextSibling();
if (afterNext) {
afterNext->SetPrevSibling(aChild);
} else {
aContainer->mLastChild = aChild;
}
aAfter->SetNextSibling(aChild);
aChild->SetPrevSibling(aAfter);
aChild->SetNextSibling(afterNext);
}
static bool
HasOpaqueAncestorLayer(Layer* aLayer)
{
for (Layer* l = aLayer->GetParent(); l; l = l->GetParent()) {
if (l->GetContentFlags() & Layer::CONTENT_OPAQUE)
return true;
}
return false;
}
class ClientContainerLayer : public ContainerLayer,
public ClientLayer
{
template<class Container>
friend void ContainerInsertAfter(Layer* aChild, Layer* aAfter, Container* aContainer);
template<class Container>
friend void ContainerRemoveChild(Layer* aChild, Container* aContainer);
template<class Container>
friend void ContainerRepositionChild(Layer* aChild, Layer* aAfter, Container* aContainer);
public:
ClientContainerLayer(ClientLayerManager* aManager) :
ContainerLayer(aManager,
@ -168,7 +37,7 @@ public:
virtual ~ClientContainerLayer()
{
while (mFirstChild) {
ContainerRemoveChild(mFirstChild, this);
ContainerLayer::RemoveChild(mFirstChild);
}
MOZ_COUNT_DTOR(ClientContainerLayer);
@ -219,33 +88,33 @@ public:
"Can only set properties in construction phase");
ContainerLayer::SetVisibleRegion(aRegion);
}
virtual void InsertAfter(Layer* aChild, Layer* aAfter)
virtual void InsertAfter(Layer* aChild, Layer* aAfter) MOZ_OVERRIDE
{
NS_ASSERTION(ClientManager()->InConstruction(),
"Can only set properties in construction phase");
ClientManager()->InsertAfter(ClientManager()->Hold(this),
ClientManager()->Hold(aChild),
aAfter ? ClientManager()->Hold(aAfter) : nullptr);
ContainerInsertAfter(aChild, aAfter, this);
ContainerLayer::InsertAfter(aChild, aAfter);
}
virtual void RemoveChild(Layer* aChild)
virtual void RemoveChild(Layer* aChild) MOZ_OVERRIDE
{
NS_ASSERTION(ClientManager()->InConstruction(),
"Can only set properties in construction phase");
ClientManager()->RemoveChild(ClientManager()->Hold(this),
ClientManager()->Hold(aChild));
ContainerRemoveChild(aChild, this);
ContainerLayer::RemoveChild(aChild);
}
virtual void RepositionChild(Layer* aChild, Layer* aAfter)
virtual void RepositionChild(Layer* aChild, Layer* aAfter) MOZ_OVERRIDE
{
NS_ASSERTION(ClientManager()->InConstruction(),
"Can only set properties in construction phase");
ClientManager()->RepositionChild(ClientManager()->Hold(this),
ClientManager()->Hold(aChild),
aAfter ? ClientManager()->Hold(aAfter) : nullptr);
ContainerRepositionChild(aChild, aAfter, this);
ContainerLayer::RepositionChild(aChild, aAfter);
}
virtual Layer* AsLayer() { return this; }

View File

@ -116,6 +116,11 @@ ContainerRender(ContainerT* aContainer,
} else {
surface = compositor->CreateRenderTarget(surfaceRect, mode);
}
if (!surface) {
return;
}
compositor->SetRenderTarget(surface);
childOffset.x = visibleRect.x;
childOffset.y = visibleRect.y;
@ -216,75 +221,6 @@ ContainerLayerComposite::~ContainerLayerComposite()
}
}
void
ContainerLayerComposite::InsertAfter(Layer* aChild, Layer* aAfter)
{
NS_ASSERTION(aChild->Manager() == Manager(),
"Child has wrong manager");
NS_ASSERTION(!aChild->GetParent(),
"aChild already in the tree");
NS_ASSERTION(!aChild->GetNextSibling() && !aChild->GetPrevSibling(),
"aChild already has siblings?");
NS_ASSERTION(!aAfter ||
(aAfter->Manager() == Manager() &&
aAfter->GetParent() == this),
"aAfter is not our child");
aChild->SetParent(this);
if (aAfter == mLastChild) {
mLastChild = aChild;
}
if (!aAfter) {
aChild->SetNextSibling(mFirstChild);
if (mFirstChild) {
mFirstChild->SetPrevSibling(aChild);
}
mFirstChild = aChild;
NS_ADDREF(aChild);
DidInsertChild(aChild);
return;
}
Layer* next = aAfter->GetNextSibling();
aChild->SetNextSibling(next);
aChild->SetPrevSibling(aAfter);
if (next) {
next->SetPrevSibling(aChild);
}
aAfter->SetNextSibling(aChild);
NS_ADDREF(aChild);
DidInsertChild(aChild);
}
void
ContainerLayerComposite::RemoveChild(Layer *aChild)
{
NS_ASSERTION(aChild->Manager() == Manager(),
"Child has wrong manager");
NS_ASSERTION(aChild->GetParent() == this,
"aChild not our child");
Layer* prev = aChild->GetPrevSibling();
Layer* next = aChild->GetNextSibling();
if (prev) {
prev->SetNextSibling(next);
} else {
this->mFirstChild = next;
}
if (next) {
next->SetPrevSibling(prev);
} else {
this->mLastChild = prev;
}
aChild->SetNextSibling(nullptr);
aChild->SetPrevSibling(nullptr);
aChild->SetParent(nullptr);
this->DidRemoveChild(aChild);
NS_RELEASE(aChild);
}
void
ContainerLayerComposite::Destroy()
{
@ -306,51 +242,6 @@ ContainerLayerComposite::GetFirstChildComposite()
return static_cast<LayerComposite*>(mFirstChild->ImplData());
}
void
ContainerLayerComposite::RepositionChild(Layer* aChild, Layer* aAfter)
{
NS_ASSERTION(aChild->Manager() == Manager(),
"Child has wrong manager");
NS_ASSERTION(aChild->GetParent() == this,
"aChild not our child");
NS_ASSERTION(!aAfter ||
(aAfter->Manager() == Manager() &&
aAfter->GetParent() == this),
"aAfter is not our child");
Layer* prev = aChild->GetPrevSibling();
Layer* next = aChild->GetNextSibling();
if (prev == aAfter) {
// aChild is already in the correct position, nothing to do.
return;
}
if (prev) {
prev->SetNextSibling(next);
}
if (next) {
next->SetPrevSibling(prev);
}
if (!aAfter) {
aChild->SetPrevSibling(nullptr);
aChild->SetNextSibling(mFirstChild);
if (mFirstChild) {
mFirstChild->SetPrevSibling(aChild);
}
mFirstChild = aChild;
return;
}
Layer* afterNext = aAfter->GetNextSibling();
if (afterNext) {
afterNext->SetPrevSibling(aChild);
} else {
mLastChild = aChild;
}
aAfter->SetNextSibling(aChild);
aChild->SetPrevSibling(aAfter);
aChild->SetNextSibling(afterNext);
}
void
ContainerLayerComposite::RenderLayer(const nsIntPoint& aOffset,
const nsIntRect& aClipRect)

View File

@ -33,12 +33,6 @@ public:
~ContainerLayerComposite();
void InsertAfter(Layer* aChild, Layer* aAfter);
void RemoveChild(Layer* aChild);
void RepositionChild(Layer* aChild, Layer* aAfter);
// LayerComposite Implementation
virtual Layer* GetLayer() MOZ_OVERRIDE { return this; }

View File

@ -28,140 +28,6 @@ ContainerLayerD3D10::~ContainerLayerD3D10()
RemoveChild(mFirstChild);
}
}
template<class Container>
static void
ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter)
{
NS_ASSERTION(aChild->Manager() == aContainer->Manager(),
"Child has wrong manager");
NS_ASSERTION(!aChild->GetParent(),
"aChild already in the tree");
NS_ASSERTION(!aChild->GetNextSibling() && !aChild->GetPrevSibling(),
"aChild already has siblings?");
NS_ASSERTION(!aAfter ||
(aAfter->Manager() == aContainer->Manager() &&
aAfter->GetParent() == aContainer),
"aAfter is not our child");
aChild->SetParent(aContainer);
if (aAfter == aContainer->mLastChild) {
aContainer->mLastChild = aChild;
}
if (!aAfter) {
aChild->SetNextSibling(aContainer->mFirstChild);
if (aContainer->mFirstChild) {
aContainer->mFirstChild->SetPrevSibling(aChild);
}
aContainer->mFirstChild = aChild;
NS_ADDREF(aChild);
aContainer->DidInsertChild(aChild);
return;
}
Layer* next = aAfter->GetNextSibling();
aChild->SetNextSibling(next);
aChild->SetPrevSibling(aAfter);
if (next) {
next->SetPrevSibling(aChild);
}
aAfter->SetNextSibling(aChild);
NS_ADDREF(aChild);
aContainer->DidInsertChild(aChild);
}
template<class Container>
static void
ContainerRemoveChild(Container* aContainer, Layer* aChild)
{
NS_ASSERTION(aChild->Manager() == aContainer->Manager(),
"Child has wrong manager");
NS_ASSERTION(aChild->GetParent() == aContainer,
"aChild not our child");
Layer* prev = aChild->GetPrevSibling();
Layer* next = aChild->GetNextSibling();
if (prev) {
prev->SetNextSibling(next);
} else {
aContainer->mFirstChild = next;
}
if (next) {
next->SetPrevSibling(prev);
} else {
aContainer->mLastChild = prev;
}
aChild->SetNextSibling(nullptr);
aChild->SetPrevSibling(nullptr);
aChild->SetParent(nullptr);
aContainer->DidRemoveChild(aChild);
NS_RELEASE(aChild);
}
template<class Container>
static void
ContainerRepositionChild(Container* aContainer, Layer* aChild, Layer* aAfter)
{
NS_ASSERTION(aChild->Manager() == aContainer->Manager(),
"Child has wrong manager");
NS_ASSERTION(aChild->GetParent() == aContainer,
"aChild not our child");
NS_ASSERTION(!aAfter ||
(aAfter->Manager() == aContainer->Manager() &&
aAfter->GetParent() == aContainer),
"aAfter is not our child");
Layer* prev = aChild->GetPrevSibling();
Layer* next = aChild->GetNextSibling();
if (prev == aAfter) {
// aChild is already in the correct position, nothing to do.
return;
}
if (prev) {
prev->SetNextSibling(next);
}
if (next) {
next->SetPrevSibling(prev);
}
if (!aAfter) {
aChild->SetPrevSibling(nullptr);
aChild->SetNextSibling(aContainer->mFirstChild);
if (aContainer->mFirstChild) {
aContainer->mFirstChild->SetPrevSibling(aChild);
}
aContainer->mFirstChild = aChild;
return;
}
Layer* afterNext = aAfter->GetNextSibling();
if (afterNext) {
afterNext->SetPrevSibling(aChild);
} else {
aContainer->mLastChild = aChild;
}
aAfter->SetNextSibling(aChild);
aChild->SetPrevSibling(aAfter);
aChild->SetNextSibling(afterNext);
}
void
ContainerLayerD3D10::InsertAfter(Layer* aChild, Layer* aAfter)
{
ContainerInsertAfter(this, aChild, aAfter);
}
void
ContainerLayerD3D10::RemoveChild(Layer *aChild)
{
ContainerRemoveChild(this, aChild);
}
void
ContainerLayerD3D10::RepositionChild(Layer* aChild, Layer* aAfter)
{
ContainerRepositionChild(this, aChild, aAfter);
}
Layer*
ContainerLayerD3D10::GetLayer()

View File

@ -11,35 +11,15 @@
namespace mozilla {
namespace layers {
template<class Container>
static void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter);
template<class Container>
static void ContainerRemoveChild(Container* aContainer, Layer* aChild);
template<class Container>
static void ContainerRepositionChild(Container* aContainer, Layer* aChild, Layer* aAfter);
class ContainerLayerD3D10 : public ContainerLayer,
public LayerD3D10
{
template<class Container>
friend void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter);
template<class Container>
friend void ContainerRemoveChild(Container* aContainer, Layer* aChild);
template<class Container>
friend void ContainerRepositionChild(Container* aContainer, Layer* aChild, Layer* aAfter);
public:
ContainerLayerD3D10(LayerManagerD3D10 *aManager);
~ContainerLayerD3D10();
nsIntRect GetVisibleRect() { return mVisibleRegion.GetBounds(); }
/* ContainerLayer implementation */
virtual void InsertAfter(Layer* aChild, Layer* aAfter);
virtual void RemoveChild(Layer* aChild);
virtual void RepositionChild(Layer* aChild, Layer* aAfter);
/* LayerD3D10 implementation */
virtual Layer* GetLayer();

View File

@ -371,6 +371,10 @@ CompositorD3D11::CreateRenderTarget(const gfx::IntRect& aRect,
RefPtr<ID3D11Texture2D> texture;
mDevice->CreateTexture2D(&desc, nullptr, byRef(texture));
NS_ASSERTION(texture, "Could not create texture");
if (!texture) {
return nullptr;
}
RefPtr<CompositingRenderTargetD3D11> rt = new CompositingRenderTargetD3D11(texture);
rt->SetSize(IntSize(aRect.width, aRect.height));
@ -393,6 +397,10 @@ CompositorD3D11::CreateRenderTargetFromSource(const gfx::IntRect &aRect,
RefPtr<ID3D11Texture2D> texture;
mDevice->CreateTexture2D(&desc, nullptr, byRef(texture));
NS_ASSERTION(texture, "Could not create texture");
if (!texture) {
return nullptr;
}
if (aSource) {
const CompositingRenderTargetD3D11* sourceD3D11 =

View File

@ -12,155 +12,37 @@
namespace mozilla {
namespace layers {
template<class Container>
static void
ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter)
ContainerLayerD3D9::ContainerLayerD3D9(LayerManagerD3D9 *aManager)
: ContainerLayer(aManager, nullptr)
, LayerD3D9(aManager)
{
NS_ASSERTION(aChild->Manager() == aContainer->Manager(),
"Child has wrong manager");
NS_ASSERTION(!aChild->GetParent(),
"aChild already in the tree");
NS_ASSERTION(!aChild->GetNextSibling() && !aChild->GetPrevSibling(),
"aChild already has siblings?");
NS_ASSERTION(!aAfter ||
(aAfter->Manager() == aContainer->Manager() &&
aAfter->GetParent() == aContainer),
"aAfter is not our child");
aChild->SetParent(aContainer);
if (aAfter == aContainer->mLastChild) {
aContainer->mLastChild = aChild;
}
if (!aAfter) {
aChild->SetNextSibling(aContainer->mFirstChild);
if (aContainer->mFirstChild) {
aContainer->mFirstChild->SetPrevSibling(aChild);
}
aContainer->mFirstChild = aChild;
NS_ADDREF(aChild);
aContainer->DidInsertChild(aChild);
return;
}
Layer* next = aAfter->GetNextSibling();
aChild->SetNextSibling(next);
aChild->SetPrevSibling(aAfter);
if (next) {
next->SetPrevSibling(aChild);
}
aAfter->SetNextSibling(aChild);
NS_ADDREF(aChild);
aContainer->DidInsertChild(aChild);
mImplData = static_cast<LayerD3D9*>(this);
}
template<class Container>
static void
ContainerRemoveChild(Container* aContainer, Layer* aChild)
ContainerLayerD3D9::~ContainerLayerD3D9()
{
NS_ASSERTION(aChild->Manager() == aContainer->Manager(),
"Child has wrong manager");
NS_ASSERTION(aChild->GetParent() == aContainer,
"aChild not our child");
Layer* prev = aChild->GetPrevSibling();
Layer* next = aChild->GetNextSibling();
if (prev) {
prev->SetNextSibling(next);
} else {
aContainer->mFirstChild = next;
while (mFirstChild) {
RemoveChild(mFirstChild);
}
if (next) {
next->SetPrevSibling(prev);
} else {
aContainer->mLastChild = prev;
}
aChild->SetNextSibling(nullptr);
aChild->SetPrevSibling(nullptr);
aChild->SetParent(nullptr);
aContainer->DidRemoveChild(aChild);
NS_RELEASE(aChild);
}
template<class Container>
static void
ContainerRepositionChild(Container* aContainer, Layer* aChild, Layer* aAfter)
Layer*
ContainerLayerD3D9::GetLayer()
{
NS_ASSERTION(aChild->Manager() == aContainer->Manager(),
"Child has wrong manager");
NS_ASSERTION(aChild->GetParent() == aContainer,
"aChild not our child");
NS_ASSERTION(!aAfter ||
(aAfter->Manager() == aContainer->Manager() &&
aAfter->GetParent() == aContainer),
"aAfter is not our child");
Layer* prev = aChild->GetPrevSibling();
Layer* next = aChild->GetNextSibling();
if (prev == aAfter) {
// aChild is already in the correct position, nothing to do.
return;
}
if (prev) {
prev->SetNextSibling(next);
}
if (next) {
next->SetPrevSibling(prev);
}
if (!aAfter) {
aChild->SetPrevSibling(nullptr);
aChild->SetNextSibling(aContainer->mFirstChild);
if (aContainer->mFirstChild) {
aContainer->mFirstChild->SetPrevSibling(aChild);
}
aContainer->mFirstChild = aChild;
return;
}
Layer* afterNext = aAfter->GetNextSibling();
if (afterNext) {
afterNext->SetPrevSibling(aChild);
} else {
aContainer->mLastChild = aChild;
}
aAfter->SetNextSibling(aChild);
aChild->SetPrevSibling(aAfter);
aChild->SetNextSibling(afterNext);
return this;
}
static inline LayerD3D9*
GetNextSibling(LayerD3D9* aLayer)
LayerD3D9*
ContainerLayerD3D9::GetFirstChildD3D9()
{
Layer* layer = aLayer->GetLayer()->GetNextSibling();
return layer ? static_cast<LayerD3D9*>(layer->
ImplData())
: nullptr;
}
static bool
HasOpaqueAncestorLayer(Layer* aLayer)
{
for (Layer* l = aLayer->GetParent(); l; l = l->GetParent()) {
if (l->GetContentFlags() & Layer::CONTENT_OPAQUE)
return true;
if (!mFirstChild) {
return nullptr;
}
return false;
return static_cast<LayerD3D9*>(mFirstChild->ImplData());
}
static inline LayerD3D9*
GetNextSiblingD3D9(LayerD3D9* aLayer)
{
Layer* layer = aLayer->GetLayer()->GetNextSibling();
return layer ? static_cast<LayerD3D9*>(layer->
ImplData())
: nullptr;
}
template<class Container>
static void
ContainerRender(Container* aContainer,
LayerManagerD3D9* aManager)
void
ContainerLayerD3D9::RenderLayer()
{
nsRefPtr<IDirect3DSurface9> previousRenderTarget;
nsRefPtr<IDirect3DTexture9> renderTexture;
@ -169,7 +51,7 @@ ContainerRender(Container* aContainer,
float oldViewMatrix[4][4];
RECT containerD3D9ClipRect;
aManager->device()->GetScissorRect(&containerD3D9ClipRect);
device()->GetScissorRect(&containerD3D9ClipRect);
// Convert scissor to an nsIntRect. RECT's are exclusive on the bottom and
// right values.
nsIntRect oldScissor(containerD3D9ClipRect.left,
@ -178,44 +60,44 @@ ContainerRender(Container* aContainer,
containerD3D9ClipRect.bottom - containerD3D9ClipRect.top);
ReadbackProcessor readback;
readback.BuildUpdates(aContainer);
readback.BuildUpdates(this);
nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
bool useIntermediate = aContainer->UseIntermediateSurface();
nsIntRect visibleRect = GetEffectiveVisibleRegion().GetBounds();
bool useIntermediate = UseIntermediateSurface();
aContainer->mSupportsComponentAlphaChildren = false;
mSupportsComponentAlphaChildren = false;
if (useIntermediate) {
nsRefPtr<IDirect3DSurface9> renderSurface;
if (!aManager->CompositingDisabled()) {
aManager->device()->GetRenderTarget(0, getter_AddRefs(previousRenderTarget));
HRESULT hr = aManager->device()->CreateTexture(visibleRect.width, visibleRect.height, 1,
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT, getter_AddRefs(renderTexture),
nullptr);
if (!mD3DManager->CompositingDisabled()) {
device()->GetRenderTarget(0, getter_AddRefs(previousRenderTarget));
HRESULT hr = device()->CreateTexture(visibleRect.width, visibleRect.height, 1,
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT, getter_AddRefs(renderTexture),
nullptr);
if (FAILED(hr)) {
aManager->ReportFailure(NS_LITERAL_CSTRING("ContainerLayerD3D9::ContainerRender(): Failed to create texture"),
ReportFailure(NS_LITERAL_CSTRING("ContainerLayerD3D9::ContainerRender(): Failed to create texture"),
hr);
return;
}
nsRefPtr<IDirect3DSurface9> renderSurface;
renderTexture->GetSurfaceLevel(0, getter_AddRefs(renderSurface));
aManager->device()->SetRenderTarget(0, renderSurface);
device()->SetRenderTarget(0, renderSurface);
}
if (aContainer->mVisibleRegion.GetNumRects() == 1 &&
(aContainer->GetContentFlags() & aContainer->CONTENT_OPAQUE)) {
if (mVisibleRegion.GetNumRects() == 1 &&
(GetContentFlags() & CONTENT_OPAQUE)) {
// don't need a background, we're going to paint all opaque stuff
aContainer->mSupportsComponentAlphaChildren = true;
mSupportsComponentAlphaChildren = true;
} else {
const gfx3DMatrix& transform3D = aContainer->GetEffectiveTransform();
const gfx3DMatrix& transform3D = GetEffectiveTransform();
gfxMatrix transform;
// If we have an opaque ancestor layer, then we can be sure that
// all the pixels we draw into are either opaque already or will be
// covered by something opaque. Otherwise copying up the background is
// not safe.
HRESULT hr = E_FAIL;
if (HasOpaqueAncestorLayer(aContainer) &&
if (HasOpaqueAncestorLayer(this) &&
transform3D.Is2D(&transform) && !transform.HasNonIntegerTranslation()) {
// Copy background up from below
RECT dest = { 0, 0, visibleRect.width, visibleRect.height };
@ -223,24 +105,24 @@ ContainerRender(Container* aContainer,
::OffsetRect(&src,
visibleRect.x + int32_t(transform.x0),
visibleRect.y + int32_t(transform.y0));
if (!aManager->CompositingDisabled()) {
hr = aManager->device()->
if (!mD3DManager->CompositingDisabled()) {
hr = device()->
StretchRect(previousRenderTarget, &src, renderSurface, &dest, D3DTEXF_NONE);
}
}
if (hr == S_OK) {
aContainer->mSupportsComponentAlphaChildren = true;
} else if (!aManager->CompositingDisabled()) {
aManager->device()->
mSupportsComponentAlphaChildren = true;
} else if (!mD3DManager->CompositingDisabled()) {
device()->
Clear(0, 0, D3DCLEAR_TARGET, D3DCOLOR_RGBA(0, 0, 0, 0), 0, 0);
}
}
aManager->device()->
device()->
GetVertexShaderConstantF(CBvRenderTargetOffset, previousRenderTargetOffset, 1);
renderTargetOffset[0] = (float)visibleRect.x;
renderTargetOffset[1] = (float)visibleRect.y;
aManager->device()->
device()->
SetVertexShaderConstantF(CBvRenderTargetOffset, renderTargetOffset, 1);
gfx3DMatrix viewMatrix;
@ -253,19 +135,19 @@ ContainerRender(Container* aContainer,
viewMatrix._41 = -1.0f;
viewMatrix._42 = 1.0f;
aManager->device()->
device()->
GetVertexShaderConstantF(CBmProjection, &oldViewMatrix[0][0], 4);
aManager->device()->
device()->
SetVertexShaderConstantF(CBmProjection, &viewMatrix._11, 4);
} else {
aContainer->mSupportsComponentAlphaChildren =
(aContainer->GetContentFlags() & aContainer->CONTENT_OPAQUE) ||
(aContainer->mParent &&
aContainer->mParent->SupportsComponentAlphaChildren());
mSupportsComponentAlphaChildren =
(GetContentFlags() & CONTENT_OPAQUE) ||
(mParent &&
mParent->SupportsComponentAlphaChildren());
}
nsAutoTArray<Layer*, 12> children;
aContainer->SortChildrenBy3DZOrder(children);
SortChildrenBy3DZOrder(children);
/*
* Render this container's contents.
@ -288,94 +170,40 @@ ContainerRender(Container* aContainer,
d3drect.top = scissorRect.y;
d3drect.right = scissorRect.x + scissorRect.width;
d3drect.bottom = scissorRect.y + scissorRect.height;
aManager->device()->SetScissorRect(&d3drect);
device()->SetScissorRect(&d3drect);
if (layerToRender->GetLayer()->GetType() == aContainer->TYPE_THEBES) {
if (layerToRender->GetLayer()->GetType() == TYPE_THEBES) {
static_cast<ThebesLayerD3D9*>(layerToRender)->RenderThebesLayer(&readback);
} else {
layerToRender->RenderLayer();
}
}
if (useIntermediate && !aManager->CompositingDisabled()) {
aManager->device()->SetRenderTarget(0, previousRenderTarget);
aManager->device()->SetVertexShaderConstantF(CBvRenderTargetOffset, previousRenderTargetOffset, 1);
aManager->device()->SetVertexShaderConstantF(CBmProjection, &oldViewMatrix[0][0], 4);
if (useIntermediate && !mD3DManager->CompositingDisabled()) {
device()->SetRenderTarget(0, previousRenderTarget);
device()->SetVertexShaderConstantF(CBvRenderTargetOffset, previousRenderTargetOffset, 1);
device()->SetVertexShaderConstantF(CBmProjection, &oldViewMatrix[0][0], 4);
aManager->device()->SetVertexShaderConstantF(CBvLayerQuad,
device()->SetVertexShaderConstantF(CBvLayerQuad,
ShaderConstantRect(visibleRect.x,
visibleRect.y,
visibleRect.width,
visibleRect.height),
1);
aContainer->SetShaderTransformAndOpacity();
aManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER,
aContainer->GetMaskLayer(),
aContainer->GetTransform().CanDraw2D());
SetShaderTransformAndOpacity();
mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER,
GetMaskLayer(),
GetTransform().CanDraw2D());
aManager->device()->SetTexture(0, renderTexture);
aManager->device()->SetScissorRect(&containerD3D9ClipRect);
aManager->device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
device()->SetTexture(0, renderTexture);
device()->SetScissorRect(&containerD3D9ClipRect);
device()->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
} else {
aManager->device()->SetScissorRect(&containerD3D9ClipRect);
device()->SetScissorRect(&containerD3D9ClipRect);
}
}
ContainerLayerD3D9::ContainerLayerD3D9(LayerManagerD3D9 *aManager)
: ContainerLayer(aManager, nullptr)
, LayerD3D9(aManager)
{
mImplData = static_cast<LayerD3D9*>(this);
}
ContainerLayerD3D9::~ContainerLayerD3D9()
{
while (mFirstChild) {
RemoveChild(mFirstChild);
}
}
void
ContainerLayerD3D9::InsertAfter(Layer* aChild, Layer* aAfter)
{
ContainerInsertAfter(this, aChild, aAfter);
}
void
ContainerLayerD3D9::RemoveChild(Layer *aChild)
{
ContainerRemoveChild(this, aChild);
}
void
ContainerLayerD3D9::RepositionChild(Layer* aChild, Layer* aAfter)
{
ContainerRepositionChild(this, aChild, aAfter);
}
Layer*
ContainerLayerD3D9::GetLayer()
{
return this;
}
LayerD3D9*
ContainerLayerD3D9::GetFirstChildD3D9()
{
if (!mFirstChild) {
return nullptr;
}
return static_cast<LayerD3D9*>(mFirstChild->ImplData());
}
void
ContainerLayerD3D9::RenderLayer()
{
ContainerRender(this, mD3DManager);
}
void
ContainerLayerD3D9::LayerManagerDestroyed()
{

View File

@ -12,40 +12,15 @@
namespace mozilla {
namespace layers {
template<class Container>
static void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter);
template<class Container>
static void ContainerRemoveChild(Container* aContainer, Layer* aChild);
template<class Container>
static void ContainerRepositionChild(Container* aContainer, Layer* aChild, Layer* aAfter);
template<class Container>
static void ContainerRender(Container* aContainer, LayerManagerD3D9* aManager);
class ContainerLayerD3D9 : public ContainerLayer,
public LayerD3D9
{
template<class Container>
friend void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter);
template<class Container>
friend void ContainerRemoveChild(Container* aContainer, Layer* aChild);
template<class Container>
friend void ContainerRepositionChild(Container* aContainer, Layer* aChild, Layer* aAfter);
template<class Container>
friend void ContainerRender(Container* aContainer, LayerManagerD3D9* aManager);
public:
ContainerLayerD3D9(LayerManagerD3D9 *aManager);
~ContainerLayerD3D9();
nsIntRect GetVisibleRect() { return mVisibleRegion.GetBounds(); }
/* ContainerLayer implementation */
virtual void InsertAfter(Layer* aChild, Layer* aAfter);
virtual void RemoveChild(Layer* aChild);
virtual void RepositionChild(Layer* aChild, Layer* aAfter);
/* LayerD3D9 implementation */
Layer* GetLayer();

View File

@ -28,146 +28,6 @@ class gfxImageSurface;
namespace mozilla {
namespace layers {
template<class Container>
static void
ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter)
{
NS_ASSERTION(aChild->Manager() == aContainer->Manager(),
"Child has wrong manager");
NS_ASSERTION(!aChild->GetParent(),
"aChild already in the tree");
NS_ASSERTION(!aChild->GetNextSibling() && !aChild->GetPrevSibling(),
"aChild already has siblings?");
NS_ASSERTION(!aAfter ||
(aAfter->Manager() == aContainer->Manager() &&
aAfter->GetParent() == aContainer),
"aAfter is not our child");
aChild->SetParent(aContainer);
if (aAfter == aContainer->mLastChild) {
aContainer->mLastChild = aChild;
}
if (!aAfter) {
aChild->SetNextSibling(aContainer->mFirstChild);
if (aContainer->mFirstChild) {
aContainer->mFirstChild->SetPrevSibling(aChild);
}
aContainer->mFirstChild = aChild;
NS_ADDREF(aChild);
aContainer->DidInsertChild(aChild);
return;
}
Layer* next = aAfter->GetNextSibling();
aChild->SetNextSibling(next);
aChild->SetPrevSibling(aAfter);
if (next) {
next->SetPrevSibling(aChild);
}
aAfter->SetNextSibling(aChild);
NS_ADDREF(aChild);
aContainer->DidInsertChild(aChild);
}
template<class Container>
static void
ContainerRemoveChild(Container* aContainer, Layer* aChild)
{
NS_ASSERTION(aChild->Manager() == aContainer->Manager(),
"Child has wrong manager");
NS_ASSERTION(aChild->GetParent() == aContainer,
"aChild not our child");
Layer* prev = aChild->GetPrevSibling();
Layer* next = aChild->GetNextSibling();
if (prev) {
prev->SetNextSibling(next);
} else {
aContainer->mFirstChild = next;
}
if (next) {
next->SetPrevSibling(prev);
} else {
aContainer->mLastChild = prev;
}
aChild->SetNextSibling(nullptr);
aChild->SetPrevSibling(nullptr);
aChild->SetParent(nullptr);
aContainer->DidRemoveChild(aChild);
NS_RELEASE(aChild);
}
template<class Container>
static void
ContainerRepositionChild(Container* aContainer, Layer* aChild, Layer* aAfter)
{
NS_ASSERTION(aChild->Manager() == aContainer->Manager(),
"Child has wrong manager");
NS_ASSERTION(aChild->GetParent() == aContainer,
"aChild not our child");
NS_ASSERTION(!aAfter ||
(aAfter->Manager() == aContainer->Manager() &&
aAfter->GetParent() == aContainer),
"aAfter is not our child");
Layer* prev = aChild->GetPrevSibling();
Layer* next = aChild->GetNextSibling();
if (prev == aAfter) {
// aChild is already in the correct position, nothing to do.
return;
}
if (prev) {
prev->SetNextSibling(next);
}
if (next) {
next->SetPrevSibling(prev);
}
if (!aAfter) {
aChild->SetPrevSibling(nullptr);
aChild->SetNextSibling(aContainer->mFirstChild);
if (aContainer->mFirstChild) {
aContainer->mFirstChild->SetPrevSibling(aChild);
}
aContainer->mFirstChild = aChild;
return;
}
Layer* afterNext = aAfter->GetNextSibling();
if (afterNext) {
afterNext->SetPrevSibling(aChild);
} else {
aContainer->mLastChild = aChild;
}
aAfter->SetNextSibling(aChild);
aChild->SetPrevSibling(aAfter);
aChild->SetNextSibling(afterNext);
}
template<class Container>
static void
ContainerDestroy(Container* aContainer)
{
if (!aContainer->mDestroyed) {
while (aContainer->mFirstChild) {
aContainer->GetFirstChildOGL()->Destroy();
aContainer->RemoveChild(aContainer->mFirstChild);
}
aContainer->mDestroyed = true;
}
}
template<class Container>
static void
ContainerCleanupResources(Container* aContainer)
{
for (Layer* l = aContainer->GetFirstChild(); l; l = l->GetNextSibling()) {
LayerOGL* layerToRender = static_cast<LayerOGL*>(l->ImplData());
layerToRender->CleanupResources();
}
}
static inline LayerOGL*
GetNextSibling(LayerOGL* aLayer)
{
@ -177,195 +37,9 @@ GetNextSibling(LayerOGL* aLayer)
: nullptr;
}
static bool
HasOpaqueAncestorLayer(Layer* aLayer)
{
for (Layer* l = aLayer->GetParent(); l; l = l->GetParent()) {
if (l->GetContentFlags() & Layer::CONTENT_OPAQUE)
return true;
}
return false;
}
template<class Container>
static void
ContainerRender(Container* aContainer,
int aPreviousFrameBuffer,
const nsIntPoint& aOffset,
LayerManagerOGL* aManager)
{
/**
* Setup our temporary texture for rendering the contents of this container.
*/
GLuint containerSurface;
GLuint frameBuffer;
nsIntPoint childOffset(aOffset);
nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds();
nsIntRect cachedScissor = aContainer->gl()->ScissorRect();
aContainer->gl()->PushScissorRect();
aContainer->mSupportsComponentAlphaChildren = false;
float opacity = aContainer->GetEffectiveOpacity();
const gfx3DMatrix& transform = aContainer->GetEffectiveTransform();
bool needsFramebuffer = aContainer->UseIntermediateSurface();
if (needsFramebuffer) {
nsIntRect framebufferRect = visibleRect;
// we're about to create a framebuffer backed by textures to use as an intermediate
// surface. What to do if its size (as given by framebufferRect) would exceed the
// maximum texture size supported by the GL? The present code chooses the compromise
// of just clamping the framebuffer's size to the max supported size.
// This gives us a lower resolution rendering of the intermediate surface (children layers).
// See bug 827170 for a discussion.
GLint maxTexSize;
aContainer->gl()->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, &maxTexSize);
framebufferRect.width = std::min(framebufferRect.width, maxTexSize);
framebufferRect.height = std::min(framebufferRect.height, maxTexSize);
LayerManagerOGL::InitMode mode = LayerManagerOGL::InitModeClear;
if (aContainer->GetEffectiveVisibleRegion().GetNumRects() == 1 &&
(aContainer->GetContentFlags() & Layer::CONTENT_OPAQUE))
{
// don't need a background, we're going to paint all opaque stuff
aContainer->mSupportsComponentAlphaChildren = true;
mode = LayerManagerOGL::InitModeNone;
} else {
const gfx3DMatrix& transform3D = aContainer->GetEffectiveTransform();
gfxMatrix transform;
// If we have an opaque ancestor layer, then we can be sure that
// all the pixels we draw into are either opaque already or will be
// covered by something opaque. Otherwise copying up the background is
// not safe.
if (HasOpaqueAncestorLayer(aContainer) &&
transform3D.Is2D(&transform) && !transform.HasNonIntegerTranslation()) {
mode = gfxPlatform::ComponentAlphaEnabled() ?
LayerManagerOGL::InitModeCopy :
LayerManagerOGL::InitModeClear;
framebufferRect.x += transform.x0;
framebufferRect.y += transform.y0;
aContainer->mSupportsComponentAlphaChildren = gfxPlatform::ComponentAlphaEnabled();
}
}
aContainer->gl()->PushViewportRect();
framebufferRect -= childOffset;
if (!aManager->CompositingDisabled()) {
if (!aManager->CreateFBOWithTexture(framebufferRect,
mode,
aPreviousFrameBuffer,
&frameBuffer,
&containerSurface)) {
aContainer->gl()->PopViewportRect();
aContainer->gl()->PopScissorRect();
aContainer->gl()->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, aPreviousFrameBuffer);
return;
}
}
childOffset.x = visibleRect.x;
childOffset.y = visibleRect.y;
} else {
frameBuffer = aPreviousFrameBuffer;
aContainer->mSupportsComponentAlphaChildren = (aContainer->GetContentFlags() & Layer::CONTENT_OPAQUE) ||
(aContainer->GetParent() && aContainer->GetParent()->SupportsComponentAlphaChildren());
}
nsAutoTArray<Layer*, 12> children;
aContainer->SortChildrenBy3DZOrder(children);
/**
* Render this container's contents.
*/
for (uint32_t i = 0; i < children.Length(); i++) {
LayerOGL* layerToRender = static_cast<LayerOGL*>(children.ElementAt(i)->ImplData());
if (layerToRender->GetLayer()->GetEffectiveVisibleRegion().IsEmpty()) {
continue;
}
nsIntRect scissorRect = layerToRender->GetLayer()->
CalculateScissorRect(cachedScissor, &aManager->GetWorldTransform());
if (scissorRect.IsEmpty()) {
continue;
}
aContainer->gl()->fScissor(scissorRect.x,
scissorRect.y,
scissorRect.width,
scissorRect.height);
layerToRender->RenderLayer(frameBuffer, childOffset);
aContainer->gl()->MakeCurrent();
}
if (needsFramebuffer) {
// Unbind the current framebuffer and rebind the previous one.
#ifdef MOZ_DUMP_PAINTING
if (gfxUtils::sDumpPainting) {
nsRefPtr<gfxImageSurface> surf =
aContainer->gl()->GetTexImage(containerSurface, true, aManager->GetFBOTextureFormat());
WriteSnapshotToDumpFile(aContainer, surf);
}
#endif
// Restore the viewport
aContainer->gl()->PopViewportRect();
nsIntRect viewport = aContainer->gl()->ViewportRect();
aManager->SetupPipeline(viewport.width, viewport.height,
LayerManagerOGL::ApplyWorldTransform);
aContainer->gl()->PopScissorRect();
if (!aManager->CompositingDisabled()) {
aContainer->gl()->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, aPreviousFrameBuffer);
aContainer->gl()->fDeleteFramebuffers(1, &frameBuffer);
aContainer->gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
aContainer->gl()->fBindTexture(aManager->FBOTextureTarget(), containerSurface);
MaskType maskType = MaskNone;
if (aContainer->GetMaskLayer()) {
if (!aContainer->GetTransform().CanDraw2D()) {
maskType = Mask3d;
} else {
maskType = Mask2d;
}
}
ShaderProgramOGL *rgb =
aManager->GetFBOLayerProgram(maskType);
rgb->Activate();
rgb->SetLayerQuadRect(visibleRect);
rgb->SetLayerTransform(transform);
rgb->SetTextureTransform(gfx3DMatrix());
rgb->SetLayerOpacity(opacity);
rgb->SetRenderOffset(aOffset);
rgb->SetTextureUnit(0);
rgb->LoadMask(aContainer->GetMaskLayer());
if (rgb->GetTexCoordMultiplierUniformLocation() != -1) {
// 2DRect case, get the multiplier right for a sampler2DRect
rgb->SetTexCoordMultiplier(visibleRect.width, visibleRect.height);
}
// Drawing is always flipped, but when copying between surfaces we want to avoid
// this. Pass true for the flip parameter to introduce a second flip
// that cancels the other one out.
aManager->BindAndDrawQuad(rgb, true);
// Clean up resources. This also unbinds the texture.
aContainer->gl()->fDeleteTextures(1, &containerSurface);
}
} else {
aContainer->gl()->PopScissorRect();
}
}
ContainerLayerOGL::ContainerLayerOGL(LayerManagerOGL *aManager)
: ContainerLayer(aManager, nullptr)
, LayerOGL(aManager)
ContainerLayerOGL::ContainerLayerOGL(LayerManagerOGL *mOGLManager)
: ContainerLayer(mOGLManager, nullptr)
, LayerOGL(mOGLManager)
{
mImplData = static_cast<LayerOGL*>(this);
}
@ -375,28 +49,16 @@ ContainerLayerOGL::~ContainerLayerOGL()
Destroy();
}
void
ContainerLayerOGL::InsertAfter(Layer* aChild, Layer* aAfter)
{
ContainerInsertAfter(this, aChild, aAfter);
}
void
ContainerLayerOGL::RemoveChild(Layer *aChild)
{
ContainerRemoveChild(this, aChild);
}
void
ContainerLayerOGL::RepositionChild(Layer* aChild, Layer* aAfter)
{
ContainerRepositionChild(this, aChild, aAfter);
}
void
ContainerLayerOGL::Destroy()
{
ContainerDestroy(this);
if (!mDestroyed) {
while (mFirstChild) {
GetFirstChildOGL()->Destroy();
RemoveChild(mFirstChild);
}
mDestroyed = true;
}
}
LayerOGL*
@ -412,13 +74,182 @@ void
ContainerLayerOGL::RenderLayer(int aPreviousFrameBuffer,
const nsIntPoint& aOffset)
{
ContainerRender(this, aPreviousFrameBuffer, aOffset, mOGLManager);
/**
* Setup our temporary texture for rendering the contents of this container.
*/
GLuint containerSurface;
GLuint frameBuffer;
nsIntPoint childOffset(aOffset);
nsIntRect visibleRect = GetEffectiveVisibleRegion().GetBounds();
nsIntRect cachedScissor = gl()->ScissorRect();
gl()->PushScissorRect();
mSupportsComponentAlphaChildren = false;
float opacity = GetEffectiveOpacity();
const gfx3DMatrix& transform = GetEffectiveTransform();
bool needsFramebuffer = UseIntermediateSurface();
if (needsFramebuffer) {
nsIntRect framebufferRect = visibleRect;
// we're about to create a framebuffer backed by textures to use as an intermediate
// surface. What to do if its size (as given by framebufferRect) would exceed the
// maximum texture size supported by the GL? The present code chooses the compromise
// of just clamping the framebuffer's size to the max supported size.
// This gives us a lower resolution rendering of the intermediate surface (children layers).
// See bug 827170 for a discussion.
GLint maxTexSize;
gl()->fGetIntegerv(LOCAL_GL_MAX_TEXTURE_SIZE, &maxTexSize);
framebufferRect.width = std::min(framebufferRect.width, maxTexSize);
framebufferRect.height = std::min(framebufferRect.height, maxTexSize);
LayerManagerOGL::InitMode mode = LayerManagerOGL::InitModeClear;
if (GetEffectiveVisibleRegion().GetNumRects() == 1 &&
(GetContentFlags() & Layer::CONTENT_OPAQUE))
{
// don't need a background, we're going to paint all opaque stuff
mSupportsComponentAlphaChildren = true;
mode = LayerManagerOGL::InitModeNone;
} else {
const gfx3DMatrix& transform3D = GetEffectiveTransform();
gfxMatrix transform;
// If we have an opaque ancestor layer, then we can be sure that
// all the pixels we draw into are either opaque already or will be
// covered by something opaque. Otherwise copying up the background is
// not safe.
if (HasOpaqueAncestorLayer(this) &&
transform3D.Is2D(&transform) && !transform.HasNonIntegerTranslation()) {
mode = gfxPlatform::ComponentAlphaEnabled() ?
LayerManagerOGL::InitModeCopy :
LayerManagerOGL::InitModeClear;
framebufferRect.x += transform.x0;
framebufferRect.y += transform.y0;
mSupportsComponentAlphaChildren = gfxPlatform::ComponentAlphaEnabled();
}
}
gl()->PushViewportRect();
framebufferRect -= childOffset;
if (!mOGLManager->CompositingDisabled()) {
if (!mOGLManager->CreateFBOWithTexture(framebufferRect,
mode,
aPreviousFrameBuffer,
&frameBuffer,
&containerSurface)) {
gl()->PopViewportRect();
gl()->PopScissorRect();
gl()->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, aPreviousFrameBuffer);
return;
}
}
childOffset.x = visibleRect.x;
childOffset.y = visibleRect.y;
} else {
frameBuffer = aPreviousFrameBuffer;
mSupportsComponentAlphaChildren = (GetContentFlags() & Layer::CONTENT_OPAQUE) ||
(GetParent() && GetParent()->SupportsComponentAlphaChildren());
}
nsAutoTArray<Layer*, 12> children;
SortChildrenBy3DZOrder(children);
/**
* Render this container's contents.
*/
for (uint32_t i = 0; i < children.Length(); i++) {
LayerOGL* layerToRender = static_cast<LayerOGL*>(children.ElementAt(i)->ImplData());
if (layerToRender->GetLayer()->GetEffectiveVisibleRegion().IsEmpty()) {
continue;
}
nsIntRect scissorRect = layerToRender->GetLayer()->
CalculateScissorRect(cachedScissor, &mOGLManager->GetWorldTransform());
if (scissorRect.IsEmpty()) {
continue;
}
gl()->fScissor(scissorRect.x,
scissorRect.y,
scissorRect.width,
scissorRect.height);
layerToRender->RenderLayer(frameBuffer, childOffset);
gl()->MakeCurrent();
}
if (needsFramebuffer) {
// Unbind the current framebuffer and rebind the previous one.
#ifdef MOZ_DUMP_PAINTING
if (gfxUtils::sDumpPainting) {
nsRefPtr<gfxImageSurface> surf =
gl()->GetTexImage(containerSurface, true, mOGLManager->GetFBOTextureFormat());
WriteSnapshotToDumpFile(this, surf);
}
#endif
// Restore the viewport
gl()->PopViewportRect();
nsIntRect viewport = gl()->ViewportRect();
mOGLManager->SetupPipeline(viewport.width, viewport.height,
LayerManagerOGL::ApplyWorldTransform);
gl()->PopScissorRect();
if (!mOGLManager->CompositingDisabled()) {
gl()->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, aPreviousFrameBuffer);
gl()->fDeleteFramebuffers(1, &frameBuffer);
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
gl()->fBindTexture(mOGLManager->FBOTextureTarget(), containerSurface);
MaskType maskType = MaskNone;
if (GetMaskLayer()) {
if (!GetTransform().CanDraw2D()) {
maskType = Mask3d;
} else {
maskType = Mask2d;
}
}
ShaderProgramOGL *rgb =
mOGLManager->GetFBOLayerProgram(maskType);
rgb->Activate();
rgb->SetLayerQuadRect(visibleRect);
rgb->SetLayerTransform(transform);
rgb->SetTextureTransform(gfx3DMatrix());
rgb->SetLayerOpacity(opacity);
rgb->SetRenderOffset(aOffset);
rgb->SetTextureUnit(0);
rgb->LoadMask(GetMaskLayer());
if (rgb->GetTexCoordMultiplierUniformLocation() != -1) {
// 2DRect case, get the multiplier right for a sampler2DRect
rgb->SetTexCoordMultiplier(visibleRect.width, visibleRect.height);
}
// Drawing is always flipped, but when copying between surfaces we want to avoid
// this. Pass true for the flip parameter to introduce a second flip
// that cancels the other one out.
mOGLManager->BindAndDrawQuad(rgb, true);
// Clean up resources. This also unbinds the texture.
gl()->fDeleteTextures(1, &containerSurface);
}
} else {
gl()->PopScissorRect();
}
}
void
ContainerLayerOGL::CleanupResources()
{
ContainerCleanupResources(this);
for (Layer* l = GetFirstChild(); l; l = l->GetNextSibling()) {
LayerOGL* layerToRender = static_cast<LayerOGL*>(l->ImplData());
layerToRender->CleanupResources();
}
}
} /* layers */

View File

@ -14,47 +14,13 @@ struct nsIntPoint;
namespace mozilla {
namespace layers {
template<class Container>
static void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter);
template<class Container>
static void ContainerRemoveChild(Container* aContainer, Layer* aChild);
template<class Container>
static void ContainerRepositionChild(Container* aContainer, Layer* aChild, Layer* aAfter);
template<class Container>
static void ContainerDestroy(Container* aContainer);
template<class Container>
static void ContainerRender(Container* aContainer,
int aPreviousFrameBuffer,
const nsIntPoint& aOffset,
LayerManagerOGL* aManager);
class ContainerLayerOGL : public ContainerLayer,
public LayerOGL
{
template<class Container>
friend void ContainerInsertAfter(Container* aContainer, Layer* aChild, Layer* aAfter);
template<class Container>
friend void ContainerRemoveChild(Container* aContainer, Layer* aChild);
template<class Container>
friend void ContainerRepositionChild(Container* aContainer, Layer* aChild, Layer* aAfter);
template<class Container>
friend void ContainerDestroy(Container* aContainer);
template<class Container>
friend void ContainerRender(Container* aContainer,
int aPreviousFrameBuffer,
const nsIntPoint& aOffset,
LayerManagerOGL* aManager);
public:
ContainerLayerOGL(LayerManagerOGL *aManager);
~ContainerLayerOGL();
void InsertAfter(Layer* aChild, Layer* aAfter);
void RemoveChild(Layer* aChild);
void RepositionChild(Layer* aChild, Layer* aAfter);
/** LayerOGL implementation */
Layer* GetLayer() { return this; }

View File

@ -6,6 +6,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "X11Util.h"
#include "nsDebug.h" // for NS_ASSERTION, etc
namespace mozilla {

View File

@ -21,10 +21,9 @@
# error Unknown toolkit
#endif
#include "mozilla/Scoped.h"
#include "gfxCore.h"
#include "nsDebug.h"
#include <string.h> // for memset
#include "gfxCore.h" // for NS_GFX
#include "mozilla/Scoped.h" // for SCOPED_TEMPLATE
namespace mozilla {

View File

@ -10,15 +10,25 @@
#endif
#ifdef MOZ_GFXFEATUREREPORTER
#include "nsExceptionHandler.h"
#include "nsString.h"
#include "nsTArray.h"
#include "nsIObserverService.h"
#include "nsIObserver.h"
#include "nsAutoPtr.h"
#include "nsServiceManagerUtils.h"
#include "mozilla/Services.h"
#include "nsThreadUtils.h"
#include "gfxCrashReporterUtils.h"
#include <string.h> // for strcmp
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
#include "mozilla/Services.h" // for GetObserverService
#include "mozilla/mozalloc.h" // for operator new, etc
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsCOMPtr.h" // for nsCOMPtr
#include "nsError.h" // for NS_OK, NS_FAILED, nsresult
#include "nsExceptionHandler.h" // for AppendAppNotesToCrashReport
#include "nsID.h"
#include "nsIEventTarget.h" // for NS_DISPATCH_NORMAL
#include "nsIObserver.h" // for nsIObserver, etc
#include "nsIObserverService.h" // for nsIObserverService
#include "nsIRunnable.h" // for nsIRunnable
#include "nsISupports.h"
#include "nsStringGlue.h" // for nsAutoCString, nsCString, etc
#include "nsTArray.h" // for nsTArray
#include "nsThreadUtils.h" // for NS_DispatchToMainThread, etc
#include "nscore.h" // for NS_IMETHOD, NS_IMETHODIMP, etc
namespace mozilla {

View File

@ -5,17 +5,15 @@
#include "mozilla/Util.h"
#include "plstr.h"
#include "nsColor.h"
#include "nsColorNames.h"
#include "nsString.h"
#include "nscore.h"
#include "nsCoord.h"
#include "nsCOMPtr.h"
#include "nsIServiceManager.h"
#include <math.h>
#include "prprf.h"
#include <sys/types.h> // for int32_t
#include "mozilla/Util.h" // for ArrayLength
#include "mozilla/mozalloc.h" // for operator delete, etc
#include "nsColorNames.h" // for nsColorNames
#include "nsDebug.h" // for NS_ASSERTION, etc
#include "nsStaticNameTable.h"
#include "nsStringGlue.h" // for nsAutoCString, nsString, etc
#include "nscore.h" // for nsAString, etc
using namespace mozilla;

View File

@ -6,8 +6,11 @@
#ifndef nsColor_h___
#define nsColor_h___
#include "gfxCore.h"
#include "nscore.h"
#include <stddef.h> // for size_t
#include <stdint.h> // for uint8_t, uint32_t
#include "gfxCore.h" // for NS_GFX_
#include "nscore.h" // for nsAString
#include "prtypes.h" // for PR_BEGIN_MACRO, etc
class nsAString;
class nsString;

View File

@ -4,24 +4,36 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsDeviceContext.h"
#include <algorithm>
#include "gfxImageSurface.h"
#include "mozilla/Attributes.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "nsCRT.h"
#include "nsFontMetrics.h"
#include "nsIDeviceContextSpec.h"
#include "nsILanguageAtomService.h"
#include "nsIObserver.h"
#include "nsIObserverService.h"
#include "nsIScreen.h"
#include "nsIScreenManager.h"
#include "nsIServiceManager.h"
#include "nsIWidget.h"
#include "nsRenderingContext.h"
#include <algorithm> // for max
#include "gfxASurface.h" // for gfxASurface, etc
#include "gfxFont.h" // for gfxFontGroup
#include "gfxImageSurface.h" // for gfxImageSurface
#include "gfxPoint.h" // for gfxSize
#include "mozilla/Attributes.h" // for MOZ_FINAL
#include "mozilla/Preferences.h" // for Preferences
#include "mozilla/Services.h" // for GetObserverService
#include "mozilla/mozalloc.h" // for operator new
#include "nsCRT.h" // for nsCRT
#include "nsDebug.h" // for NS_NOTREACHED, NS_ASSERTION, etc
#include "nsFont.h" // for nsFont
#include "nsFontMetrics.h" // for nsFontMetrics
#include "nsIAtom.h" // for nsIAtom, do_GetAtom
#include "nsID.h"
#include "nsIDeviceContextSpec.h" // for nsIDeviceContextSpec
#include "nsILanguageAtomService.h" // for nsILanguageAtomService, etc
#include "nsIObserver.h" // for nsIObserver, etc
#include "nsIObserverService.h" // for nsIObserverService
#include "nsIScreen.h" // for nsIScreen
#include "nsIScreenManager.h" // for nsIScreenManager
#include "nsISupportsUtils.h" // for NS_ADDREF, NS_RELEASE
#include "nsIWidget.h" // for nsIWidget, NS_NATIVE_WINDOW
#include "nsRect.h" // for nsRect
#include "nsRenderingContext.h" // for nsRenderingContext
#include "nsServiceManagerUtils.h" // for do_GetService
#include "nsStringGlue.h" // for nsDependentString
#include "nsTArray.h" // for nsTArray, nsTArray_Impl
#include "nsThreadUtils.h" // for NS_IsMainThread
#include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc
#if !XP_MACOSX
#include "gfxPDFSurface.h"

View File

@ -6,11 +6,17 @@
#ifndef _NS_DEVICECONTEXT_H_
#define _NS_DEVICECONTEXT_H_
#include "gfxTypes.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsCoord.h"
#include "nsMathUtils.h"
#include <stdint.h> // for uint32_t
#include <sys/types.h> // for int32_t
#include "gfxTypes.h" // for gfxFloat
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsCOMPtr.h" // for nsCOMPtr
#include "nsCoord.h" // for nscoord
#include "nsError.h" // for nsresult
#include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING
#include "nsMathUtils.h" // for NS_round
#include "nscore.h" // for PRUnichar, nsAString
class gfxASurface;
class gfxUserFontSet;

View File

@ -4,10 +4,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsFont.h"
#include "nsString.h"
#include "gfxFont.h" // for gfxFontStyle
#include "gfxFontConstants.h" // for NS_FONT_KERNING_AUTO, etc
#include "gfxFontFeatures.h" // for gfxFontFeature, etc
#include "gfxFontUtils.h" // for TRUETYPE_TAG
#include "nsCRT.h" // for nsCRT
#include "nsDebug.h" // for NS_ASSERTION
#include "nsISupports.h"
#include "nsMemory.h" // for NS_ARRAY_LENGTH
#include "nsUnicharUtils.h"
#include "nsCRT.h"
#include "gfxFont.h"
#include "nscore.h" // for PRUnichar
#include "prtypes.h" // for PR_STATIC_ASSERT
nsFont::nsFont(const char* aName, uint8_t aStyle, uint8_t aVariant,
uint16_t aWeight, int16_t aStretch, uint8_t aDecoration,

View File

@ -6,13 +6,17 @@
#ifndef nsFont_h___
#define nsFont_h___
#include "gfxCore.h"
#include "nsCoord.h"
#include "nsStringGlue.h"
#include "nsTArray.h"
#include "gfxFontConstants.h"
#include <stdint.h> // for uint8_t, uint16_t
#include <sys/types.h> // for int16_t
#include "gfxCore.h" // for NS_GFX
#include "gfxFontFeatures.h"
#include "nsAutoPtr.h"
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsCoord.h" // for nscoord
#include "nsStringFwd.h" // for nsSubstring
#include "nsStringGlue.h" // for nsString
#include "nsTArray.h" // for nsTArray
struct gfxFontStyle;
// XXX we need a method to enumerate all of the possible fonts on the
// system across family, weight, style, size, etc. But not here!
@ -34,8 +38,6 @@ const uint8_t kGenericFont_monospace = 0x08;
const uint8_t kGenericFont_cursive = 0x10;
const uint8_t kGenericFont_fantasy = 0x20;
struct gfxFontStyle;
// Font structure.
struct NS_GFX nsFont {
// The family name of the font

View File

@ -4,11 +4,22 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsFontMetrics.h"
#include "nsBoundingMetrics.h"
#include "nsRenderingContext.h"
#include "nsDeviceContext.h"
#include "nsStyleConsts.h"
#include <algorithm>
#include <math.h> // for floor, ceil
#include <algorithm> // for max
#include "gfxPlatform.h" // for gfxPlatform
#include "gfxPoint.h" // for gfxPoint
#include "gfxRect.h" // for gfxRect
#include "gfxTypes.h" // for gfxFloat
#include "nsBoundingMetrics.h" // for nsBoundingMetrics
#include "nsDebug.h" // for NS_ERROR, NS_ABORT_IF_FALSE
#include "nsDeviceContext.h" // for nsDeviceContext
#include "nsIAtom.h" // for nsIAtom
#include "nsMathUtils.h" // for NS_round
#include "nsRenderingContext.h" // for nsRenderingContext
#include "nsStringGlue.h" // for nsString
#include "nsStyleConsts.h" // for NS_STYLE_HYPHENS_NONE
class gfxUserFontSet;
namespace {

View File

@ -6,13 +6,21 @@
#ifndef NSFONTMETRICS__H__
#define NSFONTMETRICS__H__
#include "nsCOMPtr.h"
#include "nsCoord.h"
#include "nsFont.h"
#include "gfxFont.h"
#include <stdint.h> // for uint32_t
#include <sys/types.h> // for int32_t
#include "gfxFont.h" // for gfxFont, gfxFontGroup
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsCOMPtr.h" // for nsCOMPtr
#include "nsCoord.h" // for nscoord
#include "nsError.h" // for nsresult
#include "nsFont.h" // for nsFont
#include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING
#include "nscore.h" // for PRUnichar
class nsIAtom;
class gfxUserFontSet;
class nsDeviceContext;
class nsIAtom;
class nsRenderingContext;
struct nsBoundingMetrics;

View File

@ -4,9 +4,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsRect.h"
#include "nsString.h"
#include "nsDeviceContext.h"
#include "prlog.h"
#include "mozilla/gfx/Types.h" // for NS_SIDE_BOTTOM, etc
#include "nsDeviceContext.h" // for nsDeviceContext
#include "nsStringGlue.h" // for nsAutoString, etc
#include "prtypes.h" // for PR_STATIC_ASSERT
// the mozilla::css::Side sequence must match the nsMargin nscoord sequence
PR_STATIC_ASSERT((NS_SIDE_TOP == 0) && (NS_SIDE_RIGHT == 1) && (NS_SIDE_BOTTOM == 2) && (NS_SIDE_LEFT == 3));

View File

@ -7,17 +7,20 @@
#ifndef NSRECT_H
#define NSRECT_H
#include <stdio.h>
#include "nsCoord.h"
#include "nsPoint.h"
#include "nsSize.h"
#include "nsMargin.h"
#include "gfxCore.h"
#include "nsTraceRefcnt.h"
#include "mozilla/gfx/BaseRect.h"
#include "mozilla/Likely.h"
#include <climits>
#include <algorithm>
#include <stdio.h> // for FILE
#include <sys/types.h> // for int32_t, int64_t
#include <algorithm> // for max, min
#include <climits> // for INT_MAX
#include "gfxCore.h" // for NS_GFX
#include "mozilla/Likely.h" // for MOZ_UNLIKELY
#include "mozilla/gfx/BaseRect.h" // for BaseRect
#include "nsCoord.h" // for nscoord, etc
#include "nsDebug.h" // for NS_WARNING
#include "nsMargin.h" // for nsMargin, etc
#include "nsPoint.h" // for nsIntPoint, nsPoint
#include "nsSize.h" // for nsIntSize, nsSize
#include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc
#include "nscore.h" // for NS_BUILD_REFCNT_LOGGING
struct nsIntRect;

View File

@ -3,11 +3,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsRegion.h"
#include "nsISupportsImpl.h"
#include "nsTArray.h"
#include "mozilla/ThreadLocal.h"
#include "nsPrintfCString.h"
#include <algorithm>
#include <algorithm> // for max, min
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2, etc
#include "mozilla/ThreadLocal.h" // for ThreadLocal
#include "mozilla/mozalloc.h" // for operator delete, etc
#include "nsDebug.h" // for NS_ASSERTION, NS_ERROR
#include "nsISupports.h" // for NS_ASSERT_OWNINGTHREAD, etc
#include "nsPrintfCString.h" // for nsPrintfCString
#include "nsTArray.h" // for nsTArray, nsTArray_Impl, etc
/*
* The SENTINEL values below guaranties that a < or >

View File

@ -6,9 +6,16 @@
#ifndef nsRegion_h__
#define nsRegion_h__
#include "nsRect.h"
#include "nsPoint.h"
#include "nsString.h"
#include <stddef.h> // for size_t
#include <stdint.h> // for uint32_t, uint64_t
#include <sys/types.h> // for int32_t
#include "gfxCore.h" // for NS_GFX
#include "nsCoord.h" // for nscoord
#include "nsError.h" // for nsresult
#include "nsPoint.h" // for nsIntPoint, nsPoint
#include "nsRect.h" // for nsIntRect, nsRect
#include "nsStringGlue.h" // for nsCString
#include "xpcom-config.h" // for CPP_THROW_NEW
class nsIntRegion;

View File

@ -4,9 +4,23 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsRenderingContext.h"
#include "nsBoundingMetrics.h"
#include "nsRegion.h"
#include <algorithm>
#include <string.h> // for strlen
#include <algorithm> // for min
#include "gfxColor.h" // for gfxRGBA
#include "gfxMatrix.h" // for gfxMatrix
#include "gfxPoint.h" // for gfxPoint, gfxSize
#include "gfxRect.h" // for gfxRect
#include "gfxTypes.h" // for gfxFloat
#include "mozilla/gfx/BasePoint.h" // for BasePoint
#include "mozilla/mozalloc.h" // for operator delete[], etc
#include "nsBoundingMetrics.h" // for nsBoundingMetrics
#include "nsCharTraits.h" // for NS_IS_LOW_SURROGATE
#include "nsDebug.h" // for NS_ERROR
#include "nsPoint.h" // for nsPoint
#include "nsRect.h" // for nsRect, nsIntRect
#include "nsRegion.h" // for nsIntRegionRectIterator, etc
class gfxASurface;
// XXXTodo: rename FORM_TWIPS to FROM_APPUNITS
#define FROM_TWIPS(_x) ((gfxFloat)((_x)/(mP2A)))

View File

@ -6,16 +6,25 @@
#ifndef NSRENDERINGCONTEXT__H__
#define NSRENDERINGCONTEXT__H__
#include "nsAutoPtr.h"
#include "nsDeviceContext.h"
#include "nsFontMetrics.h"
#include "nsColor.h"
#include "nsCoord.h"
#include "gfxContext.h"
#include "mozilla/gfx/UserData.h"
#include <stdint.h> // for uint32_t
#include <sys/types.h> // for int32_t
#include "gfxContext.h" // for gfxContext
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
#include "mozilla/gfx/UserData.h" // for UserData, UserDataKey
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsBoundingMetrics.h" // for nsBoundingMetrics
#include "nsColor.h" // for nscolor
#include "nsCoord.h" // for nscoord, NSToIntRound
#include "nsDeviceContext.h" // for nsDeviceContext
#include "nsFontMetrics.h" // for nsFontMetrics
#include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING, etc
#include "nsStringGlue.h" // for nsString
#include "nscore.h" // for PRUnichar
struct nsPoint;
class gfxASurface;
class nsIntRegion;
struct nsPoint;
struct nsRect;
typedef enum {
nsLineStyle_kNone = 0,

View File

@ -5,10 +5,19 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsScriptableRegion.h"
#include "nsCOMPtr.h"
#include "nsIXPConnect.h"
#include "nsServiceManagerUtils.h"
#include "jsapi.h"
#include <stdint.h> // for uint32_t
#include <sys/types.h> // for int32_t
#include "js/RootingAPI.h" // for Rooted
#include "js/Value.h" // for INT_TO_JSVAL, etc
#include "jsapi.h" // for JS_DefineElement, etc
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
#include "nsError.h" // for NS_OK, NS_ERROR_FAILURE, etc
#include "nsID.h"
#include "nsRect.h" // for nsIntRect
#include "nscore.h" // for NS_IMETHODIMP
class JSObject;
struct JSContext;
nsScriptableRegion::nsScriptableRegion()
{

View File

@ -4,12 +4,18 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsThebesFontEnumerator.h"
#include "nsMemory.h"
#include "gfxPlatform.h"
#include "nsTArray.h"
#include "nsIAtom.h"
#include <stdint.h> // for uint32_t
#include "gfxPlatform.h" // for gfxPlatform
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
#include "nsCOMPtr.h" // for nsCOMPtr
#include "nsDebug.h" // for NS_ENSURE_ARG_POINTER
#include "nsError.h" // for NS_OK, NS_FAILED, nsresult
#include "nsIAtom.h" // for nsIAtom, do_GetAtom
#include "nsID.h"
#include "nsMemory.h" // for nsMemory
#include "nsStringGlue.h" // for nsAutoCString, nsAutoString, etc
#include "nsTArray.h" // for nsTArray, nsTArray_Impl, etc
#include "nscore.h" // for PRUnichar, NS_IMETHODIMP
NS_IMPL_ISUPPORTS1(nsThebesFontEnumerator, nsIFontEnumerator)

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