mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 781409 - remove nsITableLayout r=roc,davidb
This commit is contained in:
parent
28adec29b2
commit
55821aa041
@ -30,12 +30,13 @@
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsITableLayout.h"
|
||||
#include "nsITableCellLayout.h"
|
||||
#include "nsFrameSelection.h"
|
||||
#include "nsError.h"
|
||||
#include "nsArrayUtils.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsTableCellFrame.h"
|
||||
#include "nsTableOuterFrame.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
@ -471,52 +472,35 @@ HTMLTableAccessible::Summary(nsString& aSummary)
|
||||
uint32_t
|
||||
HTMLTableAccessible::ColCount()
|
||||
{
|
||||
nsITableLayout* tableLayout = GetTableLayout();
|
||||
if (!tableLayout)
|
||||
return 0;
|
||||
|
||||
int32_t rowCount = 0, colCount = 0;
|
||||
tableLayout->GetTableSize(rowCount, colCount);
|
||||
return colCount;
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||
return tableFrame ? tableFrame->GetColCount() : 0;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
HTMLTableAccessible::RowCount()
|
||||
{
|
||||
nsITableLayout* tableLayout = GetTableLayout();
|
||||
if (!tableLayout)
|
||||
return 0;
|
||||
|
||||
int32_t rowCount = 0, colCount = 0;
|
||||
tableLayout->GetTableSize(rowCount, colCount);
|
||||
return rowCount;
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||
return tableFrame ? tableFrame->GetRowCount() : 0;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
HTMLTableAccessible::SelectedCellCount()
|
||||
{
|
||||
nsITableLayout *tableLayout = GetTableLayout();
|
||||
if (!tableLayout)
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||
if (!tableFrame)
|
||||
return 0;
|
||||
|
||||
uint32_t count = 0, rowCount = RowCount(), colCount = ColCount();
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement;
|
||||
int32_t startRowIndex = 0, startColIndex = 0,
|
||||
rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
bool isSelected = false;
|
||||
|
||||
for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++) {
|
||||
for (uint32_t colIdx = 0; colIdx < colCount; colIdx++) {
|
||||
nsresult rv = tableLayout->GetCellDataAt(rowIdx, colIdx,
|
||||
*getter_AddRefs(domElement),
|
||||
startRowIndex, startColIndex,
|
||||
rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan,
|
||||
isSelected);
|
||||
nsTableCellFrame* cellFrame = tableFrame->GetCellFrameAt(rowIdx, colIdx);
|
||||
if (!cellFrame || !cellFrame->IsSelected())
|
||||
continue;
|
||||
|
||||
if (NS_SUCCEEDED(rv) && startRowIndex == rowIdx &&
|
||||
startColIndex == colIdx && isSelected)
|
||||
int32_t startRow = -1, startCol = -1;
|
||||
cellFrame->GetRowIndex(startRow);
|
||||
cellFrame->GetColIndex(startCol);
|
||||
if (startRow == rowIdx && startCol == colIdx)
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@ -551,32 +535,25 @@ HTMLTableAccessible::SelectedRowCount()
|
||||
void
|
||||
HTMLTableAccessible::SelectedCells(nsTArray<Accessible*>* aCells)
|
||||
{
|
||||
uint32_t rowCount = RowCount(), colCount = ColCount();
|
||||
|
||||
nsITableLayout *tableLayout = GetTableLayout();
|
||||
if (!tableLayout)
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||
if (!tableFrame)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> cellElement;
|
||||
int32_t startRowIndex = 0, startColIndex = 0,
|
||||
rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
bool isSelected = false;
|
||||
|
||||
uint32_t rowCount = RowCount(), colCount = ColCount();
|
||||
for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++) {
|
||||
for (uint32_t colIdx = 0; colIdx < colCount; colIdx++) {
|
||||
nsresult rv = tableLayout->GetCellDataAt(rowIdx, colIdx,
|
||||
*getter_AddRefs(cellElement),
|
||||
startRowIndex, startColIndex,
|
||||
rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan,
|
||||
isSelected);
|
||||
nsTableCellFrame* cellFrame = tableFrame->GetCellFrameAt(rowIdx, colIdx);
|
||||
if (!cellFrame || !cellFrame->IsSelected())
|
||||
continue;
|
||||
|
||||
if (NS_SUCCEEDED(rv) && startRowIndex == rowIdx &&
|
||||
startColIndex == colIdx && isSelected) {
|
||||
nsCOMPtr<nsIContent> cellContent(do_QueryInterface(cellElement));
|
||||
Accessible* cell = mDoc->GetAccessible(cellContent);
|
||||
int32_t startCol = -1, startRow = -1;
|
||||
cellFrame->GetRowIndex(startRow);
|
||||
cellFrame->GetColIndex(startCol);
|
||||
if (startRow != rowIdx || startCol != colIdx)
|
||||
continue;
|
||||
|
||||
Accessible* cell = mDoc->GetAccessible(cellFrame->GetContent());
|
||||
aCells->AppendElement(cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -584,28 +561,21 @@ HTMLTableAccessible::SelectedCells(nsTArray<Accessible*>* aCells)
|
||||
void
|
||||
HTMLTableAccessible::SelectedCellIndices(nsTArray<uint32_t>* aCells)
|
||||
{
|
||||
nsITableLayout *tableLayout = GetTableLayout();
|
||||
if (!tableLayout)
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||
if (!tableFrame)
|
||||
return;
|
||||
|
||||
uint32_t rowCount = RowCount(), colCount = ColCount();
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement;
|
||||
int32_t startRowIndex = 0, startColIndex = 0,
|
||||
rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
bool isSelected = false;
|
||||
|
||||
for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++) {
|
||||
for (uint32_t colIdx = 0; colIdx < colCount; colIdx++) {
|
||||
nsresult rv = tableLayout->GetCellDataAt(rowIdx, colIdx,
|
||||
*getter_AddRefs(domElement),
|
||||
startRowIndex, startColIndex,
|
||||
rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan,
|
||||
isSelected);
|
||||
nsTableCellFrame* cellFrame = tableFrame->GetCellFrameAt(rowIdx, colIdx);
|
||||
if (!cellFrame || !cellFrame->IsSelected())
|
||||
continue;
|
||||
|
||||
if (NS_SUCCEEDED(rv) && startRowIndex == rowIdx &&
|
||||
startColIndex == colIdx && isSelected)
|
||||
int32_t startRow = -1, startCol = -1;
|
||||
cellFrame->GetColIndex(startCol);
|
||||
cellFrame->GetRowIndex(startRow);
|
||||
if (startRow == rowIdx && startCol == colIdx)
|
||||
aCells->AppendElement(CellIndexAt(rowIdx, colIdx));
|
||||
}
|
||||
}
|
||||
@ -630,17 +600,13 @@ HTMLTableAccessible::SelectedRowIndices(nsTArray<uint32_t>* aRows)
|
||||
}
|
||||
|
||||
Accessible*
|
||||
HTMLTableAccessible::CellAt(uint32_t aRowIndex, uint32_t aColumnIndex)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> cellElement;
|
||||
GetCellAt(aRowIndex, aColumnIndex, *getter_AddRefs(cellElement));
|
||||
if (!cellElement)
|
||||
return nullptr;
|
||||
|
||||
nsCOMPtr<nsIContent> cellContent(do_QueryInterface(cellElement));
|
||||
if (!cellContent)
|
||||
HTMLTableAccessible::CellAt(uint32_t aRowIdx, uint32_t aColIdx)
|
||||
{
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||
if (!tableFrame)
|
||||
return nullptr;
|
||||
|
||||
nsIContent* cellContent = tableFrame->GetCellAt(aRowIdx, aColIdx);
|
||||
Accessible* cell = mDoc->GetAccessible(cellContent);
|
||||
|
||||
// XXX bug 576838: crazy tables (like table6 in tables/test_table2.html) may
|
||||
@ -651,34 +617,34 @@ HTMLTableAccessible::CellAt(uint32_t aRowIndex, uint32_t aColumnIndex)
|
||||
int32_t
|
||||
HTMLTableAccessible::CellIndexAt(uint32_t aRowIdx, uint32_t aColIdx)
|
||||
{
|
||||
nsITableLayout* tableLayout = GetTableLayout();
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||
if (!tableFrame)
|
||||
return -1;
|
||||
|
||||
int32_t index = -1;
|
||||
tableLayout->GetIndexByRowAndColumn(aRowIdx, aColIdx, &index);
|
||||
return index;
|
||||
return tableFrame->GetIndexByRowAndColumn(aRowIdx, aColIdx);
|
||||
}
|
||||
|
||||
int32_t
|
||||
HTMLTableAccessible::ColIndexAt(uint32_t aCellIdx)
|
||||
{
|
||||
nsITableLayout* tableLayout = GetTableLayout();
|
||||
if (!tableLayout)
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||
if (!tableFrame)
|
||||
return -1;
|
||||
|
||||
int32_t rowIdx = -1, colIdx = -1;
|
||||
tableLayout->GetRowAndColumnByIndex(aCellIdx, &rowIdx, &colIdx);
|
||||
tableFrame->GetRowAndColumnByIndex(aCellIdx, &rowIdx, &colIdx);
|
||||
return colIdx;
|
||||
}
|
||||
|
||||
int32_t
|
||||
HTMLTableAccessible::RowIndexAt(uint32_t aCellIdx)
|
||||
{
|
||||
nsITableLayout* tableLayout = GetTableLayout();
|
||||
if (!tableLayout)
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||
if (!tableFrame)
|
||||
return -1;
|
||||
|
||||
int32_t rowIdx = -1, colIdx = -1;
|
||||
tableLayout->GetRowAndColumnByIndex(aCellIdx, &rowIdx, &colIdx);
|
||||
tableFrame->GetRowAndColumnByIndex(aCellIdx, &rowIdx, &colIdx);
|
||||
return rowIdx;
|
||||
}
|
||||
|
||||
@ -686,52 +652,29 @@ void
|
||||
HTMLTableAccessible::RowAndColIndicesAt(uint32_t aCellIdx, int32_t* aRowIdx,
|
||||
int32_t* aColIdx)
|
||||
{
|
||||
nsITableLayout* tableLayout = GetTableLayout();
|
||||
|
||||
if (tableLayout)
|
||||
tableLayout->GetRowAndColumnByIndex(aCellIdx, aRowIdx, aColIdx);
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||
if (tableFrame)
|
||||
tableFrame->GetRowAndColumnByIndex(aCellIdx, aRowIdx, aColIdx);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
HTMLTableAccessible::ColExtentAt(uint32_t aRowIdx, uint32_t aColIdx)
|
||||
{
|
||||
nsITableLayout* tableLayout = GetTableLayout();
|
||||
if (!tableLayout)
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||
if (!tableFrame)
|
||||
return 0;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement;
|
||||
int32_t startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan;
|
||||
bool isSelected;
|
||||
int32_t columnExtent = 0;
|
||||
|
||||
DebugOnly<nsresult> rv = tableLayout->
|
||||
GetCellDataAt(aRowIdx, aColIdx, *getter_AddRefs(domElement),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, columnExtent, isSelected);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Could not get cell data");
|
||||
|
||||
return columnExtent;
|
||||
return tableFrame->GetEffectiveColSpanAt(aRowIdx, aColIdx);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
HTMLTableAccessible::RowExtentAt(uint32_t aRowIdx, uint32_t aColIdx)
|
||||
{
|
||||
nsITableLayout* tableLayout = GetTableLayout();
|
||||
if (!tableLayout)
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||
if (!tableFrame)
|
||||
return 0;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement;
|
||||
int32_t startRowIndex, startColIndex, rowSpan, colSpan, actualColSpan;
|
||||
bool isSelected;
|
||||
int32_t rowExtent = 0;
|
||||
|
||||
DebugOnly<nsresult> rv = tableLayout->
|
||||
GetCellDataAt(aRowIdx, aColIdx, *getter_AddRefs(domElement),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
rowExtent, actualColSpan, isSelected);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Could not get cell data");
|
||||
|
||||
return rowExtent;
|
||||
return tableFrame->GetEffectiveRowSpanAt(aRowIdx, aColIdx);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -767,20 +710,12 @@ HTMLTableAccessible::IsRowSelected(uint32_t aRowIdx)
|
||||
bool
|
||||
HTMLTableAccessible::IsCellSelected(uint32_t aRowIdx, uint32_t aColIdx)
|
||||
{
|
||||
nsITableLayout *tableLayout = GetTableLayout();
|
||||
if (!tableLayout)
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||
if (!tableFrame)
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement;
|
||||
int32_t startRowIndex = 0, startColIndex = 0,
|
||||
rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
bool isSelected = false;
|
||||
|
||||
tableLayout->GetCellDataAt(aRowIdx, aColIdx, *getter_AddRefs(domElement),
|
||||
startRowIndex, startColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
|
||||
return isSelected;
|
||||
nsTableCellFrame* cellFrame = tableFrame->GetCellFrameAt(aRowIdx, aColIdx);
|
||||
return cellFrame ? cellFrame->IsSelected() : false;
|
||||
}
|
||||
|
||||
void
|
||||
@ -830,40 +765,26 @@ HTMLTableAccessible::AddRowOrColumnToSelection(int32_t aIndex, uint32_t aTarget)
|
||||
{
|
||||
bool doSelectRow = (aTarget == nsISelectionPrivate::TABLESELECTION_ROW);
|
||||
|
||||
nsITableLayout *tableLayout = GetTableLayout();
|
||||
NS_ENSURE_STATE(tableLayout);
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||
if (!tableFrame)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> cellElm;
|
||||
int32_t startRowIdx, startColIdx, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan;
|
||||
bool isSelected = false;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
int32_t count = 0;
|
||||
uint32_t count = 0;
|
||||
if (doSelectRow)
|
||||
rv = GetColumnCount(&count);
|
||||
count = ColCount();
|
||||
else
|
||||
rv = GetRowCount(&count);
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
count = RowCount();
|
||||
|
||||
nsIPresShell* presShell(mDoc->PresShell());
|
||||
nsRefPtr<nsFrameSelection> tableSelection =
|
||||
const_cast<nsFrameSelection*>(presShell->ConstFrameSelection());
|
||||
|
||||
for (int32_t idx = 0; idx < count; idx++) {
|
||||
for (uint32_t idx = 0; idx < count; idx++) {
|
||||
int32_t rowIdx = doSelectRow ? aIndex : idx;
|
||||
int32_t colIdx = doSelectRow ? idx : aIndex;
|
||||
rv = tableLayout->GetCellDataAt(rowIdx, colIdx,
|
||||
*getter_AddRefs(cellElm),
|
||||
startRowIdx, startColIdx,
|
||||
rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan,
|
||||
isSelected);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && !isSelected) {
|
||||
nsCOMPtr<nsIContent> cellContent(do_QueryInterface(cellElm));
|
||||
rv = tableSelection->SelectCellElement(cellContent);
|
||||
nsTableCellFrame* cellFrame = tableFrame->GetCellFrameAt(rowIdx, colIdx);
|
||||
if (cellFrame && !cellFrame->IsSelected()) {
|
||||
nsresult rv = tableSelection->SelectCellElement(cellFrame->GetContent());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
@ -876,17 +797,16 @@ HTMLTableAccessible::RemoveRowsOrColumnsFromSelection(int32_t aIndex,
|
||||
uint32_t aTarget,
|
||||
bool aIsOuter)
|
||||
{
|
||||
nsITableLayout *tableLayout = GetTableLayout();
|
||||
NS_ENSURE_STATE(tableLayout);
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||
if (!tableFrame)
|
||||
return NS_OK;
|
||||
|
||||
nsIPresShell* presShell(mDoc->PresShell());
|
||||
nsRefPtr<nsFrameSelection> tableSelection =
|
||||
const_cast<nsFrameSelection*>(presShell->ConstFrameSelection());
|
||||
|
||||
bool doUnselectRow = (aTarget == nsISelectionPrivate::TABLESELECTION_ROW);
|
||||
int32_t count = 0;
|
||||
nsresult rv = doUnselectRow ? GetColumnCount(&count) : GetRowCount(&count);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
uint32_t count = doUnselectRow ? ColCount() : RowCount();
|
||||
|
||||
int32_t startRowIdx = doUnselectRow ? aIndex : 0;
|
||||
int32_t endRowIdx = doUnselectRow ? aIndex : count - 1;
|
||||
@ -903,37 +823,6 @@ HTMLTableAccessible::RemoveRowsOrColumnsFromSelection(int32_t aIndex,
|
||||
endRowIdx, endColIdx);
|
||||
}
|
||||
|
||||
nsITableLayout*
|
||||
HTMLTableAccessible::GetTableLayout()
|
||||
{
|
||||
nsIFrame *frame = mContent->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return nullptr;
|
||||
|
||||
nsITableLayout *tableLayout = do_QueryFrame(frame);
|
||||
return tableLayout;
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLTableAccessible::GetCellAt(int32_t aRowIndex, int32_t aColIndex,
|
||||
nsIDOMElement*& aCell)
|
||||
{
|
||||
int32_t startRowIndex = 0, startColIndex = 0,
|
||||
rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
bool isSelected;
|
||||
|
||||
nsITableLayout *tableLayout = GetTableLayout();
|
||||
NS_ENSURE_STATE(tableLayout);
|
||||
|
||||
nsresult 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;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLTableAccessible::Description(nsString& aDescription)
|
||||
{
|
||||
@ -1140,16 +1029,14 @@ HTMLTableAccessible::IsProbablyLayoutTable()
|
||||
// Now we know there are 2-4 columns and 2 or more rows
|
||||
// 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;
|
||||
nsresult rv = GetCellAt(0, 0, *getter_AddRefs(cellElement));
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
|
||||
if (!tableFrame)
|
||||
RETURN_LAYOUT_ANSWER(false, "table with no frame!");
|
||||
|
||||
nsIFrame* cellFrame = tableFrame->GetCellFrameAt(0, 0);
|
||||
if (!cellFrame)
|
||||
RETURN_LAYOUT_ANSWER(false, "table's first cell has no frame!");
|
||||
|
||||
nsCOMPtr<nsIContent> cellContent(do_QueryInterface(cellElement));
|
||||
NS_ENSURE_TRUE(cellContent, false);
|
||||
nsIFrame *cellFrame = cellContent->GetPrimaryFrame();
|
||||
if (!cellFrame) {
|
||||
RETURN_LAYOUT_ANSWER(false, "Could not get frame for cellContent");
|
||||
}
|
||||
nsMargin border;
|
||||
cellFrame->GetBorder(border);
|
||||
if (border.top && border.bottom && border.left && border.right) {
|
||||
|
@ -166,19 +166,6 @@ public:
|
||||
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() MOZ_OVERRIDE;
|
||||
virtual Relation RelationByType(uint32_t aRelationType);
|
||||
|
||||
// HTMLTableAccessible
|
||||
|
||||
/**
|
||||
* Retun cell element at the given row and column index.
|
||||
*/
|
||||
nsresult GetCellAt(int32_t aRowIndex, int32_t aColIndex,
|
||||
nsIDOMElement* &aCell);
|
||||
|
||||
/**
|
||||
* Return nsITableLayout for the frame of the accessible table.
|
||||
*/
|
||||
nsITableLayout* GetTableLayout();
|
||||
|
||||
protected:
|
||||
// Accessible
|
||||
virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE;
|
||||
|
@ -39,6 +39,7 @@ LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../../../content/base/src \
|
||||
-I$(srcdir)/../../../content/html/content/src \
|
||||
-I$(srcdir)/../../../layout/generic \
|
||||
-I$(srcdir)/../../../layout/tables \
|
||||
-I$(srcdir)/../../../layout/xul/base/src \
|
||||
$(NULL)
|
||||
|
||||
|
@ -60,3 +60,9 @@ INCLUDES += -I$(topsrcdir)/editor/libeditor/base \
|
||||
-I$(topsrcdir)/content/base/src \
|
||||
-I$(topsrcdir)/layout/style \
|
||||
$(NULL)
|
||||
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(topsrcdir)/layout/generic \
|
||||
-I$(topsrcdir)/layout/tables \
|
||||
-I$(topsrcdir)/layout/xul/base/src \
|
||||
$(null)
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsICSSLoaderObserver.h"
|
||||
#include "nsITableLayout.h"
|
||||
|
||||
#include "nsEditRules.h"
|
||||
|
||||
@ -52,6 +51,7 @@ class TypeInState;
|
||||
class nsIContentFilter;
|
||||
class nsIURL;
|
||||
class nsILinkHandler;
|
||||
class nsTableOuterFrame;
|
||||
struct PropItem;
|
||||
|
||||
namespace mozilla {
|
||||
@ -441,8 +441,8 @@ protected:
|
||||
NS_IMETHOD SetColSpan(nsIDOMElement *aCell, int32_t aColSpan);
|
||||
NS_IMETHOD SetRowSpan(nsIDOMElement *aCell, int32_t aRowSpan);
|
||||
|
||||
// Helper used to get nsITableLayout interface for methods implemented in nsTableFrame
|
||||
NS_IMETHOD GetTableLayoutObject(nsIDOMElement* aTable, nsITableLayout **tableLayoutObject);
|
||||
// Helper used to get nsTableOuterFrame for a table.
|
||||
nsTableOuterFrame* GetTableFrame(nsIDOMElement* aTable);
|
||||
// Needed to do appropriate deleting when last cell or row is about to be deleted
|
||||
// This doesn't count cells that don't start in the given row (are spanning from row above)
|
||||
int32_t GetNumberOfCellsInRow(nsIDOMElement* aTable, int32_t rowIndex);
|
||||
|
@ -32,11 +32,12 @@
|
||||
#include "nsISupportsUtils.h"
|
||||
#include "nsITableCellLayout.h" // For efficient access to table cell
|
||||
#include "nsITableEditor.h"
|
||||
#include "nsITableLayout.h" // data owned by the table and cell frames
|
||||
#include "nsLiteralString.h"
|
||||
#include "nsQueryFrame.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsTableCellFrame.h"
|
||||
#include "nsTableOuterFrame.h"
|
||||
#include "nscore.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -2607,23 +2608,14 @@ nsHTMLEditor::GetCellIndexes(nsIDOMElement *aCell,
|
||||
return cellLayoutObject->GetCellIndexes(*aRowIndex, *aColIndex);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetTableLayoutObject(nsIDOMElement* aTable, nsITableLayout **tableLayoutObject)
|
||||
nsTableOuterFrame*
|
||||
nsHTMLEditor::GetTableFrame(nsIDOMElement* aTable)
|
||||
{
|
||||
*tableLayoutObject = nullptr;
|
||||
NS_ENSURE_TRUE(aTable, NS_ERROR_NOT_INITIALIZED);
|
||||
NS_ENSURE_TRUE(mDocWeak, NS_ERROR_NOT_INITIALIZED);
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
NS_ENSURE_TRUE(ps, NS_ERROR_NOT_INITIALIZED);
|
||||
NS_ENSURE_TRUE(aTable, nullptr);
|
||||
|
||||
nsCOMPtr<nsIContent> nodeAsContent( do_QueryInterface(aTable) );
|
||||
NS_ENSURE_TRUE(nodeAsContent, NS_ERROR_FAILURE);
|
||||
// frames are not ref counted, so don't use an nsCOMPtr
|
||||
nsIFrame *layoutObject = nodeAsContent->GetPrimaryFrame();
|
||||
NS_ENSURE_TRUE(layoutObject, NS_ERROR_FAILURE);
|
||||
|
||||
*tableLayoutObject = do_QueryFrame(layoutObject);
|
||||
return *tableLayoutObject ? NS_OK : NS_NOINTERFACE;
|
||||
NS_ENSURE_TRUE(nodeAsContent, nullptr);
|
||||
return do_QueryFrame(nodeAsContent->GetPrimaryFrame());
|
||||
}
|
||||
|
||||
//Return actual number of cells (a cell with colspan > 1 counts as just 1)
|
||||
@ -2675,13 +2667,13 @@ nsHTMLEditor::GetTableSize(nsIDOMElement *aTable,
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
NS_ENSURE_TRUE(table, NS_ERROR_FAILURE);
|
||||
|
||||
// frames are not ref counted, so don't use an nsCOMPtr
|
||||
nsITableLayout *tableLayoutObject;
|
||||
res = GetTableLayoutObject(table.get(), &tableLayoutObject);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
NS_ENSURE_TRUE(tableLayoutObject, NS_ERROR_FAILURE);
|
||||
nsTableOuterFrame* tableFrame = GetTableFrame(table.get());
|
||||
NS_ENSURE_TRUE(tableFrame, NS_ERROR_FAILURE);
|
||||
|
||||
return tableLayoutObject->GetTableSize(*aRowCount, *aColCount);
|
||||
*aRowCount = tableFrame->GetRowCount();
|
||||
*aColCount = tableFrame->GetColCount();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -2724,40 +2716,43 @@ nsHTMLEditor::GetCellDataAt(nsIDOMElement* aTable, int32_t aRowIndex,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// frames are not ref counted, so don't use an nsCOMPtr
|
||||
nsITableLayout *tableLayoutObject;
|
||||
res = GetTableLayoutObject(aTable, &tableLayoutObject);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
NS_ENSURE_TRUE(tableLayoutObject, NS_ERROR_FAILURE);
|
||||
nsTableOuterFrame* tableFrame = GetTableFrame(aTable);
|
||||
NS_ENSURE_TRUE(tableFrame, NS_ERROR_FAILURE);
|
||||
|
||||
// Note that this returns NS_TABLELAYOUT_CELL_NOT_FOUND when
|
||||
// the index(es) are out of bounds
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
res = tableLayoutObject->GetCellDataAt(aRowIndex, aColIndex,
|
||||
*getter_AddRefs(cell),
|
||||
*aStartRowIndex, *aStartColIndex,
|
||||
*aRowSpan, *aColSpan,
|
||||
*aActualRowSpan, *aActualColSpan,
|
||||
*aIsSelected);
|
||||
if (cell)
|
||||
{
|
||||
*aCell = cell.get();
|
||||
NS_ADDREF(*aCell);
|
||||
}
|
||||
// Convert to editor's generic "not found" return value
|
||||
if (res == NS_TABLELAYOUT_CELL_NOT_FOUND) res = NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
return res;
|
||||
nsTableCellFrame* cellFrame =
|
||||
tableFrame->GetCellFrameAt(aRowIndex, aColIndex);
|
||||
if (!cellFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aIsSelected = cellFrame->IsSelected();
|
||||
cellFrame->GetRowIndex(*aStartRowIndex);
|
||||
cellFrame->GetColIndex(*aStartColIndex);
|
||||
*aRowSpan = cellFrame->GetRowSpan();
|
||||
*aColSpan = cellFrame->GetColSpan();
|
||||
*aActualRowSpan = tableFrame->GetEffectiveRowSpanAt(aRowIndex, aColIndex);
|
||||
*aActualColSpan = tableFrame->GetEffectiveColSpanAt(aRowIndex, aColIndex);
|
||||
nsCOMPtr<nsIDOMElement> domCell = do_QueryInterface(cellFrame->GetContent());
|
||||
domCell.forget(aCell);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// When all you want is the cell
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditor::GetCellAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t aColIndex, nsIDOMElement **aCell)
|
||||
{
|
||||
int32_t startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
bool isSelected;
|
||||
return GetCellDataAt(aTable, aRowIndex, aColIndex, aCell,
|
||||
&startRowIndex, &startColIndex, &rowSpan, &colSpan,
|
||||
&actualRowSpan, &actualColSpan, &isSelected);
|
||||
NS_ENSURE_ARG_POINTER(aCell);
|
||||
*aCell = nullptr;
|
||||
|
||||
nsTableOuterFrame* tableFrame = GetTableFrame(aTable);
|
||||
if (!tableFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domCell =
|
||||
do_QueryInterface(tableFrame->GetCellAt(aRowIndex, aColIndex));
|
||||
domCell.forget(aCell);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// When all you want are the rowspan and colspan (not exposed in nsITableEditor)
|
||||
@ -2765,12 +2760,14 @@ NS_IMETHODIMP
|
||||
nsHTMLEditor::GetCellSpansAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t aColIndex,
|
||||
int32_t& aActualRowSpan, int32_t& aActualColSpan)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
int32_t startRowIndex, startColIndex, rowSpan, colSpan;
|
||||
bool isSelected;
|
||||
return GetCellDataAt(aTable, aRowIndex, aColIndex, getter_AddRefs(cell),
|
||||
&startRowIndex, &startColIndex, &rowSpan, &colSpan,
|
||||
&aActualRowSpan, &aActualColSpan, &isSelected);
|
||||
nsTableOuterFrame* tableFrame = GetTableFrame(aTable);
|
||||
if (!tableFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
aActualRowSpan = tableFrame->GetEffectiveRowSpanAt(aRowIndex, aColIndex);
|
||||
aActualColSpan = tableFrame->GetEffectiveColSpanAt(aRowIndex, aColIndex);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "mozilla/LinkedList.h"
|
||||
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsAbsoluteContainingBlock.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIURL.h"
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsBlockFrame.h"
|
||||
#include "nsAbsoluteContainingBlock.h"
|
||||
#include "nsBlockReflowContext.h"
|
||||
#include "nsBlockReflowState.h"
|
||||
#include "nsBulletFrame.h"
|
||||
|
@ -14,7 +14,6 @@
|
||||
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsHTMLParts.h"
|
||||
#include "nsAbsoluteContainingBlock.h"
|
||||
#include "nsLineBox.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "nsContainerFrame.h"
|
||||
|
||||
#include "nsAbsoluteContainingBlock.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsPresContext.h"
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsTableOuterFrame.h"
|
||||
#include "nsIView.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
@ -53,7 +54,6 @@
|
||||
#include "nsStyleChangeList.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsRange.h"
|
||||
#include "nsITableLayout.h" //selection necessity
|
||||
#include "nsITableCellLayout.h"// "
|
||||
#include "nsITextControlFrame.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
@ -2502,8 +2502,8 @@ nsFrame::GetDataForTableSelection(const nsFrameSelection *aFrameSelection,
|
||||
// If not a cell, check for table
|
||||
// This will happen when starting frame is the table or child of a table,
|
||||
// such as a row (we were inbetween cells or in table border)
|
||||
nsITableLayout *tableElement = do_QueryFrame(frame);
|
||||
if (tableElement)
|
||||
nsTableOuterFrame *tableFrame = do_QueryFrame(frame);
|
||||
if (tableFrame)
|
||||
{
|
||||
foundTable = true;
|
||||
//TODO: How can we select row when along left table edge
|
||||
|
@ -10,12 +10,13 @@
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsITableLayout.h"
|
||||
#include "nsITableCellLayout.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsRange.h"
|
||||
|
||||
class nsTableOuterFrame;
|
||||
|
||||
// IID for the nsFrameSelection interface
|
||||
// 3c6ae2d0-4cf1-44a1-9e9d-2411867f19c6
|
||||
#define NS_FRAME_SELECTION_IID \
|
||||
@ -650,8 +651,6 @@ private:
|
||||
nsRefPtr<mozilla::Selection> mDomSelections[nsISelectionController::NUM_SELECTIONTYPES];
|
||||
|
||||
// Table selection support.
|
||||
// Interfaces that let us get info based on cellmap locations
|
||||
nsITableLayout* GetTableLayout(nsIContent *aTableContent) const;
|
||||
nsITableCellLayout* GetCellLayout(nsIContent *aCellContent) const;
|
||||
|
||||
nsresult SelectBlockOfCells(nsIContent *aStartNode, nsIContent *aEndNode);
|
||||
|
@ -29,10 +29,11 @@
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsITableLayout.h"
|
||||
#include "nsITableCellLayout.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsTableOuterFrame.h"
|
||||
#include "nsTableCellFrame.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsCCUncollectableMarker.h"
|
||||
#include "nsIContentIterator.h"
|
||||
@ -2077,15 +2078,6 @@ nsFrameSelection::GetCellLayout(nsIContent *aCellContent) const
|
||||
return cellLayoutObject;
|
||||
}
|
||||
|
||||
nsITableLayout*
|
||||
nsFrameSelection::GetTableLayout(nsIContent *aTableContent) const
|
||||
{
|
||||
NS_ENSURE_TRUE(mShell, nullptr);
|
||||
nsITableLayout *tableLayoutObject =
|
||||
do_QueryFrame(aTableContent->GetPrimaryFrame());
|
||||
return tableLayoutObject;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsFrameSelection::ClearNormalSelection()
|
||||
{
|
||||
@ -2480,8 +2472,8 @@ nsFrameSelection::UnselectCells(nsIContent *aTableContent,
|
||||
if (!mDomSelections[index])
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsITableLayout *tableLayout = GetTableLayout(aTableContent);
|
||||
if (!tableLayout)
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(aTableContent->GetPrimaryFrame());
|
||||
if (!tableFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
int32_t minRowIndex = NS_MIN(aStartRowIndex, aEndRowIndex);
|
||||
@ -2519,24 +2511,20 @@ nsFrameSelection::UnselectCells(nsIContent *aTableContent,
|
||||
} else {
|
||||
// Remove cell from selection if it belongs to the given cells range or
|
||||
// it is spanned onto the cells range.
|
||||
nsCOMPtr<nsIDOMElement> cellElement;
|
||||
int32_t origRowIndex, origColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan;
|
||||
bool isSelected;
|
||||
nsTableCellFrame* cellFrame =
|
||||
tableFrame->GetCellFrameAt(curRowIndex, curColIndex);
|
||||
|
||||
result = tableLayout->GetCellDataAt(curRowIndex, curColIndex,
|
||||
*getter_AddRefs(cellElement),
|
||||
origRowIndex, origColIndex,
|
||||
rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan,
|
||||
isSelected);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
if (origRowIndex <= maxRowIndex &&
|
||||
origRowIndex + actualRowSpan - 1 >= minRowIndex &&
|
||||
origColIndex <= maxColIndex &&
|
||||
origColIndex + actualColSpan - 1 >= minColIndex) {
|
||||
int32_t origRowIndex, origColIndex;
|
||||
cellFrame->GetRowIndex(origRowIndex);
|
||||
cellFrame->GetColIndex(origColIndex);
|
||||
uint32_t actualRowSpan =
|
||||
tableFrame->GetEffectiveRowSpanAt(origRowIndex, origColIndex);
|
||||
uint32_t actualColSpan =
|
||||
tableFrame->GetEffectiveColSpanAt(curRowIndex, curColIndex);
|
||||
if (origRowIndex <= maxRowIndex && maxRowIndex >= 0 &&
|
||||
origRowIndex + actualRowSpan - 1 >= static_cast<uint32_t>(minRowIndex) &&
|
||||
origColIndex <= maxColIndex && maxColIndex >= 0 &&
|
||||
origColIndex + actualColSpan - 1 >= static_cast<uint32_t>(minColIndex)) {
|
||||
|
||||
mDomSelections[index]->RemoveRange(range);
|
||||
// Since we've removed the range, decrement pointer to next range
|
||||
@ -2564,37 +2552,28 @@ nsFrameSelection::AddCellsToSelection(nsIContent *aTableContent,
|
||||
if (!mDomSelections[index])
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Get TableLayout interface to access cell data based on cellmap location
|
||||
// frames are not ref counted, so don't use an nsCOMPtr
|
||||
nsITableLayout *tableLayoutObject = GetTableLayout(aTableContent);
|
||||
if (!tableLayoutObject) // Check that |table| is a table.
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(aTableContent->GetPrimaryFrame());
|
||||
if (!tableFrame) // Check that |table| is a table.
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> cellElement;
|
||||
int32_t rowSpan, colSpan, actualRowSpan, actualColSpan,
|
||||
curRowIndex, curColIndex;
|
||||
bool isSelected;
|
||||
nsresult result = NS_OK;
|
||||
|
||||
int32_t row = aStartRowIndex;
|
||||
while(true)
|
||||
{
|
||||
int32_t col = aStartColumnIndex;
|
||||
while(true)
|
||||
{
|
||||
result = tableLayoutObject->GetCellDataAt(row, col, *getter_AddRefs(cellElement),
|
||||
curRowIndex, curColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
||||
NS_ASSERTION(actualColSpan, "!actualColSpan is 0!");
|
||||
nsTableCellFrame* cellFrame = tableFrame->GetCellFrameAt(row, col);
|
||||
|
||||
// Skip cells that are spanned from previous locations or are already selected
|
||||
if (!isSelected && cellElement && row == curRowIndex && col == curColIndex)
|
||||
{
|
||||
nsCOMPtr<nsIContent> cellContent = do_QueryInterface(cellElement);
|
||||
result = SelectCellElement(cellContent);
|
||||
if (NS_FAILED(result)) return result;
|
||||
if (cellFrame) {
|
||||
int32_t origRow, origCol;
|
||||
cellFrame->GetRowIndex(origRow);
|
||||
cellFrame->GetColIndex(origCol);
|
||||
if (origRow == row && origCol == col && !cellFrame->IsSelected()) {
|
||||
result = SelectCellElement(cellFrame->GetContent());
|
||||
if (NS_FAILED(result)) return result;
|
||||
}
|
||||
}
|
||||
// Done when we reach end column
|
||||
if (col == aEndColumnIndex) break;
|
||||
@ -2647,13 +2626,13 @@ nsFrameSelection::SelectRowOrColumn(nsIContent *aCellContent, uint32_t aTarget)
|
||||
// Get table and cell layout interfaces to access
|
||||
// cell data based on cellmap location
|
||||
// Frames are not ref counted, so don't use an nsCOMPtr
|
||||
nsITableLayout *tableLayout = GetTableLayout(table);
|
||||
if (!tableLayout) return NS_ERROR_FAILURE;
|
||||
nsTableOuterFrame* tableFrame = do_QueryFrame(table->GetPrimaryFrame());
|
||||
if (!tableFrame) return NS_ERROR_FAILURE;
|
||||
nsITableCellLayout *cellLayout = GetCellLayout(aCellContent);
|
||||
if (!cellLayout) return NS_ERROR_FAILURE;
|
||||
|
||||
// Get location of target cell:
|
||||
int32_t rowIndex, colIndex, curRowIndex, curColIndex;
|
||||
int32_t rowIndex, colIndex;
|
||||
nsresult result = cellLayout->GetCellIndexes(rowIndex, colIndex);
|
||||
if (NS_FAILED(result)) return result;
|
||||
|
||||
@ -2664,34 +2643,25 @@ nsFrameSelection::SelectRowOrColumn(nsIContent *aCellContent, uint32_t aTarget)
|
||||
if (aTarget == nsISelectionPrivate::TABLESELECTION_COLUMN)
|
||||
rowIndex = 0;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> cellElement;
|
||||
nsCOMPtr<nsIContent> firstCell;
|
||||
nsCOMPtr<nsIDOMElement> lastCell;
|
||||
int32_t rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
bool isSelected;
|
||||
|
||||
do {
|
||||
nsCOMPtr<nsIContent> firstCell, lastCell;
|
||||
while (true) {
|
||||
// Loop through all cells in column or row to find first and last
|
||||
result = tableLayout->GetCellDataAt(rowIndex, colIndex, *getter_AddRefs(cellElement),
|
||||
curRowIndex, curColIndex, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan, isSelected);
|
||||
if (NS_FAILED(result)) return result;
|
||||
if (cellElement)
|
||||
{
|
||||
NS_ASSERTION(actualRowSpan > 0 && actualColSpan> 0, "SelectRowOrColumn: Bad rowspan or colspan\n");
|
||||
if (!firstCell)
|
||||
firstCell = do_QueryInterface(cellElement);
|
||||
nsCOMPtr<nsIContent> curCellContent =
|
||||
tableFrame->GetCellAt(rowIndex, colIndex);
|
||||
if (!curCellContent)
|
||||
break;
|
||||
|
||||
lastCell = cellElement;
|
||||
if (!firstCell)
|
||||
firstCell = curCellContent;
|
||||
|
||||
// Move to next cell in cellmap, skipping spanned locations
|
||||
if (aTarget == nsISelectionPrivate::TABLESELECTION_ROW)
|
||||
colIndex += actualColSpan;
|
||||
else
|
||||
rowIndex += actualRowSpan;
|
||||
}
|
||||
lastCell = curCellContent.forget();
|
||||
|
||||
// Move to next cell in cellmap, skipping spanned locations
|
||||
if (aTarget == nsISelectionPrivate::TABLESELECTION_ROW)
|
||||
colIndex += tableFrame->GetEffectiveRowSpanAt(rowIndex, colIndex);
|
||||
else
|
||||
rowIndex += tableFrame->GetEffectiveRowSpanAt(rowIndex, colIndex);
|
||||
}
|
||||
while (cellElement);
|
||||
|
||||
// Use SelectBlockOfCells:
|
||||
// This will replace existing selection,
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "nsPresContext.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsTableRowFrame.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsRenderingContext.h"
|
||||
|
||||
@ -511,8 +512,7 @@ nsIFrame*
|
||||
nsMathMLmtableOuterFrame::GetRowFrameAt(nsPresContext* aPresContext,
|
||||
int32_t aRowIndex)
|
||||
{
|
||||
int32_t rowCount, colCount;
|
||||
GetTableSize(rowCount, colCount);
|
||||
int32_t rowCount = GetRowCount();
|
||||
|
||||
// Negative indices mean to find upwards from the end.
|
||||
if (aRowIndex < 0) {
|
||||
|
@ -19,7 +19,6 @@ FAIL_ON_WARNINGS = 1
|
||||
|
||||
EXPORTS = \
|
||||
nsITableCellLayout.h \
|
||||
nsITableLayout.h \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "nsCellMap.h"
|
||||
#include "nsTableFrame.h"
|
||||
#include "nsTableCellFrame.h"
|
||||
#include "nsTableRowFrame.h"
|
||||
#include "nsTableRowGroupFrame.h"
|
||||
|
||||
|
||||
|
@ -1,80 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#ifndef nsITableLayout_h__
|
||||
#define nsITableLayout_h__
|
||||
|
||||
#include "nsQueryFrame.h"
|
||||
class nsIDOMElement;
|
||||
|
||||
/**
|
||||
* nsITableLayout
|
||||
* interface for layout objects that act like tables.
|
||||
* initially, we use this to get cell info
|
||||
*
|
||||
* @author sclark
|
||||
*/
|
||||
class nsITableLayout
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECL_QUERYFRAME_TARGET(nsITableLayout)
|
||||
|
||||
/** return all the relevant layout information about a cell.
|
||||
* @param aRowIndex a row which the cell intersects
|
||||
* @param aColIndex a col which the cell intersects
|
||||
* @param aCell [OUT] the content representing the cell at (aRowIndex, aColIndex)
|
||||
* @param aStartRowIndex [IN/OUT] the row in which aCell starts
|
||||
* @param aStartColIndex [IN/OUT] the col in which aCell starts
|
||||
* Initialize these with the "candidate" start indexes to use
|
||||
* for searching through the table when a cell isn't found
|
||||
* because of "holes" in the cellmap
|
||||
* when ROWSPAN and/or COLSPAN > 1
|
||||
* @param aRowSpan [OUT] the value of the ROWSPAN attribute (may be 0 or actual number)
|
||||
* @param aColSpan [OUT] the value of the COLSPAN attribute (may be 0 or actual number)
|
||||
* @param aActualRowSpan [OUT] the actual number of rows aCell spans
|
||||
* @param aActualColSpan [OUT] the acutal number of cols aCell spans
|
||||
* @param aIsSelected [OUT] true if the frame that maps aCell is selected
|
||||
* in the presentation shell that owns this.
|
||||
*/
|
||||
NS_IMETHOD GetCellDataAt(int32_t aRowIndex, int32_t aColIndex,
|
||||
nsIDOMElement* &aCell, //out params
|
||||
int32_t& aStartRowIndex, int32_t& aStartColIndex,
|
||||
int32_t& aRowSpan, int32_t& aColSpan,
|
||||
int32_t& aActualRowSpan, int32_t& aActualColSpan,
|
||||
bool& aIsSelected)=0;
|
||||
|
||||
/** Get the number of rows and column for a table from the frame's cellmap
|
||||
* Some rows may not have enough cells (the number returned is the maximum possible),
|
||||
* which displays as a ragged-right edge table
|
||||
*/
|
||||
NS_IMETHOD GetTableSize(int32_t& aRowCount, int32_t& aColCount)=0;
|
||||
|
||||
/**
|
||||
* Retrieves the index of the cell at the given coordinates.
|
||||
*
|
||||
* @note The index is the order number of the cell calculated from top left
|
||||
* cell to the right bottom cell of the table.
|
||||
*
|
||||
* @param aRow [in] the row the cell is in
|
||||
* @param aColumn [in] the column the cell is in
|
||||
* @param aIndex [out] the index to be returned
|
||||
*/
|
||||
NS_IMETHOD GetIndexByRowAndColumn(int32_t aRow, int32_t aColumn,
|
||||
int32_t *aIndex) = 0;
|
||||
|
||||
/**
|
||||
* Retrieves the coordinates of the cell at the given index.
|
||||
*
|
||||
* @see nsITableLayout::GetIndexByRowAndColumn()
|
||||
*
|
||||
* @param aIndex [in] the index for which the coordinates are to be retrieved
|
||||
* @param aRow [out] the resulting row coordinate
|
||||
* @param aColumn [out] the resulting column coordinate
|
||||
*/
|
||||
NS_IMETHOD GetRowAndColumnByIndex(int32_t aIndex,
|
||||
int32_t *aRow, int32_t *aColumn) = 0;
|
||||
};
|
||||
|
||||
#endif
|
@ -5,6 +5,7 @@
|
||||
#include "nsTableFrame.h"
|
||||
#include "nsTableColFrame.h"
|
||||
#include "nsTableCellFrame.h"
|
||||
#include "nsTableRowFrame.h"
|
||||
#include "nsTableRowGroupFrame.h"
|
||||
#include "nsTablePainter.h"
|
||||
#include "nsStyleContext.h"
|
||||
|
@ -6,10 +6,10 @@
|
||||
#define nsTableCellFrame_h__
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "celldata.h"
|
||||
#include "nsITableCellLayout.h"
|
||||
#include "nscore.h"
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsTableRowFrame.h" // need to actually include this here to inline GetRowIndex
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsIPercentHeightObserver.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
@ -6,9 +6,9 @@
|
||||
#define nsTableColFrame_h__
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "celldata.h"
|
||||
#include "nscore.h"
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsTablePainter.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
class nsTableCellFrame;
|
||||
|
@ -9,8 +9,8 @@
|
||||
#include "nscore.h"
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsTableColFrame.h"
|
||||
#include "nsTablePainter.h"
|
||||
|
||||
class nsTableFrame;
|
||||
class nsTableColFrame;
|
||||
|
||||
enum nsTableColGroupType {
|
||||
|
@ -160,7 +160,6 @@ nsTableFrame::nsTableFrame(nsStyleContext* aContext)
|
||||
}
|
||||
|
||||
NS_QUERYFRAME_HEAD(nsTableFrame)
|
||||
NS_QUERYFRAME_ENTRY(nsITableLayout)
|
||||
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -3691,108 +3690,6 @@ int32_t nsTableIterator::Count()
|
||||
return mCount;
|
||||
}
|
||||
|
||||
/*------------------ nsITableLayout methods ------------------------------*/
|
||||
NS_IMETHODIMP
|
||||
nsTableFrame::GetCellDataAt(int32_t aRowIndex,
|
||||
int32_t aColIndex,
|
||||
nsIDOMElement* &aCell, //out params
|
||||
int32_t& aStartRowIndex,
|
||||
int32_t& aStartColIndex,
|
||||
int32_t& aRowSpan,
|
||||
int32_t& aColSpan,
|
||||
int32_t& aActualRowSpan,
|
||||
int32_t& aActualColSpan,
|
||||
bool& aIsSelected)
|
||||
{
|
||||
// Initialize out params
|
||||
aCell = nullptr;
|
||||
aStartRowIndex = 0;
|
||||
aStartColIndex = 0;
|
||||
aRowSpan = 0;
|
||||
aColSpan = 0;
|
||||
aIsSelected = false;
|
||||
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (!cellMap) { return NS_ERROR_NOT_INITIALIZED;}
|
||||
|
||||
bool originates;
|
||||
int32_t colSpan; // Is this the "effective" or "html" value?
|
||||
|
||||
nsTableCellFrame *cellFrame = cellMap->GetCellInfoAt(aRowIndex, aColIndex, &originates, &colSpan);
|
||||
if (!cellFrame) return NS_TABLELAYOUT_CELL_NOT_FOUND;
|
||||
|
||||
nsresult result= cellFrame->GetRowIndex(aStartRowIndex);
|
||||
if (NS_FAILED(result)) return result;
|
||||
result = cellFrame->GetColIndex(aStartColIndex);
|
||||
if (NS_FAILED(result)) return result;
|
||||
//This returns HTML value, which may be 0
|
||||
aRowSpan = cellFrame->GetRowSpan();
|
||||
aColSpan = cellFrame->GetColSpan();
|
||||
aActualRowSpan = GetEffectiveRowSpan(*cellFrame);
|
||||
aActualColSpan = GetEffectiveColSpan(*cellFrame);
|
||||
|
||||
// If these aren't at least 1, we have a cellmap error
|
||||
if (aActualRowSpan == 0 || aActualColSpan == 0)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
aIsSelected = cellFrame->IsSelected();
|
||||
|
||||
// do this last, because it addrefs,
|
||||
// and we don't want the caller leaking it on error
|
||||
nsIContent* content = cellFrame->GetContent();
|
||||
if (!content) return NS_ERROR_FAILURE;
|
||||
|
||||
return CallQueryInterface(content, &aCell);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsTableFrame::GetTableSize(int32_t& aRowCount, int32_t& aColCount)
|
||||
{
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
// Initialize out params
|
||||
aRowCount = 0;
|
||||
aColCount = 0;
|
||||
if (!cellMap) { return NS_ERROR_NOT_INITIALIZED;}
|
||||
|
||||
aRowCount = cellMap->GetRowCount();
|
||||
aColCount = cellMap->GetColCount();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTableFrame::GetIndexByRowAndColumn(int32_t aRow, int32_t aColumn,
|
||||
int32_t *aIndex)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIndex);
|
||||
*aIndex = -1;
|
||||
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (!cellMap)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
*aIndex = cellMap->GetIndexByRowAndColumn(aRow, aColumn);
|
||||
return (*aIndex == -1) ? NS_TABLELAYOUT_CELL_NOT_FOUND : NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTableFrame::GetRowAndColumnByIndex(int32_t aIndex,
|
||||
int32_t *aRow, int32_t *aColumn)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRow);
|
||||
*aRow = -1;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aColumn);
|
||||
*aColumn = -1;
|
||||
|
||||
nsTableCellMap* cellMap = GetCellMap();
|
||||
if (!cellMap)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
cellMap->GetRowAndColumnByIndex(aIndex, aRow, aColumn);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*---------------- end of nsITableLayout implementation ------------------*/
|
||||
|
||||
bool
|
||||
nsTableFrame::ColumnHasCellSpacingBefore(int32_t aColIndex) const
|
||||
{
|
||||
|
@ -5,11 +5,11 @@
|
||||
#ifndef nsTableFrame_h__
|
||||
#define nsTableFrame_h__
|
||||
|
||||
#include "celldata.h"
|
||||
#include "nscore.h"
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsStyleCoord.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsITableLayout.h"
|
||||
#include "nsTableColFrame.h"
|
||||
#include "nsTableColGroupFrame.h"
|
||||
#include "nsCellMap.h"
|
||||
@ -17,7 +17,9 @@
|
||||
#include "nsDisplayList.h"
|
||||
|
||||
class nsTableCellFrame;
|
||||
class nsTableCellMap;
|
||||
class nsTableColFrame;
|
||||
class nsColGroupFrame;
|
||||
class nsTableRowGroupFrame;
|
||||
class nsTableRowFrame;
|
||||
class nsTableColGroupFrame;
|
||||
@ -103,7 +105,7 @@ private:
|
||||
* The principal child list contains row group frames. There is also an
|
||||
* additional child list, kColGroupList, which contains the col group frames.
|
||||
*/
|
||||
class nsTableFrame : public nsContainerFrame, public nsITableLayout
|
||||
class nsTableFrame : public nsContainerFrame
|
||||
{
|
||||
public:
|
||||
NS_DECL_QUERYFRAME
|
||||
@ -461,9 +463,6 @@ public:
|
||||
bool aRemoveFromCache,
|
||||
bool aRemoveFromCellMap);
|
||||
|
||||
NS_IMETHOD GetIndexByRowAndColumn(int32_t aRow, int32_t aColumn, int32_t *aIndex);
|
||||
NS_IMETHOD GetRowAndColumnByIndex(int32_t aIndex, int32_t *aRow, int32_t *aColumn);
|
||||
|
||||
bool ColumnHasCellSpacingBefore(int32_t aColIndex) const;
|
||||
|
||||
bool HasPctCol() const;
|
||||
@ -722,24 +721,6 @@ public: /* ----- Cell Map public methods ----- */
|
||||
/** returns true if table-layout:auto */
|
||||
virtual bool IsAutoLayout();
|
||||
|
||||
/*---------------- nsITableLayout methods ------------------------*/
|
||||
|
||||
/** Get the cell and associated data for a table cell from the frame's cellmap */
|
||||
NS_IMETHOD GetCellDataAt(int32_t aRowIndex, int32_t aColIndex,
|
||||
nsIDOMElement* &aCell, //out params
|
||||
int32_t& aStartRowIndex, int32_t& aStartColIndex,
|
||||
int32_t& aRowSpan, int32_t& aColSpan,
|
||||
int32_t& aActualRowSpan, int32_t& aActualColSpan,
|
||||
bool& aIsSelected);
|
||||
|
||||
/** Get the number of rows and column for a table from the frame's cellmap
|
||||
* Some rows may not have enough cells (the number returned is the maximum possible),
|
||||
* which displays as a ragged-right edge table
|
||||
*/
|
||||
NS_IMETHOD GetTableSize(int32_t& aRowCount, int32_t& aColCount);
|
||||
|
||||
/*------------end of nsITableLayout methods -----------------------*/
|
||||
|
||||
public:
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -4,6 +4,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#include "nsTableOuterFrame.h"
|
||||
#include "nsTableFrame.h"
|
||||
#include "nsTableCellFrame.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsPresContext.h"
|
||||
@ -150,7 +151,7 @@ nsTableOuterFrame::~nsTableOuterFrame()
|
||||
}
|
||||
|
||||
NS_QUERYFRAME_HEAD(nsTableOuterFrame)
|
||||
NS_QUERYFRAME_ENTRY(nsITableLayout)
|
||||
NS_QUERYFRAME_ENTRY(nsTableOuterFrame)
|
||||
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
@ -1064,46 +1065,22 @@ nsTableOuterFrame::GetType() const
|
||||
|
||||
/* ----- global methods ----- */
|
||||
|
||||
/*------------------ nsITableLayout methods ------------------------------*/
|
||||
NS_IMETHODIMP
|
||||
nsTableOuterFrame::GetCellDataAt(int32_t aRowIndex, int32_t aColIndex,
|
||||
nsIDOMElement* &aCell, //out params
|
||||
int32_t& aStartRowIndex, int32_t& aStartColIndex,
|
||||
int32_t& aRowSpan, int32_t& aColSpan,
|
||||
int32_t& aActualRowSpan, int32_t& aActualColSpan,
|
||||
bool& aIsSelected)
|
||||
nsIContent*
|
||||
nsTableOuterFrame::GetCellAt(uint32_t aRowIdx, uint32_t aColIdx) const
|
||||
{
|
||||
return InnerTableFrame()->GetCellDataAt(aRowIndex, aColIndex, aCell,
|
||||
aStartRowIndex, aStartColIndex,
|
||||
aRowSpan, aColSpan, aActualRowSpan,
|
||||
aActualColSpan, aIsSelected);
|
||||
}
|
||||
nsTableCellMap* cellMap = InnerTableFrame()->GetCellMap();
|
||||
if (!cellMap) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTableOuterFrame::GetTableSize(int32_t& aRowCount, int32_t& aColCount)
|
||||
{
|
||||
return InnerTableFrame()->GetTableSize(aRowCount, aColCount);
|
||||
}
|
||||
nsTableCellFrame* cell = cellMap->GetCellInfoAt(aRowIdx, aColIdx);
|
||||
if (!cell) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTableOuterFrame::GetIndexByRowAndColumn(int32_t aRow, int32_t aColumn,
|
||||
int32_t *aIndex)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIndex);
|
||||
return InnerTableFrame()->GetIndexByRowAndColumn(aRow, aColumn, aIndex);
|
||||
return cell->GetContent();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTableOuterFrame::GetRowAndColumnByIndex(int32_t aIndex,
|
||||
int32_t *aRow, int32_t *aColumn)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRow);
|
||||
NS_ENSURE_ARG_POINTER(aColumn);
|
||||
return InnerTableFrame()->GetRowAndColumnByIndex(aIndex, aRow, aColumn);
|
||||
}
|
||||
|
||||
/*---------------- end of nsITableLayout implementation ------------------*/
|
||||
|
||||
|
||||
nsIFrame*
|
||||
NS_NewTableOuterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
||||
|
@ -8,8 +8,8 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nscore.h"
|
||||
#include "nsContainerFrame.h"
|
||||
#include "nsCellMap.h"
|
||||
#include "nsBlockFrame.h"
|
||||
#include "nsITableLayout.h"
|
||||
#include "nsTableFrame.h"
|
||||
|
||||
class nsTableCaptionFrame : public nsBlockFrame
|
||||
@ -51,12 +51,14 @@ protected:
|
||||
* the nsTableOuterFrame contains 0 or one caption frame, and a nsTableFrame
|
||||
* pseudo-frame (referred to as the "inner frame').
|
||||
*/
|
||||
class nsTableOuterFrame : public nsContainerFrame, public nsITableLayout
|
||||
class nsTableOuterFrame : public nsContainerFrame
|
||||
{
|
||||
public:
|
||||
NS_DECL_QUERYFRAME
|
||||
NS_DECL_FRAMEARENA_HELPERS
|
||||
|
||||
NS_DECL_QUERYFRAME_TARGET(nsTableOuterFrame)
|
||||
|
||||
/** instantiate a new instance of nsTableRowFrame.
|
||||
* @param aPresShell the pres shell for this frame
|
||||
*
|
||||
@ -130,21 +132,82 @@ public:
|
||||
|
||||
virtual nsIFrame* GetParentStyleContextFrame() const MOZ_OVERRIDE;
|
||||
|
||||
/*---------------- nsITableLayout methods ------------------------*/
|
||||
/**
|
||||
* Return the content for the cell at the given row and column.
|
||||
*/
|
||||
nsIContent* GetCellAt(uint32_t aRowIdx, uint32_t aColIdx) const;
|
||||
|
||||
/** @see nsITableFrame::GetCellDataAt */
|
||||
NS_IMETHOD GetCellDataAt(int32_t aRowIndex, int32_t aColIndex,
|
||||
nsIDOMElement* &aCell, //out params
|
||||
int32_t& aStartRowIndex, int32_t& aStartColIndex,
|
||||
int32_t& aRowSpan, int32_t& aColSpan,
|
||||
int32_t& aActualRowSpan, int32_t& aActualColSpan,
|
||||
bool& aIsSelected);
|
||||
/**
|
||||
* Return the number of rows in the table.
|
||||
*/
|
||||
int32_t GetRowCount() const
|
||||
{
|
||||
return InnerTableFrame()->GetRowCount();
|
||||
}
|
||||
|
||||
/** @see nsITableFrame::GetTableSize */
|
||||
NS_IMETHOD GetTableSize(int32_t& aRowCount, int32_t& aColCount) MOZ_OVERRIDE;
|
||||
/**
|
||||
* Return the number of columns in the table.
|
||||
*/
|
||||
int32_t GetColCount() const
|
||||
{
|
||||
return InnerTableFrame()->GetColCount();
|
||||
}
|
||||
|
||||
NS_IMETHOD GetIndexByRowAndColumn(int32_t aRow, int32_t aColumn, int32_t *aIndex) MOZ_OVERRIDE;
|
||||
NS_IMETHOD GetRowAndColumnByIndex(int32_t aIndex, int32_t *aRow, int32_t *aColumn) MOZ_OVERRIDE;
|
||||
/**
|
||||
* Return the index of the cell at the given row and column.
|
||||
*/
|
||||
int32_t GetIndexByRowAndColumn(int32_t aRowIdx, int32_t aColIdx) const
|
||||
{
|
||||
nsTableCellMap* cellMap = InnerTableFrame()->GetCellMap();
|
||||
if (!cellMap)
|
||||
return -1;
|
||||
|
||||
return cellMap->GetIndexByRowAndColumn(aRowIdx, aColIdx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the row and column indices for the cell at the given index.
|
||||
*/
|
||||
void GetRowAndColumnByIndex(int32_t aCellIdx, int32_t* aRowIdx,
|
||||
int32_t* aColIdx) const
|
||||
{
|
||||
*aRowIdx = *aColIdx = 0;
|
||||
nsTableCellMap* cellMap = InnerTableFrame()->GetCellMap();
|
||||
if (cellMap) {
|
||||
cellMap->GetRowAndColumnByIndex(aCellIdx, aRowIdx, aColIdx);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return the frame for the cell at the given row and column.
|
||||
*/
|
||||
nsTableCellFrame* GetCellFrameAt(uint32_t aRowIdx, uint32_t aColIdx) const
|
||||
{
|
||||
nsTableCellMap* map = InnerTableFrame()->GetCellMap();
|
||||
if (!map) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return map->GetCellInfoAt(aRowIdx, aColIdx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the col span of the cell at the given row and column indices.
|
||||
*/
|
||||
uint32_t GetEffectiveColSpanAt(uint32_t aRowIdx, uint32_t aColIdx) const
|
||||
{
|
||||
nsTableCellMap* map = InnerTableFrame()->GetCellMap();
|
||||
return map->GetEffectiveColSpan(aRowIdx, aColIdx);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the effective row span of the cell at the given row and column.
|
||||
*/
|
||||
uint32_t GetEffectiveRowSpanAt(uint32_t aRowIdx, uint32_t aColIdx) const
|
||||
{
|
||||
nsTableCellMap* map = InnerTableFrame()->GetCellMap();
|
||||
return map->GetEffectiveRowSpan(aRowIdx, aColIdx);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user