зеркало из https://github.com/mozilla/pjs.git
Bug 417912 ��� GetCellDataAt callers that expect an error if no cell is found are wrong, r=evan.yan, bernd, a=beltzner
This commit is contained in:
Родитель
a67624a624
Коммит
8acd3d683c
|
@ -58,6 +58,7 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsITableLayout.h"
|
||||
#include "nsITableCellLayout.h"
|
||||
#include "nsLayoutErrors.h"
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableCellAccessible, nsHyperTextAccessible)
|
||||
|
@ -662,11 +663,15 @@ nsHTMLTableAccessible::IsRowSelected(PRInt32 aRow, PRBool *_retval)
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn,
|
||||
PRBool *_retval)
|
||||
PRBool *aIsSelected)
|
||||
{
|
||||
NS_ENSURE_TRUE(IsValidRow(aRow) && IsValidColumn(aColumn), NS_ERROR_INVALID_ARG);
|
||||
NS_ENSURE_ARG_POINTER(aIsSelected);
|
||||
*aIsSelected = PR_FALSE;
|
||||
|
||||
nsITableLayout *tableLayout;
|
||||
NS_ENSURE_TRUE(IsValidRow(aRow) && IsValidColumn(aColumn),
|
||||
NS_ERROR_INVALID_ARG);
|
||||
|
||||
nsITableLayout *tableLayout = nsnull;
|
||||
nsresult rv = GetTableLayout(&tableLayout);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
@ -674,11 +679,14 @@ nsHTMLTableAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn,
|
|||
PRInt32 startRowIndex = 0, startColIndex = 0,
|
||||
rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
|
||||
return tableLayout->GetCellDataAt(aRow, aColumn,
|
||||
*getter_AddRefs(domElement),
|
||||
startRowIndex, startColIndex, rowSpan,
|
||||
colSpan, actualRowSpan, actualColSpan,
|
||||
*_retval);
|
||||
rv = tableLayout->GetCellDataAt(aRow, aColumn, *getter_AddRefs(domElement),
|
||||
startRowIndex, startColIndex,
|
||||
rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, *aIsSelected);
|
||||
|
||||
if (rv == NS_TABLELAYOUT_CELL_NOT_FOUND)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRBool
|
||||
|
@ -867,15 +875,18 @@ nsHTMLTableAccessible::GetCellAt(PRInt32 aRowIndex,
|
|||
rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
PRBool isSelected;
|
||||
|
||||
nsITableLayout *tableLayout;
|
||||
nsITableLayout *tableLayout = nsnull;
|
||||
nsresult rv = GetTableLayout(&tableLayout);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return tableLayout->GetCellDataAt(aRowIndex, aColIndex, aCell,
|
||||
startRowIndex, startColIndex,
|
||||
rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan,
|
||||
isSelected);
|
||||
rv = tableLayout->GetCellDataAt(aRowIndex, aColIndex, aCell,
|
||||
startRowIndex, startColIndex,
|
||||
rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
|
||||
if (rv == NS_TABLELAYOUT_CELL_NOT_FOUND)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTableAccessible::GetDescription(nsAString& aDescription)
|
||||
|
@ -1030,7 +1041,9 @@ NS_IMETHODIMP nsHTMLTableAccessible::IsProbablyForLayout(PRBool *aIsProbablyForL
|
|||
// Check to see if there are visible borders on the cells
|
||||
// XXX currently, we just check the first cell -- do we really need to do more?
|
||||
nsCOMPtr<nsIDOMElement> cellElement;
|
||||
GetCellAt(0, 0, *getter_AddRefs(cellElement));
|
||||
nsresult rv = GetCellAt(0, 0, *getter_AddRefs(cellElement));
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIContent> cellContent(do_QueryInterface(cellElement));
|
||||
NS_ENSURE_TRUE(cellContent, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIPresShell> shell(GetPresShell());
|
||||
|
|
|
@ -12,10 +12,11 @@ function doTest()
|
|||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var table = document.getElementById("table");
|
||||
var accService = Components.classes["@mozilla.org/accessibleRetrieval;1"].
|
||||
getService(Components.interfaces.nsIAccessibleRetrieval);
|
||||
|
||||
// bug 410052
|
||||
var table = document.getElementById("table");
|
||||
var accTable = accService.getAccessibleFor(table).
|
||||
QueryInterface(Components.interfaces.nsIAccessibleTable);
|
||||
|
||||
|
@ -29,15 +30,45 @@ function doTest()
|
|||
is(accTable.getRowExtentAt(2,7), 4,"rowspan wrong");
|
||||
is(accTable.getColumnExtentAt(2,3), 1, "colspan wrong");
|
||||
is(accTable.cellRefAt(2,1).firstChild.name, "c1", "wrong cell");
|
||||
|
||||
// bug 417912
|
||||
var table2 = document.getElementById("table2");
|
||||
var accTable2 = accService.getAccessibleFor(table2).
|
||||
QueryInterface(Components.interfaces.nsIAccessibleTable);
|
||||
testCellAt(accTable2, 0, 0, true);
|
||||
testCellAt(accTable2, 0, 1, true);
|
||||
testCellAt(accTable2, 0, 2, true);
|
||||
testCellAt(accTable2, 1, 0, true);
|
||||
testCellAt(accTable2, 1, 1, false);
|
||||
testCellAt(accTable2, 1, 2, true);
|
||||
testCellAt(accTable2, 2, 0, true);
|
||||
testCellAt(accTable2, 2, 1, true);
|
||||
testCellAt(accTable2, 2, 2, true);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function testCellAt(aTable, aRow, aColumn, aSucceeded)
|
||||
{
|
||||
try {
|
||||
aTable.cellRefAt(aRow, aColumn);
|
||||
ok(aSucceeded, "cell is available at (" + aRow + ", " + aColumn + ").");
|
||||
} catch (e) {
|
||||
ok(!aSucceeded, "cell is not available at (" + aRow + ", " + aColumn + ").");
|
||||
}
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=410052">Mozilla Bug 410052</a>
|
||||
<br>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=417912"
|
||||
title="GetCellDataAt callers that expect an error if no cell is found are wrong">
|
||||
Mozilla Bug 417912
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
|
@ -83,5 +114,14 @@ addLoadEvent(doTest);
|
|||
</tbody>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<br><br><b>Testing Table 2:</b><br><br>
|
||||
<center>
|
||||
<table cellpadding="2" cellspacing="2" border="1" width="50%" id="table2">
|
||||
<tr><td>1</td><td>2</td><td rowspan=3>3</td>
|
||||
<tr><td>4</td>
|
||||
<tr><td>5</td><td>6</td>
|
||||
</table>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Загрузка…
Ссылка в новой задаче