зеркало из https://github.com/mozilla/pjs.git
Merge latest green changeset from mozilla-central to maple
--HG-- rename : dom/base/nsDOMMemoryReporter.cpp => dom/base/nsWindowMemoryReporter.cpp rename : dom/base/nsDOMMemoryReporter.h => dom/base/nsWindowMemoryReporter.h
This commit is contained in:
Коммит
a4f3dcbb49
|
@ -1497,21 +1497,16 @@ nsHTMLTableAccessible::IsProbablyForLayout(bool *aIsProbablyForLayout)
|
|||
// Check for styled background color across rows (alternating background
|
||||
// color is a common feature for data tables).
|
||||
PRUint32 childCount = GetChildCount();
|
||||
nsAutoString rowColor, prevRowColor;
|
||||
nscolor rowColor, prevRowColor;
|
||||
for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
|
||||
nsAccessible* child = GetChildAt(childIdx);
|
||||
if (child->Role() == roles::ROW) {
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> styleDecl =
|
||||
nsCoreUtils::GetComputedStyleDeclaration(EmptyString(),
|
||||
child->GetContent());
|
||||
if (styleDecl) {
|
||||
prevRowColor = rowColor;
|
||||
styleDecl->GetPropertyValue(NS_LITERAL_STRING("background-color"),
|
||||
rowColor);
|
||||
if (childIdx > 0 && !prevRowColor.Equals(rowColor)) {
|
||||
RETURN_LAYOUT_ANSWER(false, "2 styles of row background color, non-bordered");
|
||||
}
|
||||
}
|
||||
prevRowColor = rowColor;
|
||||
nsIFrame* rowFrame = child->GetFrame();
|
||||
rowColor = rowFrame->GetStyleBackground()->mBackgroundColor;
|
||||
|
||||
if (childIdx > 0 && prevRowColor != rowColor)
|
||||
RETURN_LAYOUT_ANSWER(false, "2 styles of row background color, non-bordered");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
|
||||
#include "AccessibleApplication_i.c"
|
||||
|
||||
#include "nsIGfxInfo.h"
|
||||
#include "nsIPersistentProperties2.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -49,6 +51,31 @@
|
|||
NS_IMPL_ISUPPORTS_INHERITED0(nsApplicationAccessibleWrap,
|
||||
nsApplicationAccessible)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessibleWrap::GetAttributes(nsIPersistentProperties** aAttributes)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAttributes);
|
||||
*aAttributes = nsnull;
|
||||
|
||||
nsCOMPtr<nsIPersistentProperties> attributes =
|
||||
do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
|
||||
NS_ENSURE_STATE(attributes);
|
||||
|
||||
nsCOMPtr<nsIGfxInfo> gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
|
||||
if (gfxInfo) {
|
||||
bool isD2DEnabled = false;
|
||||
gfxInfo->GetD2DEnabled(&isD2DEnabled);
|
||||
nsAutoString unused;
|
||||
attributes->SetStringProperty(
|
||||
NS_LITERAL_CSTRING("D2D"),
|
||||
isD2DEnabled ? NS_LITERAL_STRING("true") : NS_LITERAL_STRING("false"),
|
||||
unused);
|
||||
}
|
||||
|
||||
attributes.swap(*aAttributes);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// IUnknown
|
||||
|
||||
|
|
|
@ -52,6 +52,9 @@ public:
|
|||
// nsISupporst
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetAttributes(nsIPersistentProperties** aAttributes);
|
||||
|
||||
// IUnknown
|
||||
STDMETHODIMP QueryInterface(REFIID, void**);
|
||||
|
||||
|
|
|
@ -96,6 +96,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=558036
|
|||
testAttrs("th2", { "abbr": "SS#" }, true);
|
||||
testAttrs("th2", { "axis": "social" }, true);
|
||||
|
||||
// application accessible
|
||||
if (WIN) {
|
||||
var gfxInfo = Components.classes["@mozilla.org/gfx/info;1"].
|
||||
getService(Components.interfaces.nsIGfxInfo);
|
||||
var attrs = {
|
||||
"D2D": (gfxInfo.D2DEnabled ? "true" : "false")
|
||||
}
|
||||
testAttrs(getApplicationAccessible(), attrs, false);
|
||||
}
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ _TEST_FILES =\
|
|||
test_contextmenu.xul \
|
||||
test_doc.html \
|
||||
test_gencontent.html \
|
||||
test_hidden.html \
|
||||
test_list_editabledoc.html \
|
||||
test_list.html \
|
||||
test_menu.xul \
|
||||
|
|
|
@ -0,0 +1,135 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>@hidden attribute testing</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../role.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../events.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Invokers
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Set @hidden attribute
|
||||
*/
|
||||
function setHiddenAttr(aContainerID, aChildID)
|
||||
{
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_REORDER, getNode(aContainerID))
|
||||
];
|
||||
|
||||
this.invoke = function setHiddenAttr_invoke()
|
||||
{
|
||||
var tree =
|
||||
{ SECTION: [
|
||||
{ ENTRY: [
|
||||
] }
|
||||
] };
|
||||
testAccessibleTree(aContainerID, tree);
|
||||
|
||||
getNode(aChildID).setAttribute("hidden", "true");
|
||||
}
|
||||
|
||||
this.finalCheck = function setHiddenAttr_finalCheck()
|
||||
{
|
||||
var tree =
|
||||
{ SECTION: [
|
||||
] };
|
||||
testAccessibleTree(aContainerID, tree);
|
||||
}
|
||||
|
||||
this.getID = function setHiddenAttr_getID()
|
||||
{
|
||||
return "Set @hidden attribute on input and test accessible tree for div";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove @hidden attribute
|
||||
*/
|
||||
function removeHiddenAttr(aContainerID, aChildID)
|
||||
{
|
||||
this.eventSeq = [
|
||||
new invokerChecker(EVENT_REORDER, getNode(aContainerID))
|
||||
];
|
||||
|
||||
this.invoke = function removeHiddenAttr_invoke()
|
||||
{
|
||||
var tree =
|
||||
{ SECTION: [
|
||||
] };
|
||||
testAccessibleTree(aContainerID, tree);
|
||||
|
||||
getNode(aChildID).removeAttribute("hidden");
|
||||
}
|
||||
|
||||
this.finalCheck = function removeHiddenAttr_finalCheck()
|
||||
{
|
||||
var tree =
|
||||
{ SECTION: [
|
||||
{ ENTRY: [
|
||||
] }
|
||||
] };
|
||||
testAccessibleTree(aContainerID, tree);
|
||||
}
|
||||
|
||||
this.getID = function removeHiddenAttr_getID()
|
||||
{
|
||||
return "Remove @hidden attribute on input and test accessible tree for div";
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Test
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//gA11yEventDumpID = "eventdump"; // debug stuff
|
||||
//gA11yEventDumpToConsole = true;
|
||||
|
||||
var gQueue = null;
|
||||
|
||||
function doTest()
|
||||
{
|
||||
gQueue = new eventQueue();
|
||||
|
||||
gQueue.push(new setHiddenAttr("container", "child"));
|
||||
gQueue.push(new removeHiddenAttr("container", "child"));
|
||||
|
||||
gQueue.invoke(); // SimpleTest.finish() will be called in the end
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<div id="container"><input id="child"></div>
|
||||
|
||||
<div id="eventdump"></div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0"?>
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1330033499000">
|
||||
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1330367012000">
|
||||
<emItems>
|
||||
<emItem blockID="i58" id="webmaster@buzzzzvideos.info">
|
||||
<versionRange minVersion="0" maxVersion="*">
|
||||
|
@ -9,6 +9,10 @@
|
|||
<versionRange minVersion="0.1" maxVersion="4.3.1.00" severity="1">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i71" id="youtube@2youtube.com">
|
||||
<versionRange minVersion="0" maxVersion="*">
|
||||
</versionRange>
|
||||
</emItem>
|
||||
<emItem blockID="i8" id="{B13721C7-F507-4982-B2E5-502A71474FED}">
|
||||
<versionRange minVersion=" " severity="1">
|
||||
</versionRange>
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
<html:input anonid="input"
|
||||
class="autocomplete-textbox urlbar-input textbox-input uri-element-right-align"
|
||||
allowevents="true"
|
||||
xbl:inherits="tooltiptext=inputtooltiptext,onfocus,onblur,value,type,maxlength,disabled,size,readonly,placeholder,tabindex,accesskey"/>
|
||||
xbl:inherits="tooltiptext=inputtooltiptext,value,type,maxlength,disabled,size,readonly,placeholder,tabindex,accesskey"/>
|
||||
</xul:hbox>
|
||||
<children includes="hbox"/>
|
||||
</xul:hbox>
|
||||
|
|
|
@ -198,7 +198,8 @@ PlacesTreeView.prototype = {
|
|||
* @return [parentNode, parentRow]
|
||||
*/
|
||||
_getParentByChildRow: function PTV__getParentByChildRow(aChildRow) {
|
||||
let parent = this._getNodeForRow(aChildRow).parent;
|
||||
let node = this._getNodeForRow(aChildRow);
|
||||
let parent = (node === null) ? this._rootNode : node.parent;
|
||||
|
||||
// The root node is never visible
|
||||
if (parent == this._rootNode)
|
||||
|
@ -212,6 +213,10 @@ PlacesTreeView.prototype = {
|
|||
* Gets the node at a given row.
|
||||
*/
|
||||
_getNodeForRow: function PTV__getNodeForRow(aRow) {
|
||||
if (aRow < 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let node = this._rows[aRow];
|
||||
if (node !== undefined)
|
||||
return node;
|
||||
|
|
|
@ -389,6 +389,7 @@
|
|||
@BINPATH@/components/nsWifiWorker.manifest
|
||||
#endif
|
||||
@BINPATH@/components/BrowserProfileMigrators.manifest
|
||||
@BINPATH@/components/ProfileMigrator.js
|
||||
@BINPATH@/components/ChromeProfileMigrator.js
|
||||
@BINPATH@/components/FirefoxProfileMigrator.js
|
||||
#ifdef XP_MACOSX
|
||||
|
|
|
@ -459,7 +459,7 @@ class ShutdownLeakLogger(object):
|
|||
DOM windows (that are still around after test suite shutdown, despite running
|
||||
the GC) to the tests that created them and prints leak statistics.
|
||||
"""
|
||||
MAX_LEAK_COUNT = 120
|
||||
MAX_LEAK_COUNT = 130
|
||||
|
||||
def __init__(self, logger):
|
||||
self.logger = logger
|
||||
|
@ -479,7 +479,7 @@ class ShutdownLeakLogger(object):
|
|||
self.currentTest = {"fileName": fileName, "windows": set(), "docShells": set()}
|
||||
elif line.startswith("INFO TEST-END"):
|
||||
# don't track a test if no windows or docShells leaked
|
||||
if self.currentTest["windows"] and self.currentTest["docShells"]:
|
||||
if self.currentTest["windows"] or self.currentTest["docShells"]:
|
||||
self.tests.append(self.currentTest)
|
||||
self.currentTest = None
|
||||
elif line.startswith("INFO TEST-START | Shutdown"):
|
||||
|
|
|
@ -57,6 +57,8 @@ namespace std {
|
|||
template ostream& ostream::_M_insert(double);
|
||||
template ostream& ostream::_M_insert(long);
|
||||
template ostream& ostream::_M_insert(unsigned long);
|
||||
template ostream& ostream::_M_insert(long long);
|
||||
template ostream& ostream::_M_insert(unsigned long long);
|
||||
#ifdef DEBUG
|
||||
template ostream& ostream::_M_insert(const void*);
|
||||
#endif
|
||||
|
|
|
@ -108,7 +108,7 @@ _SUBDIR_CONFIG_ARGS="$ac_configure_args"
|
|||
dnl Set the version number of the libs included with mozilla
|
||||
dnl ========================================================
|
||||
MOZJPEG=62
|
||||
MOZPNG=10401
|
||||
MOZPNG=10509
|
||||
MOZZLIB=0x1230
|
||||
NSPR_VERSION=4
|
||||
NSS_VERSION=3
|
||||
|
@ -7308,7 +7308,11 @@ if test "${OS_TARGET}" = "Android"; then
|
|||
:
|
||||
elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
|
||||
dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
|
||||
MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
|
||||
if test -z "$GNU_CC"; then
|
||||
MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
|
||||
else
|
||||
MOZ_GLUE_LDFLAGS='-L$(LIBXUL_DIST)/lib $(call EXPAND_LIBNAME,mozglue)'
|
||||
fi
|
||||
else
|
||||
dnl On other Unix systems, we only want to link executables against mozglue
|
||||
MOZ_GLUE_PROGRAM_LDFLAGS='$(MKSHLIB_FORCE_ALL) $(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib) $(MKSHLIB_UNFORCE_ALL)'
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
|
||||
#include "nsIContent.h"
|
||||
#include "nsEventStates.h"
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
|
||||
class nsEventStateManager;
|
||||
class nsGlobalWindow;
|
||||
|
|
|
@ -73,6 +73,5 @@ DEPRECATED_OPERATION(TextContent)
|
|||
DEPRECATED_OPERATION(EnablePrivilege)
|
||||
DEPRECATED_OPERATION(Position)
|
||||
DEPRECATED_OPERATION(TotalSize)
|
||||
DEPRECATED_OPERATION(GlobalStorage)
|
||||
DEPRECATED_OPERATION(InputEncoding)
|
||||
DEPRECATED_OPERATION(MozBeforePaint)
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "nsChangeHint.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsIDocument.h" // for IsInHTMLDocument
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
|
||||
// Forward declarations
|
||||
class nsIAtom;
|
||||
|
|
|
@ -68,7 +68,6 @@
|
|||
#include "nsEventStates.h"
|
||||
#include "nsIStructuredCloneContainer.h"
|
||||
#include "nsIBFCacheEntry.h"
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsPresContext;
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#include "nsDOMError.h"
|
||||
#include "nsDOMString.h"
|
||||
#include "jspubtd.h"
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
#include "nsWindowMemoryReporter.h"
|
||||
#include "nsIVariant.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ interface nsIObjectLoadingContent : nsISupports
|
|||
* account. The MIME type is required as some plugins (java) calculate
|
||||
* this differently.
|
||||
*/
|
||||
nsIURI GetObjectBaseURI(in ACString aMimeType);
|
||||
nsIURI getObjectBaseURI(in ACString aMimeType);
|
||||
|
||||
/**
|
||||
* Returns the plugin instance if it has already been instantiated. This
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsGenericElement.h" // DOMCI_NODE_DATA
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
|
||||
class nsCommentNode : public nsGenericDOMDataNode,
|
||||
public nsIDOMComment
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
*/
|
||||
|
||||
#include "nsDOMSettableTokenList.h"
|
||||
#include "dombindings.h"
|
||||
|
||||
|
||||
nsDOMSettableTokenList::nsDOMSettableTokenList(nsGenericElement *aElement, nsIAtom* aAttrAtom)
|
||||
|
@ -78,3 +79,10 @@ nsDOMSettableTokenList::SetValue(const nsAString& aValue)
|
|||
return mElement->SetAttr(kNameSpaceID_None, mAttrAtom, aValue, true);
|
||||
}
|
||||
|
||||
JSObject*
|
||||
nsDOMSettableTokenList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope,
|
||||
bool *triedToWrap)
|
||||
{
|
||||
return mozilla::dom::binding::DOMSettableTokenList::create(cx, scope, this,
|
||||
triedToWrap);
|
||||
}
|
||||
|
|
|
@ -59,6 +59,9 @@ public:
|
|||
|
||||
nsDOMSettableTokenList(nsGenericElement* aElement, nsIAtom* aAttrAtom);
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope,
|
||||
bool *triedToWrap);
|
||||
|
||||
protected:
|
||||
virtual ~nsDOMSettableTokenList();
|
||||
};
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "nsContentUtils.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsGenericElement.h"
|
||||
#include "dombindings.h"
|
||||
|
||||
|
||||
nsDOMTokenList::nsDOMTokenList(nsGenericElement *aElement, nsIAtom* aAttrAtom)
|
||||
|
@ -52,21 +53,34 @@ nsDOMTokenList::nsDOMTokenList(nsGenericElement *aElement, nsIAtom* aAttrAtom)
|
|||
{
|
||||
// We don't add a reference to our element. If it goes away,
|
||||
// we'll be told to drop our reference
|
||||
SetIsProxy();
|
||||
}
|
||||
|
||||
nsDOMTokenList::~nsDOMTokenList() { }
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMTokenList)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMTokenList)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMTokenList)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDOMTokenList)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||
|
||||
DOMCI_DATA(DOMTokenList, nsDOMTokenList)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsDOMTokenList)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_TABLE1(nsDOMTokenList,
|
||||
nsIDOMDOMTokenList)
|
||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE
|
||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsDOMTokenList)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(DOMTokenList)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_ADDREF(nsDOMTokenList)
|
||||
NS_IMPL_RELEASE(nsDOMTokenList)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMTokenList)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMTokenList)
|
||||
|
||||
void
|
||||
nsDOMTokenList::DropReference()
|
||||
|
@ -293,3 +307,12 @@ nsDOMTokenList::ToString(nsAString& aResult)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
JSObject*
|
||||
nsDOMTokenList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope,
|
||||
bool *triedToWrap)
|
||||
{
|
||||
return mozilla::dom::binding::DOMTokenList::create(cx, scope, this,
|
||||
triedToWrap);
|
||||
}
|
||||
|
||||
|
|
|
@ -46,16 +46,26 @@
|
|||
|
||||
class nsAttrValue;
|
||||
|
||||
class nsDOMTokenList : public nsIDOMDOMTokenList
|
||||
class nsDOMTokenList : public nsIDOMDOMTokenList,
|
||||
public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMTokenList)
|
||||
NS_DECL_NSIDOMDOMTOKENLIST
|
||||
|
||||
nsDOMTokenList(nsGenericElement* aElement, nsIAtom* aAttrAtom);
|
||||
|
||||
void DropReference();
|
||||
|
||||
virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope,
|
||||
bool *triedToWrap);
|
||||
|
||||
nsINode *GetParentObject()
|
||||
{
|
||||
return mElement;
|
||||
}
|
||||
|
||||
protected:
|
||||
~nsDOMTokenList();
|
||||
|
||||
|
|
|
@ -9149,6 +9149,13 @@ nsIDocument::DocSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const
|
|||
aWindowSizes->mDOM +=
|
||||
nsINode::SizeOfExcludingThis(aWindowSizes->mMallocSizeOf);
|
||||
|
||||
if (mPresShell) {
|
||||
mPresShell->SizeOfIncludingThis(aWindowSizes->mMallocSizeOf,
|
||||
&aWindowSizes->mLayoutArenas,
|
||||
&aWindowSizes->mLayoutStyleSets,
|
||||
&aWindowSizes->mLayoutTextRuns);
|
||||
}
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it
|
||||
// is worthwhile:
|
||||
// - many!
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
#include "nsIXULWindow.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "nsIMozBrowserFrame.h"
|
||||
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsIView.h"
|
||||
|
@ -980,9 +981,9 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
|||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShell> ourDochell = GetExistingDocShell();
|
||||
nsCOMPtr<nsIDocShell> ourDocshell = GetExistingDocShell();
|
||||
nsCOMPtr<nsIDocShell> otherDocshell = aOther->GetExistingDocShell();
|
||||
if (!ourDochell || !otherDocshell) {
|
||||
if (!ourDocshell || !otherDocshell) {
|
||||
// How odd
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -990,7 +991,7 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
|||
// To avoid having to mess with session history, avoid swapping
|
||||
// frameloaders that don't correspond to root same-type docshells,
|
||||
// unless both roots have session history disabled.
|
||||
nsCOMPtr<nsIDocShellTreeItem> ourTreeItem = do_QueryInterface(ourDochell);
|
||||
nsCOMPtr<nsIDocShellTreeItem> ourTreeItem = do_QueryInterface(ourDocshell);
|
||||
nsCOMPtr<nsIDocShellTreeItem> otherTreeItem =
|
||||
do_QueryInterface(otherDocshell);
|
||||
nsCOMPtr<nsIDocShellTreeItem> ourRootTreeItem, otherRootTreeItem;
|
||||
|
@ -1058,7 +1059,7 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> ourWindow = do_GetInterface(ourDochell);
|
||||
nsCOMPtr<nsPIDOMWindow> ourWindow = do_GetInterface(ourDocshell);
|
||||
nsCOMPtr<nsPIDOMWindow> otherWindow = do_GetInterface(otherDocshell);
|
||||
|
||||
nsCOMPtr<nsIDOMElement> ourFrameElement =
|
||||
|
@ -1108,6 +1109,14 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
bool weAreBrowserFrame = false;
|
||||
bool otherIsBrowserFrame = false;
|
||||
ourDocshell->GetIsBrowserFrame(&weAreBrowserFrame);
|
||||
otherDocshell->GetIsBrowserFrame(&otherIsBrowserFrame);
|
||||
if (weAreBrowserFrame != otherIsBrowserFrame) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
if (mInSwap || aOther->mInSwap) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -1481,6 +1490,13 @@ nsFrameLoader::MaybeCreateDocShell()
|
|||
mDocShell->SetChromeEventHandler(chromeEventHandler);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIMozBrowserFrame> browserFrame = do_QueryInterface(mOwnerContent);
|
||||
if (browserFrame) {
|
||||
bool isBrowserFrame = false;
|
||||
browserFrame->GetReallyIsBrowser(&isBrowserFrame);
|
||||
mDocShell->SetIsBrowserFrame(isBrowserFrame);
|
||||
}
|
||||
|
||||
// This is nasty, this code (the do_GetInterface(mDocShell) below)
|
||||
// *must* come *after* the above call to
|
||||
// mDocShell->SetChromeEventHandler() for the global window to get
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include "nsEventListenerManager.h"
|
||||
#include "nsGenericElement.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
|
||||
#include "nsISMILAttr.h"
|
||||
|
||||
|
|
|
@ -152,7 +152,6 @@
|
|||
#include "prprf.h"
|
||||
|
||||
#include "nsSVGFeatures.h"
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
#include "nsWrapperCacheInlines.h"
|
||||
#include "nsCycleCollector.h"
|
||||
#include "xpcpublic.h"
|
||||
|
@ -1981,7 +1980,7 @@ nsGenericElement::GetChildrenList()
|
|||
return slots->mChildrenList;
|
||||
}
|
||||
|
||||
nsIDOMDOMTokenList*
|
||||
nsDOMTokenList*
|
||||
nsGenericElement::GetClassList(nsresult *aResult)
|
||||
{
|
||||
*aResult = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -2469,6 +2468,9 @@ nsGenericElement::nsDOMSlots::Traverse(nsCycleCollectionTraversalCallback &cb, b
|
|||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mChildrenList");
|
||||
cb.NoteXPCOMChild(NS_ISUPPORTS_CAST(nsIDOMNodeList*, mChildrenList));
|
||||
|
||||
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mSlots->mClassList");
|
||||
cb.NoteXPCOMChild(mClassList.get());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2483,6 +2485,10 @@ nsGenericElement::nsDOMSlots::Unlink(bool aIsXUL)
|
|||
if (aIsXUL)
|
||||
NS_IF_RELEASE(mControllers);
|
||||
mChildrenList = nsnull;
|
||||
if (mClassList) {
|
||||
mClassList->DropReference();
|
||||
mClassList = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
nsGenericElement::nsGenericElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
|
|
|
@ -597,7 +597,7 @@ public:
|
|||
nsIContent* GetLastElementChild();
|
||||
nsIContent* GetPreviousElementSibling();
|
||||
nsIContent* GetNextElementSibling();
|
||||
nsIDOMDOMTokenList* GetClassList(nsresult *aResult);
|
||||
nsDOMTokenList* GetClassList(nsresult *aResult);
|
||||
bool MozMatchesSelector(const nsAString& aSelector, nsresult* aResult);
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#define NS_MAPPEDATTRIBUTEELEMENT_H_
|
||||
|
||||
#include "nsStyledElement.h"
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
|
||||
class nsMappedAttributes;
|
||||
struct nsRuleData;
|
||||
|
|
|
@ -1871,9 +1871,18 @@ nsObjectLoadingContent::GetObjectBaseURI(const nsACString & aMimeType, nsIURI**
|
|||
codebase.AssignLiteral("/");
|
||||
}
|
||||
|
||||
nsContentUtils::NewURIWithDocumentCharset(aURI, codebase,
|
||||
thisContent->OwnerDoc(),
|
||||
baseURI);
|
||||
if (!codebase.IsEmpty()) {
|
||||
nsresult rv = nsContentUtils::NewURIWithDocumentCharset(aURI, codebase,
|
||||
thisContent->OwnerDoc(),
|
||||
baseURI);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
return rv;
|
||||
NS_WARNING("GetObjectBaseURI: Could not resolve plugin's codebase to a URI, using baseURI instead");
|
||||
}
|
||||
|
||||
// Codebase empty or build URI failed, just use baseURI
|
||||
*aURI = NULL;
|
||||
baseURI.swap(*aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,6 @@ nsPlainTextSerializer::nsPlainTextSerializer()
|
|||
mCiteQuoteLevel = 0;
|
||||
mStructs = true; // will be read from prefs later
|
||||
mHeaderStrategy = 1 /*indent increasingly*/; // ditto
|
||||
mQuotesPreformatted = false; // ditto
|
||||
mDontWrapAnyQuotes = false; // ditto
|
||||
mHasWrittenCiteBlockquote = false;
|
||||
mSpanLevel = 0;
|
||||
|
@ -210,10 +209,6 @@ nsPlainTextSerializer::Init(PRUint32 aFlags, PRUint32 aWrapColumn,
|
|||
mHeaderStrategy =
|
||||
Preferences::GetInt(PREF_HEADER_STRATEGY, mHeaderStrategy);
|
||||
|
||||
// The quotesPreformatted pref is a temporary measure. See bug 69638.
|
||||
mQuotesPreformatted =
|
||||
Preferences::GetBool("editor.quotesPreformatted", mQuotesPreformatted);
|
||||
|
||||
// DontWrapAnyQuotes is set according to whether plaintext mail
|
||||
// is wrapping to window width -- see bug 134439.
|
||||
// We'll only want this if we're wrapping and formatted.
|
||||
|
@ -1636,7 +1631,7 @@ nsPlainTextSerializer::Write(const nsAString& aStr)
|
|||
// that does normal formatted text. The one for preformatted text calls
|
||||
// Output directly while the other code path goes through AddToLine.
|
||||
if ((mPreFormatted && !mWrapColumn) || IsInPre()
|
||||
|| ((((!mQuotesPreformatted && mSpanLevel > 0) || mDontWrapAnyQuotes))
|
||||
|| ((mSpanLevel > 0 || mDontWrapAnyQuotes)
|
||||
&& mEmptyLines >= 0 && str.First() == PRUnichar('>'))) {
|
||||
// No intelligent wrapping.
|
||||
|
||||
|
|
|
@ -176,11 +176,9 @@ protected:
|
|||
// Quotes need to be wrapped differently from non-quoted text,
|
||||
// because quoted text has a few extra characters (e.g. ">> ")
|
||||
// which makes the line length longer.
|
||||
// Mail can represent quotes in different ways: it can wrap
|
||||
// quotes in a <pre> (if editor.quotesPreformatted is set),
|
||||
// or not wrapped in any special tag (if mail.compose.wrap_to_window_width)
|
||||
// or in a <span> (if neither of the above are set).
|
||||
bool mQuotesPreformatted; // expect quotes wrapped in <pre>
|
||||
// Mail can represent quotes in different ways:
|
||||
// Not wrapped in any special tag (if mail.compose.wrap_to_window_width)
|
||||
// or in a <span>.
|
||||
bool mDontWrapAnyQuotes; // no special quote markers
|
||||
|
||||
bool mStructs; // Output structs (pref)
|
||||
|
|
|
@ -928,7 +928,7 @@ nsRange::SetStart(nsIDOMNode* aParent, PRInt32 aOffset)
|
|||
nsRange::SetStart(nsINode* aParent, PRInt32 aOffset)
|
||||
{
|
||||
nsINode* newRoot = IsValidBoundary(aParent);
|
||||
NS_ENSURE_TRUE(newRoot, NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR);
|
||||
NS_ENSURE_TRUE(newRoot, NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
|
||||
|
||||
PRInt32 len = GetNodeLength(aParent);
|
||||
if (aOffset < 0 || aOffset > len)
|
||||
|
@ -957,7 +957,7 @@ nsRange::SetStartBefore(nsIDOMNode* aSibling)
|
|||
nsCOMPtr<nsIDOMNode> parent;
|
||||
nsresult rv = aSibling->GetParentNode(getter_AddRefs(parent));
|
||||
if (NS_FAILED(rv) || !parent) {
|
||||
return NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR;
|
||||
return NS_ERROR_DOM_INVALID_NODE_TYPE_ERR;
|
||||
}
|
||||
|
||||
return SetStart(parent, IndexOf(aSibling));
|
||||
|
@ -971,7 +971,7 @@ nsRange::SetStartAfter(nsIDOMNode* aSibling)
|
|||
nsCOMPtr<nsIDOMNode> nParent;
|
||||
nsresult res = aSibling->GetParentNode(getter_AddRefs(nParent));
|
||||
if (NS_FAILED(res) || !nParent) {
|
||||
return NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR;
|
||||
return NS_ERROR_DOM_INVALID_NODE_TYPE_ERR;
|
||||
}
|
||||
|
||||
return SetStart(nParent, IndexOf(aSibling) + 1);
|
||||
|
@ -992,7 +992,7 @@ nsRange::SetEnd(nsIDOMNode* aParent, PRInt32 aOffset)
|
|||
nsRange::SetEnd(nsINode* aParent, PRInt32 aOffset)
|
||||
{
|
||||
nsINode* newRoot = IsValidBoundary(aParent);
|
||||
NS_ENSURE_TRUE(newRoot, NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR);
|
||||
NS_ENSURE_TRUE(newRoot, NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
|
||||
|
||||
PRInt32 len = GetNodeLength(aParent);
|
||||
if (aOffset < 0 || aOffset > len) {
|
||||
|
@ -1022,7 +1022,7 @@ nsRange::SetEndBefore(nsIDOMNode* aSibling)
|
|||
nsCOMPtr<nsIDOMNode> nParent;
|
||||
nsresult rv = aSibling->GetParentNode(getter_AddRefs(nParent));
|
||||
if (NS_FAILED(rv) || !nParent) {
|
||||
return NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR;
|
||||
return NS_ERROR_DOM_INVALID_NODE_TYPE_ERR;
|
||||
}
|
||||
|
||||
return SetEnd(nParent, IndexOf(aSibling));
|
||||
|
@ -1036,7 +1036,7 @@ nsRange::SetEndAfter(nsIDOMNode* aSibling)
|
|||
nsCOMPtr<nsIDOMNode> nParent;
|
||||
nsresult res = aSibling->GetParentNode(getter_AddRefs(nParent));
|
||||
if (NS_FAILED(res) || !nParent) {
|
||||
return NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR;
|
||||
return NS_ERROR_DOM_INVALID_NODE_TYPE_ERR;
|
||||
}
|
||||
|
||||
return SetEnd(nParent, IndexOf(aSibling) + 1);
|
||||
|
@ -1065,15 +1065,15 @@ nsRange::SelectNode(nsIDOMNode* aN)
|
|||
VALIDATE_ACCESS(aN);
|
||||
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aN);
|
||||
NS_ENSURE_TRUE(node, NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR);
|
||||
NS_ENSURE_TRUE(node, NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
|
||||
|
||||
nsINode* parent = node->GetNodeParent();
|
||||
nsINode* newRoot = IsValidBoundary(parent);
|
||||
NS_ENSURE_TRUE(newRoot, NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR);
|
||||
NS_ENSURE_TRUE(newRoot, NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
|
||||
|
||||
PRInt32 index = parent->IndexOf(node);
|
||||
if (index < 0) {
|
||||
return NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR;
|
||||
return NS_ERROR_DOM_INVALID_NODE_TYPE_ERR;
|
||||
}
|
||||
|
||||
AutoInvalidateSelection atEndOfBlock(this);
|
||||
|
@ -1089,7 +1089,7 @@ nsRange::SelectNodeContents(nsIDOMNode* aN)
|
|||
|
||||
nsCOMPtr<nsINode> node = do_QueryInterface(aN);
|
||||
nsINode* newRoot = IsValidBoundary(node);
|
||||
NS_ENSURE_TRUE(newRoot, NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR);
|
||||
NS_ENSURE_TRUE(newRoot, NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
|
||||
|
||||
AutoInvalidateSelection atEndOfBlock(this);
|
||||
DoSetRange(node, 0, node, GetNodeLength(node), newRoot);
|
||||
|
@ -2144,7 +2144,7 @@ nsRange::SurroundContents(nsIDOMNode* aNewParent)
|
|||
VALIDATE_ACCESS(aNewParent);
|
||||
|
||||
NS_ENSURE_TRUE(mRoot, NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
// BAD_BOUNDARYPOINTS_ERR: Raised if the Range partially selects a non-text
|
||||
// INVALID_STATE_ERROR: Raised if the Range partially selects a non-text
|
||||
// node.
|
||||
if (mStartParent != mEndParent) {
|
||||
bool startIsText = mStartParent->IsNodeOfType(nsINode::eTEXT);
|
||||
|
@ -2160,7 +2160,7 @@ nsRange::SurroundContents(nsIDOMNode* aNewParent)
|
|||
(endIsText &&
|
||||
endGrandParent &&
|
||||
endGrandParent == mStartParent),
|
||||
NS_ERROR_DOM_RANGE_BAD_BOUNDARYPOINTS_ERR);
|
||||
NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
}
|
||||
|
||||
// Extract the contents within the range.
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
|
||||
#include "nsString.h"
|
||||
#include "nsGenericElement.h"
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace css {
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
|
||||
class nsString;
|
||||
class nsCString;
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "nsIAttribute.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
|
||||
/**
|
||||
* Class used to implement DOM text nodes
|
||||
|
|
|
@ -561,6 +561,7 @@ _TEST_FILES2 = \
|
|||
file_bug717511_2.html^headers^ \
|
||||
test_bug726364.html \
|
||||
test_bug698381.html \
|
||||
test_bug711047.html \
|
||||
$(NULL)
|
||||
|
||||
_CHROME_FILES = \
|
||||
|
|
|
@ -84,7 +84,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=454326
|
|||
is(r3.toString(), "Hello ", "Wrong range!");
|
||||
} catch(e) {
|
||||
ex = e;
|
||||
is(e.code, 1, "Didn't get BAD_BOUNDARYPOINTS_ERR exception!");
|
||||
is(Object.getPrototypeOf(e), DOMException.prototype, "Didn't get DOMException!");
|
||||
is(e.code, 11, "Didn't get INVALID_STATE_ERR exception!");
|
||||
}
|
||||
ok(ex, "There should have been an exception!");
|
||||
|
||||
|
@ -99,7 +100,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=454326
|
|||
is(r3.toString(), "World!", "Wrong range!");
|
||||
} catch(e) {
|
||||
ex = e;
|
||||
is(e.code, 1, "Didn't get BAD_BOUNDARYPOINTS_ERR exception!");
|
||||
is(Object.getPrototypeOf(e), DOMException.prototype, "Didn't get DOMException!");
|
||||
is(e.code, 11, "Didn't get INVALID_STATE_ERR exception!");
|
||||
}
|
||||
ok(ex, "There should have been an exception!");
|
||||
|
||||
|
@ -114,7 +116,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=454326
|
|||
is(r4.toString(), "Hello World!", "Wrong range!");
|
||||
} catch(e) {
|
||||
ex = e;
|
||||
is(e.code, 1, "Didn't get BAD_BOUNDARYPOINTS_ERR exception!");
|
||||
is(Object.getPrototypeOf(e), DOMException.prototype, "Didn't get DOMException!");
|
||||
is(e.code, 11, "Didn't get INVALID_STATE_ERR exception!");
|
||||
}
|
||||
ok(ex, "There should have been an exception!");
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=711047
|
||||
-->
|
||||
<title>Test for Bug 711047</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=711047">Mozilla Bug 711047</a>
|
||||
<div id="content">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script>
|
||||
/** Test for Bug 711047 **/
|
||||
ok(!("RangeException" in window), "RangeException shouldn't exist");
|
||||
</script>
|
||||
</pre>
|
|
@ -63,6 +63,7 @@
|
|||
#include "Layers.h"
|
||||
|
||||
#include "CheckedInt.h"
|
||||
#include "nsDataHashtable.h"
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#include "ForceDiscreteGPUHelperCGL.h"
|
||||
|
@ -1627,16 +1628,25 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
struct WebGLMappedIdentifier {
|
||||
nsCString original, mapped; // ASCII strings
|
||||
WebGLMappedIdentifier(const nsACString& o, const nsACString& m) : original(o), mapped(m) {}
|
||||
};
|
||||
|
||||
class WebGLShader MOZ_FINAL
|
||||
: public nsIWebGLShader
|
||||
, public WebGLRefCountedObject<WebGLShader>
|
||||
, public WebGLContextBoundObject
|
||||
{
|
||||
friend class WebGLContext;
|
||||
friend class WebGLProgram;
|
||||
|
||||
public:
|
||||
WebGLShader(WebGLContext *context, WebGLenum stype)
|
||||
: WebGLContextBoundObject(context)
|
||||
, mType(stype)
|
||||
, mNeedsTranslation(true)
|
||||
, mAttribMaxNameLength(0)
|
||||
{
|
||||
mContext->MakeContextCurrent();
|
||||
mGLName = mContext->gl->fCreateShader(mType);
|
||||
|
@ -1693,11 +1703,45 @@ protected:
|
|||
WebGLuint mGLName;
|
||||
WebGLenum mType;
|
||||
nsString mSource;
|
||||
nsCString mTranslationLog;
|
||||
nsCString mTranslationLog; // The translation log should contain only ASCII characters
|
||||
bool mNeedsTranslation;
|
||||
WebGLMonotonicHandle mMonotonicHandle;
|
||||
nsTArray<WebGLMappedIdentifier> mAttributes;
|
||||
nsTArray<WebGLMappedIdentifier> mUniforms;
|
||||
int mAttribMaxNameLength;
|
||||
};
|
||||
|
||||
/** Takes an ASCII string like "foo[i]", turns it into "foo" and returns "[i]" in bracketPart
|
||||
*
|
||||
* \param string input/output: the string to split, becomes the string without the bracket part
|
||||
* \param bracketPart output: gets the bracket part.
|
||||
*
|
||||
* Notice that if there are multiple brackets like "foo[i].bar[j]", only the last bracket is split.
|
||||
*/
|
||||
static bool SplitLastSquareBracket(nsACString& string, nsCString& bracketPart)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(bracketPart.Length() == 0, "SplitLastSquareBracket must be called with empty bracketPart string");
|
||||
char *string_start = string.BeginWriting();
|
||||
char *s = string_start + string.Length() - 1;
|
||||
|
||||
if (*s != ']')
|
||||
return false;
|
||||
|
||||
while (*s != '[' && s != string_start)
|
||||
s--;
|
||||
|
||||
if (*s != '[')
|
||||
return false;
|
||||
|
||||
bracketPart.Assign(s);
|
||||
*s = 0;
|
||||
string.EndWriting();
|
||||
string.SetLength(s - string_start);
|
||||
return true;
|
||||
}
|
||||
|
||||
typedef nsDataHashtable<nsCStringHashKey, nsCString> CStringHash;
|
||||
|
||||
class WebGLProgram MOZ_FINAL
|
||||
: public nsIWebGLProgram
|
||||
, public WebGLRefCountedObject<WebGLProgram>
|
||||
|
@ -1708,10 +1752,7 @@ public:
|
|||
: WebGLContextBoundObject(context)
|
||||
, mLinkStatus(false)
|
||||
, mGeneration(0)
|
||||
, mUniformMaxNameLength(0)
|
||||
, mAttribMaxNameLength(0)
|
||||
, mUniformCount(0)
|
||||
, mAttribCount(0)
|
||||
{
|
||||
mContext->MakeContextCurrent();
|
||||
mGLName = mContext->gl->fCreateProgram();
|
||||
|
@ -1790,15 +1831,107 @@ public:
|
|||
}
|
||||
|
||||
/* Called only after LinkProgram */
|
||||
bool UpdateInfo(gl::GLContext *gl);
|
||||
bool UpdateInfo();
|
||||
|
||||
/* Getters for cached program info */
|
||||
WebGLint UniformMaxNameLength() const { return mUniformMaxNameLength; }
|
||||
WebGLint AttribMaxNameLength() const { return mAttribMaxNameLength; }
|
||||
WebGLint UniformCount() const { return mUniformCount; }
|
||||
WebGLint AttribCount() const { return mAttribCount; }
|
||||
bool IsAttribInUse(unsigned i) const { return mAttribsInUse[i]; }
|
||||
|
||||
/* Maps identifier |name| to the mapped identifier |*mappedName|
|
||||
* Both are ASCII strings.
|
||||
*/
|
||||
void MapIdentifier(const nsACString& name, nsCString *mappedName) {
|
||||
if (!mIdentifierMap) {
|
||||
// if the identifier map doesn't exist yet, build it now
|
||||
mIdentifierMap = new CStringHash;
|
||||
mIdentifierMap->Init();
|
||||
for (size_t i = 0; i < mAttachedShaders.Length(); i++) {
|
||||
for (size_t j = 0; j < mAttachedShaders[i]->mAttributes.Length(); j++) {
|
||||
const WebGLMappedIdentifier& attrib = mAttachedShaders[i]->mAttributes[j];
|
||||
mIdentifierMap->Put(attrib.original, attrib.mapped);
|
||||
}
|
||||
for (size_t j = 0; j < mAttachedShaders[i]->mUniforms.Length(); j++) {
|
||||
const WebGLMappedIdentifier& uniform = mAttachedShaders[i]->mUniforms[j];
|
||||
mIdentifierMap->Put(uniform.original, uniform.mapped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsCString mutableName(name);
|
||||
nsCString bracketPart;
|
||||
bool hadBracketPart = SplitLastSquareBracket(mutableName, bracketPart);
|
||||
if (hadBracketPart)
|
||||
mutableName.AppendLiteral("[0]");
|
||||
|
||||
if (mIdentifierMap->Get(mutableName, mappedName)) {
|
||||
if (hadBracketPart) {
|
||||
nsCString mappedBracketPart;
|
||||
bool mappedHadBracketPart = SplitLastSquareBracket(*mappedName, mappedBracketPart);
|
||||
if (mappedHadBracketPart)
|
||||
mappedName->Append(bracketPart);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// not found? We might be in the situation we have a uniform array name and the GL's glGetActiveUniform
|
||||
// returned its name without [0], as is allowed by desktop GL but not in ES. Let's then try with [0].
|
||||
mutableName.AppendLiteral("[0]");
|
||||
if (mIdentifierMap->Get(mutableName, mappedName))
|
||||
return;
|
||||
|
||||
// not found? return name unchanged. This case happens e.g. on bad user input, or when
|
||||
// we're not using identifier mapping, or if we didn't store an identifier in the map because
|
||||
// e.g. its mapping is trivial (as happens for short identifiers)
|
||||
mappedName->Assign(name);
|
||||
}
|
||||
|
||||
/* Un-maps mapped identifier |name| to the original identifier |*reverseMappedName|
|
||||
* Both are ASCII strings.
|
||||
*/
|
||||
void ReverseMapIdentifier(const nsACString& name, nsCString *reverseMappedName) {
|
||||
if (!mIdentifierReverseMap) {
|
||||
// if the identifier reverse map doesn't exist yet, build it now
|
||||
mIdentifierReverseMap = new CStringHash;
|
||||
mIdentifierReverseMap->Init();
|
||||
for (size_t i = 0; i < mAttachedShaders.Length(); i++) {
|
||||
for (size_t j = 0; j < mAttachedShaders[i]->mAttributes.Length(); j++) {
|
||||
const WebGLMappedIdentifier& attrib = mAttachedShaders[i]->mAttributes[j];
|
||||
mIdentifierReverseMap->Put(attrib.mapped, attrib.original);
|
||||
}
|
||||
for (size_t j = 0; j < mAttachedShaders[i]->mUniforms.Length(); j++) {
|
||||
const WebGLMappedIdentifier& uniform = mAttachedShaders[i]->mUniforms[j];
|
||||
mIdentifierReverseMap->Put(uniform.mapped, uniform.original);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsCString mutableName(name);
|
||||
nsCString bracketPart;
|
||||
bool hadBracketPart = SplitLastSquareBracket(mutableName, bracketPart);
|
||||
if (hadBracketPart)
|
||||
mutableName.AppendLiteral("[0]");
|
||||
|
||||
if (mIdentifierReverseMap->Get(mutableName, reverseMappedName)) {
|
||||
if (hadBracketPart) {
|
||||
nsCString reverseMappedBracketPart;
|
||||
bool reverseMappedHadBracketPart = SplitLastSquareBracket(*reverseMappedName, reverseMappedBracketPart);
|
||||
if (reverseMappedHadBracketPart)
|
||||
reverseMappedName->Append(bracketPart);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// not found? We might be in the situation we have a uniform array name and the GL's glGetActiveUniform
|
||||
// returned its name without [0], as is allowed by desktop GL but not in ES. Let's then try with [0].
|
||||
mutableName.AppendLiteral("[0]");
|
||||
if (mIdentifierReverseMap->Get(mutableName, reverseMappedName))
|
||||
return;
|
||||
|
||||
// not found? return name unchanged. This case happens e.g. on bad user input, or when
|
||||
// we're not using identifier mapping, or if we didn't store an identifier in the map because
|
||||
// e.g. its mapping is trivial (as happens for short identifiers)
|
||||
reverseMappedName->Assign(name);
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIWEBGLPROGRAM
|
||||
|
||||
|
@ -1811,13 +1944,10 @@ protected:
|
|||
CheckedUint32 mGeneration;
|
||||
|
||||
// post-link data
|
||||
|
||||
GLint mUniformMaxNameLength;
|
||||
GLint mAttribMaxNameLength;
|
||||
GLint mUniformCount;
|
||||
GLint mAttribCount;
|
||||
std::vector<bool> mAttribsInUse;
|
||||
WebGLMonotonicHandle mMonotonicHandle;
|
||||
nsAutoPtr<CStringHash> mIdentifierMap, mIdentifierReverseMap;
|
||||
int mAttribMaxNameLength;
|
||||
};
|
||||
|
||||
class WebGLRenderbuffer MOZ_FINAL
|
||||
|
@ -2366,12 +2496,11 @@ class WebGLActiveInfo MOZ_FINAL
|
|||
: public nsIWebGLActiveInfo
|
||||
{
|
||||
public:
|
||||
WebGLActiveInfo(WebGLint size, WebGLenum type, const char *nameptr, PRUint32 namelength) :
|
||||
WebGLActiveInfo(WebGLint size, WebGLenum type, const nsACString& name) :
|
||||
mSize(size),
|
||||
mType(type)
|
||||
{
|
||||
mName.AssignASCII(nameptr, namelength);
|
||||
}
|
||||
mType(type),
|
||||
mName(NS_ConvertASCIItoUTF16(name))
|
||||
{}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIWEBGLACTIVEINFO
|
||||
|
|
|
@ -121,7 +121,6 @@ NS_IMETHODIMP WebGLContext::name(t1 a1, t2 a2, t3 a3, t4 a4, t5 a5, t6 a6) { \
|
|||
MakeContextCurrent(); gl->f##glname(a1,a2,a3,a4,a5,a6); return NS_OK; \
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// WebGL API
|
||||
//
|
||||
|
@ -181,7 +180,8 @@ WebGLContext::BindAttribLocation(nsIWebGLProgram *pobj, WebGLuint location, cons
|
|||
return NS_OK;
|
||||
|
||||
WebGLuint progname;
|
||||
if (!GetGLName<WebGLProgram>("bindAttribLocation: program", pobj, &progname))
|
||||
WebGLProgram *prog;
|
||||
if (!GetConcreteObjectAndGLName("bindAttribLocation: program", pobj, &prog, &progname))
|
||||
return NS_OK;
|
||||
|
||||
if (!ValidateGLSLVariableName(name, "bindAttribLocation"))
|
||||
|
@ -190,10 +190,12 @@ WebGLContext::BindAttribLocation(nsIWebGLProgram *pobj, WebGLuint location, cons
|
|||
if (!ValidateAttribIndex(location, "bindAttribLocation"))
|
||||
return NS_OK;
|
||||
|
||||
NS_LossyConvertUTF16toASCII cname(name);
|
||||
nsCString mappedName;
|
||||
prog->MapIdentifier(cname, &mappedName);
|
||||
|
||||
MakeContextCurrent();
|
||||
|
||||
gl->fBindAttribLocation(progname, location, NS_LossyConvertUTF16toASCII(name).get());
|
||||
|
||||
gl->fBindAttribLocation(progname, location, mappedName.get());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1852,7 +1854,8 @@ WebGLContext::GetActiveAttrib(nsIWebGLProgram *pobj, PRUint32 index, nsIWebGLAct
|
|||
*retval = nsnull;
|
||||
|
||||
WebGLuint progname;
|
||||
if (!GetGLName<WebGLProgram>("getActiveAttrib: program", pobj, &progname))
|
||||
WebGLProgram *prog;
|
||||
if (!GetConcreteObjectAndGLName("getActiveAttrib: program", pobj, &prog, &progname))
|
||||
return NS_OK;
|
||||
|
||||
MakeContextCurrent();
|
||||
|
@ -1872,7 +1875,10 @@ WebGLContext::GetActiveAttrib(nsIWebGLProgram *pobj, PRUint32 index, nsIWebGLAct
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
WebGLActiveInfo *retActiveInfo = new WebGLActiveInfo(attrsize, attrtype, name.get(), len);
|
||||
nsCString reverseMappedName;
|
||||
prog->ReverseMapIdentifier(nsDependentCString(name), &reverseMappedName);
|
||||
|
||||
WebGLActiveInfo *retActiveInfo = new WebGLActiveInfo(attrsize, attrtype, reverseMappedName);
|
||||
NS_ADDREF(*retval = retActiveInfo);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1916,7 +1922,8 @@ WebGLContext::GetActiveUniform(nsIWebGLProgram *pobj, PRUint32 index, nsIWebGLAc
|
|||
*retval = nsnull;
|
||||
|
||||
WebGLuint progname;
|
||||
if (!GetGLName<WebGLProgram>("getActiveUniform: program", pobj, &progname))
|
||||
WebGLProgram *prog;
|
||||
if (!GetConcreteObjectAndGLName("getActiveUniform: program", pobj, &prog, &progname))
|
||||
return NS_OK;
|
||||
|
||||
MakeContextCurrent();
|
||||
|
@ -1926,17 +1933,20 @@ WebGLContext::GetActiveUniform(nsIWebGLProgram *pobj, PRUint32 index, nsIWebGLAc
|
|||
if (len == 0)
|
||||
*retval = nsnull;
|
||||
|
||||
nsAutoArrayPtr<char> name(new char[len + 3]); // +3 because we might have to append "[0]", see below
|
||||
nsAutoArrayPtr<char> name(new char[len]);
|
||||
|
||||
GLint attrsize = 0;
|
||||
GLuint attrtype = 0;
|
||||
GLint usize = 0;
|
||||
GLuint utype = 0;
|
||||
|
||||
gl->fGetActiveUniform(progname, index, len, &len, &attrsize, &attrtype, name);
|
||||
if (len == 0 || attrsize == 0 || attrtype == 0) {
|
||||
gl->fGetActiveUniform(progname, index, len, &len, &usize, &utype, name);
|
||||
if (len == 0 || usize == 0 || utype == 0) {
|
||||
*retval = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCString reverseMappedName;
|
||||
prog->ReverseMapIdentifier(nsDependentCString(name), &reverseMappedName);
|
||||
|
||||
// OpenGL ES 2.0 specifies that if foo is a uniform array, GetActiveUniform returns its name as "foo[0]".
|
||||
// See section 2.10 page 35 in the OpenGL ES 2.0.24 specification:
|
||||
//
|
||||
|
@ -1950,16 +1960,11 @@ WebGLContext::GetActiveUniform(nsIWebGLProgram *pobj, PRUint32 index, nsIWebGLAc
|
|||
// In principle we don't need to do that on OpenGL ES, but this is such a tricky difference between the ES and non-ES
|
||||
// specs that it seems probable that some ES implementers will overlook it. Since the work-around is quite cheap,
|
||||
// we do it unconditionally.
|
||||
if (attrsize > 1 && name[len-1] != ']') {
|
||||
name[len++] = '[';
|
||||
name[len++] = '0';
|
||||
name[len++] = ']';
|
||||
}
|
||||
|
||||
WebGLActiveInfo *retActiveInfo = new WebGLActiveInfo(attrsize, attrtype, name.get(), len);
|
||||
if (usize > 1 && reverseMappedName.CharAt(reverseMappedName.Length()-1) != ']')
|
||||
reverseMappedName.AppendLiteral("[0]");
|
||||
|
||||
WebGLActiveInfo *retActiveInfo = new WebGLActiveInfo(usize, utype, reverseMappedName);
|
||||
NS_ADDREF(*retval = retActiveInfo);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2009,23 +2014,25 @@ WebGLContext::GetAttribLocation(nsIWebGLProgram *pobj,
|
|||
const nsAString& name,
|
||||
PRInt32 *retval)
|
||||
{
|
||||
if (!IsContextStable())
|
||||
{
|
||||
*retval = -1;
|
||||
return NS_OK;
|
||||
}
|
||||
*retval = -1;
|
||||
|
||||
*retval = 0;
|
||||
if (!IsContextStable())
|
||||
return NS_OK;
|
||||
|
||||
WebGLuint progname;
|
||||
if (!GetGLName<WebGLProgram>("getAttribLocation: program", pobj, &progname))
|
||||
WebGLProgram *prog;
|
||||
if (!GetConcreteObjectAndGLName("getAttribLocation: program", pobj, &prog, &progname))
|
||||
return NS_OK;
|
||||
|
||||
if (!ValidateGLSLVariableName(name, "getAttribLocation"))
|
||||
return NS_OK;
|
||||
|
||||
NS_LossyConvertUTF16toASCII cname(name);
|
||||
nsCString mappedName;
|
||||
prog->MapIdentifier(cname, &mappedName);
|
||||
|
||||
MakeContextCurrent();
|
||||
*retval = gl->fGetAttribLocation(progname, NS_LossyConvertUTF16toASCII(name).get());
|
||||
*retval = gl->fGetAttribLocation(progname, mappedName.get());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2980,11 +2987,14 @@ WebGLContext::GetUniformLocation(nsIWebGLProgram *pobj, const nsAString& name, n
|
|||
return NS_OK;
|
||||
|
||||
if (!ValidateGLSLVariableName(name, "getUniformLocation"))
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
|
||||
NS_LossyConvertUTF16toASCII cname(name);
|
||||
nsCString mappedName;
|
||||
prog->MapIdentifier(cname, &mappedName);
|
||||
|
||||
MakeContextCurrent();
|
||||
|
||||
GLint intlocation = gl->fGetUniformLocation(progname, NS_LossyConvertUTF16toASCII(name).get());
|
||||
GLint intlocation = gl->fGetUniformLocation(progname, mappedName.get());
|
||||
|
||||
WebGLUniformLocation *loc = nsnull;
|
||||
if (intlocation >= 0)
|
||||
|
@ -3251,18 +3261,16 @@ WebGLContext::LinkProgram(nsIWebGLProgram *pobj)
|
|||
}
|
||||
|
||||
MakeContextCurrent();
|
||||
|
||||
gl->fLinkProgram(progname);
|
||||
|
||||
GLint ok;
|
||||
gl->fGetProgramiv(progname, LOCAL_GL_LINK_STATUS, &ok);
|
||||
if (ok) {
|
||||
program->SetLinkStatus(true);
|
||||
program->UpdateInfo(gl);
|
||||
bool updateInfoSucceeded = program->UpdateInfo();
|
||||
program->SetLinkStatus(updateInfoSucceeded);
|
||||
} else {
|
||||
program->SetLinkStatus(false);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -4387,6 +4395,20 @@ WebGLContext::CompileShader(nsIWebGLShader *sobj)
|
|||
|
||||
MakeContextCurrent();
|
||||
|
||||
ShShaderOutput targetShaderSourceLanguage = gl->IsGLES2() ? SH_ESSL_OUTPUT : SH_GLSL_OUTPUT;
|
||||
bool useShaderSourceTranslation = true;
|
||||
|
||||
#ifdef ANDROID
|
||||
// see bug 709947. On Android, we can't use the ESSL backend because of strange crashes (might be
|
||||
// an allocator mismatch). So we use the GLSL backend, and discard the output, instead just passing
|
||||
// the original WebGL shader source to the GL (since that's ESSL already). The problem is that means
|
||||
// we can't use shader translations on Android, in particular we can't use long identifier shortening,
|
||||
// which means we can't reach 100% conformance. We need to fix that by debugging the ESSL backend
|
||||
// memory crashes.
|
||||
targetShaderSourceLanguage = SH_GLSL_OUTPUT;
|
||||
useShaderSourceTranslation = false;
|
||||
#endif
|
||||
|
||||
#if defined(USE_ANGLE)
|
||||
if (shader->NeedsTranslation() && mShaderValidation) {
|
||||
ShHandle compiler = 0;
|
||||
|
@ -4404,20 +4426,6 @@ WebGLContext::CompileShader(nsIWebGLShader *sobj)
|
|||
if (mEnabledExtensions[WebGL_OES_standard_derivatives])
|
||||
resources.OES_standard_derivatives = 1;
|
||||
|
||||
// notice that on Android, we always use SH_GLSL_OUTPUT, we never use the ESSL backend.
|
||||
// see bug 709947, the reason is that 1) we dont really need a ESSL backend since the
|
||||
// source is already ESSL, and 2) we ran into massive Android crashes when we used the ESSL backend.
|
||||
// But if we wanted to use shader transformations on ES platforms, we would have to use the
|
||||
// ESSL backend
|
||||
compiler = ShConstructCompiler((ShShaderType) shader->ShaderType(),
|
||||
SH_WEBGL_SPEC,
|
||||
#ifdef ANDROID
|
||||
SH_GLSL_OUTPUT,
|
||||
#else
|
||||
gl->IsGLES2() ? SH_ESSL_OUTPUT : SH_GLSL_OUTPUT,
|
||||
#endif
|
||||
&resources);
|
||||
|
||||
// We're storing an actual instance of StripComments because, if we don't, the
|
||||
// cleanSource nsAString instance will be destroyed before the reference is
|
||||
// actually used.
|
||||
|
@ -4431,20 +4439,29 @@ WebGLContext::CompileShader(nsIWebGLShader *sobj)
|
|||
// shaderSource() already checks that the source stripped of comments is in the
|
||||
// 7-bit ASCII range, so we can skip the NS_IsAscii() check.
|
||||
const nsCString& sourceCString = NS_LossyConvertUTF16toASCII(flatSource);
|
||||
|
||||
|
||||
const PRUint32 maxSourceLength = (PRUint32(1)<<18) - 1;
|
||||
if (sourceCString.Length() > maxSourceLength)
|
||||
return ErrorInvalidValue("compileShader: source has more than %d characters", maxSourceLength);
|
||||
|
||||
const char *s = sourceCString.get();
|
||||
|
||||
int compileOptions = SH_OBJECT_CODE;
|
||||
|
||||
|
||||
compiler = ShConstructCompiler((ShShaderType) shader->ShaderType(),
|
||||
SH_WEBGL_SPEC,
|
||||
targetShaderSourceLanguage,
|
||||
&resources);
|
||||
|
||||
int compileOptions = 0;
|
||||
if (useShaderSourceTranslation) {
|
||||
compileOptions |= SH_OBJECT_CODE
|
||||
| SH_MAP_LONG_VARIABLE_NAMES
|
||||
| SH_ATTRIBUTES_UNIFORMS;
|
||||
#ifdef XP_MACOSX
|
||||
// work around bug 665578
|
||||
if (!nsCocoaFeatures::OnLionOrLater() && gl->Vendor() == gl::GLContext::VendorATI)
|
||||
compileOptions |= SH_EMULATE_BUILT_IN_FUNCTIONS;
|
||||
// work around bug 665578
|
||||
if (!nsCocoaFeatures::OnLionOrLater() && gl->Vendor() == gl::GLContext::VendorATI)
|
||||
compileOptions |= SH_EMULATE_BUILT_IN_FUNCTIONS;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!ShCompile(compiler, &s, 1, compileOptions)) {
|
||||
int len = 0;
|
||||
|
@ -4462,11 +4479,50 @@ WebGLContext::CompileShader(nsIWebGLShader *sobj)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/* If the GL context is really GLES2, we want to use the original provided code,
|
||||
* since it's actually GLES2. We still need to validate it however, which is
|
||||
* why we ran it through the above, but we don't want the desktop GLSL.
|
||||
*/
|
||||
if (!gl->IsGLES2()) {
|
||||
int num_attributes = 0;
|
||||
ShGetInfo(compiler, SH_ACTIVE_ATTRIBUTES, &num_attributes);
|
||||
int num_uniforms = 0;
|
||||
ShGetInfo(compiler, SH_ACTIVE_UNIFORMS, &num_uniforms);
|
||||
int attrib_max_length = 0;
|
||||
ShGetInfo(compiler, SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, &attrib_max_length);
|
||||
int uniform_max_length = 0;
|
||||
ShGetInfo(compiler, SH_ACTIVE_UNIFORM_MAX_LENGTH, &uniform_max_length);
|
||||
int mapped_max_length = 0;
|
||||
ShGetInfo(compiler, SH_MAPPED_NAME_MAX_LENGTH, &mapped_max_length);
|
||||
|
||||
shader->mAttribMaxNameLength = attrib_max_length;
|
||||
|
||||
shader->mAttributes.Clear();
|
||||
shader->mUniforms.Clear();
|
||||
nsAutoArrayPtr<char> attribute_name(new char[attrib_max_length+1]);
|
||||
nsAutoArrayPtr<char> uniform_name(new char[uniform_max_length+1]);
|
||||
nsAutoArrayPtr<char> mapped_name(new char[mapped_max_length+1]);
|
||||
|
||||
if (useShaderSourceTranslation) {
|
||||
for (int i = 0; i < num_attributes; i++) {
|
||||
int length, size;
|
||||
ShDataType type;
|
||||
ShGetActiveAttrib(compiler, i,
|
||||
&length, &size, &type,
|
||||
attribute_name,
|
||||
mapped_name);
|
||||
shader->mAttributes.AppendElement(WebGLMappedIdentifier(
|
||||
nsDependentCString(attribute_name),
|
||||
nsDependentCString(mapped_name)));
|
||||
}
|
||||
|
||||
for (int i = 0; i < num_uniforms; i++) {
|
||||
int length, size;
|
||||
ShDataType type;
|
||||
ShGetActiveUniform(compiler, i,
|
||||
&length, &size, &type,
|
||||
uniform_name,
|
||||
mapped_name);
|
||||
shader->mUniforms.AppendElement(WebGLMappedIdentifier(
|
||||
nsDependentCString(uniform_name),
|
||||
nsDependentCString(mapped_name)));
|
||||
}
|
||||
|
||||
int len = 0;
|
||||
ShGetInfo(compiler, SH_OBJECT_CODE_LENGTH, &len);
|
||||
|
||||
|
@ -4478,7 +4534,10 @@ WebGLContext::CompileShader(nsIWebGLShader *sobj)
|
|||
const char *ts = translatedSrc2.get();
|
||||
|
||||
gl->fShaderSource(shadername, 1, &ts, NULL);
|
||||
} else {
|
||||
} else { // not useShaderSourceTranslation
|
||||
// we just pass the raw untranslated shader source. We then can't use ANGLE idenfier mapping.
|
||||
// that's really bad, as that means we can't be 100% conformant. We should work towards always
|
||||
// using ANGLE identifier mapping.
|
||||
gl->fShaderSource(shadername, 1, &s, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,38 +49,46 @@
|
|||
#include "angle/ShaderLang.h"
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
/*
|
||||
* Pull all the data out of the program that will be used by validate later on
|
||||
* Pull data out of the program, post-linking
|
||||
*/
|
||||
bool
|
||||
WebGLProgram::UpdateInfo(gl::GLContext *gl)
|
||||
WebGLProgram::UpdateInfo()
|
||||
{
|
||||
gl->fGetProgramiv(mGLName, LOCAL_GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &mAttribMaxNameLength);
|
||||
gl->fGetProgramiv(mGLName, LOCAL_GL_ACTIVE_UNIFORM_MAX_LENGTH, &mUniformMaxNameLength);
|
||||
gl->fGetProgramiv(mGLName, LOCAL_GL_ACTIVE_UNIFORMS, &mUniformCount);
|
||||
gl->fGetProgramiv(mGLName, LOCAL_GL_ACTIVE_ATTRIBUTES, &mAttribCount);
|
||||
mIdentifierMap = nsnull;
|
||||
mIdentifierReverseMap = nsnull;
|
||||
|
||||
GLint numVertexAttribs;
|
||||
if (mContext->MinCapabilityMode()) {
|
||||
numVertexAttribs = MINVALUE_GL_MAX_VERTEX_ATTRIBS;
|
||||
} else {
|
||||
gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_ATTRIBS, &numVertexAttribs);
|
||||
}
|
||||
mAttribsInUse.clear();
|
||||
mAttribsInUse.resize(numVertexAttribs);
|
||||
mAttribMaxNameLength = 0;
|
||||
|
||||
for (size_t i = 0; i < mAttachedShaders.Length(); i++)
|
||||
mAttribMaxNameLength = NS_MAX(mAttribMaxNameLength, mAttachedShaders[i]->mAttribMaxNameLength);
|
||||
|
||||
GLint attribCount;
|
||||
mContext->gl->fGetProgramiv(mGLName, LOCAL_GL_ACTIVE_ATTRIBUTES, &attribCount);
|
||||
|
||||
mAttribsInUse.resize(mContext->mGLMaxVertexAttribs);
|
||||
std::fill(mAttribsInUse.begin(), mAttribsInUse.end(), false);
|
||||
|
||||
nsAutoArrayPtr<char> nameBuf(new char[mAttribMaxNameLength]);
|
||||
|
||||
for (int i = 0; i < mAttribCount; ++i) {
|
||||
for (int i = 0; i < attribCount; ++i) {
|
||||
GLint attrnamelen;
|
||||
GLint attrsize;
|
||||
GLenum attrtype;
|
||||
gl->fGetActiveAttrib(mGLName, i, mAttribMaxNameLength, &attrnamelen, &attrsize, &attrtype, nameBuf);
|
||||
mContext->gl->fGetActiveAttrib(mGLName, i, mAttribMaxNameLength, &attrnamelen, &attrsize, &attrtype, nameBuf);
|
||||
if (attrnamelen > 0) {
|
||||
GLint loc = gl->fGetAttribLocation(mGLName, nameBuf);
|
||||
mAttribsInUse[loc] = true;
|
||||
GLint loc = mContext->gl->fGetAttribLocation(mGLName, nameBuf);
|
||||
NS_ABORT_IF_FALSE(loc >= 0, "major oops in managing the attributes of a WebGL program");
|
||||
if (loc < mContext->mGLMaxVertexAttribs) {
|
||||
mAttribsInUse[loc] = true;
|
||||
} else {
|
||||
mContext->ErrorInvalidOperation("program exceeds MAX_VERTEX_ATTRIBS");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -334,7 +342,7 @@ bool WebGLContext::ValidateDrawModeEnum(WebGLenum mode, const char *info)
|
|||
|
||||
bool WebGLContext::ValidateGLSLVariableName(const nsAString& name, const char *info)
|
||||
{
|
||||
const PRUint32 maxSize = 255;
|
||||
const PRUint32 maxSize = 256;
|
||||
if (name.Length() > maxSize) {
|
||||
ErrorInvalidValue("%s: identifier is %d characters long, exceeds the maximum allowed length of %d characters",
|
||||
info, name.Length(), maxSize);
|
||||
|
|
|
@ -1,13 +1,7 @@
|
|||
conformance/context/premultiplyalpha-test.html
|
||||
conformance/glsl/misc/glsl-long-variable-names.html
|
||||
conformance/glsl/misc/shader-with-256-character-identifier.frag.html
|
||||
conformance/glsl/misc/shader-with-long-line.html
|
||||
conformance/misc/uninitialized-test.html
|
||||
conformance/programs/gl-get-active-attribute.html
|
||||
conformance/textures/texture-mips.html
|
||||
conformance/uniforms/gl-uniform-bool.html
|
||||
conformance/more/conformance/quickCheckAPI-S_V.html
|
||||
conformance/more/functions/uniformfArrayLen1.html
|
||||
conformance/glsl/misc/attrib-location-length-limits.html
|
||||
conformance/glsl/misc/uniform-location-length-limits.html
|
||||
conformance/renderbuffers/framebuffer-object-attachment.html
|
|
@ -1,11 +1,6 @@
|
|||
conformance/context/premultiplyalpha-test.html
|
||||
conformance/glsl/misc/glsl-function-nodes.html
|
||||
conformance/glsl/misc/glsl-long-variable-names.html
|
||||
conformance/glsl/misc/shader-with-256-character-identifier.frag.html
|
||||
conformance/glsl/misc/shader-with-long-line.html
|
||||
conformance/more/conformance/quickCheckAPI-S_V.html
|
||||
conformance/glsl/misc/attrib-location-length-limits.html
|
||||
conformance/glsl/misc/uniform-location-length-limits.html
|
||||
conformance/programs/program-test.html
|
||||
conformance/textures/texture-mips.html
|
||||
conformance/textures/texture-npot.html
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
conformance/context/premultiplyalpha-test.html
|
||||
conformance/glsl/functions/glsl-function-atan.html
|
||||
conformance/glsl/functions/glsl-function-atan-xy.html
|
||||
conformance/glsl/misc/glsl-long-variable-names.html
|
||||
conformance/glsl/misc/shader-with-256-character-identifier.frag.html
|
||||
conformance/glsl/misc/shader-with-long-line.html
|
||||
conformance/more/conformance/quickCheckAPI-S_V.html
|
||||
conformance/more/functions/uniformfArrayLen1.html
|
||||
conformance/glsl/misc/attrib-location-length-limits.html
|
||||
conformance/glsl/misc/struct-nesting-under-maximum.html
|
||||
conformance/glsl/misc/uniform-location-length-limits.html
|
||||
conformance/more/functions/uniformfArrayLen1.html
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "nsFrameLoader.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
|
||||
class nsIDOMAttr;
|
||||
class nsIDOMEventListener;
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "nsWeakPtr.h"
|
||||
#include "nsVariant.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsAsyncDOMEvent.h"
|
||||
|
@ -30,9 +29,10 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsGenericHTMLFrameElement,
|
|||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsGenericHTMLFrameElement)
|
||||
NS_INTERFACE_TABLE_INHERITED3(nsGenericHTMLFrameElement,
|
||||
NS_INTERFACE_TABLE_INHERITED4(nsGenericHTMLFrameElement,
|
||||
nsIFrameLoaderOwner,
|
||||
nsIDOMMozBrowserFrame,
|
||||
nsIMozBrowserFrame,
|
||||
nsIWebProgressListener)
|
||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsGenericHTMLFrameElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElement)
|
||||
|
@ -286,8 +286,8 @@ nsGenericHTMLFrameElement::SetMozbrowser(bool aValue)
|
|||
}
|
||||
|
||||
/*
|
||||
* If this frame element is allowed to be a browser frame (because it passes
|
||||
* BrowserFrameSecurityCheck()), then make sure that it has the appropriate
|
||||
* If this frame element is allowed to be a browser frame (i.e.,
|
||||
* GetReallyIsBrowser returns true), then make sure that it has the appropriate
|
||||
* event listeners enabled.
|
||||
*/
|
||||
void
|
||||
|
@ -299,7 +299,7 @@ nsGenericHTMLFrameElement::MaybeEnsureBrowserFrameListenersRegistered()
|
|||
|
||||
// If this frame passes the browser frame security check, ensure that its
|
||||
// listeners are active.
|
||||
if (!BrowserFrameSecurityCheck()) {
|
||||
if (!GetReallyIsBrowser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -352,7 +352,7 @@ nsGenericHTMLFrameElement::MaybeEnsureBrowserFrameListenersRegistered()
|
|||
* events, and false otherwise.
|
||||
*/
|
||||
bool
|
||||
nsGenericHTMLFrameElement::BrowserFrameSecurityCheck()
|
||||
nsGenericHTMLFrameElement::GetReallyIsBrowser()
|
||||
{
|
||||
// Fail if browser frames are globally disabled.
|
||||
if (!Preferences::GetBool("dom.mozBrowserFramesEnabled")) {
|
||||
|
@ -379,6 +379,13 @@ nsGenericHTMLFrameElement::BrowserFrameSecurityCheck()
|
|||
return true;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericHTMLFrameElement::GetReallyIsBrowser(bool *aResult)
|
||||
{
|
||||
*aResult = GetReallyIsBrowser();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire a mozbrowser event, if we have permission.
|
||||
*
|
||||
|
@ -400,7 +407,7 @@ nsGenericHTMLFrameElement::MaybeFireBrowserEvent(
|
|||
MOZ_ASSERT_IF(aEventType.EqualsLiteral("event"),
|
||||
aValue.IsEmpty());
|
||||
|
||||
if (!BrowserFrameSecurityCheck()) {
|
||||
if (!GetReallyIsBrowser()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsIDOMHTMLFrameElement.h"
|
||||
#include "nsIDOMMozBrowserFrame.h"
|
||||
#include "nsIMozBrowserFrame.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
class nsGenericHTMLFrameElement : public nsGenericHTMLElement,
|
||||
public nsIFrameLoaderOwner,
|
||||
public nsIDOMMozBrowserFrame,
|
||||
public nsIMozBrowserFrame,
|
||||
public nsIWebProgressListener
|
||||
{
|
||||
public:
|
||||
|
@ -33,6 +33,7 @@ public:
|
|||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
NS_DECL_NSIFRAMELOADEROWNER
|
||||
NS_DECL_NSIDOMMOZBROWSERFRAME
|
||||
NS_DECL_NSIMOZBROWSERFRAME
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
|
||||
// nsIContent
|
||||
|
@ -61,6 +62,9 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsGenericHTMLFrameElement,
|
||||
nsGenericHTMLElement)
|
||||
|
||||
// Non-COM version of nsIMozBrowserFrame::GetReallyIsBrowser.
|
||||
bool GetReallyIsBrowser();
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Listens to titlechanged events from the document inside the iframe and
|
||||
|
@ -92,7 +96,6 @@ protected:
|
|||
nsresult GetContentWindow(nsIDOMWindow** aContentWindow);
|
||||
|
||||
void MaybeEnsureBrowserFrameListenersRegistered();
|
||||
bool BrowserFrameSecurityCheck();
|
||||
nsresult MaybeFireBrowserEvent(const nsAString &aEventName,
|
||||
const nsAString &aEventType,
|
||||
const nsAString &aValue = EmptyString());
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
#include "nsIDocument.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsHTMLDNSPrefetch.h"
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
|
|
@ -100,8 +100,8 @@ public:
|
|||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsHTMLOutputElement,
|
||||
nsGenericHTMLFormElement)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLOutputElement,
|
||||
nsGenericHTMLFormElement)
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
protected:
|
||||
|
@ -136,13 +136,26 @@ nsHTMLOutputElement::~nsHTMLOutputElement()
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLOutputElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLOutputElement,
|
||||
nsGenericHTMLFormElement)
|
||||
if (tmp->mTokenList) {
|
||||
tmp->mTokenList->DropReference();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTokenList)
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLOutputElement,
|
||||
nsGenericHTMLFormElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mTokenList,
|
||||
nsDOMTokenList)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsHTMLOutputElement, nsGenericElement)
|
||||
NS_IMPL_RELEASE_INHERITED(nsHTMLOutputElement, nsGenericElement)
|
||||
|
||||
DOMCI_NODE_DATA(HTMLOutputElement, nsHTMLOutputElement)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsHTMLOutputElement)
|
||||
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLOutputElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE3(nsHTMLOutputElement,
|
||||
nsIDOMHTMLOutputElement,
|
||||
nsIMutationObserver,
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include "nsStyleConsts.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsRuleData.h"
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
|
||||
class nsHTMLSpanElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLElement
|
||||
|
|
|
@ -392,9 +392,9 @@ void
|
|||
SMILPreserveAspectRatio::ClearAnimValue()
|
||||
{
|
||||
if (mVal->mIsAnimated) {
|
||||
mVal->SetAnimValue(PackPreserveAspectRatio(mVal->GetBaseValue()),
|
||||
mSVGElement);
|
||||
mVal->mIsAnimated = false;
|
||||
mVal->mAnimVal = mVal->mBaseVal;
|
||||
mSVGElement->DidAnimatePreserveAspectRatio();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -510,8 +510,10 @@ nsSVGAngle::SMILOrient::ClearAnimValue()
|
|||
{
|
||||
if (mAngle->mIsAnimated) {
|
||||
mOrientType->SetAnimValue(mOrientType->GetBaseValue());
|
||||
mAngle->SetAnimValue(mAngle->mBaseVal, mAngle->mBaseValUnit, mSVGElement);
|
||||
mAngle->mIsAnimated = false;
|
||||
mAngle->mAnimVal = mAngle->mBaseVal;
|
||||
mAngle->mAnimValUnit = mAngle->mBaseValUnit;
|
||||
mSVGElement->DidAnimateAngle(mAngle->mAttrEnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -190,8 +190,9 @@ void
|
|||
nsSVGBoolean::SMILBool::ClearAnimValue()
|
||||
{
|
||||
if (mVal->mIsAnimated) {
|
||||
mVal->SetAnimValue(mVal->mBaseVal, mSVGElement);
|
||||
mVal->mIsAnimated = false;
|
||||
mVal->mAnimVal = mVal->mBaseVal;
|
||||
mSVGElement->DidAnimateBoolean(mVal->mAttrEnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,9 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT(nsSVGCircleElementBase::)
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGCircleElementBase::)
|
||||
|
||||
// nsSVGSVGElement methods:
|
||||
virtual bool HasValidDimensions() const;
|
||||
|
||||
// nsSVGPathGeometryElement methods:
|
||||
virtual void ConstructPath(gfxContext *aCtx);
|
||||
|
||||
|
@ -143,6 +146,13 @@ NS_IMETHODIMP nsSVGCircleElement::GetR(nsIDOMSVGAnimatedLength * *aR)
|
|||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
/* virtual */ bool
|
||||
nsSVGCircleElement::HasValidDimensions() const
|
||||
{
|
||||
return mLengthAttributes[R].IsExplicitlySet() &&
|
||||
mLengthAttributes[R].GetAnimValInSpecifiedUnits() > 0;
|
||||
}
|
||||
|
||||
nsSVGElement::LengthAttributesInfo
|
||||
nsSVGCircleElement::GetLengthInfo()
|
||||
{
|
||||
|
|
|
@ -49,7 +49,6 @@
|
|||
#include "nsChangeHint.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
#include "nsError.h"
|
||||
#include "nsGenericElement.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
|
@ -195,6 +194,9 @@ public:
|
|||
bool NumberAttrAllowsPercentage(PRUint8 aAttrEnum) {
|
||||
return GetNumberInfo().mNumberInfo[aAttrEnum].mPercentagesAllowed;
|
||||
}
|
||||
virtual bool HasValidDimensions() const {
|
||||
return true;
|
||||
}
|
||||
void SetLength(nsIAtom* aName, const nsSVGLength2 &aLength);
|
||||
|
||||
nsAttrValue WillChangeLength(PRUint8 aAttrEnum);
|
||||
|
|
|
@ -68,6 +68,9 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT(nsSVGEllipseElementBase::)
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGEllipseElementBase::)
|
||||
|
||||
// nsSVGSVGElement methods:
|
||||
virtual bool HasValidDimensions() const;
|
||||
|
||||
// nsSVGPathGeometryElement methods:
|
||||
virtual void ConstructPath(gfxContext *aCtx);
|
||||
|
||||
|
@ -151,6 +154,15 @@ NS_IMETHODIMP nsSVGEllipseElement::GetRy(nsIDOMSVGAnimatedLength * *aRy)
|
|||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
/* virtual */ bool
|
||||
nsSVGEllipseElement::HasValidDimensions() const
|
||||
{
|
||||
return mLengthAttributes[RX].IsExplicitlySet() &&
|
||||
mLengthAttributes[RX].GetAnimValInSpecifiedUnits() > 0 &&
|
||||
mLengthAttributes[RY].IsExplicitlySet() &&
|
||||
mLengthAttributes[RY].GetAnimValInSpecifiedUnits() > 0;
|
||||
}
|
||||
|
||||
nsSVGElement::LengthAttributesInfo
|
||||
nsSVGEllipseElement::GetLengthInfo()
|
||||
{
|
||||
|
|
|
@ -200,8 +200,9 @@ void
|
|||
nsSVGEnum::SMILEnum::ClearAnimValue()
|
||||
{
|
||||
if (mVal->mIsAnimated) {
|
||||
mVal->SetAnimValue(mVal->mBaseVal, mSVGElement);
|
||||
mVal->mIsAnimated = false;
|
||||
mVal->mAnimVal = mVal->mBaseVal;
|
||||
mSVGElement->DidAnimateEnum(mVal->mAttrEnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -219,6 +219,15 @@ nsSVGFilterElement::Invalidate()
|
|||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
/* virtual */ bool
|
||||
nsSVGFilterElement::HasValidDimensions() const
|
||||
{
|
||||
return (!mLengthAttributes[WIDTH].IsExplicitlySet() ||
|
||||
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
|
||||
(!mLengthAttributes[HEIGHT].IsExplicitlySet() ||
|
||||
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0);
|
||||
}
|
||||
|
||||
nsSVGElement::LengthAttributesInfo
|
||||
nsSVGFilterElement::GetLengthInfo()
|
||||
{
|
||||
|
|
|
@ -83,6 +83,9 @@ public:
|
|||
void Invalidate();
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
// nsSVGSVGElement methods:
|
||||
virtual bool HasValidDimensions() const;
|
||||
protected:
|
||||
|
||||
virtual LengthAttributesInfo GetLengthInfo();
|
||||
|
|
|
@ -310,6 +310,15 @@ nsSVGFE::IsAttributeMapped(const nsIAtom* name) const
|
|||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
/* virtual */ bool
|
||||
nsSVGFE::HasValidDimensions() const
|
||||
{
|
||||
return (!mLengthAttributes[WIDTH].IsExplicitlySet() ||
|
||||
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
|
||||
(!mLengthAttributes[HEIGHT].IsExplicitlySet() ||
|
||||
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0);
|
||||
}
|
||||
|
||||
nsSVGElement::LengthAttributesInfo
|
||||
nsSVGFE::GetLengthInfo()
|
||||
{
|
||||
|
|
|
@ -158,6 +158,9 @@ public:
|
|||
// nsIContent interface
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
|
||||
// nsSVGElement interface
|
||||
virtual bool HasValidDimensions() const;
|
||||
|
||||
virtual nsSVGString& GetResultImageName() = 0;
|
||||
// Return a list of all image names used as sources. Default is to
|
||||
// return no sources.
|
||||
|
|
|
@ -136,6 +136,15 @@ nsSVGForeignObjectElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
|
|||
return toUserSpace * fromUserSpace;
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
nsSVGForeignObjectElement::HasValidDimensions() const
|
||||
{
|
||||
return mLengthAttributes[WIDTH].IsExplicitlySet() &&
|
||||
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0 &&
|
||||
mLengthAttributes[HEIGHT].IsExplicitlySet() &&
|
||||
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIContent methods
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@ public:
|
|||
// nsSVGElement specializations:
|
||||
virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix,
|
||||
TransformTypes aWhich = eAllTransforms) const;
|
||||
virtual bool HasValidDimensions() const;
|
||||
|
||||
// nsIContent interface
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
|
|
|
@ -267,6 +267,15 @@ nsSVGImageElement::ConstructPath(gfxContext *aCtx)
|
|||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
/* virtual */ bool
|
||||
nsSVGImageElement::HasValidDimensions() const
|
||||
{
|
||||
return mLengthAttributes[WIDTH].IsExplicitlySet() &&
|
||||
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0 &&
|
||||
mLengthAttributes[HEIGHT].IsExplicitlySet() &&
|
||||
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0;
|
||||
}
|
||||
|
||||
nsSVGElement::LengthAttributesInfo
|
||||
nsSVGImageElement::GetLengthInfo()
|
||||
{
|
||||
|
|
|
@ -90,6 +90,9 @@ public:
|
|||
// nsSVGPathGeometryElement methods:
|
||||
virtual void ConstructPath(gfxContext *aCtx);
|
||||
|
||||
// nsSVGSVGElement methods:
|
||||
virtual bool HasValidDimensions() const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
nsresult CopyInnerTo(nsGenericElement* aDest) const;
|
||||
|
|
|
@ -185,8 +185,9 @@ void
|
|||
nsSVGInteger::SMILInteger::ClearAnimValue()
|
||||
{
|
||||
if (mVal->mIsAnimated) {
|
||||
mVal->SetAnimValue(mVal->mBaseVal, mSVGElement);
|
||||
mVal->mIsAnimated = false;
|
||||
mVal->mAnimVal = mVal->mBaseVal;
|
||||
mSVGElement->DidAnimateInteger(mVal->mAttrEnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -241,8 +241,10 @@ void
|
|||
nsSVGIntegerPair::SMILIntegerPair::ClearAnimValue()
|
||||
{
|
||||
if (mVal->mIsAnimated) {
|
||||
mVal->SetAnimValue(mVal->mBaseVal, mSVGElement);
|
||||
mVal->mIsAnimated = false;
|
||||
mVal->mAnimVal[0] = mVal->mBaseVal[0];
|
||||
mVal->mAnimVal[1] = mVal->mBaseVal[1];
|
||||
mSVGElement->DidAnimateIntegerPair(mVal->mAttrEnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -570,8 +570,9 @@ void
|
|||
nsSVGLength2::SMILLength::ClearAnimValue()
|
||||
{
|
||||
if (mVal->mIsAnimated) {
|
||||
mVal->SetAnimValueInSpecifiedUnits(mVal->mBaseVal, mSVGElement);
|
||||
mVal->mIsAnimated = false;
|
||||
mVal->mAnimVal = mVal->mBaseVal;
|
||||
mSVGElement->DidAnimateLength(mVal->mAttrEnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -306,6 +306,15 @@ nsSVGMarkerElement::SetParentCoordCtxProvider(nsSVGSVGElement *aContext)
|
|||
mViewBoxToViewportTransform = nsnull;
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
nsSVGMarkerElement::HasValidDimensions() const
|
||||
{
|
||||
return (!mLengthAttributes[MARKERWIDTH].IsExplicitlySet() ||
|
||||
mLengthAttributes[MARKERWIDTH].GetAnimValInSpecifiedUnits() > 0) &&
|
||||
(!mLengthAttributes[MARKERHEIGHT].IsExplicitlySet() ||
|
||||
mLengthAttributes[MARKERHEIGHT].GetAnimValInSpecifiedUnits() > 0);
|
||||
}
|
||||
|
||||
nsSVGElement::LengthAttributesInfo
|
||||
nsSVGMarkerElement::GetLengthInfo()
|
||||
{
|
||||
|
|
|
@ -133,6 +133,9 @@ public:
|
|||
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||
bool aNotify);
|
||||
|
||||
// nsSVGSVGElement methods:
|
||||
virtual bool HasValidDimensions() const;
|
||||
|
||||
// public helpers
|
||||
gfxMatrix GetMarkerTransform(float aStrokeWidth,
|
||||
float aX, float aY, float aAutoAngle);
|
||||
|
|
|
@ -136,6 +136,15 @@ NS_IMETHODIMP nsSVGMaskElement::GetHeight(nsIDOMSVGAnimatedLength * *aHeight)
|
|||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
/* virtual */ bool
|
||||
nsSVGMaskElement::HasValidDimensions() const
|
||||
{
|
||||
return (!mLengthAttributes[WIDTH].IsExplicitlySet() ||
|
||||
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
|
||||
(!mLengthAttributes[HEIGHT].IsExplicitlySet() ||
|
||||
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0);
|
||||
}
|
||||
|
||||
nsSVGElement::LengthAttributesInfo
|
||||
nsSVGMaskElement::GetLengthInfo()
|
||||
{
|
||||
|
|
|
@ -76,6 +76,9 @@ public:
|
|||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
// nsSVGSVGElement methods:
|
||||
virtual bool HasValidDimensions() const;
|
||||
protected:
|
||||
|
||||
virtual LengthAttributesInfo GetLengthInfo();
|
||||
|
|
|
@ -227,8 +227,9 @@ void
|
|||
nsSVGNumber2::SMILNumber::ClearAnimValue()
|
||||
{
|
||||
if (mVal->mIsAnimated) {
|
||||
mVal->SetAnimValue(mVal->mBaseVal, mSVGElement);
|
||||
mVal->mIsAnimated = false;
|
||||
mVal->mAnimVal = mVal->mBaseVal;
|
||||
mSVGElement->DidAnimateNumber(mVal->mAttrEnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -239,8 +239,10 @@ void
|
|||
nsSVGNumberPair::SMILNumberPair::ClearAnimValue()
|
||||
{
|
||||
if (mVal->mIsAnimated) {
|
||||
mVal->SetAnimValue(mVal->mBaseVal, mSVGElement);
|
||||
mVal->mIsAnimated = false;
|
||||
mVal->mAnimVal[0] = mVal->mBaseVal[0];
|
||||
mVal->mAnimVal[1] = mVal->mBaseVal[1];
|
||||
mSVGElement->DidAnimateNumberPair(mVal->mAttrEnum);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -341,6 +341,12 @@ nsSVGPathElement::CreateSVGPathSegCurvetoQuadraticSmoothRel(float x, float y, ns
|
|||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
/* virtual */ bool
|
||||
nsSVGPathElement::HasValidDimensions() const
|
||||
{
|
||||
return !mD.GetAnimValue().IsEmpty();
|
||||
}
|
||||
|
||||
nsSVGElement::NumberAttributesInfo
|
||||
nsSVGPathElement::GetNumberInfo()
|
||||
{
|
||||
|
|
|
@ -76,6 +76,9 @@ public:
|
|||
// nsIContent interface
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
|
||||
// nsSVGSVGElement methods:
|
||||
virtual bool HasValidDimensions() const;
|
||||
|
||||
// nsSVGPathGeometryElement methods:
|
||||
virtual bool AttributeDefinesGeometry(const nsIAtom *aName);
|
||||
virtual bool IsMarkable();
|
||||
|
|
|
@ -214,6 +214,15 @@ nsSVGPatternElement::GetAnimatedTransformList()
|
|||
return mPatternTransform;
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
nsSVGPatternElement::HasValidDimensions() const
|
||||
{
|
||||
return mLengthAttributes[WIDTH].IsExplicitlySet() &&
|
||||
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0 &&
|
||||
mLengthAttributes[HEIGHT].IsExplicitlySet() &&
|
||||
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0;
|
||||
}
|
||||
|
||||
nsSVGElement::LengthAttributesInfo
|
||||
nsSVGPatternElement::GetLengthInfo()
|
||||
{
|
||||
|
|
|
@ -96,6 +96,9 @@ public:
|
|||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
// nsSVGSVGElement methods:
|
||||
virtual bool HasValidDimensions() const;
|
||||
|
||||
virtual mozilla::SVGAnimatedTransformList* GetAnimatedTransformList();
|
||||
virtual nsIAtom* GetTransformListAttrName() const {
|
||||
return nsGkAtoms::patternTransform;
|
||||
|
|
|
@ -67,6 +67,9 @@ public:
|
|||
NS_FORWARD_NSIDOMELEMENT(nsSVGRectElementBase::)
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGRectElementBase::)
|
||||
|
||||
// nsSVGSVGElement methods:
|
||||
virtual bool HasValidDimensions() const;
|
||||
|
||||
// nsSVGPathGeometryElement methods:
|
||||
virtual void ConstructPath(gfxContext *aCtx);
|
||||
|
||||
|
@ -164,6 +167,15 @@ NS_IMETHODIMP nsSVGRectElement::GetRy(nsIDOMSVGAnimatedLength * *aRy)
|
|||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
/* virtual */ bool
|
||||
nsSVGRectElement::HasValidDimensions() const
|
||||
{
|
||||
return mLengthAttributes[WIDTH].IsExplicitlySet() &&
|
||||
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0 &&
|
||||
mLengthAttributes[HEIGHT].IsExplicitlySet() &&
|
||||
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0;
|
||||
}
|
||||
|
||||
nsSVGElement::LengthAttributesInfo
|
||||
nsSVGRectElement::GetLengthInfo()
|
||||
{
|
||||
|
|
|
@ -1189,6 +1189,16 @@ nsSVGSVGElement::GetLength(PRUint8 aCtxType)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGSVGElement::SyncWidthOrHeight(nsIAtom* aName, nsSVGElement *aTarget) const
|
||||
{
|
||||
NS_ASSERTION(aName == nsGkAtoms::width || aName == nsGkAtoms::height,
|
||||
"The clue is in the function name");
|
||||
|
||||
PRUint32 index = *sLengthInfo[WIDTH].mName == aName ? WIDTH : HEIGHT;
|
||||
aTarget->SetLength(aName, mLengthAttributes[index]);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
|
@ -1229,6 +1239,16 @@ nsSVGSVGElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
|
|||
return GetViewBoxTransform() * aMatrix;
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
nsSVGSVGElement::HasValidDimensions() const
|
||||
{
|
||||
return !IsInner() ||
|
||||
((!mLengthAttributes[WIDTH].IsExplicitlySet() ||
|
||||
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
|
||||
(!mLengthAttributes[HEIGHT].IsExplicitlySet() ||
|
||||
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0));
|
||||
}
|
||||
|
||||
nsSVGElement::LengthAttributesInfo
|
||||
nsSVGSVGElement::GetLengthInfo()
|
||||
{
|
||||
|
|
|
@ -188,9 +188,12 @@ public:
|
|||
// nsSVGElement specializations:
|
||||
virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix,
|
||||
TransformTypes aWhich = eAllTransforms) const;
|
||||
virtual bool HasValidDimensions() const;
|
||||
|
||||
// nsSVGSVGElement methods:
|
||||
float GetLength(PRUint8 mCtxType);
|
||||
// Copy our width or height to the target
|
||||
void SyncWidthOrHeight(nsIAtom* aName, nsSVGElement *aTarget) const;
|
||||
|
||||
// public helpers:
|
||||
gfxMatrix GetViewBoxTransform() const;
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "nsIDOMSVGGElement.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMSVGSVGElement.h"
|
||||
#include "nsSVGSVGElement.h"
|
||||
#include "nsIDOMSVGSymbolElement.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
@ -288,10 +288,6 @@ nsSVGUseElement::CreateAnonymousContent()
|
|||
tag != nsGkAtoms::use)
|
||||
return nsnull;
|
||||
|
||||
// Make sure the use attributes are valid
|
||||
if (!HasValidDimensions())
|
||||
return nsnull;
|
||||
|
||||
// circular loop detection
|
||||
|
||||
// check 1 - check if we're a document descendent of the target
|
||||
|
@ -299,8 +295,8 @@ nsSVGUseElement::CreateAnonymousContent()
|
|||
return nsnull;
|
||||
|
||||
// check 2 - check if we're a clone, and if we already exist in the hierarchy
|
||||
if (this->GetParent() && mOriginal) {
|
||||
for (nsCOMPtr<nsIContent> content = this->GetParent();
|
||||
if (GetParent() && mOriginal) {
|
||||
for (nsCOMPtr<nsIContent> content = GetParent();
|
||||
content;
|
||||
content = content->GetParent()) {
|
||||
nsCOMPtr<nsIDOMSVGUseElement> useElement = do_QueryInterface(content);
|
||||
|
@ -407,43 +403,43 @@ nsSVGUseElement::DestroyAnonymousContent()
|
|||
//----------------------------------------------------------------------
|
||||
// implementation helpers
|
||||
|
||||
bool nsSVGUseElement::HasValidDimensions()
|
||||
{
|
||||
nsSVGSVGElement *ctx = GetCtx();
|
||||
|
||||
return (!mLengthAttributes[WIDTH].IsExplicitlySet() ||
|
||||
mLengthAttributes[WIDTH].GetAnimValue(ctx) > 0) &&
|
||||
(!mLengthAttributes[HEIGHT].IsExplicitlySet() ||
|
||||
mLengthAttributes[HEIGHT].GetAnimValue(ctx) > 0);
|
||||
}
|
||||
|
||||
void
|
||||
nsSVGUseElement::SyncWidthHeight(nsIAtom* aName)
|
||||
nsSVGUseElement::SyncWidthOrHeight(nsIAtom* aName)
|
||||
{
|
||||
NS_ASSERTION(aName == nsGkAtoms::width || aName == nsGkAtoms::height,
|
||||
"The clue is in the function name");
|
||||
|
||||
if (HasValidDimensions() == !mClone) {
|
||||
TriggerReclone();
|
||||
if (!mClone) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mClone) {
|
||||
nsCOMPtr<nsIDOMSVGSymbolElement> symbol = do_QueryInterface(mClone);
|
||||
nsCOMPtr<nsIDOMSVGSVGElement> svg = do_QueryInterface(mClone);
|
||||
nsCOMPtr<nsIDOMSVGSymbolElement> symbol = do_QueryInterface(mClone);
|
||||
nsCOMPtr<nsIDOMSVGSVGElement> svg = do_QueryInterface(mClone);
|
||||
|
||||
if (symbol || svg) {
|
||||
PRUint32 index = *sLengthInfo[WIDTH].mName == aName ? WIDTH : HEIGHT;
|
||||
if (mLengthAttributes[index].IsExplicitlySet()) {
|
||||
static_cast<nsSVGElement*>(mClone.get())->
|
||||
SetLength(aName, mLengthAttributes[index]);
|
||||
} else {
|
||||
// Our width/height attribute is now no longer explicitly set, so we
|
||||
// need to revert the clone's width/height to the width/height of the
|
||||
// content that's being cloned.
|
||||
TriggerReclone();
|
||||
}
|
||||
if (symbol || svg) {
|
||||
nsSVGElement *target = static_cast<nsSVGElement*>(mClone.get());
|
||||
PRUint32 index = *sLengthInfo[WIDTH].mName == aName ? WIDTH : HEIGHT;
|
||||
|
||||
if (mLengthAttributes[index].IsExplicitlySet()) {
|
||||
target->SetLength(aName, mLengthAttributes[index]);
|
||||
return;
|
||||
}
|
||||
if (svg) {
|
||||
// Our width/height attribute is now no longer explicitly set, so we
|
||||
// need to revert the clone's width/height to the width/height of the
|
||||
// content that's being cloned.
|
||||
nsSVGSVGElement* svgElement =
|
||||
static_cast<nsSVGSVGElement*>(mSource.get());
|
||||
svgElement->SyncWidthOrHeight(aName, target);
|
||||
return;
|
||||
}
|
||||
// Our width/height attribute is now no longer explicitly set, so we
|
||||
// need to set the value to 100%
|
||||
nsSVGLength2 length;
|
||||
length.Init(nsSVGUtils::XY, 0xff,
|
||||
100, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE);
|
||||
target->SetLength(aName, length);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -511,6 +507,15 @@ nsSVGUseElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
|
|||
return toUserSpace * fromUserSpace;
|
||||
}
|
||||
|
||||
/* virtual */ bool
|
||||
nsSVGUseElement::HasValidDimensions() const
|
||||
{
|
||||
return (!mLengthAttributes[WIDTH].IsExplicitlySet() ||
|
||||
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
|
||||
(!mLengthAttributes[HEIGHT].IsExplicitlySet() ||
|
||||
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0);
|
||||
}
|
||||
|
||||
nsSVGElement::LengthAttributesInfo
|
||||
nsSVGUseElement::GetLengthInfo()
|
||||
{
|
||||
|
|
|
@ -105,6 +105,7 @@ public:
|
|||
// nsSVGElement specializations:
|
||||
virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix,
|
||||
TransformTypes aWhich = eAllTransforms) const;
|
||||
virtual bool HasValidDimensions() const;
|
||||
|
||||
// nsIContent interface
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
@ -130,8 +131,7 @@ protected:
|
|||
virtual LengthAttributesInfo GetLengthInfo();
|
||||
virtual StringAttributesInfo GetStringInfo();
|
||||
|
||||
bool HasValidDimensions();
|
||||
void SyncWidthHeight(nsIAtom *aName);
|
||||
void SyncWidthOrHeight(nsIAtom *aName);
|
||||
void LookupHref();
|
||||
void TriggerReclone();
|
||||
void UnlinkSource();
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
#include "nsGkAtoms.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMMemoryReporter.h"
|
||||
|
||||
|
||||
class nsXMLCDATASection : public nsGenericDOMDataNode,
|
||||
public nsIDOMCDATASection
|
||||
|
|
|
@ -11756,3 +11756,18 @@ nsDocShell::GetCanExecuteScripts(bool *aResult)
|
|||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetIsBrowserFrame(bool *aOut)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOut);
|
||||
*aOut = mIsBrowserFrame;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetIsBrowserFrame(bool aValue)
|
||||
{
|
||||
mIsBrowserFrame = aValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -804,6 +804,7 @@ protected:
|
|||
bool mIsAppTab;
|
||||
bool mUseGlobalHistory;
|
||||
bool mInPrivateBrowsing;
|
||||
bool mIsBrowserFrame;
|
||||
|
||||
// This boolean is set to true right before we fire pagehide and generally
|
||||
// unset when we embed a new content viewer. While it's true no navigation
|
||||
|
|
|
@ -72,7 +72,7 @@ interface nsIPrincipal;
|
|||
interface nsIWebBrowserPrint;
|
||||
interface nsIVariant;
|
||||
|
||||
[scriptable, uuid(0615d1a6-313f-11e1-a043-6c626d69675c)]
|
||||
[scriptable, uuid(DBD39C21-5788-4C68-9D97-0FCEE289BCE1)]
|
||||
interface nsIDocShell : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -602,4 +602,16 @@ interface nsIDocShell : nsISupports
|
|||
* @see nsIParser
|
||||
*/
|
||||
attribute PRInt32 parentCharsetSource;
|
||||
|
||||
/*
|
||||
* Is this docshell a browser frame (i.e., does it correspond to an <iframe
|
||||
* mozbrowser>)? The frameloader is responsible for setting this property
|
||||
* when it initializes the docshell.
|
||||
*
|
||||
* If so, this docshell should act like a chrome/content boundary for the
|
||||
* purposes of window.top and window.parent.
|
||||
*
|
||||
* See also nsIMozBrowserFrame.
|
||||
*/
|
||||
attribute bool isBrowserFrame;
|
||||
};
|
||||
|
|
|
@ -104,7 +104,7 @@ EXPORTS = \
|
|||
nsWrapperCache.h \
|
||||
nsContentPermissionHelper.h \
|
||||
nsStructuredCloneContainer.h \
|
||||
nsDOMMemoryReporter.h \
|
||||
nsWindowMemoryReporter.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS_NAMESPACES = mozilla/dom
|
||||
|
@ -139,7 +139,7 @@ CPPSRCS = \
|
|||
nsStructuredCloneContainer.cpp \
|
||||
nsDOMNavigationTiming.cpp \
|
||||
nsPerformance.cpp \
|
||||
nsDOMMemoryReporter.cpp \
|
||||
nsWindowMemoryReporter.cpp \
|
||||
DOMError.cpp \
|
||||
DOMRequest.cpp \
|
||||
Navigator.cpp \
|
||||
|
|
|
@ -66,11 +66,6 @@ DOM_MSG_DEF_(TIMEOUT_ERR, "TimeoutError", "The operation timed out.")
|
|||
DOM_MSG_DEF_(INVALID_NODE_TYPE_ERR, "InvalidNodeTypeError", "The supplied node is incorrect or has an incorrect ancestor for this operation.")
|
||||
DOM_MSG_DEF_(DATA_CLONE_ERR, "DataCloneError", "The object could not be cloned.")
|
||||
|
||||
/* DOM error codes from http://www.w3.org/TR/DOM-Level-2/range.html */
|
||||
|
||||
DOM_MSG_DEF(NS_ERROR_DOM_RANGE_BAD_BOUNDARYPOINTS_ERR, "The boundary-points of a range does not meet specific requirements.")
|
||||
DOM_MSG_DEF(NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR, "The container of an boundary-point of a range is being set to either a node of an invalid type or a node with an ancestor of an invalid type.")
|
||||
|
||||
/* SVG DOM error codes from http://www.w3.org/TR/SVG11/svgdom.html */
|
||||
|
||||
DOM_MSG_DEF(NS_ERROR_DOM_SVG_WRONG_TYPE_ERR, "Unknown or invalid type")
|
||||
|
|
|
@ -140,7 +140,6 @@
|
|||
#include "nsDOMError.h"
|
||||
#include "nsIDOMDOMException.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMNamedNodeMap.h"
|
||||
#include "nsIDOMDOMStringList.h"
|
||||
#include "nsIDOMDOMTokenList.h"
|
||||
|
@ -152,8 +151,6 @@
|
|||
#include "nsIForm.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsIHTMLCollection.h"
|
||||
#include "nsHTMLDocument.h"
|
||||
|
||||
// Constraint Validation API helper includes
|
||||
|
@ -168,12 +165,7 @@
|
|||
#include "nsIObjectLoadingContent.h"
|
||||
#include "nsIPluginHost.h"
|
||||
|
||||
// HTMLOptionsCollection includes
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIDOMHTMLOptionsCollection.h"
|
||||
|
||||
// ContentList includes
|
||||
#include "nsContentList.h"
|
||||
#include "nsGenericElement.h"
|
||||
|
||||
// Event related includes
|
||||
|
@ -329,7 +321,6 @@
|
|||
#include "nsIDOMDeviceOrientationEvent.h"
|
||||
#include "nsIDOMDeviceMotionEvent.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIDOMRangeException.h"
|
||||
#include "nsIDOMNodeIterator.h"
|
||||
#include "nsIDOMTreeWalker.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
|
@ -785,7 +776,8 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
NS_DEFINE_CLASSINFO_DATA(CDATASection, nsNodeSH, NODE_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(ProcessingInstruction, nsNodeSH,
|
||||
NODE_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(NodeList, nsNodeListSH, ARRAY_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(NodeList, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(NamedNodeMap, nsNamedNodeMapSH,
|
||||
ARRAY_SCRIPTABLE_FLAGS)
|
||||
|
||||
|
@ -824,13 +816,10 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
NS_DEFINE_CLASSINFO_DATA(HTMLDocument, nsHTMLDocumentSH,
|
||||
DOCUMENT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_GETPROPERTY)
|
||||
NS_DEFINE_CLASSINFO_DATA(HTMLOptionsCollection,
|
||||
nsHTMLOptionsCollectionSH,
|
||||
ARRAY_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_SETPROPERTY)
|
||||
NS_DEFINE_CLASSINFO_DATA(HTMLCollection,
|
||||
nsHTMLCollectionSH,
|
||||
ARRAY_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(HTMLOptionsCollection, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(HTMLCollection, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
// HTML element classes
|
||||
NS_DEFINE_CLASSINFO_DATA(HTMLElement, nsElementSH,
|
||||
|
@ -1034,14 +1023,12 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
NS_DEFINE_CLASSINFO_DATA(CSSRGBColor, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(RangeException, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(CSSValueList, nsCSSValueListSH,
|
||||
ARRAY_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA_WITH_NAME(ContentList, HTMLCollection,
|
||||
nsContentListSH, ARRAY_SCRIPTABLE_FLAGS)
|
||||
nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CLASSINFO_DATA(XMLStylesheetProcessingInstruction, nsNodeSH,
|
||||
NODE_SCRIPTABLE_FLAGS)
|
||||
|
@ -3108,11 +3095,6 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMChromeWindow)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(RangeException, nsIDOMRangeException)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMRangeException)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIException)
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN_NO_CLASS_IF(ContentList, nsIDOMHTMLCollection)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNodeList)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMHTMLCollection)
|
||||
|
@ -4460,7 +4442,7 @@ nsDOMClassInfo::GetArrayIndexFromId(JSContext *cx, jsid id, bool *aIsNumber)
|
|||
*aIsNumber = false;
|
||||
}
|
||||
|
||||
jsint i;
|
||||
int i;
|
||||
if (JSID_IS_INT(id)) {
|
||||
i = JSID_TO_INT(id);
|
||||
} else {
|
||||
|
@ -8020,74 +8002,6 @@ nsArraySH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
}
|
||||
|
||||
|
||||
// NodeList scriptable helper
|
||||
|
||||
nsresult
|
||||
nsNodeListSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj)
|
||||
{
|
||||
nsINodeList* list = static_cast<nsINodeList*>(nativeObj);
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsINodeList> list_qi = do_QueryInterface(nativeObj);
|
||||
|
||||
// If this assertion fires the QI implementation for the object in
|
||||
// question doesn't use the nsINodeList pointer as the nsISupports
|
||||
// pointer. That must be fixed, or we'll crash...
|
||||
NS_ASSERTION(list_qi == list, "Uh, fix QI!");
|
||||
}
|
||||
#endif
|
||||
|
||||
nsINode* native_parent = list->GetParentObject();
|
||||
|
||||
nsresult rv =
|
||||
WrapNativeParent(cx, globalObj, native_parent, native_parent, parentObj);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_SUCCESS_ALLOW_SLIM_WRAPPERS;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsNodeListSH::GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, PRUint32 *length)
|
||||
{
|
||||
nsINodeList* list = static_cast<nsINodeList*>(GetNative(wrapper, obj));
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsINodeList> list_qi = do_QueryWrappedNative(wrapper, obj);
|
||||
|
||||
// If this assertion fires the QI implementation for the object in
|
||||
// question doesn't use the nsINodeList pointer as the nsISupports
|
||||
// pointer. That must be fixed, or we'll crash...
|
||||
NS_ABORT_IF_FALSE(list_qi == list, "Uh, fix QI!");
|
||||
}
|
||||
#endif
|
||||
|
||||
return list->GetLength(length);
|
||||
}
|
||||
|
||||
nsISupports*
|
||||
nsNodeListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsINodeList* list = static_cast<nsINodeList*>(aNative);
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsINodeList> list_qi = do_QueryInterface(aNative);
|
||||
|
||||
// If this assertion fires the QI implementation for the object in
|
||||
// question doesn't use the nsINodeList pointer as the nsISupports
|
||||
// pointer. That must be fixed, or we'll crash...
|
||||
NS_ABORT_IF_FALSE(list_qi == list, "Uh, fix QI!");
|
||||
}
|
||||
#endif
|
||||
|
||||
nsINode *node;
|
||||
*aCache = node = list->GetNodeAt(aIndex);
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
// StringList scriptable helper
|
||||
|
||||
nsresult
|
||||
|
@ -8248,146 +8162,6 @@ nsNamedNodeMapSH::GetNamedItem(nsISupports *aNative, const nsAString& aName,
|
|||
}
|
||||
|
||||
|
||||
// HTMLCollection helper
|
||||
|
||||
nsresult
|
||||
nsHTMLCollectionSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj)
|
||||
{
|
||||
nsIHTMLCollection* list = static_cast<nsIHTMLCollection*>(nativeObj);
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsIHTMLCollection> list_qi = do_QueryInterface(nativeObj);
|
||||
|
||||
// If this assertion fires the QI implementation for the object in
|
||||
// question doesn't use the nsIHTMLCollection pointer as the nsISupports
|
||||
// pointer. That must be fixed, or we'll crash...
|
||||
NS_ASSERTION(list_qi == list, "Uh, fix QI!");
|
||||
}
|
||||
#endif
|
||||
|
||||
nsINode* native_parent = list->GetParentObject();
|
||||
|
||||
nsresult rv =
|
||||
WrapNativeParent(cx, globalObj, native_parent, native_parent, parentObj);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_SUCCESS_ALLOW_SLIM_WRAPPERS;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLCollectionSH::GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, PRUint32 *length)
|
||||
{
|
||||
nsIHTMLCollection* collection =
|
||||
static_cast<nsIHTMLCollection*>(GetNative(wrapper, obj));
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsIHTMLCollection> collection_qi =
|
||||
do_QueryWrappedNative(wrapper, obj);
|
||||
|
||||
// If this assertion fires the QI implementation for the object in
|
||||
// question doesn't use the nsIHTMLCollection pointer as the nsISupports
|
||||
// pointer. That must be fixed, or we'll crash...
|
||||
NS_ABORT_IF_FALSE(collection_qi == collection, "Uh, fix QI!");
|
||||
}
|
||||
#endif
|
||||
|
||||
return collection->GetLength(length);
|
||||
}
|
||||
|
||||
nsISupports*
|
||||
nsHTMLCollectionSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsIHTMLCollection* collection = static_cast<nsIHTMLCollection*>(aNative);
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsIHTMLCollection> collection_qi = do_QueryInterface(aNative);
|
||||
|
||||
// If this assertion fires the QI implementation for the object in
|
||||
// question doesn't use the nsIHTMLCollection pointer as the nsISupports
|
||||
// pointer. That must be fixed, or we'll crash...
|
||||
NS_ABORT_IF_FALSE(collection_qi == collection, "Uh, fix QI!");
|
||||
}
|
||||
#endif
|
||||
|
||||
nsINode *item;
|
||||
*aCache = item = collection->GetNodeAt(aIndex);
|
||||
return item;
|
||||
}
|
||||
|
||||
nsISupports*
|
||||
nsHTMLCollectionSH::GetNamedItem(nsISupports *aNative,
|
||||
const nsAString& aName,
|
||||
nsWrapperCache **aCache,
|
||||
nsresult *aResult)
|
||||
{
|
||||
nsIHTMLCollection* collection = static_cast<nsIHTMLCollection*>(aNative);
|
||||
#ifdef DEBUG
|
||||
{
|
||||
nsCOMPtr<nsIHTMLCollection> collection_qi = do_QueryInterface(aNative);
|
||||
|
||||
// If this assertion fires the QI implementation for the object in
|
||||
// question doesn't use the nsIHTMLCollection pointer as the nsISupports
|
||||
// pointer. That must be fixed, or we'll crash...
|
||||
NS_ABORT_IF_FALSE(collection_qi == collection, "Uh, fix QI!");
|
||||
}
|
||||
#endif
|
||||
|
||||
return collection->GetNamedItem(aName, aCache);
|
||||
}
|
||||
|
||||
|
||||
// ContentList helper
|
||||
nsresult
|
||||
nsContentListSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj)
|
||||
{
|
||||
nsContentList *contentList = nsContentList::FromSupports(nativeObj);
|
||||
nsINode *native_parent = contentList->GetParentObject();
|
||||
|
||||
if (!native_parent) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult rv =
|
||||
WrapNativeParent(cx, globalObj, native_parent, native_parent, parentObj);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_SUCCESS_ALLOW_SLIM_WRAPPERS;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsContentListSH::GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, PRUint32 *length)
|
||||
{
|
||||
nsContentList *list =
|
||||
nsContentList::FromSupports(GetNative(wrapper, obj));
|
||||
|
||||
return list->GetLength(length);
|
||||
}
|
||||
|
||||
nsISupports*
|
||||
nsContentListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsContentList *list = nsContentList::FromSupports(aNative);
|
||||
|
||||
nsIContent *item;
|
||||
*aCache = item = list->GetNodeAt(aIndex);
|
||||
return item;
|
||||
}
|
||||
|
||||
nsISupports*
|
||||
nsContentListSH::GetNamedItem(nsISupports *aNative, const nsAString& aName,
|
||||
nsWrapperCache **aCache, nsresult *aResult)
|
||||
{
|
||||
nsContentList *list = nsContentList::FromSupports(aNative);
|
||||
|
||||
return list->GetNamedItem(aName, aCache);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMStringMapSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, PRUint32 flags,
|
||||
|
@ -9917,31 +9691,6 @@ nsHTMLPluginObjElementSH::NewResolve(nsIXPConnectWrappedNative *wrapper,
|
|||
_retval);
|
||||
}
|
||||
|
||||
// HTMLOptionsCollection helper
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLOptionsCollectionSH::SetProperty(nsIXPConnectWrappedNative *wrapper,
|
||||
JSContext *cx, JSObject *obj, jsid id,
|
||||
jsval *vp, bool *_retval)
|
||||
{
|
||||
PRInt32 n = GetArrayIndexFromId(cx, id);
|
||||
|
||||
if (n < 0) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLOptionsCollection> oc =
|
||||
do_QueryWrappedNative(wrapper, obj);
|
||||
NS_ENSURE_TRUE(oc, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsresult rv = nsHTMLSelectElementSH::SetOption(cx, vp, n, oc);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = NS_SUCCESS_I_DID_SOMETHING;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
// Plugin helper
|
||||
|
||||
nsISupports*
|
||||
|
|
|
@ -61,7 +61,6 @@ class DOMSVGTransformList;
|
|||
class nsGlobalWindow;
|
||||
class nsIDOMDocument;
|
||||
class nsIDOMHTMLOptionsCollection;
|
||||
class nsIDOMNodeList;
|
||||
class nsIDOMSVGLength;
|
||||
class nsIDOMSVGLengthList;
|
||||
class nsIDOMSVGNumber;
|
||||
|
@ -624,31 +623,6 @@ private:
|
|||
};
|
||||
|
||||
|
||||
// NodeList scriptable helper
|
||||
|
||||
class nsNodeListSH : public nsArraySH
|
||||
{
|
||||
protected:
|
||||
nsNodeListSH(nsDOMClassInfoData* aData) : nsArraySH(aData)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj);
|
||||
|
||||
virtual nsresult GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, PRUint32 *length);
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsWrapperCache **aCache, nsresult *aResult);
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
return new nsNodeListSH(aData);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// NamedArray helper
|
||||
|
||||
class nsNamedArraySH : public nsArraySH
|
||||
|
@ -711,70 +685,6 @@ public:
|
|||
};
|
||||
|
||||
|
||||
// HTMLCollection helper
|
||||
|
||||
class nsHTMLCollectionSH : public nsNamedArraySH
|
||||
{
|
||||
protected:
|
||||
nsHTMLCollectionSH(nsDOMClassInfoData* aData) : nsNamedArraySH(aData)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~nsHTMLCollectionSH()
|
||||
{
|
||||
}
|
||||
|
||||
virtual nsresult GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, PRUint32 *length);
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsWrapperCache **aCache, nsresult *aResult);
|
||||
|
||||
// Override nsNamedArraySH::GetNamedItem()
|
||||
virtual nsISupports* GetNamedItem(nsISupports *aNative,
|
||||
const nsAString& aName,
|
||||
nsWrapperCache **cache,
|
||||
nsresult *aResult);
|
||||
|
||||
public:
|
||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj);
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
return new nsHTMLCollectionSH(aData);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// ContentList helper
|
||||
|
||||
class nsContentListSH : public nsNamedArraySH
|
||||
{
|
||||
protected:
|
||||
nsContentListSH(nsDOMClassInfoData* aData) : nsNamedArraySH(aData)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj);
|
||||
|
||||
virtual nsresult GetLength(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, PRUint32 *length);
|
||||
virtual nsISupports* GetItemAt(nsISupports *aNative, PRUint32 aIndex,
|
||||
nsWrapperCache **aCache, nsresult *aResult);
|
||||
virtual nsISupports* GetNamedItem(nsISupports *aNative,
|
||||
const nsAString& aName,
|
||||
nsWrapperCache **cache,
|
||||
nsresult *aResult);
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
return new nsContentListSH(aData);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// DOMStringMap helper for .dataset property on elements.
|
||||
|
||||
class nsDOMStringMapSH : public nsDOMGenericSH
|
||||
|
@ -1007,31 +917,6 @@ public:
|
|||
};
|
||||
|
||||
|
||||
// HTMLOptionsCollection helper
|
||||
|
||||
class nsHTMLOptionsCollectionSH : public nsHTMLCollectionSH
|
||||
{
|
||||
protected:
|
||||
nsHTMLOptionsCollectionSH(nsDOMClassInfoData* aData)
|
||||
: nsHTMLCollectionSH(aData)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~nsHTMLOptionsCollectionSH()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, jsval *vp, bool *_retval);
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
return new nsHTMLOptionsCollectionSH(aData);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Plugin helper
|
||||
|
||||
class nsPluginSH : public nsNamedArraySH
|
||||
|
|
|
@ -197,8 +197,6 @@ DOMCI_CLASS(ChromeWindow)
|
|||
// RGBColor object used by getComputedStyle
|
||||
DOMCI_CLASS(CSSRGBColor)
|
||||
|
||||
DOMCI_CLASS(RangeException)
|
||||
|
||||
// CSSValueList object that represents an nsIDOMCSSValueList, used
|
||||
// by DOM CSS
|
||||
DOMCI_CLASS(CSSValueList)
|
||||
|
|
|
@ -71,11 +71,6 @@
|
|||
#define NS_ERROR_DOM_INVALID_NODE_TYPE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,24)
|
||||
#define NS_ERROR_DOM_DATA_CLONE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM,25)
|
||||
|
||||
/* DOM error codes from http://www.w3.org/TR/DOM-Level-2/range.html */
|
||||
|
||||
#define NS_ERROR_DOM_RANGE_BAD_BOUNDARYPOINTS_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM_RANGE, 1)
|
||||
#define NS_ERROR_DOM_RANGE_INVALID_NODE_TYPE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_DOM_RANGE, 2)
|
||||
|
||||
/* SVG DOM error codes from http://www.w3.org/TR/SVG11/svgdom.html */
|
||||
|
||||
#define NS_ERROR_DOM_SVG_WRONG_TYPE_ERR NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_SVG,0)
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "nsDOMError.h"
|
||||
#include "nsDOMException.h"
|
||||
#include "nsIDOMDOMException.h"
|
||||
#include "nsIDOMRangeException.h"
|
||||
#include "nsIDOMFileException.h"
|
||||
#include "nsIDOMSVGException.h"
|
||||
#include "nsIDOMXPathException.h"
|
||||
|
@ -169,23 +168,6 @@ nsDOMException::GetCode(PRUint16* aCode)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
IMPL_INTERNAL_DOM_EXCEPTION_HEAD(nsRangeException, nsIDOMRangeException)
|
||||
NS_DECL_NSIDOMRANGEEXCEPTION
|
||||
IMPL_INTERNAL_DOM_EXCEPTION_TAIL(nsRangeException, nsIDOMRangeException,
|
||||
RangeException, NS_ERROR_MODULE_DOM_RANGE,
|
||||
NSResultToNameAndMessage)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRangeException::GetCode(PRUint16* aCode)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCode);
|
||||
nsresult result;
|
||||
GetResult(&result);
|
||||
*aCode = NS_ERROR_GET_CODE(result);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
IMPL_INTERNAL_DOM_EXCEPTION_HEAD(nsSVGException, nsIDOMSVGException)
|
||||
NS_DECL_NSIDOMSVGEXCEPTION
|
||||
IMPL_INTERNAL_DOM_EXCEPTION_TAIL(nsSVGException, nsIDOMSVGException,
|
||||
|
|
|
@ -72,7 +72,6 @@ NS_New##domname(nsresult aNSResult, nsIException* aDefaultException, \
|
|||
|
||||
|
||||
DECL_INTERNAL_DOM_EXCEPTION(DOMException)
|
||||
DECL_INTERNAL_DOM_EXCEPTION(RangeException)
|
||||
DECL_INTERNAL_DOM_EXCEPTION(SVGException)
|
||||
DECL_INTERNAL_DOM_EXCEPTION(XPathException)
|
||||
DECL_INTERNAL_DOM_EXCEPTION(FileException)
|
||||
|
|
|
@ -87,7 +87,6 @@ nsDOMScriptObjectFactory::nsDOMScriptObjectFactory() :
|
|||
|
||||
if (xs) {
|
||||
xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_DOM);
|
||||
xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_DOM_RANGE);
|
||||
xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_SVG);
|
||||
xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_DOM_XPATH);
|
||||
xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_DOM_INDEXEDDB);
|
||||
|
@ -287,8 +286,6 @@ nsDOMScriptObjectFactory::Observe(nsISupports *aSubject,
|
|||
if (xs) {
|
||||
xs->UnregisterExceptionProvider(gExceptionProvider,
|
||||
NS_ERROR_MODULE_DOM);
|
||||
xs->UnregisterExceptionProvider(gExceptionProvider,
|
||||
NS_ERROR_MODULE_DOM_RANGE);
|
||||
xs->UnregisterExceptionProvider(gExceptionProvider,
|
||||
NS_ERROR_MODULE_SVG);
|
||||
xs->UnregisterExceptionProvider(gExceptionProvider,
|
||||
|
@ -386,8 +383,6 @@ nsDOMExceptionProvider::GetException(nsresult result,
|
|||
|
||||
switch (NS_ERROR_GET_MODULE(result))
|
||||
{
|
||||
case NS_ERROR_MODULE_DOM_RANGE:
|
||||
return NS_NewRangeException(result, aDefaultException, _retval);
|
||||
case NS_ERROR_MODULE_SVG:
|
||||
return NS_NewSVGException(result, aDefaultException, _retval);
|
||||
case NS_ERROR_MODULE_DOM_XPATH:
|
||||
|
|
|
@ -269,7 +269,6 @@ using namespace mozilla::dom;
|
|||
using mozilla::TimeStamp;
|
||||
using mozilla::TimeDuration;
|
||||
|
||||
nsIDOMStorageList *nsGlobalWindow::sGlobalStorageList = nsnull;
|
||||
nsGlobalWindow::WindowByIdTable *nsGlobalWindow::sWindowsById = nsnull;
|
||||
bool nsGlobalWindow::sWarnedAboutWindowInternal = false;
|
||||
|
||||
|
@ -1087,8 +1086,6 @@ nsGlobalWindow::~nsGlobalWindow()
|
|||
void
|
||||
nsGlobalWindow::ShutDown()
|
||||
{
|
||||
NS_IF_RELEASE(sGlobalStorageList);
|
||||
|
||||
if (gDumpFile && gDumpFile != stdout) {
|
||||
fclose(gDumpFile);
|
||||
}
|
||||
|
@ -2984,14 +2981,47 @@ nsGlobalWindow::GetPerformance(nsIDOMPerformance** aPerformance)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetScriptableParent is called when script reads window.parent.
|
||||
*
|
||||
* In contrast to GetRealParent, GetScriptableParent respects <iframe
|
||||
* mozbrowser> boundaries, so if |this| is contained by an <iframe
|
||||
* mozbrowser>, we will return |this| as its own parent.
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetParent(nsIDOMWindow** aParent)
|
||||
nsGlobalWindow::GetScriptableParent(nsIDOMWindow** aParent)
|
||||
{
|
||||
FORWARD_TO_OUTER(GetParent, (aParent), NS_ERROR_NOT_INITIALIZED);
|
||||
FORWARD_TO_OUTER(GetScriptableParent, (aParent), NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
*aParent = NULL;
|
||||
if (!mDocShell) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool isMozBrowser = false;
|
||||
mDocShell->GetIsBrowserFrame(&isMozBrowser);
|
||||
if (isMozBrowser) {
|
||||
nsCOMPtr<nsIDOMWindow> parent = static_cast<nsIDOMWindow*>(this);
|
||||
parent.swap(*aParent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return GetRealParent(aParent);
|
||||
}
|
||||
|
||||
/**
|
||||
* nsIDOMWindow::GetParent (when called from C++) is just a wrapper around
|
||||
* GetRealParent.
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetRealParent(nsIDOMWindow** aParent)
|
||||
{
|
||||
FORWARD_TO_OUTER(GetRealParent, (aParent), NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
*aParent = nsnull;
|
||||
if (!mDocShell)
|
||||
if (!mDocShell) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mDocShell));
|
||||
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
|
||||
|
@ -3011,21 +3041,62 @@ nsGlobalWindow::GetParent(nsIDOMWindow** aParent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetScriptableTop is called when script reads window.top.
|
||||
*
|
||||
* In contrast to GetRealTop, GetScriptableTop respects <iframe mozbrowser>
|
||||
* boundaries. If we encounter a window owned by an <iframe mozbrowser> while
|
||||
* walking up the window hierarchy, we'll stop and return that window.
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetTop(nsIDOMWindow** aTop)
|
||||
nsGlobalWindow::GetScriptableTop(nsIDOMWindow **aTop)
|
||||
{
|
||||
FORWARD_TO_OUTER(GetTop, (aTop), NS_ERROR_NOT_INITIALIZED);
|
||||
return GetTopImpl(aTop, /* aScriptable = */ true);
|
||||
}
|
||||
|
||||
/**
|
||||
* nsIDOMWindow::GetTop (when called from C++) is just a wrapper around
|
||||
* GetRealTop.
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetRealTop(nsIDOMWindow** aTop)
|
||||
{
|
||||
return GetTopImpl(aTop, /* aScriptable = */ false);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGlobalWindow::GetTopImpl(nsIDOMWindow** aTop, bool aScriptable)
|
||||
{
|
||||
FORWARD_TO_OUTER(GetTopImpl, (aTop, aScriptable), NS_ERROR_NOT_INITIALIZED);
|
||||
*aTop = nsnull;
|
||||
if (mDocShell) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mDocShell));
|
||||
nsCOMPtr<nsIDocShellTreeItem> root;
|
||||
docShellAsItem->GetSameTypeRootTreeItem(getter_AddRefs(root));
|
||||
|
||||
if (root) {
|
||||
nsCOMPtr<nsIDOMWindow> top(do_GetInterface(root));
|
||||
top.swap(*aTop);
|
||||
// Walk up the parent chain.
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> prevParent = this;
|
||||
nsCOMPtr<nsIDOMWindow> parent = this;
|
||||
do {
|
||||
if (!parent) {
|
||||
break;
|
||||
}
|
||||
|
||||
prevParent = parent;
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> newParent;
|
||||
nsresult rv;
|
||||
if (aScriptable) {
|
||||
rv = parent->GetScriptableParent(getter_AddRefs(newParent));
|
||||
}
|
||||
else {
|
||||
rv = parent->GetParent(getter_AddRefs(newParent));
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
parent = newParent;
|
||||
|
||||
} while (parent != prevParent);
|
||||
|
||||
if (parent) {
|
||||
parent.swap(*aTop);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -6910,12 +6981,43 @@ nsGlobalWindow::CacheXBLPrototypeHandler(nsXBLPrototypeHandler* aKey,
|
|||
mCachedXBLPrototypeHandlers.Put(aKey, aHandler.get());
|
||||
}
|
||||
|
||||
/**
|
||||
* GetScriptableFrameElement is called when script reads
|
||||
* nsIGlobalWindow::frameElement.
|
||||
*
|
||||
* In contrast to GetRealFrameElement, GetScriptableFrameElement says that the
|
||||
* window contained by an <iframe mozbrowser> has no frame element
|
||||
* (effectively treating a mozbrowser the same as a content/chrome boundary).
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetFrameElement(nsIDOMElement** aFrameElement)
|
||||
nsGlobalWindow::GetScriptableFrameElement(nsIDOMElement** aFrameElement)
|
||||
{
|
||||
FORWARD_TO_OUTER(GetFrameElement, (aFrameElement), NS_ERROR_NOT_INITIALIZED);
|
||||
FORWARD_TO_OUTER(GetScriptableFrameElement, (aFrameElement), NS_ERROR_NOT_INITIALIZED);
|
||||
*aFrameElement = NULL;
|
||||
|
||||
*aFrameElement = nsnull;
|
||||
if (!mDocShell) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool isMozBrowser = false;
|
||||
mDocShell->GetIsBrowserFrame(&isMozBrowser);
|
||||
if (isMozBrowser) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return GetFrameElement(aFrameElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* nsIGlobalWindow::GetFrameElement (when called from C++) is just a wrapper
|
||||
* around GetRealFrameElement.
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetRealFrameElement(nsIDOMElement** aFrameElement)
|
||||
{
|
||||
FORWARD_TO_OUTER(GetRealFrameElement, (aFrameElement), NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
*aFrameElement = NULL;
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTI(do_QueryInterface(mDocShell));
|
||||
|
||||
|
@ -8195,32 +8297,6 @@ nsGlobalWindow::GetSessionStorage(nsIDOMStorage ** aSessionStorage)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetGlobalStorage(nsIDOMStorageList ** aGlobalStorage)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aGlobalStorage);
|
||||
|
||||
nsCOMPtr<nsIDocument> document = do_QueryInterface(GetExtantDocument());
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eGlobalStorage);
|
||||
}
|
||||
|
||||
if (!Preferences::GetBool(kStorageEnabled)) {
|
||||
*aGlobalStorage = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!sGlobalStorageList) {
|
||||
nsresult rv = NS_NewDOMStorageList(&sGlobalStorageList);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
*aGlobalStorage = sGlobalStorageList;
|
||||
NS_IF_ADDREF(*aGlobalStorage);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetLocalStorage(nsIDOMStorage ** aLocalStorage)
|
||||
{
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче