Merge mozilla-central and inbound

This commit is contained in:
Ed Morley 2013-07-22 16:52:23 +01:00
Родитель a8fb8b7383 e69fee0a8c
Коммит b4587ffa38
145 изменённых файлов: 1751 добавлений и 902 удалений

Просмотреть файл

@ -34,7 +34,7 @@ sdnTextAccessible::get_domText(BSTR __RPC_FAR* aText)
if (!aText)
return E_INVALIDARG;
*aText = NULL;
*aText = nullptr;
if (mAccessible->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -170,7 +170,7 @@ sdnTextAccessible::get_fontFamily(BSTR __RPC_FAR* aFontFamily)
if (!aFontFamily)
return E_INVALIDARG;
*aFontFamily = NULL;
*aFontFamily = nullptr;
if (mAccessible->IsDefunct())
return CO_E_OBJNOTCONNECTED;

Просмотреть файл

@ -345,8 +345,8 @@ var gPluginHandler = {
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
let permissionString = pluginHost.getPermissionStringForType(objLoadingContent.actualType);
let browser = gBrowser.getBrowserForDocument(objLoadingContent.ownerDocument.defaultView.top.document);
let pluginPermission = Services.perms.testPermission(browser.currentURI, permissionString);
let principal = objLoadingContent.ownerDocument.defaultView.top.document.nodePrincipal;
let pluginPermission = Services.perms.testPermissionFromPrincipal(principal, permissionString);
let isFallbackTypeValid =
objLoadingContent.pluginFallbackType >= Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY &&
@ -511,7 +511,8 @@ var gPluginHandler = {
if (!gPluginHandler.isKnownPlugin(objLoadingContent))
return;
let permissionString = pluginHost.getPermissionStringForType(objLoadingContent.actualType);
let pluginPermission = Services.perms.testPermission(browser.currentURI, permissionString);
let principal = doc.defaultView.top.document.nodePrincipal;
let pluginPermission = Services.perms.testPermissionFromPrincipal(principal, permissionString);
let overlay = doc.getAnonymousElementByAttribute(aPlugin, "class", "mainBox");
@ -630,13 +631,28 @@ var gPluginHandler = {
}
},
// Match the behaviour of nsPermissionManager
_getHostFromPrincipal: function PH_getHostFromPrincipal(principal) {
if (!principal.URI || principal.URI.schemeIs("moz-nullprincipal")) {
return "(null)";
}
try {
if (principal.URI.host)
return principal.URI.host;
} catch (e) {}
return principal.origin;
},
_makeCenterActions: function PH_makeCenterActions(notification) {
let browser = notification.browser;
let contentWindow = browser.contentWindow;
let contentWindow = notification.browser.contentWindow;
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(browser.currentURI);
let principal = contentWindow.document.nodePrincipal;
// This matches the behavior of nsPermssionManager, used for display purposes only
let principalHost = this._getHostFromPrincipal(principal);
let centerActions = [];
let pluginsFound = new Set();
@ -666,7 +682,7 @@ var gPluginHandler = {
pluginInfo.pluginPermissionType = permissionObj.expireType;
}
else {
pluginInfo.pluginPermissionHost = browser.currentURI.host;
pluginInfo.pluginPermissionHost = principalHost;
pluginInfo.pluginPermissionType = undefined;
}
@ -729,9 +745,11 @@ var gPluginHandler = {
}
let browser = aNotification.browser;
let contentWindow = browser.contentWindow;
if (aNewState != "continue") {
Services.perms.add(browser.currentURI, aPluginInfo.permissionString,
permission, expireType, expireTime);
let principal = contentWindow.document.nodePrincipal;
Services.perms.addFromPrincipal(principal, aPluginInfo.permissionString,
permission, expireType, expireTime);
if (aNewState == "block") {
return;
@ -740,7 +758,6 @@ var gPluginHandler = {
// Manually activate the plugins that would have been automatically
// activated.
let contentWindow = browser.contentWindow;
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let plugins = cwu.plugins;

Просмотреть файл

@ -192,6 +192,7 @@ MOCHITEST_BROWSER_FILES = \
browser_contentAreaClick.js \
browser_contextSearchTabPosition.js \
browser_CTP_drag_drop.js \
browser_CTP_data_urls.js \
browser_ctrlTab.js \
browser_customize_popupNotification.js \
browser_customize.js \
@ -317,6 +318,7 @@ MOCHITEST_BROWSER_FILES = \
plugin_test2.html \
plugin_test3.html \
plugin_two_types.html \
plugin_data_url.html \
plugin_unknown.html \
pluginCrashCommentAndURL.html \
POSTSearchEngine.xml \

Просмотреть файл

@ -0,0 +1,239 @@
var rootDir = getRootDirectory(gTestPath);
const gTestRoot = rootDir;
const gHttpTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
var gTestBrowser = null;
var gNextTest = null;
var gPluginHost = Components.classes["@mozilla.org/plugin/host;1"].getService(Components.interfaces.nsIPluginHost);
Components.utils.import("resource://gre/modules/Services.jsm");
// This listens for the next opened tab and checks it is of the right url.
// opencallback is called when the new tab is fully loaded
// closecallback is called when the tab is closed
function TabOpenListener(url, opencallback, closecallback) {
this.url = url;
this.opencallback = opencallback;
this.closecallback = closecallback;
gBrowser.tabContainer.addEventListener("TabOpen", this, false);
}
TabOpenListener.prototype = {
url: null,
opencallback: null,
closecallback: null,
tab: null,
browser: null,
handleEvent: function(event) {
if (event.type == "TabOpen") {
gBrowser.tabContainer.removeEventListener("TabOpen", this, false);
this.tab = event.originalTarget;
this.browser = this.tab.linkedBrowser;
gBrowser.addEventListener("pageshow", this, false);
} else if (event.type == "pageshow") {
if (event.target.location.href != this.url)
return;
gBrowser.removeEventListener("pageshow", this, false);
this.tab.addEventListener("TabClose", this, false);
var url = this.browser.contentDocument.location.href;
is(url, this.url, "Should have opened the correct tab");
this.opencallback(this.tab, this.browser.contentWindow);
} else if (event.type == "TabClose") {
if (event.originalTarget != this.tab)
return;
this.tab.removeEventListener("TabClose", this, false);
this.opencallback = null;
this.tab = null;
this.browser = null;
// Let the window close complete
executeSoon(this.closecallback);
this.closecallback = null;
}
}
};
function test() {
waitForExplicitFinish();
registerCleanupFunction(function() {
clearAllPluginPermissions();
Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_ENABLED;
getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_ENABLED;
});
Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
var newTab = gBrowser.addTab();
gBrowser.selectedTab = newTab;
gTestBrowser = gBrowser.selectedBrowser;
gTestBrowser.addEventListener("load", pageLoad, true);
Services.prefs.setBoolPref("plugins.click_to_play", true);
getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
prepareTest(test1a, gHttpTestRoot + "plugin_data_url.html");
}
function finishTest() {
clearAllPluginPermissions();
gTestBrowser.removeEventListener("load", pageLoad, true);
gBrowser.removeCurrentTab();
window.focus();
finish();
}
function pageLoad() {
// The plugin events are async dispatched and can come after the load event
// This just allows the events to fire before we then go on to test the states
executeSoon(gNextTest);
}
function prepareTest(nextTest, url) {
gNextTest = nextTest;
gTestBrowser.contentWindow.location = url;
}
// Test that the click-to-play doorhanger still works when navigating to data URLs
function test1a() {
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
ok(popupNotification, "Test 1a, Should have a click-to-play notification");
let plugin = gTestBrowser.contentDocument.getElementById("test");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "Test 1a, Plugin should not be activated");
gNextTest = test1b;
gTestBrowser.contentDocument.getElementById("data-link-1").click();
}
function test1b() {
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
ok(popupNotification, "Test 1b, Should have a click-to-play notification");
let plugin = gTestBrowser.contentDocument.getElementById("test");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "Test 1b, Plugin should not be activated");
// Simulate clicking the "Allow Always" button.
popupNotification.reshow();
PopupNotifications.panel.firstChild._primaryButton.click();
let condition = function() objLoadingContent.activated;
waitForCondition(condition, test1c, "Test 1b, Waited too long for plugin to activate");
}
function test1c() {
clearAllPluginPermissions();
prepareTest(test2a, gHttpTestRoot + "plugin_data_url.html");
}
// Test that the click-to-play notification doesn't break when navigating to data URLs with multiple plugins
function test2a() {
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
ok(popupNotification, "Test 2a, Should have a click-to-play notification");
let plugin = gTestBrowser.contentDocument.getElementById("test");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "Test 2a, Plugin should not be activated");
gNextTest = test2b;
gTestBrowser.contentDocument.getElementById("data-link-2").click();
}
function test2b() {
let notification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
ok(notification, "Test 2b, Should have a click-to-play notification");
// Simulate choosing "Allow now" for the test plugin
notification.reshow();
is(notification.options.centerActions.length, 2, "Test 2b, Should have two types of plugin in the notification");
var centerAction = null;
for (var action of notification.options.centerActions) {
if (action.pluginName == "Test") {
centerAction = action;
break;
}
}
ok(centerAction, "Test 2b, found center action for the Test plugin");
var centerItem = null;
for (var item of PopupNotifications.panel.firstChild.childNodes) {
is(item.value, "block", "Test 2b, all plugins should start out blocked");
if (item.action == centerAction) {
centerItem = item;
break;
}
}
ok(centerItem, "Test 2b, found center item for the Test plugin");
// "click" the button to activate the Test plugin
centerItem.value = "allownow";
PopupNotifications.panel.firstChild._primaryButton.click();
let plugin = gTestBrowser.contentDocument.getElementById("test1");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
let condition = function() objLoadingContent.activated;
waitForCondition(condition, test2c, "Test 2b, Waited too long for plugin to activate");
}
function test2c() {
let plugin = gTestBrowser.contentDocument.getElementById("test1");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(objLoadingContent.activated, "Test 2c, Plugin should be activated");
clearAllPluginPermissions();
prepareTest(test3a, gHttpTestRoot + "plugin_data_url.html");
}
// Test that when navigating to a data url, the plugin permission is inherited
function test3a() {
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
ok(popupNotification, "Test 3a, Should have a click-to-play notification");
let plugin = gTestBrowser.contentDocument.getElementById("test");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "Test 3a, Plugin should not be activated");
// Simulate clicking the "Allow Always" button.
popupNotification.reshow();
PopupNotifications.panel.firstChild._primaryButton.click();
let condition = function() objLoadingContent.activated;
waitForCondition(condition, test3b, "Test 3a, Waited too long for plugin to activate");
}
function test3b() {
gNextTest = test3c;
gTestBrowser.contentDocument.getElementById("data-link-1").click();
}
function test3c() {
let plugin = gTestBrowser.contentDocument.getElementById("test");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(objLoadingContent.activated, "Test 3c, Plugin should be activated");
clearAllPluginPermissions();
prepareTest(test4b, 'data:text/html,<embed id="test" style="width: 200px; height: 200px" type="application/x-test"/>');
}
// Test that the click-to-play doorhanger still works when directly navigating to data URLs
function test4a() {
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
ok(popupNotification, "Test 4a, Should have a click-to-play notification");
let plugin = gTestBrowser.contentDocument.getElementById("test");
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
ok(!objLoadingContent.activated, "Test 4a, Plugin should not be activated");
// Simulate clicking the "Allow Always" button.
popupNotification.reshow();
PopupNotifications.panel.firstChild._primaryButton.click();
let condition = function() objLoadingContent.activated;
waitForCondition(condition, test4b, "Test 4a, Waited too long for plugin to activate");
}
function test4b() {
clearAllPluginPermissions();
finishTest();
}

Просмотреть файл

@ -0,0 +1,11 @@
<html>
<body>
<a id="data-link-1" href='data:text/html,<embed id="test" style="width: 200px; height: 200px" type="application/x-test"/>'>
data: with one plugin
</a><br />
<a id="data-link-2" href='data:text/html,<embed id="test1" style="width: 200px; height: 200px" type="application/x-test"/><embed id="test2" style="width: 200px; height: 200px" type="application/x-second-test"/>'>
data: with two plugins
</a><br />
<object id="test" style="width: 200px; height: 200px" type="application/x-test"></object>
</body>
</html>

Просмотреть файл

@ -1600,7 +1600,8 @@
return;
}
this._setupDescription("pluginActivateMultiple.message");
let host = gPluginHandler._getHostFromPrincipal(this.notification.browser.contentWindow.document.nodePrincipal);
this._setupDescription("pluginActivateMultiple.message", null, host);
var showBox = document.getAnonymousElementByAttribute(this, "anonid", "plugin-notification-showbox");
@ -1763,9 +1764,6 @@
span.removeChild(span.lastChild);
}
if (!host) {
host = this.notification.browser.currentURI.host;
}
var args = ["__host__", this._brandShortName];
if (pluginName) {
args.unshift(pluginName);

Просмотреть файл

@ -38,7 +38,6 @@
#include "nsEvent.h"
#include "nsAttrValue.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "nsIHTMLCollection.h"
#include "Units.h"
class nsIDOMEventListener;
@ -600,36 +599,6 @@ public:
ErrorResult& aError);
already_AddRefed<nsIHTMLCollection>
GetElementsByClassName(const nsAString& aClassNames);
Element* GetFirstElementChild() const;
Element* GetLastElementChild() const;
Element* GetPreviousElementSibling() const
{
nsIContent* previousSibling = GetPreviousSibling();
while (previousSibling) {
if (previousSibling->IsElement()) {
return previousSibling->AsElement();
}
previousSibling = previousSibling->GetPreviousSibling();
}
return nullptr;
}
Element* GetNextElementSibling() const
{
nsIContent* nextSibling = GetNextSibling();
while (nextSibling) {
if (nextSibling->IsElement()) {
return nextSibling->AsElement();
}
nextSibling = nextSibling->GetNextSibling();
}
return nullptr;
}
uint32_t ChildElementCount()
{
return Children()->Length();
}
bool MozMatchesSelector(const nsAString& aSelector,
ErrorResult& aError);
void SetCapture(bool aRetargetToElement)

Просмотреть файл

@ -23,6 +23,7 @@
#include "nsINodeList.h" // base class
#include "nsIWeakReference.h" // base class
#include "nsNodeUtils.h" // class member nsNodeUtils::CloneNodeImpl
#include "nsIHTMLCollection.h"
class ContentUnbinder;
class nsContentList;
@ -32,7 +33,6 @@ class nsIControllers;
class nsICSSDeclaration;
class nsIDocument;
class nsDOMStringMap;
class nsIHTMLCollection;
class nsINodeInfo;
class nsIURI;
@ -229,6 +229,10 @@ public:
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) MOZ_OVERRIDE;
nsIHTMLCollection* Children();
uint32_t ChildElementCount()
{
return Children()->Length();
}
public:
/**

Просмотреть файл

@ -53,6 +53,7 @@ class nsIDOMElement;
class nsIDOMNodeList;
class nsIDOMXPathExpression;
class nsIDOMXPathNSResolver;
class nsIHTMLCollection;
class nsILayoutHistoryState;
class nsIObjectLoadingContent;
class nsIObserver;
@ -2120,6 +2121,10 @@ public:
void ObsoleteSheet(const nsAString& aSheetURI, mozilla::ErrorResult& rv);
// ParentNode
nsIHTMLCollection* Children();
uint32_t ChildElementCount();
virtual nsHTMLDocument* AsHTMLDocument() { return nullptr; }
virtual JSObject* WrapObject(JSContext *aCx,
@ -2211,6 +2216,9 @@ protected:
nsPropertyTable mPropertyTable;
nsTArray<nsAutoPtr<nsPropertyTable> > mExtraPropertyTables;
// Our cached .children collection
nsCOMPtr<nsIHTMLCollection> mChildrenCollection;
// Compatibility mode
nsCompatibility mCompatMode;

Просмотреть файл

@ -1590,11 +1590,18 @@ public:
return rv.ErrorCode();
}
// ChildNode methods
mozilla::dom::Element* GetPreviousElementSibling() const;
mozilla::dom::Element* GetNextElementSibling() const;
/**
* Remove this node from its parent, if any.
*/
void Remove();
// ParentNode methods
mozilla::dom::Element* GetFirstElementChild() const;
mozilla::dom::Element* GetLastElementChild() const;
protected:
// Override this function to create a custom slots class.

Просмотреть файл

@ -416,34 +416,6 @@ Element::WrapObject(JSContext *aCx, JS::Handle<JSObject*> aScope)
return obj;
}
Element*
Element::GetFirstElementChild() const
{
uint32_t i, count = mAttrsAndChildren.ChildCount();
for (i = 0; i < count; ++i) {
nsIContent* child = mAttrsAndChildren.ChildAt(i);
if (child->IsElement()) {
return child->AsElement();
}
}
return nullptr;
}
Element*
Element::GetLastElementChild() const
{
uint32_t i = mAttrsAndChildren.ChildCount();
while (i > 0) {
nsIContent* child = mAttrsAndChildren.ChildAt(--i);
if (child->IsElement()) {
return child->AsElement();
}
}
return nullptr;
}
nsDOMTokenList*
Element::GetClassList()
{

Просмотреть файл

@ -1793,6 +1793,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStateObjectCached)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mUndoManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTemplateContentsOwner)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChildrenCollection)
// Traverse all our nsCOMArrays.
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStyleSheets)
@ -1877,6 +1878,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCachedEncoder)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mUndoManager)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTemplateContentsOwner)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mChildrenCollection)
tmp->mParentDocument = nullptr;
@ -9475,6 +9477,25 @@ nsIDocument::ObsoleteSheet(const nsAString& aSheetURI, ErrorResult& rv)
}
}
nsIHTMLCollection*
nsIDocument::Children()
{
if (!mChildrenCollection) {
mChildrenCollection = new nsContentList(this, kNameSpaceID_Wildcard,
nsGkAtoms::_asterix,
nsGkAtoms::_asterix,
false);
}
return mChildrenCollection;
}
uint32_t
nsIDocument::ChildElementCount()
{
return Children()->Length();
}
namespace mozilla {
// Singleton class to manage the list of fullscreen documents which are the

Просмотреть файл

@ -1404,6 +1404,34 @@ nsINode::doInsertChildAt(nsIContent* aKid, uint32_t aIndex,
return NS_OK;
}
Element*
nsINode::GetPreviousElementSibling() const
{
nsIContent* previousSibling = GetPreviousSibling();
while (previousSibling) {
if (previousSibling->IsElement()) {
return previousSibling->AsElement();
}
previousSibling = previousSibling->GetPreviousSibling();
}
return nullptr;
}
Element*
nsINode::GetNextElementSibling() const
{
nsIContent* nextSibling = GetNextSibling();
while (nextSibling) {
if (nextSibling->IsElement()) {
return nextSibling->AsElement();
}
nextSibling = nextSibling->GetNextSibling();
}
return nullptr;
}
void
nsINode::Remove()
{
@ -1419,6 +1447,34 @@ nsINode::Remove()
parent->RemoveChildAt(uint32_t(index), true);
}
Element*
nsINode::GetFirstElementChild() const
{
for (nsIContent* child = GetFirstChild();
child;
child = child->GetNextSibling()) {
if (child->IsElement()) {
return child->AsElement();
}
}
return nullptr;
}
Element*
nsINode::GetLastElementChild() const
{
for (nsIContent* child = GetLastChild();
child;
child = child->GetPreviousSibling()) {
if (child->IsElement()) {
return child->AsElement();
}
}
return nullptr;
}
void
nsINode::doRemoveChildAt(uint32_t aIndex, bool aNotify,
nsIContent* aKid, nsAttrAndChildArray& aChildArray)

Просмотреть файл

@ -249,6 +249,7 @@ MOCHITEST_FILES_A = \
test_bug820909.html \
test_bug704063.html \
test_bug894874.html \
test_bug895974.html \
$(NULL)
MOCHITEST_FILES_B = \

Просмотреть файл

@ -0,0 +1,69 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=895974
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 895974</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 895974 **/
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
var frag = document.createDocumentFragment();
var span = document.createElement("span");
var div = document.createElement("div");
var text = document.createTextNode("help");
frag.appendChild(document.createTextNode("fail"));
frag.appendChild(span);
frag.appendChild(text);
frag.appendChild(div);
frag.appendChild(document.createTextNode("fail"));
is(text.nextElementSibling, div, "nextElementSibling should work on text");
is(text.previousElementSibling, span,
"previousElementSibling should work on text");
is(document.firstElementChild, document.documentElement,
"firstElementChild should work on document");
is(document.lastElementChild, document.documentElement,
"lastElementChild should work on document");
is(document.children.length, 1, "Document has one element kid");
is(document.children[0], document.documentElement,
"Document only element child is <html>");
is(frag.firstElementChild, span,
"firstElementChild should work on document fragment");
is(frag.lastElementChild, div,
"lastElementChild should work on document fragment");
is(frag.children.length, 2, "Document fragment has two element kids");
is(frag.children[0], span, "Document fragment first element child is span");
is(frag.children[1], div, "Document fragment second element child is div");
is(document.documentElement.firstElementChild, document.head,
"firstElementChild should work on element");
is(document.documentElement.lastElementChild, document.body,
"lastElementChild should work on element");
is(document.documentElement.children.length, 2, "<html> has two element kids");
is(document.documentElement.children[0], document.head,
"<html> first element child is head");
is(document.documentElement.children[1], document.body,
"<html> second element child is body");
SimpleTest.finish();
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=895974">Mozilla Bug 895974</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -522,7 +522,8 @@ public:
template<class ElementType>
void TexImage2D(WebGLenum target, WebGLint level,
WebGLenum internalformat, WebGLenum format, WebGLenum type,
const ElementType& elt, ErrorResult& rv) {
ElementType& elt, ErrorResult& rv)
{
if (!IsContextStable())
return;
nsRefPtr<gfxImageSurface> isurf;
@ -559,7 +560,8 @@ public:
template<class ElementType>
void TexSubImage2D(WebGLenum target, WebGLint level,
WebGLint xoffset, WebGLint yoffset, WebGLenum format,
WebGLenum type, const ElementType& elt, ErrorResult& rv) {
WebGLenum type, ElementType& elt, ErrorResult& rv)
{
if (!IsContextStable())
return;
nsRefPtr<gfxImageSurface> isurf;
@ -976,8 +978,9 @@ protected:
return nsLayoutUtils::SurfaceFromElement(aElement, flags);
}
template<class ElementType>
nsLayoutUtils::SurfaceFromElementResult SurfaceFromElement(const dom::NonNull<ElementType>& aElement) {
return SurfaceFromElement(aElement.get());
nsLayoutUtils::SurfaceFromElementResult SurfaceFromElement(ElementType& aElement)
{
return SurfaceFromElement(&aElement);
}
nsresult SurfaceFromElementResultToImageSurface(nsLayoutUtils::SurfaceFromElementResult& res,

Просмотреть файл

@ -115,6 +115,7 @@ MOCHITEST_FILES = \
test_volume.html \
test_video_to_canvas.html \
test_audiowrite.html \
test_mediarecorder_creation.html \
test_mozHasAudio.html \
test_source_media.html \
test_autoplay_contentEditable.html \

Просмотреть файл

@ -78,6 +78,12 @@ var gTrackTests = [
{ name:"bogus.duh", type:"bogus/duh" }
];
// Used by any media recorder test. Need one test file per decoder backend
// currently supported by the media encoder.
var gMediaRecorderTests = [
{ name:"detodos.opus", type:"audio/ogg; codecs=opus", duration:2.9135 }
];
// These are files that we want to make sure we can play through. We can
// also check metadata. Put files of the same type together in this list so if
// something crashes we have some idea of which backend is responsible.

Просмотреть файл

@ -0,0 +1,45 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test MediaRecorder Creation</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
var manager = new MediaTestManager;
/**
* Starts a test on every media recorder file included to check that
* a media recorder object created with a stream derived from a media
* element with that file produces the correct starting attribute values.
*/
function startTest(test, token) {
var element = document.createElement('audio');
element.token = token;
manager.started(token);
element.src = test.name;
element.test = test;
element.stream = element.mozCaptureStreamUntilEnded();
var mediaRecorder = new MediaRecorder(element.stream);
is(mediaRecorder.stream, element.stream,
'Stream should be provided stream on creation');
is(mediaRecorder.mimeType, '',
'mimeType should be an empty string on creation');
is(mediaRecorder.state, 'inactive',
'state should be inactive on creation');
manager.finished(token);
}
manager.runTests(gMediaRecorderTests, startTest);
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -2022,6 +2022,37 @@ const T& Constify(T& arg)
return arg;
}
// Helper for turning (Owning)NonNull<T> into T&
template<typename T>
T& NonNullHelper(T& aArg)
{
return aArg;
}
template<typename T>
T& NonNullHelper(NonNull<T>& aArg)
{
return aArg;
}
template<typename T>
const T& NonNullHelper(const NonNull<T>& aArg)
{
return aArg;
}
template<typename T>
T& NonNullHelper(OwningNonNull<T>& aArg)
{
return aArg;
}
template<typename T>
const T& NonNullHelper(const OwningNonNull<T>& aArg)
{
return aArg;
}
// Reparent the wrapper of aObj to whatever its native now thinks its
// parent should be.
nsresult

Просмотреть файл

@ -4420,6 +4420,11 @@ class CGCallGenerator(CGThing):
return False
if needsConst(a):
arg = CGWrapper(arg, pre="Constify(", post=")")
# And convert NonNull<T> to T&
if (((a.type.isInterface() or a.type.isCallback()) and
not a.type.nullable()) or
a.type.isDOMString()):
arg = CGWrapper(arg, pre="NonNullHelper(", post=")")
args.append(arg)
# Return values that go in outparams go here

Просмотреть файл

@ -275,7 +275,6 @@ public:
TestInterface* ReceiveWeakSelf();
TestInterface* ReceiveWeakNullableSelf();
void PassSelf(TestInterface&);
void PassSelf2(NonNull<TestInterface>&);
void PassNullableSelf(TestInterface*);
already_AddRefed<TestInterface> NonNullSelf();
void SetNonNullSelf(TestInterface&);
@ -297,7 +296,6 @@ public:
IndirectlyImplementedInterface* ReceiveWeakOther();
IndirectlyImplementedInterface* ReceiveWeakNullableOther();
void PassOther(IndirectlyImplementedInterface&);
void PassOther2(NonNull<IndirectlyImplementedInterface>&);
void PassNullableOther(IndirectlyImplementedInterface*);
already_AddRefed<IndirectlyImplementedInterface> NonNullOther();
void SetNonNullOther(IndirectlyImplementedInterface&);
@ -312,7 +310,6 @@ public:
TestExternalInterface* ReceiveWeakExternal();
TestExternalInterface* ReceiveWeakNullableExternal();
void PassExternal(TestExternalInterface*);
void PassExternal2(TestExternalInterface*);
void PassNullableExternal(TestExternalInterface*);
already_AddRefed<TestExternalInterface> NonNullExternal();
void SetNonNullExternal(TestExternalInterface*);
@ -327,7 +324,6 @@ public:
TestCallbackInterface* ReceiveWeakCallbackInterface();
TestCallbackInterface* ReceiveWeakNullableCallbackInterface();
void PassCallbackInterface(TestCallbackInterface&);
void PassCallbackInterface2(OwningNonNull<TestCallbackInterface>);
void PassNullableCallbackInterface(TestCallbackInterface*);
already_AddRefed<TestCallbackInterface> NonNullCallbackInterface();
void SetNonNullCallbackInterface(TestCallbackInterface&);
@ -808,6 +804,28 @@ private:
void PassVariadicAny(JSContext*, Sequence<JS::Value>&) MOZ_DELETE;
void PassVariadicObject(JSContext*, Sequence<JSObject*>&) MOZ_DELETE;
void PassVariadicNullableObject(JSContext*, Sequence<JSObject*>&) MOZ_DELETE;
// Ensure NonNull does not leak in
void PassSelf(NonNull<TestInterface>&) MOZ_DELETE;
void PassSelf(OwningNonNull<TestInterface>&) MOZ_DELETE;
void PassSelf(const NonNull<TestInterface>&) MOZ_DELETE;
void PassSelf(const OwningNonNull<TestInterface>&) MOZ_DELETE;
void PassOther(NonNull<IndirectlyImplementedInterface>&) MOZ_DELETE;
void PassOther(const NonNull<IndirectlyImplementedInterface>&) MOZ_DELETE;
void PassOther(OwningNonNull<IndirectlyImplementedInterface>&) MOZ_DELETE;
void PassOther(const OwningNonNull<IndirectlyImplementedInterface>&) MOZ_DELETE;
void PassCallbackInterface(OwningNonNull<TestCallbackInterface>&) MOZ_DELETE;
void PassCallbackInterface(const OwningNonNull<TestCallbackInterface>&) MOZ_DELETE;
void PassCallbackInterface(NonNull<TestCallbackInterface>&) MOZ_DELETE;
void PassCallbackInterface(const NonNull<TestCallbackInterface>&) MOZ_DELETE;
void PassCallback(OwningNonNull<TestCallback>&) MOZ_DELETE;
void PassCallback(const OwningNonNull<TestCallback>&) MOZ_DELETE;
void PassCallback(NonNull<TestCallback>&) MOZ_DELETE;
void PassCallback(const NonNull<TestCallback>&) MOZ_DELETE;
void PassString(const NonNull<nsAString>&) MOZ_DELETE;
void PassString(NonNull<nsAString>&) MOZ_DELETE;
void PassString(const OwningNonNull<nsAString>&) MOZ_DELETE;
void PassString(OwningNonNull<nsAString>&) MOZ_DELETE;
};
class TestIndexedGetterInterface : public nsISupports,

Просмотреть файл

@ -223,10 +223,7 @@ interface TestInterface {
TestInterface? receiveNullableSelf();
TestInterface receiveWeakSelf();
TestInterface? receiveWeakNullableSelf();
// A verstion to test for casting to TestInterface&
void passSelf(TestInterface arg);
// A version we can use to test for the exact type passed in
void passSelf2(TestInterface arg);
void passNullableSelf(TestInterface? arg);
attribute TestInterface nonNullSelf;
attribute TestInterface? nullableSelf;
@ -254,10 +251,7 @@ interface TestInterface {
IndirectlyImplementedInterface? receiveNullableOther();
IndirectlyImplementedInterface receiveWeakOther();
IndirectlyImplementedInterface? receiveWeakNullableOther();
// A verstion to test for casting to IndirectlyImplementedInterface&
void passOther(IndirectlyImplementedInterface arg);
// A version we can use to test for the exact type passed in
void passOther2(IndirectlyImplementedInterface arg);
void passNullableOther(IndirectlyImplementedInterface? arg);
attribute IndirectlyImplementedInterface nonNullOther;
attribute IndirectlyImplementedInterface? nullableOther;
@ -271,10 +265,7 @@ interface TestInterface {
TestExternalInterface? receiveNullableExternal();
TestExternalInterface receiveWeakExternal();
TestExternalInterface? receiveWeakNullableExternal();
// A verstion to test for casting to TestExternalInterface&
void passExternal(TestExternalInterface arg);
// A version we can use to test for the exact type passed in
void passExternal2(TestExternalInterface arg);
void passNullableExternal(TestExternalInterface? arg);
attribute TestExternalInterface nonNullExternal;
attribute TestExternalInterface? nullableExternal;
@ -288,10 +279,7 @@ interface TestInterface {
TestCallbackInterface? receiveNullableCallbackInterface();
TestCallbackInterface receiveWeakCallbackInterface();
TestCallbackInterface? receiveWeakNullableCallbackInterface();
// A verstion to test for casting to TestCallbackInterface&
void passCallbackInterface(TestCallbackInterface arg);
// A version we can use to test for the exact type passed in
void passCallbackInterface2(TestCallbackInterface arg);
void passNullableCallbackInterface(TestCallbackInterface? arg);
attribute TestCallbackInterface nonNullCallbackInterface;
attribute TestCallbackInterface? nullableCallbackInterface;

Просмотреть файл

@ -119,10 +119,7 @@ interface TestExampleInterface {
TestInterface? receiveNullableSelf();
TestInterface receiveWeakSelf();
TestInterface? receiveWeakNullableSelf();
// A verstion to test for casting to TestInterface&
void passSelf(TestInterface arg);
// A version we can use to test for the exact type passed in
void passSelf2(TestInterface arg);
void passNullableSelf(TestInterface? arg);
attribute TestInterface nonNullSelf;
attribute TestInterface? nullableSelf;
@ -150,10 +147,7 @@ interface TestExampleInterface {
IndirectlyImplementedInterface? receiveNullableOther();
IndirectlyImplementedInterface receiveWeakOther();
IndirectlyImplementedInterface? receiveWeakNullableOther();
// A verstion to test for casting to IndirectlyImplementedInterface&
void passOther(IndirectlyImplementedInterface arg);
// A version we can use to test for the exact type passed in
void passOther2(IndirectlyImplementedInterface arg);
void passNullableOther(IndirectlyImplementedInterface? arg);
attribute IndirectlyImplementedInterface nonNullOther;
attribute IndirectlyImplementedInterface? nullableOther;
@ -167,10 +161,7 @@ interface TestExampleInterface {
TestExternalInterface? receiveNullableExternal();
TestExternalInterface receiveWeakExternal();
TestExternalInterface? receiveWeakNullableExternal();
// A verstion to test for casting to TestExternalInterface&
void passExternal(TestExternalInterface arg);
// A version we can use to test for the exact type passed in
void passExternal2(TestExternalInterface arg);
void passNullableExternal(TestExternalInterface? arg);
attribute TestExternalInterface nonNullExternal;
attribute TestExternalInterface? nullableExternal;
@ -184,10 +175,7 @@ interface TestExampleInterface {
TestCallbackInterface? receiveNullableCallbackInterface();
TestCallbackInterface receiveWeakCallbackInterface();
TestCallbackInterface? receiveWeakNullableCallbackInterface();
// A verstion to test for casting to TestCallbackInterface&
void passCallbackInterface(TestCallbackInterface arg);
// A version we can use to test for the exact type passed in
void passCallbackInterface2(TestCallbackInterface arg);
void passNullableCallbackInterface(TestCallbackInterface? arg);
attribute TestCallbackInterface nonNullCallbackInterface;
attribute TestCallbackInterface? nullableCallbackInterface;

Просмотреть файл

@ -136,8 +136,6 @@ interface TestJSImplInterface {
// A version to test for casting to TestJSImplInterface&
void passSelf(TestJSImplInterface arg);
// A version we can use to test for the exact type passed in
void passSelf2(TestJSImplInterface arg);
void passNullableSelf(TestJSImplInterface? arg);
attribute TestJSImplInterface nonNullSelf;
attribute TestJSImplInterface? nullableSelf;
@ -168,10 +166,7 @@ interface TestJSImplInterface {
//IndirectlyImplementedInterface receiveWeakOther();
//IndirectlyImplementedInterface? receiveWeakNullableOther();
// A verstion to test for casting to IndirectlyImplementedInterface&
void passOther(IndirectlyImplementedInterface arg);
// A version we can use to test for the exact type passed in
void passOther2(IndirectlyImplementedInterface arg);
void passNullableOther(IndirectlyImplementedInterface? arg);
attribute IndirectlyImplementedInterface nonNullOther;
attribute IndirectlyImplementedInterface? nullableOther;
@ -186,10 +181,7 @@ interface TestJSImplInterface {
// Callback interface ignores 'resultNotAddRefed'. See bug 843272.
//TestExternalInterface receiveWeakExternal();
//TestExternalInterface? receiveWeakNullableExternal();
// A verstion to test for casting to TestExternalInterface&
void passExternal(TestExternalInterface arg);
// A version we can use to test for the exact type passed in
void passExternal2(TestExternalInterface arg);
void passNullableExternal(TestExternalInterface? arg);
attribute TestExternalInterface nonNullExternal;
attribute TestExternalInterface? nullableExternal;
@ -204,10 +196,7 @@ interface TestJSImplInterface {
// Callback interface ignores 'resultNotAddRefed'. See bug 843272.
//TestCallbackInterface receiveWeakCallbackInterface();
//TestCallbackInterface? receiveWeakNullableCallbackInterface();
// A verstion to test for casting to TestCallbackInterface&
void passCallbackInterface(TestCallbackInterface arg);
// A version we can use to test for the exact type passed in
void passCallbackInterface2(TestCallbackInterface arg);
void passNullableCallbackInterface(TestCallbackInterface? arg);
attribute TestCallbackInterface nonNullCallbackInterface;
attribute TestCallbackInterface? nullableCallbackInterface;

Просмотреть файл

@ -61,7 +61,7 @@ public:
static already_AddRefed<IDBVersionChangeEvent>
Constructor(const GlobalObject& aGlobal,
const NonNull<nsAString>& aType,
const nsAString& aType,
const IDBVersionChangeEventInit& aOptions,
ErrorResult& aRv)
{

Просмотреть файл

@ -647,7 +647,7 @@ IDBFactory::Cmp(JSContext* aCx, JS::Handle<JS::Value> aFirst,
already_AddRefed<nsIIDBOpenDBRequest>
IDBFactory::OpenForPrincipal(nsIPrincipal* aPrincipal,
const NonNull<nsAString>& aName,
const nsAString& aName,
const Optional<uint64_t>& aVersion,
ErrorResult& aRv)
{
@ -661,7 +661,7 @@ IDBFactory::OpenForPrincipal(nsIPrincipal* aPrincipal,
already_AddRefed<nsIIDBOpenDBRequest>
IDBFactory::DeleteForPrincipal(nsIPrincipal* aPrincipal,
const NonNull<nsAString>& aName,
const nsAString& aName,
ErrorResult& aRv)
{
// Just to be on the extra-safe side

Просмотреть файл

@ -141,14 +141,14 @@ public:
// WebIDL
already_AddRefed<nsIIDBOpenDBRequest>
Open(const NonNull<nsAString>& aName, const Optional<uint64_t>& aVersion,
Open(const nsAString& aName, const Optional<uint64_t>& aVersion,
ErrorResult& aRv)
{
return Open(nullptr, aName, aVersion, false, aRv);
}
already_AddRefed<nsIIDBOpenDBRequest>
DeleteDatabase(const NonNull<nsAString>& aName, ErrorResult& aRv)
DeleteDatabase(const nsAString& aName, ErrorResult& aRv)
{
return Open(nullptr, aName, Optional<uint64_t>(), true, aRv);
}
@ -158,11 +158,11 @@ public:
JS::Handle<JS::Value> aSecond, ErrorResult& aRv);
already_AddRefed<nsIIDBOpenDBRequest>
OpenForPrincipal(nsIPrincipal* aPrincipal, const NonNull<nsAString>& aName,
OpenForPrincipal(nsIPrincipal* aPrincipal, const nsAString& aName,
const Optional<uint64_t>& aVersion, ErrorResult& aRv);
already_AddRefed<nsIIDBOpenDBRequest>
DeleteForPrincipal(nsIPrincipal* aPrincipal, const NonNull<nsAString>& aName,
DeleteForPrincipal(nsIPrincipal* aPrincipal, const nsAString& aName,
ErrorResult& aRv);
private:

Просмотреть файл

@ -608,16 +608,28 @@ DataChannelTest.prototype = Object.create(PeerConnectionTest.prototype, {
}
}
// Register handlers for the remote peer
this.pcRemote.registerDataChannelOpenEvents(function (channel) {
remoteChannel = channel;
check_next_test();
});
if (!options.negotiated) {
// Register handlers for the remote peer
this.pcRemote.registerDataChannelOpenEvents(function (channel) {
remoteChannel = channel;
check_next_test();
});
}
// Creat the datachannel and handle the local 'onopen' event
// Create the datachannel and handle the local 'onopen' event
this.pcLocal.createDataChannel(options, function (channel) {
localChannel = channel;
check_next_test();
if (options.negotiated) {
// externally negotiated - we need to open from both ends
options.id = options.id || channel.id; // allow for no id to let the impl choose
self.pcRemote.createDataChannel(options, function (channel) {
remoteChannel = channel;
check_next_test();
});
} else {
check_next_test();
}
});
}
},
@ -825,6 +837,35 @@ DataChannelWrapper.prototype = {
return this._channel.label;
},
/**
* Returns the protocol of the underlying data channel
*
* @returns {String} The protocol
*/
get protocol() {
return this._channel.protocol;
},
/**
* Returns the id of the underlying data channel
*
* @returns {number} The stream id
*/
get id() {
return this._channel.id;
},
/**
* Returns the reliable state of the underlying data channel
*
* @returns {bool} The stream's reliable state
*/
get reliable() {
return this._channel.reliable;
},
// ordered, maxRetransmits and maxRetransmitTime not exposed yet
/**
* Returns the readyState bit of the data channel
*

Просмотреть файл

@ -337,6 +337,77 @@ var commandsDataChannel = [
}, options);
}
],
[
'CREATE_NEGOTIATED_DATA_CHANNEL',
function (test) {
var options = {negotiated:true, id: 5, protocol:"foo/bar", ordered:false,
maxRetransmits:500};
test.createDataChannel(options, function (sourceChannel2, targetChannel2) {
is(sourceChannel2.readyState, "open", sourceChannel2 + " is in state: 'open'");
is(targetChannel2.readyState, "open", targetChannel2 + " is in state: 'open'");
is(targetChannel2.binaryType, "blob", targetChannel2 + " is of binary type 'blob'");
is(targetChannel2.readyState, "open", targetChannel2 + " is in state: 'open'");
if (options.id != undefined) {
is(sourceChannel2.id, options.id, sourceChannel2 + " id is:" + sourceChannel2.id);
} else {
options.id = sourceChannel2.id;
}
var reliable = !options.ordered ? false : (options.maxRetransmits || options.maxRetransmitTime);
is(sourceChannel2.protocol, options.protocol, sourceChannel2 + " protocol is:" + sourceChannel2.protocol);
is(sourceChannel2.reliable, reliable, sourceChannel2 + " reliable is:" + sourceChannel2.reliable);
/*
These aren't exposed by IDL yet
is(sourceChannel2.ordered, options.ordered, sourceChannel2 + " ordered is:" + sourceChannel2.ordered);
is(sourceChannel2.maxRetransmits, options.maxRetransmits, sourceChannel2 + " maxRetransmits is:" +
sourceChannel2.maxRetransmits);
is(sourceChannel2.maxRetransmitTime, options.maxRetransmitTime, sourceChannel2 + " maxRetransmitTime is:" +
sourceChannel2.maxRetransmitTime);
*/
is(targetChannel2.id, options.id, targetChannel2 + " id is:" + targetChannel2.id);
is(targetChannel2.protocol, options.protocol, targetChannel2 + " protocol is:" + targetChannel2.protocol);
is(targetChannel2.reliable, reliable, targetChannel2 + " reliable is:" + targetChannel2.reliable);
/*
These aren't exposed by IDL yet
is(targetChannel2.ordered, options.ordered, targetChannel2 + " ordered is:" + targetChannel2.ordered);
is(targetChannel2.maxRetransmits, options.maxRetransmits, targetChannel2 + " maxRetransmits is:" +
targetChannel2.maxRetransmits);
is(targetChannel2.maxRetransmitTime, options.maxRetransmitTime, targetChannel2 + " maxRetransmitTime is:" +
targetChannel2.maxRetransmitTime);
*/
test.next();
});
}
],
[
'SEND_MESSAGE_THROUGH_LAST_OPENED_CHANNEL2',
function (test) {
var channels = test.pcRemote.dataChannels;
var message = "Lorem ipsum dolor sit amet";
test.send(message, function (channel, data) {
is(channels.indexOf(channel), channels.length - 1, "Last channel used");
is(data, message, "Received message has the correct content.");
test.next();
});
}
],
[
'CLOSE_LAST_OPENED_DATA_CHANNEL2',
function (test) {
var channels = test.pcRemote.dataChannels;
test.closeDataChannel(channels.length - 1, function (channel) {
is(channel.readyState, "closed", "Channel is in state: 'closed'");
test.next();
});
}
],
[
'CLOSE_LAST_OPENED_DATA_CHANNEL',
function (test) {

Просмотреть файл

@ -46,10 +46,14 @@ public:
DesktopNotificationCenter(nsPIDOMWindow *aWindow)
{
MOZ_ASSERT(aWindow);
mOwner = aWindow;
// Grab the uri of the document
mPrincipal = mOwner->GetDoc()->NodePrincipal();
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(aWindow);
MOZ_ASSERT(sop);
mPrincipal = sop->GetPrincipal();
MOZ_ASSERT(mPrincipal);
SetIsDOMBinding();
}

Просмотреть файл

@ -9,9 +9,10 @@
[NoInterfaceObject]
interface ChildNode {
// On Element:
// readonly attribute Element? previousElementSibling;
// readonly attribute Element? nextElementSibling;
[Pure]
readonly attribute Element? previousElementSibling;
[Pure]
readonly attribute Element? nextElementSibling;
// Not implemented yet:
// void before((Node or DOMString)... nodes);

Просмотреть файл

@ -334,3 +334,4 @@ Document implements XPathEvaluator;
Document implements GlobalEventHandlers;
Document implements NodeEventHandlers;
Document implements TouchEventHandlers;
Document implements ParentNode;

Просмотреть файл

@ -29,3 +29,5 @@ partial interface DocumentFragment {
[Throws]
NodeList querySelectorAll(DOMString selectors);
};
DocumentFragment implements ParentNode;

Просмотреть файл

@ -55,19 +55,6 @@ interface Element : Node {
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
HTMLCollection getElementsByClassName(DOMString classNames);
[Constant]
readonly attribute HTMLCollection children;
[Pure]
readonly attribute Element? firstElementChild;
[Pure]
readonly attribute Element? lastElementChild;
[Pure]
readonly attribute Element? previousElementSibling;
[Pure]
readonly attribute Element? nextElementSibling;
[Pure]
readonly attribute unsigned long childElementCount;
/**
* The ratio of font-size-inflated text font size to computed font
* size for this element. This will query the element for its primary frame,
@ -199,3 +186,4 @@ partial interface Element {
};
Element implements ChildNode;
Element implements ParentNode;

Просмотреть файл

@ -0,0 +1,24 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://dom.spec.whatwg.org/#interface-parentnode
*/
[NoInterfaceObject]
interface ParentNode {
[Constant]
readonly attribute HTMLCollection children;
[Pure]
readonly attribute Element? firstElementChild;
[Pure]
readonly attribute Element? lastElementChild;
[Pure]
readonly attribute unsigned long childElementCount;
// Not implemented yet
// void prepend((Node or DOMString)... nodes);
// void append((Node or DOMString)... nodes);
};

Просмотреть файл

@ -209,6 +209,7 @@ webidl_files = \
PaintRequest.webidl \
PaintRequestList.webidl \
PannerNode.webidl \
ParentNode.webidl \
Performance.webidl \
PerformanceNavigation.webidl \
PerformanceTiming.webidl \

Просмотреть файл

@ -704,7 +704,7 @@ public:
const GlyphBuffer &aBuffer,
const Pattern &aPattern,
const DrawOptions &aOptions = DrawOptions(),
const GlyphRenderingOptions *aRenderingOptions = NULL) = 0;
const GlyphRenderingOptions *aRenderingOptions = nullptr) = 0;
/*
* This takes a source pattern and a mask, and composites the source pattern
@ -839,7 +839,7 @@ public:
/* Tries to get a native surface for a DrawTarget, this may fail if the
* draw target cannot convert to this surface type.
*/
virtual void *GetNativeSurface(NativeSurfaceType aType) { return NULL; }
virtual void *GetNativeSurface(NativeSurfaceType aType) { return nullptr; }
virtual bool IsDualDrawTarget() { return false; }

Просмотреть файл

@ -29,7 +29,7 @@ DrawEventRecorderPrivate::RecordEvent(const RecordedEvent &aEvent)
}
DrawEventRecorderFile::DrawEventRecorderFile(const char *aFilename)
: DrawEventRecorderPrivate(NULL)
: DrawEventRecorderPrivate(nullptr)
, mOutputFile(aFilename, ofstream::binary)
{
mOutputStream = &mOutputFile;

Просмотреть файл

@ -1813,10 +1813,10 @@ DrawTargetD2D::GetClippedGeometry(IntRect *aClipBounds)
pathGeom = newGeom.forget();
}
// For now we need mCurrentClippedGeometry to always be non-NULL. This method
// might seem a little strange but it is just fine, if pathGeom is NULL
// pathRect will always still contain 1 clip unaccounted for regardless of
// mCurrentClipBounds.
// For now we need mCurrentClippedGeometry to always be non-nullptr. This
// method might seem a little strange but it is just fine, if pathGeom is
// nullptr pathRect will always still contain 1 clip unaccounted for
// regardless of mCurrentClipBounds.
if (!pathGeom) {
pathGeom = ConvertRectToGeometry(pathRect);
}

Просмотреть файл

@ -207,7 +207,7 @@ private:
void SetupStateForRendering();
// Set the scissor rect to a certain IntRects, resets the scissor rect to
// surface bounds when NULL is specified.
// surface bounds when nullptr is specified.
void SetScissorToRect(IntRect *aRect);
void PushD2DLayer(ID2D1RenderTarget *aRT, ID2D1Geometry *aGeometry, ID2D1Layer *aLayer, const D2D1_MATRIX_3X2_F &aTransform);
@ -242,7 +242,7 @@ private:
RefPtr<ID2D1Layer> mLayer;
D2D1_RECT_F mBounds;
union {
// If mPath is non-NULL, the mTransform member will be used, otherwise
// If mPath is non-nullptr, the mTransform member will be used, otherwise
// the mIsPixelAligned member is valid.
D2D1_MATRIX_3X2_F mTransform;
bool mIsPixelAligned;

Просмотреть файл

@ -77,7 +77,7 @@ GetGradientStops(GradientStops *aStops)
struct AdjustedPattern
{
AdjustedPattern(const Pattern &aPattern)
: mPattern(NULL)
: mPattern(nullptr)
{
mOrigPattern = const_cast<Pattern*>(&aPattern);
}
@ -186,7 +186,7 @@ Path*
DrawTargetRecording::GetPathForPathRecording(const Path *aPath) const
{
if (aPath->GetBackendType() != BACKEND_RECORDING) {
return NULL;
return nullptr;
}
return static_cast<const PathRecording*>(aPath)->mPath;

Просмотреть файл

@ -157,7 +157,7 @@ public:
const GlyphBuffer &aBuffer,
const Pattern &aPattern,
const DrawOptions &aOptions = DrawOptions(),
const GlyphRenderingOptions *aRenderingOptions = NULL);
const GlyphRenderingOptions *aRenderingOptions = nullptr);
/*
* This takes a source pattern and a mask, and composites the source pattern

Просмотреть файл

@ -60,7 +60,7 @@ RecordedEvent::LoadEventFromStream(std::istream &aStream, EventType aType)
LOAD_EVENT_TYPE(SCALEDFONTDESTRUCTION, RecordedScaledFontDestruction);
LOAD_EVENT_TYPE(MASKSURFACE, RecordedMaskSurface);
default:
return NULL;
return nullptr;
}
}
@ -342,7 +342,7 @@ RecordedDrawTargetDestruction::OutputSimpleEventInfo(stringstream &aStringStream
struct GenericPattern
{
GenericPattern(const PatternStorage &aStorage, Translator *aTranslator)
: mPattern(NULL), mTranslator(aTranslator)
: mPattern(nullptr), mTranslator(aTranslator)
{
mStorage = const_cast<PatternStorage*>(&aStorage);
}

Просмотреть файл

@ -815,7 +815,7 @@ public:
}
RecordedScaledFontCreation(ReferencePtr aRefPtr, ScaledFont *aScaledFont)
: RecordedEvent(SCALEDFONTCREATION), mRefPtr(aRefPtr), mData(NULL)
: RecordedEvent(SCALEDFONTCREATION), mRefPtr(aRefPtr), mData(nullptr)
{
aScaledFont->GetFontFileData(&FontDataProc, this);
}

Просмотреть файл

@ -14,16 +14,20 @@
namespace mozilla {
namespace gfx {
struct Margin :
public BaseMargin<Float, Margin> {
typedef BaseMargin<Float, Margin> Super;
template<class units>
struct MarginTyped:
public BaseMargin<Float, MarginTyped<units> >,
public units {
typedef BaseMargin<Float, MarginTyped<units> > Super;
// Constructors
Margin() : Super(0, 0, 0, 0) {}
Margin(const Margin& aMargin) : Super(aMargin) {}
Margin(Float aTop, Float aRight, Float aBottom, Float aLeft)
: Super(aTop, aRight, aBottom, aLeft) {}
MarginTyped() : Super(0, 0, 0, 0) {}
MarginTyped(const MarginTyped<units>& aMargin) :
Super(float(aMargin.top), float(aMargin.right),
float(aMargin.bottom), float(aMargin.left)) {}
MarginTyped(Float aTop, Float aRight, Float aBottom, Float aLeft) :
Super(aTop, aRight, aBottom, aLeft) {}
};
typedef MarginTyped<UnknownUnits> Margin;
template<class units>
struct IntRectTyped :

Просмотреть файл

@ -213,7 +213,7 @@ DoGrayscale(IDWriteFontFace *aDWFace, Float ppem)
return true;
}
IDWriteFontFileLoader* DWriteFontFileLoader::mInstance = NULL;
IDWriteFontFileLoader* DWriteFontFileLoader::mInstance = nullptr;
HRESULT STDMETHODCALLTYPE
DWriteFontFileLoader::CreateStreamFromKey(const void *fontFileReferenceKey,
@ -275,7 +275,7 @@ DWriteFontFileStream::ReadFileFragment(const void **fragmentStart,
// We should be alive for the duration of this.
*fragmentStart = &mData[index];
*fragmentContext = NULL;
*fragmentContext = nullptr;
return S_OK;
}

Просмотреть файл

@ -141,147 +141,147 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
mWorkAroundDriverBugs = gfxPlatform::GetPlatform()->WorkAroundDriverBugs();
SymLoadStruct symbols[] = {
{ (PRFuncPtr*) &mSymbols.fActiveTexture, { "ActiveTexture", "ActiveTextureARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fAttachShader, { "AttachShader", "AttachShaderARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fBindAttribLocation, { "BindAttribLocation", "BindAttribLocationARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fBindBuffer, { "BindBuffer", "BindBufferARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fBindTexture, { "BindTexture", "BindTextureARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fBlendColor, { "BlendColor", NULL } },
{ (PRFuncPtr*) &mSymbols.fBlendEquation, { "BlendEquation", NULL } },
{ (PRFuncPtr*) &mSymbols.fBlendEquationSeparate, { "BlendEquationSeparate", "BlendEquationSeparateEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fBlendFunc, { "BlendFunc", NULL } },
{ (PRFuncPtr*) &mSymbols.fBlendFuncSeparate, { "BlendFuncSeparate", "BlendFuncSeparateEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fBufferData, { "BufferData", NULL } },
{ (PRFuncPtr*) &mSymbols.fBufferSubData, { "BufferSubData", NULL } },
{ (PRFuncPtr*) &mSymbols.fClear, { "Clear", NULL } },
{ (PRFuncPtr*) &mSymbols.fClearColor, { "ClearColor", NULL } },
{ (PRFuncPtr*) &mSymbols.fClearStencil, { "ClearStencil", NULL } },
{ (PRFuncPtr*) &mSymbols.fColorMask, { "ColorMask", NULL } },
{ (PRFuncPtr*) &mSymbols.fCompressedTexImage2D, {"CompressedTexImage2D", NULL} },
{ (PRFuncPtr*) &mSymbols.fCompressedTexSubImage2D, {"CompressedTexSubImage2D", NULL} },
{ (PRFuncPtr*) &mSymbols.fCullFace, { "CullFace", NULL } },
{ (PRFuncPtr*) &mSymbols.fDetachShader, { "DetachShader", "DetachShaderARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fDepthFunc, { "DepthFunc", NULL } },
{ (PRFuncPtr*) &mSymbols.fDepthMask, { "DepthMask", NULL } },
{ (PRFuncPtr*) &mSymbols.fDisable, { "Disable", NULL } },
{ (PRFuncPtr*) &mSymbols.fDisableVertexAttribArray, { "DisableVertexAttribArray", "DisableVertexAttribArrayARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fDrawArrays, { "DrawArrays", NULL } },
{ (PRFuncPtr*) &mSymbols.fDrawElements, { "DrawElements", NULL } },
{ (PRFuncPtr*) &mSymbols.fEnable, { "Enable", NULL } },
{ (PRFuncPtr*) &mSymbols.fEnableVertexAttribArray, { "EnableVertexAttribArray", "EnableVertexAttribArrayARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fFinish, { "Finish", NULL } },
{ (PRFuncPtr*) &mSymbols.fFlush, { "Flush", NULL } },
{ (PRFuncPtr*) &mSymbols.fFrontFace, { "FrontFace", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetActiveAttrib, { "GetActiveAttrib", "GetActiveAttribARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetActiveUniform, { "GetActiveUniform", "GetActiveUniformARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetAttachedShaders, { "GetAttachedShaders", "GetAttachedShadersARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetAttribLocation, { "GetAttribLocation", "GetAttribLocationARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetIntegerv, { "GetIntegerv", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetFloatv, { "GetFloatv", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetBooleanv, { "GetBooleanv", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetBufferParameteriv, { "GetBufferParameteriv", "GetBufferParameterivARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetError, { "GetError", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetProgramiv, { "GetProgramiv", "GetProgramivARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetProgramInfoLog, { "GetProgramInfoLog", "GetProgramInfoLogARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fTexParameteri, { "TexParameteri", NULL } },
{ (PRFuncPtr*) &mSymbols.fTexParameteriv, { "TexParameteriv", NULL } },
{ (PRFuncPtr*) &mSymbols.fTexParameterf, { "TexParameterf", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetString, { "GetString", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetTexParameterfv, { "GetTexParameterfv", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetTexParameteriv, { "GetTexParameteriv", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetUniformfv, { "GetUniformfv", "GetUniformfvARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetUniformiv, { "GetUniformiv", "GetUniformivARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetUniformLocation, { "GetUniformLocation", "GetUniformLocationARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetVertexAttribfv, { "GetVertexAttribfv", "GetVertexAttribfvARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetVertexAttribiv, { "GetVertexAttribiv", "GetVertexAttribivARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetVertexAttribPointerv, { "GetVertexAttribPointerv", NULL } },
{ (PRFuncPtr*) &mSymbols.fHint, { "Hint", NULL } },
{ (PRFuncPtr*) &mSymbols.fIsBuffer, { "IsBuffer", "IsBufferARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fIsEnabled, { "IsEnabled", NULL } },
{ (PRFuncPtr*) &mSymbols.fIsProgram, { "IsProgram", "IsProgramARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fIsShader, { "IsShader", "IsShaderARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fIsTexture, { "IsTexture", "IsTextureARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fLineWidth, { "LineWidth", NULL } },
{ (PRFuncPtr*) &mSymbols.fLinkProgram, { "LinkProgram", "LinkProgramARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fPixelStorei, { "PixelStorei", NULL } },
{ (PRFuncPtr*) &mSymbols.fPolygonOffset, { "PolygonOffset", NULL } },
{ (PRFuncPtr*) &mSymbols.fReadPixels, { "ReadPixels", NULL } },
{ (PRFuncPtr*) &mSymbols.fSampleCoverage, { "SampleCoverage", NULL } },
{ (PRFuncPtr*) &mSymbols.fScissor, { "Scissor", NULL } },
{ (PRFuncPtr*) &mSymbols.fStencilFunc, { "StencilFunc", NULL } },
{ (PRFuncPtr*) &mSymbols.fStencilFuncSeparate, { "StencilFuncSeparate", "StencilFuncSeparateEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fStencilMask, { "StencilMask", NULL } },
{ (PRFuncPtr*) &mSymbols.fStencilMaskSeparate, { "StencilMaskSeparate", "StencilMaskSeparateEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fStencilOp, { "StencilOp", NULL } },
{ (PRFuncPtr*) &mSymbols.fStencilOpSeparate, { "StencilOpSeparate", "StencilOpSeparateEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fTexImage2D, { "TexImage2D", NULL } },
{ (PRFuncPtr*) &mSymbols.fTexSubImage2D, { "TexSubImage2D", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform1f, { "Uniform1f", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform1fv, { "Uniform1fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform1i, { "Uniform1i", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform1iv, { "Uniform1iv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform2f, { "Uniform2f", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform2fv, { "Uniform2fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform2i, { "Uniform2i", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform2iv, { "Uniform2iv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform3f, { "Uniform3f", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform3fv, { "Uniform3fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform3i, { "Uniform3i", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform3iv, { "Uniform3iv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform4f, { "Uniform4f", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform4fv, { "Uniform4fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform4i, { "Uniform4i", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniform4iv, { "Uniform4iv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniformMatrix2fv, { "UniformMatrix2fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniformMatrix3fv, { "UniformMatrix3fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUniformMatrix4fv, { "UniformMatrix4fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fUseProgram, { "UseProgram", NULL } },
{ (PRFuncPtr*) &mSymbols.fValidateProgram, { "ValidateProgram", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttribPointer, { "VertexAttribPointer", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib1f, { "VertexAttrib1f", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib2f, { "VertexAttrib2f", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib3f, { "VertexAttrib3f", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib4f, { "VertexAttrib4f", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib1fv, { "VertexAttrib1fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib2fv, { "VertexAttrib2fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib3fv, { "VertexAttrib3fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib4fv, { "VertexAttrib4fv", NULL } },
{ (PRFuncPtr*) &mSymbols.fViewport, { "Viewport", NULL } },
{ (PRFuncPtr*) &mSymbols.fCompileShader, { "CompileShader", NULL } },
{ (PRFuncPtr*) &mSymbols.fCopyTexImage2D, { "CopyTexImage2D", NULL } },
{ (PRFuncPtr*) &mSymbols.fCopyTexSubImage2D, { "CopyTexSubImage2D", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetShaderiv, { "GetShaderiv", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetShaderInfoLog, { "GetShaderInfoLog", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetShaderSource, { "GetShaderSource", NULL } },
{ (PRFuncPtr*) &mSymbols.fShaderSource, { "ShaderSource", NULL } },
{ (PRFuncPtr*) &mSymbols.fVertexAttribPointer, { "VertexAttribPointer", NULL } },
{ (PRFuncPtr*) &mSymbols.fBindFramebuffer, { "BindFramebuffer", "BindFramebufferEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fBindRenderbuffer, { "BindRenderbuffer", "BindRenderbufferEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fCheckFramebufferStatus, { "CheckFramebufferStatus", "CheckFramebufferStatusEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fFramebufferRenderbuffer, { "FramebufferRenderbuffer", "FramebufferRenderbufferEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fFramebufferTexture2D, { "FramebufferTexture2D", "FramebufferTexture2DEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fGenerateMipmap, { "GenerateMipmap", "GenerateMipmapEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetFramebufferAttachmentParameteriv, { "GetFramebufferAttachmentParameteriv", "GetFramebufferAttachmentParameterivEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetRenderbufferParameteriv, { "GetRenderbufferParameteriv", "GetRenderbufferParameterivEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fIsFramebuffer, { "IsFramebuffer", "IsFramebufferEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fIsRenderbuffer, { "IsRenderbuffer", "IsRenderbufferEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fRenderbufferStorage, { "RenderbufferStorage", "RenderbufferStorageEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fActiveTexture, { "ActiveTexture", "ActiveTextureARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fAttachShader, { "AttachShader", "AttachShaderARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBindAttribLocation, { "BindAttribLocation", "BindAttribLocationARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBindBuffer, { "BindBuffer", "BindBufferARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBindTexture, { "BindTexture", "BindTextureARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBlendColor, { "BlendColor", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBlendEquation, { "BlendEquation", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBlendEquationSeparate, { "BlendEquationSeparate", "BlendEquationSeparateEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBlendFunc, { "BlendFunc", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBlendFuncSeparate, { "BlendFuncSeparate", "BlendFuncSeparateEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBufferData, { "BufferData", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBufferSubData, { "BufferSubData", nullptr } },
{ (PRFuncPtr*) &mSymbols.fClear, { "Clear", nullptr } },
{ (PRFuncPtr*) &mSymbols.fClearColor, { "ClearColor", nullptr } },
{ (PRFuncPtr*) &mSymbols.fClearStencil, { "ClearStencil", nullptr } },
{ (PRFuncPtr*) &mSymbols.fColorMask, { "ColorMask", nullptr } },
{ (PRFuncPtr*) &mSymbols.fCompressedTexImage2D, {"CompressedTexImage2D", nullptr} },
{ (PRFuncPtr*) &mSymbols.fCompressedTexSubImage2D, {"CompressedTexSubImage2D", nullptr} },
{ (PRFuncPtr*) &mSymbols.fCullFace, { "CullFace", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDetachShader, { "DetachShader", "DetachShaderARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDepthFunc, { "DepthFunc", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDepthMask, { "DepthMask", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDisable, { "Disable", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDisableVertexAttribArray, { "DisableVertexAttribArray", "DisableVertexAttribArrayARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDrawArrays, { "DrawArrays", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDrawElements, { "DrawElements", nullptr } },
{ (PRFuncPtr*) &mSymbols.fEnable, { "Enable", nullptr } },
{ (PRFuncPtr*) &mSymbols.fEnableVertexAttribArray, { "EnableVertexAttribArray", "EnableVertexAttribArrayARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fFinish, { "Finish", nullptr } },
{ (PRFuncPtr*) &mSymbols.fFlush, { "Flush", nullptr } },
{ (PRFuncPtr*) &mSymbols.fFrontFace, { "FrontFace", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetActiveAttrib, { "GetActiveAttrib", "GetActiveAttribARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetActiveUniform, { "GetActiveUniform", "GetActiveUniformARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetAttachedShaders, { "GetAttachedShaders", "GetAttachedShadersARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetAttribLocation, { "GetAttribLocation", "GetAttribLocationARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetIntegerv, { "GetIntegerv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetFloatv, { "GetFloatv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetBooleanv, { "GetBooleanv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetBufferParameteriv, { "GetBufferParameteriv", "GetBufferParameterivARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetError, { "GetError", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetProgramiv, { "GetProgramiv", "GetProgramivARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetProgramInfoLog, { "GetProgramInfoLog", "GetProgramInfoLogARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fTexParameteri, { "TexParameteri", nullptr } },
{ (PRFuncPtr*) &mSymbols.fTexParameteriv, { "TexParameteriv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fTexParameterf, { "TexParameterf", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetString, { "GetString", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetTexParameterfv, { "GetTexParameterfv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetTexParameteriv, { "GetTexParameteriv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetUniformfv, { "GetUniformfv", "GetUniformfvARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetUniformiv, { "GetUniformiv", "GetUniformivARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetUniformLocation, { "GetUniformLocation", "GetUniformLocationARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetVertexAttribfv, { "GetVertexAttribfv", "GetVertexAttribfvARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetVertexAttribiv, { "GetVertexAttribiv", "GetVertexAttribivARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetVertexAttribPointerv, { "GetVertexAttribPointerv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fHint, { "Hint", nullptr } },
{ (PRFuncPtr*) &mSymbols.fIsBuffer, { "IsBuffer", "IsBufferARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fIsEnabled, { "IsEnabled", nullptr } },
{ (PRFuncPtr*) &mSymbols.fIsProgram, { "IsProgram", "IsProgramARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fIsShader, { "IsShader", "IsShaderARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fIsTexture, { "IsTexture", "IsTextureARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fLineWidth, { "LineWidth", nullptr } },
{ (PRFuncPtr*) &mSymbols.fLinkProgram, { "LinkProgram", "LinkProgramARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fPixelStorei, { "PixelStorei", nullptr } },
{ (PRFuncPtr*) &mSymbols.fPolygonOffset, { "PolygonOffset", nullptr } },
{ (PRFuncPtr*) &mSymbols.fReadPixels, { "ReadPixels", nullptr } },
{ (PRFuncPtr*) &mSymbols.fSampleCoverage, { "SampleCoverage", nullptr } },
{ (PRFuncPtr*) &mSymbols.fScissor, { "Scissor", nullptr } },
{ (PRFuncPtr*) &mSymbols.fStencilFunc, { "StencilFunc", nullptr } },
{ (PRFuncPtr*) &mSymbols.fStencilFuncSeparate, { "StencilFuncSeparate", "StencilFuncSeparateEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fStencilMask, { "StencilMask", nullptr } },
{ (PRFuncPtr*) &mSymbols.fStencilMaskSeparate, { "StencilMaskSeparate", "StencilMaskSeparateEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fStencilOp, { "StencilOp", nullptr } },
{ (PRFuncPtr*) &mSymbols.fStencilOpSeparate, { "StencilOpSeparate", "StencilOpSeparateEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fTexImage2D, { "TexImage2D", nullptr } },
{ (PRFuncPtr*) &mSymbols.fTexSubImage2D, { "TexSubImage2D", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform1f, { "Uniform1f", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform1fv, { "Uniform1fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform1i, { "Uniform1i", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform1iv, { "Uniform1iv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform2f, { "Uniform2f", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform2fv, { "Uniform2fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform2i, { "Uniform2i", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform2iv, { "Uniform2iv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform3f, { "Uniform3f", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform3fv, { "Uniform3fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform3i, { "Uniform3i", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform3iv, { "Uniform3iv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform4f, { "Uniform4f", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform4fv, { "Uniform4fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform4i, { "Uniform4i", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniform4iv, { "Uniform4iv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniformMatrix2fv, { "UniformMatrix2fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniformMatrix3fv, { "UniformMatrix3fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUniformMatrix4fv, { "UniformMatrix4fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUseProgram, { "UseProgram", nullptr } },
{ (PRFuncPtr*) &mSymbols.fValidateProgram, { "ValidateProgram", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttribPointer, { "VertexAttribPointer", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib1f, { "VertexAttrib1f", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib2f, { "VertexAttrib2f", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib3f, { "VertexAttrib3f", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib4f, { "VertexAttrib4f", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib1fv, { "VertexAttrib1fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib2fv, { "VertexAttrib2fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib3fv, { "VertexAttrib3fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttrib4fv, { "VertexAttrib4fv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fViewport, { "Viewport", nullptr } },
{ (PRFuncPtr*) &mSymbols.fCompileShader, { "CompileShader", nullptr } },
{ (PRFuncPtr*) &mSymbols.fCopyTexImage2D, { "CopyTexImage2D", nullptr } },
{ (PRFuncPtr*) &mSymbols.fCopyTexSubImage2D, { "CopyTexSubImage2D", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetShaderiv, { "GetShaderiv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetShaderInfoLog, { "GetShaderInfoLog", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetShaderSource, { "GetShaderSource", nullptr } },
{ (PRFuncPtr*) &mSymbols.fShaderSource, { "ShaderSource", nullptr } },
{ (PRFuncPtr*) &mSymbols.fVertexAttribPointer, { "VertexAttribPointer", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBindFramebuffer, { "BindFramebuffer", "BindFramebufferEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBindRenderbuffer, { "BindRenderbuffer", "BindRenderbufferEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fCheckFramebufferStatus, { "CheckFramebufferStatus", "CheckFramebufferStatusEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fFramebufferRenderbuffer, { "FramebufferRenderbuffer", "FramebufferRenderbufferEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fFramebufferTexture2D, { "FramebufferTexture2D", "FramebufferTexture2DEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGenerateMipmap, { "GenerateMipmap", "GenerateMipmapEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetFramebufferAttachmentParameteriv, { "GetFramebufferAttachmentParameteriv", "GetFramebufferAttachmentParameterivEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetRenderbufferParameteriv, { "GetRenderbufferParameteriv", "GetRenderbufferParameterivEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fIsFramebuffer, { "IsFramebuffer", "IsFramebufferEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fIsRenderbuffer, { "IsRenderbuffer", "IsRenderbufferEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fRenderbufferStorage, { "RenderbufferStorage", "RenderbufferStorageEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGenBuffers, { "GenBuffers", "GenBuffersARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGenTextures, { "GenTextures", NULL } },
{ (PRFuncPtr*) &mSymbols.fCreateProgram, { "CreateProgram", "CreateProgramARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fCreateShader, { "CreateShader", "CreateShaderARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fGenFramebuffers, { "GenFramebuffers", "GenFramebuffersEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fGenRenderbuffers, { "GenRenderbuffers", "GenRenderbuffersEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fGenBuffers, { "GenBuffers", "GenBuffersARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGenTextures, { "GenTextures", nullptr } },
{ (PRFuncPtr*) &mSymbols.fCreateProgram, { "CreateProgram", "CreateProgramARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fCreateShader, { "CreateShader", "CreateShaderARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGenFramebuffers, { "GenFramebuffers", "GenFramebuffersEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGenRenderbuffers, { "GenRenderbuffers", "GenRenderbuffersEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDeleteBuffers, { "DeleteBuffers", "DeleteBuffersARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fDeleteTextures, { "DeleteTextures", "DeleteTexturesARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fDeleteProgram, { "DeleteProgram", "DeleteProgramARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fDeleteShader, { "DeleteShader", "DeleteShaderARB", NULL } },
{ (PRFuncPtr*) &mSymbols.fDeleteFramebuffers, { "DeleteFramebuffers", "DeleteFramebuffersEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fDeleteRenderbuffers, { "DeleteRenderbuffers", "DeleteRenderbuffersEXT", NULL } },
{ (PRFuncPtr*) &mSymbols.fDeleteBuffers, { "DeleteBuffers", "DeleteBuffersARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDeleteTextures, { "DeleteTextures", "DeleteTexturesARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDeleteProgram, { "DeleteProgram", "DeleteProgramARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDeleteShader, { "DeleteShader", "DeleteShaderARB", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDeleteFramebuffers, { "DeleteFramebuffers", "DeleteFramebuffersEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDeleteRenderbuffers, { "DeleteRenderbuffers", "DeleteRenderbuffersEXT", nullptr } },
{ NULL, { NULL } },
{ nullptr, { nullptr } },
};
@ -291,10 +291,10 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (mInitialized) {
if (mIsGLES2) {
SymLoadStruct symbols_ES2[] = {
{ (PRFuncPtr*) &mSymbols.fGetShaderPrecisionFormat, { "GetShaderPrecisionFormat", NULL } },
{ (PRFuncPtr*) &mSymbols.fClearDepthf, { "ClearDepthf", NULL } },
{ (PRFuncPtr*) &mSymbols.fDepthRangef, { "DepthRangef", NULL } },
{ NULL, { NULL } },
{ (PRFuncPtr*) &mSymbols.fGetShaderPrecisionFormat, { "GetShaderPrecisionFormat", nullptr } },
{ (PRFuncPtr*) &mSymbols.fClearDepthf, { "ClearDepthf", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDepthRangef, { "DepthRangef", nullptr } },
{ nullptr, { nullptr } },
};
if (!LoadSymbols(&symbols_ES2[0], trygl, prefix)) {
@ -303,22 +303,22 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
}
} else {
SymLoadStruct symbols_desktop[] = {
{ (PRFuncPtr*) &mSymbols.fClearDepth, { "ClearDepth", NULL } },
{ (PRFuncPtr*) &mSymbols.fDepthRange, { "DepthRange", NULL } },
{ (PRFuncPtr*) &mSymbols.fReadBuffer, { "ReadBuffer", NULL } },
{ (PRFuncPtr*) &mSymbols.fMapBuffer, { "MapBuffer", NULL } },
{ (PRFuncPtr*) &mSymbols.fUnmapBuffer, { "UnmapBuffer", NULL } },
{ (PRFuncPtr*) &mSymbols.fPointParameterf, { "PointParameterf", NULL } },
{ (PRFuncPtr*) &mSymbols.fBeginQuery, { "BeginQuery", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetQueryObjectuiv, { "GetQueryObjectuiv", NULL } },
{ (PRFuncPtr*) &mSymbols.fGenQueries, { "GenQueries", NULL } },
{ (PRFuncPtr*) &mSymbols.fDeleteQueries, { "DeleteQueries", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetQueryiv, { "GetQueryiv", NULL } },
{ (PRFuncPtr*) &mSymbols.fGetQueryObjectiv, { "GetQueryObjectiv", NULL } },
{ (PRFuncPtr*) &mSymbols.fEndQuery, { "EndQuery", NULL } },
{ (PRFuncPtr*) &mSymbols.fDrawBuffer, { "DrawBuffer", NULL } },
{ (PRFuncPtr*) &mSymbols.fDrawBuffers, { "DrawBuffers", NULL } },
{ NULL, { NULL } },
{ (PRFuncPtr*) &mSymbols.fClearDepth, { "ClearDepth", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDepthRange, { "DepthRange", nullptr } },
{ (PRFuncPtr*) &mSymbols.fReadBuffer, { "ReadBuffer", nullptr } },
{ (PRFuncPtr*) &mSymbols.fMapBuffer, { "MapBuffer", nullptr } },
{ (PRFuncPtr*) &mSymbols.fUnmapBuffer, { "UnmapBuffer", nullptr } },
{ (PRFuncPtr*) &mSymbols.fPointParameterf, { "PointParameterf", nullptr } },
{ (PRFuncPtr*) &mSymbols.fBeginQuery, { "BeginQuery", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetQueryObjectuiv, { "GetQueryObjectuiv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGenQueries, { "GenQueries", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDeleteQueries, { "DeleteQueries", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetQueryiv, { "GetQueryiv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGetQueryObjectiv, { "GetQueryObjectiv", nullptr } },
{ (PRFuncPtr*) &mSymbols.fEndQuery, { "EndQuery", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDrawBuffer, { "DrawBuffer", nullptr } },
{ (PRFuncPtr*) &mSymbols.fDrawBuffers, { "DrawBuffers", nullptr } },
{ nullptr, { nullptr } },
};
if (!LoadSymbols(&symbols_desktop[0], trygl, prefix)) {
@ -1581,8 +1581,8 @@ GLContext::ReadTextureImage(GLuint aTexture,
vs = fCreateShader(LOCAL_GL_VERTEX_SHADER);
fs = fCreateShader(LOCAL_GL_FRAGMENT_SHADER);
fShaderSource(vs, 1, (const GLchar**) &vShader, NULL);
fShaderSource(fs, 1, (const GLchar**) &fShader, NULL);
fShaderSource(vs, 1, (const GLchar**) &vShader, nullptr);
fShaderSource(fs, 1, (const GLchar**) &fShader, nullptr);
fCompileShader(vs);
fCompileShader(fs);
prog = fCreateProgram();
@ -2012,8 +2012,8 @@ GLContext::BlitTextureImage(TextureImage *aSrc, const nsIntRect& aSrcRect,
} while (aSrc->NextTile());
} while (aDst->NextTile());
fVertexAttribPointer(0, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, NULL);
fVertexAttribPointer(1, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, NULL);
fVertexAttribPointer(0, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, nullptr);
fVertexAttribPointer(1, 2, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, nullptr);
// unbind the previous texture from the framebuffer
SetBlitFramebufferForDestTexture(0);
@ -2186,7 +2186,7 @@ GLContext::UploadSurfaceToTexture(gfxASurface *aSurface,
{
nsRefPtr<gfxImageSurface> imageSurface = aSurface->GetAsImageSurface();
unsigned char* data = NULL;
unsigned char* data = nullptr;
if (!imageSurface ||
(imageSurface->Format() != gfxASurface::ImageFormatARGB32 &&
@ -2254,7 +2254,7 @@ GLContext::UploadSurfaceToTexture(gfx::DataSourceSurface *aSurface,
GLenum aTextureUnit,
GLenum aTextureTarget)
{
unsigned char* data = aPixelBuffer ? NULL : aSurface->GetData();
unsigned char* data = aPixelBuffer ? nullptr : aSurface->GetData();
int32_t stride = aSurface->Stride();
gfxASurface::gfxImageFormat format =
ImageFormatForSurfaceFormat(aSurface->GetFormat());
@ -2349,7 +2349,7 @@ GLContext::TexImage2D(GLenum target, GLint level, GLint internalformat,
border,
format,
type,
NULL);
nullptr);
TexSubImage2D(target,
level,
0,
@ -2736,8 +2736,8 @@ GLContext::UseBlitProgram()
" gl_FragColor = texture2D(uSrcTexture, vTexCoord);"
"}";
fShaderSource(shaders[0], 1, (const GLchar**) &blitVSSrc, NULL);
fShaderSource(shaders[1], 1, (const GLchar**) &blitFSSrc, NULL);
fShaderSource(shaders[0], 1, (const GLchar**) &blitVSSrc, nullptr);
fShaderSource(shaders[1], 1, (const GLchar**) &blitFSSrc, nullptr);
for (int i = 0; i < 2; ++i) {
GLint success, len = 0;
@ -2958,7 +2958,7 @@ ReportArrayContents(const char *title, const nsTArray<GLContext::NamedResource>&
nsTArray<GLContext::NamedResource> copy(aArray);
copy.Sort();
GLContext *lastContext = NULL;
GLContext *lastContext = nullptr;
for (uint32_t i = 0; i < copy.Length(); ++i) {
if (lastContext != copy[i].origin) {
if (lastContext)

Просмотреть файл

@ -173,7 +173,7 @@ public:
#ifdef DEBUG
static void StaticInit() {
PR_NewThreadPrivateIndex(&sCurrentGLContextTLS, NULL);
PR_NewThreadPrivateIndex(&sCurrentGLContextTLS, nullptr);
}
#endif
@ -213,7 +213,7 @@ public:
mUserData.Put(aKey, aValue);
}
// Mark this context as destroyed. This will NULL out all
// Mark this context as destroyed. This will nullptr out all
// the GL function pointers!
void MarkDestroyed();
@ -229,7 +229,7 @@ public:
NativeDataTypeMax
};
virtual void *GetNativeData(NativeDataType aType) { return NULL; }
virtual void *GetNativeData(NativeDataType aType) { return nullptr; }
GLContext *GetSharedContext() { return mSharedContext; }
bool IsGlobalSharedContext() { return mIsGlobalSharedContext; }
@ -786,7 +786,7 @@ public:
* default, GL_LINEAR filtering. Specify
* |aFlags=UseNearestFilter| for GL_NEAREST filtering. Specify
* |aFlags=NeedsYFlip| if the image is flipped. Return
* NULL if creating the TextureImage fails.
* nullptr if creating the TextureImage fails.
*
* The returned TextureImage may only be used with this GLContext.
* Attempting to use the returned TextureImage after this
@ -982,7 +982,7 @@ public:
/**
* these return a float pointer to the start of each array respectively.
* Use it for glVertexAttribPointer calls.
* We can return NULL if we choose to use Vertex Buffer Objects here.
* We can return nullptr if we choose to use Vertex Buffer Objects here.
*/
float* vertexPointer() {
return &vertexCoords[0].x;
@ -1500,7 +1500,7 @@ public:
void BeforeGLCall(const char* glFunction) {
MOZ_ASSERT(IsCurrent());
if (DebugMode()) {
GLContext *currentGLContext = NULL;
GLContext *currentGLContext = nullptr;
currentGLContext = (GLContext*)PR_GetThreadPrivate(sCurrentGLContextTLS);

Просмотреть файл

@ -67,7 +67,7 @@ using namespace android;
// a little helper
class AutoDestroyHWND {
public:
AutoDestroyHWND(HWND aWnd = NULL)
AutoDestroyHWND(HWND aWnd = nullptr)
: mWnd(aWnd)
{
}
@ -84,7 +84,7 @@ public:
HWND forget() {
HWND w = mWnd;
mWnd = NULL;
mWnd = nullptr;
return w;
}
@ -555,7 +555,7 @@ public:
#else
EGLConfig config;
CreateConfig(&config);
mSurface = CreateSurfaceForWindow(NULL, config);
mSurface = CreateSurfaceForWindow(nullptr, config);
#endif
}
return sEGLLibrary.fMakeCurrent(EGL_DISPLAY(),
@ -570,7 +570,7 @@ public:
sEGLLibrary.fMakeCurrent(EGL_DISPLAY(), EGL_NO_SURFACE, EGL_NO_SURFACE,
EGL_NO_CONTEXT);
sEGLLibrary.fDestroySurface(EGL_DISPLAY(), mSurface);
mSurface = NULL;
mSurface = nullptr;
}
}
@ -1191,7 +1191,7 @@ public:
//printf_stderr("BeginUpdate with updateRect [%d %d %d %d]\n", mUpdateRect.x, mUpdateRect.y, mUpdateRect.width, mUpdateRect.height);
if (!nsIntRect(nsIntPoint(0, 0), mSize).Contains(mUpdateRect)) {
NS_ERROR("update outside of image");
return NULL;
return nullptr;
}
if (mBackingSurface) {
@ -1357,7 +1357,7 @@ public:
0,
GLFormatForImage(mUpdateFormat),
GLTypeForImage(mUpdateFormat),
NULL);
nullptr);
}
mTextureState = Allocated;

Просмотреть файл

@ -125,68 +125,68 @@ GLXLibrary::EnsureInitialized(LibType libType)
GLLibraryLoader::SymLoadStruct symbols[] = {
/* functions that were in GLX 1.0 */
{ (PRFuncPtr*) &xDestroyContextInternal, { "glXDestroyContext", NULL } },
{ (PRFuncPtr*) &xMakeCurrentInternal, { "glXMakeCurrent", NULL } },
{ (PRFuncPtr*) &xSwapBuffersInternal, { "glXSwapBuffers", NULL } },
{ (PRFuncPtr*) &xQueryVersionInternal, { "glXQueryVersion", NULL } },
{ (PRFuncPtr*) &xGetCurrentContextInternal, { "glXGetCurrentContext", NULL } },
{ (PRFuncPtr*) &xWaitGLInternal, { "glXWaitGL", NULL } },
{ (PRFuncPtr*) &xWaitXInternal, { "glXWaitX", NULL } },
{ (PRFuncPtr*) &xDestroyContextInternal, { "glXDestroyContext", nullptr } },
{ (PRFuncPtr*) &xMakeCurrentInternal, { "glXMakeCurrent", nullptr } },
{ (PRFuncPtr*) &xSwapBuffersInternal, { "glXSwapBuffers", nullptr } },
{ (PRFuncPtr*) &xQueryVersionInternal, { "glXQueryVersion", nullptr } },
{ (PRFuncPtr*) &xGetCurrentContextInternal, { "glXGetCurrentContext", nullptr } },
{ (PRFuncPtr*) &xWaitGLInternal, { "glXWaitGL", nullptr } },
{ (PRFuncPtr*) &xWaitXInternal, { "glXWaitX", nullptr } },
/* functions introduced in GLX 1.1 */
{ (PRFuncPtr*) &xQueryExtensionsStringInternal, { "glXQueryExtensionsString", NULL } },
{ (PRFuncPtr*) &xGetClientStringInternal, { "glXGetClientString", NULL } },
{ (PRFuncPtr*) &xQueryServerStringInternal, { "glXQueryServerString", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &xQueryExtensionsStringInternal, { "glXQueryExtensionsString", nullptr } },
{ (PRFuncPtr*) &xGetClientStringInternal, { "glXGetClientString", nullptr } },
{ (PRFuncPtr*) &xQueryServerStringInternal, { "glXQueryServerString", nullptr } },
{ nullptr, { nullptr } }
};
GLLibraryLoader::SymLoadStruct symbols13[] = {
/* functions introduced in GLX 1.3 */
{ (PRFuncPtr*) &xChooseFBConfigInternal, { "glXChooseFBConfig", NULL } },
{ (PRFuncPtr*) &xGetFBConfigAttribInternal, { "glXGetFBConfigAttrib", NULL } },
{ (PRFuncPtr*) &xChooseFBConfigInternal, { "glXChooseFBConfig", nullptr } },
{ (PRFuncPtr*) &xGetFBConfigAttribInternal, { "glXGetFBConfigAttrib", nullptr } },
// WARNING: xGetFBConfigs not set in symbols13_ext
{ (PRFuncPtr*) &xGetFBConfigsInternal, { "glXGetFBConfigs", NULL } },
{ (PRFuncPtr*) &xGetFBConfigsInternal, { "glXGetFBConfigs", nullptr } },
// WARNING: symbols13_ext sets xCreateGLXPixmapWithConfig instead
{ (PRFuncPtr*) &xCreatePixmapInternal, { "glXCreatePixmap", NULL } },
{ (PRFuncPtr*) &xDestroyPixmapInternal, { "glXDestroyPixmap", NULL } },
{ (PRFuncPtr*) &xCreateNewContextInternal, { "glXCreateNewContext", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &xCreatePixmapInternal, { "glXCreatePixmap", nullptr } },
{ (PRFuncPtr*) &xDestroyPixmapInternal, { "glXDestroyPixmap", nullptr } },
{ (PRFuncPtr*) &xCreateNewContextInternal, { "glXCreateNewContext", nullptr } },
{ nullptr, { nullptr } }
};
GLLibraryLoader::SymLoadStruct symbols13_ext[] = {
/* extension equivalents for functions introduced in GLX 1.3 */
// GLX_SGIX_fbconfig extension
{ (PRFuncPtr*) &xChooseFBConfigInternal, { "glXChooseFBConfigSGIX", NULL } },
{ (PRFuncPtr*) &xGetFBConfigAttribInternal, { "glXGetFBConfigAttribSGIX", NULL } },
{ (PRFuncPtr*) &xChooseFBConfigInternal, { "glXChooseFBConfigSGIX", nullptr } },
{ (PRFuncPtr*) &xGetFBConfigAttribInternal, { "glXGetFBConfigAttribSGIX", nullptr } },
// WARNING: no xGetFBConfigs equivalent in extensions
// WARNING: different from symbols13:
{ (PRFuncPtr*) &xCreateGLXPixmapWithConfigInternal, { "glXCreateGLXPixmapWithConfigSGIX", NULL } },
{ (PRFuncPtr*) &xDestroyPixmapInternal, { "glXDestroyGLXPixmap", NULL } }, // not from ext
{ (PRFuncPtr*) &xCreateNewContextInternal, { "glXCreateContextWithConfigSGIX", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &xCreateGLXPixmapWithConfigInternal, { "glXCreateGLXPixmapWithConfigSGIX", nullptr } },
{ (PRFuncPtr*) &xDestroyPixmapInternal, { "glXDestroyGLXPixmap", nullptr } }, // not from ext
{ (PRFuncPtr*) &xCreateNewContextInternal, { "glXCreateContextWithConfigSGIX", nullptr } },
{ nullptr, { nullptr } }
};
GLLibraryLoader::SymLoadStruct symbols14[] = {
/* functions introduced in GLX 1.4 */
{ (PRFuncPtr*) &xGetProcAddressInternal, { "glXGetProcAddress", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &xGetProcAddressInternal, { "glXGetProcAddress", nullptr } },
{ nullptr, { nullptr } }
};
GLLibraryLoader::SymLoadStruct symbols14_ext[] = {
/* extension equivalents for functions introduced in GLX 1.4 */
// GLX_ARB_get_proc_address extension
{ (PRFuncPtr*) &xGetProcAddressInternal, { "glXGetProcAddressARB", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &xGetProcAddressInternal, { "glXGetProcAddressARB", nullptr } },
{ nullptr, { nullptr } }
};
GLLibraryLoader::SymLoadStruct symbols_texturefrompixmap[] = {
{ (PRFuncPtr*) &xBindTexImageInternal, { "glXBindTexImageEXT", NULL } },
{ (PRFuncPtr*) &xReleaseTexImageInternal, { "glXReleaseTexImageEXT", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &xBindTexImageInternal, { "glXBindTexImageEXT", nullptr } },
{ (PRFuncPtr*) &xReleaseTexImageInternal, { "glXReleaseTexImageEXT", nullptr } },
{ nullptr, { nullptr } }
};
GLLibraryLoader::SymLoadStruct symbols_robustness[] = {
{ (PRFuncPtr*) &xCreateContextAttribsInternal, { "glXCreateContextAttribsARB", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &xCreateContextAttribsInternal, { "glXCreateContextAttribsARB", nullptr } },
{ nullptr, { nullptr } }
};
if (!GLLibraryLoader::LoadSymbols(mOGLLibrary, &symbols[0])) {
@ -448,7 +448,7 @@ GLXLibrary::BindTexImage(GLXPixmap aPixmap)
} else {
xWaitX();
}
xBindTexImage(display, aPixmap, GLX_FRONT_LEFT_EXT, NULL);
xBindTexImage(display, aPixmap, GLX_FRONT_LEFT_EXT, nullptr);
}
void
@ -777,7 +777,7 @@ TRY_AGAIN_NO_SHARING:
error = false;
GLXContext glxContext = shareContext ? shareContext->mContext : NULL;
GLXContext glxContext = shareContext ? shareContext->mContext : nullptr;
if (glx.HasRobustness()) {
int attrib_list[] = {
LOCAL_GL_CONTEXT_FLAGS_ARB, LOCAL_GL_CONTEXT_ROBUST_ACCESS_BIT_ARB,
@ -1354,7 +1354,7 @@ CreateOffscreenPixmapContext(const gfxIntSize& size, LibType libToUse)
glxpixmap = glx.xCreatePixmap(display,
cfgs[chosenIndex],
xsurface->XDrawable(),
NULL);
nullptr);
} else {
glxpixmap = glx.xCreateGLXPixmapWithConfig(display,
cfgs[chosenIndex],

Просмотреть файл

@ -41,26 +41,27 @@ HWND
WGLLibrary::CreateDummyWindow(HDC *aWindowDC)
{
WNDCLASSW wc;
if (!GetClassInfoW(GetModuleHandle(NULL), L"GLContextWGLClass", &wc)) {
if (!GetClassInfoW(GetModuleHandle(nullptr), L"GLContextWGLClass", &wc)) {
ZeroMemory(&wc, sizeof(WNDCLASSW));
wc.style = CS_OWNDC;
wc.hInstance = GetModuleHandle(NULL);
wc.hInstance = GetModuleHandle(nullptr);
wc.lpfnWndProc = DefWindowProc;
wc.lpszClassName = L"GLContextWGLClass";
if (!RegisterClassW(&wc)) {
NS_WARNING("Failed to register GLContextWGLClass?!");
// er. failed to register our class?
return NULL;
return nullptr;
}
}
HWND win = CreateWindowW(L"GLContextWGLClass", L"GLContextWGL", 0,
0, 0, 16, 16,
NULL, NULL, GetModuleHandle(NULL), NULL);
NS_ENSURE_TRUE(win, NULL);
nullptr, nullptr, GetModuleHandle(nullptr),
nullptr);
NS_ENSURE_TRUE(win, nullptr);
HDC dc = GetDC(win);
NS_ENSURE_TRUE(dc, NULL);
NS_ENSURE_TRUE(dc, nullptr);
if (mWindowPixelFormat == 0) {
PIXELFORMATDESCRIPTOR pfd;
@ -83,11 +84,11 @@ WGLLibrary::CreateDummyWindow(HDC *aWindowDC)
}
if (!mWindowPixelFormat ||
!SetPixelFormat(dc, mWindowPixelFormat, NULL))
!SetPixelFormat(dc, mWindowPixelFormat, nullptr))
{
NS_WARNING("SetPixelFormat failed!");
DestroyWindow(win);
return NULL;
return nullptr;
}
if (aWindowDC) {
@ -126,14 +127,14 @@ WGLLibrary::EnsureInitialized(bool aUseMesaLlvmPipe)
mUseDoubleBufferedWindows = PR_GetEnv("MOZ_WGL_DB") != nullptr;
GLLibraryLoader::SymLoadStruct earlySymbols[] = {
{ (PRFuncPtr*) &fCreateContext, { "wglCreateContext", NULL } },
{ (PRFuncPtr*) &fMakeCurrent, { "wglMakeCurrent", NULL } },
{ (PRFuncPtr*) &fGetProcAddress, { "wglGetProcAddress", NULL } },
{ (PRFuncPtr*) &fDeleteContext, { "wglDeleteContext", NULL } },
{ (PRFuncPtr*) &fGetCurrentContext, { "wglGetCurrentContext", NULL } },
{ (PRFuncPtr*) &fGetCurrentDC, { "wglGetCurrentDC", NULL } },
{ (PRFuncPtr*) &fShareLists, { "wglShareLists", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &fCreateContext, { "wglCreateContext", nullptr } },
{ (PRFuncPtr*) &fMakeCurrent, { "wglMakeCurrent", nullptr } },
{ (PRFuncPtr*) &fGetProcAddress, { "wglGetProcAddress", nullptr } },
{ (PRFuncPtr*) &fDeleteContext, { "wglDeleteContext", nullptr } },
{ (PRFuncPtr*) &fGetCurrentContext, { "wglGetCurrentContext", nullptr } },
{ (PRFuncPtr*) &fGetCurrentDC, { "wglGetCurrentDC", nullptr } },
{ (PRFuncPtr*) &fShareLists, { "wglShareLists", nullptr } },
{ nullptr, { nullptr } }
};
if (!GLLibraryLoader::LoadSymbols(mOGLLibrary, &earlySymbols[0])) {
@ -162,18 +163,18 @@ WGLLibrary::EnsureInitialized(bool aUseMesaLlvmPipe)
// a context current.
GLLibraryLoader::SymLoadStruct pbufferSymbols[] = {
{ (PRFuncPtr*) &fCreatePbuffer, { "wglCreatePbufferARB", "wglCreatePbufferEXT", NULL } },
{ (PRFuncPtr*) &fDestroyPbuffer, { "wglDestroyPbufferARB", "wglDestroyPbufferEXT", NULL } },
{ (PRFuncPtr*) &fGetPbufferDC, { "wglGetPbufferDCARB", "wglGetPbufferDCEXT", NULL } },
{ (PRFuncPtr*) &fBindTexImage, { "wglBindTexImageARB", "wglBindTexImageEXT", NULL } },
{ (PRFuncPtr*) &fReleaseTexImage, { "wglReleaseTexImageARB", "wglReleaseTexImageEXT", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &fCreatePbuffer, { "wglCreatePbufferARB", "wglCreatePbufferEXT", nullptr } },
{ (PRFuncPtr*) &fDestroyPbuffer, { "wglDestroyPbufferARB", "wglDestroyPbufferEXT", nullptr } },
{ (PRFuncPtr*) &fGetPbufferDC, { "wglGetPbufferDCARB", "wglGetPbufferDCEXT", nullptr } },
{ (PRFuncPtr*) &fBindTexImage, { "wglBindTexImageARB", "wglBindTexImageEXT", nullptr } },
{ (PRFuncPtr*) &fReleaseTexImage, { "wglReleaseTexImageARB", "wglReleaseTexImageEXT", nullptr } },
{ nullptr, { nullptr } }
};
GLLibraryLoader::SymLoadStruct pixFmtSymbols[] = {
{ (PRFuncPtr*) &fChoosePixelFormat, { "wglChoosePixelFormatARB", "wglChoosePixelFormatEXT", NULL } },
{ (PRFuncPtr*) &fGetPixelFormatAttribiv, { "wglGetPixelFormatAttribivARB", "wglGetPixelFormatAttribivEXT", NULL } },
{ NULL, { NULL } }
{ (PRFuncPtr*) &fChoosePixelFormat, { "wglChoosePixelFormatARB", "wglChoosePixelFormatEXT", nullptr } },
{ (PRFuncPtr*) &fGetPixelFormatAttribiv, { "wglGetPixelFormatAttribivARB", "wglGetPixelFormatAttribivEXT", nullptr } },
{ nullptr, { nullptr } }
};
if (!GLLibraryLoader::LoadSymbols(mOGLLibrary, &pbufferSymbols[0],
@ -191,13 +192,13 @@ WGLLibrary::EnsureInitialized(bool aUseMesaLlvmPipe)
}
GLLibraryLoader::SymLoadStruct extensionsSymbols[] = {
{ (PRFuncPtr *) &fGetExtensionsString, { "wglGetExtensionsStringARB", NULL} },
{ NULL, { NULL } }
{ (PRFuncPtr *) &fGetExtensionsString, { "wglGetExtensionsStringARB", nullptr} },
{ nullptr, { nullptr } }
};
GLLibraryLoader::SymLoadStruct robustnessSymbols[] = {
{ (PRFuncPtr *) &fCreateContextAttribs, { "wglCreateContextAttribsARB", NULL} },
{ NULL, { NULL } }
{ (PRFuncPtr *) &fCreateContextAttribs, { "wglCreateContextAttribsARB", nullptr} },
{ nullptr, { nullptr } }
};
if (GLLibraryLoader::LoadSymbols(mOGLLibrary, &extensionsSymbols[0],
@ -224,7 +225,7 @@ WGLLibrary::EnsureInitialized(bool aUseMesaLlvmPipe)
0
};
mWindowGLContext = fCreateContextAttribs(mWindowDC, NULL, attribs);
mWindowGLContext = fCreateContextAttribs(mWindowDC, nullptr, attribs);
if (!mWindowGLContext) {
mHasRobustness = false;
mWindowGLContext = fCreateContext(mWindowDC);
@ -266,7 +267,7 @@ public:
mDC(aDC),
mContext(aContext),
mWnd(aWindow),
mPBuffer(NULL),
mPBuffer(nullptr),
mPixelFormat(0),
mLibType(aLibUsed),
mIsDoubleBuffered(false)
@ -285,7 +286,7 @@ public:
: GLContext(caps, sharedContext, isOffscreen),
mDC(aDC),
mContext(aContext),
mWnd(NULL),
mWnd(nullptr),
mPBuffer(aPbuffer),
mPixelFormat(aPixelFormat),
mLibType(aLibUsed),
@ -456,7 +457,7 @@ GLContextProviderWGL::CreateForWindow(nsIWidget *aWidget)
HDC dc = (HDC)aWidget->GetNativeData(NS_NATIVE_GRAPHIC);
SetPixelFormat(dc, sWGLLib[libToUse].GetWindowPixelFormat(), NULL);
SetPixelFormat(dc, sWGLLib[libToUse].GetWindowPixelFormat(), nullptr);
HGLRC context;
GLContextWGL *shareContext = GetGlobalContextWGL();
@ -545,7 +546,7 @@ CreatePBufferOffscreenContext(const gfxIntSize& aSize,
int formats[1];
HDC windowDC = wgl.GetWindowDC();
if (!wgl.fChoosePixelFormat(windowDC,
attrs.Elements(), NULL,
attrs.Elements(), nullptr,
numFormats, formats, &numFormats)
|| numFormats == 0)
{

Просмотреть файл

@ -32,7 +32,7 @@ static const char *sExtensionNames[] = {
static PRLibrary* LoadApitraceLibrary()
{
static PRLibrary* sApitraceLibrary = NULL;
static PRLibrary* sApitraceLibrary = nullptr;
if (sApitraceLibrary)
return sApitraceLibrary;
@ -145,7 +145,7 @@ GLLibraryEGL::EnsureInitialized()
#endif // !Windows
#define SYMBOL(name) \
{ (PRFuncPtr*) &mSymbols.f##name, { "egl" #name, NULL } }
{ (PRFuncPtr*) &mSymbols.f##name, { "egl" #name, nullptr } }
GLLibraryLoader::SymLoadStruct earlySymbols[] = {
SYMBOL(GetDisplay),
@ -173,7 +173,7 @@ GLLibraryEGL::EnsureInitialized()
SYMBOL(BindTexImage),
SYMBOL(ReleaseTexImage),
SYMBOL(QuerySurface),
{ NULL, { NULL } }
{ nullptr, { nullptr } }
};
if (!GLLibraryLoader::LoadSymbols(mEGLLibrary, &earlySymbols[0])) {
@ -182,7 +182,7 @@ GLLibraryEGL::EnsureInitialized()
}
mEGLDisplay = fGetDisplay(EGL_DEFAULT_DISPLAY);
if (!fInitialize(mEGLDisplay, NULL, NULL))
if (!fInitialize(mEGLDisplay, nullptr, nullptr))
return false;
const char *vendor = (const char*) fQueryString(mEGLDisplay, LOCAL_EGL_VENDOR);
@ -372,7 +372,7 @@ void
GLLibraryEGL::DumpEGLConfigs()
{
int nc = 0;
fGetConfigs(mEGLDisplay, NULL, 0, &nc);
fGetConfigs(mEGLDisplay, nullptr, 0, &nc);
EGLConfig *ec = new EGLConfig[nc];
fGetConfigs(mEGLDisplay, ec, nc, &nc);

Просмотреть файл

@ -56,7 +56,7 @@ BasicTextureImage::BeginUpdate(nsIntRegion& aRegion)
nsIntRect rgnSize = mUpdateRegion.GetBounds();
if (!nsIntRect(nsIntPoint(0, 0), mSize).Contains(rgnSize)) {
NS_ERROR("update outside of image");
return NULL;
return nullptr;
}
ImageFormat format =
@ -66,8 +66,8 @@ BasicTextureImage::BeginUpdate(nsIntRegion& aRegion)
GetSurfaceForUpdate(gfxIntSize(rgnSize.width, rgnSize.height), format);
if (!mUpdateSurface || mUpdateSurface->CairoStatus()) {
mUpdateSurface = NULL;
return NULL;
mUpdateSurface = nullptr;
return nullptr;
}
mUpdateSurface->SetDeviceOffset(gfxPoint(-rgnSize.x, -rgnSize.y));
@ -182,7 +182,7 @@ BasicTextureImage::Resize(const nsIntSize& aSize)
0,
LOCAL_GL_RGBA,
LOCAL_GL_UNSIGNED_BYTE,
NULL);
nullptr);
mTextureState = Allocated;
mSize = aSize;

Просмотреть файл

@ -66,10 +66,10 @@ public:
/**
* Returns a gfxASurface for updating |aRegion| of the client's
* image if successul, NULL if not. |aRegion|'s bounds must fit
* image if successul, nullptr if not. |aRegion|'s bounds must fit
* within Size(); its coordinate space (if any) is ignored. If
* the update begins successfully, the returned gfxASurface is
* owned by this. Otherwise, NULL is returned.
* owned by this. Otherwise, nullptr is returned.
*
* |aRegion| is an inout param: the returned region is what the
* client must repaint. Category (1) regions above can

Просмотреть файл

@ -50,7 +50,7 @@ SharedDIBSurface::InitSurface(uint32_t aWidth, uint32_t aHeight,
gfxImageSurface::InitWithData(data, gfxIntSize(aWidth, aHeight),
stride, format);
cairo_surface_set_user_data(mSurface, &SHAREDDIB_KEY, this, NULL);
cairo_surface_set_user_data(mSurface, &SHAREDDIB_KEY, this, nullptr);
}
bool

Просмотреть файл

@ -40,8 +40,8 @@ SharedDIBWin::Close()
if (mSharedBmp)
::DeleteObject(mSharedBmp);
mSharedHdc = NULL;
mOldObj = mSharedBmp = NULL;
mSharedHdc = nullptr;
mOldObj = mSharedBmp = nullptr;
SharedDIB::Close();
@ -83,7 +83,7 @@ SharedDIBWin::Attach(Handle aHandle, uint32_t aWidth, uint32_t aHeight,
if (NS_FAILED(rv))
return rv;
if (NS_FAILED(SetupSurface(NULL, &bmih))) {
if (NS_FAILED(SetupSurface(nullptr, &bmih))) {
Close();
return NS_ERROR_FAILURE;
}

Просмотреть файл

@ -39,7 +39,7 @@ D3D9SurfaceImage::SetData(const Data& aData)
// device.
const nsIntRect& region = aData.mRegion;
RefPtr<IDirect3DTexture9> texture;
HANDLE shareHandle = NULL;
HANDLE shareHandle = nullptr;
hr = device->CreateTexture(region.width,
region.height,
1,
@ -59,7 +59,7 @@ D3D9SurfaceImage::SetData(const Data& aData)
textureSurface->GetDesc(&mDesc);
RECT src = { region.x, region.y, region.x+region.width, region.y+region.height };
hr = device->StretchRect(surface, &src, textureSurface, NULL, D3DTEXF_NONE);
hr = device->StretchRect(surface, &src, textureSurface, nullptr, D3DTEXF_NONE);
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
// Flush the draw command now, so that by the time we come to draw this
@ -87,7 +87,7 @@ D3D9SurfaceImage::EnsureSynchronized()
return;
}
int iterations = 0;
while (iterations < 10 && S_FALSE == mQuery->GetData(NULL, 0, D3DGETDATA_FLUSH)) {
while (iterations < 10 && S_FALSE == mQuery->GetData(nullptr, 0, D3DGETDATA_FLUSH)) {
Sleep(1);
iterations++;
}
@ -155,7 +155,7 @@ D3D9SurfaceImage::GetAsSurface()
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
D3DLOCKED_RECT rect;
hr = systemMemorySurface->LockRect(&rect, NULL, 0);
hr = systemMemorySurface->LockRect(&rect, nullptr, 0);
NS_ENSURE_TRUE(SUCCEEDED(hr), nullptr);
const unsigned char* src = (const unsigned char*)(rect.pBits);

Просмотреть файл

@ -28,7 +28,7 @@ public:
nsIntRect mRegion;
};
D3D9SurfaceImage() : Image(NULL, D3D9_RGB32_TEXTURE), mSize(0, 0) {}
D3D9SurfaceImage() : Image(nullptr, D3D9_RGB32_TEXTURE), mSize(0, 0) {}
virtual ~D3D9SurfaceImage() {}
// Copies the surface into a sharable texture's surface, and initializes

Просмотреть файл

@ -55,7 +55,7 @@ public:
gfxIntSize mPicSize;
};
GonkIOSurfaceImage()
: Image(NULL, GONK_IO_SURFACE)
: Image(nullptr, GONK_IO_SURFACE)
, mSize(0, 0)
{}

Просмотреть файл

@ -538,7 +538,7 @@ protected:
nsRefPtr<BufferRecycleBin> mRecycleBin;
// This contains the remote image data for this container, if this is NULL
// This contains the remote image data for this container, if this is nullptr
// that means the container has no other process that may control its active
// image.
RemoteImageData *mRemoteData;
@ -782,7 +782,7 @@ public:
gfxIntSize GetSize() { return mSize; }
CairoImage() : Image(NULL, CAIRO_SURFACE) {}
CairoImage() : Image(nullptr, CAIRO_SURFACE) {}
nsCountedRef<nsMainThreadSurfaceRef> mSurface;
gfxIntSize mSize;
@ -790,7 +790,7 @@ public:
class RemoteBitmapImage : public Image {
public:
RemoteBitmapImage() : Image(NULL, REMOTE_IMAGE_BITMAP) {}
RemoteBitmapImage() : Image(nullptr, REMOTE_IMAGE_BITMAP) {}
already_AddRefed<gfxASurface> GetAsSurface();

Просмотреть файл

@ -1142,7 +1142,7 @@ Layer::PrintInfo(nsACString& aTo, const char* aPrefix)
aTo += " [componentAlpha]";
}
if (GetIsFixedPosition()) {
aTo += " [isFixedPosition]";
aTo.AppendPrintf(" [isFixedPosition anchor=%f,%f]", mAnchor.x, mAnchor.y);
}
return aTo;

Просмотреть файл

@ -491,12 +491,12 @@ public:
* Dump information about this layer manager and its managed tree to
* aFile, which defaults to stderr.
*/
void Dump(FILE* aFile=NULL, const char* aPrefix="", bool aDumpHtml=false);
void Dump(FILE* aFile=nullptr, const char* aPrefix="", bool aDumpHtml=false);
/**
* Dump information about just this layer manager itself to aFile,
* which defaults to stderr.
*/
void DumpSelf(FILE* aFile=NULL, const char* aPrefix="");
void DumpSelf(FILE* aFile=nullptr, const char* aPrefix="");
/**
* Log information about this layer manager and its managed tree to
@ -859,7 +859,7 @@ public:
* same position when compositing the layer tree with a transformation
* (such as when asynchronously scrolling and zooming).
*/
void SetFixedPositionAnchor(const gfxPoint& aAnchor)
void SetFixedPositionAnchor(const LayerPoint& aAnchor)
{
if (mAnchor != aAnchor) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) FixedPositionAnchor", this));
@ -879,7 +879,7 @@ public:
* layer represents are auto-positioned, and so fixed position margins should
* not have an effect on the corresponding axis.
*/
void SetFixedPositionMargins(const gfx::Margin& aMargins)
void SetFixedPositionMargins(const LayerMargin& aMargins)
{
if (mMargins != aMargins) {
MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) FixedPositionMargins", this));
@ -905,8 +905,8 @@ public:
float GetPostXScale() const { return mPostXScale; }
float GetPostYScale() const { return mPostYScale; }
bool GetIsFixedPosition() { return mIsFixedPosition; }
gfxPoint GetFixedPositionAnchor() { return mAnchor; }
const gfx::Margin& GetFixedPositionMargins() { return mMargins; }
LayerPoint GetFixedPositionAnchor() { return mAnchor; }
const LayerMargin& GetFixedPositionMargins() { return mMargins; }
Layer* GetMaskLayer() const { return mMaskLayer; }
// Note that all lengths in animation data are either in CSS pixels or app
@ -1118,12 +1118,12 @@ public:
* Dump information about this layer manager and its managed tree to
* aFile, which defaults to stderr.
*/
void Dump(FILE* aFile=NULL, const char* aPrefix="", bool aDumpHtml=false);
void Dump(FILE* aFile=nullptr, const char* aPrefix="", bool aDumpHtml=false);
/**
* Dump information about just this layer manager itself to aFile,
* which defaults to stderr.
*/
void DumpSelf(FILE* aFile=NULL, const char* aPrefix="");
void DumpSelf(FILE* aFile=nullptr, const char* aPrefix="");
/**
* Log information about this layer manager and its managed tree to
@ -1260,8 +1260,8 @@ protected:
bool mUseClipRect;
bool mUseTileSourceRect;
bool mIsFixedPosition;
gfxPoint mAnchor;
gfx::Margin mMargins;
LayerPoint mAnchor;
LayerMargin mMargins;
DebugOnly<uint32_t> mDebugColorIndex;
// If this layer is used for OMTA, then this counter is used to ensure we
// stay in sync with the animation manager

Просмотреть файл

@ -18,7 +18,7 @@ static int colorId = 0;
static gfx3DMatrix GetRootTransform(Layer *aLayer) {
gfx3DMatrix layerTrans = aLayer->GetTransform();
layerTrans.ProjectTo2D();
if (aLayer->GetParent() != NULL) {
if (aLayer->GetParent() != nullptr) {
return GetRootTransform(aLayer->GetParent()) * layerTrans;
}
return layerTrans;

Просмотреть файл

@ -35,7 +35,7 @@ public:
return gl::GLContextProvider::GetSharedHandleAsSurface(mData.mShareType, mData.mHandle);
}
SharedTextureImage() : Image(NULL, SHARED_TEXTURE) {}
SharedTextureImage() : Image(nullptr, SHARED_TEXTURE) {}
private:
Data mData;

Просмотреть файл

@ -109,86 +109,174 @@ AsyncCompositionManager::ComputeRotation()
}
}
// Do a breadth-first search to find the first layer in the tree that is
// scrollable.
static void
Translate2D(gfx3DMatrix& aTransform, const gfxPoint& aOffset)
static bool
GetBaseTransform2D(Layer* aLayer, gfxMatrix* aTransform)
{
aTransform._41 += aOffset.x;
aTransform._42 += aOffset.y;
// Start with the animated transform if there is one
return (aLayer->AsLayerComposite()->GetShadowTransformSetByAnimation() ?
aLayer->GetLocalTransform() : aLayer->GetTransform()).Is2D(aTransform);
}
static void
TranslateShadowLayer2D(Layer* aLayer,
const gfxPoint& aTranslation)
{
gfxMatrix layerTransform;
if (!GetBaseTransform2D(aLayer, &layerTransform)) {
return;
}
// Apply the 2D translation to the layer transform.
layerTransform.x0 += aTranslation.x;
layerTransform.y0 += aTranslation.y;
// The transform already takes the resolution scale into account. Since we
// will apply the resolution scale again when computing the effective
// transform, we must apply the inverse resolution scale here.
gfx3DMatrix layerTransform3D = gfx3DMatrix::From2D(layerTransform);
if (ContainerLayer* c = aLayer->AsContainerLayer()) {
layerTransform3D.Scale(1.0f/c->GetPreXScale(),
1.0f/c->GetPreYScale(),
1);
}
layerTransform3D.ScalePost(1.0f/aLayer->GetPostXScale(),
1.0f/aLayer->GetPostYScale(),
1);
LayerComposite* layerComposite = aLayer->AsLayerComposite();
layerComposite->SetShadowTransform(layerTransform3D);
layerComposite->SetShadowTransformSetByAnimation(false);
const nsIntRect* clipRect = aLayer->GetClipRect();
if (clipRect) {
nsIntRect transformedClipRect(*clipRect);
transformedClipRect.MoveBy(aTranslation.x, aTranslation.y);
layerComposite->SetShadowClipRect(&transformedClipRect);
}
}
static bool
AccumulateLayerTransforms2D(Layer* aLayer,
Layer* aAncestor,
gfxMatrix& aMatrix)
{
// Accumulate the transforms between this layer and the subtree root layer.
for (Layer* l = aLayer; l && l != aAncestor; l = l->GetParent()) {
gfxMatrix l2D;
if (!GetBaseTransform2D(l, &l2D)) {
return false;
}
aMatrix.Multiply(l2D);
}
return true;
}
static LayerPoint
GetLayerFixedMarginsOffset(Layer* aLayer,
const LayerMargin& aFixedLayerMargins)
{
// Work out the necessary translation, in root scrollable layer space.
// Because fixed layer margins are stored relative to the root scrollable
// layer, we can just take the difference between these values.
LayerPoint translation;
const LayerPoint& anchor = aLayer->GetFixedPositionAnchor();
const LayerMargin& fixedMargins = aLayer->GetFixedPositionMargins();
if (fixedMargins.left >= 0) {
if (anchor.x > 0) {
translation.x -= aFixedLayerMargins.right - fixedMargins.right;
} else {
translation.x += aFixedLayerMargins.left - fixedMargins.left;
}
}
if (fixedMargins.top >= 0) {
if (anchor.y > 0) {
translation.y -= aFixedLayerMargins.bottom - fixedMargins.bottom;
} else {
translation.y += aFixedLayerMargins.top - fixedMargins.top;
}
}
return translation;
}
void
AsyncCompositionManager::TransformFixedLayers(Layer* aLayer,
const gfxPoint& aTranslation,
const gfxSize& aScaleDiff,
const gfx::Margin& aFixedLayerMargins)
AsyncCompositionManager::AlignFixedLayersForAnchorPoint(Layer* aLayer,
Layer* aTransformedSubtreeRoot,
const gfx3DMatrix& aPreviousTransformForRoot,
const LayerMargin& aFixedLayerMargins)
{
if (aLayer->GetIsFixedPosition() &&
if (aLayer != aTransformedSubtreeRoot && aLayer->GetIsFixedPosition() &&
!aLayer->GetParent()->GetIsFixedPosition()) {
// When a scale has been applied to a layer, it focuses around (0,0).
// The anchor position is used here as a scale focus point (assuming that
// aScaleDiff has already been applied) to re-focus the scale.
const gfxPoint& anchor = aLayer->GetFixedPositionAnchor();
gfxPoint translation(aTranslation - (anchor - anchor / aScaleDiff));
// Insert a translation so that the position of the anchor point is the same
// before and after the change to the transform of aTransformedSubtreeRoot.
// This currently only works for fixed layers with 2D transforms.
// Offset this translation by the fixed layer margins, depending on what
// side of the viewport the layer is anchored to, reconciling the
// difference between the current fixed layer margins and the Gecko-side
// fixed layer margins.
// aFixedLayerMargins are the margins we expect to be at at the current
// time, obtained via SyncViewportInfo, and fixedMargins are the margins
// that were used during layout.
// If top/left of fixedMargins are negative, that indicates that this layer
// represents auto-positioned elements, and should not be affected by
// fixed margins at all.
const gfx::Margin& fixedMargins = aLayer->GetFixedPositionMargins();
if (fixedMargins.left >= 0) {
if (anchor.x > 0) {
translation.x -= aFixedLayerMargins.right - fixedMargins.right;
} else {
translation.x += aFixedLayerMargins.left - fixedMargins.left;
}
// Accumulate the transforms between this layer and the subtree root layer.
gfxMatrix ancestorTransform;
if (!AccumulateLayerTransforms2D(aLayer->GetParent(), aTransformedSubtreeRoot,
ancestorTransform)) {
return;
}
if (fixedMargins.top >= 0) {
if (anchor.y > 0) {
translation.y -= aFixedLayerMargins.bottom - fixedMargins.bottom;
} else {
translation.y += aFixedLayerMargins.top - fixedMargins.top;
}
gfxMatrix oldRootTransform;
gfxMatrix newRootTransform;
if (!aPreviousTransformForRoot.Is2D(&oldRootTransform) ||
!aTransformedSubtreeRoot->GetLocalTransform().Is2D(&newRootTransform)) {
return;
}
// The transform already takes the resolution scale into account. Since we
// will apply the resolution scale again when computing the effective
// transform, we must apply the inverse resolution scale here.
LayerComposite* layerComposite = aLayer->AsLayerComposite();
gfx3DMatrix layerTransform;
if (layerComposite->GetShadowTransformSetByAnimation()) {
// Start with the animated transform
layerTransform = aLayer->GetLocalTransform();
} else {
layerTransform = aLayer->GetTransform();
// Calculate the cumulative transforms between the subtree root with the
// old transform and the current transform.
gfxMatrix oldCumulativeTransform = ancestorTransform * oldRootTransform;
gfxMatrix newCumulativeTransform = ancestorTransform * newRootTransform;
if (newCumulativeTransform.IsSingular()) {
return;
}
Translate2D(layerTransform, translation);
if (ContainerLayer* c = aLayer->AsContainerLayer()) {
layerTransform.Scale(1.0f/c->GetPreXScale(),
1.0f/c->GetPreYScale(),
1);
}
layerTransform.ScalePost(1.0f/aLayer->GetPostXScale(),
1.0f/aLayer->GetPostYScale(),
1);
layerComposite->SetShadowTransform(layerTransform);
layerComposite->SetShadowTransformSetByAnimation(false);
gfxMatrix newCumulativeTransformInverse = newCumulativeTransform;
newCumulativeTransformInverse.Invert();
const nsIntRect* clipRect = aLayer->GetClipRect();
if (clipRect) {
nsIntRect transformedClipRect(*clipRect);
transformedClipRect.MoveBy(translation.x, translation.y);
layerComposite->SetShadowClipRect(&transformedClipRect);
// Now work out the translation necessary to make sure the layer doesn't
// move given the new sub-tree root transform.
gfxMatrix layerTransform;
if (!GetBaseTransform2D(aLayer, &layerTransform)) {
return;
}
// Calculate any offset necessary, in previous transform sub-tree root
// space. This is used to make sure fixed position content respects
// content document fixed position margins.
LayerPoint offsetInOldSubtreeLayerSpace = GetLayerFixedMarginsOffset(aLayer, aFixedLayerMargins);
// Add the above offset to the anchor point so we can offset the layer by
// and amount that's specified in old subtree layer space.
const LayerPoint& anchorInOldSubtreeLayerSpace = aLayer->GetFixedPositionAnchor();
LayerPoint offsetAnchorInOldSubtreeLayerSpace = anchorInOldSubtreeLayerSpace + offsetInOldSubtreeLayerSpace;
// Add the local layer transform to the two points to make the equation
// below this section more convenient.
gfxPoint anchor(anchorInOldSubtreeLayerSpace.x, anchorInOldSubtreeLayerSpace.y);
gfxPoint offsetAnchor(offsetAnchorInOldSubtreeLayerSpace.x, offsetAnchorInOldSubtreeLayerSpace.y);
gfxPoint locallyTransformedAnchor = layerTransform.Transform(anchor);
gfxPoint locallyTransformedOffsetAnchor = layerTransform.Transform(offsetAnchor);
// Transforming the locallyTransformedAnchor by oldCumulativeTransform
// returns the layer's anchor point relative to the parent of
// aTransformedSubtreeRoot, before the new transform was applied.
// Then, applying newCumulativeTransformInverse maps that point relative
// to the layer's parent, which is the same coordinate space as
// locallyTransformedAnchor again, allowing us to subtract them and find
// out the offset necessary to make sure the layer stays stationary.
gfxPoint oldAnchorPositionInNewSpace =
newCumulativeTransformInverse.Transform(
oldCumulativeTransform.Transform(locallyTransformedOffsetAnchor));
gfxPoint translation = oldAnchorPositionInNewSpace - locallyTransformedAnchor;
// Finally, apply the 2D translation to the layer transform.
TranslateShadowLayer2D(aLayer, translation);
// The transform has now been applied, so there's no need to iterate over
// child layers.
return;
@ -196,7 +284,8 @@ AsyncCompositionManager::TransformFixedLayers(Layer* aLayer,
for (Layer* child = aLayer->GetFirstChild();
child; child = child->GetNextSibling()) {
TransformFixedLayers(child, aTranslation, aScaleDiff, aFixedLayerMargins);
AlignFixedLayersForAnchorPoint(child, aTransformedSubtreeRoot,
aPreviousTransformForRoot, aFixedLayerMargins);
}
}
@ -342,6 +431,7 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(TimeStamp aCurrentFram
if (AsyncPanZoomController* controller = container->GetAsyncPanZoomController()) {
LayerComposite* layerComposite = aLayer->AsLayerComposite();
gfx3DMatrix oldTransform = aLayer->GetTransform();
ViewTransform treeTransform;
ScreenPoint scrollOffset;
@ -361,7 +451,7 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(TimeStamp aCurrentFram
/ LayerToLayoutDeviceScale(rootTransform.GetXScale(), rootTransform.GetYScale());
CSSRect displayPort(metrics.mCriticalDisplayPort.IsEmpty() ?
metrics.mDisplayPort : metrics.mCriticalDisplayPort);
gfx::Margin fixedLayerMargins(0, 0, 0, 0);
LayerMargin fixedLayerMargins(0, 0, 0, 0);
ScreenPoint offset(0, 0);
SyncFrameMetrics(scrollOffset, treeTransform.mScale.scale, metrics.mScrollableRect,
mLayersUpdated, displayPort, paintScale,
@ -387,11 +477,20 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(TimeStamp aCurrentFram
NS_ASSERTION(!layerComposite->GetShadowTransformSetByAnimation(),
"overwriting animated transform!");
TransformFixedLayers(
aLayer,
gfxPoint(-treeTransform.mTranslation.x, -treeTransform.mTranslation.y),
gfxSize(treeTransform.mScale.scale, treeTransform.mScale.scale),
fixedLayerMargins);
// Apply resolution scaling to the old transform - the layer tree as it is
// doesn't have the necessary transform to display correctly.
#ifdef MOZ_WIDGET_ANDROID
// XXX We use rootTransform instead of the resolution on the individual layer's
// FrameMetrics on Fennec because the resolution is set on the root layer rather
// than the scrollable layer. See bug 732971. On non-Fennec we do the right thing.
LayoutDeviceToLayerScale resolution(1.0 / rootTransform.GetXScale(),
1.0 / rootTransform.GetYScale());
#else
LayoutDeviceToLayerScale resolution = metrics.mResolution;
#endif
oldTransform.Scale(resolution.scale, resolution.scale, 1);
AlignFixedLayersForAnchorPoint(aLayer, aLayer, oldTransform, fixedLayerMargins);
appliedTransform = true;
}
@ -409,6 +508,7 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer, const LayoutDev
// We must apply the resolution scale before a pan/zoom transform, so we call
// GetTransform here.
const gfx3DMatrix& currentTransform = aLayer->GetTransform();
gfx3DMatrix oldTransform = currentTransform;
gfx3DMatrix treeTransform;
@ -437,7 +537,7 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer, const LayoutDev
) * geckoZoom);
displayPort += scrollOffsetLayerPixels;
gfx::Margin fixedLayerMargins(0, 0, 0, 0);
LayerMargin fixedLayerMargins(0, 0, 0, 0);
ScreenPoint offset(0, 0);
// Ideally we would initialize userZoom to AsyncPanZoomController::CalculateResolution(metrics)
@ -471,33 +571,6 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer, const LayoutDev
LayerPoint translation = (userScroll / zoomAdjust) - geckoScroll;
treeTransform = gfx3DMatrix(ViewTransform(-translation, userZoom / metrics.mDevPixelsPerCSSPixel));
// Translate fixed position layers so that they stay in the correct position
// when userScroll and geckoScroll differ.
gfxPoint fixedOffset;
gfxSize scaleDiff;
LayerRect content = mContentRect * geckoZoom;
// If the contents can fit entirely within the widget area on a particular
// dimension, we need to translate and scale so that the fixed layers remain
// within the page boundaries.
if (mContentRect.width * userZoom.scale < metrics.mCompositionBounds.width) {
fixedOffset.x = -geckoScroll.x;
scaleDiff.width = std::min(1.0f, metrics.mCompositionBounds.width / content.width);
} else {
fixedOffset.x = clamped(userScroll.x / zoomAdjust.scale, content.x,
content.XMost() - metrics.mCompositionBounds.width / zoomAdjust.scale) - geckoScroll.x;
scaleDiff.width = zoomAdjust.scale;
}
if (mContentRect.height * userZoom.scale < metrics.mCompositionBounds.height) {
fixedOffset.y = -geckoScroll.y;
scaleDiff.height = std::min(1.0f, metrics.mCompositionBounds.height / content.height);
} else {
fixedOffset.y = clamped(userScroll.y / zoomAdjust.scale, content.y,
content.YMost() - metrics.mCompositionBounds.height / zoomAdjust.scale) - geckoScroll.y;
scaleDiff.height = zoomAdjust.scale;
}
// The transform already takes the resolution scale into account. Since we
// will apply the resolution scale again when computing the effective
// transform, we must apply the inverse resolution scale here.
@ -511,7 +584,46 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer, const LayoutDev
layerComposite->SetShadowTransform(computedTransform);
NS_ASSERTION(!layerComposite->GetShadowTransformSetByAnimation(),
"overwriting animated transform!");
TransformFixedLayers(aLayer, fixedOffset, scaleDiff, fixedLayerMargins);
// Apply resolution scaling to the old transform - the layer tree as it is
// doesn't have the necessary transform to display correctly.
oldTransform.Scale(aResolution.scale, aResolution.scale, 1);
// Make sure that overscroll and under-zoom are represented in the old
// transform so that fixed position content moves and scales accordingly.
// These calculations will effectively scale and offset fixed position layers
// in screen space when the compensatory transform is performed in
// AlignFixedLayersForAnchorPoint.
ScreenRect contentScreenRect = mContentRect * userZoom;
gfxPoint3D overscrollTranslation;
if (userScroll.x < contentScreenRect.x) {
overscrollTranslation.x = contentScreenRect.x - userScroll.x;
} else if (userScroll.x + metrics.mCompositionBounds.width > contentScreenRect.XMost()) {
overscrollTranslation.x = contentScreenRect.XMost() -
(userScroll.x + metrics.mCompositionBounds.width);
}
if (userScroll.y < contentScreenRect.y) {
overscrollTranslation.y = contentScreenRect.y - userScroll.y;
} else if (userScroll.y + metrics.mCompositionBounds.height > contentScreenRect.YMost()) {
overscrollTranslation.y = contentScreenRect.YMost() -
(userScroll.y + metrics.mCompositionBounds.height);
}
oldTransform.Translate(overscrollTranslation);
gfxSize underZoomScale(1.0f, 1.0f);
if (mContentRect.width * userZoom.scale < metrics.mCompositionBounds.width) {
underZoomScale.width = (mContentRect.width * userZoom.scale) /
metrics.mCompositionBounds.width;
}
if (mContentRect.height * userZoom.scale < metrics.mCompositionBounds.height) {
underZoomScale.height = (mContentRect.height * userZoom.scale) /
metrics.mCompositionBounds.height;
}
oldTransform.Scale(underZoomScale.width, underZoomScale.height, 1);
// Make sure fixed position layers don't move away from their anchor points
// when we're asynchronously panning or zooming
AlignFixedLayersForAnchorPoint(aLayer, aLayer, oldTransform, fixedLayerMargins);
}
bool
@ -587,7 +699,7 @@ AsyncCompositionManager::SyncViewportInfo(const LayerIntRect& aDisplayPort,
bool aLayersUpdated,
ScreenPoint& aScrollOffset,
CSSToScreenScale& aScale,
gfx::Margin& aFixedLayerMargins,
LayerMargin& aFixedLayerMargins,
ScreenPoint& aOffset)
{
#ifdef MOZ_WIDGET_ANDROID
@ -609,7 +721,7 @@ AsyncCompositionManager::SyncFrameMetrics(const ScreenPoint& aScrollOffset,
const CSSRect& aDisplayPort,
const CSSToLayerScale& aDisplayResolution,
bool aIsFirstPaint,
gfx::Margin& aFixedLayerMargins,
LayerMargin& aFixedLayerMargins,
ScreenPoint& aOffset)
{
#ifdef MOZ_WIDGET_ANDROID

Просмотреть файл

@ -131,7 +131,7 @@ private:
bool aLayersUpdated,
ScreenPoint& aScrollOffset,
CSSToScreenScale& aScale,
gfx::Margin& aFixedLayerMargins,
LayerMargin& aFixedLayerMargins,
ScreenPoint& aOffset);
void SyncFrameMetrics(const ScreenPoint& aScrollOffset,
float aZoom,
@ -140,20 +140,23 @@ private:
const CSSRect& aDisplayPort,
const CSSToLayerScale& aDisplayResolution,
bool aIsFirstPaint,
gfx::Margin& aFixedLayerMargins,
LayerMargin& aFixedLayerMargins,
ScreenPoint& aOffset);
/**
* Recursively applies the given translation to all top-level fixed position
* layers that are descendants of the given layer.
* aScaleDiff is considered to be the scale transformation applied when
* displaying the layers, and is used to make sure the anchor points of
* fixed position layers remain in the same position.
* Adds a translation to the transform of any fixed-pos layer descendant of
* aTransformedSubtreeRoot whose parent layer is not fixed. The translation is
* chosen so that the layer's anchor point relative to aTransformedSubtreeRoot's
* parent layer is the same as it was when aTransformedSubtreeRoot's
* GetLocalTransform() was aPreviousTransformForRoot.
* This function will also adjust layers so that the given content document
* fixed position margins will be respected during asynchronous panning and
* zooming.
*/
void TransformFixedLayers(Layer* aLayer,
const gfxPoint& aTranslation,
const gfxSize& aScaleDiff,
const gfx::Margin& aFixedLayerMargins);
void AlignFixedLayersForAnchorPoint(Layer* aLayer,
Layer* aTransformedSubtreeRoot,
const gfx3DMatrix& aPreviousTransformForRoot,
const LayerMargin& aFixedLayerMargins);
/**
* DRAWING PHASE ONLY

Просмотреть файл

@ -195,7 +195,7 @@ public:
SetCompositor(nullptr);
}
virtual void Dump(FILE* aFile=NULL,
virtual void Dump(FILE* aFile=nullptr,
const char* aPrefix="",
bool aDumpHtml=false) { }
static void DumpDeprecatedTextureHost(FILE* aFile, DeprecatedTextureHost* aTexture);

Просмотреть файл

@ -97,7 +97,7 @@ public:
}
#endif
virtual void Dump(FILE* aFile=NULL,
virtual void Dump(FILE* aFile=nullptr,
const char* aPrefix="",
bool aDumpHtml=false) MOZ_OVERRIDE;
@ -159,7 +159,7 @@ public:
const TextureInfo& aTextureInfo) MOZ_OVERRIDE;
virtual void DestroyTextures() MOZ_OVERRIDE;
virtual void Dump(FILE* aFile=NULL,
virtual void Dump(FILE* aFile=nullptr,
const char* aPrefix="",
bool aDumpHtml=false) MOZ_OVERRIDE;

Просмотреть файл

@ -86,7 +86,7 @@ public:
virtual void SetCompositor(Compositor* aCompositor) MOZ_OVERRIDE;
virtual void Dump(FILE* aFile=NULL,
virtual void Dump(FILE* aFile=nullptr,
const char* aPrefix="",
bool aDumpHtml=false) MOZ_OVERRIDE;

Просмотреть файл

@ -202,7 +202,7 @@ public:
virtual void Attach(Layer* aLayer, Compositor* aCompositor) MOZ_OVERRIDE;
virtual void Dump(FILE* aFile=NULL,
virtual void Dump(FILE* aFile=nullptr,
const char* aPrefix="",
bool aDumpHtml=false) MOZ_OVERRIDE;

Просмотреть файл

@ -68,7 +68,7 @@ CanvasLayerD3D10::Initialize(const Data& aData)
"CanvasLayer can't have both surface and WebGLContext/Surface");
mBounds.SetRect(0, 0, aData.mSize.width, aData.mSize.height);
device()->CreateShaderResourceView(mTexture, NULL, getter_AddRefs(mSRView));
device()->CreateShaderResourceView(mTexture, nullptr, getter_AddRefs(mSRView));
return;
}
@ -86,7 +86,7 @@ CanvasLayerD3D10::Initialize(const Data& aData)
if (data) {
mTexture = static_cast<ID3D10Texture2D*>(data);
mIsD2DTexture = true;
device()->CreateShaderResourceView(mTexture, NULL, getter_AddRefs(mSRView));
device()->CreateShaderResourceView(mTexture, nullptr, getter_AddRefs(mSRView));
mHasAlpha =
mSurface->GetContentType() == gfxASurface::CONTENT_COLOR_ALPHA;
return;
@ -100,13 +100,13 @@ CanvasLayerD3D10::Initialize(const Data& aData)
desc.Usage = D3D10_USAGE_DYNAMIC;
desc.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE;
HRESULT hr = device()->CreateTexture2D(&desc, NULL, getter_AddRefs(mTexture));
HRESULT hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(mTexture));
if (FAILED(hr)) {
NS_WARNING("Failed to create texture for CanvasLayer!");
return;
}
device()->CreateShaderResourceView(mTexture, NULL, getter_AddRefs(mUploadSRView));
device()->CreateShaderResourceView(mTexture, nullptr, getter_AddRefs(mUploadSRView));
}
void

Просмотреть файл

@ -20,7 +20,7 @@ class CanvasLayerD3D10 : public CanvasLayer,
{
public:
CanvasLayerD3D10(LayerManagerD3D10 *aManager)
: CanvasLayer(aManager, NULL)
: CanvasLayer(aManager, nullptr)
, LayerD3D10(aManager)
, mDataIsPremultiplied(false)
, mNeedsYFlip(false)

Просмотреть файл

@ -11,7 +11,7 @@ namespace mozilla {
namespace layers {
ColorLayerD3D10::ColorLayerD3D10(LayerManagerD3D10 *aManager)
: ColorLayer(aManager, NULL)
: ColorLayer(aManager, nullptr)
, LayerD3D10(aManager)
{
mImplData = static_cast<LayerD3D10*>(this);

Просмотреть файл

@ -16,7 +16,7 @@ namespace mozilla {
namespace layers {
ContainerLayerD3D10::ContainerLayerD3D10(LayerManagerD3D10 *aManager)
: ContainerLayer(aManager, NULL)
: ContainerLayer(aManager, nullptr)
, LayerD3D10(aManager)
{
mImplData = static_cast<LayerD3D10*>(this);
@ -215,7 +215,7 @@ ContainerLayerD3D10::RenderLayer()
gfx3DMatrix oldViewMatrix;
if (useIntermediate) {
device()->OMGetRenderTargets(1, getter_AddRefs(previousRTView), NULL);
device()->OMGetRenderTargets(1, getter_AddRefs(previousRTView), nullptr);
D3D10_TEXTURE2D_DESC desc;
memset(&desc, 0, sizeof(D3D10_TEXTURE2D_DESC));
@ -227,7 +227,7 @@ ContainerLayerD3D10::RenderLayer()
desc.SampleDesc.Count = 1;
desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
HRESULT hr;
hr = device()->CreateTexture2D(&desc, NULL, getter_AddRefs(renderTexture));
hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(renderTexture));
if (FAILED(hr)) {
LayerManagerD3D10::ReportFailure(NS_LITERAL_CSTRING("Failed to create new texture for ContainerLayerD3D10!"),
@ -235,7 +235,7 @@ ContainerLayerD3D10::RenderLayer()
return;
}
hr = device()->CreateRenderTargetView(renderTexture, NULL, getter_AddRefs(rtView));
hr = device()->CreateRenderTargetView(renderTexture, nullptr, getter_AddRefs(rtView));
NS_ASSERTION(SUCCEEDED(hr), "Failed to create render target view for ContainerLayerD3D10!");
effect()->GetVariableByName("vRenderTargetOffset")->
@ -277,7 +277,7 @@ ContainerLayerD3D10::RenderLayer()
}
ID3D10RenderTargetView *rtViewPtr = rtView;
device()->OMSetRenderTargets(1, &rtViewPtr, NULL);
device()->OMSetRenderTargets(1, &rtViewPtr, nullptr);
renderTargetOffset[0] = (float)visibleRect.x;
renderTargetOffset[1] = (float)visibleRect.y;
@ -332,7 +332,7 @@ ContainerLayerD3D10::RenderLayer()
if (useIntermediate) {
mD3DManager->SetViewport(previousViewportSize);
ID3D10RenderTargetView *rtView = previousRTView;
device()->OMSetRenderTargets(1, &rtView, NULL);
device()->OMSetRenderTargets(1, &rtView, nullptr);
effect()->GetVariableByName("vRenderTargetOffset")->
SetRawValue(previousRenderTargetOffset, 0, 8);
@ -360,7 +360,7 @@ ContainerLayerD3D10::RenderLayer()
technique->GetPassByIndex(0)->Apply(0);
ID3D10ShaderResourceView *view;
device()->CreateShaderResourceView(renderTexture, NULL, &view);
device()->CreateShaderResourceView(renderTexture, nullptr, &view);
device()->PSSetShaderResources(0, 1, &view);
device()->Draw(4, 0);
view->Release();

Просмотреть файл

@ -50,7 +50,7 @@ SurfaceToTexture(ID3D10Device *aDevice,
const gfxIntSize &aSize)
{
if (!aSurface) {
return NULL;
return nullptr;
}
if (aSurface->GetType() == gfxASurface::SurfaceTypeD2D) {
@ -106,7 +106,7 @@ ImageLayerD3D10::GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex
dat->mTexture = DataToTexture(device(), remoteImage->mData, remoteImage->mStride, remoteImage->mSize);
if (dat->mTexture) {
device()->CreateShaderResourceView(dat->mTexture, NULL, getter_AddRefs(dat->mSRView));
device()->CreateShaderResourceView(dat->mTexture, nullptr, getter_AddRefs(dat->mSRView));
aImage->SetBackendData(mozilla::layers::LAYERS_D3D10, dat.forget());
}
}
@ -132,7 +132,7 @@ ImageLayerD3D10::GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex
dat->mTexture = SurfaceToTexture(device(), cairoImage->mSurface, cairoImage->mSize);
if (dat->mTexture) {
device()->CreateShaderResourceView(dat->mTexture, NULL, getter_AddRefs(dat->mSRView));
device()->CreateShaderResourceView(dat->mTexture, nullptr, getter_AddRefs(dat->mSRView));
aImage->SetBackendData(mozilla::layers::LAYERS_D3D10, dat.forget());
}
}
@ -152,7 +152,7 @@ ImageLayerD3D10::GetImageSRView(Image* aImage, bool& aHasAlpha, IDXGIKeyedMutex
nsAutoPtr<TextureD3D10BackendData> dat(new TextureD3D10BackendData());
dat->mTexture = texture;
hr = device()->CreateShaderResourceView(dat->mTexture, NULL, getter_AddRefs(dat->mSRView));
hr = device()->CreateShaderResourceView(dat->mTexture, nullptr, getter_AddRefs(dat->mSRView));
NS_ENSURE_TRUE(SUCCEEDED(hr) && dat->mSRView, nullptr);
aImage->SetBackendData(mozilla::layers::LAYERS_D3D10, dat.forget());
@ -307,7 +307,7 @@ ImageLayerD3D10::RenderLayer()
if (yuvImage->GetData()->mStereoMode != STEREO_MODE_MONO) {
// Dst resource is optional
GetNv3DVUtils()->SendNv3DVMetaData((unsigned int)yuvImage->GetData()->mYSize.width,
(unsigned int)yuvImage->GetData()->mYSize.height, (HANDLE)(data->mYTexture), (HANDLE)(NULL));
(unsigned int)yuvImage->GetData()->mYSize.height, (HANDLE)(data->mYTexture), (HANDLE)(nullptr));
}
}
@ -385,9 +385,9 @@ void ImageLayerD3D10::AllocateTexturesYCbCr(PlanarYCbCrImage *aImage)
hr);
return;
}
device()->CreateShaderResourceView(backendData->mYTexture, NULL, getter_AddRefs(backendData->mYView));
device()->CreateShaderResourceView(backendData->mCbTexture, NULL, getter_AddRefs(backendData->mCbView));
device()->CreateShaderResourceView(backendData->mCrTexture, NULL, getter_AddRefs(backendData->mCrView));
device()->CreateShaderResourceView(backendData->mYTexture, nullptr, getter_AddRefs(backendData->mYView));
device()->CreateShaderResourceView(backendData->mCbTexture, nullptr, getter_AddRefs(backendData->mCbView));
device()->CreateShaderResourceView(backendData->mCrTexture, nullptr, getter_AddRefs(backendData->mCrView));
aImage->SetBackendData(mozilla::layers::LAYERS_D3D10, backendData.forget());
}
@ -454,7 +454,7 @@ RemoteDXGITextureImage::GetAsSurface()
desc.Usage = D3D10_USAGE_STAGING;
nsRefPtr<ID3D10Texture2D> softTexture;
HRESULT hr = device->CreateTexture2D(&desc, NULL, getter_AddRefs(softTexture));
HRESULT hr = device->CreateTexture2D(&desc, nullptr, getter_AddRefs(softTexture));
if (FAILED(hr)) {
NS_WARNING("Failed to create 2D staging texture.");
@ -514,7 +514,7 @@ RemoteDXGITextureImage::GetD3D10TextureBackendData(ID3D10Device *aDevice)
data->mTexture = texture;
aDevice->CreateShaderResourceView(texture, NULL, getter_AddRefs(data->mSRView));
aDevice->CreateShaderResourceView(texture, nullptr, getter_AddRefs(data->mSRView));
SetBackendData(mozilla::layers::LAYERS_D3D10, data);

Просмотреть файл

@ -19,7 +19,7 @@ class ImageLayerD3D10 : public ImageLayer,
{
public:
ImageLayerD3D10(LayerManagerD3D10 *aManager)
: ImageLayer(aManager, NULL)
: ImageLayer(aManager, nullptr)
, LayerD3D10(aManager)
{
mImplData = static_cast<LayerD3D10*>(this);
@ -56,7 +56,7 @@ struct TextureD3D10BackendData : public ImageBackendData
class RemoteDXGITextureImage : public Image {
public:
RemoteDXGITextureImage() : Image(NULL, REMOTE_IMAGE_DXGI_TEXTURE) {}
RemoteDXGITextureImage() : Image(nullptr, REMOTE_IMAGE_DXGI_TEXTURE) {}
already_AddRefed<gfxASurface> GetAsSurface();

Просмотреть файл

@ -89,7 +89,7 @@ LayerManagerD3D10::~LayerManagerD3D10()
mDevice->GetPrivateData(sDeviceAttachments, &size, &attachments);
// No LayerManagers left for this device. Clear out interfaces stored which
// hold a reference to the device.
mDevice->SetPrivateData(sDeviceAttachments, 0, NULL);
mDevice->SetPrivateData(sDeviceAttachments, 0, nullptr);
delete attachments;
}
@ -136,7 +136,7 @@ LayerManagerD3D10::Initialize(bool force, HRESULT* aHresultPtr)
* Do some post device creation setup
*/
if (mNv3DVUtils) {
IUnknown* devUnknown = NULL;
IUnknown* devUnknown = nullptr;
if (mDevice) {
mDevice->QueryInterface(IID_IUnknown, (void **)&devUnknown);
}
@ -168,7 +168,7 @@ LayerManagerD3D10::Initialize(bool force, HRESULT* aHresultPtr)
sizeof(g_main),
D3D10_EFFECT_SINGLE_THREADED,
mDevice,
NULL,
nullptr,
getter_AddRefs(mEffect));
if (FAILED(hr)) {
@ -463,7 +463,7 @@ LayerManagerD3D10::CreateOptimalSurface(const gfxIntSize &aSize,
desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
desc.MiscFlags = D3D10_RESOURCE_MISC_GDI_COMPATIBLE;
HRESULT hr = device()->CreateTexture2D(&desc, NULL, getter_AddRefs(texture));
HRESULT hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(texture));
if (FAILED(hr)) {
NS_WARNING("Failed to create new texture for CreateOptimalSurface!");
@ -508,7 +508,7 @@ LayerManagerD3D10::CreateDrawTarget(const IntSize &aSize,
CD3D10_TEXTURE2D_DESC desc(DXGI_FORMAT_B8G8R8A8_UNORM, aSize.width, aSize.height, 1, 1);
desc.BindFlags = D3D10_BIND_RENDER_TARGET | D3D10_BIND_SHADER_RESOURCE;
HRESULT hr = device()->CreateTexture2D(&desc, NULL, getter_AddRefs(texture));
HRESULT hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(texture));
if (FAILED(hr)) {
NS_WARNING("Failed to create new texture for CreateOptimalSurface!");
@ -599,7 +599,7 @@ LayerManagerD3D10::SetupPipeline()
}
ID3D10RenderTargetView *view = mRTView;
mDevice->OMSetRenderTargets(1, &view, NULL);
mDevice->OMSetRenderTargets(1, &view, nullptr);
SetupInputAssembler();
@ -620,7 +620,7 @@ LayerManagerD3D10::UpdateRenderTarget()
if (FAILED(hr)) {
return;
}
mDevice->CreateRenderTargetView(backBuf, NULL, getter_AddRefs(mRTView));
mDevice->CreateRenderTargetView(backBuf, nullptr, getter_AddRefs(mRTView));
}
void
@ -753,7 +753,7 @@ LayerManagerD3D10::PaintToTarget()
nsRefPtr<ID3D10Texture2D> readTexture;
HRESULT hr = device()->CreateTexture2D(&softDesc, NULL, getter_AddRefs(readTexture));
HRESULT hr = device()->CreateTexture2D(&softDesc, nullptr, getter_AddRefs(readTexture));
if (FAILED(hr)) {
ReportFailure(NS_LITERAL_CSTRING("LayerManagerD3D10::PaintToTarget(): Failed to create texture"),
hr);

Просмотреть файл

@ -178,7 +178,7 @@ private:
nsAutoPtr<Nv3DVUtils> mNv3DVUtils;
/*
* Context target, NULL when drawing directly to our swap chain.
* Context target, nullptr when drawing directly to our swap chain.
*/
nsRefPtr<gfxContext> mTarget;

Просмотреть файл

@ -18,7 +18,7 @@ class ReadbackLayerD3D10 :
{
public:
ReadbackLayerD3D10(LayerManagerD3D10 *aManager)
: ReadbackLayer(aManager, NULL),
: ReadbackLayer(aManager, nullptr),
LayerD3D10(aManager)
{
mImplData = static_cast<LayerD3D10*>(this);

Просмотреть файл

@ -108,9 +108,9 @@ ReadbackManagerD3D10::ReadbackManagerD3D10()
: mRefCnt(0)
{
::InitializeCriticalSection(&mTaskMutex);
mShutdownEvent = ::CreateEventA(NULL, FALSE, FALSE, NULL);
mTaskSemaphore = ::CreateSemaphoreA(NULL, 0, 1000000, NULL);
mTaskThread = ::CreateThread(NULL, 0, StartTaskThread, this, 0, 0);
mShutdownEvent = ::CreateEventA(nullptr, FALSE, FALSE, nullptr);
mTaskSemaphore = ::CreateSemaphoreA(nullptr, 0, 1000000, nullptr);
mTaskThread = ::CreateThread(nullptr, 0, StartTaskThread, this, 0, 0);
}
ReadbackManagerD3D10::~ReadbackManagerD3D10()
@ -144,7 +144,7 @@ ReadbackManagerD3D10::PostTask(ID3D10Texture2D *aTexture, void *aUpdate, const g
mPendingReadbackTasks.AppendElement(task);
::LeaveCriticalSection(&mTaskMutex);
::ReleaseSemaphore(mTaskSemaphore, 1, NULL);
::ReleaseSemaphore(mTaskSemaphore, 1, nullptr);
}
HRESULT

Просмотреть файл

@ -32,7 +32,7 @@ namespace mozilla {
namespace layers {
ThebesLayerD3D10::ThebesLayerD3D10(LayerManagerD3D10 *aManager)
: ThebesLayer(aManager, NULL)
: ThebesLayer(aManager, nullptr)
, LayerD3D10(aManager)
, mCurrentSurfaceMode(SURFACE_OPAQUE)
{
@ -250,7 +250,7 @@ ThebesLayerD3D10::Validate(ReadbackProcessor *aReadback)
D3D10_CPU_ACCESS_READ);
nsRefPtr<ID3D10Texture2D> readbackTexture;
HRESULT hr = device()->CreateTexture2D(&desc, NULL, getter_AddRefs(readbackTexture));
HRESULT hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(readbackTexture));
if (FAILED(hr)) {
LayerManagerD3D10::ReportFailure(NS_LITERAL_CSTRING("ThebesLayerD3D10::Validate(): Failed to create texture"),
hr);
@ -333,12 +333,12 @@ ThebesLayerD3D10::FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsInt
// and probably not worth the win here as this will often be a single
// rect.
nsRefPtr<ID3D10RenderTargetView> oldRT;
device()->OMGetRenderTargets(1, getter_AddRefs(oldRT), NULL);
device()->OMGetRenderTargets(1, getter_AddRefs(oldRT), nullptr);
nsRefPtr<ID3D10RenderTargetView> viewBlack;
nsRefPtr<ID3D10RenderTargetView> viewWhite;
device()->CreateRenderTargetView(mTexture, NULL, getter_AddRefs(viewBlack));
device()->CreateRenderTargetView(mTextureOnWhite, NULL, getter_AddRefs(viewWhite));
device()->CreateRenderTargetView(mTexture, nullptr, getter_AddRefs(viewBlack));
device()->CreateRenderTargetView(mTextureOnWhite, nullptr, getter_AddRefs(viewWhite));
D3D10_RECT oldScissor;
UINT numRects = 1;
@ -356,7 +356,7 @@ ThebesLayerD3D10::FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsInt
mD3DManager->SetViewport(nsIntSize(desc.Width, desc.Height));
ID3D10RenderTargetView *views[2] = { viewBlack, viewWhite };
device()->OMSetRenderTargets(2, views, NULL);
device()->OMSetRenderTargets(2, views, nullptr);
gfx3DMatrix transform;
transform.Translate(gfxPoint3D(-aOffset.x, -aOffset.y, 0));
@ -383,7 +383,7 @@ ThebesLayerD3D10::FillTexturesBlackWhite(const nsIntRegion& aRegion, const nsInt
}
views[0] = oldRT;
device()->OMSetRenderTargets(1, views, NULL);
device()->OMSetRenderTargets(1, views, nullptr);
mD3DManager->SetViewport(oldVP);
device()->RSSetScissorRects(1, &oldScissor);
}
@ -464,14 +464,14 @@ ThebesLayerD3D10::CreateNewTextures(const gfxIntSize &aSize, SurfaceMode aMode)
HRESULT hr;
if (!mTexture) {
hr = device()->CreateTexture2D(&desc, NULL, getter_AddRefs(mTexture));
hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(mTexture));
if (FAILED(hr)) {
NS_WARNING("Failed to create new texture for ThebesLayerD3D10!");
return;
}
hr = device()->CreateShaderResourceView(mTexture, NULL, getter_AddRefs(mSRView));
hr = device()->CreateShaderResourceView(mTexture, nullptr, getter_AddRefs(mSRView));
if (FAILED(hr)) {
NS_WARNING("Failed to create shader resource view for ThebesLayerD3D10.");
@ -483,7 +483,7 @@ ThebesLayerD3D10::CreateNewTextures(const gfxIntSize &aSize, SurfaceMode aMode)
if (!mD2DSurface || mD2DSurface->CairoStatus()) {
NS_WARNING("Failed to create surface for ThebesLayerD3D10.");
mD2DSurface = NULL;
mD2DSurface = nullptr;
return;
}
} else {
@ -492,14 +492,14 @@ ThebesLayerD3D10::CreateNewTextures(const gfxIntSize &aSize, SurfaceMode aMode)
}
if (aMode == SURFACE_COMPONENT_ALPHA && !mTextureOnWhite) {
hr = device()->CreateTexture2D(&desc, NULL, getter_AddRefs(mTextureOnWhite));
hr = device()->CreateTexture2D(&desc, nullptr, getter_AddRefs(mTextureOnWhite));
if (FAILED(hr)) {
NS_WARNING("Failed to create new texture for ThebesLayerD3D10!");
return;
}
hr = device()->CreateShaderResourceView(mTextureOnWhite, NULL, getter_AddRefs(mSRViewOnWhite));
hr = device()->CreateShaderResourceView(mTextureOnWhite, nullptr, getter_AddRefs(mSRViewOnWhite));
if (FAILED(hr)) {
NS_WARNING("Failed to create shader resource view for ThebesLayerD3D10.");

Просмотреть файл

@ -80,7 +80,7 @@ CompositorD3D11::~CompositorD3D11()
mDevice->GetPrivateData(sDeviceAttachmentsD3D11, &size, &attachments);
// No LayerManagers left for this device. Clear out interfaces stored which
// hold a reference to the device.
mDevice->SetPrivateData(sDeviceAttachmentsD3D11, 0, NULL);
mDevice->SetPrivateData(sDeviceAttachmentsD3D11, 0, nullptr);
delete attachments;
}
@ -338,7 +338,7 @@ CompositorD3D11::CreateRenderTarget(const gfx::IntRect &aRect,
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET);
RefPtr<ID3D11Texture2D> texture;
mDevice->CreateTexture2D(&desc, NULL, byRef(texture));
mDevice->CreateTexture2D(&desc, nullptr, byRef(texture));
RefPtr<CompositingRenderTargetD3D11> rt = new CompositingRenderTargetD3D11(texture);
rt->SetSize(IntSize(aRect.width, aRect.height));
@ -360,7 +360,7 @@ CompositorD3D11::CreateRenderTargetFromSource(const gfx::IntRect &aRect,
D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET);
RefPtr<ID3D11Texture2D> texture;
mDevice->CreateTexture2D(&desc, NULL, byRef(texture));
mDevice->CreateTexture2D(&desc, nullptr, byRef(texture));
RefPtr<CompositingRenderTargetD3D11> rt = new CompositingRenderTargetD3D11(texture);
rt->SetSize(IntSize(aRect.width, aRect.height));
@ -658,7 +658,7 @@ CompositorD3D11::UpdateRenderTarget()
}
mDefaultRT = new CompositingRenderTargetD3D11(nullptr);
mDevice->CreateRenderTargetView(backBuf, NULL, byRef(mDefaultRT->mRTView));
mDevice->CreateRenderTargetView(backBuf, nullptr, byRef(mDefaultRT->mRTView));
}
bool
@ -759,7 +759,7 @@ CompositorD3D11::PaintToTarget()
nsRefPtr<ID3D11Texture2D> readTexture;
HRESULT hr = mDevice->CreateTexture2D(&softDesc, NULL, getter_AddRefs(readTexture));
HRESULT hr = mDevice->CreateTexture2D(&softDesc, nullptr, getter_AddRefs(readTexture));
mContext->CopyResource(readTexture, backBuf);
D3D11_MAPPED_SUBRESOURCE map;

Просмотреть файл

@ -50,7 +50,7 @@ CompositingRenderTargetD3D11::CompositingRenderTargetD3D11(ID3D11Texture2D *aTex
RefPtr<ID3D11Device> device;
mTextures[0]->GetDevice(byRef(device));
HRESULT hr = device->CreateRenderTargetView(mTextures[0], NULL, byRef(mRTView));
HRESULT hr = device->CreateRenderTargetView(mTextures[0], nullptr, byRef(mRTView));
if (FAILED(hr)) {
LOGD3D11("Failed to create RenderTargetView.");
@ -249,7 +249,7 @@ DeprecatedTextureClientD3D11::ReleaseTexture()
void
DeprecatedTextureClientD3D11::ClearDT()
{
// An Azure DrawTarget needs to be locked when it gets NULL'ed as this is
// An Azure DrawTarget needs to be locked when it gets nullptr'ed as this is
// when it calls EndDraw. This EndDraw should not execute anything so it
// shouldn't -really- need the lock but the debug layer chokes on this.
//

Просмотреть файл

@ -242,13 +242,13 @@ CanvasLayerD3D9::CreateTexture()
if (mD3DManager->deviceManager()->HasDynamicTextures()) {
hr = device()->CreateTexture(mBounds.width, mBounds.height, 1, D3DUSAGE_DYNAMIC,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT,
getter_AddRefs(mTexture), NULL);
getter_AddRefs(mTexture), nullptr);
} else {
// D3DPOOL_MANAGED is fine here since we require Dynamic Textures for D3D9Ex
// devices.
hr = device()->CreateTexture(mBounds.width, mBounds.height, 1, 0,
D3DFMT_A8R8G8B8, D3DPOOL_MANAGED,
getter_AddRefs(mTexture), NULL);
getter_AddRefs(mTexture), nullptr);
}
if (FAILED(hr)) {
mD3DManager->ReportFailure(NS_LITERAL_CSTRING("CanvasLayerD3D9::CreateTexture() failed"),

Просмотреть файл

@ -20,7 +20,7 @@ class CanvasLayerD3D9 :
{
public:
CanvasLayerD3D9(LayerManagerD3D9 *aManager)
: CanvasLayer(aManager, NULL)
: CanvasLayer(aManager, nullptr)
, LayerD3D9(aManager)
, mDataIsPremultiplied(false)
, mNeedsYFlip(false)

Просмотреть файл

@ -16,7 +16,7 @@ class ColorLayerD3D9 : public ColorLayer,
{
public:
ColorLayerD3D9(LayerManagerD3D9 *aManager)
: ColorLayer(aManager, NULL)
: ColorLayer(aManager, nullptr)
, LayerD3D9(aManager)
{
mImplData = static_cast<LayerD3D9*>(this);

Просмотреть файл

@ -191,7 +191,7 @@ ContainerRender(Container* aContainer,
HRESULT hr = aManager->device()->CreateTexture(visibleRect.width, visibleRect.height, 1,
D3DUSAGE_RENDERTARGET, D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT, getter_AddRefs(renderTexture),
NULL);
nullptr);
if (FAILED(hr)) {
aManager->ReportFailure(NS_LITERAL_CSTRING("ContainerLayerD3D9::ContainerRender(): Failed to create texture"),
hr);
@ -324,7 +324,7 @@ ContainerRender(Container* aContainer,
ContainerLayerD3D9::ContainerLayerD3D9(LayerManagerD3D9 *aManager)
: ContainerLayer(aManager, NULL)
: ContainerLayer(aManager, nullptr)
, LayerD3D9(aManager)
{
mImplData = static_cast<LayerD3D9*>(this);

Просмотреть файл

@ -170,9 +170,9 @@ DeviceManagerD3D9::Init()
WNDCLASSW wc;
HRESULT hr;
if (!GetClassInfoW(GetModuleHandle(NULL), kClassName, &wc)) {
if (!GetClassInfoW(GetModuleHandle(nullptr), kClassName, &wc)) {
ZeroMemory(&wc, sizeof(WNDCLASSW));
wc.hInstance = GetModuleHandle(NULL);
wc.hInstance = GetModuleHandle(nullptr);
wc.lpfnWndProc = ::DefWindowProc;
wc.lpszClassName = kClassName;
if (!RegisterClassW(&wc)) {
@ -182,8 +182,8 @@ DeviceManagerD3D9::Init()
}
mFocusWnd = ::CreateWindowW(kClassName, L"D3D9Window", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL,
NULL, GetModuleHandle(NULL), NULL);
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, nullptr,
nullptr, GetModuleHandle(nullptr), nullptr);
if (!mFocusWnd) {
NS_WARNING("Failed to create DeviceManagerD3D9 Window.");
@ -262,7 +262,7 @@ DeviceManagerD3D9::Init()
D3DCREATE_MULTITHREADED |
D3DCREATE_MIXED_VERTEXPROCESSING,
&pp,
NULL,
nullptr,
getter_AddRefs(mDeviceEx));
if (SUCCEEDED(hr)) {
mDevice = mDeviceEx;
@ -313,7 +313,7 @@ DeviceManagerD3D9::Init()
* Do some post device creation setup
*/
if (mNv3DVUtils) {
IUnknown* devUnknown = NULL;
IUnknown* devUnknown = nullptr;
if (mDevice) {
mDevice->QueryInterface(IID_IUnknown, (void **)&devUnknown);
}
@ -786,7 +786,7 @@ DeviceManagerD3D9::CreateVertexBuffer()
0,
D3DPOOL_DEFAULT,
getter_AddRefs(mVB),
NULL);
nullptr);
if (FAILED(hr)) {
return false;

Просмотреть файл

@ -51,34 +51,34 @@ DataToTexture(IDirect3DDevice9 *aDevice,
if (FAILED(aDevice->
CreateTexture(aSize.width, aSize.height,
1, 0, aFormat, D3DPOOL_DEFAULT,
getter_AddRefs(texture), NULL)))
getter_AddRefs(texture), nullptr)))
{
return NULL;
return nullptr;
}
nsRefPtr<IDirect3DTexture9> tmpTexture;
if (FAILED(aDevice->
CreateTexture(aSize.width, aSize.height,
1, 0, aFormat, D3DPOOL_SYSTEMMEM,
getter_AddRefs(tmpTexture), NULL)))
getter_AddRefs(tmpTexture), nullptr)))
{
return NULL;
return nullptr;
}
tmpTexture->GetSurfaceLevel(0, getter_AddRefs(surface));
surface->LockRect(&lockedRect, NULL, 0);
surface->LockRect(&lockedRect, nullptr, 0);
NS_ASSERTION(lockedRect.pBits, "Could not lock surface");
} else {
if (FAILED(aDevice->
CreateTexture(aSize.width, aSize.height,
1, 0, aFormat, D3DPOOL_MANAGED,
getter_AddRefs(texture), NULL)))
getter_AddRefs(texture), nullptr)))
{
return NULL;
return nullptr;
}
/* lock the entire texture */
texture->LockRect(0, &lockedRect, NULL, 0);
texture->LockRect(0, &lockedRect, nullptr, 0);
}
uint32_t width = aSize.width;
@ -95,7 +95,7 @@ DataToTexture(IDirect3DDevice9 *aDevice,
surface->UnlockRect();
nsRefPtr<IDirect3DSurface9> dstSurface;
texture->GetSurfaceLevel(0, getter_AddRefs(dstSurface));
aDevice->UpdateSurface(surface, NULL, dstSurface, NULL);
aDevice->UpdateSurface(surface, nullptr, dstSurface, nullptr);
} else {
texture->UnlockRect(0);
}
@ -185,31 +185,31 @@ static void AllocateTexturesYCbCr(PlanarYCbCrImage *aImage,
HRESULT hr;
hr = aDevice->CreateTexture(data->mYSize.width, data->mYSize.height,
1, 0, D3DFMT_L8, D3DPOOL_DEFAULT,
getter_AddRefs(backendData->mYTexture), NULL);
getter_AddRefs(backendData->mYTexture), nullptr);
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_DEFAULT,
getter_AddRefs(backendData->mCbTexture), NULL);
getter_AddRefs(backendData->mCbTexture), nullptr);
}
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_DEFAULT,
getter_AddRefs(backendData->mCrTexture), NULL);
getter_AddRefs(backendData->mCrTexture), nullptr);
}
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mYSize.width, data->mYSize.height,
1, 0, D3DFMT_L8, D3DPOOL_SYSTEMMEM,
getter_AddRefs(tmpYTexture), NULL);
getter_AddRefs(tmpYTexture), nullptr);
}
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_SYSTEMMEM,
getter_AddRefs(tmpCbTexture), NULL);
getter_AddRefs(tmpCbTexture), nullptr);
}
if (!FAILED(hr)) {
hr = aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_SYSTEMMEM,
getter_AddRefs(tmpCrTexture), NULL);
getter_AddRefs(tmpCrTexture), nullptr);
}
if (FAILED(hr)) {
@ -221,23 +221,23 @@ static void AllocateTexturesYCbCr(PlanarYCbCrImage *aImage,
tmpYTexture->GetSurfaceLevel(0, getter_AddRefs(tmpSurfaceY));
tmpCbTexture->GetSurfaceLevel(0, getter_AddRefs(tmpSurfaceCb));
tmpCrTexture->GetSurfaceLevel(0, getter_AddRefs(tmpSurfaceCr));
tmpSurfaceY->LockRect(&lockrectY, NULL, 0);
tmpSurfaceCb->LockRect(&lockrectCb, NULL, 0);
tmpSurfaceCr->LockRect(&lockrectCr, NULL, 0);
tmpSurfaceY->LockRect(&lockrectY, nullptr, 0);
tmpSurfaceCb->LockRect(&lockrectCb, nullptr, 0);
tmpSurfaceCr->LockRect(&lockrectCr, nullptr, 0);
} else {
HRESULT hr;
hr = aDevice->CreateTexture(data->mYSize.width, data->mYSize.height,
1, 0, D3DFMT_L8, D3DPOOL_MANAGED,
getter_AddRefs(backendData->mYTexture), NULL);
getter_AddRefs(backendData->mYTexture), nullptr);
if (!FAILED(hr)) {
aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_MANAGED,
getter_AddRefs(backendData->mCbTexture), NULL);
getter_AddRefs(backendData->mCbTexture), nullptr);
}
if (!FAILED(hr)) {
aDevice->CreateTexture(data->mCbCrSize.width, data->mCbCrSize.height,
1, 0, D3DFMT_L8, D3DPOOL_MANAGED,
getter_AddRefs(backendData->mCrTexture), NULL);
getter_AddRefs(backendData->mCrTexture), nullptr);
}
if (FAILED(hr)) {
@ -247,9 +247,9 @@ static void AllocateTexturesYCbCr(PlanarYCbCrImage *aImage,
}
/* lock the entire texture */
backendData->mYTexture->LockRect(0, &lockrectY, NULL, 0);
backendData->mCbTexture->LockRect(0, &lockrectCb, NULL, 0);
backendData->mCrTexture->LockRect(0, &lockrectCr, NULL, 0);
backendData->mYTexture->LockRect(0, &lockrectY, nullptr, 0);
backendData->mCbTexture->LockRect(0, &lockrectCb, nullptr, 0);
backendData->mCrTexture->LockRect(0, &lockrectCr, nullptr, 0);
}
src = data->mYChannel;
@ -291,11 +291,11 @@ static void AllocateTexturesYCbCr(PlanarYCbCrImage *aImage,
tmpSurfaceCr->UnlockRect();
nsRefPtr<IDirect3DSurface9> dstSurface;
backendData->mYTexture->GetSurfaceLevel(0, getter_AddRefs(dstSurface));
aDevice->UpdateSurface(tmpSurfaceY, NULL, dstSurface, NULL);
aDevice->UpdateSurface(tmpSurfaceY, nullptr, dstSurface, nullptr);
backendData->mCbTexture->GetSurfaceLevel(0, getter_AddRefs(dstSurface));
aDevice->UpdateSurface(tmpSurfaceCb, NULL, dstSurface, NULL);
aDevice->UpdateSurface(tmpSurfaceCb, nullptr, dstSurface, nullptr);
backendData->mCrTexture->GetSurfaceLevel(0, getter_AddRefs(dstSurface));
aDevice->UpdateSurface(tmpSurfaceCr, NULL, dstSurface, NULL);
aDevice->UpdateSurface(tmpSurfaceCr, nullptr, dstSurface, nullptr);
} else {
backendData->mYTexture->UnlockRect(0);
backendData->mCbTexture->UnlockRect(0);

Просмотреть файл

@ -19,7 +19,7 @@ class ImageLayerD3D9 : public ImageLayer,
{
public:
ImageLayerD3D9(LayerManagerD3D9 *aManager)
: ImageLayer(aManager, NULL)
: ImageLayer(aManager, nullptr)
, LayerD3D9(aManager)
{
mImplData = static_cast<LayerD3D9*>(this);

Просмотреть файл

@ -28,8 +28,8 @@ LayerManagerD3D9::LayerManagerD3D9(nsIWidget *aWidget)
: mWidget(aWidget)
, mDeviceResetCount(0)
{
mCurrentCallbackInfo.Callback = NULL;
mCurrentCallbackInfo.CallbackData = NULL;
mCurrentCallbackInfo.Callback = nullptr;
mCurrentCallbackInfo.CallbackData = nullptr;
}
LayerManagerD3D9::~LayerManagerD3D9()
@ -163,12 +163,12 @@ LayerManagerD3D9::EndTransaction(DrawThebesLayerCallback aCallback,
SetCompositingDisabled(aFlags & END_NO_COMPOSITE);
Render();
/* Clean this out for sanity */
mCurrentCallbackInfo.Callback = NULL;
mCurrentCallbackInfo.CallbackData = NULL;
mCurrentCallbackInfo.Callback = nullptr;
mCurrentCallbackInfo.CallbackData = nullptr;
}
// Clear mTarget, next transaction could have no target
mTarget = NULL;
mTarget = nullptr;
}
void
@ -255,7 +255,7 @@ LayerManagerD3D9::Render()
nsIntRect rect;
mWidget->GetClientBounds(rect);
device()->Clear(0, NULL, D3DCLEAR_TARGET, 0x00000000, 0, 0);
device()->Clear(0, nullptr, D3DCLEAR_TARGET, 0x00000000, 0, 0);
device()->BeginScene();
@ -341,12 +341,12 @@ LayerManagerD3D9::PaintToTarget()
device()->CreateOffscreenPlainSurface(desc.Width, desc.Height,
D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM,
getter_AddRefs(destSurf), NULL);
getter_AddRefs(destSurf), nullptr);
device()->GetRenderTargetData(backBuff, destSurf);
D3DLOCKED_RECT rect;
destSurf->LockRect(&rect, NULL, D3DLOCK_READONLY);
destSurf->LockRect(&rect, nullptr, D3DLOCK_READONLY);
nsRefPtr<gfxImageSurface> imageSurface =
new gfxImageSurface((unsigned char*)rect.pBits,

Просмотреть файл

@ -152,7 +152,7 @@ public:
/**
* Return pointer to the Nv3DVUtils instance. Re-direct to mDeviceManager.
*/
Nv3DVUtils *GetNv3DVUtils() { return mDeviceManager ? mDeviceManager->GetNv3DVUtils() : NULL; }
Nv3DVUtils *GetNv3DVUtils() { return mDeviceManager ? mDeviceManager->GetNv3DVUtils() : nullptr; }
static void OnDeviceManagerDestroy(DeviceManagerD3D9 *aDeviceManager) {
if(aDeviceManager == mDefaultDeviceManager)
@ -182,7 +182,7 @@ private:
nsIWidget *mWidget;
/*
* Context target, NULL when drawing directly to our swap chain.
* Context target, nullptr when drawing directly to our swap chain.
*/
nsRefPtr<gfxContext> mTarget;
@ -298,7 +298,7 @@ public:
LockTextureRectD3D9(IDirect3DTexture9* aTexture)
: mTexture(aTexture)
{
mLockResult = mTexture->LockRect(0, &mR, NULL, 0);
mLockResult = mTexture->LockRect(0, &mR, nullptr, 0);
}
~LockTextureRectD3D9()

Просмотреть файл

@ -23,7 +23,7 @@ namespace layers {
* Constructor and Destructor
*/
Nv3DVUtils::Nv3DVUtils()
: m3DVStreaming (NULL)
: m3DVStreaming (nullptr)
{
}
@ -60,14 +60,14 @@ Nv3DVUtils::Initialize()
/*
* Create the COM object. If we fail at any stage, just return
*/
HRESULT hr = CoCreateInstance(CLSID_NV3DVStreaming, NULL, CLSCTX_INPROC_SERVER, IID_INV3DVStreaming, (void**)(getter_AddRefs(m3DVStreaming)));
HRESULT hr = CoCreateInstance(CLSID_NV3DVStreaming, nullptr, CLSCTX_INPROC_SERVER, IID_INV3DVStreaming, (void**)(getter_AddRefs(m3DVStreaming)));
if (FAILED(hr) || !m3DVStreaming) {
WARNING("Nv3DVStreaming CoCreateInstance failed (disabled).");
return;
}
/*
* Initialize the object. Note that m3DVStreaming cannot be NULL at this point.
* Initialize the object. Note that m3DVStreaming cannot be nullptr at this point.
*/
bool bRetVal = m3DVStreaming->Nv3DVInitialize();
@ -79,7 +79,7 @@ Nv3DVUtils::Initialize()
/**
* Release resources used by the COM Object, and then release
* the COM Object (nsRefPtr gets released by setting to NULL)
* the COM Object (nsRefPtr gets released by setting to nullptr)
*
*/
void
@ -98,7 +98,7 @@ void
Nv3DVUtils::SetDeviceInfo(IUnknown *devUnknown)
{
if (!devUnknown) {
WARNING("D3D Device Pointer (IUnknown) is NULL.\n");
WARNING("D3D Device Pointer (IUnknown) is nullptr.\n");
return;
}

Просмотреть файл

@ -18,7 +18,7 @@ class ReadbackLayerD3D9 :
{
public:
ReadbackLayerD3D9(LayerManagerD3D9 *aManager)
: ReadbackLayer(aManager, NULL),
: ReadbackLayer(aManager, nullptr),
LayerD3D9(aManager)
{
mImplData = static_cast<LayerD3D9*>(this);

Просмотреть файл

@ -24,7 +24,7 @@ namespace mozilla {
namespace layers {
ThebesLayerD3D9::ThebesLayerD3D9(LayerManagerD3D9 *aManager)
: ThebesLayer(aManager, NULL)
: ThebesLayer(aManager, nullptr)
, LayerD3D9(aManager)
{
mImplData = static_cast<LayerD3D9*>(this);
@ -261,7 +261,7 @@ ThebesLayerD3D9::RenderThebesLayer(ReadbackProcessor* aReadback)
// Restore defaults
device()->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
device()->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
device()->SetTexture(1, NULL);
device()->SetTexture(1, nullptr);
} else {
mD3DManager->SetShaderMode(DeviceManagerD3D9::RGBALAYER,
GetMaskLayer());
@ -340,7 +340,7 @@ ThebesLayerD3D9::VerifyContentType(SurfaceMode aMode)
class OpaqueRenderer {
public:
OpaqueRenderer(const nsIntRegion& aUpdateRegion) :
mUpdateRegion(aUpdateRegion), mDC(NULL) {}
mUpdateRegion(aUpdateRegion), mDC(nullptr) {}
~OpaqueRenderer() { End(); }
already_AddRefed<gfxWindowsSurface> Begin(LayerD3D9* aLayer);
void End();
@ -360,7 +360,7 @@ OpaqueRenderer::Begin(LayerD3D9* aLayer)
HRESULT hr = aLayer->device()->
CreateTexture(bounds.width, bounds.height, 1, 0, D3DFMT_X8R8G8B8,
D3DPOOL_SYSTEMMEM, getter_AddRefs(mTmpTexture), NULL);
D3DPOOL_SYSTEMMEM, getter_AddRefs(mTmpTexture), nullptr);
if (FAILED(hr)) {
aLayer->ReportFailure(NS_LITERAL_CSTRING("Failed to create temporary texture in system memory."), hr);
@ -390,8 +390,8 @@ OpaqueRenderer::End()
{
if (mSurface && mDC) {
mSurface->ReleaseDC(mDC);
mSurface = NULL;
mDC = NULL;
mSurface = nullptr;
mDC = nullptr;
}
}
@ -428,7 +428,7 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode,
case SURFACE_SINGLE_CHANNEL_ALPHA: {
hr = device()->CreateTexture(bounds.width, bounds.height, 1,
0, D3DFMT_A8R8G8B8,
D3DPOOL_SYSTEMMEM, getter_AddRefs(tmpTexture), NULL);
D3DPOOL_SYSTEMMEM, getter_AddRefs(tmpTexture), nullptr);
if (FAILED(hr)) {
ReportFailure(NS_LITERAL_CSTRING("Failed to create temporary texture in system memory."), hr);
@ -521,7 +521,7 @@ ThebesLayerD3D9::DrawRegion(nsIntRegion &aRegion, SurfaceMode aMode,
context->Paint();
}
imgSurface = NULL;
imgSurface = nullptr;
srcTextures.AppendElement(tmpTexture);
destTextures.AppendElement(mTexture);
@ -579,7 +579,7 @@ ThebesLayerD3D9::CreateNewTextures(const gfxIntSize &aSize,
HRESULT hr = device()->CreateTexture(aSize.width, aSize.height, 1,
D3DUSAGE_RENDERTARGET,
aMode != SURFACE_SINGLE_CHANNEL_ALPHA ? D3DFMT_X8R8G8B8 : D3DFMT_A8R8G8B8,
D3DPOOL_DEFAULT, getter_AddRefs(mTexture), NULL);
D3DPOOL_DEFAULT, getter_AddRefs(mTexture), nullptr);
if (FAILED(hr)) {
ReportFailure(NS_LITERAL_CSTRING("ThebesLayerD3D9::CreateNewTextures(): Failed to create texture"),
hr);
@ -590,7 +590,7 @@ ThebesLayerD3D9::CreateNewTextures(const gfxIntSize &aSize,
hr = device()->CreateTexture(aSize.width, aSize.height, 1,
D3DUSAGE_RENDERTARGET,
D3DFMT_X8R8G8B8,
D3DPOOL_DEFAULT, getter_AddRefs(mTextureOnWhite), NULL);
D3DPOOL_DEFAULT, getter_AddRefs(mTextureOnWhite), nullptr);
if (FAILED(hr)) {
ReportFailure(NS_LITERAL_CSTRING("ThebesLayerD3D9::CreateNewTextures(): Failed to create texture (2)"),
hr);

Просмотреть файл

@ -31,7 +31,7 @@ void
CompositorChild::Destroy()
{
mLayerManager->Destroy();
mLayerManager = NULL;
mLayerManager = nullptr;
while (size_t len = ManagedPLayerTransactionChild().Length()) {
LayerTransactionChild* layers =
static_cast<LayerTransactionChild*>(ManagedPLayerTransactionChild()[len - 1]);
@ -94,7 +94,7 @@ CompositorChild::ActorDestroy(ActorDestroyReason aWhy)
NS_RUNTIMEABORT("ActorDestroy by IPC channel failure at CompositorChild");
}
sCompositor = NULL;
sCompositor = nullptr;
// We don't want to release the ref to sCompositor here, during
// cleanup, because that will cause it to be deleted while it's
// still being used. So defer the deletion to after it's not in

Просмотреть файл

@ -132,7 +132,7 @@ CompositorParent::CompositorParent(nsIWidget* aWidget,
bool aUseExternalSurfaceSize,
int aSurfaceWidth, int aSurfaceHeight)
: mWidget(aWidget)
, mCurrentCompositeTask(NULL)
, mCurrentCompositeTask(nullptr)
, mIsTesting(false)
, mPaused(false)
, mUseExternalSurfaceSize(aUseExternalSurfaceSize)
@ -527,7 +527,7 @@ CompositorParent::ShadowLayersUpdated(LayerTransactionParent* aLayerTree,
if (!isFirstPaint &&
!mCompositionManager->IsFirstPaint() &&
mCompositionManager->RequiresReorientation(aTargetConfig.orientation())) {
if (mForceCompositionTask != NULL) {
if (mForceCompositionTask != nullptr) {
mForceCompositionTask->Cancel();
}
mForceCompositionTask = NewRunnableMethod(this, &CompositorParent::ForceComposition);

Просмотреть файл

@ -29,7 +29,8 @@ using mozilla::ScreenRotation;
using nsCSSProperty;
using mozilla::dom::ScreenOrientation;
using mozilla::layers::TextureInfo;
using mozilla::gfx::Margin;
using mozilla::LayerMargin;
using mozilla::LayerPoint;
using mozilla::layers::ImageLayer::ScaleMode;
namespace mozilla {
@ -186,8 +187,8 @@ struct CommonLayerAttributes {
bool useClipRect;
nsIntRect clipRect;
bool isFixedPosition;
gfxPoint fixedPositionAnchor;
Margin fixedPositionMargin;
LayerPoint fixedPositionAnchor;
LayerMargin fixedPositionMargin;
nullable PLayer maskLayer;
// Animated colors will only honored for ColorLayers.
Animation[] animations;

Просмотреть файл

@ -185,7 +185,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
EditReplyVector replyv;
layer_manager()->BeginTransactionWithTarget(NULL);
layer_manager()->BeginTransactionWithTarget(nullptr);
for (EditArray::index_type i = 0; i < cset.Length(); ++i) {
const Edit& edit = cset[i];
@ -251,7 +251,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
layer->SetVisibleRegion(common.visibleRegion());
layer->SetContentFlags(common.contentFlags());
layer->SetOpacity(common.opacity());
layer->SetClipRect(common.useClipRect() ? &common.clipRect() : NULL);
layer->SetClipRect(common.useClipRect() ? &common.clipRect() : nullptr);
layer->SetBaseTransform(common.transform().value());
layer->SetPostScale(common.postXScale(), common.postYScale());
layer->SetIsFixedPosition(common.isFixedPosition());
@ -260,7 +260,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
if (PLayerParent* maskLayer = common.maskLayerParent()) {
layer->SetMaskLayer(cast(maskLayer)->AsLayer());
} else {
layer->SetMaskLayer(NULL);
layer->SetMaskLayer(nullptr);
}
layer->SetAnimations(common.animations());
@ -361,7 +361,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
const OpAppendChild& oac = edit.get_OpAppendChild();
ShadowContainer(oac)->AsContainer()->InsertAfter(
ShadowChild(oac)->AsLayer(), NULL);
ShadowChild(oac)->AsLayer(), nullptr);
break;
}
case Edit::TOpRemoveChild: {
@ -385,7 +385,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
const OpRaiseToTopChild& rtc = edit.get_OpRaiseToTopChild();
ShadowContainer(rtc)->AsContainer()->RepositionChild(
ShadowChild(rtc)->AsLayer(), NULL);
ShadowChild(rtc)->AsLayer(), nullptr);
break;
}
case Edit::TCompositableOperation: {
@ -411,7 +411,7 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
}
}
layer_manager()->EndTransaction(NULL, NULL, LayerManager::END_NO_IMMEDIATE_REDRAW);
layer_manager()->EndTransaction(nullptr, nullptr, LayerManager::END_NO_IMMEDIATE_REDRAW);
if (reply) {
reply->SetCapacity(replyv.size());

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше