зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1482389, remove methods of XULTreeElement that return unused nsresults. In addition, change GetView to return the nsITreeView instead of using an out-parameter, r=paolo
This commit is contained in:
Родитель
8a34b15d64
Коммит
52a756d064
|
@ -66,8 +66,7 @@ bool nsCoreUtils::HasClickListener(nsIContent *aContent) {
|
||||||
void nsCoreUtils::DispatchClickEvent(XULTreeElement *aTree,
|
void nsCoreUtils::DispatchClickEvent(XULTreeElement *aTree,
|
||||||
int32_t aRowIndex, nsTreeColumn *aColumn,
|
int32_t aRowIndex, nsTreeColumn *aColumn,
|
||||||
const nsAString &aPseudoElt) {
|
const nsAString &aPseudoElt) {
|
||||||
RefPtr<dom::Element> tcElm;
|
RefPtr<dom::Element> tcElm = aTree->GetTreeBody();
|
||||||
aTree->GetTreeBody(getter_AddRefs(tcElm));
|
|
||||||
if (!tcElm) return;
|
if (!tcElm) return;
|
||||||
|
|
||||||
Document *document = tcElm->GetUncomposedDoc();
|
Document *document = tcElm->GetUncomposedDoc();
|
||||||
|
@ -80,10 +79,12 @@ void nsCoreUtils::DispatchClickEvent(XULTreeElement *aTree,
|
||||||
aTree->EnsureRowIsVisible(aRowIndex);
|
aTree->EnsureRowIsVisible(aRowIndex);
|
||||||
|
|
||||||
// Calculate x and y coordinates.
|
// Calculate x and y coordinates.
|
||||||
int32_t x = 0, y = 0, width = 0, height = 0;
|
nsresult rv;
|
||||||
nsresult rv = aTree->GetCoordsForCellItem(aRowIndex, aColumn, aPseudoElt, &x,
|
nsIntRect rect =
|
||||||
&y, &width, &height);
|
aTree->GetCoordsForCellItem(aRowIndex, aColumn, aPseudoElt, rv);
|
||||||
if (NS_FAILED(rv)) return;
|
if (NS_FAILED(rv)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIBoxObject> tcBoxObj =
|
nsCOMPtr<nsIBoxObject> tcBoxObj =
|
||||||
nsXULElement::FromNode(tcElm)->GetBoxObject(IgnoreErrors());
|
nsXULElement::FromNode(tcElm)->GetBoxObject(IgnoreErrors());
|
||||||
|
@ -103,9 +104,9 @@ void nsCoreUtils::DispatchClickEvent(XULTreeElement *aTree,
|
||||||
|
|
||||||
RefPtr<nsPresContext> presContext = presShell->GetPresContext();
|
RefPtr<nsPresContext> presContext = presShell->GetPresContext();
|
||||||
|
|
||||||
int32_t cnvdX = presContext->CSSPixelsToDevPixels(tcX + x + 1) +
|
int32_t cnvdX = presContext->CSSPixelsToDevPixels(tcX + int32_t(rect.x) + 1) +
|
||||||
presContext->AppUnitsToDevPixels(offset.x);
|
presContext->AppUnitsToDevPixels(offset.x);
|
||||||
int32_t cnvdY = presContext->CSSPixelsToDevPixels(tcY + y + 1) +
|
int32_t cnvdY = presContext->CSSPixelsToDevPixels(tcY + int32_t(rect.y) + 1) +
|
||||||
presContext->AppUnitsToDevPixels(offset.y);
|
presContext->AppUnitsToDevPixels(offset.y);
|
||||||
|
|
||||||
// XUL is just desktop, so there is no real reason for senfing touch events.
|
// XUL is just desktop, so there is no real reason for senfing touch events.
|
||||||
|
@ -426,8 +427,7 @@ void nsCoreUtils::GetLanguageFor(nsIContent *aContent, nsIContent *aRootContent,
|
||||||
|
|
||||||
already_AddRefed<nsIBoxObject> nsCoreUtils::GetTreeBodyBoxObject(
|
already_AddRefed<nsIBoxObject> nsCoreUtils::GetTreeBodyBoxObject(
|
||||||
XULTreeElement *aTree) {
|
XULTreeElement *aTree) {
|
||||||
RefPtr<dom::Element> tcElm;
|
RefPtr<dom::Element> tcElm = aTree->GetTreeBody();
|
||||||
aTree->GetTreeBody(getter_AddRefs(tcElm));
|
|
||||||
RefPtr<nsXULElement> tcXULElm = nsXULElement::FromNodeOrNull(tcElm);
|
RefPtr<nsXULElement> tcXULElm = nsXULElement::FromNodeOrNull(tcElm);
|
||||||
if (!tcXULElm) return nullptr;
|
if (!tcXULElm) return nullptr;
|
||||||
|
|
||||||
|
@ -449,8 +449,7 @@ XULTreeElement *nsCoreUtils::GetTree(nsIContent *aContent) {
|
||||||
|
|
||||||
already_AddRefed<nsTreeColumn> nsCoreUtils::GetFirstSensibleColumn(
|
already_AddRefed<nsTreeColumn> nsCoreUtils::GetFirstSensibleColumn(
|
||||||
XULTreeElement *aTree) {
|
XULTreeElement *aTree) {
|
||||||
RefPtr<nsTreeColumns> cols;
|
RefPtr<nsTreeColumns> cols = aTree->GetColumns();
|
||||||
aTree->GetColumns(getter_AddRefs(cols));
|
|
||||||
if (!cols) return nullptr;
|
if (!cols) return nullptr;
|
||||||
|
|
||||||
RefPtr<nsTreeColumn> column = cols->GetFirstColumn();
|
RefPtr<nsTreeColumn> column = cols->GetFirstColumn();
|
||||||
|
@ -462,8 +461,7 @@ already_AddRefed<nsTreeColumn> nsCoreUtils::GetFirstSensibleColumn(
|
||||||
uint32_t nsCoreUtils::GetSensibleColumnCount(XULTreeElement *aTree) {
|
uint32_t nsCoreUtils::GetSensibleColumnCount(XULTreeElement *aTree) {
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
|
|
||||||
RefPtr<nsTreeColumns> cols;
|
RefPtr<nsTreeColumns> cols = aTree->GetColumns();
|
||||||
aTree->GetColumns(getter_AddRefs(cols));
|
|
||||||
if (!cols) return count;
|
if (!cols) return count;
|
||||||
|
|
||||||
nsTreeColumn *column = cols->GetFirstColumn();
|
nsTreeColumn *column = cols->GetFirstColumn();
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "nsTreeBodyFrame.h"
|
#include "nsTreeBodyFrame.h"
|
||||||
#include "nsTreeColumns.h"
|
#include "nsTreeColumns.h"
|
||||||
#include "nsTreeUtils.h"
|
#include "nsTreeUtils.h"
|
||||||
|
#include "mozilla/dom/XULTreeElementBinding.h"
|
||||||
|
|
||||||
using namespace mozilla::a11y;
|
using namespace mozilla::a11y;
|
||||||
|
|
||||||
|
@ -113,8 +114,7 @@ void XULTreeAccessible::Value(nsString& aValue) const {
|
||||||
if (currentIndex >= 0) {
|
if (currentIndex >= 0) {
|
||||||
RefPtr<nsTreeColumn> keyCol;
|
RefPtr<nsTreeColumn> keyCol;
|
||||||
|
|
||||||
RefPtr<nsTreeColumns> cols;
|
RefPtr<nsTreeColumns> cols = mTree->GetColumns();
|
||||||
mTree->GetColumns(getter_AddRefs(cols));
|
|
||||||
if (cols) keyCol = cols->GetKeyColumn();
|
if (cols) keyCol = cols->GetKeyColumn();
|
||||||
|
|
||||||
mTreeView->GetCellText(currentIndex, keyCol, aValue);
|
mTreeView->GetCellText(currentIndex, keyCol, aValue);
|
||||||
|
@ -171,23 +171,21 @@ Accessible* XULTreeAccessible::ChildAtPoint(int32_t aX, int32_t aY,
|
||||||
int32_t clientX = presContext->DevPixelsToIntCSSPixels(aX) - rootRect.X();
|
int32_t clientX = presContext->DevPixelsToIntCSSPixels(aX) - rootRect.X();
|
||||||
int32_t clientY = presContext->DevPixelsToIntCSSPixels(aY) - rootRect.Y();
|
int32_t clientY = presContext->DevPixelsToIntCSSPixels(aY) - rootRect.Y();
|
||||||
|
|
||||||
int32_t row = -1;
|
ErrorResult rv;
|
||||||
RefPtr<nsTreeColumn> column;
|
dom::TreeCellInfo cellInfo;
|
||||||
nsAutoString childEltUnused;
|
mTree->GetCellAt(clientX, clientY, cellInfo, rv);
|
||||||
mTree->GetCellAt(clientX, clientY, &row, getter_AddRefs(column),
|
|
||||||
childEltUnused);
|
|
||||||
|
|
||||||
// If we failed to find tree cell for the given point then it might be
|
// If we failed to find tree cell for the given point then it might be
|
||||||
// tree columns.
|
// tree columns.
|
||||||
if (row == -1 || !column)
|
if (cellInfo.mRow == -1 || !cellInfo.mCol)
|
||||||
return AccessibleWrap::ChildAtPoint(aX, aY, aWhichChild);
|
return AccessibleWrap::ChildAtPoint(aX, aY, aWhichChild);
|
||||||
|
|
||||||
Accessible* child = GetTreeItemAccessible(row);
|
Accessible* child = GetTreeItemAccessible(cellInfo.mRow);
|
||||||
if (aWhichChild == eDeepestChild && child) {
|
if (aWhichChild == eDeepestChild && child) {
|
||||||
// Look for accessible cell for the found item accessible.
|
// Look for accessible cell for the found item accessible.
|
||||||
RefPtr<XULTreeItemAccessibleBase> treeitem = do_QueryObject(child);
|
RefPtr<XULTreeItemAccessibleBase> treeitem = do_QueryObject(child);
|
||||||
|
|
||||||
Accessible* cell = treeitem->GetCellAccessible(column);
|
Accessible* cell = treeitem->GetCellAccessible(cellInfo.mCol);
|
||||||
if (cell) child = cell;
|
if (cell) child = cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -524,8 +522,7 @@ void XULTreeAccessible::TreeViewInvalidated(int32_t aStartRow, int32_t aEndRow,
|
||||||
endRow = rowCount - 1;
|
endRow = rowCount - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<nsTreeColumns> treeColumns;
|
RefPtr<nsTreeColumns> treeColumns = mTree->GetColumns();
|
||||||
mTree->GetColumns(getter_AddRefs(treeColumns));
|
|
||||||
if (!treeColumns) return;
|
if (!treeColumns) return;
|
||||||
|
|
||||||
int32_t endCol = aEndCol;
|
int32_t endCol = aEndCol;
|
||||||
|
@ -625,23 +622,19 @@ nsIntRect XULTreeItemAccessibleBase::BoundsInCSSPixels() const {
|
||||||
|
|
||||||
RefPtr<nsTreeColumn> column = nsCoreUtils::GetFirstSensibleColumn(mTree);
|
RefPtr<nsTreeColumn> column = nsCoreUtils::GetFirstSensibleColumn(mTree);
|
||||||
|
|
||||||
int32_t x = 0, y = 0, width = 0, height = 0;
|
nsresult rv;
|
||||||
nsresult rv = mTree->GetCoordsForCellItem(mRow, column, EmptyString(), &x, &y,
|
nsIntRect rect =
|
||||||
&width, &height);
|
mTree->GetCoordsForCellItem(mRow, column, NS_LITERAL_STRING("cell"), rv);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return nsIntRect();
|
return nsIntRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
boxObj->GetWidth(&width);
|
boxObj->GetWidth(&rect.width);
|
||||||
|
|
||||||
int32_t tcX = 0, tcY = 0;
|
int32_t tcX = 0, tcY = 0;
|
||||||
boxObj->GetScreenX(&tcX);
|
boxObj->GetScreenX(&tcX);
|
||||||
boxObj->GetScreenY(&tcY);
|
boxObj->GetScreenY(&tcY);
|
||||||
|
return nsIntRect(tcX, rect.y + tcY, rect.width, rect.height);
|
||||||
x = tcX;
|
|
||||||
y += tcY;
|
|
||||||
|
|
||||||
return nsIntRect(x, y, width, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRect XULTreeItemAccessibleBase::BoundsInAppUnits() const {
|
nsRect XULTreeItemAccessibleBase::BoundsInAppUnits() const {
|
||||||
|
@ -806,9 +799,8 @@ uint64_t XULTreeItemAccessibleBase::NativeState() const {
|
||||||
if (FocusMgr()->IsFocused(this)) state |= states::FOCUSED;
|
if (FocusMgr()->IsFocused(this)) state |= states::FOCUSED;
|
||||||
|
|
||||||
// invisible state
|
// invisible state
|
||||||
int32_t firstVisibleRow, lastVisibleRow;
|
int32_t firstVisibleRow = mTree->GetFirstVisibleRow();
|
||||||
mTree->GetFirstVisibleRow(&firstVisibleRow);
|
int32_t lastVisibleRow = mTree->GetLastVisibleRow();
|
||||||
mTree->GetLastVisibleRow(&lastVisibleRow);
|
|
||||||
if (mRow < firstVisibleRow || mRow > lastVisibleRow)
|
if (mRow < firstVisibleRow || mRow > lastVisibleRow)
|
||||||
state |= states::INVISIBLE;
|
state |= states::INVISIBLE;
|
||||||
|
|
||||||
|
@ -837,8 +829,7 @@ void XULTreeItemAccessibleBase::DispatchClickEvent(
|
||||||
nsIContent* aContent, uint32_t aActionIndex) const {
|
nsIContent* aContent, uint32_t aActionIndex) const {
|
||||||
if (IsDefunct()) return;
|
if (IsDefunct()) return;
|
||||||
|
|
||||||
RefPtr<nsTreeColumns> columns;
|
RefPtr<nsTreeColumns> columns = mTree->GetColumns();
|
||||||
mTree->GetColumns(getter_AddRefs(columns));
|
|
||||||
if (!columns) return;
|
if (!columns) return;
|
||||||
|
|
||||||
// Get column and pseudo element.
|
// Get column and pseudo element.
|
||||||
|
@ -874,8 +865,7 @@ bool XULTreeItemAccessibleBase::IsExpandable() const {
|
||||||
bool isEmpty = false;
|
bool isEmpty = false;
|
||||||
mTreeView->IsContainerEmpty(mRow, &isEmpty);
|
mTreeView->IsContainerEmpty(mRow, &isEmpty);
|
||||||
if (!isEmpty) {
|
if (!isEmpty) {
|
||||||
RefPtr<nsTreeColumns> columns;
|
RefPtr<nsTreeColumns> columns = mTree->GetColumns();
|
||||||
mTree->GetColumns(getter_AddRefs(columns));
|
|
||||||
if (columns) {
|
if (columns) {
|
||||||
nsTreeColumn* primaryColumn = columns->GetPrimaryColumn();
|
nsTreeColumn* primaryColumn = columns->GetPrimaryColumn();
|
||||||
if (primaryColumn && !nsCoreUtils::IsColumnHidden(primaryColumn))
|
if (primaryColumn && !nsCoreUtils::IsColumnHidden(primaryColumn))
|
||||||
|
@ -946,8 +936,7 @@ void XULTreeItemAccessible::Shutdown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
role XULTreeItemAccessible::NativeRole() const {
|
role XULTreeItemAccessible::NativeRole() const {
|
||||||
RefPtr<nsTreeColumns> columns;
|
RefPtr<nsTreeColumns> columns = mTree->GetColumns();
|
||||||
mTree->GetColumns(getter_AddRefs(columns));
|
|
||||||
if (!columns) {
|
if (!columns) {
|
||||||
NS_ERROR("No tree columns object in the tree!");
|
NS_ERROR("No tree columns object in the tree!");
|
||||||
return roles::NOTHING;
|
return roles::NOTHING;
|
||||||
|
@ -989,8 +978,7 @@ Accessible* XULTreeColumAccessible::GetSiblingAtOffset(int32_t aOffset,
|
||||||
|
|
||||||
RefPtr<dom::XULTreeElement> tree = nsCoreUtils::GetTree(mContent);
|
RefPtr<dom::XULTreeElement> tree = nsCoreUtils::GetTree(mContent);
|
||||||
if (tree) {
|
if (tree) {
|
||||||
nsCOMPtr<nsITreeView> treeView;
|
nsCOMPtr<nsITreeView> treeView = tree->GetView();
|
||||||
tree->GetView(getter_AddRefs(treeView));
|
|
||||||
if (treeView) {
|
if (treeView) {
|
||||||
int32_t rowCount = 0;
|
int32_t rowCount = 0;
|
||||||
treeView->GetRowCount(&rowCount);
|
treeView->GetRowCount(&rowCount);
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "nsComponentManagerUtils.h"
|
#include "nsComponentManagerUtils.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
#include "mozilla/dom/TreeColumnBinding.h"
|
#include "mozilla/dom/TreeColumnBinding.h"
|
||||||
|
#include "mozilla/dom/XULTreeElementBinding.h"
|
||||||
|
|
||||||
using namespace mozilla::a11y;
|
using namespace mozilla::a11y;
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
@ -169,8 +170,7 @@ void XULTreeGridAccessible::UnselectRow(uint32_t aRowIdx) {
|
||||||
// XULTreeGridAccessible: Accessible implementation
|
// XULTreeGridAccessible: Accessible implementation
|
||||||
|
|
||||||
role XULTreeGridAccessible::NativeRole() const {
|
role XULTreeGridAccessible::NativeRole() const {
|
||||||
RefPtr<nsTreeColumns> treeColumns;
|
RefPtr<nsTreeColumns> treeColumns = mTree->GetColumns();
|
||||||
mTree->GetColumns(getter_AddRefs(treeColumns));
|
|
||||||
if (!treeColumns) {
|
if (!treeColumns) {
|
||||||
NS_ERROR("No treecolumns object for tree!");
|
NS_ERROR("No treecolumns object for tree!");
|
||||||
return roles::NOTHING;
|
return roles::NOTHING;
|
||||||
|
@ -268,16 +268,14 @@ Accessible* XULTreeGridRowAccessible::ChildAtPoint(
|
||||||
int32_t clientX = presContext->DevPixelsToIntCSSPixels(aX) - rootRect.X();
|
int32_t clientX = presContext->DevPixelsToIntCSSPixels(aX) - rootRect.X();
|
||||||
int32_t clientY = presContext->DevPixelsToIntCSSPixels(aY) - rootRect.Y();
|
int32_t clientY = presContext->DevPixelsToIntCSSPixels(aY) - rootRect.Y();
|
||||||
|
|
||||||
int32_t row = -1;
|
ErrorResult rv;
|
||||||
RefPtr<nsTreeColumn> column;
|
dom::TreeCellInfo cellInfo;
|
||||||
nsAutoString childEltUnused;
|
mTree->GetCellAt(clientX, clientY, cellInfo, rv);
|
||||||
mTree->GetCellAt(clientX, clientY, &row, getter_AddRefs(column),
|
|
||||||
childEltUnused);
|
|
||||||
|
|
||||||
// Return if we failed to find tree cell in the row for the given point.
|
// Return if we failed to find tree cell in the row for the given point.
|
||||||
if (row != mRow || !column) return nullptr;
|
if (cellInfo.mRow != mRow || !cellInfo.mCol) return nullptr;
|
||||||
|
|
||||||
return GetCellAccessible(column);
|
return GetCellAccessible(cellInfo.mCol);
|
||||||
}
|
}
|
||||||
|
|
||||||
Accessible* XULTreeGridRowAccessible::GetChildAt(uint32_t aIndex) const {
|
Accessible* XULTreeGridRowAccessible::GetChildAt(uint32_t aIndex) const {
|
||||||
|
@ -314,8 +312,7 @@ XULTreeGridCellAccessible* XULTreeGridRowAccessible::GetCellAccessible(
|
||||||
|
|
||||||
void XULTreeGridRowAccessible::RowInvalidated(int32_t aStartColIdx,
|
void XULTreeGridRowAccessible::RowInvalidated(int32_t aStartColIdx,
|
||||||
int32_t aEndColIdx) {
|
int32_t aEndColIdx) {
|
||||||
RefPtr<nsTreeColumns> treeColumns;
|
RefPtr<nsTreeColumns> treeColumns = mTree->GetColumns();
|
||||||
mTree->GetColumns(getter_AddRefs(treeColumns));
|
|
||||||
if (!treeColumns) return;
|
if (!treeColumns) return;
|
||||||
|
|
||||||
bool nameChanged = false;
|
bool nameChanged = false;
|
||||||
|
@ -410,9 +407,9 @@ nsIntRect XULTreeGridCellAccessible::BoundsInCSSPixels() const {
|
||||||
return nsIntRect();
|
return nsIntRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t x = 0, y = 0, width = 0, height = 0;
|
nsresult rv;
|
||||||
nsresult rv = mTree->GetCoordsForCellItem(
|
nsIntRect rect =
|
||||||
mRow, mColumn, NS_LITERAL_STRING("cell"), &x, &y, &width, &height);
|
mTree->GetCoordsForCellItem(mRow, mColumn, NS_LITERAL_STRING("cell"), rv);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
return nsIntRect();
|
return nsIntRect();
|
||||||
}
|
}
|
||||||
|
@ -420,10 +417,7 @@ nsIntRect XULTreeGridCellAccessible::BoundsInCSSPixels() const {
|
||||||
int32_t tcX = 0, tcY = 0;
|
int32_t tcX = 0, tcY = 0;
|
||||||
boxObj->GetScreenX(&tcX);
|
boxObj->GetScreenX(&tcX);
|
||||||
boxObj->GetScreenY(&tcY);
|
boxObj->GetScreenY(&tcY);
|
||||||
x += tcX;
|
return nsIntRect(rect.x + tcX, rect.y + tcY, rect.width, rect.height);
|
||||||
y += tcY;
|
|
||||||
|
|
||||||
return nsIntRect(x, y, width, height);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRect XULTreeGridCellAccessible::BoundsInAppUnits() const {
|
nsRect XULTreeGridCellAccessible::BoundsInAppUnits() const {
|
||||||
|
|
|
@ -110,41 +110,30 @@ nsTreeBodyFrame* XULTreeElement::GetTreeBodyFrame(bool aFlushLayout) {
|
||||||
return mTreeBody;
|
return mTreeBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult XULTreeElement::GetView(nsITreeView** aView) {
|
already_AddRefed<nsITreeView> XULTreeElement::GetView() {
|
||||||
if (!mTreeBody) {
|
if (!mTreeBody) {
|
||||||
if (!GetTreeBodyFrame()) {
|
if (!GetTreeBodyFrame()) {
|
||||||
// Don't return an uninitialised view
|
return nullptr;
|
||||||
*aView = nullptr;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mView) {
|
if (mView) {
|
||||||
|
nsCOMPtr<nsITreeView> view;
|
||||||
// Our new frame needs to initialise itself
|
// Our new frame needs to initialise itself
|
||||||
return mTreeBody->GetView(aView);
|
mTreeBody->GetView(getter_AddRefs(view));
|
||||||
|
return view.forget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!mView) {
|
if (!mView) {
|
||||||
// No tree builder, create a tree content view.
|
// No tree builder, create a tree content view.
|
||||||
nsresult rv = NS_NewTreeContentView(getter_AddRefs(mView));
|
if (NS_FAILED(NS_NewTreeContentView(getter_AddRefs(mView)))) {
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
// Initialise the frame and view
|
// Initialise the frame and view
|
||||||
mTreeBody->SetView(mView);
|
mTreeBody->SetView(mView);
|
||||||
}
|
}
|
||||||
NS_IF_ADDREF(*aView = mView);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
already_AddRefed<nsITreeView> XULTreeElement::GetView(CallerType /* unused */) {
|
return do_AddRef(mView);
|
||||||
nsCOMPtr<nsITreeView> view;
|
|
||||||
GetView(getter_AddRefs(view));
|
|
||||||
return view.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult XULTreeElement::SetView(nsITreeView* aView) {
|
|
||||||
ErrorResult rv;
|
|
||||||
SetView(aView, CallerType::System, rv);
|
|
||||||
return rv.StealNSResult();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XULTreeElement::SetView(nsITreeView* aView, CallerType aCallerType,
|
void XULTreeElement::SetView(nsITreeView* aView, CallerType aCallerType,
|
||||||
|
@ -157,108 +146,98 @@ void XULTreeElement::SetView(nsITreeView* aView, CallerType aCallerType,
|
||||||
|
|
||||||
mView = aView;
|
mView = aView;
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) body->SetView(aView);
|
if (body) {
|
||||||
|
body->SetView(aView);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XULTreeElement::Focused() {
|
bool XULTreeElement::Focused() {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) return body->GetFocused();
|
if (body) {
|
||||||
|
return body->GetFocused();
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult XULTreeElement::GetFocused(bool* aFocused) {
|
|
||||||
*aFocused = Focused();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void XULTreeElement::SetFocused(bool aFocused) {
|
void XULTreeElement::SetFocused(bool aFocused) {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) body->SetFocused(aFocused);
|
if (body) {
|
||||||
}
|
body->SetFocused(aFocused);
|
||||||
|
}
|
||||||
nsresult XULTreeElement::GetTreeBody(Element** aElement) {
|
|
||||||
*aElement = nullptr;
|
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
|
||||||
if (body) return body->GetTreeBody(aElement);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<Element> XULTreeElement::GetTreeBody() {
|
already_AddRefed<Element> XULTreeElement::GetTreeBody() {
|
||||||
RefPtr<Element> el;
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
GetTreeBody(getter_AddRefs(el));
|
if (body) {
|
||||||
return el.forget();
|
nsCOMPtr<Element> element;
|
||||||
|
body->GetTreeBody(getter_AddRefs(element));
|
||||||
|
return element.forget();
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsTreeColumns> XULTreeElement::GetColumns() {
|
already_AddRefed<nsTreeColumns> XULTreeElement::GetColumns() {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) return body->Columns();
|
if (body) {
|
||||||
|
return body->Columns();
|
||||||
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult XULTreeElement::GetColumns(nsTreeColumns** aColumns) {
|
|
||||||
*aColumns = GetColumns().take();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t XULTreeElement::RowHeight() {
|
int32_t XULTreeElement::RowHeight() {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) return body->RowHeight();
|
if (body) {
|
||||||
|
return body->RowHeight();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t XULTreeElement::RowWidth() {
|
int32_t XULTreeElement::RowWidth() {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) return body->RowWidth();
|
if (body) {
|
||||||
|
return body->RowWidth();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult XULTreeElement::GetRowHeight(int32_t* aRowHeight) {
|
|
||||||
*aRowHeight = RowHeight();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult XULTreeElement::GetRowWidth(int32_t* aRowWidth) {
|
|
||||||
*aRowWidth = RowWidth();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t XULTreeElement::GetFirstVisibleRow() {
|
int32_t XULTreeElement::GetFirstVisibleRow() {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) return body->FirstVisibleRow();
|
if (body) {
|
||||||
|
return body->FirstVisibleRow();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult XULTreeElement::GetFirstVisibleRow(int32_t* aFirstVisibleRow) {
|
|
||||||
*aFirstVisibleRow = GetFirstVisibleRow();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t XULTreeElement::GetLastVisibleRow() {
|
int32_t XULTreeElement::GetLastVisibleRow() {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) return body->LastVisibleRow();
|
if (body) {
|
||||||
|
return body->LastVisibleRow();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult XULTreeElement::GetLastVisibleRow(int32_t* aLastVisibleRow) {
|
|
||||||
*aLastVisibleRow = GetLastVisibleRow();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t XULTreeElement::HorizontalPosition() {
|
int32_t XULTreeElement::HorizontalPosition() {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) return body->GetHorizontalPosition();
|
if (body) {
|
||||||
|
return body->GetHorizontalPosition();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t XULTreeElement::GetPageLength() {
|
int32_t XULTreeElement::GetPageLength() {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) return body->PageLength();
|
if (body) {
|
||||||
|
return body->PageLength();
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void XULTreeElement::EnsureRowIsVisible(int32_t aRow) {
|
void XULTreeElement::EnsureRowIsVisible(int32_t aRow) {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) body->EnsureRowIsVisible(aRow);
|
if (body) {
|
||||||
|
body->EnsureRowIsVisible(aRow);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XULTreeElement::EnsureCellIsVisible(int32_t aRow, nsTreeColumn* aCol,
|
void XULTreeElement::EnsureCellIsVisible(int32_t aRow, nsTreeColumn* aCol,
|
||||||
|
@ -291,32 +270,44 @@ void XULTreeElement::ScrollByLines(int32_t aNumLines) {
|
||||||
|
|
||||||
void XULTreeElement::ScrollByPages(int32_t aNumPages) {
|
void XULTreeElement::ScrollByPages(int32_t aNumPages) {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) body->ScrollByPages(aNumPages);
|
if (body) {
|
||||||
|
body->ScrollByPages(aNumPages);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XULTreeElement::Invalidate() {
|
void XULTreeElement::Invalidate() {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) body->Invalidate();
|
if (body) {
|
||||||
|
body->Invalidate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XULTreeElement::InvalidateColumn(nsTreeColumn* aCol) {
|
void XULTreeElement::InvalidateColumn(nsTreeColumn* aCol) {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) body->InvalidateColumn(aCol);
|
if (body) {
|
||||||
|
body->InvalidateColumn(aCol);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XULTreeElement::InvalidateRow(int32_t aIndex) {
|
void XULTreeElement::InvalidateRow(int32_t aIndex) {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) body->InvalidateRow(aIndex);
|
if (body) {
|
||||||
|
body->InvalidateRow(aIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XULTreeElement::InvalidateCell(int32_t aRow, nsTreeColumn* aCol) {
|
void XULTreeElement::InvalidateCell(int32_t aRow, nsTreeColumn* aCol) {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) body->InvalidateCell(aRow, aCol);
|
if (body) {
|
||||||
|
body->InvalidateCell(aRow, aCol);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XULTreeElement::InvalidateRange(int32_t aStart, int32_t aEnd) {
|
void XULTreeElement::InvalidateRange(int32_t aStart, int32_t aEnd) {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) body->InvalidateRange(aStart, aEnd);
|
if (body) {
|
||||||
|
body->InvalidateRange(aStart, aEnd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t XULTreeElement::GetRowAt(int32_t x, int32_t y) {
|
int32_t XULTreeElement::GetRowAt(int32_t x, int32_t y) {
|
||||||
|
@ -327,82 +318,86 @@ int32_t XULTreeElement::GetRowAt(int32_t x, int32_t y) {
|
||||||
return body->GetRowAt(x, y);
|
return body->GetRowAt(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult XULTreeElement::GetCellAt(int32_t aX, int32_t aY, int32_t* aRow,
|
void XULTreeElement::GetCellAt(int32_t aX, int32_t aY, TreeCellInfo& aRetVal,
|
||||||
nsTreeColumn** aCol, nsAString& aChildElt) {
|
ErrorResult& aRv) {
|
||||||
*aRow = 0;
|
aRetVal.mRow = 0;
|
||||||
*aCol = nullptr;
|
aRetVal.mCol = nullptr;
|
||||||
|
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) {
|
if (body) {
|
||||||
nsAutoCString element;
|
nsAutoCString element;
|
||||||
nsresult retval = body->GetCellAt(aX, aY, aRow, aCol, element);
|
body->GetCellAt(aX, aY, &aRetVal.mRow, getter_AddRefs(aRetVal.mCol),
|
||||||
CopyUTF8toUTF16(element, aChildElt);
|
element);
|
||||||
return retval;
|
CopyUTF8toUTF16(element, aRetVal.mChildElt);
|
||||||
}
|
}
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XULTreeElement::GetCellAt(int32_t x, int32_t y, TreeCellInfo& aRetVal,
|
nsIntRect XULTreeElement::GetCoordsForCellItem(int32_t aRow, nsTreeColumn* aCol,
|
||||||
ErrorResult& aRv) {
|
|
||||||
GetCellAt(x, y, &aRetVal.mRow, getter_AddRefs(aRetVal.mCol),
|
|
||||||
aRetVal.mChildElt);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult XULTreeElement::GetCoordsForCellItem(int32_t aRow, nsTreeColumn* aCol,
|
|
||||||
const nsAString& aElement,
|
const nsAString& aElement,
|
||||||
int32_t* aX, int32_t* aY,
|
nsresult& rv) {
|
||||||
int32_t* aWidth,
|
rv = NS_OK;
|
||||||
int32_t* aHeight) {
|
nsIntRect rect;
|
||||||
*aX = *aY = *aWidth = *aHeight = 0;
|
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
NS_ConvertUTF16toUTF8 element(aElement);
|
NS_ConvertUTF16toUTF8 element(aElement);
|
||||||
if (body)
|
if (body) {
|
||||||
return body->GetCoordsForCellItem(aRow, aCol, element, aX, aY, aWidth,
|
rv = body->GetCoordsForCellItem(aRow, aCol, element, &rect.x, &rect.y,
|
||||||
aHeight);
|
&rect.width, &rect.height);
|
||||||
return NS_OK;
|
}
|
||||||
|
|
||||||
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<DOMRect> XULTreeElement::GetCoordsForCellItem(
|
already_AddRefed<DOMRect> XULTreeElement::GetCoordsForCellItem(
|
||||||
int32_t row, nsTreeColumn& col, const nsAString& element,
|
int32_t aRow, nsTreeColumn& aCol, const nsAString& aElement,
|
||||||
ErrorResult& aRv) {
|
ErrorResult& aRv) {
|
||||||
int32_t x, y, w, h;
|
nsresult rv;
|
||||||
GetCoordsForCellItem(row, &col, element, &x, &y, &w, &h);
|
nsIntRect rect = GetCoordsForCellItem(aRow, &aCol, aElement, rv);
|
||||||
RefPtr<DOMRect> rect = new DOMRect(this, x, y, w, h);
|
aRv = rv;
|
||||||
return rect.forget();
|
|
||||||
|
RefPtr<DOMRect> domRect =
|
||||||
|
new DOMRect(this, rect.x, rect.y, rect.width, rect.height);
|
||||||
|
return domRect.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult XULTreeElement::IsCellCropped(int32_t aRow, nsTreeColumn* aCol,
|
bool XULTreeElement::IsCellCropped(int32_t aRow, nsTreeColumn* aCol,
|
||||||
bool* aIsCropped) {
|
ErrorResult& aRv) {
|
||||||
*aIsCropped = false;
|
bool cropped = false;
|
||||||
|
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) return body->IsCellCropped(aRow, aCol, aIsCropped);
|
if (body) {
|
||||||
return NS_OK;
|
aRv = body->IsCellCropped(aRow, aCol, &cropped);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool XULTreeElement::IsCellCropped(int32_t row, nsTreeColumn* col,
|
return cropped;
|
||||||
ErrorResult& aRv) {
|
|
||||||
bool ret;
|
|
||||||
aRv = IsCellCropped(row, col, &ret);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XULTreeElement::RowCountChanged(int32_t aIndex, int32_t aDelta) {
|
void XULTreeElement::RowCountChanged(int32_t aIndex, int32_t aDelta) {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) body->RowCountChanged(aIndex, aDelta);
|
if (body) {
|
||||||
|
body->RowCountChanged(aIndex, aDelta);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XULTreeElement::BeginUpdateBatch() {
|
void XULTreeElement::BeginUpdateBatch() {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) body->BeginUpdateBatch();
|
if (body) {
|
||||||
|
body->BeginUpdateBatch();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XULTreeElement::EndUpdateBatch() {
|
void XULTreeElement::EndUpdateBatch() {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) body->EndUpdateBatch();
|
if (body) {
|
||||||
|
body->EndUpdateBatch();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XULTreeElement::ClearStyleAndImageCaches() {
|
void XULTreeElement::ClearStyleAndImageCaches() {
|
||||||
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
nsTreeBodyFrame* body = GetTreeBodyFrame();
|
||||||
if (body) body->ClearStyleAndImageCaches();
|
if (body) {
|
||||||
|
body->ClearStyleAndImageCaches();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XULTreeElement::RemoveImageCacheEntry(int32_t aRowIndex,
|
void XULTreeElement::RemoveImageCacheEntry(int32_t aRowIndex,
|
||||||
|
|
|
@ -38,12 +38,15 @@ class XULTreeElement final : public nsXULElement {
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULTreeElement, nsXULElement)
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULTreeElement, nsXULElement)
|
||||||
|
|
||||||
nsTreeBodyFrame *GetTreeBodyFrame(bool aFlushLayout = false);
|
nsTreeBodyFrame* GetTreeBodyFrame(bool aFlushLayout = false);
|
||||||
nsTreeBodyFrame *GetCachedTreeBodyFrame() { return mTreeBody; }
|
nsTreeBodyFrame* GetCachedTreeBodyFrame() { return mTreeBody; }
|
||||||
|
|
||||||
already_AddRefed<nsTreeColumns> GetColumns();
|
already_AddRefed<nsTreeColumns> GetColumns();
|
||||||
|
|
||||||
already_AddRefed<nsITreeView> GetView(CallerType /* unused */);
|
already_AddRefed<nsITreeView> GetView(CallerType /* unused */) {
|
||||||
|
return GetView();
|
||||||
|
}
|
||||||
|
already_AddRefed<nsITreeView> GetView();
|
||||||
|
|
||||||
void SetView(nsITreeView* arg, CallerType aCallerType, ErrorResult& aRv);
|
void SetView(nsITreeView* arg, CallerType aCallerType, ErrorResult& aRv);
|
||||||
|
|
||||||
|
@ -57,7 +60,7 @@ class XULTreeElement final : public nsXULElement {
|
||||||
|
|
||||||
int32_t HorizontalPosition();
|
int32_t HorizontalPosition();
|
||||||
|
|
||||||
void EnsureCellIsVisible(int32_t row, nsTreeColumn *col, ErrorResult &aRv);
|
void EnsureCellIsVisible(int32_t row, nsTreeColumn* col, ErrorResult& aRv);
|
||||||
|
|
||||||
void ScrollToRow(int32_t aRow);
|
void ScrollToRow(int32_t aRow);
|
||||||
|
|
||||||
|
@ -73,42 +76,29 @@ class XULTreeElement final : public nsXULElement {
|
||||||
|
|
||||||
int32_t GetRowAt(int32_t x, int32_t y);
|
int32_t GetRowAt(int32_t x, int32_t y);
|
||||||
|
|
||||||
void GetCellAt(int32_t x, int32_t y, TreeCellInfo &aRetVal, ErrorResult &aRv);
|
void GetCellAt(int32_t x, int32_t y, TreeCellInfo& aRetVal, ErrorResult& aRv);
|
||||||
|
|
||||||
already_AddRefed<DOMRect> GetCoordsForCellItem(int32_t row, nsTreeColumn &col,
|
nsIntRect GetCoordsForCellItem(int32_t aRow, nsTreeColumn* aCol,
|
||||||
const nsAString &element,
|
const nsAString& aElement, nsresult& rv);
|
||||||
ErrorResult &aRv);
|
already_AddRefed<DOMRect> GetCoordsForCellItem(int32_t row, nsTreeColumn& col,
|
||||||
|
const nsAString& element,
|
||||||
|
ErrorResult& aRv);
|
||||||
|
|
||||||
bool IsCellCropped(int32_t row, nsTreeColumn *col, ErrorResult &aRv);
|
bool IsCellCropped(int32_t row, nsTreeColumn* col, ErrorResult& aRv);
|
||||||
|
|
||||||
void RemoveImageCacheEntry(int32_t row, nsTreeColumn &col, ErrorResult &aRv);
|
void RemoveImageCacheEntry(int32_t row, nsTreeColumn& col, ErrorResult& aRv);
|
||||||
|
|
||||||
void SetFocused(bool aFocused);
|
void SetFocused(bool aFocused);
|
||||||
void EnsureRowIsVisible(int32_t index);
|
void EnsureRowIsVisible(int32_t index);
|
||||||
void Invalidate(void);
|
void Invalidate(void);
|
||||||
void InvalidateColumn(nsTreeColumn *col);
|
void InvalidateColumn(nsTreeColumn* col);
|
||||||
void InvalidateRow(int32_t index);
|
void InvalidateRow(int32_t index);
|
||||||
void InvalidateCell(int32_t row, nsTreeColumn *col);
|
void InvalidateCell(int32_t row, nsTreeColumn* col);
|
||||||
void InvalidateRange(int32_t startIndex, int32_t endIndex);
|
void InvalidateRange(int32_t startIndex, int32_t endIndex);
|
||||||
void RowCountChanged(int32_t index, int32_t count);
|
void RowCountChanged(int32_t index, int32_t count);
|
||||||
void BeginUpdateBatch(void);
|
void BeginUpdateBatch(void);
|
||||||
void EndUpdateBatch(void);
|
void EndUpdateBatch(void);
|
||||||
void ClearStyleAndImageCaches(void);
|
void ClearStyleAndImageCaches(void);
|
||||||
nsresult GetColumns(nsTreeColumns **aColumns);
|
|
||||||
nsresult GetView(nsITreeView **aView);
|
|
||||||
nsresult SetView(nsITreeView *aView);
|
|
||||||
nsresult GetFocused(bool *aFocused);
|
|
||||||
nsresult GetTreeBody(mozilla::dom::Element **aTreeBody);
|
|
||||||
nsresult GetRowHeight(int32_t *aRowHeight);
|
|
||||||
nsresult GetRowWidth(int32_t *aRowWidth);
|
|
||||||
nsresult GetFirstVisibleRow(int32_t *_retval);
|
|
||||||
nsresult GetLastVisibleRow(int32_t *_retval);
|
|
||||||
nsresult GetCellAt(int32_t x, int32_t y, int32_t *row, nsTreeColumn **col,
|
|
||||||
nsAString &childElt);
|
|
||||||
nsresult GetCoordsForCellItem(int32_t row, nsTreeColumn *col,
|
|
||||||
const nsAString &element, int32_t *x,
|
|
||||||
int32_t *y, int32_t *width, int32_t *height);
|
|
||||||
nsresult IsCellCropped(int32_t row, nsTreeColumn *col, bool *_retval);
|
|
||||||
|
|
||||||
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
|
virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
|
||||||
virtual void DestroyContent() override;
|
virtual void DestroyContent() override;
|
||||||
|
@ -123,7 +113,7 @@ class XULTreeElement final : public nsXULElement {
|
||||||
protected:
|
protected:
|
||||||
int32_t mCachedFirstVisibleRow;
|
int32_t mCachedFirstVisibleRow;
|
||||||
|
|
||||||
nsTreeBodyFrame *mTreeBody;
|
nsTreeBodyFrame* mTreeBody;
|
||||||
nsCOMPtr<nsITreeView> mView;
|
nsCOMPtr<nsITreeView> mView;
|
||||||
|
|
||||||
virtual ~XULTreeElement() {}
|
virtual ~XULTreeElement() {}
|
||||||
|
|
|
@ -7984,16 +7984,14 @@ void PresShell::GetCurrentItemAndPositionForElement(
|
||||||
// which could provide the current focus coordinates?
|
// which could provide the current focus coordinates?
|
||||||
if (tree) {
|
if (tree) {
|
||||||
tree->EnsureRowIsVisible(currentIndex);
|
tree->EnsureRowIsVisible(currentIndex);
|
||||||
int32_t firstVisibleRow, rowHeight;
|
int32_t firstVisibleRow = tree->GetFirstVisibleRow();
|
||||||
tree->GetFirstVisibleRow(&firstVisibleRow);
|
int32_t rowHeight = tree->RowHeight();
|
||||||
tree->GetRowHeight(&rowHeight);
|
|
||||||
|
|
||||||
extraTreeY += nsPresContext::CSSPixelsToAppUnits(
|
extraTreeY += nsPresContext::CSSPixelsToAppUnits(
|
||||||
(currentIndex - firstVisibleRow + 1) * rowHeight);
|
(currentIndex - firstVisibleRow + 1) * rowHeight);
|
||||||
istree = true;
|
istree = true;
|
||||||
|
|
||||||
RefPtr<nsTreeColumns> cols;
|
RefPtr<nsTreeColumns> cols = tree->GetColumns();
|
||||||
tree->GetColumns(getter_AddRefs(cols));
|
|
||||||
if (cols) {
|
if (cols) {
|
||||||
nsTreeColumn* col = cols->GetFirstColumn();
|
nsTreeColumn* col = cols->GetFirstColumn();
|
||||||
if (col) {
|
if (col) {
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "mozilla/dom/BoxObject.h"
|
#include "mozilla/dom/BoxObject.h"
|
||||||
#include "mozilla/dom/MouseEvent.h"
|
#include "mozilla/dom/MouseEvent.h"
|
||||||
#include "mozilla/dom/TreeColumnBinding.h"
|
#include "mozilla/dom/TreeColumnBinding.h"
|
||||||
|
#include "mozilla/dom/XULTreeElementBinding.h"
|
||||||
#include "mozilla/TextEvents.h"
|
#include "mozilla/TextEvents.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
@ -337,10 +338,6 @@ void nsXULTooltipListener::CheckTreeBodyMove(MouseEvent* aMouseEvent) {
|
||||||
int32_t x = aMouseEvent->ScreenX(CallerType::System);
|
int32_t x = aMouseEvent->ScreenX(CallerType::System);
|
||||||
int32_t y = aMouseEvent->ScreenY(CallerType::System);
|
int32_t y = aMouseEvent->ScreenY(CallerType::System);
|
||||||
|
|
||||||
int32_t row;
|
|
||||||
RefPtr<nsTreeColumn> col;
|
|
||||||
nsAutoString obj;
|
|
||||||
|
|
||||||
// subtract off the documentElement's boxObject
|
// subtract off the documentElement's boxObject
|
||||||
int32_t boxX, boxY;
|
int32_t boxX, boxY;
|
||||||
bx->GetScreenX(&boxX);
|
bx->GetScreenX(&boxX);
|
||||||
|
@ -348,7 +345,12 @@ void nsXULTooltipListener::CheckTreeBodyMove(MouseEvent* aMouseEvent) {
|
||||||
x -= boxX;
|
x -= boxX;
|
||||||
y -= boxY;
|
y -= boxY;
|
||||||
|
|
||||||
tree->GetCellAt(x, y, &row, getter_AddRefs(col), obj);
|
ErrorResult rv;
|
||||||
|
TreeCellInfo cellInfo;
|
||||||
|
tree->GetCellAt(x, y, cellInfo, rv);
|
||||||
|
|
||||||
|
int32_t row = cellInfo.mRow;
|
||||||
|
RefPtr<nsTreeColumn> col = cellInfo.mCol;
|
||||||
|
|
||||||
// determine if we are going to need a titletip
|
// determine if we are going to need a titletip
|
||||||
// XXX check the disabletitletips attribute on the tree content
|
// XXX check the disabletitletips attribute on the tree content
|
||||||
|
@ -357,9 +359,9 @@ void nsXULTooltipListener::CheckTreeBodyMove(MouseEvent* aMouseEvent) {
|
||||||
if (col) {
|
if (col) {
|
||||||
colType = col->Type();
|
colType = col->Type();
|
||||||
}
|
}
|
||||||
if (row >= 0 && obj.EqualsLiteral("text") &&
|
if (row >= 0 && cellInfo.mChildElt.EqualsLiteral("text") &&
|
||||||
colType != TreeColumn_Binding::TYPE_PASSWORD) {
|
colType != TreeColumn_Binding::TYPE_PASSWORD) {
|
||||||
tree->IsCellCropped(row, col, &mNeedTitletip);
|
mNeedTitletip = tree->IsCellCropped(row, col, rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> currentTooltip = do_QueryReferent(mCurrentTooltip);
|
nsCOMPtr<nsIContent> currentTooltip = do_QueryReferent(mCurrentTooltip);
|
||||||
|
@ -435,8 +437,7 @@ nsresult nsXULTooltipListener::ShowTooltip() {
|
||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
static void SetTitletipLabel(XULTreeElement* aTree, Element* aTooltip,
|
static void SetTitletipLabel(XULTreeElement* aTree, Element* aTooltip,
|
||||||
int32_t aRow, nsTreeColumn* aCol) {
|
int32_t aRow, nsTreeColumn* aCol) {
|
||||||
nsCOMPtr<nsITreeView> view;
|
nsCOMPtr<nsITreeView> view = aTree->GetView();
|
||||||
aTree->GetView(getter_AddRefs(view));
|
|
||||||
if (view) {
|
if (view) {
|
||||||
nsAutoString label;
|
nsAutoString label;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
|
@ -277,8 +277,7 @@ void nsTreeBodyFrame::EnsureView() {
|
||||||
|
|
||||||
RefPtr<XULTreeElement> tree = GetBaseElement();
|
RefPtr<XULTreeElement> tree = GetBaseElement();
|
||||||
if (tree) {
|
if (tree) {
|
||||||
nsCOMPtr<nsITreeView> treeView;
|
nsCOMPtr<nsITreeView> treeView = tree->GetView();
|
||||||
tree->GetView(getter_AddRefs(treeView));
|
|
||||||
if (treeView && weakFrame.IsAlive()) {
|
if (treeView && weakFrame.IsAlive()) {
|
||||||
int32_t rowIndex = tree->GetCachedTopVisibleRow();
|
int32_t rowIndex = tree->GetCachedTopVisibleRow();
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ void nsTreeColFrame::InvalidateColumns(bool aCanWalkFrameTree) {
|
||||||
RefPtr<nsTreeColumns> columns;
|
RefPtr<nsTreeColumns> columns;
|
||||||
|
|
||||||
if (aCanWalkFrameTree) {
|
if (aCanWalkFrameTree) {
|
||||||
tree->GetColumns(getter_AddRefs(columns));
|
columns = tree->GetColumns();
|
||||||
} else {
|
} else {
|
||||||
nsTreeBodyFrame* body = tree->GetCachedTreeBodyFrame();
|
nsTreeBodyFrame* body = tree->GetCachedTreeBodyFrame();
|
||||||
if (body) {
|
if (body) {
|
||||||
|
|
|
@ -518,8 +518,7 @@ nsTreeContentView::SetTree(XULTreeElement* aTree) {
|
||||||
mDocument = document;
|
mDocument = document;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<dom::Element> bodyElement;
|
RefPtr<dom::Element> bodyElement = mTree->GetTreeBody();
|
||||||
mTree->GetTreeBody(getter_AddRefs(bodyElement));
|
|
||||||
if (bodyElement) {
|
if (bodyElement) {
|
||||||
mBody = bodyElement.forget();
|
mBody = bodyElement.forget();
|
||||||
int32_t index = 0;
|
int32_t index = 0;
|
||||||
|
@ -779,8 +778,7 @@ void nsTreeContentView::AttributeChanged(dom::Element* aElement,
|
||||||
if (aElement->IsXULElement(nsGkAtoms::treecol)) {
|
if (aElement->IsXULElement(nsGkAtoms::treecol)) {
|
||||||
if (aAttribute == nsGkAtoms::properties) {
|
if (aAttribute == nsGkAtoms::properties) {
|
||||||
if (mTree) {
|
if (mTree) {
|
||||||
RefPtr<nsTreeColumns> cols;
|
RefPtr<nsTreeColumns> cols = mTree->GetColumns();
|
||||||
mTree->GetColumns(getter_AddRefs(cols));
|
|
||||||
if (cols) {
|
if (cols) {
|
||||||
RefPtr<nsTreeColumn> col = cols->GetColumnFor(aElement);
|
RefPtr<nsTreeColumn> col = cols->GetColumnFor(aElement);
|
||||||
mTree->InvalidateColumn(col);
|
mTree->InvalidateColumn(col);
|
||||||
|
|
|
@ -466,8 +466,7 @@ NS_IMETHODIMP nsTreeSelection::InvertSelection() {
|
||||||
NS_IMETHODIMP nsTreeSelection::SelectAll() {
|
NS_IMETHODIMP nsTreeSelection::SelectAll() {
|
||||||
if (!mTree) return NS_OK;
|
if (!mTree) return NS_OK;
|
||||||
|
|
||||||
nsCOMPtr<nsITreeView> view;
|
nsCOMPtr<nsITreeView> view = mTree->GetView();
|
||||||
mTree->GetView(getter_AddRefs(view));
|
|
||||||
if (!view) return NS_OK;
|
if (!view) return NS_OK;
|
||||||
|
|
||||||
int32_t rowCount;
|
int32_t rowCount;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче