merge m-c to devtools

This commit is contained in:
Rob Campbell 2011-04-25 15:13:53 -03:00
commit 592b70f604
14 changed files with 116 additions and 119 deletions

0
build/os2/test_os2.cmd Normal file → Executable file
View File

View File

@ -615,19 +615,9 @@ nsContentList::GetNodeAt(PRUint32 aIndex)
return Item(aIndex, PR_TRUE);
}
nsIContent*
nsContentList::GetNodeAt(PRUint32 aIndex, nsresult* aResult)
{
*aResult = NS_OK;
return Item(aIndex, PR_TRUE);
}
nsISupports*
nsContentList::GetNamedItem(const nsAString& aName, nsWrapperCache **aCache,
nsresult* aResult)
nsContentList::GetNamedItem(const nsAString& aName, nsWrapperCache **aCache)
{
*aResult = NS_OK;
nsIContent *item;
*aCache = item = NamedItem(aName, PR_TRUE);
return item;

View File

@ -260,10 +260,9 @@ public:
virtual PRInt32 IndexOf(nsIContent* aContent);
// nsIHTMLCollection
virtual nsIContent* GetNodeAt(PRUint32 aIndex, nsresult* aResult);
// GetNodeAt already declared as part of nsINodeList
virtual nsISupports* GetNamedItem(const nsAString& aName,
nsWrapperCache** aCache,
nsresult* aResult);
nsWrapperCache** aCache);
// nsContentList public methods
NS_HIDDEN_(nsINode*) GetParentObject() { return mRootNode; }

View File

@ -45,8 +45,8 @@ class nsWrapperCache;
// IID for the nsIHTMLCollection interface
#define NS_IHTMLCOLLECTION_IID \
{ 0xf38b43dc, 0x74d4, 0x4b11, \
{ 0xa6, 0xc9, 0xf8, 0xf4, 0xb5, 0xd3, 0x84, 0xe3 } }
{ 0x84a68396, 0x518d, 0x4fa8, \
{ 0x8f, 0x7f, 0xa0, 0x60, 0x55, 0xff, 0xef, 0xba } }
/**
* An internal interface that allows QI-less getting of nodes from HTML
@ -60,14 +60,13 @@ public:
/**
* Get the node at the index. Returns null if the index is out of bounds.
*/
virtual nsIContent* GetNodeAt(PRUint32 aIndex, nsresult* aResult) = 0;
virtual nsIContent* GetNodeAt(PRUint32 aIndex) = 0;
/**
* Get the node for the name. Returns null if no node exists for the name.
*/
virtual nsISupports* GetNamedItem(const nsAString& aName,
nsWrapperCache** aCache,
nsresult* aResult) = 0;
nsWrapperCache** aCache) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIHTMLCollection, NS_IHTMLCOLLECTION_IID)

View File

@ -121,20 +121,15 @@ public:
// nsIDOMHTMLCollection interface
NS_DECL_NSIDOMHTMLCOLLECTION
virtual nsIContent* GetNodeAt(PRUint32 aIndex, nsresult* aResult)
virtual nsIContent* GetNodeAt(PRUint32 aIndex)
{
FlushPendingNotifications();
*aResult = NS_OK;
return mElements.SafeElementAt(aIndex, nsnull);
}
virtual nsISupports* GetNamedItem(const nsAString& aName,
nsWrapperCache **aCache,
nsresult* aResult)
nsWrapperCache **aCache)
{
*aResult = NS_OK;
nsISupports *item = NamedItemInternal(aName, PR_TRUE);
*aCache = nsnull;
return item;
@ -2306,7 +2301,7 @@ NS_IMETHODIMP
nsFormControlList::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
{
nsresult rv;
nsISupports* item = GetNodeAt(aIndex, &rv);
nsISupports* item = GetNodeAt(aIndex);
if (!item) {
*aReturn = nsnull;

View File

@ -2169,22 +2169,19 @@ nsHTMLOptionCollection::SetSelectedIndex(PRInt32 aSelectedIndex)
NS_IMETHODIMP
nsHTMLOptionCollection::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
{
nsresult rv;
nsISupports* item = GetNodeAt(aIndex, &rv);
nsISupports* item = GetNodeAt(aIndex);
if (!item) {
*aReturn = nsnull;
return rv;
return NS_OK;
}
return CallQueryInterface(item, aReturn);
}
nsIContent*
nsHTMLOptionCollection::GetNodeAt(PRUint32 aIndex, nsresult* aResult)
nsHTMLOptionCollection::GetNodeAt(PRUint32 aIndex)
{
*aResult = NS_OK;
return static_cast<nsIContent*>(ItemAsOption(aIndex));
}
@ -2209,11 +2206,8 @@ GetNamedItemHelper(nsTArray<nsRefPtr<nsHTMLOptionElement> > &aElements,
nsISupports*
nsHTMLOptionCollection::GetNamedItem(const nsAString& aName,
nsWrapperCache **aCache,
nsresult* aResult)
nsWrapperCache **aCache)
{
*aResult = NS_OK;
nsINode *item = GetNamedItemHelper(mElements, aName);
*aCache = item;
return item;

View File

@ -87,10 +87,9 @@ public:
// nsIDOMHTMLCollection interface, all its methods are defined in
// nsIDOMHTMLOptionsCollection
virtual nsIContent* GetNodeAt(PRUint32 aIndex, nsresult* aResult);
virtual nsIContent* GetNodeAt(PRUint32 aIndex);
virtual nsISupports* GetNamedItem(const nsAString& aName,
nsWrapperCache** aCache,
nsresult* aResult);
nsWrapperCache** aCache);
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsHTMLOptionCollection,
nsIHTMLCollection)

View File

@ -95,6 +95,13 @@ public:
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsHTMLTableElement,
nsGenericHTMLElement)
already_AddRefed<nsIDOMHTMLTableSectionElement> GetTHead() {
return GetSection(nsGkAtoms::thead);
}
already_AddRefed<nsIDOMHTMLTableSectionElement> GetTFoot() {
return GetSection(nsGkAtoms::tfoot);
}
nsContentList* TBodies();
protected:
already_AddRefed<nsIDOMHTMLTableSectionElement> GetSection(nsIAtom *aTag);
@ -119,10 +126,9 @@ public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_NSIDOMHTMLCOLLECTION
virtual nsIContent* GetNodeAt(PRUint32 aIndex, nsresult* aResult);
virtual nsIContent* GetNodeAt(PRUint32 aIndex);
virtual nsISupports* GetNamedItem(const nsAString& aName,
nsWrapperCache **aCache,
nsresult* aResult);
nsWrapperCache **aCache);
NS_IMETHOD ParentDestroyed();
@ -186,10 +192,7 @@ TableRowsCollection::Init()
if (mParent) { \
/* THead */ \
nsCOMPtr<nsIDOMHTMLTableSectionElement> rowGroup; \
rv = mParent->GetTHead(getter_AddRefs(rowGroup)); \
if (NS_FAILED(rv)) { \
break; \
} \
rowGroup = mParent->GetTHead(); \
nsCOMPtr<nsIDOMHTMLCollection> rows; \
if (rowGroup) { \
rowGroup->GetRows(getter_AddRefs(rows)); \
@ -197,35 +200,20 @@ TableRowsCollection::Init()
_code \
} while (0); \
} \
nsCOMPtr<nsIDOMHTMLCollection> _tbodies; \
/* TBodies */ \
rv = mParent->GetTBodies(getter_AddRefs(_tbodies)); \
if (NS_FAILED(rv)) { \
break; \
} \
if (_tbodies) { \
nsCOMPtr<nsIDOMNode> _node; \
PRUint32 _tbodyIndex = 0; \
rv = _tbodies->Item(_tbodyIndex, getter_AddRefs(_node)); \
if (NS_FAILED(rv)) { \
break; \
} \
while (_node) { \
rowGroup = do_QueryInterface(_node); \
if (rowGroup) { \
rowGroup->GetRows(getter_AddRefs(rows)); \
do { /* gives scoping */ \
_code \
} while (0); \
} \
rv = _tbodies->Item(++_tbodyIndex, getter_AddRefs(_node)); \
if (NS_FAILED(rv)) { \
break; \
} \
} \
if (NS_FAILED(rv)) { \
break; \
nsContentList *_tbodies = mParent->TBodies(); \
nsINode * _node; \
PRUint32 _tbodyIndex = 0; \
_node = _tbodies->GetNodeAt(_tbodyIndex); \
while (_node) { \
rowGroup = do_QueryInterface(_node); \
if (rowGroup) { \
rowGroup->GetRows(getter_AddRefs(rows)); \
do { /* gives scoping */ \
_code \
} while (0); \
} \
_node = _tbodies->GetNodeAt(++_tbodyIndex); \
} \
/* orphan rows */ \
rows = mOrphanRows; \
@ -233,10 +221,7 @@ TableRowsCollection::Init()
_code \
} while (0); \
/* TFoot */ \
rv = mParent->GetTFoot(getter_AddRefs(rowGroup)); \
if (NS_FAILED(rv)) { \
break; \
} \
rowGroup = mParent->GetTFoot(); \
rows = nsnull; \
if (rowGroup) { \
rowGroup->GetRows(getter_AddRefs(rows)); \
@ -266,13 +251,12 @@ NS_IMETHODIMP
TableRowsCollection::GetLength(PRUint32* aLength)
{
*aLength=0;
nsresult rv = NS_OK;
DO_FOR_EACH_ROWGROUP(
*aLength += CountRowsInRowGroup(rows);
);
return rv;
return NS_OK;
}
// Returns the item at index aIndex if available. If null is returned,
@ -296,9 +280,8 @@ GetItemOrCountInRowGroup(nsIDOMHTMLCollection* rows,
}
nsIContent*
TableRowsCollection::GetNodeAt(PRUint32 aIndex, nsresult *aResult)
TableRowsCollection::GetNodeAt(PRUint32 aIndex)
{
nsresult rv = NS_OK;
DO_FOR_EACH_ROWGROUP(
PRUint32 count;
nsIContent* node = GetItemOrCountInRowGroup(rows, aIndex, &count);
@ -310,21 +293,17 @@ TableRowsCollection::GetNodeAt(PRUint32 aIndex, nsresult *aResult)
aIndex -= count;
);
*aResult = rv;
return nsnull;
}
NS_IMETHODIMP
TableRowsCollection::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
{
nsresult rv;
nsISupports* node = GetNodeAt(aIndex, &rv);
nsISupports* node = GetNodeAt(aIndex);
if (!node) {
*aReturn = nsnull;
return rv;
return NS_OK;
}
return CallQueryInterface(node, aReturn);
@ -332,31 +311,27 @@ TableRowsCollection::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
static nsISupports*
GetNamedItemInRowGroup(nsIDOMHTMLCollection* aRows, const nsAString& aName,
nsWrapperCache** aCache, nsresult* aResult)
nsWrapperCache** aCache)
{
nsCOMPtr<nsIHTMLCollection> rows = do_QueryInterface(aRows);
if (rows) {
return rows->GetNamedItem(aName, aCache, aResult);
return rows->GetNamedItem(aName, aCache);
}
*aResult = NS_OK;
return nsnull;
}
nsISupports*
TableRowsCollection::GetNamedItem(const nsAString& aName,
nsWrapperCache** aCache,
nsresult* aResult)
nsWrapperCache** aCache)
{
nsresult rv = NS_OK;
DO_FOR_EACH_ROWGROUP(
nsISupports* item = GetNamedItemInRowGroup(rows, aName, aCache, aResult);
if (NS_FAILED(*aResult) || item) {
nsISupports* item = GetNamedItemInRowGroup(rows, aName, aCache);
if (item) {
return item;
}
);
*aCache = nsnull;
*aResult = rv;
return nsnull;
}
@ -364,13 +339,12 @@ NS_IMETHODIMP
TableRowsCollection::NamedItem(const nsAString& aName,
nsIDOMNode** aReturn)
{
nsresult rv;
nsWrapperCache *cache;
nsISupports* item = GetNamedItem(aName, &cache, &rv);
nsISupports* item = GetNamedItem(aName, &cache);
if (!item) {
*aReturn = nsnull;
return rv;
return NS_OK;
}
return CallQueryInterface(item, aReturn);
@ -510,7 +484,7 @@ nsHTMLTableElement::GetSection(nsIAtom *aTag)
NS_IMETHODIMP
nsHTMLTableElement::GetTHead(nsIDOMHTMLTableSectionElement** aValue)
{
*aValue = GetSection(nsGkAtoms::thead).get();
*aValue = GetTHead().get();
return NS_OK;
}
@ -547,7 +521,7 @@ nsHTMLTableElement::SetTHead(nsIDOMHTMLTableSectionElement* aValue)
NS_IMETHODIMP
nsHTMLTableElement::GetTFoot(nsIDOMHTMLTableSectionElement** aValue)
{
*aValue = GetSection(nsGkAtoms::tfoot).get();
*aValue = GetTFoot().get();
return NS_OK;
}
@ -596,6 +570,13 @@ nsHTMLTableElement::GetRows(nsIDOMHTMLCollection** aValue)
NS_IMETHODIMP
nsHTMLTableElement::GetTBodies(nsIDOMHTMLCollection** aValue)
{
NS_ADDREF(*aValue = TBodies());
return NS_OK;
}
nsContentList*
nsHTMLTableElement::TBodies()
{
if (!mTBodies) {
// Not using NS_GetContentList because this should not be cached
@ -606,8 +587,7 @@ nsHTMLTableElement::GetTBodies(nsIDOMHTMLCollection** aValue)
PR_FALSE);
}
NS_ADDREF(*aValue = mTBodies);
return NS_OK;
return mTBodies;
}
NS_IMETHODIMP

View File

@ -60,6 +60,7 @@ _TEST_FILES = \
test_animLengthRelativeUnits.xhtml \
test_animLengthUnits.xhtml \
test_bbox.xhtml \
test_bbox-with-invalid-viewBox.xhtml \
bbox-helper.svg \
bounds-helper.svg \
test_dataTypes.html \

View File

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=433063
-->
<head>
<title>Test for getBBox when the viewBox is invalid</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none"></div>
<svg id="svg" xmlns="http://www.w3.org/2000/svg"
style="width:200px; height:200px;" viewBox="0 0 200 0">
<rect width="120" height="120"/>
</svg>
<pre id="test">
<script class="testbody" type="application/javascript">
SimpleTest.waitForExplicitFinish();
function run()
{
var bbox = $("svg").getBBox();
is(bbox.x, 0, "Check bbox.x");
is(bbox.y, 0, "Check bbox.y");
is(bbox.width, 120, "Check bbox.width");
is(bbox.height, 120, "Check bbox.height");
SimpleTest.finish();
}
window.addEventListener("load", run, false);
</script>
</pre>
</body>
</html>

View File

@ -8351,7 +8351,7 @@ nsHTMLCollectionSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
#endif
nsINode *item;
*aCache = item = collection->GetNodeAt(aIndex, aResult);
*aCache = item = collection->GetNodeAt(aIndex);
return item;
}
@ -8373,7 +8373,7 @@ nsHTMLCollectionSH::GetNamedItem(nsISupports *aNative,
}
#endif
return collection->GetNamedItem(aName, aCache, aResult);
return collection->GetNamedItem(aName, aCache);
}
@ -8413,7 +8413,7 @@ nsContentListSH::GetItemAt(nsISupports *aNative, PRUint32 aIndex,
nsContentList *list = nsContentList::FromSupports(aNative);
nsIContent *item;
*aCache = item = list->GetNodeAt(aIndex, aResult);
*aCache = item = list->GetNodeAt(aIndex);
return item;
}
@ -8423,7 +8423,7 @@ nsContentListSH::GetNamedItem(nsISupports *aNative, const nsAString& aName,
{
nsContentList *list = nsContentList::FromSupports(aNative);
return list->GetNamedItem(aName, aCache, aResult);
return list->GetNamedItem(aName, aCache);
}
NS_IMETHODIMP
@ -9491,8 +9491,7 @@ nsHTMLSelectElementSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext
nsHTMLOptionCollection *options = s->GetOptions();
if (options) {
nsresult rv;
nsISupports *node = options->GetNodeAt(n, &rv);
nsISupports *node = options->GetNodeAt(n);
if (node) {
*objp = obj;
*_retval = JS_DefineElement(cx, obj, n, JSVAL_VOID, nsnull, nsnull,
@ -9521,7 +9520,7 @@ nsHTMLSelectElementSH::GetProperty(nsIXPConnectWrappedNative *wrapper,
nsHTMLOptionCollection *options = s->GetOptions();
if (options) {
nsISupports *node = options->GetNodeAt(n, &rv);
nsISupports *node = options->GetNodeAt(n);
rv = WrapNative(cx, JS_GetGlobalForScopeChain(cx), node,
&NS_GET_IID(nsIDOMNode), PR_TRUE, vp);

View File

@ -8808,14 +8808,14 @@ nsGlobalWindow::SetTimeoutOrInterval(nsIScriptTimeoutHandler *aHandler,
interval = NS_MAX(aIsInterval ? 1 : 0, interval);
// Make sure we don't proceed with an interval larger than our timer
// code can handle.
if (interval > PR_IntervalToMilliseconds(DOM_MAX_TIMEOUT_VALUE)) {
interval = PR_IntervalToMilliseconds(DOM_MAX_TIMEOUT_VALUE);
// code can handle. (Note: we already forced |interval| to be non-negative,
// so the PRUint32 cast (to avoid compiler warnings) is ok.)
PRUint32 maxTimeoutMs = PR_IntervalToMilliseconds(DOM_MAX_TIMEOUT_VALUE);
if (static_cast<PRUint32>(interval) > maxTimeoutMs) {
interval = maxTimeoutMs;
}
nsTimeout *timeout = new nsTimeout();
if (!timeout)
return NS_ERROR_OUT_OF_MEMORY;
// Increment the timeout's reference count to represent this function's hold
// on the timeout.

View File

@ -265,7 +265,7 @@ abstract public class GeckoApp
}
boolean IsUnsupportedDevice() {
// We don't currently support devices with less than 256Mb of RAM, warn on first run
// We don't currently support devices with less than 512Mb of RAM, warn on first run
File meminfo = new File("/proc/meminfo");
try {
BufferedReader br = new BufferedReader(new FileReader(meminfo));
@ -277,7 +277,7 @@ abstract public class GeckoApp
totalMem = st.nextToken();
Log.i("GeckoMemory", "MemTotal: " + Integer.parseInt(totalMem));
return Integer.parseInt(totalMem) <= 262144L;
return Integer.parseInt(totalMem) <= 524288L;
} catch (Exception ex) {
// Will catch NullPointerException if totalMem isn't found,
// a NumberFormatException if the token isn't parsible

View File

@ -224,6 +224,7 @@ using mozilla::DefaultXDisplay;
#define INCL_PM
#define INCL_GPI
#include <os2.h>
#include "gfxOS2Surface.h"
#endif
#ifdef CreateEvent // Thank you MS.
@ -1663,7 +1664,7 @@ nsObjectFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
#ifdef XP_OS2
static void *
GetPSFromRC(nsRenderingContext& aRC)
GetPSFromRC(nsRenderingContext& aRenderingContext)
{
nsRefPtr<gfxASurface>
surf = aRenderingContext.ThebesContext()->CurrentSurface();