mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Merge from mozilla-central.
--HG-- rename : content/svg/content/src/nsSVGFilters.cpp => content/svg/content/src/SVGFEMorphologyElement.cpp rename : content/svg/content/src/nsSVGFilters.cpp => content/svg/content/src/SVGFEMorphologyElement.h rename : content/svg/content/src/nsSVGFilters.cpp => content/svg/content/src/SVGFETurbulenceElement.cpp rename : content/svg/content/src/nsSVGFilters.cpp => content/svg/content/src/SVGFETurbulenceElement.h rename : xpcom/stub/dependentlibs.py => toolkit/library/dependentlibs.py rename : xpcom/stub/nsXPComStub.cpp => xpcom/build/FrozenFunctions.cpp
This commit is contained in:
commit
8793f84ed3
2
.gdbinit
2
.gdbinit
@ -88,7 +88,7 @@ def pa
|
||||
end
|
||||
|
||||
# define a "pxul" command to display the type of a XUL element from
|
||||
# an nsXULDocument* pointer.
|
||||
# an nsXULElement* pointer.
|
||||
def pxul
|
||||
set $p = $arg0
|
||||
print $p->mNodeInfo.mRawPtr->mInner.mName->mStaticAtom->mString
|
||||
|
@ -85,6 +85,7 @@ LOCAL_INCLUDES += \
|
||||
-I$(srcdir)/../../../layout/style \
|
||||
-I$(srcdir)/../../../layout/svg \
|
||||
-I$(srcdir)/../../../layout/xul/base/src \
|
||||
-I$(srcdir)/../../../layout/xul/tree/ \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
|
||||
|
@ -136,15 +136,14 @@ nsAccUtils::SetLiveContainerAttributes(nsIPersistentProperties *aAttributes,
|
||||
|
||||
// container-relevant attribute
|
||||
if (relevant.IsEmpty() &&
|
||||
nsAccUtils::HasDefinedARIAToken(ancestor, nsGkAtoms::aria_relevant) &&
|
||||
HasDefinedARIAToken(ancestor, nsGkAtoms::aria_relevant) &&
|
||||
ancestor->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_relevant, relevant))
|
||||
SetAccAttr(aAttributes, nsGkAtoms::containerRelevant, relevant);
|
||||
|
||||
// container-live, and container-live-role attributes
|
||||
if (live.IsEmpty()) {
|
||||
nsRoleMapEntry* role = aria::GetRoleMap(ancestor);
|
||||
if (nsAccUtils::HasDefinedARIAToken(ancestor,
|
||||
nsGkAtoms::aria_live)) {
|
||||
if (HasDefinedARIAToken(ancestor, nsGkAtoms::aria_live)) {
|
||||
ancestor->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_live,
|
||||
live);
|
||||
} else if (role) {
|
||||
@ -153,21 +152,21 @@ nsAccUtils::SetLiveContainerAttributes(nsIPersistentProperties *aAttributes,
|
||||
if (!live.IsEmpty()) {
|
||||
SetAccAttr(aAttributes, nsGkAtoms::containerLive, live);
|
||||
if (role) {
|
||||
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::containerLiveRole,
|
||||
role->ARIARoleString());
|
||||
SetAccAttr(aAttributes, nsGkAtoms::containerLiveRole,
|
||||
role->ARIARoleString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// container-atomic attribute
|
||||
if (atomic.IsEmpty() &&
|
||||
nsAccUtils::HasDefinedARIAToken(ancestor, nsGkAtoms::aria_atomic) &&
|
||||
HasDefinedARIAToken(ancestor, nsGkAtoms::aria_atomic) &&
|
||||
ancestor->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_atomic, atomic))
|
||||
SetAccAttr(aAttributes, nsGkAtoms::containerAtomic, atomic);
|
||||
|
||||
// container-busy attribute
|
||||
if (busy.IsEmpty() &&
|
||||
nsAccUtils::HasDefinedARIAToken(ancestor, nsGkAtoms::aria_busy) &&
|
||||
HasDefinedARIAToken(ancestor, nsGkAtoms::aria_busy) &&
|
||||
ancestor->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_busy, busy))
|
||||
SetAccAttr(aAttributes, nsGkAtoms::containerBusy, busy);
|
||||
|
||||
@ -198,7 +197,7 @@ nsAccUtils::HasDefinedARIAToken(nsIContent *aContent, nsIAtom *aAtom)
|
||||
nsIAtom*
|
||||
nsAccUtils::GetARIAToken(dom::Element* aElement, nsIAtom* aAttr)
|
||||
{
|
||||
if (!nsAccUtils::HasDefinedARIAToken(aElement, aAttr))
|
||||
if (!HasDefinedARIAToken(aElement, aAttr))
|
||||
return nsGkAtoms::_empty;
|
||||
|
||||
static nsIContent::AttrValuesArray tokens[] =
|
||||
|
@ -57,6 +57,9 @@
|
||||
#include "nsNPAPIPluginInstance.h"
|
||||
#include "nsObjectFrame.h"
|
||||
#include "nsSVGPathGeometryFrame.h"
|
||||
#include "nsTreeBodyFrame.h"
|
||||
#include "nsTreeColumns.h"
|
||||
#include "nsTreeUtils.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
@ -1572,27 +1575,28 @@ already_AddRefed<Accessible>
|
||||
nsAccessibilityService::CreateAccessibleForXULTree(nsIContent* aContent,
|
||||
DocAccessible* aDoc)
|
||||
{
|
||||
nsCOMPtr<nsITreeBoxObject> treeBoxObj = nsCoreUtils::GetTreeBoxObject(aContent);
|
||||
if (!treeBoxObj)
|
||||
nsIContent* child = nsTreeUtils::GetDescendantChild(aContent,
|
||||
nsGkAtoms::treechildren);
|
||||
if (!child)
|
||||
return nullptr;
|
||||
|
||||
nsCOMPtr<nsITreeColumns> treeColumns;
|
||||
treeBoxObj->GetColumns(getter_AddRefs(treeColumns));
|
||||
if (!treeColumns)
|
||||
nsTreeBodyFrame* treeFrame = do_QueryFrame(child->GetPrimaryFrame());
|
||||
if (!treeFrame)
|
||||
return nullptr;
|
||||
|
||||
nsRefPtr<nsTreeColumns> treeCols = treeFrame->Columns();
|
||||
int32_t count = 0;
|
||||
treeColumns->GetCount(&count);
|
||||
treeCols->GetCount(&count);
|
||||
|
||||
// Outline of list accessible.
|
||||
if (count == 1) {
|
||||
Accessible* accessible = new XULTreeAccessible(aContent, aDoc);
|
||||
Accessible* accessible = new XULTreeAccessible(aContent, aDoc, treeFrame);
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
||||
// Table or tree table accessible.
|
||||
Accessible* accessible = new XULTreeGridAccessibleWrap(aContent, aDoc);
|
||||
Accessible* accessible = new XULTreeGridAccessibleWrap(aContent, aDoc, treeFrame);
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
@ -22,8 +22,9 @@ class XULTreeGridAccessibleWrap : public XULTreeGridAccessible,
|
||||
public ia2AccessibleTable
|
||||
{
|
||||
public:
|
||||
XULTreeGridAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
|
||||
XULTreeGridAccessible(aContent, aDoc), ia2AccessibleTable(this) {}
|
||||
XULTreeGridAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc,
|
||||
nsTreeBodyFrame* aTree) :
|
||||
XULTreeGridAccessible(aContent, aDoc, aTree), ia2AccessibleTable(this) {}
|
||||
|
||||
// IUnknown
|
||||
DECL_IUNKNOWN_INHERITED
|
||||
|
@ -43,6 +43,7 @@ LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../xpcom \
|
||||
-I$(srcdir)/../../../layout/generic \
|
||||
-I$(srcdir)/../../../layout/xul/base/src \
|
||||
-I$(srcdir)/../../../layout/xul/tree// \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
|
||||
|
@ -27,6 +27,9 @@
|
||||
#include "nsIDOMXULTreeElement.h"
|
||||
#include "nsITreeSelection.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsTreeBodyFrame.h"
|
||||
#include "nsTreeColumns.h"
|
||||
#include "nsTreeUtils.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
@ -35,21 +38,19 @@ using namespace mozilla::a11y;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
XULTreeAccessible::
|
||||
XULTreeAccessible(nsIContent* aContent, DocAccessible* aDoc) :
|
||||
XULTreeAccessible(nsIContent* aContent, DocAccessible* aDoc,
|
||||
nsTreeBodyFrame* aTreeFrame) :
|
||||
AccessibleWrap(aContent, aDoc)
|
||||
{
|
||||
mType = eXULTreeType;
|
||||
mGenericTypes |= eSelect;
|
||||
|
||||
nsCOMPtr<nsITreeView> view = aTreeFrame->GetExistingView();
|
||||
mTreeView = view;
|
||||
|
||||
mTree = nsCoreUtils::GetTreeBoxObject(aContent);
|
||||
NS_ASSERTION(mTree, "Can't get mTree!\n");
|
||||
|
||||
if (mTree) {
|
||||
nsCOMPtr<nsITreeView> treeView;
|
||||
mTree->GetView(getter_AddRefs(treeView));
|
||||
mTreeView = treeView;
|
||||
}
|
||||
|
||||
nsIContent* parentContent = mContent->GetParent();
|
||||
if (parentContent) {
|
||||
nsCOMPtr<nsIAutoCompletePopup> autoCompletePopupElm =
|
||||
@ -159,11 +160,16 @@ XULTreeAccessible::NativeRole()
|
||||
// No primary column means we're in a list. In fact, history and mail turn off
|
||||
// the primary flag when switching to a flat view.
|
||||
|
||||
nsCOMPtr<nsITreeColumns> cols;
|
||||
mTree->GetColumns(getter_AddRefs(cols));
|
||||
nsIContent* child = nsTreeUtils::GetDescendantChild(mContent, nsGkAtoms::treechildren);
|
||||
NS_ASSERTION(child, "tree without treechildren!");
|
||||
nsTreeBodyFrame* treeFrame = do_QueryFrame(child->GetPrimaryFrame());
|
||||
NS_ASSERTION(treeFrame, "xul tree accessible for tree without a frame!");
|
||||
if (!treeFrame)
|
||||
return roles::LIST;
|
||||
|
||||
nsRefPtr<nsTreeColumns> cols = treeFrame->Columns();
|
||||
nsCOMPtr<nsITreeColumn> primaryCol;
|
||||
if (cols)
|
||||
cols->GetPrimaryColumn(getter_AddRefs(primaryCol));
|
||||
cols->GetPrimaryColumn(getter_AddRefs(primaryCol));
|
||||
|
||||
return primaryCol ? roles::OUTLINE : roles::LIST;
|
||||
}
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "nsITreeColumns.h"
|
||||
#include "XULListboxAccessible.h"
|
||||
|
||||
class nsTreeBodyFrame;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
@ -29,7 +31,8 @@ class XULTreeAccessible : public AccessibleWrap
|
||||
public:
|
||||
using Accessible::GetChildAt;
|
||||
|
||||
XULTreeAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
||||
XULTreeAccessible(nsIContent* aContent, DocAccessible* aDoc,
|
||||
nsTreeBodyFrame* aTreeframe);
|
||||
|
||||
// nsISupports and cycle collection
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -20,17 +20,6 @@
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// XULTreeGridAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
XULTreeGridAccessible::
|
||||
XULTreeGridAccessible(nsIContent* aContent, DocAccessible* aDoc) :
|
||||
XULTreeAccessible(aContent, aDoc), xpcAccessibleTable(this)
|
||||
{
|
||||
mGenericTypes |= eTable;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// XULTreeGridAccessible: nsISupports implementation
|
||||
|
||||
|
@ -24,7 +24,10 @@ class XULTreeGridAccessible : public XULTreeAccessible,
|
||||
public TableAccessible
|
||||
{
|
||||
public:
|
||||
XULTreeGridAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
||||
XULTreeGridAccessible(nsIContent* aContent, DocAccessible* aDoc,
|
||||
nsTreeBodyFrame* aTreeFrame) :
|
||||
XULTreeAccessible(aContent, aDoc, aTreeFrame), xpcAccessibleTable(this)
|
||||
{ mGenericTypes |= eTable; }
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
@ -32,9 +32,6 @@
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
if (!navigator.platform.startsWith("Mac")) {
|
||||
SimpleTest.expectAssertions(2);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Hacky stuffs
|
||||
|
||||
|
@ -66,9 +66,9 @@
|
||||
"textarea", kTodo, kTodo, kTodo);
|
||||
testTextAfterOffset(8, BOUNDARY_WORD_START, "two ", 9, 13,
|
||||
"div", kTodo, kTodo, kTodo,
|
||||
"divbr", kTodo, kTodo, kTodo,
|
||||
"divbr", kTodo, kTodo, kOk,
|
||||
"editable", kTodo, kTodo, kTodo,
|
||||
"editablebr", kTodo, kTodo, kTodo,
|
||||
"editablebr", kTodo, kTodo, kOk,
|
||||
"textarea", kTodo, kTodo, kTodo);
|
||||
testTextAfterOffset(9, BOUNDARY_WORD_START, "words\n", 13, 19,
|
||||
"div", kTodo, kTodo, kTodo,
|
||||
@ -384,12 +384,7 @@
|
||||
"textarea", kOk, kOk, kOk);
|
||||
|
||||
// BOUNDARY_WORD_START
|
||||
testTextAtOffset(0, BOUNDARY_WORD_START, "oneword\n\n", 0, 9,
|
||||
"div", kTodo, kOk, kTodo,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
"editable", kTodo, kOk, kTodo,
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kTodo, kOk, kTodo);
|
||||
testTextAtOffset(0, BOUNDARY_WORD_START, "oneword\n\n", 0, 9, IDs);
|
||||
testTextAtOffset(8, BOUNDARY_WORD_START, "oneword\n\n", 0, 9,
|
||||
"div", kOk, kOk, kOk,
|
||||
"divbr", kTodo, kTodo, kTodo,
|
||||
@ -413,17 +408,12 @@
|
||||
"editablebr", kTodo, kTodo, kTodo,
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(9, BOUNDARY_WORD_END, "\n\ntwo", 7, 12,
|
||||
"div", kTodo, kTodo, kOk,
|
||||
"div", kOk, kOk, kOk,
|
||||
"divbr", kTodo, kTodo, kTodo,
|
||||
"editable", kTodo, kTodo, kOk,
|
||||
"editable", kOk, kOk, kOk,
|
||||
"editablebr", kTodo, kTodo, kTodo,
|
||||
"textarea", kTodo, kTodo, kOk);
|
||||
testTextAtOffset(12, BOUNDARY_WORD_END, "\n\ntwo", 7, 12,
|
||||
"div", kTodo, kTodo, kOk,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
"editable", kTodo, kTodo, kOk,
|
||||
"editablebr", kOk, kOk, kOk,
|
||||
"textarea", kTodo, kTodo, kOk);
|
||||
"textarea", kOk, kOk, kOk);
|
||||
testTextAtOffset(12, BOUNDARY_WORD_END, "\n\ntwo", 7, 12, IDs);
|
||||
testTextAtOffset(13, BOUNDARY_WORD_END, " words", 12, 18,
|
||||
"div", kOk, kOk, kOk,
|
||||
"divbr", kOk, kOk, kOk,
|
||||
|
@ -18,11 +18,6 @@
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
if (navigator.platform.startsWith("Mac")) {
|
||||
SimpleTest.expectAssertions(0, 1);
|
||||
} else {
|
||||
SimpleTest.expectAssertions(1);
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Test
|
||||
|
||||
|
@ -54,7 +54,6 @@
|
||||
@BINPATH@/@DLL_PREFIX@plds4@DLL_SUFFIX@
|
||||
@BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@
|
||||
#endif
|
||||
@BINPATH@/@DLL_PREFIX@xpcom@DLL_SUFFIX@
|
||||
@BINPATH@/@DLL_PREFIX@mozalloc@DLL_SUFFIX@
|
||||
#ifdef MOZ_DMD
|
||||
@BINPATH@/@DLL_PREFIX@dmd@DLL_SUFFIX@
|
||||
@ -202,6 +201,7 @@
|
||||
@BINPATH@/components/dom_browserelement.xpt
|
||||
@BINPATH@/components/dom_messages.xpt
|
||||
@BINPATH@/components/dom_power.xpt
|
||||
@BINPATH@/components/dom_quota.xpt
|
||||
@BINPATH@/components/dom_range.xpt
|
||||
@BINPATH@/components/dom_settings.xpt
|
||||
@BINPATH@/components/dom_permissionsettings.xpt
|
||||
|
@ -20,3 +20,4 @@ components/dom_sms.xpt
|
||||
@DLL_PREFIX@nssutil3@DLL_SUFFIX@
|
||||
@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@
|
||||
#endif
|
||||
@DLL_PREFIX@xpcom@DLL_SUFFIX@
|
||||
|
@ -2,6 +2,17 @@
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
// the "exported" symbols
|
||||
let SocialUI,
|
||||
SocialChatBar,
|
||||
SocialFlyout,
|
||||
SocialShareButton,
|
||||
SocialMenu,
|
||||
SocialToolbar,
|
||||
SocialSidebar;
|
||||
|
||||
(function() {
|
||||
|
||||
// The minimum sizes for the auto-resize panel code.
|
||||
const PANEL_MIN_HEIGHT = 100;
|
||||
const PANEL_MIN_WIDTH = 330;
|
||||
@ -9,7 +20,7 @@ const PANEL_MIN_WIDTH = 330;
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "SharedFrame",
|
||||
"resource:///modules/SharedFrame.jsm");
|
||||
|
||||
let SocialUI = {
|
||||
SocialUI = {
|
||||
// Called on delayed startup to initialize the UI
|
||||
init: function SocialUI_init() {
|
||||
Services.obs.addObserver(this, "social:ambient-notification-changed", false);
|
||||
@ -340,7 +351,7 @@ let SocialUI = {
|
||||
|
||||
}
|
||||
|
||||
let SocialChatBar = {
|
||||
SocialChatBar = {
|
||||
init: function() {
|
||||
},
|
||||
get chatbar() {
|
||||
@ -437,7 +448,7 @@ DynamicResizeWatcher.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
let SocialFlyout = {
|
||||
SocialFlyout = {
|
||||
get panel() {
|
||||
return document.getElementById("social-flyout-panel");
|
||||
},
|
||||
@ -569,7 +580,7 @@ let SocialFlyout = {
|
||||
}
|
||||
}
|
||||
|
||||
let SocialShareButton = {
|
||||
SocialShareButton = {
|
||||
// Called once, after window load, when the Social.provider object is initialized
|
||||
init: function SSB_init() {
|
||||
},
|
||||
@ -712,7 +723,7 @@ let SocialShareButton = {
|
||||
}
|
||||
};
|
||||
|
||||
var SocialMenu = {
|
||||
SocialMenu = {
|
||||
init: function SocialMenu_init() {
|
||||
},
|
||||
|
||||
@ -746,7 +757,7 @@ var SocialMenu = {
|
||||
};
|
||||
|
||||
// XXX Need to audit that this is being initialized correctly
|
||||
var SocialToolbar = {
|
||||
SocialToolbar = {
|
||||
// Called once, after window load, when the Social.provider object is
|
||||
// initialized.
|
||||
init: function SocialToolbar_init() {
|
||||
@ -1087,7 +1098,7 @@ var SocialToolbar = {
|
||||
}
|
||||
}
|
||||
|
||||
var SocialSidebar = {
|
||||
SocialSidebar = {
|
||||
// Called once, after window load, when the Social.provider object is initialized
|
||||
init: function SocialSidebar_init() {
|
||||
let sbrowser = document.getElementById("social-sidebar-browser");
|
||||
@ -1194,3 +1205,5 @@ var SocialSidebar = {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
||||
|
@ -144,7 +144,7 @@ Site.prototype = {
|
||||
// Register drag-and-drop event handlers.
|
||||
this._node.addEventListener("dragstart", this, false);
|
||||
this._node.addEventListener("dragend", this, false);
|
||||
this._node.addEventListener("mouseenter", this, false);
|
||||
this._node.addEventListener("mouseover", this, false);
|
||||
|
||||
let controls = this.node.querySelectorAll(".newtab-control");
|
||||
for (let i = 0; i < controls.length; i++)
|
||||
@ -174,7 +174,8 @@ Site.prototype = {
|
||||
else
|
||||
this.pin();
|
||||
break;
|
||||
case "mouseenter":
|
||||
case "mouseover":
|
||||
this._node.removeEventListener("mouseover", this, false);
|
||||
this._speculativeConnect();
|
||||
break;
|
||||
case "dragstart":
|
||||
|
@ -7,11 +7,11 @@ const ALLOW = nsIPermissionManager.ALLOW_ACTION; // 1
|
||||
const BLOCK = nsIPermissionManager.DENY_ACTION; // 2
|
||||
const SESSION = nsICookiePermission.ACCESS_SESSION; // 8
|
||||
|
||||
const nsIIndexedDatabaseManager =
|
||||
Components.interfaces.nsIIndexedDatabaseManager;
|
||||
const nsIQuotaManager = Components.interfaces.nsIQuotaManager;
|
||||
|
||||
var gPermURI;
|
||||
var gPrefs;
|
||||
var gUsageRequest;
|
||||
|
||||
var gPermObj = {
|
||||
image: function getImageDefaultPermission()
|
||||
@ -116,9 +116,10 @@ function onUnloadPermission()
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
os.removeObserver(permissionObserver, "perm-changed");
|
||||
|
||||
var dbManager = Components.classes["@mozilla.org/dom/indexeddb/manager;1"]
|
||||
.getService(nsIIndexedDatabaseManager);
|
||||
dbManager.cancelGetUsageForURI(gPermURI, onIndexedDBUsageCallback);
|
||||
if (gUsageRequest) {
|
||||
gUsageRequest.cancel();
|
||||
gUsageRequest = null;
|
||||
}
|
||||
}
|
||||
|
||||
function initRow(aPartId)
|
||||
@ -205,9 +206,10 @@ function setRadioState(aPartId, aValue)
|
||||
|
||||
function initIndexedDBRow()
|
||||
{
|
||||
var dbManager = Components.classes["@mozilla.org/dom/indexeddb/manager;1"]
|
||||
.getService(nsIIndexedDatabaseManager);
|
||||
dbManager.getUsageForURI(gPermURI, onIndexedDBUsageCallback);
|
||||
var quotaManager = Components.classes["@mozilla.org/dom/quota/manager;1"]
|
||||
.getService(nsIQuotaManager);
|
||||
gUsageRequest =
|
||||
quotaManager.getUsageForURI(gPermURI, onIndexedDBUsageCallback);
|
||||
|
||||
var status = document.getElementById("indexedDBStatus");
|
||||
var button = document.getElementById("indexedDBClear");
|
||||
@ -219,9 +221,9 @@ function initIndexedDBRow()
|
||||
|
||||
function onIndexedDBClear()
|
||||
{
|
||||
Components.classes["@mozilla.org/dom/indexeddb/manager;1"]
|
||||
.getService(nsIIndexedDatabaseManager)
|
||||
.clearDatabasesForURI(gPermURI);
|
||||
Components.classes["@mozilla.org/dom/quota/manager;1"]
|
||||
.getService(nsIQuotaManager)
|
||||
.clearStoragesForURI(gPermURI);
|
||||
|
||||
var permissionManager = Components.classes[PERMISSION_CONTRACTID]
|
||||
.getService(nsIPermissionManager);
|
||||
|
@ -448,12 +448,28 @@
|
||||
return this.mTabBrowser._callProgressListeners.apply(this.mTabBrowser, arguments);
|
||||
},
|
||||
|
||||
_shouldShowProgress: function (aRequest) {
|
||||
if (this.mBlank)
|
||||
return false;
|
||||
|
||||
// Don't show progress indicators in tabs for about: URIs
|
||||
// pointing to local resources.
|
||||
try {
|
||||
let channel = aRequest.QueryInterface(Ci.nsIChannel);
|
||||
if (channel.originalURI.schemeIs("about") &&
|
||||
(channel.URI.schemeIs("jar") || channel.URI.schemeIs("file")))
|
||||
return false;
|
||||
} catch (e) {}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
onProgressChange: function (aWebProgress, aRequest,
|
||||
aCurSelfProgress, aMaxSelfProgress,
|
||||
aCurTotalProgress, aMaxTotalProgress) {
|
||||
this.mTotalProgress = aMaxTotalProgress ? aCurTotalProgress / aMaxTotalProgress : 0;
|
||||
|
||||
if (this.mBlank)
|
||||
if (!this._shouldShowProgress(aRequest))
|
||||
return;
|
||||
|
||||
if (this.mTotalProgress)
|
||||
@ -510,7 +526,7 @@
|
||||
if (aWebProgress.DOMWindow == this.mBrowser.contentWindow)
|
||||
this.mBrowser.userTypedClear += 2;
|
||||
|
||||
if (!this.mBlank) {
|
||||
if (this._shouldShowProgress(aRequest)) {
|
||||
if (!(aStateFlags & nsIWebProgressListener.STATE_RESTORING)) {
|
||||
this.mTab.setAttribute("busy", "true");
|
||||
if (!(this.mBrowser.docShell.loadType & Ci.nsIDocShell.LOAD_CMD_RELOAD))
|
||||
@ -694,9 +710,15 @@
|
||||
this.mFaviconService.FAVICON_LOAD_NON_PRIVATE);
|
||||
}
|
||||
|
||||
if ((browser.mIconURL || "") != aTab.getAttribute("image")) {
|
||||
if (browser.mIconURL)
|
||||
aTab.setAttribute("image", browser.mIconURL);
|
||||
let sizedIconUrl = browser.mIconURL || "";
|
||||
if (sizedIconUrl) {
|
||||
let size = Math.round(16 * window.devicePixelRatio);
|
||||
sizedIconUrl += (sizedIconUrl.contains("#") ? "&" : "#") +
|
||||
"-moz-resolution=" + size + "," + size;
|
||||
}
|
||||
if (sizedIconUrl != aTab.getAttribute("image")) {
|
||||
if (sizedIconUrl)
|
||||
aTab.setAttribute("image", sizedIconUrl);
|
||||
else
|
||||
aTab.removeAttribute("image");
|
||||
this._tabAttrModified(aTab);
|
||||
|
@ -31,7 +31,8 @@ let gTests = [
|
||||
},
|
||||
run: function (aSnippetsMap)
|
||||
{
|
||||
isnot(aSnippetsMap.get("snippets-last-update"), null);
|
||||
isnot(aSnippetsMap.get("snippets-last-update"), null,
|
||||
"snippets-last-update should have a value");
|
||||
}
|
||||
},
|
||||
|
||||
@ -116,7 +117,7 @@ let gTests = [
|
||||
cm.getCategoryEntry("healthreport-js-provider", "SearchesProvider");
|
||||
} catch (ex) {
|
||||
// Health Report disabled, or no SearchesProvider.
|
||||
return;
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
let deferred = Promise.defer();
|
||||
@ -220,9 +221,9 @@ function test()
|
||||
let snippetsMap = yield promiseSetupSnippetsMap(tab, test.setup);
|
||||
// Ensure browser has set attributes already, or wait for them.
|
||||
yield promise;
|
||||
|
||||
info("Running test");
|
||||
yield test.run(snippetsMap);
|
||||
|
||||
info("Cleanup");
|
||||
gBrowser.removeCurrentTab();
|
||||
}
|
||||
|
||||
@ -243,8 +244,10 @@ function promiseNewTabLoadEvent(aUrl, aEventType="load")
|
||||
{
|
||||
let deferred = Promise.defer();
|
||||
let tab = gBrowser.selectedTab = gBrowser.addTab(aUrl);
|
||||
info("Wait tab event: " + aEventType);
|
||||
tab.linkedBrowser.addEventListener(aEventType, function load(event) {
|
||||
tab.linkedBrowser.removeEventListener(aEventType, load, true);
|
||||
info("Tab event received: " + aEventType);
|
||||
deferred.resolve(tab);
|
||||
}, true);
|
||||
return deferred.promise;
|
||||
@ -264,7 +267,12 @@ function promiseSetupSnippetsMap(aTab, aSetupFn)
|
||||
{
|
||||
let deferred = Promise.defer();
|
||||
let cw = aTab.linkedBrowser.contentWindow.wrappedJSObject;
|
||||
info("Waiting for snippets map");
|
||||
cw.ensureSnippetsMapThen(function (aSnippetsMap) {
|
||||
info("Got snippets map: " +
|
||||
"{ last-update: " + aSnippetsMap.get("snippets-last-update") +
|
||||
", cached-version: " + aSnippetsMap.get("snippets-cached-version") +
|
||||
" }");
|
||||
// Don't try to update.
|
||||
aSnippetsMap.set("snippets-last-update", Date.now());
|
||||
aSnippetsMap.set("snippets-cached-version", AboutHomeUtils.snippetsVersion);
|
||||
@ -293,6 +301,8 @@ function promiseBrowserAttributes(aTab)
|
||||
//docElt.setAttribute("snippetsURL", "nonexistent://test");
|
||||
let observer = new MutationObserver(function (mutations) {
|
||||
for (let mutation of mutations) {
|
||||
info("Got attribute mutation: " + mutation.attributeName +
|
||||
" from " + mutation.oldValue);
|
||||
if (mutation.attributeName == "snippetsURL" &&
|
||||
docElt.getAttribute("snippetsURL") != "nonexistent://test") {
|
||||
docElt.setAttribute("snippetsURL", "nonexistent://test");
|
||||
@ -300,6 +310,7 @@ function promiseBrowserAttributes(aTab)
|
||||
|
||||
// Now we just have to wait for the last attribute.
|
||||
if (mutation.attributeName == "searchEngineURL") {
|
||||
info("Remove attributes observer");
|
||||
observer.disconnect();
|
||||
// Must be sure to continue after the page mutation observer.
|
||||
executeSoon(function() deferred.resolve());
|
||||
@ -307,6 +318,7 @@ function promiseBrowserAttributes(aTab)
|
||||
}
|
||||
}
|
||||
});
|
||||
info("Add attributes observer");
|
||||
observer.observe(docElt, { attributes: true });
|
||||
|
||||
return deferred.promise;
|
||||
|
@ -1398,7 +1398,7 @@ BrowserGlue.prototype = {
|
||||
}
|
||||
|
||||
// Add the entry to the persisted set for this document if it's not there.
|
||||
// This code is mostly borrowed from nsXULDocument::Persist.
|
||||
// This code is mostly borrowed from XULDocument::Persist.
|
||||
let docURL = aSource.ValueUTF8.split("#")[0];
|
||||
let docResource = this._rdf.GetResource(docURL);
|
||||
let persistResource = this._rdf.GetResource("http://home.netscape.com/NC-rdf#persist");
|
||||
|
@ -19,7 +19,7 @@ let localStore = {
|
||||
delete this.toolbar;
|
||||
let toolbar = this.RDF.GetResource(BROWSER_URL + "#PersonalToolbar");
|
||||
// Add the entry to the persisted set for this document if it's not there.
|
||||
// See nsXULDocument::Persist.
|
||||
// See XULDocument::Persist.
|
||||
let doc = this.RDF.GetResource(BROWSER_URL);
|
||||
let persist = this.RDF.GetResource("http://home.netscape.com/NC-rdf#persist");
|
||||
if (!this.store.HasAssertion(doc, persist, toolbar, true)) {
|
||||
|
@ -1,17 +1,17 @@
|
||||
[
|
||||
{
|
||||
"clang_version": "r170890"
|
||||
},
|
||||
},
|
||||
{
|
||||
"size": 47,
|
||||
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
"filename": "setup.sh",
|
||||
"algorithm": "sha512",
|
||||
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
|
||||
"size": 47
|
||||
},
|
||||
{
|
||||
"size": 61878284,
|
||||
"digest": "a3f924e7a6d8651b3466f3dc4625eaa00f90ee6cc824ddd4da7a27ce26916220615c1aa33e4a286b757b9283c536b8311edddf469d23e9e1306b90dff19ae11f",
|
||||
"algorithm": "sha512",
|
||||
"filename": "clang.tar.bz2"
|
||||
"filename": "clang.tar.bz2",
|
||||
"algorithm": "sha512",
|
||||
"digest": "0bcfc19f05cc0f042befb3823c7ecce9ba411b152921aa29e97e7adc846e0258fd7da521b1620cb1e61a19d2fcac9b60e6d613c922b6c153e01b9b0766651d09",
|
||||
"size": 62708281
|
||||
}
|
||||
]
|
||||
|
@ -3,15 +3,15 @@
|
||||
"clang_version": "r170890"
|
||||
},
|
||||
{
|
||||
"size": 47,
|
||||
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
|
||||
"filename": "setup.sh",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
|
||||
"size": 47
|
||||
},
|
||||
{
|
||||
"size": 62279506,
|
||||
"digest": "aa886361161a7d32aad71dfe5fd6b6cdff25610d8e32153a80caea66a8475aa8526d8529d8ac26e8ac26bd32878ee0df6d8dbef95dfd9faacec45b4ab918d52d",
|
||||
"filename": "clang.tar.bz2",
|
||||
"algorithm": "sha512",
|
||||
"filename": "clang.tar.bz2"
|
||||
"digest": "e14ccefd965372a57c540647b2b99e21a4aa82f81a8b9a9e18dac7cba4c3436181bef0dfab8c51bcb5c343f504a693fdcfbe7d609f10291b5dd65ab059979d29",
|
||||
"size": 63034761
|
||||
}
|
||||
]
|
||||
|
@ -69,7 +69,6 @@
|
||||
@BINPATH@/@DLL_PREFIX@plds4@DLL_SUFFIX@
|
||||
#endif
|
||||
#endif
|
||||
@BINPATH@/@DLL_PREFIX@xpcom@DLL_SUFFIX@
|
||||
#ifdef XP_MACOSX
|
||||
@BINPATH@/XUL
|
||||
#else
|
||||
@ -203,6 +202,7 @@
|
||||
#endif
|
||||
@BINPATH@/components/dom_browserelement.xpt
|
||||
@BINPATH@/components/dom_power.xpt
|
||||
@BINPATH@/components/dom_quota.xpt
|
||||
@BINPATH@/components/dom_range.xpt
|
||||
@BINPATH@/components/dom_settings.xpt
|
||||
@BINPATH@/components/dom_permissionsettings.xpt
|
||||
|
@ -26,6 +26,7 @@
|
||||
@DLL_PREFIX@nssutil3@DLL_SUFFIX@
|
||||
@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@
|
||||
#endif
|
||||
@DLL_PREFIX@xpcom@DLL_SUFFIX@
|
||||
LICENSE
|
||||
browserconfig.properties
|
||||
chrome/US.jar
|
||||
|
@ -25,6 +25,12 @@ XPCOMUtils.defineLazyModuleGetter(this, "PdfJs",
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "DownloadUtils",
|
||||
"resource://gre/modules/DownloadUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
||||
"resource://gre/modules/commonjs/sdk/core/promise.js");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Task",
|
||||
"resource://gre/modules/Task.jsm");
|
||||
|
||||
/*
|
||||
* Services
|
||||
*/
|
||||
|
@ -278,17 +278,19 @@ var BrowserUI = {
|
||||
content.focus();
|
||||
this._setURI(aURI);
|
||||
|
||||
let postData = {};
|
||||
aURI = Browser.getShortcutOrURI(aURI, postData);
|
||||
Browser.loadURI(aURI, { flags: Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP, postData: postData });
|
||||
Task.spawn(function() {
|
||||
let postData = {};
|
||||
aURI = yield Browser.getShortcutOrURI(aURI, postData);
|
||||
Browser.loadURI(aURI, { flags: Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP, postData: postData });
|
||||
|
||||
// Delay doing the fixup so the raw URI is passed to loadURIWithFlags
|
||||
// and the proper third-party fixup can be done
|
||||
let fixupFlags = Ci.nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
|
||||
let uri = gURIFixup.createFixupURI(aURI, fixupFlags);
|
||||
gHistSvc.markPageAsTyped(uri);
|
||||
// Delay doing the fixup so the raw URI is passed to loadURIWithFlags
|
||||
// and the proper third-party fixup can be done
|
||||
let fixupFlags = Ci.nsIURIFixup.FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP;
|
||||
let uri = gURIFixup.createFixupURI(aURI, fixupFlags);
|
||||
gHistSvc.markPageAsTyped(uri);
|
||||
|
||||
this._titleChanged(Browser.selectedBrowser);
|
||||
BrowserUI._titleChanged(Browser.selectedBrowser);
|
||||
});
|
||||
},
|
||||
|
||||
handleUrlbarEnter: function handleUrlbarEnter(aEvent) {
|
||||
|
@ -133,53 +133,6 @@ var Browser = {
|
||||
if (window.arguments && window.arguments[0])
|
||||
commandURL = window.arguments[0];
|
||||
|
||||
// Activation URIs come from protocol activations, secondary tiles, and file activations
|
||||
let activationURI = this.getShortcutOrURI(MetroUtils.activationURI);
|
||||
|
||||
let self = this;
|
||||
function loadStartupURI() {
|
||||
let uri = activationURI || commandURL || Browser.getHomePage();
|
||||
if (StartUI.isStartURI(uri)) {
|
||||
self.addTab(uri, true);
|
||||
StartUI.show(); // This makes about:start load a lot faster
|
||||
} else if (activationURI) {
|
||||
self.addTab(uri, true, null, { flags: Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP });
|
||||
} else {
|
||||
self.addTab(uri, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Should we restore the previous session (crash or some other event)
|
||||
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
|
||||
if (ss.shouldRestore() || Services.prefs.getBoolPref("browser.startup.sessionRestore")) {
|
||||
let bringFront = false;
|
||||
// First open any commandline URLs, except the homepage
|
||||
if (activationURI && !StartUI.isStartURI(activationURI)) {
|
||||
this.addTab(activationURI, true, null, { flags: Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP });
|
||||
} else if (commandURL && !StartUI.isStartURI(commandURL)) {
|
||||
this.addTab(commandURL, true);
|
||||
} else {
|
||||
bringFront = true;
|
||||
// Initial window resizes call functions that assume a tab is in the tab list
|
||||
// and restored tabs are added too late. We add a dummy to to satisfy the resize
|
||||
// code and then remove the dummy after the session has been restored.
|
||||
let dummy = this.addTab("about:blank", true);
|
||||
let dummyCleanup = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(dummyCleanup, "sessionstore-windows-restored");
|
||||
if (aData == "fail")
|
||||
loadStartupURI();
|
||||
dummy.chromeTab.ignoreUndo = true;
|
||||
Browser.closeTab(dummy, { forceClose: true });
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(dummyCleanup, "sessionstore-windows-restored", false);
|
||||
}
|
||||
ss.restoreLastSession(bringFront);
|
||||
} else {
|
||||
loadStartupURI();
|
||||
}
|
||||
|
||||
messageManager.addMessageListener("DOMLinkAdded", this);
|
||||
messageManager.addMessageListener("MozScrolledAreaChanged", this);
|
||||
messageManager.addMessageListener("Browser:ViewportMetadata", this);
|
||||
@ -197,10 +150,59 @@ var Browser = {
|
||||
// starting with:
|
||||
InputSourceHelper.fireUpdate();
|
||||
|
||||
// Broadcast a UIReady message so add-ons know we are finished with startup
|
||||
let event = document.createEvent("Events");
|
||||
event.initEvent("UIReady", true, false);
|
||||
window.dispatchEvent(event);
|
||||
Task.spawn(function() {
|
||||
// Activation URIs come from protocol activations, secondary tiles, and file activations
|
||||
let activationURI = yield this.getShortcutOrURI(MetroUtils.activationURI);
|
||||
|
||||
let self = this;
|
||||
function loadStartupURI() {
|
||||
let uri = activationURI || commandURL || Browser.getHomePage();
|
||||
if (StartUI.isStartURI(uri)) {
|
||||
self.addTab(uri, true);
|
||||
StartUI.show(); // This makes about:start load a lot faster
|
||||
} else if (activationURI) {
|
||||
self.addTab(uri, true, null, { flags: Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP });
|
||||
} else {
|
||||
self.addTab(uri, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Should we restore the previous session (crash or some other event)
|
||||
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
|
||||
if (ss.shouldRestore() || Services.prefs.getBoolPref("browser.startup.sessionRestore")) {
|
||||
let bringFront = false;
|
||||
// First open any commandline URLs, except the homepage
|
||||
if (activationURI && !StartUI.isStartURI(activationURI)) {
|
||||
this.addTab(activationURI, true, null, { flags: Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP });
|
||||
} else if (commandURL && !StartUI.isStartURI(commandURL)) {
|
||||
this.addTab(commandURL, true);
|
||||
} else {
|
||||
bringFront = true;
|
||||
// Initial window resizes call functions that assume a tab is in the tab list
|
||||
// and restored tabs are added too late. We add a dummy to to satisfy the resize
|
||||
// code and then remove the dummy after the session has been restored.
|
||||
let dummy = this.addTab("about:blank", true);
|
||||
let dummyCleanup = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(dummyCleanup, "sessionstore-windows-restored");
|
||||
if (aData == "fail")
|
||||
loadStartupURI();
|
||||
dummy.chromeTab.ignoreUndo = true;
|
||||
Browser.closeTab(dummy, { forceClose: true });
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(dummyCleanup, "sessionstore-windows-restored", false);
|
||||
}
|
||||
ss.restoreLastSession(bringFront);
|
||||
} else {
|
||||
loadStartupURI();
|
||||
}
|
||||
|
||||
// Broadcast a UIReady message so add-ons know we are finished with startup
|
||||
let event = document.createEvent("Events");
|
||||
event.initEvent("UIReady", true, false);
|
||||
window.dispatchEvent(event);
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
quit: function quit() {
|
||||
@ -348,77 +350,80 @@ var Browser = {
|
||||
* Determine if the given URL is a shortcut/keyword and, if so, expand it
|
||||
* @param aURL String
|
||||
* @param aPostDataRef Out param contains any required post data for a search
|
||||
* @returns the expanded shortcut, or the original URL if not a shortcut
|
||||
* @return {Promise}
|
||||
* @result the expanded shortcut, or the original URL if not a shortcut
|
||||
*/
|
||||
getShortcutOrURI: function getShortcutOrURI(aURL, aPostDataRef) {
|
||||
if (!aURL)
|
||||
return aURL;
|
||||
return Task.spawn(function() {
|
||||
if (!aURL)
|
||||
throw new Task.Result(aURL);
|
||||
|
||||
let shortcutURL = null;
|
||||
let keyword = aURL;
|
||||
let param = "";
|
||||
let shortcutURL = null;
|
||||
let keyword = aURL;
|
||||
let param = "";
|
||||
|
||||
let offset = aURL.indexOf(" ");
|
||||
if (offset > 0) {
|
||||
keyword = aURL.substr(0, offset);
|
||||
param = aURL.substr(offset + 1);
|
||||
}
|
||||
|
||||
if (!aPostDataRef)
|
||||
aPostDataRef = {};
|
||||
|
||||
let engine = Services.search.getEngineByAlias(keyword);
|
||||
if (engine) {
|
||||
let submission = engine.getSubmission(param);
|
||||
aPostDataRef.value = submission.postData;
|
||||
return submission.uri.spec;
|
||||
}
|
||||
|
||||
try {
|
||||
[shortcutURL, aPostDataRef.value] = PlacesUtils.getURLAndPostDataForKeyword(keyword);
|
||||
} catch (e) {}
|
||||
|
||||
if (!shortcutURL)
|
||||
return aURL;
|
||||
|
||||
let postData = "";
|
||||
if (aPostDataRef.value)
|
||||
postData = unescape(aPostDataRef.value);
|
||||
|
||||
if (/%s/i.test(shortcutURL) || /%s/i.test(postData)) {
|
||||
let charset = "";
|
||||
const re = /^(.*)\&mozcharset=([a-zA-Z][_\-a-zA-Z0-9]+)\s*$/;
|
||||
let matches = shortcutURL.match(re);
|
||||
if (matches)
|
||||
[, shortcutURL, charset] = matches;
|
||||
else {
|
||||
// Try to get the saved character-set.
|
||||
try {
|
||||
// makeURI throws if URI is invalid.
|
||||
// Will return an empty string if character-set is not found.
|
||||
charset = PlacesUtils.history.getCharsetForURI(Util.makeURI(shortcutURL));
|
||||
} catch (e) { dump("--- error " + e + "\n"); }
|
||||
let offset = aURL.indexOf(" ");
|
||||
if (offset > 0) {
|
||||
keyword = aURL.substr(0, offset);
|
||||
param = aURL.substr(offset + 1);
|
||||
}
|
||||
|
||||
let encodedParam = "";
|
||||
if (charset)
|
||||
encodedParam = escape(convertFromUnicode(charset, param));
|
||||
else // Default charset is UTF-8
|
||||
encodedParam = encodeURIComponent(param);
|
||||
if (!aPostDataRef)
|
||||
aPostDataRef = {};
|
||||
|
||||
shortcutURL = shortcutURL.replace(/%s/g, encodedParam).replace(/%S/g, param);
|
||||
let engine = Services.search.getEngineByAlias(keyword);
|
||||
if (engine) {
|
||||
let submission = engine.getSubmission(param);
|
||||
aPostDataRef.value = submission.postData;
|
||||
throw new Task.Result(submission.uri.spec);
|
||||
}
|
||||
|
||||
if (/%s/i.test(postData)) // POST keyword
|
||||
aPostDataRef.value = getPostDataStream(postData, param, encodedParam, "application/x-www-form-urlencoded");
|
||||
} else if (param) {
|
||||
// This keyword doesn't take a parameter, but one was provided. Just return
|
||||
// the original URL.
|
||||
aPostDataRef.value = null;
|
||||
try {
|
||||
[shortcutURL, aPostDataRef.value] = PlacesUtils.getURLAndPostDataForKeyword(keyword);
|
||||
} catch (e) {}
|
||||
|
||||
return aURL;
|
||||
}
|
||||
if (!shortcutURL)
|
||||
throw new Task.Result(aURL);
|
||||
|
||||
return shortcutURL;
|
||||
let postData = "";
|
||||
if (aPostDataRef.value)
|
||||
postData = unescape(aPostDataRef.value);
|
||||
|
||||
if (/%s/i.test(shortcutURL) || /%s/i.test(postData)) {
|
||||
let charset = "";
|
||||
const re = /^(.*)\&mozcharset=([a-zA-Z][_\-a-zA-Z0-9]+)\s*$/;
|
||||
let matches = shortcutURL.match(re);
|
||||
if (matches)
|
||||
[, shortcutURL, charset] = matches;
|
||||
else {
|
||||
// Try to get the saved character-set.
|
||||
try {
|
||||
// makeURI throws if URI is invalid.
|
||||
// Will return an empty string if character-set is not found.
|
||||
charset = yield PlacesUtils.getCharsetForURI(Util.makeURI(shortcutURL));
|
||||
} catch (e) { dump("--- error " + e + "\n"); }
|
||||
}
|
||||
|
||||
let encodedParam = "";
|
||||
if (charset)
|
||||
encodedParam = escape(convertFromUnicode(charset, param));
|
||||
else // Default charset is UTF-8
|
||||
encodedParam = encodeURIComponent(param);
|
||||
|
||||
shortcutURL = shortcutURL.replace(/%s/g, encodedParam).replace(/%S/g, param);
|
||||
|
||||
if (/%s/i.test(postData)) // POST keyword
|
||||
aPostDataRef.value = getPostDataStream(postData, param, encodedParam, "application/x-www-form-urlencoded");
|
||||
} else if (param) {
|
||||
// This keyword doesn't take a parameter, but one was provided. Just return
|
||||
// the original URL.
|
||||
aPostDataRef.value = null;
|
||||
|
||||
throw new Task.Result(aURL);
|
||||
}
|
||||
|
||||
throw new Task.Result(shortcutURL);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -28,6 +28,13 @@ static const WCHAR* kFirefoxExe = L"firefox.exe";
|
||||
static const WCHAR* kDefaultMetroBrowserIDPathKey = L"FirefoxURL";
|
||||
static const WCHAR* kDemoMetroBrowserIDPathKey = L"Mozilla.Firefox.URL";
|
||||
|
||||
CString sAppParams;
|
||||
CString sFirefoxPath;
|
||||
|
||||
// The tests file we write out for firefox.exe which contains test
|
||||
// startup command line paramters.
|
||||
#define kMetroTestFile "tests.ini"
|
||||
|
||||
static void Log(const wchar_t *fmt, ...)
|
||||
{
|
||||
va_list a = NULL;
|
||||
@ -134,7 +141,20 @@ static bool GetDefaultBrowserAppModelID(WCHAR* aIDBuffer,
|
||||
return true;
|
||||
}
|
||||
|
||||
CString sAppParams;
|
||||
// Tests.ini file cleanup helper
|
||||
class DeleteTestFileHelper
|
||||
{
|
||||
CStringA mTestFile;
|
||||
public:
|
||||
DeleteTestFileHelper(CStringA& aTestFile) :
|
||||
mTestFile(aTestFile) {}
|
||||
~DeleteTestFileHelper() {
|
||||
if (mTestFile.GetLength()) {
|
||||
Log(L"Deleting %s", CStringW(mTestFile));
|
||||
DeleteFileA(mTestFile);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static bool Launch()
|
||||
{
|
||||
@ -143,7 +163,7 @@ static bool Launch()
|
||||
DWORD processID;
|
||||
|
||||
// The interface that allows us to activate the browser
|
||||
IApplicationActivationManager* activateMgr = NULL;
|
||||
CComPtr<IApplicationActivationManager> activateMgr;
|
||||
if (FAILED(CoCreateInstance(CLSID_ApplicationActivationManager, NULL,
|
||||
CLSCTX_LOCAL_SERVER,
|
||||
IID_IApplicationActivationManager,
|
||||
@ -157,7 +177,6 @@ static bool Launch()
|
||||
// Activation is based on the browser's registered app model id
|
||||
if (!GetDefaultBrowserAppModelID(appModelID, (sizeof(appModelID)/sizeof(WCHAR)))) {
|
||||
Fail(L"GetDefaultBrowserAppModelID failed.");
|
||||
activateMgr->Release();
|
||||
return false;
|
||||
}
|
||||
Log(L"App model id='%s'", appModelID);
|
||||
@ -167,7 +186,6 @@ static bool Launch()
|
||||
hr = CoAllowSetForegroundWindow(activateMgr, NULL);
|
||||
if (FAILED(hr)) {
|
||||
Fail(L"CoAllowSetForegroundWindow result %X", hr);
|
||||
activateMgr->Release();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -175,34 +193,49 @@ static bool Launch()
|
||||
|
||||
// Because we can't pass command line args, we store params in a
|
||||
// tests.ini file in dist/bin which the browser picks up on launch.
|
||||
char path[MAX_PATH];
|
||||
if (!GetModuleFileNameA(NULL, path, MAX_PATH)) {
|
||||
Fail(L"GetModuleFileNameA errorno=%d", GetLastError());
|
||||
activateMgr->Release();
|
||||
return false;
|
||||
CStringA testFilePath;
|
||||
if (sFirefoxPath.GetLength()) {
|
||||
// Use the firefoxpath passed to us by the test harness
|
||||
int index = sFirefoxPath.ReverseFind('\\');
|
||||
if (index == -1) {
|
||||
Fail(L"Bad firefoxpath path");
|
||||
return false;
|
||||
}
|
||||
testFilePath = sFirefoxPath.Mid(0, index);
|
||||
testFilePath += "\\";
|
||||
testFilePath += kMetroTestFile;
|
||||
} else {
|
||||
// Use the module path
|
||||
char path[MAX_PATH];
|
||||
if (!GetModuleFileNameA(NULL, path, MAX_PATH)) {
|
||||
Fail(L"GetModuleFileNameA errorno=%d", GetLastError());
|
||||
return false;
|
||||
}
|
||||
char* slash = strrchr(path, '\\');
|
||||
if (!slash)
|
||||
return false;
|
||||
*slash = '\0'; // no trailing slash
|
||||
testFilePath = path;
|
||||
testFilePath += "\\";
|
||||
testFilePath += kMetroTestFile;
|
||||
}
|
||||
char* slash = strrchr(path, '\\');
|
||||
if (!slash)
|
||||
return false;
|
||||
*slash = '\0'; // no trailing slash
|
||||
CStringA testFilePath = path;
|
||||
testFilePath += "\\tests.ini";
|
||||
|
||||
Log(L"Writing out tests.ini to: '%s'", CStringW(testFilePath));
|
||||
HANDLE hTestFile = CreateFileA(testFilePath, GENERIC_WRITE,
|
||||
0, NULL, CREATE_ALWAYS,
|
||||
FILE_ATTRIBUTE_NORMAL,
|
||||
NULL);
|
||||
if (hTestFile == INVALID_HANDLE_VALUE) {
|
||||
Fail(L"CreateFileA errorno=%d", GetLastError());
|
||||
activateMgr->Release();
|
||||
return false;
|
||||
}
|
||||
|
||||
DeleteTestFileHelper dtf(testFilePath);
|
||||
|
||||
CStringA asciiParams = sAppParams;
|
||||
if (!WriteFile(hTestFile, asciiParams, asciiParams.GetLength(), NULL, 0)) {
|
||||
CloseHandle(hTestFile);
|
||||
Fail(L"WriteFile errorno=%d", GetLastError());
|
||||
activateMgr->Release();
|
||||
return false;
|
||||
}
|
||||
FlushFileBuffers(hTestFile);
|
||||
@ -212,7 +245,6 @@ static bool Launch()
|
||||
hr = activateMgr->ActivateApplication(appModelID, L"", AO_NOERRORUI, &processID);
|
||||
if (FAILED(hr)) {
|
||||
Fail(L"ActivateApplication result %X", hr);
|
||||
activateMgr->Release();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -221,7 +253,6 @@ static bool Launch()
|
||||
HANDLE child = OpenProcess(SYNCHRONIZE, FALSE, processID);
|
||||
if (!child) {
|
||||
Fail(L"Couldn't find child process. (%d)", GetLastError());
|
||||
activateMgr->Release();
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -237,8 +268,6 @@ static bool Launch()
|
||||
}
|
||||
|
||||
Log(L"Exiting.");
|
||||
activateMgr->Release();
|
||||
DeleteFileA(testFilePath);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -247,11 +276,29 @@ int wmain(int argc, WCHAR* argv[])
|
||||
CoInitialize(NULL);
|
||||
|
||||
int idx;
|
||||
bool firefoxParam = false;
|
||||
for (idx = 1; idx < argc; idx++) {
|
||||
CString param = argv[idx];
|
||||
param.Trim();
|
||||
|
||||
// Pickup the firefox path param and store it, we'll need this
|
||||
// when we create the tests.ini file.
|
||||
if (param == "-firefoxpath") {
|
||||
firefoxParam = true;
|
||||
continue;
|
||||
} else if (firefoxParam) {
|
||||
firefoxParam = false;
|
||||
sFirefoxPath = param;
|
||||
continue;
|
||||
}
|
||||
|
||||
sAppParams.Append(argv[idx]);
|
||||
sAppParams.Append(L" ");
|
||||
}
|
||||
sAppParams.Trim();
|
||||
if (sFirefoxPath.GetLength()) {
|
||||
Log(L"firefoxpath: '%s'", sFirefoxPath);
|
||||
}
|
||||
Log(L"args: '%s'", sAppParams);
|
||||
Launch();
|
||||
|
||||
|
@ -20,9 +20,9 @@
|
||||
%ifdef WINDOWS_AERO
|
||||
-moz-margin-start: 8px;
|
||||
%endif
|
||||
/* Prevent flickering when changing states. */
|
||||
min-height: 32px;
|
||||
min-width: 32px;
|
||||
/* explicitly size the icon, so size doesn't vary on hidpi systems */
|
||||
height: 32px;
|
||||
width: 32px;
|
||||
}
|
||||
|
||||
.blockedIcon {
|
||||
|
@ -53,7 +53,7 @@ if test -z $DONT_POPULATE_VIRTUALENV; then
|
||||
dnl virtualenv is present and up to date. It sanitizes the environment
|
||||
dnl for us, so we don't need to clean anything out.
|
||||
$PYTHON $_virtualenv_populate_path \
|
||||
$_virtualenv_topsrcdir $MOZ_BUILD_ROOT/_virtualenv || exit 1
|
||||
$_virtualenv_topsrcdir $MOZ_BUILD_ROOT $MOZ_BUILD_ROOT/_virtualenv || exit 1
|
||||
|
||||
case "$host_os" in
|
||||
mingw*)
|
||||
|
@ -1139,7 +1139,7 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
|
||||
return True
|
||||
|
||||
foundZombie = False
|
||||
self.log.info('INFO | automation.py | Reading PID log: %s', processLog)
|
||||
self.log.info('INFO | zombiecheck | Reading PID log: %s', processLog)
|
||||
processList = []
|
||||
pidRE = re.compile(r'launched child process (\d+)$')
|
||||
processLogFD = open(processLog)
|
||||
@ -1151,10 +1151,10 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
|
||||
processLogFD.close()
|
||||
|
||||
for processPID in processList:
|
||||
self.log.info("INFO | automation.py | Checking for orphan process with PID: %d", processPID)
|
||||
self.log.info("INFO | zombiecheck | Checking for orphan process with PID: %d", processPID)
|
||||
if self.isPidAlive(processPID):
|
||||
foundZombie = True
|
||||
self.log.info("TEST-UNEXPECTED-FAIL | automation.py | child process %d still alive after shutdown", processPID)
|
||||
self.log.info("TEST-UNEXPECTED-FAIL | zombiecheck | child process %d still alive after shutdown", processPID)
|
||||
self.killPid(processPID)
|
||||
return foundZombie
|
||||
|
||||
|
@ -22,6 +22,8 @@ SEARCH_PATHS = [
|
||||
'xpcom/idl-parser',
|
||||
'testing',
|
||||
'testing/xpcshell',
|
||||
'testing/mozbase/mozcrash',
|
||||
'testing/mozbase/mozlog',
|
||||
'testing/mozbase/mozprocess',
|
||||
'testing/mozbase/mozfile',
|
||||
'testing/mozbase/mozinfo',
|
||||
|
@ -10,6 +10,7 @@ import re
|
||||
import shutil
|
||||
import tempfile
|
||||
import time
|
||||
import traceback
|
||||
|
||||
from automation import Automation
|
||||
from devicemanager import NetworkTools
|
||||
@ -106,11 +107,14 @@ class B2GRemoteAutomation(Automation):
|
||||
def checkForCrashes(self, directory, symbolsPath):
|
||||
crashed = False
|
||||
remote_dump_dir = self._remoteProfile + '/minidumps'
|
||||
print "checking for crashes in '%s'" % remote_dump_dir
|
||||
if self._devicemanager.dirExists(remote_dump_dir):
|
||||
local_dump_dir = tempfile.mkdtemp()
|
||||
self._devicemanager.getDirectory(remote_dump_dir, local_dump_dir)
|
||||
try:
|
||||
crashed = mozcrash.check_for_crashes(local_dump_dir, symbolsPath, test_name=self.lastTestSeen)
|
||||
except:
|
||||
traceback.print_exc()
|
||||
finally:
|
||||
shutil.rmtree(local_dump_dir)
|
||||
self._devicemanager.removeDir(remote_dump_dir)
|
||||
|
@ -111,9 +111,9 @@ def build_one_stage_aux(stage_dir, is_stage_one):
|
||||
"--enable-targets=x86,x86_64,arm",
|
||||
"--disable-assertions",
|
||||
"--prefix=%s" % inst_dir,
|
||||
"--with-gcc-toolchain=/tools/gcc-4.5-0moz3"]
|
||||
"--with-gcc-toolchain=/tools/gcc-4.7.2-0moz1"]
|
||||
build_package(llvm_source_dir, build_dir, configure_opts,
|
||||
["CLANG_IS_PRODUCTION=1"])
|
||||
[])
|
||||
|
||||
if isDarwin:
|
||||
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.7'
|
||||
|
2
build/unix/headers/bits/c++config.h
Normal file
2
build/unix/headers/bits/c++config.h
Normal file
@ -0,0 +1,2 @@
|
||||
#include_next <bits/c++config.h>
|
||||
#undef _GLIBCXX_USE_FLOAT128
|
@ -15,3 +15,4 @@ mozilla.pth:config
|
||||
mozilla.pth:xpcom/typelib/xpt/tools
|
||||
copy:build/buildconfig.py
|
||||
packages.txt:testing/mozbase/packages.txt
|
||||
objdir:build
|
||||
|
@ -22,7 +22,8 @@ MINIMUM_PYTHON_MINOR = 7
|
||||
class VirtualenvManager(object):
|
||||
"""Contains logic for managing virtualenvs for building the tree."""
|
||||
|
||||
def __init__(self, topsrcdir, virtualenv_path, log_handle, manifest_path):
|
||||
def __init__(self, topsrcdir, topobjdir, virtualenv_path, log_handle,
|
||||
manifest_path):
|
||||
"""Create a new manager.
|
||||
|
||||
Each manager is associated with a source directory, a path where you
|
||||
@ -30,6 +31,7 @@ class VirtualenvManager(object):
|
||||
"""
|
||||
assert os.path.isabs(manifest_path), "manifest_path must be an absolute path: %s" % (manifest_path)
|
||||
self.topsrcdir = topsrcdir
|
||||
self.topobjdir = topobjdir
|
||||
self.virtualenv_root = virtualenv_path
|
||||
self.log_handle = log_handle
|
||||
self.manifest_path = manifest_path
|
||||
@ -78,6 +80,7 @@ class VirtualenvManager(object):
|
||||
for submanifest in submanifests:
|
||||
submanifest = os.path.join(self.topsrcdir, submanifest)
|
||||
submanager = VirtualenvManager(self.topsrcdir,
|
||||
self.topobjdir,
|
||||
self.virtualenv_root,
|
||||
self.log_handle,
|
||||
submanifest)
|
||||
@ -151,6 +154,14 @@ class VirtualenvManager(object):
|
||||
copy -- Copies the given file in the virtualenv site packages
|
||||
directory.
|
||||
|
||||
packages.txt -- Denotes that the specified path is a child manifest. It
|
||||
will be read and processed as if its contents were concatenated
|
||||
into the manifest being read.
|
||||
|
||||
objdir -- Denotes a relative path in the object directory to add to the
|
||||
search path. e.g. "objdir:build" will add $topobjdir/build to the
|
||||
search path.
|
||||
|
||||
Note that the Python interpreter running this function should be the
|
||||
one from the virtualenv. If it is the system Python or if the
|
||||
environment is not configured properly, packages could be installed
|
||||
@ -185,6 +196,7 @@ class VirtualenvManager(object):
|
||||
src = os.path.join(self.topsrcdir, package[1])
|
||||
assert os.path.isfile(src), "'%s' does not exist" % src
|
||||
submanager = VirtualenvManager(self.topsrcdir,
|
||||
self.topobjdir,
|
||||
self.virtualenv_root,
|
||||
self.log_handle,
|
||||
src)
|
||||
@ -212,6 +224,15 @@ class VirtualenvManager(object):
|
||||
file=self.log_handle)
|
||||
return False
|
||||
|
||||
if package[0] == 'objdir':
|
||||
assert len(package) == 2
|
||||
path = os.path.join(self.topobjdir, package[1])
|
||||
|
||||
with open(os.path.join(python_lib, 'objdir.pth'), 'a') as f:
|
||||
f.write('%s\n' % path)
|
||||
|
||||
return True
|
||||
|
||||
raise Exception('Unknown action: %s' % package[0])
|
||||
|
||||
# We always target the OS X deployment target that Python itself was
|
||||
@ -293,7 +314,7 @@ class VirtualenvManager(object):
|
||||
# the virtualenv for paths to be proper.
|
||||
|
||||
args = [self.python_path, __file__, 'populate', self.topsrcdir,
|
||||
self.virtualenv_root]
|
||||
self.topobjdir, self.virtualenv_root]
|
||||
|
||||
result = subprocess.call(args, stdout=self.log_handle,
|
||||
stderr=subprocess.STDOUT, cwd=self.topsrcdir)
|
||||
@ -329,26 +350,29 @@ def verify_python_version(log_handle):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 3:
|
||||
print('Usage: populate_virtualenv.py /path/to/topsrcdir /path/to/virtualenv')
|
||||
if len(sys.argv) < 4:
|
||||
print('Usage: populate_virtualenv.py /path/to/topsrcdir /path/to/topobjdir /path/to/virtualenv')
|
||||
sys.exit(1)
|
||||
|
||||
verify_python_version(sys.stdout)
|
||||
|
||||
topsrcdir = sys.argv[1]
|
||||
virtualenv_path = sys.argv[2]
|
||||
topobjdir = sys.argv[2]
|
||||
virtualenv_path = sys.argv[3]
|
||||
populate = False
|
||||
|
||||
# This should only be called internally.
|
||||
if sys.argv[1] == 'populate':
|
||||
populate = True
|
||||
topsrcdir = sys.argv[2]
|
||||
virtualenv_path = sys.argv[3]
|
||||
topobjdir = sys.argv[3]
|
||||
virtualenv_path = sys.argv[4]
|
||||
|
||||
# path to default packages.txt
|
||||
manifest_path = os.path.join(topsrcdir, 'build', 'virtualenv', 'packages.txt')
|
||||
|
||||
manager = VirtualenvManager(topsrcdir, virtualenv_path, sys.stdout, manifest_path)
|
||||
manager = VirtualenvManager(topsrcdir, topobjdir, virtualenv_path,
|
||||
sys.stdout, manifest_path)
|
||||
|
||||
if populate:
|
||||
manager.populate()
|
||||
|
@ -330,7 +330,7 @@ nsScriptSecurityManager::GetChannelPrincipal(nsIChannel* aChannel,
|
||||
}
|
||||
|
||||
// OK, get the principal from the URI. Make sure this does the same thing
|
||||
// as nsDocument::Reset and nsXULDocument::StartDocumentLoad.
|
||||
// as nsDocument::Reset and XULDocument::StartDocumentLoad.
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
47
configure.in
47
configure.in
@ -1019,10 +1019,10 @@ MOZ_PNG_LIBS='$(call EXPAND_LIBNAME_PATH,mozpng,$(DEPTH)/media/libpng)'
|
||||
|
||||
MOZ_JS_STATIC_LIBS='$(call EXPAND_LIBNAME_PATH,js_static,$(LIBXUL_DIST)/lib)'
|
||||
MOZ_JS_SHARED_LIBS='$(call EXPAND_LIBNAME_PATH,mozjs,$(LIBXUL_DIST)/lib)'
|
||||
DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxpcom -lxpcom_core -lmozalloc'
|
||||
DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/bin -lxul -lxpcom_core -lmozalloc'
|
||||
MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(prefix)/lib'
|
||||
XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxpcom -lmozalloc'
|
||||
LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) -lxul'
|
||||
XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/bin -lxul -lmozalloc'
|
||||
LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS)'
|
||||
XPCOM_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) $(XPCOM_FROZEN_LDOPTS)'
|
||||
XPCOM_STANDALONE_GLUE_LDOPTS='$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX)'
|
||||
|
||||
@ -1426,7 +1426,7 @@ if test "$GNU_CC"; then
|
||||
MOZ_C_SUPPORTS_WARNING(-W, type-limits, ac_c_has_wtype_limits)
|
||||
MOZ_C_SUPPORTS_WARNING(-W, empty-body, ac_c_has_wempty_body)
|
||||
MOZ_C_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
|
||||
|
||||
|
||||
# Turn off the following warnings that -Wall turns on:
|
||||
# -Wno-unused - lots of violations in third-party code
|
||||
#
|
||||
@ -1489,7 +1489,7 @@ if test "$GNU_CXX"; then
|
||||
MOZ_CXX_SUPPORTS_WARNING(-W, error=return-type, ac_cxx_has_werror_return_type)
|
||||
MOZ_CXX_SUPPORTS_WARNING(-W, type-limits, ac_cxx_has_wtype_limits)
|
||||
MOZ_CXX_SUPPORTS_WARNING(-W, empty-body, ac_cxx_has_wempty_body)
|
||||
MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_c_has_sign_compare)
|
||||
MOZ_CXX_SUPPORTS_WARNING(-W, sign-compare, ac_cxx_has_sign_compare)
|
||||
|
||||
# Turn off the following warnings that -Wall turns on:
|
||||
# -Wno-invalid-offsetof - we use offsetof on non-POD types frequently
|
||||
@ -2116,8 +2116,8 @@ ia64*-hpux*)
|
||||
# mingw doesn't require kernel32, user32, and advapi32 explicitly
|
||||
LIBS="$LIBS -luuid -lgdi32 -lwinmm -lwsock32 -luserenv -lsecur32 -lnetapi32"
|
||||
MOZ_FIX_LINK_PATHS=
|
||||
DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxpcom -lxpcom_core -lmozalloc'
|
||||
XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxpcom -lmozalloc'
|
||||
DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib -lxul -lxpcom_core -lmozalloc'
|
||||
XPCOM_FROZEN_LDOPTS='-L$(LIBXUL_DIST)/lib -lxul -lmozalloc'
|
||||
DLL_PREFIX=
|
||||
IMPORT_LIB_SUFFIX=dll.a
|
||||
|
||||
@ -2182,9 +2182,9 @@ ia64*-hpux*)
|
||||
WARNINGS_AS_ERRORS='-WX'
|
||||
MOZ_OPTIMIZE_FLAGS='-O1'
|
||||
MOZ_FIX_LINK_PATHS=
|
||||
DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
|
||||
XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
|
||||
LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
|
||||
DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
|
||||
XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
|
||||
LIBXUL_LIBS='$(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
|
||||
MOZ_COMPONENT_NSPR_LIBS='$(NSPR_LIBS)'
|
||||
LDFLAGS="$LDFLAGS -LARGEADDRESSAWARE -NXCOMPAT"
|
||||
dnl For profile-guided optimization
|
||||
@ -2360,8 +2360,8 @@ ia64*-hpux*)
|
||||
MOZ_DEBUG_FLAGS="-g -fno-inline"
|
||||
MOZ_OPTIMIZE_FLAGS="-O2"
|
||||
MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
|
||||
DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
|
||||
LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
|
||||
DYNAMIC_XPCOM_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/xpcom_core.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
|
||||
LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
|
||||
TARGET_MD_ARCH=os2
|
||||
_PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
|
||||
RC=rc.exe
|
||||
@ -2715,9 +2715,20 @@ if test "$GNU_CXX"; then
|
||||
[AC_TRY_COMPILE([#include <memory>], [],
|
||||
ac_cv_cxx0x_headers_bug="no",
|
||||
ac_cv_cxx0x_headers_bug="yes")])
|
||||
CXXFLAGS="$_SAVE_CXXFLAGS"
|
||||
if test "$ac_cv_cxx0x_headers_bug" = "no"; then
|
||||
CXXFLAGS="$CXXFLAGS -std=gnu++0x"
|
||||
|
||||
if test "$CLANG_CXX" -a "$ac_cv_cxx0x_headers_bug" = "yes"; then
|
||||
CXXFLAGS="$CXXFLAGS -I$_topsrcdir/build/unix/headers"
|
||||
AC_CACHE_CHECK(whether workaround for gcc c++0x headers conflict with clang works,
|
||||
ac_cv_cxx0x_clang_workaround,
|
||||
[AC_TRY_COMPILE([#include <memory>], [],
|
||||
ac_cv_cxx0x_clang_workaround="yes",
|
||||
ac_cv_cxx0x_clang_workaround="no")])
|
||||
|
||||
if test "ac_cv_cxx0x_clang_workaround" = "no"; then
|
||||
CXXFLAGS="$_SAVE_CXXFLAGS"
|
||||
fi
|
||||
elif test "$ac_cv_cxx0x_headers_bug" = "yes"; then
|
||||
CXXFLAGS="$_SAVE_CXXFLAGS"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -4585,7 +4596,8 @@ cairo-cocoa)
|
||||
TK_CFLAGS="-DNO_X11"
|
||||
CFLAGS="$CFLAGS $TK_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
|
||||
LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
|
||||
DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/bin/XUL -lxpcom_core -lmozalloc'
|
||||
XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL -lmozalloc'
|
||||
MOZ_USER_DIR="Mozilla"
|
||||
MOZ_FS_LAYOUT=bundle
|
||||
MOZ_WEBGL=1
|
||||
@ -4600,7 +4612,8 @@ cairo-uikit)
|
||||
TK_LIBS='-framework Foundation -framework CoreFoundation -framework CoreGraphics -framework CoreText'
|
||||
CFLAGS="$CFLAGS $TK_CFLAGS"
|
||||
CXXFLAGS="$CXXFLAGS $TK_CFLAGS"
|
||||
LIBXUL_LIBS='$(XPCOM_FROZEN_LDOPTS) $(LIBXUL_DIST)/bin/XUL'
|
||||
DYNAMIC_XPCOM_LIBS='$(LIBXUL_DIST)/bin/XUL -lxpcom_core -lmozalloc'
|
||||
XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/bin/XUL -lmozalloc'
|
||||
MOZ_USER_DIR="Mozilla"
|
||||
MOZ_FS_LAYOUT=bundle
|
||||
;;
|
||||
|
@ -110,8 +110,8 @@ typedef CallbackObjectHolder<NodeFilter, nsIDOMNodeFilter> NodeFilterHolder;
|
||||
} // namespace mozilla
|
||||
|
||||
#define NS_IDOCUMENT_IID \
|
||||
{ 0x45ce048f, 0x5970, 0x411e, \
|
||||
{ 0xaa, 0x99, 0x12, 0xed, 0x3a, 0x55, 0xc9, 0xc3 } }
|
||||
{ 0x699e0649, 0x55f2, 0x47f1, \
|
||||
{ 0x93, 0x38, 0xcd, 0x67, 0xf3, 0x2b, 0x04, 0xe9 } }
|
||||
|
||||
// Flag for AddStyleSheet().
|
||||
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
|
||||
@ -1306,7 +1306,9 @@ public:
|
||||
* Get the box object for an element. This is not exposed through a
|
||||
* scriptable interface except for XUL documents.
|
||||
*/
|
||||
NS_IMETHOD GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult) = 0;
|
||||
virtual already_AddRefed<nsIBoxObject>
|
||||
GetBoxObjectFor(mozilla::dom::Element* aElement,
|
||||
mozilla::ErrorResult& aRv) = 0;
|
||||
|
||||
/**
|
||||
* Get the compatibility mode for this document
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsXULDocument.h"
|
||||
#include "XULDocument.h"
|
||||
#include "nsIWindowMediator.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
@ -425,7 +425,7 @@ TraceActiveWindowGlobal(const uint64_t& aId, nsGlobalWindow*& aWindow, void* aCl
|
||||
#ifdef MOZ_XUL
|
||||
nsIDocument* doc = aWindow->GetExtantDoc();
|
||||
if (doc && doc->IsXUL()) {
|
||||
nsXULDocument* xulDoc = static_cast<nsXULDocument*>(doc);
|
||||
XULDocument* xulDoc = static_cast<XULDocument*>(doc);
|
||||
xulDoc->TraceProtos(closure->mTrc, closure->mGCNumber);
|
||||
}
|
||||
#endif
|
||||
|
@ -156,7 +156,7 @@
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "mozilla/dom/EncodingUtils.h"
|
||||
#include "mozilla/dom/indexedDB/IndexedDatabaseManager.h"
|
||||
#include "mozilla/dom/quota/QuotaManager.h"
|
||||
#include "nsDOMNavigationTiming.h"
|
||||
#include "nsEventStateManager.h"
|
||||
|
||||
@ -1945,7 +1945,7 @@ nsDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup)
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
if (aChannel) {
|
||||
// Note: this code is duplicated in nsXULDocument::StartDocumentLoad and
|
||||
// Note: this code is duplicated in XULDocument::StartDocumentLoad and
|
||||
// nsScriptSecurityManager::GetChannelPrincipal.
|
||||
// Note: this should match nsDocShell::OnLoadingSite
|
||||
NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri));
|
||||
@ -5927,16 +5927,21 @@ nsDocument::DoNotifyPossibleTitleChange()
|
||||
true, true);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult)
|
||||
already_AddRefed<nsIBoxObject>
|
||||
nsDocument::GetBoxObjectFor(Element* aElement, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aElement));
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_UNEXPECTED);
|
||||
if (!aElement) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIDocument* doc = content->OwnerDoc();
|
||||
NS_ENSURE_TRUE(doc == this, NS_ERROR_DOM_WRONG_DOCUMENT_ERR);
|
||||
nsIDocument* doc = aElement->OwnerDoc();
|
||||
if (doc != this) {
|
||||
aRv.Throw(NS_ERROR_DOM_WRONG_DOCUMENT_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!mHasWarnedAboutBoxObjects && !content->IsXUL()) {
|
||||
if (!mHasWarnedAboutBoxObjects && !aElement->IsXUL()) {
|
||||
mHasWarnedAboutBoxObjects = true;
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
"BoxObjects", this,
|
||||
@ -5944,22 +5949,18 @@ nsDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult)
|
||||
"UseOfGetBoxObjectForWarning");
|
||||
}
|
||||
|
||||
*aResult = nullptr;
|
||||
|
||||
if (!mBoxObjectTable) {
|
||||
mBoxObjectTable = new nsInterfaceHashtable<nsPtrHashKey<nsIContent>, nsPIBoxObject>;
|
||||
mBoxObjectTable->Init(12);
|
||||
} else {
|
||||
// Want to use Get(content, aResult); but it's the wrong type
|
||||
*aResult = mBoxObjectTable->GetWeak(content);
|
||||
if (*aResult) {
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
nsCOMPtr<nsPIBoxObject> boxObject = mBoxObjectTable->Get(aElement);
|
||||
if (boxObject) {
|
||||
return boxObject.forget();
|
||||
}
|
||||
}
|
||||
|
||||
int32_t namespaceID;
|
||||
nsCOMPtr<nsIAtom> tag = BindingManager()->ResolveTag(content, &namespaceID);
|
||||
nsCOMPtr<nsIAtom> tag = BindingManager()->ResolveTag(aElement, &namespaceID);
|
||||
|
||||
nsAutoCString contractID("@mozilla.org/layout/xul-boxobject");
|
||||
if (namespaceID == kNameSpaceID_XUL) {
|
||||
@ -5984,19 +5985,18 @@ nsDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult)
|
||||
contractID += ";1";
|
||||
|
||||
nsCOMPtr<nsPIBoxObject> boxObject(do_CreateInstance(contractID.get()));
|
||||
if (!boxObject)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
boxObject->Init(content);
|
||||
|
||||
if (mBoxObjectTable) {
|
||||
mBoxObjectTable->Put(content, boxObject.get());
|
||||
if (!boxObject) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
*aResult = boxObject;
|
||||
NS_ADDREF(*aResult);
|
||||
boxObject->Init(aElement);
|
||||
|
||||
return NS_OK;
|
||||
if (mBoxObjectTable) {
|
||||
mBoxObjectTable->Put(aElement, boxObject.get());
|
||||
}
|
||||
|
||||
return boxObject.forget();
|
||||
}
|
||||
|
||||
void
|
||||
@ -7638,11 +7638,11 @@ nsDocument::CanSavePresentation(nsIRequest *aNewRequest)
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we have running IndexedDB transactions
|
||||
indexedDB::IndexedDatabaseManager* idbManager =
|
||||
win ? indexedDB::IndexedDatabaseManager::Get() : nullptr;
|
||||
if (idbManager && idbManager->HasOpenTransactions(win)) {
|
||||
return false;
|
||||
// Check if we have running offline storage transactions
|
||||
quota::QuotaManager* quotaManager =
|
||||
win ? quota::QuotaManager::Get() : nullptr;
|
||||
if (quotaManager && quotaManager->HasOpenTransactions(win)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef MOZ_WEBRTC
|
||||
|
@ -812,7 +812,8 @@ public:
|
||||
virtual NS_HIDDEN_(void) ForgetLink(mozilla::dom::Link* aLink);
|
||||
|
||||
NS_HIDDEN_(void) ClearBoxObjectFor(nsIContent* aContent);
|
||||
NS_IMETHOD GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult);
|
||||
already_AddRefed<nsIBoxObject> GetBoxObjectFor(mozilla::dom::Element* aElement,
|
||||
mozilla::ErrorResult& aRv);
|
||||
|
||||
virtual NS_HIDDEN_(nsresult) GetXBLChildNodesFor(nsIContent* aContent,
|
||||
nsIDOMNodeList** aResult);
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "nsIDOMBeforeUnloadEvent.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "mozilla/dom/BeforeUnloadEventBinding.h"
|
||||
|
||||
class nsDOMBeforeUnloadEvent : public nsDOMEvent,
|
||||
public nsIDOMBeforeUnloadEvent
|
||||
@ -15,7 +16,15 @@ class nsDOMBeforeUnloadEvent : public nsDOMEvent,
|
||||
public:
|
||||
nsDOMBeforeUnloadEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext, nsEvent* aEvent)
|
||||
: nsDOMEvent(aOwner, aPresContext, aEvent) {}
|
||||
: nsDOMEvent(aOwner, aPresContext, aEvent)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope)
|
||||
{
|
||||
return mozilla::dom::BeforeUnloadEventBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
|
@ -30,6 +30,8 @@ nsDOMCompositionEvent::nsDOMCompositionEvent(mozilla::dom::EventTarget* aOwner,
|
||||
|
||||
mData = static_cast<nsCompositionEvent*>(mEvent)->data;
|
||||
// TODO: Native event should have locale information.
|
||||
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
nsDOMCompositionEvent::~nsDOMCompositionEvent()
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIDOMCompositionEvent.h"
|
||||
#include "mozilla/dom/CompositionEventBinding.h"
|
||||
|
||||
class nsDOMCompositionEvent : public nsDOMUIEvent,
|
||||
public nsIDOMCompositionEvent
|
||||
@ -23,6 +24,24 @@ public:
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
NS_DECL_NSIDOMCOMPOSITIONEVENT
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope)
|
||||
{
|
||||
return mozilla::dom::CompositionEventBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
void
|
||||
InitCompositionEvent(const nsAString& aType,
|
||||
bool aCanBubble,
|
||||
bool aCancelable,
|
||||
nsIDOMWindow* aView,
|
||||
const nsAString& aData,
|
||||
const nsAString& aLocale,
|
||||
mozilla::ErrorResult& aRv)
|
||||
{
|
||||
aRv = InitCompositionEvent(aType, aCanBubble, aCancelable, aView,
|
||||
aData, aLocale);
|
||||
}
|
||||
|
||||
protected:
|
||||
nsString mData;
|
||||
nsString mLocale;
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "DOMMediaStream.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
|
||||
#include "VideoUtils.h"
|
||||
#include "MediaEngine.h"
|
||||
|
@ -10,6 +10,9 @@
|
||||
#include "WMFUtils.h"
|
||||
#include "MediaDecoderStateMachine.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "WinUtils.h"
|
||||
|
||||
using namespace mozilla::widget;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -86,27 +89,12 @@ WMFDecoder::UnloadDLLs()
|
||||
wmf::UnloadDLLs();
|
||||
}
|
||||
|
||||
bool IsWindows7OrLater()
|
||||
{
|
||||
OSVERSIONINFO versionInfo;
|
||||
versionInfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
|
||||
if (!GetVersionEx(&versionInfo)) {
|
||||
return false;
|
||||
}
|
||||
// Note: Win Vista = 6.0
|
||||
// Win 7 = 6.1
|
||||
// Win 8 = 6.2
|
||||
return versionInfo.dwMajorVersion > 6 ||
|
||||
(versionInfo.dwMajorVersion == 6 && versionInfo.dwMinorVersion >= 1);
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
WMFDecoder::IsEnabled()
|
||||
{
|
||||
// We only use WMF on Windows 7 and up, until we can properly test Vista
|
||||
// and how it responds with and without the Platform Update installed.
|
||||
return IsWindows7OrLater() &&
|
||||
// We only use WMF on Windows Vista and up
|
||||
return WinUtils::GetWindowsVersion() >= WinUtils::VISTA_VERSION &&
|
||||
Preferences::GetBool("media.windows-media-foundation.enabled");
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,10 @@
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "prlog.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "WinUtils.h"
|
||||
#include "nsWindowsHelpers.h"
|
||||
|
||||
using namespace mozilla::widget;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -269,15 +273,15 @@ DisableBlockedDecoders()
|
||||
{
|
||||
RefPtr<IMFPluginControl> pluginControl;
|
||||
HRESULT hr = wmf::MFGetPluginControl(byRef(pluginControl));
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
|
||||
if (SUCCEEDED(hr) && pluginControl) {
|
||||
hr = DisableBlockedDecoders(pluginControl,
|
||||
MFT_CATEGORY_VIDEO_DECODER);
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
|
||||
|
||||
hr = DisableBlockedDecoders(pluginControl,
|
||||
MFT_CATEGORY_VIDEO_DECODER);
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
|
||||
|
||||
hr = DisableBlockedDecoders(pluginControl,
|
||||
MFT_CATEGORY_AUDIO_DECODER);
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
|
||||
hr = DisableBlockedDecoders(pluginControl,
|
||||
MFT_CATEGORY_AUDIO_DECODER);
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr), hr);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@ -286,15 +290,15 @@ static bool sDLLsLoaded = false;
|
||||
static bool sFailedToLoadDlls = false;
|
||||
|
||||
struct WMFModule {
|
||||
const char* name;
|
||||
const wchar_t* name;
|
||||
HMODULE handle;
|
||||
};
|
||||
|
||||
static WMFModule sDLLs[] = {
|
||||
{ "mfplat.dll", NULL },
|
||||
{ "mfreadwrite.dll", NULL },
|
||||
{ "propsys.dll", NULL },
|
||||
{ "mf.dll", NULL }
|
||||
{ L"mfplat.dll", NULL },
|
||||
{ L"mfreadwrite.dll", NULL },
|
||||
{ L"propsys.dll", NULL },
|
||||
{ L"mf.dll", NULL }
|
||||
};
|
||||
|
||||
HRESULT
|
||||
@ -312,7 +316,7 @@ LoadDLLs()
|
||||
// Try to load all the required DLLs.
|
||||
uint32_t dllLength = NS_ARRAY_LENGTH(sDLLs);
|
||||
for (uint32_t i = 0; i < dllLength; i++) {
|
||||
sDLLs[i].handle = LoadLibraryA(sDLLs[i].name);
|
||||
sDLLs[i].handle = LoadLibrarySystem32(sDLLs[i].name);
|
||||
if (!sDLLs[i].handle) {
|
||||
sFailedToLoadDlls = true;
|
||||
NS_WARNING("Failed to load WMF DLLs");
|
||||
@ -367,9 +371,15 @@ UnloadDLLs()
|
||||
HRESULT
|
||||
MFStartup()
|
||||
{
|
||||
const int MF_VISTA_VERSION = (0x0001 << 16 | MF_API_VERSION);
|
||||
const int MF_WIN7_VERSION = (0x0002 << 16 | MF_API_VERSION);
|
||||
|
||||
DECL_FUNCTION_PTR(MFStartup, ULONG, DWORD);
|
||||
ENSURE_FUNCTION_PTR(MFStartup, Mfplat.dll)
|
||||
return MFStartupPtr(MF_VERSION, MFSTARTUP_FULL);
|
||||
if (WinUtils::GetWindowsVersion() == WinUtils::VISTA_VERSION)
|
||||
return MFStartupPtr(MF_VISTA_VERSION, MFSTARTUP_FULL);
|
||||
else
|
||||
return MFStartupPtr(MF_WIN7_VERSION, MFSTARTUP_FULL);
|
||||
}
|
||||
|
||||
HRESULT
|
||||
|
@ -50,7 +50,6 @@ CPPSRCS = \
|
||||
nsSVGPathGeometryElement.cpp \
|
||||
nsSVGPolyElement.cpp \
|
||||
nsSVGString.cpp \
|
||||
nsSVGRect.cpp \
|
||||
nsSVGUnknownElement.cpp \
|
||||
nsSVGViewBox.cpp \
|
||||
SVGAElement.cpp \
|
||||
@ -90,11 +89,13 @@ CPPSRCS = \
|
||||
SVGFEImageElement.cpp \
|
||||
SVGFEMergeElement.cpp \
|
||||
SVGFEMergeNodeElement.cpp \
|
||||
SVGFEMorphologyElement.cpp \
|
||||
SVGFEOffsetElement.cpp \
|
||||
SVGFEPointLightElement.cpp \
|
||||
SVGFESpecularLightingElement.cpp \
|
||||
SVGFESpotLightElement.cpp \
|
||||
SVGFETileElement.cpp \
|
||||
SVGFETurbulenceElement.cpp \
|
||||
SVGFilterElement.cpp \
|
||||
SVGForeignObjectElement.cpp \
|
||||
SVGFragmentIdentifier.cpp \
|
||||
@ -130,6 +131,7 @@ CPPSRCS = \
|
||||
SVGPolygonElement.cpp \
|
||||
SVGPolylineElement.cpp \
|
||||
SVGPreserveAspectRatio.cpp \
|
||||
SVGRect.cpp \
|
||||
SVGRectElement.cpp \
|
||||
SVGScriptElement.cpp \
|
||||
SVGSetElement.cpp \
|
||||
@ -165,7 +167,6 @@ EXPORTS = \
|
||||
nsSVGClass.h \
|
||||
nsSVGElement.h \
|
||||
nsSVGFeatures.h \
|
||||
nsSVGRect.h \
|
||||
SVGAttrValueWrapper.h \
|
||||
SVGStringList.h \
|
||||
$(NULL)
|
||||
@ -202,11 +203,13 @@ EXPORTS_mozilla/dom = \
|
||||
SVGFEImageElement.h \
|
||||
SVGFEMergeElement.h \
|
||||
SVGFEMergeNodeElement.h \
|
||||
SVGFEMorphologyElement.h \
|
||||
SVGFEOffsetElement.h \
|
||||
SVGFEPointLightElement.h \
|
||||
SVGFESpecularLightingElement.h \
|
||||
SVGFESpotLightElement.h \
|
||||
SVGFETileElement.h \
|
||||
SVGFETurbulenceElement.h \
|
||||
SVGFilterElement.h \
|
||||
SVGForeignObjectElement.h \
|
||||
SVGGElement.h \
|
||||
@ -223,6 +226,8 @@ EXPORTS_mozilla/dom = \
|
||||
SVGPatternElement.h \
|
||||
SVGPolygonElement.h \
|
||||
SVGPolylineElement.h \
|
||||
SVGRect.h \
|
||||
SVGIRect.h \
|
||||
SVGRectElement.h \
|
||||
SVGScriptElement.h \
|
||||
SVGSetElement.h \
|
||||
|
260
content/svg/content/src/SVGFEMorphologyElement.cpp
Normal file
260
content/svg/content/src/SVGFEMorphologyElement.cpp
Normal file
@ -0,0 +1,260 @@
|
||||
/* a*- Mode: C++; 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/. */
|
||||
|
||||
#include "mozilla/dom/SVGFEMorphologyElement.h"
|
||||
#include "mozilla/dom/SVGFEMorphologyElementBinding.h"
|
||||
#include "nsSVGFilterInstance.h"
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FEMorphology)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
JSObject*
|
||||
SVGFEMorphologyElement::WrapNode(JSContext* aCx, JSObject* aScope)
|
||||
{
|
||||
return SVGFEMorphologyElementBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
// Morphology Operators
|
||||
static const unsigned short SVG_OPERATOR_UNKNOWN = 0;
|
||||
static const unsigned short SVG_OPERATOR_ERODE = 1;
|
||||
static const unsigned short SVG_OPERATOR_DILATE = 2;
|
||||
|
||||
nsSVGElement::NumberPairInfo SVGFEMorphologyElement::sNumberPairInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::radius, 0, 0 }
|
||||
};
|
||||
|
||||
nsSVGEnumMapping SVGFEMorphologyElement::sOperatorMap[] = {
|
||||
{&nsGkAtoms::erode, SVG_OPERATOR_ERODE},
|
||||
{&nsGkAtoms::dilate, SVG_OPERATOR_DILATE},
|
||||
{nullptr, 0}
|
||||
};
|
||||
|
||||
nsSVGElement::EnumInfo SVGFEMorphologyElement::sEnumInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::_operator,
|
||||
sOperatorMap,
|
||||
SVG_OPERATOR_ERODE
|
||||
}
|
||||
};
|
||||
|
||||
nsSVGElement::StringInfo SVGFEMorphologyElement::sStringInfo[2] =
|
||||
{
|
||||
{ &nsGkAtoms::result, kNameSpaceID_None, true },
|
||||
{ &nsGkAtoms::in, kNameSpaceID_None, true }
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(SVGFEMorphologyElement,SVGFEMorphologyElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(SVGFEMorphologyElement,SVGFEMorphologyElementBase)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(SVGFEMorphologyElement)
|
||||
NS_NODE_INTERFACE_TABLE3(SVGFEMorphologyElement, nsIDOMNode, nsIDOMElement,
|
||||
nsIDOMSVGElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(SVGFEMorphologyElementBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEMorphologyElement)
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// SVGFEMorphologyElement methods
|
||||
|
||||
already_AddRefed<nsIDOMSVGAnimatedString>
|
||||
SVGFEMorphologyElement::In1()
|
||||
{
|
||||
return mStringAttributes[IN1].ToDOMAnimatedString(this);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGAnimatedEnumeration>
|
||||
SVGFEMorphologyElement::Operator()
|
||||
{
|
||||
return mEnumAttributes[OPERATOR].ToDOMAnimatedEnum(this);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber>
|
||||
SVGFEMorphologyElement::RadiusX()
|
||||
{
|
||||
return mNumberPairAttributes[RADIUS].ToDOMAnimatedNumber(nsSVGNumberPair::eFirst, this);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber>
|
||||
SVGFEMorphologyElement::RadiusY()
|
||||
{
|
||||
return mNumberPairAttributes[RADIUS].ToDOMAnimatedNumber(nsSVGNumberPair::eSecond, this);
|
||||
}
|
||||
|
||||
void
|
||||
SVGFEMorphologyElement::SetRadius(float rx, float ry)
|
||||
{
|
||||
mNumberPairAttributes[RADIUS].SetBaseValues(rx, ry, this);
|
||||
}
|
||||
|
||||
void
|
||||
SVGFEMorphologyElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
|
||||
{
|
||||
aSources.AppendElement(nsSVGStringInfo(&mStringAttributes[IN1], this));
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
SVGFEMorphologyElement::InflateRect(const nsIntRect& aRect,
|
||||
const nsSVGFilterInstance& aInstance)
|
||||
{
|
||||
int32_t rx, ry;
|
||||
GetRXY(&rx, &ry, aInstance);
|
||||
nsIntRect result = aRect;
|
||||
result.Inflate(std::max(0, rx), std::max(0, ry));
|
||||
return result;
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
SVGFEMorphologyElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
const nsSVGFilterInstance& aInstance)
|
||||
{
|
||||
return InflateRect(aSourceBBoxes[0], aInstance);
|
||||
}
|
||||
|
||||
void
|
||||
SVGFEMorphologyElement::ComputeNeededSourceBBoxes(const nsIntRect& aTargetBBox,
|
||||
nsTArray<nsIntRect>& aSourceBBoxes, const nsSVGFilterInstance& aInstance)
|
||||
{
|
||||
aSourceBBoxes[0] = InflateRect(aTargetBBox, aInstance);
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
SVGFEMorphologyElement::ComputeChangeBBox(const nsTArray<nsIntRect>& aSourceChangeBoxes,
|
||||
const nsSVGFilterInstance& aInstance)
|
||||
{
|
||||
return InflateRect(aSourceChangeBoxes[0], aInstance);
|
||||
}
|
||||
|
||||
#define MORPHOLOGY_EPSILON 0.0001
|
||||
|
||||
void
|
||||
SVGFEMorphologyElement::GetRXY(int32_t *aRX, int32_t *aRY,
|
||||
const nsSVGFilterInstance& aInstance)
|
||||
{
|
||||
// Subtract an epsilon here because we don't want a value that's just
|
||||
// slightly larger than an integer to round up to the next integer; it's
|
||||
// probably meant to be the integer it's close to, modulo machine precision
|
||||
// issues.
|
||||
*aRX = NSToIntCeil(aInstance.GetPrimitiveNumber(SVGContentUtils::X,
|
||||
&mNumberPairAttributes[RADIUS],
|
||||
nsSVGNumberPair::eFirst) -
|
||||
MORPHOLOGY_EPSILON);
|
||||
*aRY = NSToIntCeil(aInstance.GetPrimitiveNumber(SVGContentUtils::Y,
|
||||
&mNumberPairAttributes[RADIUS],
|
||||
nsSVGNumberPair::eSecond) -
|
||||
MORPHOLOGY_EPSILON);
|
||||
}
|
||||
|
||||
nsresult
|
||||
SVGFEMorphologyElement::Filter(nsSVGFilterInstance* instance,
|
||||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& rect)
|
||||
{
|
||||
int32_t rx, ry;
|
||||
GetRXY(&rx, &ry, *instance);
|
||||
|
||||
if (rx < 0 || ry < 0) {
|
||||
// XXX SVGContentUtils::ReportToConsole()
|
||||
return NS_OK;
|
||||
}
|
||||
if (rx == 0 && ry == 0) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Clamp radii to prevent completely insane values:
|
||||
rx = std::min(rx, 100000);
|
||||
ry = std::min(ry, 100000);
|
||||
|
||||
uint8_t* sourceData = aSources[0]->mImage->Data();
|
||||
uint8_t* targetData = aTarget->mImage->Data();
|
||||
int32_t stride = aTarget->mImage->Stride();
|
||||
uint8_t extrema[4]; // RGBA magnitude of extrema
|
||||
uint16_t op = mEnumAttributes[OPERATOR].GetAnimValue();
|
||||
|
||||
// Scan the kernel for each pixel to determine max/min RGBA values.
|
||||
for (int32_t y = rect.y; y < rect.YMost(); y++) {
|
||||
int32_t startY = std::max(0, y - ry);
|
||||
// We need to read pixels not just in 'rect', which is limited to
|
||||
// the dirty part of our filter primitive subregion, but all pixels in
|
||||
// the given radii from the source surface, so use the surface size here.
|
||||
int32_t endY = std::min(y + ry, instance->GetSurfaceHeight() - 1);
|
||||
for (int32_t x = rect.x; x < rect.XMost(); x++) {
|
||||
int32_t startX = std::max(0, x - rx);
|
||||
int32_t endX = std::min(x + rx, instance->GetSurfaceWidth() - 1);
|
||||
int32_t targIndex = y * stride + 4 * x;
|
||||
|
||||
for (int32_t i = 0; i < 4; i++) {
|
||||
extrema[i] = sourceData[targIndex + i];
|
||||
}
|
||||
for (int32_t y1 = startY; y1 <= endY; y1++) {
|
||||
for (int32_t x1 = startX; x1 <= endX; x1++) {
|
||||
for (int32_t i = 0; i < 4; i++) {
|
||||
uint8_t pixel = sourceData[y1 * stride + 4 * x1 + i];
|
||||
if ((extrema[i] > pixel &&
|
||||
op == SVG_OPERATOR_ERODE) ||
|
||||
(extrema[i] < pixel &&
|
||||
op == SVG_OPERATOR_DILATE)) {
|
||||
extrema[i] = pixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
targetData[targIndex ] = extrema[0];
|
||||
targetData[targIndex+1] = extrema[1];
|
||||
targetData[targIndex+2] = extrema[2];
|
||||
targetData[targIndex+3] = extrema[3];
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
SVGFEMorphologyElement::AttributeAffectsRendering(int32_t aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return SVGFEMorphologyElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::in ||
|
||||
aAttribute == nsGkAtoms::radius ||
|
||||
aAttribute == nsGkAtoms::_operator));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
nsSVGElement::NumberPairAttributesInfo
|
||||
SVGFEMorphologyElement::GetNumberPairInfo()
|
||||
{
|
||||
return NumberPairAttributesInfo(mNumberPairAttributes, sNumberPairInfo,
|
||||
ArrayLength(sNumberPairInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::EnumAttributesInfo
|
||||
SVGFEMorphologyElement::GetEnumInfo()
|
||||
{
|
||||
return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
|
||||
ArrayLength(sEnumInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::StringAttributesInfo
|
||||
SVGFEMorphologyElement::GetStringInfo()
|
||||
{
|
||||
return StringAttributesInfo(mStringAttributes, sStringInfo,
|
||||
ArrayLength(sStringInfo));
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
95
content/svg/content/src/SVGFEMorphologyElement.h
Normal file
95
content/svg/content/src/SVGFEMorphologyElement.h
Normal file
@ -0,0 +1,95 @@
|
||||
/* a*- Mode: C++; 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/. */
|
||||
|
||||
#ifndef mozilla_dom_SVGFEMorphologyElement_h
|
||||
#define mozilla_dom_SVGFEMorphologyElement_h
|
||||
|
||||
#include "nsSVGEnum.h"
|
||||
#include "nsSVGFilters.h"
|
||||
#include "nsSVGNumberPair.h"
|
||||
#include "nsSVGString.h"
|
||||
|
||||
nsresult NS_NewSVGFEMorphologyElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
typedef nsSVGFE SVGFEMorphologyElementBase;
|
||||
|
||||
class SVGFEMorphologyElement : public SVGFEMorphologyElementBase,
|
||||
public nsIDOMSVGElement
|
||||
{
|
||||
friend nsresult (::NS_NewSVGFEMorphologyElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo));
|
||||
protected:
|
||||
SVGFEMorphologyElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: SVGFEMorphologyElementBase(aNodeInfo)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
virtual JSObject* WrapNode(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
|
||||
|
||||
public:
|
||||
// interfaces:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
virtual nsresult Filter(nsSVGFilterInstance* aInstance,
|
||||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual bool AttributeAffectsRendering(
|
||||
int32_t aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
|
||||
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
|
||||
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
const nsSVGFilterInstance& aInstance);
|
||||
virtual void ComputeNeededSourceBBoxes(const nsIntRect& aTargetBBox,
|
||||
nsTArray<nsIntRect>& aSourceBBoxes, const nsSVGFilterInstance& aInstance);
|
||||
virtual nsIntRect ComputeChangeBBox(const nsTArray<nsIntRect>& aSourceChangeBoxes,
|
||||
const nsSVGFilterInstance& aInstance);
|
||||
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(SVGFEMorphologyElementBase::)
|
||||
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
|
||||
// WebIDL
|
||||
already_AddRefed<nsIDOMSVGAnimatedString> In1();
|
||||
already_AddRefed<nsIDOMSVGAnimatedEnumeration> Operator();
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber> RadiusX();
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber> RadiusY();
|
||||
void SetRadius(float rx, float ry);
|
||||
|
||||
protected:
|
||||
void GetRXY(int32_t *aRX, int32_t *aRY, const nsSVGFilterInstance& aInstance);
|
||||
nsIntRect InflateRect(const nsIntRect& aRect, const nsSVGFilterInstance& aInstance);
|
||||
|
||||
virtual NumberPairAttributesInfo GetNumberPairInfo();
|
||||
virtual EnumAttributesInfo GetEnumInfo();
|
||||
virtual StringAttributesInfo GetStringInfo();
|
||||
|
||||
enum { RADIUS };
|
||||
nsSVGNumberPair mNumberPairAttributes[1];
|
||||
static NumberPairInfo sNumberPairInfo[1];
|
||||
|
||||
enum { OPERATOR };
|
||||
nsSVGEnum mEnumAttributes[1];
|
||||
static nsSVGEnumMapping sOperatorMap[];
|
||||
static EnumInfo sEnumInfo[1];
|
||||
|
||||
enum { RESULT, IN1 };
|
||||
nsSVGString mStringAttributes[2];
|
||||
static StringInfo sStringInfo[2];
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_SVGFEMorphologyElement_h
|
435
content/svg/content/src/SVGFETurbulenceElement.cpp
Normal file
435
content/svg/content/src/SVGFETurbulenceElement.cpp
Normal file
@ -0,0 +1,435 @@
|
||||
/* a*- Mode: C++; 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/. */
|
||||
|
||||
#include "mozilla/dom/SVGFETurbulenceElement.h"
|
||||
#include "mozilla/dom/SVGFETurbulenceElementBinding.h"
|
||||
#include "nsSVGFilterInstance.h"
|
||||
#include "nsSVGUtils.h"
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FETurbulence)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
// Turbulence Types
|
||||
static const unsigned short SVG_TURBULENCE_TYPE_UNKNOWN = 0;
|
||||
static const unsigned short SVG_TURBULENCE_TYPE_FRACTALNOISE = 1;
|
||||
static const unsigned short SVG_TURBULENCE_TYPE_TURBULENCE = 2;
|
||||
|
||||
// Stitch Options
|
||||
static const unsigned short SVG_STITCHTYPE_UNKNOWN = 0;
|
||||
static const unsigned short SVG_STITCHTYPE_STITCH = 1;
|
||||
static const unsigned short SVG_STITCHTYPE_NOSTITCH = 2;
|
||||
|
||||
JSObject*
|
||||
SVGFETurbulenceElement::WrapNode(JSContext* aCx, JSObject* aScope)
|
||||
{
|
||||
return SVGFETurbulenceElementBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
nsSVGElement::NumberInfo SVGFETurbulenceElement::sNumberInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::seed, 0, false }
|
||||
};
|
||||
|
||||
nsSVGElement::NumberPairInfo SVGFETurbulenceElement::sNumberPairInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::baseFrequency, 0, 0 }
|
||||
};
|
||||
|
||||
nsSVGElement::IntegerInfo SVGFETurbulenceElement::sIntegerInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::numOctaves, 1 }
|
||||
};
|
||||
|
||||
nsSVGEnumMapping SVGFETurbulenceElement::sTypeMap[] = {
|
||||
{&nsGkAtoms::fractalNoise,
|
||||
SVG_TURBULENCE_TYPE_FRACTALNOISE},
|
||||
{&nsGkAtoms::turbulence,
|
||||
SVG_TURBULENCE_TYPE_TURBULENCE},
|
||||
{nullptr, 0}
|
||||
};
|
||||
|
||||
nsSVGEnumMapping SVGFETurbulenceElement::sStitchTilesMap[] = {
|
||||
{&nsGkAtoms::stitch,
|
||||
SVG_STITCHTYPE_STITCH},
|
||||
{&nsGkAtoms::noStitch,
|
||||
SVG_STITCHTYPE_NOSTITCH},
|
||||
{nullptr, 0}
|
||||
};
|
||||
|
||||
nsSVGElement::EnumInfo SVGFETurbulenceElement::sEnumInfo[2] =
|
||||
{
|
||||
{ &nsGkAtoms::type,
|
||||
sTypeMap,
|
||||
SVG_TURBULENCE_TYPE_TURBULENCE
|
||||
},
|
||||
{ &nsGkAtoms::stitchTiles,
|
||||
sStitchTilesMap,
|
||||
SVG_STITCHTYPE_NOSTITCH
|
||||
}
|
||||
};
|
||||
|
||||
nsSVGElement::StringInfo SVGFETurbulenceElement::sStringInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::result, kNameSpaceID_None, true }
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(SVGFETurbulenceElement,SVGFETurbulenceElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(SVGFETurbulenceElement,SVGFETurbulenceElementBase)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(SVGFETurbulenceElement)
|
||||
NS_NODE_INTERFACE_TABLE3(SVGFETurbulenceElement, nsIDOMNode, nsIDOMElement,
|
||||
nsIDOMSVGElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(SVGFETurbulenceElementBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFETurbulenceElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber>
|
||||
SVGFETurbulenceElement::BaseFrequencyX()
|
||||
{
|
||||
return mNumberPairAttributes[BASE_FREQ].ToDOMAnimatedNumber(nsSVGNumberPair::eFirst, this);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber>
|
||||
SVGFETurbulenceElement::BaseFrequencyY()
|
||||
{
|
||||
return mNumberPairAttributes[BASE_FREQ].ToDOMAnimatedNumber(nsSVGNumberPair::eSecond, this);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGAnimatedInteger>
|
||||
SVGFETurbulenceElement::NumOctaves()
|
||||
{
|
||||
return mIntegerAttributes[OCTAVES].ToDOMAnimatedInteger(this);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber>
|
||||
SVGFETurbulenceElement::Seed()
|
||||
{
|
||||
return mNumberAttributes[SEED].ToDOMAnimatedNumber(this);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGAnimatedEnumeration>
|
||||
SVGFETurbulenceElement::StitchTiles()
|
||||
{
|
||||
return mEnumAttributes[STITCHTILES].ToDOMAnimatedEnum(this);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGAnimatedEnumeration>
|
||||
SVGFETurbulenceElement::Type()
|
||||
{
|
||||
return mEnumAttributes[TYPE].ToDOMAnimatedEnum(this);
|
||||
}
|
||||
|
||||
nsresult
|
||||
SVGFETurbulenceElement::Filter(nsSVGFilterInstance* instance,
|
||||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& rect)
|
||||
{
|
||||
uint8_t* targetData = aTarget->mImage->Data();
|
||||
uint32_t stride = aTarget->mImage->Stride();
|
||||
|
||||
nsIntRect filterSubregion(int32_t(aTarget->mFilterPrimitiveSubregion.X()),
|
||||
int32_t(aTarget->mFilterPrimitiveSubregion.Y()),
|
||||
int32_t(aTarget->mFilterPrimitiveSubregion.Width()),
|
||||
int32_t(aTarget->mFilterPrimitiveSubregion.Height()));
|
||||
|
||||
float fX = mNumberPairAttributes[BASE_FREQ].GetAnimValue(nsSVGNumberPair::eFirst);
|
||||
float fY = mNumberPairAttributes[BASE_FREQ].GetAnimValue(nsSVGNumberPair::eSecond);
|
||||
float seed = mNumberAttributes[OCTAVES].GetAnimValue();
|
||||
int32_t octaves = mIntegerAttributes[OCTAVES].GetAnimValue();
|
||||
uint16_t type = mEnumAttributes[TYPE].GetAnimValue();
|
||||
uint16_t stitch = mEnumAttributes[STITCHTILES].GetAnimValue();
|
||||
|
||||
InitSeed((int32_t)seed);
|
||||
|
||||
// XXXroc this makes absolutely no sense to me.
|
||||
float filterX = instance->GetFilterRegion().X();
|
||||
float filterY = instance->GetFilterRegion().Y();
|
||||
float filterWidth = instance->GetFilterRegion().Width();
|
||||
float filterHeight = instance->GetFilterRegion().Height();
|
||||
|
||||
bool doStitch = false;
|
||||
if (stitch == SVG_STITCHTYPE_STITCH) {
|
||||
doStitch = true;
|
||||
|
||||
float lowFreq, hiFreq;
|
||||
|
||||
lowFreq = floor(filterWidth * fX) / filterWidth;
|
||||
hiFreq = ceil(filterWidth * fX) / filterWidth;
|
||||
if (fX / lowFreq < hiFreq / fX)
|
||||
fX = lowFreq;
|
||||
else
|
||||
fX = hiFreq;
|
||||
|
||||
lowFreq = floor(filterHeight * fY) / filterHeight;
|
||||
hiFreq = ceil(filterHeight * fY) / filterHeight;
|
||||
if (fY / lowFreq < hiFreq / fY)
|
||||
fY = lowFreq;
|
||||
else
|
||||
fY = hiFreq;
|
||||
}
|
||||
for (int32_t y = rect.y; y < rect.YMost(); y++) {
|
||||
for (int32_t x = rect.x; x < rect.XMost(); x++) {
|
||||
int32_t targIndex = y * stride + x * 4;
|
||||
double point[2];
|
||||
point[0] = filterX + (filterWidth * (x + instance->GetSurfaceRect().x)) / (filterSubregion.width - 1);
|
||||
point[1] = filterY + (filterHeight * (y + instance->GetSurfaceRect().y)) / (filterSubregion.height - 1);
|
||||
|
||||
float col[4];
|
||||
if (type == SVG_TURBULENCE_TYPE_TURBULENCE) {
|
||||
for (int i = 0; i < 4; i++)
|
||||
col[i] = Turbulence(i, point, fX, fY, octaves, false,
|
||||
doStitch, filterX, filterY, filterWidth, filterHeight) * 255;
|
||||
} else {
|
||||
for (int i = 0; i < 4; i++)
|
||||
col[i] = (Turbulence(i, point, fX, fY, octaves, true,
|
||||
doStitch, filterX, filterY, filterWidth, filterHeight) * 255 + 255) / 2;
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
col[i] = std::min(col[i], 255.f);
|
||||
col[i] = std::max(col[i], 0.f);
|
||||
}
|
||||
|
||||
uint8_t r, g, b, a;
|
||||
a = uint8_t(col[3]);
|
||||
FAST_DIVIDE_BY_255(r, unsigned(col[0]) * a);
|
||||
FAST_DIVIDE_BY_255(g, unsigned(col[1]) * a);
|
||||
FAST_DIVIDE_BY_255(b, unsigned(col[2]) * a);
|
||||
|
||||
targetData[targIndex + GFX_ARGB32_OFFSET_B] = b;
|
||||
targetData[targIndex + GFX_ARGB32_OFFSET_G] = g;
|
||||
targetData[targIndex + GFX_ARGB32_OFFSET_R] = r;
|
||||
targetData[targIndex + GFX_ARGB32_OFFSET_A] = a;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
SVGFETurbulenceElement::AttributeAffectsRendering(int32_t aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return SVGFETurbulenceElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::seed ||
|
||||
aAttribute == nsGkAtoms::baseFrequency ||
|
||||
aAttribute == nsGkAtoms::numOctaves ||
|
||||
aAttribute == nsGkAtoms::type ||
|
||||
aAttribute == nsGkAtoms::stitchTiles));
|
||||
}
|
||||
|
||||
void
|
||||
SVGFETurbulenceElement::InitSeed(int32_t aSeed)
|
||||
{
|
||||
double s;
|
||||
int i, j, k;
|
||||
aSeed = SetupSeed(aSeed);
|
||||
for (k = 0; k < 4; k++) {
|
||||
for (i = 0; i < sBSize; i++) {
|
||||
mLatticeSelector[i] = i;
|
||||
for (j = 0; j < 2; j++) {
|
||||
mGradient[k][i][j] =
|
||||
(double) (((aSeed =
|
||||
Random(aSeed)) % (sBSize + sBSize)) - sBSize) / sBSize;
|
||||
}
|
||||
s = double (sqrt
|
||||
(mGradient[k][i][0] * mGradient[k][i][0] +
|
||||
mGradient[k][i][1] * mGradient[k][i][1]));
|
||||
mGradient[k][i][0] /= s;
|
||||
mGradient[k][i][1] /= s;
|
||||
}
|
||||
}
|
||||
while (--i) {
|
||||
k = mLatticeSelector[i];
|
||||
mLatticeSelector[i] = mLatticeSelector[j =
|
||||
(aSeed =
|
||||
Random(aSeed)) % sBSize];
|
||||
mLatticeSelector[j] = k;
|
||||
}
|
||||
for (i = 0; i < sBSize + 2; i++) {
|
||||
mLatticeSelector[sBSize + i] = mLatticeSelector[i];
|
||||
for (k = 0; k < 4; k++)
|
||||
for (j = 0; j < 2; j++)
|
||||
mGradient[k][sBSize + i][j] = mGradient[k][i][j];
|
||||
}
|
||||
}
|
||||
|
||||
#define S_CURVE(t) ( t * t * (3. - 2. * t) )
|
||||
#define LERP(t, a, b) ( a + t * (b - a) )
|
||||
double
|
||||
SVGFETurbulenceElement::Noise2(int aColorChannel, double aVec[2],
|
||||
StitchInfo *aStitchInfo)
|
||||
{
|
||||
int bx0, bx1, by0, by1, b00, b10, b01, b11;
|
||||
double rx0, rx1, ry0, ry1, *q, sx, sy, a, b, t, u, v;
|
||||
register long i, j;
|
||||
t = aVec[0] + sPerlinN;
|
||||
bx0 = (int) t;
|
||||
bx1 = bx0 + 1;
|
||||
rx0 = t - (int) t;
|
||||
rx1 = rx0 - 1.0f;
|
||||
t = aVec[1] + sPerlinN;
|
||||
by0 = (int) t;
|
||||
by1 = by0 + 1;
|
||||
ry0 = t - (int) t;
|
||||
ry1 = ry0 - 1.0f;
|
||||
// If stitching, adjust lattice points accordingly.
|
||||
if (aStitchInfo != NULL) {
|
||||
if (bx0 >= aStitchInfo->mWrapX)
|
||||
bx0 -= aStitchInfo->mWidth;
|
||||
if (bx1 >= aStitchInfo->mWrapX)
|
||||
bx1 -= aStitchInfo->mWidth;
|
||||
if (by0 >= aStitchInfo->mWrapY)
|
||||
by0 -= aStitchInfo->mHeight;
|
||||
if (by1 >= aStitchInfo->mWrapY)
|
||||
by1 -= aStitchInfo->mHeight;
|
||||
}
|
||||
bx0 &= sBM;
|
||||
bx1 &= sBM;
|
||||
by0 &= sBM;
|
||||
by1 &= sBM;
|
||||
i = mLatticeSelector[bx0];
|
||||
j = mLatticeSelector[bx1];
|
||||
b00 = mLatticeSelector[i + by0];
|
||||
b10 = mLatticeSelector[j + by0];
|
||||
b01 = mLatticeSelector[i + by1];
|
||||
b11 = mLatticeSelector[j + by1];
|
||||
sx = double (S_CURVE(rx0));
|
||||
sy = double (S_CURVE(ry0));
|
||||
q = mGradient[aColorChannel][b00];
|
||||
u = rx0 * q[0] + ry0 * q[1];
|
||||
q = mGradient[aColorChannel][b10];
|
||||
v = rx1 * q[0] + ry0 * q[1];
|
||||
a = LERP(sx, u, v);
|
||||
q = mGradient[aColorChannel][b01];
|
||||
u = rx0 * q[0] + ry1 * q[1];
|
||||
q = mGradient[aColorChannel][b11];
|
||||
v = rx1 * q[0] + ry1 * q[1];
|
||||
b = LERP(sx, u, v);
|
||||
return LERP(sy, a, b);
|
||||
}
|
||||
#undef S_CURVE
|
||||
#undef LERP
|
||||
|
||||
double
|
||||
SVGFETurbulenceElement::Turbulence(int aColorChannel, double* aPoint,
|
||||
double aBaseFreqX, double aBaseFreqY,
|
||||
int aNumOctaves, bool aFractalSum,
|
||||
bool aDoStitching,
|
||||
double aTileX, double aTileY,
|
||||
double aTileWidth, double aTileHeight)
|
||||
{
|
||||
StitchInfo stitch;
|
||||
StitchInfo *stitchInfo = NULL; // Not stitching when NULL.
|
||||
// Adjust the base frequencies if necessary for stitching.
|
||||
if (aDoStitching) {
|
||||
// When stitching tiled turbulence, the frequencies must be adjusted
|
||||
// so that the tile borders will be continuous.
|
||||
if (aBaseFreqX != 0.0) {
|
||||
double loFreq = double (floor(aTileWidth * aBaseFreqX)) / aTileWidth;
|
||||
double hiFreq = double (ceil(aTileWidth * aBaseFreqX)) / aTileWidth;
|
||||
if (aBaseFreqX / loFreq < hiFreq / aBaseFreqX)
|
||||
aBaseFreqX = loFreq;
|
||||
else
|
||||
aBaseFreqX = hiFreq;
|
||||
}
|
||||
if (aBaseFreqY != 0.0) {
|
||||
double loFreq = double (floor(aTileHeight * aBaseFreqY)) / aTileHeight;
|
||||
double hiFreq = double (ceil(aTileHeight * aBaseFreqY)) / aTileHeight;
|
||||
if (aBaseFreqY / loFreq < hiFreq / aBaseFreqY)
|
||||
aBaseFreqY = loFreq;
|
||||
else
|
||||
aBaseFreqY = hiFreq;
|
||||
}
|
||||
// Set up initial stitch values.
|
||||
stitchInfo = &stitch;
|
||||
stitch.mWidth = int (aTileWidth * aBaseFreqX + 0.5f);
|
||||
stitch.mWrapX = int (aTileX * aBaseFreqX + sPerlinN + stitch.mWidth);
|
||||
stitch.mHeight = int (aTileHeight * aBaseFreqY + 0.5f);
|
||||
stitch.mWrapY = int (aTileY * aBaseFreqY + sPerlinN + stitch.mHeight);
|
||||
}
|
||||
double sum = 0.0f;
|
||||
double vec[2];
|
||||
vec[0] = aPoint[0] * aBaseFreqX;
|
||||
vec[1] = aPoint[1] * aBaseFreqY;
|
||||
double ratio = 1;
|
||||
for (int octave = 0; octave < aNumOctaves; octave++) {
|
||||
if (aFractalSum)
|
||||
sum += double (Noise2(aColorChannel, vec, stitchInfo) / ratio);
|
||||
else
|
||||
sum += double (fabs(Noise2(aColorChannel, vec, stitchInfo)) / ratio);
|
||||
vec[0] *= 2;
|
||||
vec[1] *= 2;
|
||||
ratio *= 2;
|
||||
if (stitchInfo != NULL) {
|
||||
// Update stitch values. Subtracting sPerlinN before the multiplication
|
||||
// and adding it afterward simplifies to subtracting it once.
|
||||
stitch.mWidth *= 2;
|
||||
stitch.mWrapX = 2 * stitch.mWrapX - sPerlinN;
|
||||
stitch.mHeight *= 2;
|
||||
stitch.mWrapY = 2 * stitch.mWrapY - sPerlinN;
|
||||
}
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
SVGFETurbulenceElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
const nsSVGFilterInstance& aInstance)
|
||||
{
|
||||
return GetMaxRect();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
nsSVGElement::NumberAttributesInfo
|
||||
SVGFETurbulenceElement::GetNumberInfo()
|
||||
{
|
||||
return NumberAttributesInfo(mNumberAttributes, sNumberInfo,
|
||||
ArrayLength(sNumberInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::NumberPairAttributesInfo
|
||||
SVGFETurbulenceElement::GetNumberPairInfo()
|
||||
{
|
||||
return NumberPairAttributesInfo(mNumberPairAttributes, sNumberPairInfo,
|
||||
ArrayLength(sNumberPairInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::IntegerAttributesInfo
|
||||
SVGFETurbulenceElement::GetIntegerInfo()
|
||||
{
|
||||
return IntegerAttributesInfo(mIntegerAttributes, sIntegerInfo,
|
||||
ArrayLength(sIntegerInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::EnumAttributesInfo
|
||||
SVGFETurbulenceElement::GetEnumInfo()
|
||||
{
|
||||
return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
|
||||
ArrayLength(sEnumInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::StringAttributesInfo
|
||||
SVGFETurbulenceElement::GetStringInfo()
|
||||
{
|
||||
return StringAttributesInfo(mStringAttributes, sStringInfo,
|
||||
ArrayLength(sStringInfo));
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
163
content/svg/content/src/SVGFETurbulenceElement.h
Normal file
163
content/svg/content/src/SVGFETurbulenceElement.h
Normal file
@ -0,0 +1,163 @@
|
||||
/* a*- Mode: C++; 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/. */
|
||||
|
||||
#ifndef mozilla_dom_SVGFETurbulenceElement_h
|
||||
#define mozilla_dom_SVGFETurbulenceElement_h
|
||||
|
||||
#include "nsSVGEnum.h"
|
||||
#include "nsSVGFilters.h"
|
||||
#include "nsSVGNumber2.h"
|
||||
#include "nsSVGInteger.h"
|
||||
#include "nsSVGString.h"
|
||||
|
||||
nsresult NS_NewSVGFETurbulenceElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
typedef nsSVGFE SVGFETurbulenceElementBase;
|
||||
|
||||
class SVGFETurbulenceElement : public SVGFETurbulenceElementBase,
|
||||
public nsIDOMSVGElement
|
||||
{
|
||||
friend nsresult (::NS_NewSVGFETurbulenceElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo));
|
||||
protected:
|
||||
SVGFETurbulenceElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: SVGFETurbulenceElementBase(aNodeInfo)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
virtual JSObject* WrapNode(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
|
||||
|
||||
public:
|
||||
virtual bool SubregionIsUnionOfRegions() { return false; }
|
||||
|
||||
// interfaces:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
virtual nsresult Filter(nsSVGFilterInstance* aInstance,
|
||||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual bool AttributeAffectsRendering(
|
||||
int32_t aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
|
||||
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
const nsSVGFilterInstance& aInstance);
|
||||
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(SVGFETurbulenceElementBase::)
|
||||
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
|
||||
// WebIDL
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber> BaseFrequencyX();
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber> BaseFrequencyY();
|
||||
already_AddRefed<nsIDOMSVGAnimatedInteger> NumOctaves();
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber> Seed();
|
||||
already_AddRefed<nsIDOMSVGAnimatedEnumeration> StitchTiles();
|
||||
already_AddRefed<nsIDOMSVGAnimatedEnumeration> Type();
|
||||
|
||||
protected:
|
||||
virtual NumberAttributesInfo GetNumberInfo();
|
||||
virtual NumberPairAttributesInfo GetNumberPairInfo();
|
||||
virtual IntegerAttributesInfo GetIntegerInfo();
|
||||
virtual EnumAttributesInfo GetEnumInfo();
|
||||
virtual StringAttributesInfo GetStringInfo();
|
||||
|
||||
enum { SEED }; // floating point seed?!
|
||||
nsSVGNumber2 mNumberAttributes[1];
|
||||
static NumberInfo sNumberInfo[1];
|
||||
|
||||
enum { BASE_FREQ };
|
||||
nsSVGNumberPair mNumberPairAttributes[1];
|
||||
static NumberPairInfo sNumberPairInfo[1];
|
||||
|
||||
enum { OCTAVES };
|
||||
nsSVGInteger mIntegerAttributes[1];
|
||||
static IntegerInfo sIntegerInfo[1];
|
||||
|
||||
enum { TYPE, STITCHTILES };
|
||||
nsSVGEnum mEnumAttributes[2];
|
||||
static nsSVGEnumMapping sTypeMap[];
|
||||
static nsSVGEnumMapping sStitchTilesMap[];
|
||||
static EnumInfo sEnumInfo[2];
|
||||
|
||||
enum { RESULT };
|
||||
nsSVGString mStringAttributes[1];
|
||||
static StringInfo sStringInfo[1];
|
||||
|
||||
private:
|
||||
|
||||
/* The turbulence calculation code is an adapted version of what
|
||||
appears in the SVG 1.1 specification:
|
||||
http://www.w3.org/TR/SVG11/filters.html#feTurbulence
|
||||
*/
|
||||
|
||||
/* Produces results in the range [1, 2**31 - 2].
|
||||
Algorithm is: r = (a * r) mod m
|
||||
where a = 16807 and m = 2**31 - 1 = 2147483647
|
||||
See [Park & Miller], CACM vol. 31 no. 10 p. 1195, Oct. 1988
|
||||
To test: the algorithm should produce the result 1043618065
|
||||
as the 10,000th generated number if the original seed is 1.
|
||||
*/
|
||||
#define RAND_M 2147483647 /* 2**31 - 1 */
|
||||
#define RAND_A 16807 /* 7**5; primitive root of m */
|
||||
#define RAND_Q 127773 /* m / a */
|
||||
#define RAND_R 2836 /* m % a */
|
||||
|
||||
int32_t SetupSeed(int32_t aSeed) {
|
||||
if (aSeed <= 0)
|
||||
aSeed = -(aSeed % (RAND_M - 1)) + 1;
|
||||
if (aSeed > RAND_M - 1)
|
||||
aSeed = RAND_M - 1;
|
||||
return aSeed;
|
||||
}
|
||||
|
||||
uint32_t Random(uint32_t aSeed) {
|
||||
int32_t result = RAND_A * (aSeed % RAND_Q) - RAND_R * (aSeed / RAND_Q);
|
||||
if (result <= 0)
|
||||
result += RAND_M;
|
||||
return result;
|
||||
}
|
||||
#undef RAND_M
|
||||
#undef RAND_A
|
||||
#undef RAND_Q
|
||||
#undef RAND_R
|
||||
|
||||
const static int sBSize = 0x100;
|
||||
const static int sBM = 0xff;
|
||||
const static int sPerlinN = 0x1000;
|
||||
const static int sNP = 12; /* 2^PerlinN */
|
||||
const static int sNM = 0xfff;
|
||||
|
||||
int32_t mLatticeSelector[sBSize + sBSize + 2];
|
||||
double mGradient[4][sBSize + sBSize + 2][2];
|
||||
struct StitchInfo {
|
||||
int mWidth; // How much to subtract to wrap for stitching.
|
||||
int mHeight;
|
||||
int mWrapX; // Minimum value to wrap.
|
||||
int mWrapY;
|
||||
};
|
||||
|
||||
void InitSeed(int32_t aSeed);
|
||||
double Noise2(int aColorChannel, double aVec[2], StitchInfo *aStitchInfo);
|
||||
double
|
||||
Turbulence(int aColorChannel, double *aPoint, double aBaseFreqX,
|
||||
double aBaseFreqY, int aNumOctaves, bool aFractalSum,
|
||||
bool aDoStitching, double aTileX, double aTileY,
|
||||
double aTileWidth, double aTileHeight);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_SVGFETurbulenceElement_h
|
108
content/svg/content/src/SVGIRect.h
Normal file
108
content/svg/content/src/SVGIRect.h
Normal file
@ -0,0 +1,108 @@
|
||||
/* -*- Mode: C++; 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/. */
|
||||
|
||||
#ifndef mozilla_dom_SVGIRect_h
|
||||
#define mozilla_dom_SVGIRect_h
|
||||
|
||||
#include "nsIDOMSVGRect.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "mozilla/dom/SVGRectBinding.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class SVGIRect : public nsIDOMSVGRect
|
||||
{
|
||||
public:
|
||||
JSObject* WrapObject(JSContext* aCx, JSObject* aScope)
|
||||
{
|
||||
return SVGRectBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
virtual float X() const = 0;
|
||||
|
||||
NS_IMETHOD GetX(float *aX) MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
*aX = X();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
virtual void SetX(float aX, ErrorResult& aRv) = 0;
|
||||
|
||||
NS_IMETHOD SetX(float aX) MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
NS_ENSURE_FINITE(aX, NS_ERROR_ILLEGAL_VALUE);
|
||||
|
||||
ErrorResult rv;
|
||||
SetX(aX, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
virtual float Y() const = 0;
|
||||
|
||||
NS_IMETHOD GetY(float *aY) MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
*aY = Y();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
virtual void SetY(float aY, ErrorResult& aRv) = 0;
|
||||
|
||||
NS_IMETHOD SetY(float aY) MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
NS_ENSURE_FINITE(aY, NS_ERROR_ILLEGAL_VALUE);
|
||||
|
||||
ErrorResult rv;
|
||||
SetY(aY, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
virtual float Width() const = 0;
|
||||
|
||||
NS_IMETHOD GetWidth(float *aWidth) MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
*aWidth = Width();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
virtual void SetWidth(float aWidth, ErrorResult& aRv) = 0;
|
||||
|
||||
NS_IMETHOD SetWidth(float aWidth) MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
NS_ENSURE_FINITE(aWidth, NS_ERROR_ILLEGAL_VALUE);
|
||||
|
||||
ErrorResult rv;
|
||||
SetWidth(aWidth, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
virtual float Height() const = 0;
|
||||
|
||||
NS_IMETHOD GetHeight(float *aHeight) MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
*aHeight = Height();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
virtual void SetHeight(float aHeight, ErrorResult& aRv) = 0;
|
||||
|
||||
NS_IMETHOD SetHeight(float aHeight) MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
NS_ENSURE_FINITE(aHeight, NS_ERROR_ILLEGAL_VALUE);
|
||||
|
||||
ErrorResult rv;
|
||||
SetHeight(aHeight, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif //mozilla_dom_SVGIRect_h
|
||||
|
58
content/svg/content/src/SVGRect.cpp
Normal file
58
content/svg/content/src/SVGRect.cpp
Normal file
@ -0,0 +1,58 @@
|
||||
/* -*- Mode: C++; 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/. */
|
||||
|
||||
#include "mozilla/dom/SVGRect.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
|
||||
DOMCI_DATA(SVGRect, mozilla::dom::SVGRect)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// implementation:
|
||||
|
||||
SVGRect::SVGRect(float x, float y, float w, float h)
|
||||
: mX(x), mY(y), mWidth(w), mHeight(h)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods:
|
||||
|
||||
NS_IMPL_ADDREF(SVGRect)
|
||||
NS_IMPL_RELEASE(SVGRect)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(SVGRect)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGRect)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGRect)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Exported creation functions:
|
||||
|
||||
nsresult
|
||||
NS_NewSVGRect(mozilla::dom::SVGRect** result, float x, float y,
|
||||
float width, float height)
|
||||
{
|
||||
*result = new mozilla::dom::SVGRect(x, y, width, height);
|
||||
if (!*result) return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewSVGRect(mozilla::dom::SVGRect** result, const gfxRect& rect)
|
||||
{
|
||||
return NS_NewSVGRect(result,
|
||||
rect.X(), rect.Y(),
|
||||
rect.Width(), rect.Height());
|
||||
}
|
||||
|
87
content/svg/content/src/SVGRect.h
Normal file
87
content/svg/content/src/SVGRect.h
Normal file
@ -0,0 +1,87 @@
|
||||
/* -*- Mode: C++; 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/. */
|
||||
|
||||
#ifndef mozilla_dom_SVGRect_h
|
||||
#define mozilla_dom_SVGRect_h
|
||||
|
||||
#include "gfxRect.h"
|
||||
#include "mozilla/dom/SVGIRect.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// SVGRect class
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class SVGRect MOZ_FINAL : public SVGIRect
|
||||
{
|
||||
public:
|
||||
SVGRect(float x=0.0f, float y=0.0f, float w=0.0f, float h=0.0f);
|
||||
|
||||
// nsISupports interface:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// WebIDL
|
||||
virtual float X() const MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
return mX;
|
||||
}
|
||||
|
||||
virtual void SetX(float aX, ErrorResult& aRv) MOZ_FINAL
|
||||
{
|
||||
mX = aX;
|
||||
}
|
||||
|
||||
virtual float Y() const MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
return mY;
|
||||
}
|
||||
|
||||
virtual void SetY(float aY, ErrorResult& aRv) MOZ_FINAL
|
||||
{
|
||||
mY = aY;
|
||||
}
|
||||
|
||||
virtual float Width() const MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
return mWidth;
|
||||
}
|
||||
|
||||
virtual void SetWidth(float aWidth, ErrorResult& aRv) MOZ_FINAL
|
||||
{
|
||||
mWidth = aWidth;
|
||||
}
|
||||
|
||||
virtual float Height() const MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
return mHeight;
|
||||
}
|
||||
|
||||
virtual void SetHeight(float aHeight, ErrorResult& aRv) MOZ_FINAL
|
||||
{
|
||||
mHeight = aHeight;
|
||||
}
|
||||
|
||||
using mozilla::dom::SVGIRect::SetX;
|
||||
using mozilla::dom::SVGIRect::SetY;
|
||||
using mozilla::dom::SVGIRect::SetWidth;
|
||||
using mozilla::dom::SVGIRect::SetHeight;
|
||||
|
||||
protected:
|
||||
float mX, mY, mWidth, mHeight;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
nsresult
|
||||
NS_NewSVGRect(mozilla::dom::SVGRect** result,
|
||||
float x=0.0f, float y=0.0f,
|
||||
float width=0.0f, float height=0.0f);
|
||||
|
||||
nsresult
|
||||
NS_NewSVGRect(mozilla::dom::SVGRect** result, const gfxRect& rect);
|
||||
|
||||
#endif //mozilla_dom_SVGRect_h
|
@ -20,7 +20,7 @@
|
||||
#include "DOMSVGPoint.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsISVGSVGFrame.h" //XXX
|
||||
#include "nsSVGRect.h"
|
||||
#include "mozilla/dom/SVGRect.h"
|
||||
#include "nsError.h"
|
||||
#include "nsISVGChildFrame.h"
|
||||
#include "nsGUIEvent.h"
|
||||
@ -409,10 +409,10 @@ SVGSVGElement::CreateSVGMatrix()
|
||||
return matrix.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGRect>
|
||||
already_AddRefed<SVGIRect>
|
||||
SVGSVGElement::CreateSVGRect()
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGRect> rect;
|
||||
nsRefPtr<SVGRect> rect;
|
||||
NS_NewSVGRect(getter_AddRefs(rect));
|
||||
return rect.forget();
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ namespace dom {
|
||||
class SVGAngle;
|
||||
class SVGMatrix;
|
||||
class SVGViewElement;
|
||||
class SVGIRect;
|
||||
|
||||
class SVGSVGElement;
|
||||
|
||||
@ -247,7 +248,7 @@ public:
|
||||
already_AddRefed<SVGAngle> CreateSVGAngle();
|
||||
already_AddRefed<nsISVGPoint> CreateSVGPoint();
|
||||
already_AddRefed<SVGMatrix> CreateSVGMatrix();
|
||||
already_AddRefed<nsIDOMSVGRect> CreateSVGRect();
|
||||
already_AddRefed<SVGIRect> CreateSVGRect();
|
||||
already_AddRefed<DOMSVGTransform> CreateSVGTransform();
|
||||
already_AddRefed<DOMSVGTransform> CreateSVGTransformFromMatrix(SVGMatrix& matrix);
|
||||
Element* GetElementById(const nsAString& elementId, ErrorResult& rv);
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "nsSVGTextContainerFrame.h"
|
||||
#include "nsSVGTextFrame2.h"
|
||||
#include "nsIDOMSVGAnimatedLength.h"
|
||||
#include "nsIDOMSVGRect.h"
|
||||
#include "mozilla/dom/SVGIRect.h"
|
||||
#include "nsIDOMSVGAnimatedEnum.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -153,10 +153,10 @@ SVGTextContentElement::GetEndPositionOfChar(uint32_t charnum, ErrorResult& rv)
|
||||
return point.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGRect>
|
||||
already_AddRefed<SVGIRect>
|
||||
SVGTextContentElement::GetExtentOfChar(uint32_t charnum, ErrorResult& rv)
|
||||
{
|
||||
nsCOMPtr<nsIDOMSVGRect> rect;
|
||||
nsRefPtr<SVGIRect> rect;
|
||||
if (FrameIsSVGText()) {
|
||||
nsSVGTextFrame2* textFrame = GetSVGTextFrame();
|
||||
|
||||
|
@ -16,6 +16,8 @@ class nsISVGPoint;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class SVGIRect;
|
||||
|
||||
typedef SVGGraphicsElement SVGTextContentElementBase;
|
||||
|
||||
class SVGTextContentElement : public SVGTextContentElementBase
|
||||
@ -29,7 +31,7 @@ public:
|
||||
float GetSubStringLength(uint32_t charnum, uint32_t nchars, ErrorResult& rv);
|
||||
already_AddRefed<nsISVGPoint> GetStartPositionOfChar(uint32_t charnum, ErrorResult& rv);
|
||||
already_AddRefed<nsISVGPoint> GetEndPositionOfChar(uint32_t charnum, ErrorResult& rv);
|
||||
already_AddRefed<nsIDOMSVGRect> GetExtentOfChar(uint32_t charnum, ErrorResult& rv);
|
||||
already_AddRefed<SVGIRect> GetExtentOfChar(uint32_t charnum, ErrorResult& rv);
|
||||
float GetRotationOfChar(uint32_t charnum, ErrorResult& rv);
|
||||
int32_t GetCharNumAtPosition(nsISVGPoint& point);
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "nsIDOMMutationEvent.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsISVGChildFrame.h"
|
||||
#include "nsSVGRect.h"
|
||||
#include "mozilla/dom/SVGRect.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "SVGContentUtils.h"
|
||||
|
||||
@ -160,7 +160,7 @@ SVGTransformableElement::GetFarthestViewportElement()
|
||||
return SVGContentUtils::GetOuterSVGElement(this);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMSVGRect>
|
||||
already_AddRefed<SVGIRect>
|
||||
SVGTransformableElement::GetBBox(ErrorResult& rv)
|
||||
{
|
||||
nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
|
||||
@ -176,7 +176,7 @@ SVGTransformableElement::GetBBox(ErrorResult& rv)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMSVGRect> rect;
|
||||
nsRefPtr<SVGRect> rect;
|
||||
rv = NS_NewSVGRect(getter_AddRefs(rect), nsSVGUtils::GetBBox(frame));
|
||||
return rect.forget();
|
||||
}
|
||||
|
@ -10,8 +10,6 @@
|
||||
#include "gfxMatrix.h"
|
||||
#include "SVGAnimatedTransformList.h"
|
||||
|
||||
class nsIDOMSVGRect;
|
||||
|
||||
namespace mozilla {
|
||||
class DOMSVGAnimatedTransformList;
|
||||
|
||||
@ -19,6 +17,7 @@ namespace dom {
|
||||
|
||||
class SVGGraphicsElement;
|
||||
class SVGMatrix;
|
||||
class SVGIRect;
|
||||
|
||||
class SVGTransformableElement : public nsSVGElement
|
||||
{
|
||||
@ -33,7 +32,7 @@ public:
|
||||
already_AddRefed<DOMSVGAnimatedTransformList> Transform();
|
||||
nsSVGElement* GetNearestViewportElement();
|
||||
nsSVGElement* GetFarthestViewportElement();
|
||||
already_AddRefed<nsIDOMSVGRect> GetBBox(ErrorResult& rv);
|
||||
already_AddRefed<SVGIRect> GetBBox(ErrorResult& rv);
|
||||
already_AddRefed<SVGMatrix> GetCTM();
|
||||
already_AddRefed<SVGMatrix> GetScreenCTM();
|
||||
already_AddRefed<SVGMatrix> GetTransformToElement(SVGGraphicsElement& aElement,
|
||||
|
@ -660,864 +660,6 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEFuncAElement)
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
//---------------------Turbulence------------------------
|
||||
|
||||
typedef nsSVGFE nsSVGFETurbulenceElementBase;
|
||||
|
||||
class nsSVGFETurbulenceElement : public nsSVGFETurbulenceElementBase,
|
||||
public nsIDOMSVGFETurbulenceElement
|
||||
{
|
||||
friend nsresult NS_NewSVGFETurbulenceElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
protected:
|
||||
nsSVGFETurbulenceElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsSVGFETurbulenceElementBase(aNodeInfo) {}
|
||||
|
||||
public:
|
||||
virtual bool SubregionIsUnionOfRegions() { return false; }
|
||||
|
||||
// interfaces:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// FE Base
|
||||
NS_FORWARD_NSIDOMSVGFILTERPRIMITIVESTANDARDATTRIBUTES(nsSVGFETurbulenceElementBase::)
|
||||
|
||||
virtual nsresult Filter(nsSVGFilterInstance* aInstance,
|
||||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual bool AttributeAffectsRendering(
|
||||
int32_t aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
|
||||
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
const nsSVGFilterInstance& aInstance);
|
||||
|
||||
// Turbulence
|
||||
NS_DECL_NSIDOMSVGFETURBULENCEELEMENT
|
||||
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFETurbulenceElementBase::)
|
||||
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
protected:
|
||||
virtual NumberAttributesInfo GetNumberInfo();
|
||||
virtual NumberPairAttributesInfo GetNumberPairInfo();
|
||||
virtual IntegerAttributesInfo GetIntegerInfo();
|
||||
virtual EnumAttributesInfo GetEnumInfo();
|
||||
virtual StringAttributesInfo GetStringInfo();
|
||||
|
||||
enum { SEED }; // floating point seed?!
|
||||
nsSVGNumber2 mNumberAttributes[1];
|
||||
static NumberInfo sNumberInfo[1];
|
||||
|
||||
enum { BASE_FREQ };
|
||||
nsSVGNumberPair mNumberPairAttributes[1];
|
||||
static NumberPairInfo sNumberPairInfo[1];
|
||||
|
||||
enum { OCTAVES };
|
||||
nsSVGInteger mIntegerAttributes[1];
|
||||
static IntegerInfo sIntegerInfo[1];
|
||||
|
||||
enum { TYPE, STITCHTILES };
|
||||
nsSVGEnum mEnumAttributes[2];
|
||||
static nsSVGEnumMapping sTypeMap[];
|
||||
static nsSVGEnumMapping sStitchTilesMap[];
|
||||
static EnumInfo sEnumInfo[2];
|
||||
|
||||
enum { RESULT };
|
||||
nsSVGString mStringAttributes[1];
|
||||
static StringInfo sStringInfo[1];
|
||||
|
||||
private:
|
||||
|
||||
/* The turbulence calculation code is an adapted version of what
|
||||
appears in the SVG 1.1 specification:
|
||||
http://www.w3.org/TR/SVG11/filters.html#feTurbulence
|
||||
*/
|
||||
|
||||
/* Produces results in the range [1, 2**31 - 2].
|
||||
Algorithm is: r = (a * r) mod m
|
||||
where a = 16807 and m = 2**31 - 1 = 2147483647
|
||||
See [Park & Miller], CACM vol. 31 no. 10 p. 1195, Oct. 1988
|
||||
To test: the algorithm should produce the result 1043618065
|
||||
as the 10,000th generated number if the original seed is 1.
|
||||
*/
|
||||
#define RAND_M 2147483647 /* 2**31 - 1 */
|
||||
#define RAND_A 16807 /* 7**5; primitive root of m */
|
||||
#define RAND_Q 127773 /* m / a */
|
||||
#define RAND_R 2836 /* m % a */
|
||||
|
||||
int32_t SetupSeed(int32_t aSeed) {
|
||||
if (aSeed <= 0)
|
||||
aSeed = -(aSeed % (RAND_M - 1)) + 1;
|
||||
if (aSeed > RAND_M - 1)
|
||||
aSeed = RAND_M - 1;
|
||||
return aSeed;
|
||||
}
|
||||
|
||||
uint32_t Random(uint32_t aSeed) {
|
||||
int32_t result = RAND_A * (aSeed % RAND_Q) - RAND_R * (aSeed / RAND_Q);
|
||||
if (result <= 0)
|
||||
result += RAND_M;
|
||||
return result;
|
||||
}
|
||||
#undef RAND_M
|
||||
#undef RAND_A
|
||||
#undef RAND_Q
|
||||
#undef RAND_R
|
||||
|
||||
const static int sBSize = 0x100;
|
||||
const static int sBM = 0xff;
|
||||
const static int sPerlinN = 0x1000;
|
||||
const static int sNP = 12; /* 2^PerlinN */
|
||||
const static int sNM = 0xfff;
|
||||
|
||||
int32_t mLatticeSelector[sBSize + sBSize + 2];
|
||||
double mGradient[4][sBSize + sBSize + 2][2];
|
||||
struct StitchInfo {
|
||||
int mWidth; // How much to subtract to wrap for stitching.
|
||||
int mHeight;
|
||||
int mWrapX; // Minimum value to wrap.
|
||||
int mWrapY;
|
||||
};
|
||||
|
||||
void InitSeed(int32_t aSeed);
|
||||
double Noise2(int aColorChannel, double aVec[2], StitchInfo *aStitchInfo);
|
||||
double
|
||||
Turbulence(int aColorChannel, double *aPoint, double aBaseFreqX,
|
||||
double aBaseFreqY, int aNumOctaves, bool aFractalSum,
|
||||
bool aDoStitching, double aTileX, double aTileY,
|
||||
double aTileWidth, double aTileHeight);
|
||||
};
|
||||
|
||||
nsSVGElement::NumberInfo nsSVGFETurbulenceElement::sNumberInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::seed, 0, false }
|
||||
};
|
||||
|
||||
nsSVGElement::NumberPairInfo nsSVGFETurbulenceElement::sNumberPairInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::baseFrequency, 0, 0 }
|
||||
};
|
||||
|
||||
nsSVGElement::IntegerInfo nsSVGFETurbulenceElement::sIntegerInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::numOctaves, 1 }
|
||||
};
|
||||
|
||||
nsSVGEnumMapping nsSVGFETurbulenceElement::sTypeMap[] = {
|
||||
{&nsGkAtoms::fractalNoise,
|
||||
nsIDOMSVGFETurbulenceElement::SVG_TURBULENCE_TYPE_FRACTALNOISE},
|
||||
{&nsGkAtoms::turbulence,
|
||||
nsIDOMSVGFETurbulenceElement::SVG_TURBULENCE_TYPE_TURBULENCE},
|
||||
{nullptr, 0}
|
||||
};
|
||||
|
||||
nsSVGEnumMapping nsSVGFETurbulenceElement::sStitchTilesMap[] = {
|
||||
{&nsGkAtoms::stitch,
|
||||
nsIDOMSVGFETurbulenceElement::SVG_STITCHTYPE_STITCH},
|
||||
{&nsGkAtoms::noStitch,
|
||||
nsIDOMSVGFETurbulenceElement::SVG_STITCHTYPE_NOSTITCH},
|
||||
{nullptr, 0}
|
||||
};
|
||||
|
||||
nsSVGElement::EnumInfo nsSVGFETurbulenceElement::sEnumInfo[2] =
|
||||
{
|
||||
{ &nsGkAtoms::type,
|
||||
sTypeMap,
|
||||
nsIDOMSVGFETurbulenceElement::SVG_TURBULENCE_TYPE_TURBULENCE
|
||||
},
|
||||
{ &nsGkAtoms::stitchTiles,
|
||||
sStitchTilesMap,
|
||||
nsIDOMSVGFETurbulenceElement::SVG_STITCHTYPE_NOSTITCH
|
||||
}
|
||||
};
|
||||
|
||||
nsSVGElement::StringInfo nsSVGFETurbulenceElement::sStringInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::result, kNameSpaceID_None, true }
|
||||
};
|
||||
|
||||
NS_IMPL_NS_NEW_SVG_ELEMENT(FETurbulence)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsSVGFETurbulenceElement,nsSVGFETurbulenceElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(nsSVGFETurbulenceElement,nsSVGFETurbulenceElementBase)
|
||||
|
||||
DOMCI_NODE_DATA(SVGFETurbulenceElement, nsSVGFETurbulenceElement)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsSVGFETurbulenceElement)
|
||||
NS_NODE_INTERFACE_TABLE5(nsSVGFETurbulenceElement, nsIDOMNode, nsIDOMElement,
|
||||
nsIDOMSVGElement,
|
||||
nsIDOMSVGFilterPrimitiveStandardAttributes,
|
||||
nsIDOMSVGFETurbulenceElement)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGFETurbulenceElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsSVGFETurbulenceElementBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFETurbulenceElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGFETurbulenceElement methods
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedNumber baseFrequencyX; */
|
||||
NS_IMETHODIMP nsSVGFETurbulenceElement::GetBaseFrequencyX(nsIDOMSVGAnimatedNumber * *aX)
|
||||
{
|
||||
return mNumberPairAttributes[BASE_FREQ].ToDOMAnimatedNumber(aX, nsSVGNumberPair::eFirst, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedNumber baseFrequencyY; */
|
||||
NS_IMETHODIMP nsSVGFETurbulenceElement::GetBaseFrequencyY(nsIDOMSVGAnimatedNumber * *aY)
|
||||
{
|
||||
return mNumberPairAttributes[BASE_FREQ].ToDOMAnimatedNumber(aY, nsSVGNumberPair::eSecond, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedInteger numOctaves; */
|
||||
NS_IMETHODIMP nsSVGFETurbulenceElement::GetNumOctaves(nsIDOMSVGAnimatedInteger * *aNum)
|
||||
{
|
||||
return mIntegerAttributes[OCTAVES].ToDOMAnimatedInteger(aNum, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedNumber seed; */
|
||||
NS_IMETHODIMP nsSVGFETurbulenceElement::GetSeed(nsIDOMSVGAnimatedNumber * *aSeed)
|
||||
{
|
||||
return mNumberAttributes[SEED].ToDOMAnimatedNumber(aSeed, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedEnumeration stitchTiles; */
|
||||
NS_IMETHODIMP nsSVGFETurbulenceElement::GetStitchTiles(nsIDOMSVGAnimatedEnumeration * *aStitch)
|
||||
{
|
||||
return mEnumAttributes[STITCHTILES].ToDOMAnimatedEnum(aStitch, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedEnumeration type; */
|
||||
NS_IMETHODIMP nsSVGFETurbulenceElement::GetType(nsIDOMSVGAnimatedEnumeration * *aType)
|
||||
{
|
||||
return mEnumAttributes[TYPE].ToDOMAnimatedEnum(aType, this);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGFETurbulenceElement::Filter(nsSVGFilterInstance *instance,
|
||||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& rect)
|
||||
{
|
||||
uint8_t* targetData = aTarget->mImage->Data();
|
||||
uint32_t stride = aTarget->mImage->Stride();
|
||||
|
||||
nsIntRect filterSubregion(int32_t(aTarget->mFilterPrimitiveSubregion.X()),
|
||||
int32_t(aTarget->mFilterPrimitiveSubregion.Y()),
|
||||
int32_t(aTarget->mFilterPrimitiveSubregion.Width()),
|
||||
int32_t(aTarget->mFilterPrimitiveSubregion.Height()));
|
||||
|
||||
float fX = mNumberPairAttributes[BASE_FREQ].GetAnimValue(nsSVGNumberPair::eFirst);
|
||||
float fY = mNumberPairAttributes[BASE_FREQ].GetAnimValue(nsSVGNumberPair::eSecond);
|
||||
float seed = mNumberAttributes[OCTAVES].GetAnimValue();
|
||||
int32_t octaves = mIntegerAttributes[OCTAVES].GetAnimValue();
|
||||
uint16_t type = mEnumAttributes[TYPE].GetAnimValue();
|
||||
uint16_t stitch = mEnumAttributes[STITCHTILES].GetAnimValue();
|
||||
|
||||
InitSeed((int32_t)seed);
|
||||
|
||||
// XXXroc this makes absolutely no sense to me.
|
||||
float filterX = instance->GetFilterRegion().X();
|
||||
float filterY = instance->GetFilterRegion().Y();
|
||||
float filterWidth = instance->GetFilterRegion().Width();
|
||||
float filterHeight = instance->GetFilterRegion().Height();
|
||||
|
||||
bool doStitch = false;
|
||||
if (stitch == nsIDOMSVGFETurbulenceElement::SVG_STITCHTYPE_STITCH) {
|
||||
doStitch = true;
|
||||
|
||||
float lowFreq, hiFreq;
|
||||
|
||||
lowFreq = floor(filterWidth * fX) / filterWidth;
|
||||
hiFreq = ceil(filterWidth * fX) / filterWidth;
|
||||
if (fX / lowFreq < hiFreq / fX)
|
||||
fX = lowFreq;
|
||||
else
|
||||
fX = hiFreq;
|
||||
|
||||
lowFreq = floor(filterHeight * fY) / filterHeight;
|
||||
hiFreq = ceil(filterHeight * fY) / filterHeight;
|
||||
if (fY / lowFreq < hiFreq / fY)
|
||||
fY = lowFreq;
|
||||
else
|
||||
fY = hiFreq;
|
||||
}
|
||||
for (int32_t y = rect.y; y < rect.YMost(); y++) {
|
||||
for (int32_t x = rect.x; x < rect.XMost(); x++) {
|
||||
int32_t targIndex = y * stride + x * 4;
|
||||
double point[2];
|
||||
point[0] = filterX + (filterWidth * (x + instance->GetSurfaceRect().x)) / (filterSubregion.width - 1);
|
||||
point[1] = filterY + (filterHeight * (y + instance->GetSurfaceRect().y)) / (filterSubregion.height - 1);
|
||||
|
||||
float col[4];
|
||||
if (type == nsIDOMSVGFETurbulenceElement::SVG_TURBULENCE_TYPE_TURBULENCE) {
|
||||
for (int i = 0; i < 4; i++)
|
||||
col[i] = Turbulence(i, point, fX, fY, octaves, false,
|
||||
doStitch, filterX, filterY, filterWidth, filterHeight) * 255;
|
||||
} else {
|
||||
for (int i = 0; i < 4; i++)
|
||||
col[i] = (Turbulence(i, point, fX, fY, octaves, true,
|
||||
doStitch, filterX, filterY, filterWidth, filterHeight) * 255 + 255) / 2;
|
||||
}
|
||||
for (int i = 0; i < 4; i++) {
|
||||
col[i] = std::min(col[i], 255.f);
|
||||
col[i] = std::max(col[i], 0.f);
|
||||
}
|
||||
|
||||
uint8_t r, g, b, a;
|
||||
a = uint8_t(col[3]);
|
||||
FAST_DIVIDE_BY_255(r, unsigned(col[0]) * a);
|
||||
FAST_DIVIDE_BY_255(g, unsigned(col[1]) * a);
|
||||
FAST_DIVIDE_BY_255(b, unsigned(col[2]) * a);
|
||||
|
||||
targetData[targIndex + GFX_ARGB32_OFFSET_B] = b;
|
||||
targetData[targIndex + GFX_ARGB32_OFFSET_G] = g;
|
||||
targetData[targIndex + GFX_ARGB32_OFFSET_R] = r;
|
||||
targetData[targIndex + GFX_ARGB32_OFFSET_A] = a;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFETurbulenceElement::AttributeAffectsRendering(int32_t aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return nsSVGFETurbulenceElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::seed ||
|
||||
aAttribute == nsGkAtoms::baseFrequency ||
|
||||
aAttribute == nsGkAtoms::numOctaves ||
|
||||
aAttribute == nsGkAtoms::type ||
|
||||
aAttribute == nsGkAtoms::stitchTiles));
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFETurbulenceElement::InitSeed(int32_t aSeed)
|
||||
{
|
||||
double s;
|
||||
int i, j, k;
|
||||
aSeed = SetupSeed(aSeed);
|
||||
for (k = 0; k < 4; k++) {
|
||||
for (i = 0; i < sBSize; i++) {
|
||||
mLatticeSelector[i] = i;
|
||||
for (j = 0; j < 2; j++) {
|
||||
mGradient[k][i][j] =
|
||||
(double) (((aSeed =
|
||||
Random(aSeed)) % (sBSize + sBSize)) - sBSize) / sBSize;
|
||||
}
|
||||
s = double (sqrt
|
||||
(mGradient[k][i][0] * mGradient[k][i][0] +
|
||||
mGradient[k][i][1] * mGradient[k][i][1]));
|
||||
mGradient[k][i][0] /= s;
|
||||
mGradient[k][i][1] /= s;
|
||||
}
|
||||
}
|
||||
while (--i) {
|
||||
k = mLatticeSelector[i];
|
||||
mLatticeSelector[i] = mLatticeSelector[j =
|
||||
(aSeed =
|
||||
Random(aSeed)) % sBSize];
|
||||
mLatticeSelector[j] = k;
|
||||
}
|
||||
for (i = 0; i < sBSize + 2; i++) {
|
||||
mLatticeSelector[sBSize + i] = mLatticeSelector[i];
|
||||
for (k = 0; k < 4; k++)
|
||||
for (j = 0; j < 2; j++)
|
||||
mGradient[k][sBSize + i][j] = mGradient[k][i][j];
|
||||
}
|
||||
}
|
||||
|
||||
#define S_CURVE(t) ( t * t * (3. - 2. * t) )
|
||||
#define LERP(t, a, b) ( a + t * (b - a) )
|
||||
double
|
||||
nsSVGFETurbulenceElement::Noise2(int aColorChannel, double aVec[2],
|
||||
StitchInfo *aStitchInfo)
|
||||
{
|
||||
int bx0, bx1, by0, by1, b00, b10, b01, b11;
|
||||
double rx0, rx1, ry0, ry1, *q, sx, sy, a, b, t, u, v;
|
||||
register long i, j;
|
||||
t = aVec[0] + sPerlinN;
|
||||
bx0 = (int) t;
|
||||
bx1 = bx0 + 1;
|
||||
rx0 = t - (int) t;
|
||||
rx1 = rx0 - 1.0f;
|
||||
t = aVec[1] + sPerlinN;
|
||||
by0 = (int) t;
|
||||
by1 = by0 + 1;
|
||||
ry0 = t - (int) t;
|
||||
ry1 = ry0 - 1.0f;
|
||||
// If stitching, adjust lattice points accordingly.
|
||||
if (aStitchInfo != NULL) {
|
||||
if (bx0 >= aStitchInfo->mWrapX)
|
||||
bx0 -= aStitchInfo->mWidth;
|
||||
if (bx1 >= aStitchInfo->mWrapX)
|
||||
bx1 -= aStitchInfo->mWidth;
|
||||
if (by0 >= aStitchInfo->mWrapY)
|
||||
by0 -= aStitchInfo->mHeight;
|
||||
if (by1 >= aStitchInfo->mWrapY)
|
||||
by1 -= aStitchInfo->mHeight;
|
||||
}
|
||||
bx0 &= sBM;
|
||||
bx1 &= sBM;
|
||||
by0 &= sBM;
|
||||
by1 &= sBM;
|
||||
i = mLatticeSelector[bx0];
|
||||
j = mLatticeSelector[bx1];
|
||||
b00 = mLatticeSelector[i + by0];
|
||||
b10 = mLatticeSelector[j + by0];
|
||||
b01 = mLatticeSelector[i + by1];
|
||||
b11 = mLatticeSelector[j + by1];
|
||||
sx = double (S_CURVE(rx0));
|
||||
sy = double (S_CURVE(ry0));
|
||||
q = mGradient[aColorChannel][b00];
|
||||
u = rx0 * q[0] + ry0 * q[1];
|
||||
q = mGradient[aColorChannel][b10];
|
||||
v = rx1 * q[0] + ry0 * q[1];
|
||||
a = LERP(sx, u, v);
|
||||
q = mGradient[aColorChannel][b01];
|
||||
u = rx0 * q[0] + ry1 * q[1];
|
||||
q = mGradient[aColorChannel][b11];
|
||||
v = rx1 * q[0] + ry1 * q[1];
|
||||
b = LERP(sx, u, v);
|
||||
return LERP(sy, a, b);
|
||||
}
|
||||
#undef S_CURVE
|
||||
#undef LERP
|
||||
|
||||
double
|
||||
nsSVGFETurbulenceElement::Turbulence(int aColorChannel, double *aPoint,
|
||||
double aBaseFreqX, double aBaseFreqY,
|
||||
int aNumOctaves, bool aFractalSum,
|
||||
bool aDoStitching,
|
||||
double aTileX, double aTileY,
|
||||
double aTileWidth, double aTileHeight)
|
||||
{
|
||||
StitchInfo stitch;
|
||||
StitchInfo *stitchInfo = NULL; // Not stitching when NULL.
|
||||
// Adjust the base frequencies if necessary for stitching.
|
||||
if (aDoStitching) {
|
||||
// When stitching tiled turbulence, the frequencies must be adjusted
|
||||
// so that the tile borders will be continuous.
|
||||
if (aBaseFreqX != 0.0) {
|
||||
double loFreq = double (floor(aTileWidth * aBaseFreqX)) / aTileWidth;
|
||||
double hiFreq = double (ceil(aTileWidth * aBaseFreqX)) / aTileWidth;
|
||||
if (aBaseFreqX / loFreq < hiFreq / aBaseFreqX)
|
||||
aBaseFreqX = loFreq;
|
||||
else
|
||||
aBaseFreqX = hiFreq;
|
||||
}
|
||||
if (aBaseFreqY != 0.0) {
|
||||
double loFreq = double (floor(aTileHeight * aBaseFreqY)) / aTileHeight;
|
||||
double hiFreq = double (ceil(aTileHeight * aBaseFreqY)) / aTileHeight;
|
||||
if (aBaseFreqY / loFreq < hiFreq / aBaseFreqY)
|
||||
aBaseFreqY = loFreq;
|
||||
else
|
||||
aBaseFreqY = hiFreq;
|
||||
}
|
||||
// Set up initial stitch values.
|
||||
stitchInfo = &stitch;
|
||||
stitch.mWidth = int (aTileWidth * aBaseFreqX + 0.5f);
|
||||
stitch.mWrapX = int (aTileX * aBaseFreqX + sPerlinN + stitch.mWidth);
|
||||
stitch.mHeight = int (aTileHeight * aBaseFreqY + 0.5f);
|
||||
stitch.mWrapY = int (aTileY * aBaseFreqY + sPerlinN + stitch.mHeight);
|
||||
}
|
||||
double sum = 0.0f;
|
||||
double vec[2];
|
||||
vec[0] = aPoint[0] * aBaseFreqX;
|
||||
vec[1] = aPoint[1] * aBaseFreqY;
|
||||
double ratio = 1;
|
||||
for (int octave = 0; octave < aNumOctaves; octave++) {
|
||||
if (aFractalSum)
|
||||
sum += double (Noise2(aColorChannel, vec, stitchInfo) / ratio);
|
||||
else
|
||||
sum += double (fabs(Noise2(aColorChannel, vec, stitchInfo)) / ratio);
|
||||
vec[0] *= 2;
|
||||
vec[1] *= 2;
|
||||
ratio *= 2;
|
||||
if (stitchInfo != NULL) {
|
||||
// Update stitch values. Subtracting sPerlinN before the multiplication
|
||||
// and adding it afterward simplifies to subtracting it once.
|
||||
stitch.mWidth *= 2;
|
||||
stitch.mWrapX = 2 * stitch.mWrapX - sPerlinN;
|
||||
stitch.mHeight *= 2;
|
||||
stitch.mWrapY = 2 * stitch.mWrapY - sPerlinN;
|
||||
}
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
nsSVGFETurbulenceElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
const nsSVGFilterInstance& aInstance)
|
||||
{
|
||||
return GetMaxRect();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
nsSVGElement::NumberAttributesInfo
|
||||
nsSVGFETurbulenceElement::GetNumberInfo()
|
||||
{
|
||||
return NumberAttributesInfo(mNumberAttributes, sNumberInfo,
|
||||
ArrayLength(sNumberInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::NumberPairAttributesInfo
|
||||
nsSVGFETurbulenceElement::GetNumberPairInfo()
|
||||
{
|
||||
return NumberPairAttributesInfo(mNumberPairAttributes, sNumberPairInfo,
|
||||
ArrayLength(sNumberPairInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::IntegerAttributesInfo
|
||||
nsSVGFETurbulenceElement::GetIntegerInfo()
|
||||
{
|
||||
return IntegerAttributesInfo(mIntegerAttributes, sIntegerInfo,
|
||||
ArrayLength(sIntegerInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::EnumAttributesInfo
|
||||
nsSVGFETurbulenceElement::GetEnumInfo()
|
||||
{
|
||||
return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
|
||||
ArrayLength(sEnumInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::StringAttributesInfo
|
||||
nsSVGFETurbulenceElement::GetStringInfo()
|
||||
{
|
||||
return StringAttributesInfo(mStringAttributes, sStringInfo,
|
||||
ArrayLength(sStringInfo));
|
||||
}
|
||||
|
||||
//---------------------Morphology------------------------
|
||||
|
||||
typedef nsSVGFE nsSVGFEMorphologyElementBase;
|
||||
|
||||
class nsSVGFEMorphologyElement : public nsSVGFEMorphologyElementBase,
|
||||
public nsIDOMSVGFEMorphologyElement
|
||||
{
|
||||
friend nsresult NS_NewSVGFEMorphologyElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
protected:
|
||||
nsSVGFEMorphologyElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsSVGFEMorphologyElementBase(aNodeInfo) {}
|
||||
|
||||
public:
|
||||
// interfaces:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// FE Base
|
||||
NS_FORWARD_NSIDOMSVGFILTERPRIMITIVESTANDARDATTRIBUTES(nsSVGFEMorphologyElementBase::)
|
||||
|
||||
virtual nsresult Filter(nsSVGFilterInstance* aInstance,
|
||||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& aDataRect);
|
||||
virtual bool AttributeAffectsRendering(
|
||||
int32_t aNameSpaceID, nsIAtom* aAttribute) const;
|
||||
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
|
||||
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
|
||||
virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
const nsSVGFilterInstance& aInstance);
|
||||
virtual void ComputeNeededSourceBBoxes(const nsIntRect& aTargetBBox,
|
||||
nsTArray<nsIntRect>& aSourceBBoxes, const nsSVGFilterInstance& aInstance);
|
||||
virtual nsIntRect ComputeChangeBBox(const nsTArray<nsIntRect>& aSourceChangeBoxes,
|
||||
const nsSVGFilterInstance& aInstance);
|
||||
|
||||
// Morphology
|
||||
NS_DECL_NSIDOMSVGFEMORPHOLOGYELEMENT
|
||||
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEMorphologyElementBase::)
|
||||
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
protected:
|
||||
void GetRXY(int32_t *aRX, int32_t *aRY, const nsSVGFilterInstance& aInstance);
|
||||
nsIntRect InflateRect(const nsIntRect& aRect, const nsSVGFilterInstance& aInstance);
|
||||
|
||||
virtual NumberPairAttributesInfo GetNumberPairInfo();
|
||||
virtual EnumAttributesInfo GetEnumInfo();
|
||||
virtual StringAttributesInfo GetStringInfo();
|
||||
|
||||
enum { RADIUS };
|
||||
nsSVGNumberPair mNumberPairAttributes[1];
|
||||
static NumberPairInfo sNumberPairInfo[1];
|
||||
|
||||
enum { OPERATOR };
|
||||
nsSVGEnum mEnumAttributes[1];
|
||||
static nsSVGEnumMapping sOperatorMap[];
|
||||
static EnumInfo sEnumInfo[1];
|
||||
|
||||
enum { RESULT, IN1 };
|
||||
nsSVGString mStringAttributes[2];
|
||||
static StringInfo sStringInfo[2];
|
||||
};
|
||||
|
||||
nsSVGElement::NumberPairInfo nsSVGFEMorphologyElement::sNumberPairInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::radius, 0, 0 }
|
||||
};
|
||||
|
||||
nsSVGEnumMapping nsSVGFEMorphologyElement::sOperatorMap[] = {
|
||||
{&nsGkAtoms::erode, nsSVGFEMorphologyElement::SVG_OPERATOR_ERODE},
|
||||
{&nsGkAtoms::dilate, nsSVGFEMorphologyElement::SVG_OPERATOR_DILATE},
|
||||
{nullptr, 0}
|
||||
};
|
||||
|
||||
nsSVGElement::EnumInfo nsSVGFEMorphologyElement::sEnumInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::_operator,
|
||||
sOperatorMap,
|
||||
nsSVGFEMorphologyElement::SVG_OPERATOR_ERODE
|
||||
}
|
||||
};
|
||||
|
||||
nsSVGElement::StringInfo nsSVGFEMorphologyElement::sStringInfo[2] =
|
||||
{
|
||||
{ &nsGkAtoms::result, kNameSpaceID_None, true },
|
||||
{ &nsGkAtoms::in, kNameSpaceID_None, true }
|
||||
};
|
||||
|
||||
NS_IMPL_NS_NEW_SVG_ELEMENT(FEMorphology)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsSVGFEMorphologyElement,nsSVGFEMorphologyElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(nsSVGFEMorphologyElement,nsSVGFEMorphologyElementBase)
|
||||
|
||||
DOMCI_NODE_DATA(SVGFEMorphologyElement, nsSVGFEMorphologyElement)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsSVGFEMorphologyElement)
|
||||
NS_NODE_INTERFACE_TABLE5(nsSVGFEMorphologyElement, nsIDOMNode, nsIDOMElement,
|
||||
nsIDOMSVGElement,
|
||||
nsIDOMSVGFilterPrimitiveStandardAttributes,
|
||||
nsIDOMSVGFEMorphologyElement)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGFEMorphologyElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsSVGFEMorphologyElementBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEMorphologyElement)
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGFEMorphologyElement methods
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedString in1; */
|
||||
NS_IMETHODIMP nsSVGFEMorphologyElement::GetIn1(nsIDOMSVGAnimatedString * *aIn)
|
||||
{
|
||||
return mStringAttributes[IN1].ToDOMAnimatedString(aIn, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedEnumeration operator; */
|
||||
NS_IMETHODIMP nsSVGFEMorphologyElement::GetOperator(nsIDOMSVGAnimatedEnumeration * *aOperator)
|
||||
{
|
||||
return mEnumAttributes[OPERATOR].ToDOMAnimatedEnum(aOperator, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedNumber radiusX; */
|
||||
NS_IMETHODIMP nsSVGFEMorphologyElement::GetRadiusX(nsIDOMSVGAnimatedNumber * *aX)
|
||||
{
|
||||
return mNumberPairAttributes[RADIUS].ToDOMAnimatedNumber(aX, nsSVGNumberPair::eFirst, this);
|
||||
}
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedNumber radiusY; */
|
||||
NS_IMETHODIMP nsSVGFEMorphologyElement::GetRadiusY(nsIDOMSVGAnimatedNumber * *aY)
|
||||
{
|
||||
return mNumberPairAttributes[RADIUS].ToDOMAnimatedNumber(aY, nsSVGNumberPair::eSecond, this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGFEMorphologyElement::SetRadius(float rx, float ry)
|
||||
{
|
||||
NS_ENSURE_FINITE2(rx, ry, NS_ERROR_ILLEGAL_VALUE);
|
||||
mNumberPairAttributes[RADIUS].SetBaseValues(rx, ry, this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFEMorphologyElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
|
||||
{
|
||||
aSources.AppendElement(nsSVGStringInfo(&mStringAttributes[IN1], this));
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
nsSVGFEMorphologyElement::InflateRect(const nsIntRect& aRect,
|
||||
const nsSVGFilterInstance& aInstance)
|
||||
{
|
||||
int32_t rx, ry;
|
||||
GetRXY(&rx, &ry, aInstance);
|
||||
nsIntRect result = aRect;
|
||||
result.Inflate(std::max(0, rx), std::max(0, ry));
|
||||
return result;
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
nsSVGFEMorphologyElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
|
||||
const nsSVGFilterInstance& aInstance)
|
||||
{
|
||||
return InflateRect(aSourceBBoxes[0], aInstance);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGFEMorphologyElement::ComputeNeededSourceBBoxes(const nsIntRect& aTargetBBox,
|
||||
nsTArray<nsIntRect>& aSourceBBoxes, const nsSVGFilterInstance& aInstance)
|
||||
{
|
||||
aSourceBBoxes[0] = InflateRect(aTargetBBox, aInstance);
|
||||
}
|
||||
|
||||
nsIntRect
|
||||
nsSVGFEMorphologyElement::ComputeChangeBBox(const nsTArray<nsIntRect>& aSourceChangeBoxes,
|
||||
const nsSVGFilterInstance& aInstance)
|
||||
{
|
||||
return InflateRect(aSourceChangeBoxes[0], aInstance);
|
||||
}
|
||||
|
||||
#define MORPHOLOGY_EPSILON 0.0001
|
||||
|
||||
void
|
||||
nsSVGFEMorphologyElement::GetRXY(int32_t *aRX, int32_t *aRY,
|
||||
const nsSVGFilterInstance& aInstance)
|
||||
{
|
||||
// Subtract an epsilon here because we don't want a value that's just
|
||||
// slightly larger than an integer to round up to the next integer; it's
|
||||
// probably meant to be the integer it's close to, modulo machine precision
|
||||
// issues.
|
||||
*aRX = NSToIntCeil(aInstance.GetPrimitiveNumber(SVGContentUtils::X,
|
||||
&mNumberPairAttributes[RADIUS],
|
||||
nsSVGNumberPair::eFirst) -
|
||||
MORPHOLOGY_EPSILON);
|
||||
*aRY = NSToIntCeil(aInstance.GetPrimitiveNumber(SVGContentUtils::Y,
|
||||
&mNumberPairAttributes[RADIUS],
|
||||
nsSVGNumberPair::eSecond) -
|
||||
MORPHOLOGY_EPSILON);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSVGFEMorphologyElement::Filter(nsSVGFilterInstance *instance,
|
||||
const nsTArray<const Image*>& aSources,
|
||||
const Image* aTarget,
|
||||
const nsIntRect& rect)
|
||||
{
|
||||
int32_t rx, ry;
|
||||
GetRXY(&rx, &ry, *instance);
|
||||
|
||||
if (rx < 0 || ry < 0) {
|
||||
// XXX SVGContentUtils::ReportToConsole()
|
||||
return NS_OK;
|
||||
}
|
||||
if (rx == 0 && ry == 0) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Clamp radii to prevent completely insane values:
|
||||
rx = std::min(rx, 100000);
|
||||
ry = std::min(ry, 100000);
|
||||
|
||||
uint8_t* sourceData = aSources[0]->mImage->Data();
|
||||
uint8_t* targetData = aTarget->mImage->Data();
|
||||
int32_t stride = aTarget->mImage->Stride();
|
||||
uint8_t extrema[4]; // RGBA magnitude of extrema
|
||||
uint16_t op = mEnumAttributes[OPERATOR].GetAnimValue();
|
||||
|
||||
// Scan the kernel for each pixel to determine max/min RGBA values.
|
||||
for (int32_t y = rect.y; y < rect.YMost(); y++) {
|
||||
int32_t startY = std::max(0, y - ry);
|
||||
// We need to read pixels not just in 'rect', which is limited to
|
||||
// the dirty part of our filter primitive subregion, but all pixels in
|
||||
// the given radii from the source surface, so use the surface size here.
|
||||
int32_t endY = std::min(y + ry, instance->GetSurfaceHeight() - 1);
|
||||
for (int32_t x = rect.x; x < rect.XMost(); x++) {
|
||||
int32_t startX = std::max(0, x - rx);
|
||||
int32_t endX = std::min(x + rx, instance->GetSurfaceWidth() - 1);
|
||||
int32_t targIndex = y * stride + 4 * x;
|
||||
|
||||
for (int32_t i = 0; i < 4; i++) {
|
||||
extrema[i] = sourceData[targIndex + i];
|
||||
}
|
||||
for (int32_t y1 = startY; y1 <= endY; y1++) {
|
||||
for (int32_t x1 = startX; x1 <= endX; x1++) {
|
||||
for (int32_t i = 0; i < 4; i++) {
|
||||
uint8_t pixel = sourceData[y1 * stride + 4 * x1 + i];
|
||||
if ((extrema[i] > pixel &&
|
||||
op == nsSVGFEMorphologyElement::SVG_OPERATOR_ERODE) ||
|
||||
(extrema[i] < pixel &&
|
||||
op == nsSVGFEMorphologyElement::SVG_OPERATOR_DILATE)) {
|
||||
extrema[i] = pixel;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
targetData[targIndex ] = extrema[0];
|
||||
targetData[targIndex+1] = extrema[1];
|
||||
targetData[targIndex+2] = extrema[2];
|
||||
targetData[targIndex+3] = extrema[3];
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsSVGFEMorphologyElement::AttributeAffectsRendering(int32_t aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return nsSVGFEMorphologyElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
|
||||
(aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::in ||
|
||||
aAttribute == nsGkAtoms::radius ||
|
||||
aAttribute == nsGkAtoms::_operator));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
nsSVGElement::NumberPairAttributesInfo
|
||||
nsSVGFEMorphologyElement::GetNumberPairInfo()
|
||||
{
|
||||
return NumberPairAttributesInfo(mNumberPairAttributes, sNumberPairInfo,
|
||||
ArrayLength(sNumberPairInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::EnumAttributesInfo
|
||||
nsSVGFEMorphologyElement::GetEnumInfo()
|
||||
{
|
||||
return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
|
||||
ArrayLength(sEnumInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::StringAttributesInfo
|
||||
nsSVGFEMorphologyElement::GetStringInfo()
|
||||
{
|
||||
return StringAttributesInfo(mStringAttributes, sStringInfo,
|
||||
ArrayLength(sStringInfo));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
//
|
||||
nsSVGElement::NumberInfo nsSVGFELightingElement::sNumberInfo[4] =
|
||||
|
@ -1,109 +0,0 @@
|
||||
/* -*- Mode: C++; 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/. */
|
||||
|
||||
#include "nsSVGRect.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// implementation:
|
||||
|
||||
nsSVGRect::nsSVGRect(float x, float y, float w, float h)
|
||||
: mX(x), mY(y), mWidth(w), mHeight(h)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods:
|
||||
|
||||
NS_IMPL_ADDREF(nsSVGRect)
|
||||
NS_IMPL_RELEASE(nsSVGRect)
|
||||
|
||||
DOMCI_DATA(SVGRect, nsSVGRect)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsSVGRect)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGRect)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGRect)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGRect methods:
|
||||
|
||||
/* attribute float x; */
|
||||
NS_IMETHODIMP nsSVGRect::GetX(float *aX)
|
||||
{
|
||||
*aX = mX;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSVGRect::SetX(float aX)
|
||||
{
|
||||
NS_ENSURE_FINITE(aX, NS_ERROR_ILLEGAL_VALUE);
|
||||
mX = aX;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute float y; */
|
||||
NS_IMETHODIMP nsSVGRect::GetY(float *aY)
|
||||
{
|
||||
*aY = mY;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSVGRect::SetY(float aY)
|
||||
{
|
||||
NS_ENSURE_FINITE(aY, NS_ERROR_ILLEGAL_VALUE);
|
||||
mY = aY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute float width; */
|
||||
NS_IMETHODIMP nsSVGRect::GetWidth(float *aWidth)
|
||||
{
|
||||
*aWidth = mWidth;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSVGRect::SetWidth(float aWidth)
|
||||
{
|
||||
NS_ENSURE_FINITE(aWidth, NS_ERROR_ILLEGAL_VALUE);
|
||||
mWidth = aWidth;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute float height; */
|
||||
NS_IMETHODIMP nsSVGRect::GetHeight(float *aHeight)
|
||||
{
|
||||
*aHeight = mHeight;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsSVGRect::SetHeight(float aHeight)
|
||||
{
|
||||
NS_ENSURE_FINITE(aHeight, NS_ERROR_ILLEGAL_VALUE);
|
||||
mHeight = aHeight;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Exported creation functions:
|
||||
|
||||
nsresult
|
||||
NS_NewSVGRect(nsIDOMSVGRect** result, float x, float y,
|
||||
float width, float height)
|
||||
{
|
||||
*result = new nsSVGRect(x, y, width, height);
|
||||
if (!*result) return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewSVGRect(nsIDOMSVGRect** result, const gfxRect& rect)
|
||||
{
|
||||
return NS_NewSVGRect(result,
|
||||
rect.X(), rect.Y(),
|
||||
rect.Width(), rect.Height());
|
||||
}
|
||||
|
@ -1,39 +0,0 @@
|
||||
/* -*- Mode: C++; 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/. */
|
||||
|
||||
#ifndef __NS_SVGRECT_H__
|
||||
#define __NS_SVGRECT_H__
|
||||
|
||||
#include "gfxRect.h"
|
||||
#include "nsIDOMSVGRect.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
nsresult
|
||||
NS_NewSVGRect(nsIDOMSVGRect** result,
|
||||
float x=0.0f, float y=0.0f,
|
||||
float width=0.0f, float height=0.0f);
|
||||
|
||||
nsresult
|
||||
NS_NewSVGRect(nsIDOMSVGRect** result, const gfxRect& rect);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// nsSVGRect class
|
||||
|
||||
class nsSVGRect MOZ_FINAL : public nsIDOMSVGRect
|
||||
{
|
||||
public:
|
||||
nsSVGRect(float x=0.0f, float y=0.0f, float w=0.0f, float h=0.0f);
|
||||
|
||||
// nsISupports interface:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMSVGRect interface:
|
||||
NS_DECL_NSIDOMSVGRECT
|
||||
|
||||
protected:
|
||||
float mX, mY, mWidth, mHeight;
|
||||
};
|
||||
|
||||
#endif //__NS_SVGRECT_H__
|
@ -280,40 +280,36 @@ nsSVGViewBox::DOMAnimVal::~DOMAnimVal()
|
||||
sAnimSVGViewBoxTearoffTable.RemoveTearoff(mVal);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGViewBox::DOMBaseVal::SetX(float aX)
|
||||
void
|
||||
nsSVGViewBox::DOMBaseVal::SetX(float aX, ErrorResult& aRv)
|
||||
{
|
||||
nsSVGViewBoxRect rect = mVal->GetBaseValue();
|
||||
rect.x = aX;
|
||||
mVal->SetBaseValue(rect, mSVGElement);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGViewBox::DOMBaseVal::SetY(float aY)
|
||||
void
|
||||
nsSVGViewBox::DOMBaseVal::SetY(float aY, ErrorResult& aRv)
|
||||
{
|
||||
nsSVGViewBoxRect rect = mVal->GetBaseValue();
|
||||
rect.y = aY;
|
||||
mVal->SetBaseValue(rect, mSVGElement);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGViewBox::DOMBaseVal::SetWidth(float aWidth)
|
||||
void
|
||||
nsSVGViewBox::DOMBaseVal::SetWidth(float aWidth, ErrorResult& aRv)
|
||||
{
|
||||
nsSVGViewBoxRect rect = mVal->GetBaseValue();
|
||||
rect.width = aWidth;
|
||||
mVal->SetBaseValue(rect, mSVGElement);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGViewBox::DOMBaseVal::SetHeight(float aHeight)
|
||||
void
|
||||
nsSVGViewBox::DOMBaseVal::SetHeight(float aHeight, ErrorResult& aRv)
|
||||
{
|
||||
nsSVGViewBoxRect rect = mVal->GetBaseValue();
|
||||
rect.height = aHeight;
|
||||
mVal->SetBaseValue(rect, mSVGElement);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsISMILAttr*
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIDOMSVGAnimatedRect.h"
|
||||
#include "nsIDOMSVGRect.h"
|
||||
#include "mozilla/dom/SVGIRect.h"
|
||||
#include "nsISMILAttr.h"
|
||||
#include "nsSVGElement.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
@ -93,8 +93,13 @@ private:
|
||||
bool mHasBaseVal;
|
||||
|
||||
public:
|
||||
struct DOMBaseVal MOZ_FINAL : public nsIDOMSVGRect
|
||||
struct DOMBaseVal MOZ_FINAL : public mozilla::dom::SVGIRect
|
||||
{
|
||||
using mozilla::dom::SVGIRect::SetX;
|
||||
using mozilla::dom::SVGIRect::SetY;
|
||||
using mozilla::dom::SVGIRect::SetWidth;
|
||||
using mozilla::dom::SVGIRect::SetHeight;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMBaseVal)
|
||||
|
||||
@ -105,23 +110,39 @@ public:
|
||||
nsSVGViewBox* mVal; // kept alive because it belongs to content
|
||||
nsRefPtr<nsSVGElement> mSVGElement;
|
||||
|
||||
NS_IMETHOD GetX(float *aX)
|
||||
{ *aX = mVal->GetBaseValue().x; return NS_OK; }
|
||||
NS_IMETHOD GetY(float *aY)
|
||||
{ *aY = mVal->GetBaseValue().y; return NS_OK; }
|
||||
NS_IMETHOD GetWidth(float *aWidth)
|
||||
{ *aWidth = mVal->GetBaseValue().width; return NS_OK; }
|
||||
NS_IMETHOD GetHeight(float *aHeight)
|
||||
{ *aHeight = mVal->GetBaseValue().height; return NS_OK; }
|
||||
float X() const MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
return mVal->GetBaseValue().x;
|
||||
}
|
||||
|
||||
NS_IMETHOD SetX(float aX);
|
||||
NS_IMETHOD SetY(float aY);
|
||||
NS_IMETHOD SetWidth(float aWidth);
|
||||
NS_IMETHOD SetHeight(float aHeight);
|
||||
float Y() const MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
return mVal->GetBaseValue().y;
|
||||
}
|
||||
|
||||
float Width() const MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
return mVal->GetBaseValue().width;
|
||||
}
|
||||
|
||||
float Height() const MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
return mVal->GetBaseValue().height;
|
||||
}
|
||||
|
||||
void SetX(float aX, mozilla::ErrorResult& aRv) MOZ_FINAL;
|
||||
void SetY(float aY, mozilla::ErrorResult& aRv) MOZ_FINAL;
|
||||
void SetWidth(float aWidth, mozilla::ErrorResult& aRv) MOZ_FINAL;
|
||||
void SetHeight(float aHeight, mozilla::ErrorResult& aRv) MOZ_FINAL;
|
||||
};
|
||||
|
||||
struct DOMAnimVal MOZ_FINAL : public nsIDOMSVGRect
|
||||
struct DOMAnimVal MOZ_FINAL : public mozilla::dom::SVGIRect
|
||||
{
|
||||
using mozilla::dom::SVGIRect::SetX;
|
||||
using mozilla::dom::SVGIRect::SetY;
|
||||
using mozilla::dom::SVGIRect::SetWidth;
|
||||
using mozilla::dom::SVGIRect::SetHeight;
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimVal)
|
||||
|
||||
@ -134,39 +155,49 @@ public:
|
||||
|
||||
// Script may have modified animation parameters or timeline -- DOM getters
|
||||
// need to flush any resample requests to reflect these modifications.
|
||||
NS_IMETHOD GetX(float *aX)
|
||||
float X() const MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
mSVGElement->FlushAnimations();
|
||||
*aX = mVal->GetAnimValue().x;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetY(float *aY)
|
||||
{
|
||||
mSVGElement->FlushAnimations();
|
||||
*aY = mVal->GetAnimValue().y;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetWidth(float *aWidth)
|
||||
{
|
||||
mSVGElement->FlushAnimations();
|
||||
*aWidth = mVal->GetAnimValue().width;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHOD GetHeight(float *aHeight)
|
||||
{
|
||||
mSVGElement->FlushAnimations();
|
||||
*aHeight = mVal->GetAnimValue().height;
|
||||
return NS_OK;
|
||||
return mVal->GetAnimValue().x;
|
||||
}
|
||||
|
||||
NS_IMETHOD SetX(float aX)
|
||||
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
NS_IMETHOD SetY(float aY)
|
||||
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
NS_IMETHOD SetWidth(float aWidth)
|
||||
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
NS_IMETHOD SetHeight(float aHeight)
|
||||
{ return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR; }
|
||||
float Y() const MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
mSVGElement->FlushAnimations();
|
||||
return mVal->GetAnimValue().y;
|
||||
}
|
||||
|
||||
float Width() const MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
mSVGElement->FlushAnimations();
|
||||
return mVal->GetAnimValue().width;
|
||||
}
|
||||
|
||||
float Height() const MOZ_OVERRIDE MOZ_FINAL
|
||||
{
|
||||
mSVGElement->FlushAnimations();
|
||||
return mVal->GetAnimValue().height;
|
||||
}
|
||||
|
||||
void SetX(float aX, mozilla::ErrorResult& aRv) MOZ_FINAL
|
||||
{
|
||||
aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
|
||||
void SetY(float aY, mozilla::ErrorResult& aRv) MOZ_FINAL
|
||||
{
|
||||
aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
|
||||
void SetWidth(float aWidth, mozilla::ErrorResult& aRv) MOZ_FINAL
|
||||
{
|
||||
aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
|
||||
void SetHeight(float aHeight, mozilla::ErrorResult& aRv) MOZ_FINAL
|
||||
{
|
||||
aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
};
|
||||
|
||||
struct DOMAnimatedRect MOZ_FINAL : public nsIDOMSVGAnimatedRect
|
||||
|
@ -23,7 +23,6 @@ namespace dom {
|
||||
|
||||
SVGDocument::SVGDocument()
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
SVGDocument::~SVGDocument()
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "mozilla/dom/Element.h" // DOMCI_NODE_DATA
|
||||
#include "mozilla/dom/XMLDocumentBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
@ -219,9 +220,10 @@ XMLDocument::XMLDocument(const char* aContentType)
|
||||
: nsDocument(aContentType),
|
||||
mAsync(true)
|
||||
{
|
||||
|
||||
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
||||
// bother initializing members to 0.
|
||||
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
|
||||
XMLDocument::~XMLDocument()
|
||||
@ -298,17 +300,25 @@ ReportUseOfDeprecatedMethod(nsIDocument *aDoc, const char* aWarning)
|
||||
|
||||
NS_IMETHODIMP
|
||||
XMLDocument::Load(const nsAString& aUrl, bool *aReturn)
|
||||
{
|
||||
ErrorResult rv;
|
||||
*aReturn = Load(aUrl, rv);
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
bool
|
||||
XMLDocument::Load(const nsAString& aUrl, ErrorResult& aRv)
|
||||
{
|
||||
bool hasHadScriptObject = true;
|
||||
nsIScriptGlobalObject* scriptObject =
|
||||
GetScriptHandlingObject(hasHadScriptObject);
|
||||
NS_ENSURE_STATE(scriptObject || !hasHadScriptObject);
|
||||
if (!scriptObject && hasHadScriptObject) {
|
||||
aRv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return false;
|
||||
}
|
||||
|
||||
ReportUseOfDeprecatedMethod(this, "UseOfDOM3LoadMethodWarning");
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aReturn);
|
||||
*aReturn = false;
|
||||
|
||||
nsCOMPtr<nsIDocument> callingDoc =
|
||||
do_QueryInterface(nsContentUtils::GetDocumentFromContext());
|
||||
|
||||
@ -324,7 +334,8 @@ XMLDocument::Load(const nsAString& aUrl, bool *aReturn)
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), aUrl, charset.get(), baseURI);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
aRv.Throw(rv);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check to see whether the current document is allowed to load this URI.
|
||||
@ -338,7 +349,10 @@ XMLDocument::Load(const nsAString& aUrl, bool *aReturn)
|
||||
nsCOMPtr<nsIPrincipal> principal = NodePrincipal();
|
||||
if (!nsContentUtils::IsSystemPrincipal(principal)) {
|
||||
rv = principal->CheckMayLoad(uri, false, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return false;
|
||||
}
|
||||
|
||||
int16_t shouldLoad = nsIContentPolicy::ACCEPT;
|
||||
rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_XMLHTTPREQUEST,
|
||||
@ -351,9 +365,13 @@ XMLDocument::Load(const nsAString& aUrl, bool *aReturn)
|
||||
&shouldLoad,
|
||||
nsContentUtils::GetContentPolicy(),
|
||||
nsContentUtils::GetSecurityManager());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return false;
|
||||
}
|
||||
if (NS_CP_REJECTED(shouldLoad)) {
|
||||
return NS_ERROR_CONTENT_BLOCKED;
|
||||
aRv.Throw(NS_ERROR_CONTENT_BLOCKED);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
// We're called from chrome, check to make sure the URI we're
|
||||
@ -370,7 +388,10 @@ XMLDocument::Load(const nsAString& aUrl, bool *aReturn)
|
||||
"longer supported. Use XMLHttpRequest instead.");
|
||||
nsCOMPtr<nsIScriptError> errorObject =
|
||||
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return false;
|
||||
}
|
||||
|
||||
rv = errorObject->InitWithWindowID(error,
|
||||
NS_ConvertUTF8toUTF16(spec),
|
||||
@ -381,7 +402,10 @@ XMLDocument::Load(const nsAString& aUrl, bool *aReturn)
|
||||
callingDoc->InnerWindowID() :
|
||||
this->InnerWindowID());
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIConsoleService> consoleService =
|
||||
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
|
||||
@ -389,7 +413,8 @@ XMLDocument::Load(const nsAString& aUrl, bool *aReturn)
|
||||
consoleService->LogMessage(errorObject);
|
||||
}
|
||||
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
aRv.Throw(NS_ERROR_DOM_SECURITY_ERR);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -418,7 +443,10 @@ XMLDocument::Load(const nsAString& aUrl, bool *aReturn)
|
||||
|
||||
// Create a channel
|
||||
nsCOMPtr<nsIInterfaceRequestor> req = nsContentUtils::GetSameOriginChecker();
|
||||
NS_ENSURE_TRUE(req, NS_ERROR_OUT_OF_MEMORY);
|
||||
if (!req) {
|
||||
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
// nsIRequest::LOAD_BACKGROUND prevents throbber from becoming active,
|
||||
@ -426,7 +454,8 @@ XMLDocument::Load(const nsAString& aUrl, bool *aReturn)
|
||||
rv = NS_NewChannel(getter_AddRefs(channel), uri, nullptr, loadGroup, req,
|
||||
nsIRequest::LOAD_BACKGROUND);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
aRv.Throw(rv);
|
||||
return false;
|
||||
}
|
||||
|
||||
// StartDocumentLoad asserts that readyState is uninitialized, so
|
||||
@ -444,7 +473,8 @@ XMLDocument::Load(const nsAString& aUrl, bool *aReturn)
|
||||
getter_AddRefs(listener),
|
||||
false))) {
|
||||
NS_ERROR("XMLDocument::Load: Failed to start the document load.");
|
||||
return rv;
|
||||
aRv.Throw(rv);
|
||||
return false;
|
||||
}
|
||||
|
||||
// After this point, if we error out of this method we should clear
|
||||
@ -454,7 +484,8 @@ XMLDocument::Load(const nsAString& aUrl, bool *aReturn)
|
||||
rv = channel->AsyncOpen(listener, nullptr);
|
||||
if (NS_FAILED(rv)) {
|
||||
mChannelIsPending = false;
|
||||
return rv;
|
||||
aRv.Throw(rv);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!mAsync) {
|
||||
@ -468,23 +499,21 @@ XMLDocument::Load(const nsAString& aUrl, bool *aReturn)
|
||||
}
|
||||
|
||||
// We set return to true unless there was a parsing error
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(GetRootElement());
|
||||
if (node) {
|
||||
nsAutoString name, ns;
|
||||
if (NS_SUCCEEDED(node->GetLocalName(name)) &&
|
||||
name.EqualsLiteral("parsererror") &&
|
||||
NS_SUCCEEDED(node->GetNamespaceURI(ns)) &&
|
||||
ns.EqualsLiteral("http://www.mozilla.org/newlayout/xml/parsererror.xml")) {
|
||||
//return is already false
|
||||
} else {
|
||||
*aReturn = true;
|
||||
Element* rootElement = GetRootElement();
|
||||
if (!rootElement) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (rootElement->LocalName().EqualsLiteral("parsererror")) {
|
||||
nsAutoString ns;
|
||||
rootElement->GetNamespaceURI(ns);
|
||||
if (ns.EqualsLiteral("http://www.mozilla.org/newlayout/xml/parsererror.xml")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
*aReturn = true;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -598,5 +627,15 @@ XMLDocument::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
|
||||
return CallQueryInterface(clone.get(), aResult);
|
||||
}
|
||||
|
||||
JSObject*
|
||||
XMLDocument::WrapNode(JSContext *aCx, JSObject *aScope)
|
||||
{
|
||||
JSObject* obj = XMLDocumentBinding::Wrap(aCx, aScope, this);
|
||||
if (obj && !PostCreateWrapper(aCx, obj)) {
|
||||
return nullptr;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -51,7 +51,26 @@ public:
|
||||
virtual void DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const;
|
||||
// DocSizeOfIncludingThis is inherited from nsIDocument.
|
||||
|
||||
|
||||
// WebIDL API
|
||||
bool Load(const nsAString& aUrl, mozilla::ErrorResult& aRv);
|
||||
bool Async() const
|
||||
{
|
||||
return mAsync;
|
||||
}
|
||||
// The XPCOM SetAsync is ok for us
|
||||
|
||||
// .location is [Unforgeable], so we have to make it clear that the
|
||||
// nsIDocument version applies to us (it's shadowed by the XPCOM thing on
|
||||
// nsDocument).
|
||||
using nsIDocument::GetLocation;
|
||||
// But then we need to also pull in the nsDocument XPCOM version
|
||||
// because nsXULDocument tries to forward to it.
|
||||
using nsDocument::GetLocation;
|
||||
|
||||
protected:
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope) MOZ_OVERRIDE;
|
||||
|
||||
// mChannelIsPending indicates whether we're currently asynchronously loading
|
||||
// data from mChannel (via document.load() or normal load). It's set to true
|
||||
// when we first find out about the channel (StartDocumentLoad) and set to
|
||||
|
@ -65,7 +65,7 @@
|
||||
#include "nsXULControllers.h"
|
||||
#include "nsIBoxObject.h"
|
||||
#include "nsPIBoxObject.h"
|
||||
#include "nsXULDocument.h"
|
||||
#include "XULDocument.h"
|
||||
#include "nsXULPopupListener.h"
|
||||
#include "nsRuleWalker.h"
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
@ -106,6 +106,7 @@
|
||||
#include "mozilla/dom/XULElementBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
@ -436,7 +437,7 @@ nsXULElement::GetElementsByAttribute(const nsAString& aAttribute,
|
||||
void* attrValue = new nsString(aValue);
|
||||
nsRefPtr<nsContentList> list =
|
||||
new nsContentList(this,
|
||||
nsXULDocument::MatchAttribute,
|
||||
XULDocument::MatchAttribute,
|
||||
nsContentUtils::DestroyMatchString,
|
||||
attrValue,
|
||||
true,
|
||||
@ -478,7 +479,7 @@ nsXULElement::GetElementsByAttributeNS(const nsAString& aNamespaceURI,
|
||||
void* attrValue = new nsString(aValue);
|
||||
nsRefPtr<nsContentList> list =
|
||||
new nsContentList(this,
|
||||
nsXULDocument::MatchAttribute,
|
||||
XULDocument::MatchAttribute,
|
||||
nsContentUtils::DestroyMatchString,
|
||||
attrValue,
|
||||
true,
|
||||
@ -1366,10 +1367,8 @@ nsXULElement::GetBoxObject(nsIBoxObject** aResult)
|
||||
already_AddRefed<nsIBoxObject>
|
||||
nsXULElement::GetBoxObject(ErrorResult& rv)
|
||||
{
|
||||
nsCOMPtr<nsIBoxObject> boxObject;
|
||||
// XXX sXBL/XBL2 issue! Owner or current document?
|
||||
rv = OwnerDoc()->GetBoxObjectFor(this, getter_AddRefs(boxObject));
|
||||
return boxObject.forget();
|
||||
return OwnerDoc()->GetBoxObjectFor(this, rv);
|
||||
}
|
||||
|
||||
// Methods for setting/getting attributes from nsIDOMXULElement
|
||||
@ -2492,7 +2491,7 @@ nsXULPrototypeScript::DeserializeOutOfLine(nsIObjectInputStream* aInput,
|
||||
if (mSrcURI) {
|
||||
// NB: we must check the XUL script cache early, to avoid
|
||||
// multiple deserialization attempts for a given script.
|
||||
// Note that nsXULDocument::LoadScript
|
||||
// Note that XULDocument::LoadScript
|
||||
// checks the XUL script cache too, in order to handle the
|
||||
// serialization case.
|
||||
//
|
||||
@ -2600,7 +2599,7 @@ nsXULPrototypeScript::Compile(const PRUnichar* aText,
|
||||
// protodoc's?
|
||||
// If we start using the protodoc's, make sure
|
||||
// the DowngradePrincipalIfNeeded stuff in
|
||||
// nsXULDocument::OnStreamComplete still works!
|
||||
// XULDocument::OnStreamComplete still works!
|
||||
aDocument->NodePrincipal(),
|
||||
urlspec.get(),
|
||||
aLineNo,
|
||||
|
@ -199,7 +199,11 @@ public:
|
||||
nsXULPrototypeAttribute* mAttributes; // [OWNER]
|
||||
};
|
||||
|
||||
class nsXULDocument;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class XULDocument;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
class nsXULPrototypeScript : public nsXULPrototypeNode
|
||||
{
|
||||
@ -242,7 +246,7 @@ public:
|
||||
uint32_t mLineNo;
|
||||
bool mSrcLoading;
|
||||
bool mOutOfLine;
|
||||
nsXULDocument* mSrcLoadWaiters; // [OWNER] but not COMPtr
|
||||
mozilla::dom::XULDocument* mSrcLoadWaiters; // [OWNER] but not COMPtr
|
||||
uint32_t mLangVersion;
|
||||
private:
|
||||
JSScript* mScriptObject;
|
||||
|
@ -20,7 +20,7 @@ ifdef MOZ_XUL
|
||||
CPPSRCS += \
|
||||
nsXULCommandDispatcher.cpp \
|
||||
nsXULContentSink.cpp \
|
||||
nsXULDocument.cpp \
|
||||
XULDocument.cpp \
|
||||
nsXULPrototypeCache.cpp \
|
||||
nsXULPrototypeDocument.cpp \
|
||||
$(NULL)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,8 +3,8 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsXULDocument_h__
|
||||
#define nsXULDocument_h__
|
||||
#ifndef mozilla_dom_XULDocument_h
|
||||
#define mozilla_dom_XULDocument_h
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXULPrototypeDocument.h"
|
||||
@ -81,15 +81,19 @@ private:
|
||||
/**
|
||||
* The XUL document class
|
||||
*/
|
||||
class nsXULDocument : public mozilla::dom::XMLDocument,
|
||||
public nsIXULDocument,
|
||||
public nsIDOMXULDocument,
|
||||
public nsIStreamLoaderObserver,
|
||||
public nsICSSLoaderObserver
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class XULDocument : public XMLDocument,
|
||||
public nsIXULDocument,
|
||||
public nsIDOMXULDocument,
|
||||
public nsIStreamLoaderObserver,
|
||||
public nsICSSLoaderObserver
|
||||
{
|
||||
public:
|
||||
nsXULDocument();
|
||||
virtual ~nsXULDocument();
|
||||
XULDocument();
|
||||
virtual ~XULDocument();
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
@ -140,7 +144,7 @@ public:
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
|
||||
// nsIDOMDocument interface
|
||||
NS_FORWARD_NSIDOMDOCUMENT(mozilla::dom::XMLDocument::)
|
||||
NS_FORWARD_NSIDOMDOCUMENT(XMLDocument::)
|
||||
// And explicitly import the things from nsDocument that we just shadowed
|
||||
using nsDocument::GetImplementation;
|
||||
using nsDocument::GetTitle;
|
||||
@ -148,9 +152,10 @@ public:
|
||||
using nsDocument::GetLastStyleSheetSet;
|
||||
using nsDocument::MozSetImageElement;
|
||||
using nsDocument::GetMozFullScreenElement;
|
||||
using nsIDocument::GetLocation;
|
||||
|
||||
// nsDocument interface overrides
|
||||
virtual mozilla::dom::Element* GetElementById(const nsAString & elementId);
|
||||
virtual Element* GetElementById(const nsAString & elementId);
|
||||
|
||||
// nsIDOMXULDocument interface
|
||||
NS_DECL_NSIDOMXULDOCUMENT
|
||||
@ -176,25 +181,60 @@ public:
|
||||
nsIAtom* aAttrName,
|
||||
void* aData);
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULDocument,
|
||||
mozilla::dom::XMLDocument)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULDocument, XMLDocument)
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
void TraceProtos(JSTracer* aTrc, uint32_t aGCNumber);
|
||||
|
||||
// WebIDL API
|
||||
already_AddRefed<nsINode> GetPopupNode();
|
||||
void SetPopupNode(nsINode* aNode);
|
||||
already_AddRefed<nsINode> GetPopupRangeParent(ErrorResult& aRv);
|
||||
int32_t GetPopupRangeOffset(ErrorResult& aRv);
|
||||
already_AddRefed<nsINode> GetTooltipNode();
|
||||
void SetTooltipNode(nsINode* aNode) { /* do nothing */ }
|
||||
nsIDOMXULCommandDispatcher* GetCommandDispatcher() const
|
||||
{
|
||||
return mCommandDispatcher;
|
||||
}
|
||||
int32_t GetWidth(ErrorResult& aRv);
|
||||
int32_t GetHeight(ErrorResult& aRv);
|
||||
already_AddRefed<nsINodeList>
|
||||
GetElementsByAttribute(const nsAString& aAttribute,
|
||||
const nsAString& aValue);
|
||||
already_AddRefed<nsINodeList>
|
||||
GetElementsByAttributeNS(const nsAString& aNamespaceURI,
|
||||
const nsAString& aAttribute,
|
||||
const nsAString& aValue,
|
||||
ErrorResult& aRv);
|
||||
void AddBroadcastListenerFor(Element& aBroadcaster, Element& aListener,
|
||||
const nsAString& aAttr, ErrorResult& aRv);
|
||||
void RemoveBroadcastListenerFor(Element& aBroadcaster, Element& aListener,
|
||||
const nsAString& aAttr);
|
||||
void Persist(const nsAString& aId, const nsAString& aAttr, ErrorResult& aRv)
|
||||
{
|
||||
aRv = Persist(aId, aAttr);
|
||||
}
|
||||
using nsDocument::GetBoxObjectFor;
|
||||
void LoadOverlay(const nsAString& aURL, nsIObserver* aObserver,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
aRv = LoadOverlay(aURL, aObserver);
|
||||
}
|
||||
|
||||
protected:
|
||||
// Implementation methods
|
||||
friend nsresult
|
||||
NS_NewXULDocument(nsIXULDocument** aResult);
|
||||
(::NS_NewXULDocument(nsIXULDocument** aResult));
|
||||
|
||||
nsresult Init(void);
|
||||
nsresult StartLayout(void);
|
||||
|
||||
nsresult
|
||||
AddElementToRefMap(mozilla::dom::Element* aElement);
|
||||
AddElementToRefMap(Element* aElement);
|
||||
void
|
||||
RemoveElementFromRefMap(mozilla::dom::Element* aElement);
|
||||
RemoveElementFromRefMap(Element* aElement);
|
||||
|
||||
nsresult GetViewportSize(int32_t* aWidth, int32_t* aHeight);
|
||||
|
||||
@ -220,14 +260,14 @@ protected:
|
||||
nsCOMArray<nsIContent>& aElements);
|
||||
|
||||
nsresult
|
||||
AddElementToDocumentPre(mozilla::dom::Element* aElement);
|
||||
AddElementToDocumentPre(Element* aElement);
|
||||
|
||||
nsresult
|
||||
AddElementToDocumentPost(mozilla::dom::Element* aElement);
|
||||
AddElementToDocumentPost(Element* aElement);
|
||||
|
||||
nsresult
|
||||
ExecuteOnBroadcastHandlerFor(nsIContent* aBroadcaster,
|
||||
nsIDOMElement* aListener,
|
||||
ExecuteOnBroadcastHandlerFor(Element* aBroadcaster,
|
||||
Element* aListener,
|
||||
nsIAtom* aAttr);
|
||||
|
||||
nsresult
|
||||
@ -256,6 +296,8 @@ protected:
|
||||
nsresult
|
||||
Persist(nsIContent* aElement, int32_t aNameSpaceID, nsIAtom* aAttribute);
|
||||
|
||||
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope) MOZ_OVERRIDE;
|
||||
|
||||
// IMPORTANT: The ownership implicit in the following member
|
||||
// variables has been explicitly checked and set using nsCOMPtr
|
||||
// for owning pointers and raw COM interface pointers for weak
|
||||
@ -264,7 +306,7 @@ protected:
|
||||
// NOTE, THIS IS STILL IN PROGRESS, TALK TO PINK OR SCC BEFORE
|
||||
// CHANGING
|
||||
|
||||
nsXULDocument* mNextSrcLoadWaiter; // [OWNER] but not COMPtr
|
||||
XULDocument* mNextSrcLoadWaiter; // [OWNER] but not COMPtr
|
||||
|
||||
// Tracks elements with a 'ref' attribute, or an 'id' attribute where
|
||||
// the element's namespace has no registered ID attribute name.
|
||||
@ -376,7 +418,7 @@ protected:
|
||||
* Note that the resulting content node is not bound to any tree
|
||||
*/
|
||||
nsresult CreateElementFromPrototype(nsXULPrototypeElement* aPrototype,
|
||||
mozilla::dom::Element** aResult,
|
||||
Element** aResult,
|
||||
bool aIsRoot);
|
||||
|
||||
/**
|
||||
@ -384,7 +426,7 @@ protected:
|
||||
* later resolution.
|
||||
*/
|
||||
nsresult CreateOverlayElement(nsXULPrototypeElement* aPrototype,
|
||||
mozilla::dom::Element** aResult);
|
||||
Element** aResult);
|
||||
|
||||
/**
|
||||
* Add attributes from the prototype to the element.
|
||||
@ -452,13 +494,13 @@ protected:
|
||||
class BroadcasterHookup : public nsForwardReference
|
||||
{
|
||||
protected:
|
||||
nsXULDocument* mDocument; // [WEAK]
|
||||
nsRefPtr<mozilla::dom::Element> mObservesElement; // [OWNER]
|
||||
XULDocument* mDocument; // [WEAK]
|
||||
nsRefPtr<Element> mObservesElement; // [OWNER]
|
||||
bool mResolved;
|
||||
|
||||
public:
|
||||
BroadcasterHookup(nsXULDocument* aDocument,
|
||||
mozilla::dom::Element* aObservesElement)
|
||||
BroadcasterHookup(XULDocument* aDocument,
|
||||
Element* aObservesElement)
|
||||
: mDocument(aDocument),
|
||||
mObservesElement(aObservesElement),
|
||||
mResolved(false)
|
||||
@ -480,14 +522,14 @@ protected:
|
||||
class OverlayForwardReference : public nsForwardReference
|
||||
{
|
||||
protected:
|
||||
nsXULDocument* mDocument; // [WEAK]
|
||||
XULDocument* mDocument; // [WEAK]
|
||||
nsCOMPtr<nsIContent> mOverlay; // [OWNER]
|
||||
bool mResolved;
|
||||
|
||||
nsresult Merge(nsIContent* aTargetNode, nsIContent* aOverlayNode, bool aNotify);
|
||||
|
||||
public:
|
||||
OverlayForwardReference(nsXULDocument* aDocument, nsIContent* aOverlay)
|
||||
OverlayForwardReference(XULDocument* aDocument, nsIContent* aOverlay)
|
||||
: mDocument(aDocument), mOverlay(aOverlay), mResolved(false) {}
|
||||
|
||||
virtual ~OverlayForwardReference();
|
||||
@ -518,20 +560,20 @@ protected:
|
||||
// values of the out params should not be relied on (though *aListener and
|
||||
// *aBroadcaster do need to be released if non-null, of course).
|
||||
nsresult
|
||||
FindBroadcaster(mozilla::dom::Element* aElement,
|
||||
nsIDOMElement** aListener,
|
||||
FindBroadcaster(Element* aElement,
|
||||
Element** aListener,
|
||||
nsString& aBroadcasterID,
|
||||
nsString& aAttribute,
|
||||
nsIDOMElement** aBroadcaster);
|
||||
Element** aBroadcaster);
|
||||
|
||||
nsresult
|
||||
CheckBroadcasterHookup(mozilla::dom::Element* aElement,
|
||||
CheckBroadcasterHookup(Element* aElement,
|
||||
bool* aNeedsHookup,
|
||||
bool* aDidResolve);
|
||||
|
||||
void
|
||||
SynchronizeBroadcastListener(nsIDOMElement *aBroadcaster,
|
||||
nsIDOMElement *aListener,
|
||||
SynchronizeBroadcastListener(Element *aBroadcaster,
|
||||
Element *aListener,
|
||||
const nsAString &aAttr);
|
||||
|
||||
static
|
||||
@ -625,13 +667,13 @@ protected:
|
||||
|
||||
class CachedChromeStreamListener : public nsIStreamListener {
|
||||
protected:
|
||||
nsXULDocument* mDocument;
|
||||
bool mProtoLoaded;
|
||||
XULDocument* mDocument;
|
||||
bool mProtoLoaded;
|
||||
|
||||
virtual ~CachedChromeStreamListener();
|
||||
|
||||
public:
|
||||
CachedChromeStreamListener(nsXULDocument* aDocument,
|
||||
CachedChromeStreamListener(XULDocument* aDocument,
|
||||
bool aProtoLoaded);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
@ -644,12 +686,12 @@ protected:
|
||||
|
||||
class ParserObserver : public nsIRequestObserver {
|
||||
protected:
|
||||
nsRefPtr<nsXULDocument> mDocument;
|
||||
nsRefPtr<XULDocument> mDocument;
|
||||
nsRefPtr<nsXULPrototypeDocument> mPrototype;
|
||||
virtual ~ParserObserver();
|
||||
|
||||
public:
|
||||
ParserObserver(nsXULDocument* aDocument,
|
||||
ParserObserver(XULDocument* aDocument,
|
||||
nsXULPrototypeDocument* aPrototype);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
@ -671,14 +713,14 @@ protected:
|
||||
class nsDelayedBroadcastUpdate
|
||||
{
|
||||
public:
|
||||
nsDelayedBroadcastUpdate(nsIDOMElement* aBroadcaster,
|
||||
nsIDOMElement* aListener,
|
||||
nsDelayedBroadcastUpdate(Element* aBroadcaster,
|
||||
Element* aListener,
|
||||
const nsAString &aAttr)
|
||||
: mBroadcaster(aBroadcaster), mListener(aListener), mAttr(aAttr),
|
||||
mSetAttr(false), mNeedsAttrChange(false) {}
|
||||
|
||||
nsDelayedBroadcastUpdate(nsIDOMElement* aBroadcaster,
|
||||
nsIDOMElement* aListener,
|
||||
nsDelayedBroadcastUpdate(Element* aBroadcaster,
|
||||
Element* aListener,
|
||||
nsIAtom* aAttrName,
|
||||
const nsAString &aAttr,
|
||||
bool aSetAttr,
|
||||
@ -692,8 +734,8 @@ protected:
|
||||
mAttr(aOther.mAttr), mAttrName(aOther.mAttrName),
|
||||
mSetAttr(aOther.mSetAttr), mNeedsAttrChange(aOther.mNeedsAttrChange) {}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> mBroadcaster;
|
||||
nsCOMPtr<nsIDOMElement> mListener;
|
||||
nsCOMPtr<Element> mBroadcaster;
|
||||
nsCOMPtr<Element> mListener;
|
||||
// Note if mAttrName isn't used, this is the name of the attr, otherwise
|
||||
// this is the value of the attribute.
|
||||
nsString mAttr;
|
||||
@ -720,4 +762,7 @@ private:
|
||||
|
||||
};
|
||||
|
||||
#endif // nsXULDocument_h__
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_XULDocument_h
|
@ -5,7 +5,7 @@
|
||||
|
||||
|
||||
#include "nsXULPrototypeDocument.h"
|
||||
#include "nsXULDocument.h"
|
||||
#include "XULDocument.h"
|
||||
|
||||
#include "nsAString.h"
|
||||
#include "nsIObjectInputStream.h"
|
||||
@ -34,6 +34,7 @@
|
||||
|
||||
using mozilla::dom::DestroyProtoAndIfaceCache;
|
||||
using mozilla::AutoPushJSContext;
|
||||
using mozilla::dom::XULDocument;
|
||||
|
||||
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID,
|
||||
NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
||||
@ -637,7 +638,7 @@ nsXULPrototypeDocument::GetNodeInfoManager()
|
||||
|
||||
|
||||
nsresult
|
||||
nsXULPrototypeDocument::AwaitLoadDone(nsXULDocument* aDocument, bool* aResult)
|
||||
nsXULPrototypeDocument::AwaitLoadDone(XULDocument* aDocument, bool* aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
@ -18,18 +18,23 @@ class nsIAtom;
|
||||
class nsIPrincipal;
|
||||
class nsIURI;
|
||||
class nsNodeInfoManager;
|
||||
class nsXULDocument;
|
||||
class nsXULPrototypeElement;
|
||||
class nsXULPrototypePI;
|
||||
class nsXULPDGlobalObject;
|
||||
struct JSTracer;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class XULDocument;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
/**
|
||||
* A "prototype" document that stores shared document information
|
||||
* for the XUL cache.
|
||||
* Among other things, stores the tree of nsXULPrototype*
|
||||
* objects, from which the real DOM tree is built later in
|
||||
* nsXULDocument::ResumeWalk.
|
||||
* XULDocument::ResumeWalk.
|
||||
*/
|
||||
class nsXULPrototypeDocument : public nsIScriptGlobalObjectOwner,
|
||||
public nsISerializable
|
||||
@ -93,10 +98,10 @@ public:
|
||||
/**
|
||||
* If current prototype document has not yet finished loading,
|
||||
* appends aDocument to the list of documents to notify (via
|
||||
* nsXULDocument::OnPrototypeLoadDone()) and sets aLoaded to false.
|
||||
* XULDocument::OnPrototypeLoadDone()) and sets aLoaded to false.
|
||||
* Otherwise sets aLoaded to true.
|
||||
*/
|
||||
nsresult AwaitLoadDone(nsXULDocument* aDocument, bool* aResult);
|
||||
nsresult AwaitLoadDone(mozilla::dom::XULDocument* aDocument, bool* aResult);
|
||||
|
||||
/**
|
||||
* Notifies each document registered via AwaitLoadDone on this
|
||||
@ -130,7 +135,7 @@ protected:
|
||||
nsRefPtr<nsXULPDGlobalObject> mGlobalObject;
|
||||
|
||||
bool mLoaded;
|
||||
nsTArray< nsRefPtr<nsXULDocument> > mPrototypeWaiters;
|
||||
nsTArray< nsRefPtr<mozilla::dom::XULDocument> > mPrototypeWaiters;
|
||||
|
||||
nsRefPtr<nsNodeInfoManager> mNodeInfoManager;
|
||||
|
||||
|
@ -812,10 +812,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
// SVG element classes
|
||||
NS_DEFINE_CLASSINFO_DATA(TimeEvent, nsEventSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGFEMorphologyElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGFETurbulenceElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA_WITH_NAME(SVGUnknownElement, SVGElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
|
||||
@ -2225,18 +2221,6 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_EVENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(SVGFEMorphologyElement, nsIDOMSVGFEMorphologyElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEMorphologyElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
|
||||
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(SVGFETurbulenceElement, nsIDOMSVGFETurbulenceElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFETurbulenceElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
|
||||
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(SVGUnknownElement, nsIDOMSVGElement)
|
||||
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
@ -122,8 +122,6 @@ DOMCI_CLASS(SVGDocument)
|
||||
|
||||
// SVG element classes
|
||||
DOMCI_CLASS(TimeEvent)
|
||||
DOMCI_CLASS(SVGFEMorphologyElement)
|
||||
DOMCI_CLASS(SVGFETurbulenceElement)
|
||||
DOMCI_CLASS(SVGUnknownElement)
|
||||
|
||||
// other SVG classes
|
||||
|
@ -63,6 +63,7 @@
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/indexedDB/FileInfo.h"
|
||||
#include "mozilla/dom/indexedDB/IndexedDatabaseManager.h"
|
||||
#include "mozilla/dom/quota/QuotaManager.h"
|
||||
#include "GeckoProfiler.h"
|
||||
#include "nsDOMBlobBuilder.h"
|
||||
#include "nsIDOMFileHandle.h"
|
||||
@ -2756,8 +2757,7 @@ nsDOMWindowUtils::GetFileReferences(const nsAString& aDatabaseName,
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
||||
|
||||
nsCString origin;
|
||||
nsresult rv = indexedDB::IndexedDatabaseManager::GetASCIIOriginFromWindow(
|
||||
window, origin);
|
||||
nsresult rv = quota::QuotaManager::GetASCIIOriginFromWindow(window, origin);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRefPtr<indexedDB::IndexedDatabaseManager> mgr =
|
||||
|
@ -207,7 +207,7 @@
|
||||
#include "prenv.h"
|
||||
|
||||
#include "mozilla/dom/indexedDB/IDBFactory.h"
|
||||
#include "mozilla/dom/indexedDB/IndexedDatabaseManager.h"
|
||||
#include "mozilla/dom/quota/QuotaManager.h"
|
||||
|
||||
#include "mozilla/dom/StructuredCloneTags.h"
|
||||
|
||||
@ -1390,11 +1390,10 @@ nsGlobalWindow::FreeInnerObjects()
|
||||
AutoPushJSContext cx(scx ? scx->GetNativeContext() : nullptr);
|
||||
mozilla::dom::workers::CancelWorkersForWindow(cx, this);
|
||||
|
||||
// Close all IndexedDB databases for this window.
|
||||
indexedDB::IndexedDatabaseManager* idbManager =
|
||||
indexedDB::IndexedDatabaseManager::Get();
|
||||
if (idbManager) {
|
||||
idbManager->AbortCloseDatabasesForWindow(this);
|
||||
// Close all offline storages for this window.
|
||||
quota::QuotaManager* quotaManager = quota::QuotaManager::Get();
|
||||
if (quotaManager) {
|
||||
quotaManager->AbortCloseStoragesForWindow(this);
|
||||
}
|
||||
|
||||
ClearAllTimeouts();
|
||||
|
@ -126,6 +126,10 @@ DOMInterfaces = {
|
||||
'concrete': False,
|
||||
},
|
||||
|
||||
'BeforeUnloadEvent': {
|
||||
'nativeType': 'nsDOMBeforeUnloadEvent',
|
||||
},
|
||||
|
||||
'BiquadFilterNode': {
|
||||
'resultNotAddRefed': [ 'frequency', 'q', 'gain' ],
|
||||
'wrapperCache': False
|
||||
@ -179,6 +183,10 @@ DOMInterfaces = {
|
||||
'nativeType': 'nsDOMCommandEvent',
|
||||
},
|
||||
|
||||
'CompositionEvent': {
|
||||
'nativeType': 'nsDOMCompositionEvent',
|
||||
},
|
||||
|
||||
'CSS': {
|
||||
'concrete': False,
|
||||
},
|
||||
@ -864,6 +872,11 @@ DOMInterfaces = {
|
||||
'headerFile': 'mozilla/dom/SVGGradientElement.h',
|
||||
},
|
||||
|
||||
'SVGRect': {
|
||||
'wrapperCache': False,
|
||||
'nativeType': 'mozilla::dom::SVGIRect'
|
||||
},
|
||||
|
||||
'SVGTextContentElement': {
|
||||
'concrete': False
|
||||
},
|
||||
@ -1095,6 +1108,10 @@ DOMInterfaces = {
|
||||
'wrapperCache': False
|
||||
},
|
||||
|
||||
'XULDocument': {
|
||||
'headerFile': 'XULDocument.h'
|
||||
},
|
||||
|
||||
'XULElement': {
|
||||
'nativeType': 'nsXULElement',
|
||||
'resultNotAddRefed': [ 'controllers', 'style' ]
|
||||
@ -1360,6 +1377,7 @@ addExternalIface('MenuBuilder', nativeType='nsIMenuBuilder', notflattened=True)
|
||||
addExternalIface('MozBoxObject', nativeType='nsIBoxObject')
|
||||
addExternalIface('MozControllers', nativeType='nsIControllers')
|
||||
addExternalIface('MozFrameLoader', nativeType='nsIFrameLoader', notflattened=True)
|
||||
addExternalIface('MozObserver', nativeType='nsIObserver', notflattened=True)
|
||||
addExternalIface('MozRDFCompositeDataSource', nativeType='nsIRDFCompositeDataSource',
|
||||
notflattened=True)
|
||||
addExternalIface('MozRDFResource', nativeType='nsIRDFResource', notflattened=True)
|
||||
@ -1390,3 +1408,4 @@ addExternalIface('WindowProxy', nativeType='nsIDOMWindow')
|
||||
addExternalIface('XPathResult', nativeType='nsISupports')
|
||||
addExternalIface('XPathExpression')
|
||||
addExternalIface('XPathNSResolver')
|
||||
addExternalIface('XULCommandDispatcher')
|
||||
|
@ -5345,7 +5345,11 @@ class ClassMethod(ClassItem):
|
||||
virtual=False, const=False, bodyInHeader=False,
|
||||
templateArgs=None, visibility='public', body=None,
|
||||
breakAfterReturnDecl="\n",
|
||||
breakAfterSelf="\n"):
|
||||
breakAfterSelf="\n", override=False):
|
||||
"""
|
||||
override indicates whether to flag the method as MOZ_OVERRIDE
|
||||
"""
|
||||
assert not override or virtual
|
||||
self.returnType = returnType
|
||||
self.args = args
|
||||
self.inline = inline or bodyInHeader
|
||||
@ -5357,6 +5361,7 @@ class ClassMethod(ClassItem):
|
||||
self.body = body
|
||||
self.breakAfterReturnDecl = breakAfterReturnDecl
|
||||
self.breakAfterSelf = breakAfterSelf
|
||||
self.override = override
|
||||
ClassItem.__init__(self, name, visibility)
|
||||
|
||||
def getDecorators(self, declaring):
|
||||
@ -5388,7 +5393,7 @@ class ClassMethod(ClassItem):
|
||||
body = ';'
|
||||
|
||||
return string.Template("${templateClause}${decorators}${returnType}%s"
|
||||
"${name}(${args})${const}${body}%s" %
|
||||
"${name}(${args})${const}${override}${body}%s" %
|
||||
(self.breakAfterReturnDecl, self.breakAfterSelf)
|
||||
).substitute({
|
||||
'templateClause': templateClause,
|
||||
@ -5396,6 +5401,7 @@ class ClassMethod(ClassItem):
|
||||
'returnType': self.returnType,
|
||||
'name': self.name,
|
||||
'const': ' const' if self.const else '',
|
||||
'override': ' MOZ_OVERRIDE' if self.override else '',
|
||||
'args': args,
|
||||
'body': body
|
||||
})
|
||||
@ -7824,6 +7830,7 @@ class CGBindingImplClass(CGClass):
|
||||
ClassMethod("WrapObject", "JSObject*",
|
||||
wrapArgs, virtual=descriptor.wrapperCache,
|
||||
breakAfterReturnDecl=" ",
|
||||
override=descriptor.wrapperCache,
|
||||
body=self.getWrapObjectBody()))
|
||||
self.methodDecls.insert(0,
|
||||
ClassMethod("GetParentObject",
|
||||
|
@ -88,6 +88,7 @@ LOCAL_INCLUDES += -I$(topsrcdir)/js/xpconnect/src \
|
||||
-I$(topsrcdir)/content/xslt/src/xpath \
|
||||
-I$(topsrcdir)/content/xml/content/src \
|
||||
-I$(topsrcdir)/content/xul/content/src \
|
||||
-I$(topsrcdir)/content/xul/document/src \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_AUDIO_CHANNEL_MANAGER
|
||||
@ -220,11 +221,6 @@ ParserResults.pkl: $(globalgen_dependencies)
|
||||
$(all_webidl_files)
|
||||
|
||||
GARBAGE += \
|
||||
$(binding_header_files) \
|
||||
$(binding_cpp_files) \
|
||||
$(all_webidl_files) \
|
||||
$(globalgen_targets) \
|
||||
ParserResults.pkl \
|
||||
webidlyacc.py \
|
||||
parser.out \
|
||||
$(wildcard *-example.h) \
|
||||
@ -237,4 +233,12 @@ GARBAGE += \
|
||||
# the non-test headers are all exported above anyway.
|
||||
webidl-export:: $(binding_header_files)
|
||||
|
||||
distclean::
|
||||
-$(RM) \
|
||||
$(binding_header_files) \
|
||||
$(binding_cpp_files) \
|
||||
$(all_webidl_files) \
|
||||
$(globalgen_targets) \
|
||||
ParserResults.pkl
|
||||
|
||||
.PHONY: webidl-export
|
||||
|
@ -107,7 +107,7 @@ FileHandle::Open(FileMode aMode, ErrorResult& aError)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (FileService::IsShuttingDown() || mFileStorage->IsStorageShuttingDown()) {
|
||||
if (FileService::IsShuttingDown() || mFileStorage->IsShuttingDown()) {
|
||||
aError.Throw(NS_ERROR_DOM_FILEHANDLE_UNKNOWN_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -152,11 +152,11 @@ FileService::Enqueue(LockedFile* aLockedFile, FileHelper* aFileHelper)
|
||||
|
||||
FileHandle* fileHandle = aLockedFile->mFileHandle;
|
||||
|
||||
if (fileHandle->mFileStorage->IsStorageInvalidated()) {
|
||||
if (fileHandle->mFileStorage->IsInvalidated()) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
nsISupports* storageId = fileHandle->mFileStorage->StorageId();
|
||||
nsIAtom* storageId = fileHandle->mFileStorage->Id();
|
||||
const nsAString& fileName = fileHandle->mFileName;
|
||||
bool modeIsWrite = aLockedFile->mMode == LockedFile::READ_WRITE;
|
||||
|
||||
@ -226,7 +226,7 @@ FileService::NotifyLockedFileCompleted(LockedFile* aLockedFile)
|
||||
NS_ASSERTION(aLockedFile, "Null pointer!");
|
||||
|
||||
FileHandle* fileHandle = aLockedFile->mFileHandle;
|
||||
nsISupports* storageId = fileHandle->mFileStorage->StorageId();
|
||||
nsIAtom* storageId = fileHandle->mFileStorage->Id();
|
||||
|
||||
FileStorageInfo* fileStorageInfo;
|
||||
if (!mFileStorageInfos.Get(storageId, &fileStorageInfo)) {
|
||||
@ -256,10 +256,10 @@ FileService::NotifyLockedFileCompleted(LockedFile* aLockedFile)
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
FileService::WaitForAllStoragesToComplete(
|
||||
nsTArray<nsCOMPtr<nsIFileStorage> >& aStorages,
|
||||
nsIRunnable* aCallback)
|
||||
void
|
||||
FileService::WaitForStoragesToComplete(
|
||||
nsTArray<nsCOMPtr<nsIFileStorage> >& aStorages,
|
||||
nsIRunnable* aCallback)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
NS_ASSERTION(!aStorages.IsEmpty(), "No databases to wait on!");
|
||||
@ -272,8 +272,6 @@ FileService::WaitForAllStoragesToComplete(
|
||||
if (MaybeFireCallback(*callback)) {
|
||||
mCompleteCallbacks.RemoveElementAt(mCompleteCallbacks.Length() - 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
@ -283,7 +281,7 @@ FileService::AbortLockedFilesForStorage(nsIFileStorage* aFileStorage)
|
||||
NS_ASSERTION(aFileStorage, "Null pointer!");
|
||||
|
||||
FileStorageInfo* fileStorageInfo;
|
||||
if (!mFileStorageInfos.Get(aFileStorage->StorageId(), &fileStorageInfo)) {
|
||||
if (!mFileStorageInfos.Get(aFileStorage->Id(), &fileStorageInfo)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -303,7 +301,7 @@ FileService::HasLockedFilesForStorage(nsIFileStorage* aFileStorage)
|
||||
NS_ASSERTION(aFileStorage, "Null pointer!");
|
||||
|
||||
FileStorageInfo* fileStorageInfo;
|
||||
if (!mFileStorageInfos.Get(aFileStorage->StorageId(), &fileStorageInfo)) {
|
||||
if (!mFileStorageInfos.Get(aFileStorage->Id(), &fileStorageInfo)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -330,8 +328,7 @@ FileService::MaybeFireCallback(StoragesCompleteCallback& aCallback)
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
for (uint32_t index = 0; index < aCallback.mStorages.Length(); index++) {
|
||||
if (mFileStorageInfos.Get(aCallback.mStorages[index]->StorageId(),
|
||||
nullptr)) {
|
||||
if (mFileStorageInfos.Get(aCallback.mStorages[index]->Id(), nullptr)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -488,7 +485,7 @@ FileService::FileStorageInfo::RemoveLockedFileQueue(LockedFile* aLockedFile)
|
||||
|
||||
bool
|
||||
FileService::FileStorageInfo::HasRunningLockedFiles(
|
||||
nsIFileStorage* aFileStorage)
|
||||
nsIFileStorage* aFileStorage)
|
||||
{
|
||||
for (uint32_t index = 0; index < mLockedFileQueues.Length(); index++) {
|
||||
LockedFile* lockedFile = mLockedFileQueues[index]->mLockedFile;
|
||||
|
@ -46,9 +46,9 @@ public:
|
||||
void
|
||||
NotifyLockedFileCompleted(LockedFile* aLockedFile);
|
||||
|
||||
bool
|
||||
WaitForAllStoragesToComplete(nsTArray<nsCOMPtr<nsIFileStorage> >& aStorages,
|
||||
nsIRunnable* aCallback);
|
||||
void
|
||||
WaitForStoragesToComplete(nsTArray<nsCOMPtr<nsIFileStorage> >& aStorages,
|
||||
nsIRunnable* aCallback);
|
||||
|
||||
void
|
||||
AbortLockedFilesForStorage(nsIFileStorage* aFileStorage);
|
||||
@ -129,8 +129,8 @@ private:
|
||||
|
||||
inline void
|
||||
CollectRunningAndDelayedLockedFiles(
|
||||
nsIFileStorage* aFileStorage,
|
||||
nsTArray<nsRefPtr<LockedFile> >& aLockedFiles);
|
||||
nsIFileStorage* aFileStorage,
|
||||
nsTArray<nsRefPtr<LockedFile> >& aLockedFiles);
|
||||
|
||||
void
|
||||
LockFileForReading(const nsAString& aFileName)
|
||||
|
@ -384,7 +384,7 @@ LockedFile::CreateParallelStream(nsISupports** aStream)
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
nsIFileStorage* fileStorage = mFileHandle->mFileStorage;
|
||||
if (fileStorage->IsStorageInvalidated()) {
|
||||
if (fileStorage->IsInvalidated()) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
@ -404,7 +404,7 @@ LockedFile::GetOrCreateStream(nsISupports** aStream)
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
nsIFileStorage* fileStorage = mFileHandle->mFileStorage;
|
||||
if (fileStorage->IsStorageInvalidated()) {
|
||||
if (fileStorage->IsInvalidated()) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
@ -957,7 +957,7 @@ FinishHelper::Run()
|
||||
}
|
||||
|
||||
nsIFileStorage* fileStorage = mLockedFile->mFileHandle->mFileStorage;
|
||||
if (fileStorage->IsStorageInvalidated()) {
|
||||
if (fileStorage->IsInvalidated()) {
|
||||
mAborted = true;
|
||||
}
|
||||
|
||||
|
@ -10,52 +10,50 @@
|
||||
#include "nsISupports.h"
|
||||
|
||||
#define NS_FILESTORAGE_IID \
|
||||
{0xa0801944, 0x2f1c, 0x4203, \
|
||||
{ 0x9c, 0xaa, 0xaa, 0x47, 0xe0, 0x0c, 0x67, 0x92 } }
|
||||
{0x6278f453, 0xd557, 0x4a55, \
|
||||
{ 0x99, 0x3e, 0xf4, 0x69, 0xe2, 0xa5, 0xe1, 0xd0 } }
|
||||
|
||||
class nsIAtom;
|
||||
|
||||
class nsIFileStorage : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_FILESTORAGE_IID)
|
||||
|
||||
virtual const nsACString&
|
||||
StorageOrigin() = 0;
|
||||
NS_IMETHOD_(nsIAtom*)
|
||||
Id() = 0;
|
||||
|
||||
virtual nsISupports*
|
||||
StorageId() = 0;
|
||||
// Whether or not the storage has been invalidated. If it has then no further
|
||||
// operations for this storage will be allowed to run.
|
||||
NS_IMETHOD_(bool)
|
||||
IsInvalidated() = 0;
|
||||
|
||||
virtual bool
|
||||
IsStorageInvalidated() = 0;
|
||||
NS_IMETHOD_(bool)
|
||||
IsShuttingDown() = 0;
|
||||
|
||||
virtual bool
|
||||
IsStorageShuttingDown() = 0;
|
||||
|
||||
virtual void
|
||||
NS_IMETHOD_(void)
|
||||
SetThreadLocals() = 0;
|
||||
|
||||
virtual void
|
||||
NS_IMETHOD_(void)
|
||||
UnsetThreadLocals() = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIFileStorage, NS_FILESTORAGE_IID)
|
||||
|
||||
#define NS_DECL_NSIFILESTORAGE \
|
||||
virtual const nsACString& \
|
||||
StorageOrigin() MOZ_OVERRIDE; \
|
||||
NS_IMETHOD_(nsIAtom*) \
|
||||
Id() MOZ_OVERRIDE; \
|
||||
\
|
||||
virtual nsISupports* \
|
||||
StorageId() MOZ_OVERRIDE; \
|
||||
NS_IMETHOD_(bool) \
|
||||
IsInvalidated() MOZ_OVERRIDE; \
|
||||
\
|
||||
virtual bool \
|
||||
IsStorageInvalidated() MOZ_OVERRIDE; \
|
||||
NS_IMETHOD_(bool) \
|
||||
IsShuttingDown() MOZ_OVERRIDE; \
|
||||
\
|
||||
virtual bool \
|
||||
IsStorageShuttingDown() MOZ_OVERRIDE; \
|
||||
\
|
||||
virtual void \
|
||||
NS_IMETHOD_(void) \
|
||||
SetThreadLocals() MOZ_OVERRIDE; \
|
||||
\
|
||||
virtual void \
|
||||
NS_IMETHOD_(void) \
|
||||
UnsetThreadLocals() MOZ_OVERRIDE;
|
||||
|
||||
#endif // nsIFileStorage_h__
|
||||
|
@ -51,10 +51,6 @@
|
||||
"MutationCallback interface: existence and properties of interface prototype object": true,
|
||||
"MutationCallback interface: existence and properties of interface prototype object's \"constructor\" property": true,
|
||||
"MutationCallback interface: operation handleEvent(MutationRecord,MutationObserver)": true,
|
||||
"XMLDocument interface: existence and properties of interface object": true,
|
||||
"XMLDocument interface: existence and properties of interface prototype object": true,
|
||||
"XMLDocument interface: existence and properties of interface prototype object's \"constructor\" property": true,
|
||||
"Stringification of xmlDoc": "debug",
|
||||
"DocumentType interface: operation remove()": true,
|
||||
"DocumentType interface: document.doctype must inherit property \"remove\" with the proper type (3)": true,
|
||||
"Element interface: attribute namespaceURI": true,
|
||||
|
@ -9,7 +9,5 @@
|
||||
"Historical DOM features must be removed: getAttributeNodeNS": true,
|
||||
"Historical DOM features must be removed: setAttributeNode": true,
|
||||
"Historical DOM features must be removed: removeAttributeNode": true,
|
||||
"DocumentType member must be nuked: internalSubset": true,
|
||||
"Node member must be nuked: getUserData": true,
|
||||
"Node member must be nuked: setUserData": true
|
||||
"DocumentType member must be nuked: internalSubset": true
|
||||
}
|
||||
|
@ -19,8 +19,9 @@
|
||||
#include "nsDOMStorage.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/dom/quota/QuotaManager.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
#include "IndexedDatabaseManager.h"
|
||||
|
||||
@ -140,10 +141,10 @@ CheckPermissionsHelper::Run()
|
||||
window.swap(mWindow);
|
||||
|
||||
if (permission == PERMISSION_ALLOWED) {
|
||||
IndexedDatabaseManager* mgr = IndexedDatabaseManager::Get();
|
||||
NS_ASSERTION(mgr, "This should never be null!");
|
||||
quota::QuotaManager* quotaManager = quota::QuotaManager::Get();
|
||||
NS_ASSERTION(quotaManager, "This should never be null!");
|
||||
|
||||
return helper->Dispatch(mgr->IOThread());
|
||||
return helper->Dispatch(quotaManager->IOThread());
|
||||
}
|
||||
|
||||
NS_ASSERTION(permission == PERMISSION_PROMPT ||
|
||||
|
338
dom/indexedDB/Client.cpp
Normal file
338
dom/indexedDB/Client.cpp
Normal file
@ -0,0 +1,338 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "Client.h"
|
||||
|
||||
#include "mozilla/dom/quota/QuotaManager.h"
|
||||
#include "mozilla/dom/quota/UsageRunnable.h"
|
||||
#include "mozilla/dom/quota/Utilities.h"
|
||||
|
||||
#include "IDBDatabase.h"
|
||||
#include "IndexedDatabaseManager.h"
|
||||
#include "TransactionThreadPool.h"
|
||||
|
||||
USING_INDEXEDDB_NAMESPACE
|
||||
using mozilla::dom::quota::QuotaManager;
|
||||
|
||||
namespace {
|
||||
|
||||
bool
|
||||
GetDatabaseBaseFilename(const nsAString& aFilename,
|
||||
nsAString& aDatabaseBaseFilename)
|
||||
{
|
||||
NS_ASSERTION(!aFilename.IsEmpty(), "Bad argument!");
|
||||
|
||||
NS_NAMED_LITERAL_STRING(sqlite, ".sqlite");
|
||||
|
||||
if (!StringEndsWith(aFilename, sqlite)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
aDatabaseBaseFilename =
|
||||
Substring(aFilename, 0, aFilename.Length() - sqlite.Length());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
// This needs to be fully qualified to not confuse trace refcnt assertions.
|
||||
NS_IMPL_ADDREF(mozilla::dom::indexedDB::Client)
|
||||
NS_IMPL_RELEASE(mozilla::dom::indexedDB::Client)
|
||||
|
||||
nsresult
|
||||
Client::InitOrigin(const nsACString& aOrigin, UsageRunnable* aUsageRunnable)
|
||||
{
|
||||
nsCOMPtr<nsIFile> directory;
|
||||
nsresult rv = GetDirectory(aOrigin, getter_AddRefs(directory));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// We need to see if there are any files in the directory already. If they
|
||||
// are database files then we need to cleanup stored files (if it's needed)
|
||||
// and also get the usage.
|
||||
|
||||
nsAutoTArray<nsString, 20> subdirsToProcess;
|
||||
nsAutoTArray<nsCOMPtr<nsIFile> , 20> unknownFiles;
|
||||
nsTHashtable<nsStringHashKey> validSubdirs;
|
||||
validSubdirs.Init(20);
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> entries;
|
||||
rv = directory->GetDirectoryEntries(getter_AddRefs(entries));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) &&
|
||||
hasMore && (!aUsageRunnable || !aUsageRunnable->Canceled())) {
|
||||
nsCOMPtr<nsISupports> entry;
|
||||
rv = entries->GetNext(getter_AddRefs(entry));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIFile> file = do_QueryInterface(entry);
|
||||
NS_ENSURE_TRUE(file, NS_NOINTERFACE);
|
||||
|
||||
nsString leafName;
|
||||
rv = file->GetLeafName(leafName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (StringEndsWith(leafName, NS_LITERAL_STRING(".sqlite-journal"))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bool isDirectory;
|
||||
rv = file->IsDirectory(&isDirectory);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (isDirectory) {
|
||||
if (!validSubdirs.GetEntry(leafName)) {
|
||||
subdirsToProcess.AppendElement(leafName);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
nsString dbBaseFilename;
|
||||
if (!GetDatabaseBaseFilename(leafName, dbBaseFilename)) {
|
||||
unknownFiles.AppendElement(file);
|
||||
continue;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIFile> fmDirectory;
|
||||
rv = directory->Clone(getter_AddRefs(fmDirectory));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = fmDirectory->Append(dbBaseFilename);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = FileManager::InitDirectory(fmDirectory, file, aOrigin);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aUsageRunnable) {
|
||||
int64_t fileSize;
|
||||
rv = file->GetFileSize(&fileSize);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
aUsageRunnable->AppendToDatabaseUsage(uint64_t(fileSize));
|
||||
|
||||
uint64_t usage;
|
||||
rv = FileManager::GetUsage(fmDirectory, &usage);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
aUsageRunnable->AppendToFileUsage(usage);
|
||||
}
|
||||
|
||||
validSubdirs.PutEntry(dbBaseFilename);
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for (uint32_t i = 0; i < subdirsToProcess.Length(); i++) {
|
||||
const nsString& subdir = subdirsToProcess[i];
|
||||
if (!validSubdirs.GetEntry(subdir)) {
|
||||
NS_WARNING("Unknown subdirectory found!");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < unknownFiles.Length(); i++) {
|
||||
nsCOMPtr<nsIFile>& unknownFile = unknownFiles[i];
|
||||
|
||||
// Some temporary SQLite files could disappear, so we have to check if the
|
||||
// unknown file still exists.
|
||||
bool exists;
|
||||
rv = unknownFile->Exists(&exists);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (exists) {
|
||||
nsString leafName;
|
||||
unknownFile->GetLeafName(leafName);
|
||||
|
||||
// The journal file may exists even after db has been correctly opened.
|
||||
if (!StringEndsWith(leafName, NS_LITERAL_STRING(".sqlite-journal"))) {
|
||||
NS_WARNING("Unknown file found!");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
Client::GetUsageForOrigin(const nsACString& aOrigin,
|
||||
UsageRunnable* aUsageRunnable)
|
||||
{
|
||||
NS_ASSERTION(aUsageRunnable, "Null pointer!");
|
||||
|
||||
nsCOMPtr<nsIFile> directory;
|
||||
nsresult rv = GetDirectory(aOrigin, getter_AddRefs(directory));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = GetUsageForDirectoryInternal(directory, aUsageRunnable, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
Client::IsTransactionServiceActivated()
|
||||
{
|
||||
return !!TransactionThreadPool::Get();
|
||||
}
|
||||
|
||||
void
|
||||
Client::WaitForStoragesToComplete(nsTArray<nsIOfflineStorage*>& aStorages,
|
||||
nsIRunnable* aCallback)
|
||||
{
|
||||
NS_ASSERTION(!aStorages.IsEmpty(), "No storages to wait on!");
|
||||
NS_ASSERTION(aCallback, "Passed null callback!");
|
||||
|
||||
TransactionThreadPool* pool = TransactionThreadPool::Get();
|
||||
NS_ASSERTION(pool, "Should have checked if transaction service is active!");
|
||||
|
||||
nsTArray<IDBDatabase*> databases(aStorages.Length());
|
||||
for (uint32_t index = 0; index < aStorages.Length(); index++) {
|
||||
IDBDatabase* database = IDBDatabase::FromStorage(aStorages[index]);
|
||||
NS_ASSERTION(database, "This shouldn't be null!");
|
||||
|
||||
databases.AppendElement(database);
|
||||
}
|
||||
|
||||
pool->WaitForDatabasesToComplete(databases, aCallback);
|
||||
}
|
||||
|
||||
void
|
||||
Client::AbortTransactionsForStorage(nsIOfflineStorage* aStorage)
|
||||
{
|
||||
NS_ASSERTION(aStorage, "Passed null storage!");
|
||||
|
||||
TransactionThreadPool* pool = TransactionThreadPool::Get();
|
||||
NS_ASSERTION(pool, "Should have checked if transaction service is active!");
|
||||
|
||||
IDBDatabase* database = IDBDatabase::FromStorage(aStorage);
|
||||
NS_ASSERTION(database, "This shouldn't be null!");
|
||||
|
||||
pool->AbortTransactionsForDatabase(database);
|
||||
}
|
||||
|
||||
bool
|
||||
Client::HasTransactionsForStorage(nsIOfflineStorage* aStorage)
|
||||
{
|
||||
TransactionThreadPool* pool = TransactionThreadPool::Get();
|
||||
NS_ASSERTION(pool, "Should have checked if transaction service is active!");
|
||||
|
||||
IDBDatabase* database = IDBDatabase::FromStorage(aStorage);
|
||||
NS_ASSERTION(database, "This shouldn't be null!");
|
||||
|
||||
return pool->HasTransactionsForDatabase(database);
|
||||
}
|
||||
|
||||
void
|
||||
Client::OnOriginClearCompleted(const nsACString& aPattern)
|
||||
{
|
||||
IndexedDatabaseManager* mgr = IndexedDatabaseManager::Get();
|
||||
if (mgr) {
|
||||
mgr->InvalidateFileManagersForPattern(aPattern);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Client::ShutdownTransactionService()
|
||||
{
|
||||
TransactionThreadPool::Shutdown();
|
||||
}
|
||||
|
||||
void
|
||||
Client::OnShutdownCompleted()
|
||||
{
|
||||
IndexedDatabaseManager* mgr = IndexedDatabaseManager::Get();
|
||||
if (mgr) {
|
||||
mgr->InvalidateAllFileManagers();
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
Client::GetDirectory(const nsACString& aOrigin, nsIFile** aDirectory)
|
||||
{
|
||||
QuotaManager* quotaManager = QuotaManager::Get();
|
||||
NS_ASSERTION(quotaManager, "This should never fail!");
|
||||
|
||||
nsCOMPtr<nsIFile> directory;
|
||||
nsresult rv =
|
||||
quotaManager->GetDirectoryForOrigin(aOrigin, getter_AddRefs(directory));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_ASSERTION(directory, "What?");
|
||||
|
||||
rv = directory->Append(NS_LITERAL_STRING(IDB_DIRECTORY_NAME));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
directory.forget(aDirectory);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
Client::GetUsageForDirectoryInternal(nsIFile* aDirectory,
|
||||
UsageRunnable* aUsageRunnable,
|
||||
bool aDatabaseFiles)
|
||||
{
|
||||
NS_ASSERTION(aDirectory, "Null pointer!");
|
||||
NS_ASSERTION(aUsageRunnable, "Null pointer!");
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> entries;
|
||||
nsresult rv = aDirectory->GetDirectoryEntries(getter_AddRefs(entries));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!entries) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) &&
|
||||
hasMore && !aUsageRunnable->Canceled()) {
|
||||
nsCOMPtr<nsISupports> entry;
|
||||
rv = entries->GetNext(getter_AddRefs(entry));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIFile> file(do_QueryInterface(entry));
|
||||
NS_ASSERTION(file, "Don't know what this is!");
|
||||
|
||||
bool isDirectory;
|
||||
rv = file->IsDirectory(&isDirectory);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (isDirectory) {
|
||||
if (aDatabaseFiles) {
|
||||
rv = GetUsageForDirectoryInternal(file, aUsageRunnable, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
else {
|
||||
nsString leafName;
|
||||
rv = file->GetLeafName(leafName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!leafName.EqualsLiteral(JOURNAL_DIRECTORY_NAME)) {
|
||||
NS_WARNING("Unknown directory found!");
|
||||
}
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
int64_t fileSize;
|
||||
rv = file->GetFileSize(&fileSize);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
NS_ASSERTION(fileSize >= 0, "Negative size?!");
|
||||
|
||||
if (aDatabaseFiles) {
|
||||
aUsageRunnable->AppendToDatabaseUsage(uint64_t(fileSize));
|
||||
}
|
||||
else {
|
||||
aUsageRunnable->AppendToFileUsage(uint64_t(fileSize));
|
||||
}
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
87
dom/indexedDB/Client.h
Normal file
87
dom/indexedDB/Client.h
Normal file
@ -0,0 +1,87 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_indexeddb_client_h__
|
||||
#define mozilla_dom_indexeddb_client_h__
|
||||
|
||||
#include "IndexedDatabase.h"
|
||||
|
||||
#include "mozilla/dom/quota/Client.h"
|
||||
|
||||
#define IDB_DIRECTORY_NAME "idb"
|
||||
#define JOURNAL_DIRECTORY_NAME "journals"
|
||||
|
||||
BEGIN_INDEXEDDB_NAMESPACE
|
||||
|
||||
class Client : public mozilla::dom::quota::Client
|
||||
{
|
||||
typedef mozilla::dom::quota::UsageRunnable UsageRunnable;
|
||||
|
||||
public:
|
||||
NS_IMETHOD_(nsrefcnt)
|
||||
AddRef() MOZ_OVERRIDE;
|
||||
|
||||
NS_IMETHOD_(nsrefcnt)
|
||||
Release() MOZ_OVERRIDE;
|
||||
|
||||
virtual Type
|
||||
GetType() MOZ_OVERRIDE
|
||||
{
|
||||
return IDB;
|
||||
}
|
||||
|
||||
virtual nsresult
|
||||
InitOrigin(const nsACString& aOrigin,
|
||||
UsageRunnable* aUsageRunnable) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult
|
||||
GetUsageForOrigin(const nsACString& aOrigin,
|
||||
UsageRunnable* aUsageRunnable) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool
|
||||
IsFileServiceUtilized() MOZ_OVERRIDE
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool
|
||||
IsTransactionServiceActivated() MOZ_OVERRIDE;
|
||||
|
||||
virtual void
|
||||
WaitForStoragesToComplete(nsTArray<nsIOfflineStorage*>& aStorages,
|
||||
nsIRunnable* aCallback) MOZ_OVERRIDE;
|
||||
|
||||
virtual void
|
||||
AbortTransactionsForStorage(nsIOfflineStorage* aStorage) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool
|
||||
HasTransactionsForStorage(nsIOfflineStorage* aStorage) MOZ_OVERRIDE;
|
||||
|
||||
virtual void
|
||||
OnOriginClearCompleted(const nsACString& aPattern) MOZ_OVERRIDE;
|
||||
|
||||
virtual void
|
||||
ShutdownTransactionService() MOZ_OVERRIDE;
|
||||
|
||||
virtual void
|
||||
OnShutdownCompleted() MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
nsresult
|
||||
GetDirectory(const nsACString& aOrigin, nsIFile** aDirectory);
|
||||
|
||||
nsresult
|
||||
GetUsageForDirectoryInternal(nsIFile* aDirectory,
|
||||
UsageRunnable* aUsageRunnable,
|
||||
bool aDatabaseFiles);
|
||||
|
||||
nsAutoRefCnt mRefCnt;
|
||||
NS_DECL_OWNINGTHREAD
|
||||
};
|
||||
|
||||
END_INDEXEDDB_NAMESPACE
|
||||
|
||||
#endif // mozilla_dom_indexeddb_client_h__
|
@ -6,6 +6,8 @@
|
||||
|
||||
#include "FileInfo.h"
|
||||
|
||||
#include "mozilla/dom/quota/QuotaManager.h"
|
||||
|
||||
USING_INDEXEDDB_NAMESPACE
|
||||
|
||||
// static
|
||||
@ -91,7 +93,7 @@ FileInfo::UpdateReferences(nsAutoRefCnt& aRefCount, int32_t aDelta,
|
||||
void
|
||||
FileInfo::Cleanup()
|
||||
{
|
||||
if (IndexedDatabaseManager::IsShuttingDown() ||
|
||||
if (quota::QuotaManager::IsShuttingDown() ||
|
||||
mFileManager->Invalidated()) {
|
||||
return;
|
||||
}
|
||||
|
@ -11,9 +11,11 @@
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
|
||||
#include "mozilla/dom/quota/Utilities.h"
|
||||
#include "mozStorageCID.h"
|
||||
#include "mozStorageHelper.h"
|
||||
|
||||
#include "Client.h"
|
||||
#include "FileInfo.h"
|
||||
#include "IndexedDatabaseManager.h"
|
||||
#include "OpenDatabaseHelper.h"
|
||||
@ -21,8 +23,6 @@
|
||||
#include "IndexedDatabaseInlines.h"
|
||||
#include <algorithm>
|
||||
|
||||
#define JOURNAL_DIRECTORY_NAME "journals"
|
||||
|
||||
USING_INDEXEDDB_NAMESPACE
|
||||
|
||||
namespace {
|
||||
@ -412,7 +412,7 @@ FileManager::GetUsage(nsIFile* aDirectory, uint64_t* aUsage)
|
||||
rv = file->GetFileSize(&fileSize);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
IncrementUsage(&usage, uint64_t(fileSize));
|
||||
quota::IncrementUsage(&usage, uint64_t(fileSize));
|
||||
}
|
||||
|
||||
*aUsage = usage;
|
||||
|
@ -8,12 +8,14 @@
|
||||
#define mozilla_dom_indexeddb_filemanager_h__
|
||||
|
||||
#include "IndexedDatabase.h"
|
||||
#include "nsIFile.h"
|
||||
|
||||
#include "nsIDOMFile.h"
|
||||
#include "nsIFile.h"
|
||||
|
||||
#include "mozilla/dom/quota/StoragePrivilege.h"
|
||||
#include "nsDataHashtable.h"
|
||||
|
||||
class mozIStorageConnection;
|
||||
class mozIStorageServiceQuotaManagement;
|
||||
|
||||
BEGIN_INDEXEDDB_NAMESPACE
|
||||
|
||||
@ -23,8 +25,10 @@ class FileManager
|
||||
{
|
||||
friend class FileInfo;
|
||||
|
||||
typedef mozilla::dom::quota::StoragePrivilege StoragePrivilege;
|
||||
|
||||
public:
|
||||
FileManager(const nsACString& aOrigin, FactoryPrivilege aPrivilege,
|
||||
FileManager(const nsACString& aOrigin, StoragePrivilege aPrivilege,
|
||||
const nsAString& aDatabaseName)
|
||||
: mOrigin(aOrigin), mPrivilege(aPrivilege), mDatabaseName(aDatabaseName),
|
||||
mLastFileId(0), mInvalidated(false)
|
||||
@ -40,7 +44,7 @@ public:
|
||||
return mOrigin;
|
||||
}
|
||||
|
||||
const FactoryPrivilege& Privilege() const
|
||||
const StoragePrivilege& Privilege() const
|
||||
{
|
||||
return mPrivilege;
|
||||
}
|
||||
@ -81,7 +85,7 @@ public:
|
||||
|
||||
private:
|
||||
nsCString mOrigin;
|
||||
FactoryPrivilege mPrivilege;
|
||||
StoragePrivilege mPrivilege;
|
||||
nsString mDatabaseName;
|
||||
|
||||
nsString mDirectoryPath;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user