diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 07ceb605f484..6fff7dfb82be 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -8369,13 +8369,10 @@ PresShell::GetCurrentItemAndPositionForElement(Element* aFocusedElement, if (cols) { nsTreeColumn* col = cols->GetFirstColumn(); if (col) { - RefPtr colElement; - col->GetElement(getter_AddRefs(colElement)); - if (colElement) { - nsIFrame* frame = colElement->GetPrimaryFrame(); - if (frame) { - extraTreeY += frame->GetSize().height; - } + RefPtr colElement = col->Element(); + nsIFrame* frame = colElement->GetPrimaryFrame(); + if (frame) { + extraTreeY += frame->GetSize().height; } } } diff --git a/layout/xul/nsXULTooltipListener.cpp b/layout/xul/nsXULTooltipListener.cpp index 1392ae246106..2e4c9ecb362a 100644 --- a/layout/xul/nsXULTooltipListener.cpp +++ b/layout/xul/nsXULTooltipListener.cpp @@ -31,6 +31,7 @@ #include "mozilla/dom/Event.h" // for Event #include "mozilla/dom/BoxObject.h" #include "mozilla/dom/MouseEvent.h" +#include "mozilla/dom/TreeColumnBinding.h" #include "mozilla/TextEvents.h" using namespace mozilla; @@ -368,10 +369,10 @@ nsXULTooltipListener::CheckTreeBodyMove(MouseEvent* aMouseEvent) mNeedTitletip = false; int16_t colType = -1; if (col) { - col->GetType(&colType); + colType = col->Type(); } if (row >= 0 && obj.EqualsLiteral("text") && - colType != nsITreeColumn::TYPE_PASSWORD) { + colType != TreeColumnBinding::TYPE_PASSWORD) { obx->IsCellCropped(row, col, &mNeedTitletip); } diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index c6761d395577..8029771f38fd 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -62,6 +62,7 @@ #include "mozilla/dom/ScriptSettings.h" #include "mozilla/dom/ToJSValue.h" #include "mozilla/dom/TreeBoxObject.h" +#include "mozilla/dom/TreeColumnBinding.h" #include "nsIScriptableRegion.h" #include #include "ScrollbarActivity.h" @@ -634,13 +635,12 @@ nsTreeBodyFrame::Invalidate() } nsresult -nsTreeBodyFrame::InvalidateColumn(nsITreeColumn* aCol) +nsTreeBodyFrame::InvalidateColumn(nsTreeColumn* aCol) { if (mUpdateBatchNest) return NS_OK; - RefPtr col = GetColumnImpl(aCol); - if (!col) + if (!aCol) return NS_ERROR_INVALID_ARG; #ifdef ACCESSIBILITY @@ -649,7 +649,7 @@ nsTreeBodyFrame::InvalidateColumn(nsITreeColumn* aCol) #endif nsRect columnRect; - nsresult rv = col->GetRect(this, mInnerBox.y, mInnerBox.height, &columnRect); + nsresult rv = aCol->GetRect(this, mInnerBox.y, mInnerBox.height, &columnRect); NS_ENSURE_SUCCESS(rv, rv); // When false then column is out of view @@ -681,7 +681,7 @@ nsTreeBodyFrame::InvalidateRow(int32_t aIndex) } nsresult -nsTreeBodyFrame::InvalidateCell(int32_t aIndex, nsITreeColumn* aCol) +nsTreeBodyFrame::InvalidateCell(int32_t aIndex, nsTreeColumn* aCol) { if (mUpdateBatchNest) return NS_OK; @@ -695,13 +695,12 @@ nsTreeBodyFrame::InvalidateCell(int32_t aIndex, nsITreeColumn* aCol) if (aIndex < 0 || aIndex > mPageLength) return NS_OK; - RefPtr col = GetColumnImpl(aCol); - if (!col) + if (!aCol) return NS_ERROR_INVALID_ARG; nsRect cellRect; - nsresult rv = col->GetRect(this, mInnerBox.y+mRowHeight*aIndex, mRowHeight, - &cellRect); + nsresult rv = aCol->GetRect(this, mInnerBox.y+mRowHeight*aIndex, mRowHeight, + &cellRect); NS_ENSURE_SUCCESS(rv, rv); if (OffsetForHorzScroll(cellRect, true)) @@ -744,17 +743,16 @@ nsTreeBodyFrame::InvalidateRange(int32_t aStart, int32_t aEnd) } nsresult -nsTreeBodyFrame::InvalidateColumnRange(int32_t aStart, int32_t aEnd, nsITreeColumn* aCol) +nsTreeBodyFrame::InvalidateColumnRange(int32_t aStart, int32_t aEnd, nsTreeColumn* aCol) { if (mUpdateBatchNest) return NS_OK; - RefPtr col = GetColumnImpl(aCol); - if (!col) + if (!aCol) return NS_ERROR_INVALID_ARG; if (aStart == aEnd) - return InvalidateCell(aStart, col); + return InvalidateCell(aStart, aCol); int32_t last = LastVisibleRow(); if (aStart > aEnd || aEnd < mTopRowIndex || aStart > last) @@ -775,10 +773,10 @@ nsTreeBodyFrame::InvalidateColumnRange(int32_t aStart, int32_t aEnd, nsITreeColu #endif nsRect rangeRect; - nsresult rv = col->GetRect(this, - mInnerBox.y+mRowHeight*(aStart-mTopRowIndex), - mRowHeight*(aEnd-aStart+1), - &rangeRect); + nsresult rv = aCol->GetRect(this, + mInnerBox.y+mRowHeight*(aStart-mTopRowIndex), + mRowHeight*(aEnd-aStart+1), + &rangeRect); NS_ENSURE_SUCCESS(rv, rv); InvalidateFrameWithRect(rangeRect); @@ -1097,7 +1095,7 @@ nsTreeBodyFrame::GetCellAt(int32_t aX, int32_t aY, int32_t* aRow, // You need to make sure to add in the image's margins as well. // nsresult -nsTreeBodyFrame::GetCoordsForCellItem(int32_t aRow, nsITreeColumn* aCol, const nsACString& aElement, +nsTreeBodyFrame::GetCoordsForCellItem(int32_t aRow, nsTreeColumn* aCol, const nsACString& aElement, int32_t *aX, int32_t *aY, int32_t *aWidth, int32_t *aHeight) { *aX = 0; @@ -1763,19 +1761,18 @@ nsTreeBodyFrame::GetCellWidth(int32_t aRow, nsTreeColumn* aCol, } nsresult -nsTreeBodyFrame::IsCellCropped(int32_t aRow, nsITreeColumn* aCol, bool *_retval) +nsTreeBodyFrame::IsCellCropped(int32_t aRow, nsTreeColumn* aCol, bool *_retval) { nscoord currentSize, desiredSize; nsresult rv; - RefPtr col = GetColumnImpl(aCol); - if (!col) + if (!aCol) return NS_ERROR_INVALID_ARG; RefPtr rc = PresShell()->CreateReferenceRenderingContext(); - rv = GetCellWidth(aRow, col, rc, desiredSize, currentSize); + rv = GetCellWidth(aRow, aCol, rc, desiredSize, currentSize); NS_ENSURE_SUCCESS(rv, rv); *_retval = desiredSize > currentSize; @@ -2020,7 +2017,7 @@ nsTreeBodyFrame::PrefillPropertyArray(int32_t aRowIndex, nsTreeColumn* aCol) if (aCol->IsPrimary()) mScratchArray.AppendElement(nsGkAtoms::primary); - if (aCol->GetType() == nsITreeColumn::TYPE_CHECKBOX) { + if (aCol->GetType() == TreeColumnBinding::TYPE_CHECKBOX) { mScratchArray.AppendElement(nsGkAtoms::checkbox); if (aRowIndex != -1) { @@ -3391,12 +3388,12 @@ nsTreeBodyFrame::PaintCell(int32_t aRowIndex, nsRect dirtyRect; if (dirtyRect.IntersectRect(aDirtyRect, elementRect)) { switch (aColumn->GetType()) { - case nsITreeColumn::TYPE_TEXT: - case nsITreeColumn::TYPE_PASSWORD: + case TreeColumnBinding::TYPE_TEXT: + case TreeColumnBinding::TYPE_PASSWORD: result &= PaintText(aRowIndex, aColumn, elementRect, aPresContext, aRenderingContext, aDirtyRect, currX); break; - case nsITreeColumn::TYPE_CHECKBOX: + case TreeColumnBinding::TYPE_CHECKBOX: result &= PaintCheckbox(aRowIndex, aColumn, elementRect, aPresContext, aRenderingContext, aDirtyRect); break; @@ -3709,7 +3706,7 @@ nsTreeBodyFrame::PaintText(int32_t aRowIndex, nsAutoString text; mView->GetCellText(aRowIndex, aColumn, text); - if (aColumn->Type() == nsITreeColumn::TYPE_PASSWORD) { + if (aColumn->Type() == TreeColumnBinding::TYPE_PASSWORD) { TextEditRules::FillBufWithPWChars(&text, text.Length()); } @@ -4065,10 +4062,9 @@ nsresult nsTreeBodyFrame::EnsureRowIsVisibleInternal(const ScrollParts& aParts, } nsresult -nsTreeBodyFrame::EnsureCellIsVisible(int32_t aRow, nsITreeColumn* aCol) +nsTreeBodyFrame::EnsureCellIsVisible(int32_t aRow, nsTreeColumn* aCol) { - RefPtr col = GetColumnImpl(aCol); - if (!col) + if (!aCol) return NS_ERROR_INVALID_ARG; ScrollParts parts = GetScrollParts(); @@ -4077,11 +4073,11 @@ nsTreeBodyFrame::EnsureCellIsVisible(int32_t aRow, nsITreeColumn* aCol) nsresult rv; nscoord columnPos; - rv = col->GetXInTwips(this, &columnPos); + rv = aCol->GetXInTwips(this, &columnPos); if(NS_FAILED(rv)) return rv; nscoord columnWidth; - rv = col->GetWidthInTwips(this, &columnWidth); + rv = aCol->GetWidthInTwips(this, &columnWidth); if(NS_FAILED(rv)) return rv; // If the start of the column is before the @@ -4105,7 +4101,7 @@ nsTreeBodyFrame::EnsureCellIsVisible(int32_t aRow, nsITreeColumn* aCol) } nsresult -nsTreeBodyFrame::ScrollToCell(int32_t aRow, nsITreeColumn* aCol) +nsTreeBodyFrame::ScrollToCell(int32_t aRow, nsTreeColumn* aCol) { ScrollParts parts = GetScrollParts(); nsresult rv = ScrollToRowInternal(parts, aRow); @@ -4119,7 +4115,7 @@ nsTreeBodyFrame::ScrollToCell(int32_t aRow, nsITreeColumn* aCol) } nsresult -nsTreeBodyFrame::ScrollToColumn(nsITreeColumn* aCol) +nsTreeBodyFrame::ScrollToColumn(nsTreeColumn* aCol) { ScrollParts parts = GetScrollParts(); nsresult rv = ScrollToColumnInternal(parts, aCol); @@ -4129,14 +4125,13 @@ nsTreeBodyFrame::ScrollToColumn(nsITreeColumn* aCol) } nsresult nsTreeBodyFrame::ScrollToColumnInternal(const ScrollParts& aParts, - nsITreeColumn* aCol) + nsTreeColumn* aCol) { - RefPtr col = GetColumnImpl(aCol); - if (!col) + if (!aCol) return NS_ERROR_INVALID_ARG; nscoord x; - nsresult rv = col->GetXInTwips(this, &x); + nsresult rv = aCol->GetXInTwips(this, &x); if (NS_FAILED(rv)) return rv; @@ -4713,8 +4708,8 @@ nsTreeBodyFrame::FireRowCountChangedEvent(int32_t aIndex, int32_t aCount) void nsTreeBodyFrame::FireInvalidateEvent(int32_t aStartRowIdx, int32_t aEndRowIdx, - nsITreeColumn *aStartCol, - nsITreeColumn *aEndCol) + nsTreeColumn *aStartCol, + nsTreeColumn *aEndCol) { nsCOMPtr content(GetBaseElement()); if (!content) @@ -4748,20 +4743,13 @@ nsTreeBodyFrame::FireInvalidateEvent(int32_t aStartRowIdx, int32_t aEndRowIdx, if (aStartCol && aEndCol) { // Set 'startcolumn' data - the start index of invalidated rows. - int32_t startColIdx = 0; - nsresult rv = aStartCol->GetIndex(&startColIdx); - if (NS_FAILED(rv)) - return; + int32_t startColIdx = aStartCol->GetIndex(); propBag->SetPropertyAsInt32(NS_LITERAL_STRING("startcolumn"), startColIdx); // Set 'endcolumn' data - the start index of invalidated rows. - int32_t endColIdx = 0; - rv = aEndCol->GetIndex(&endColIdx); - if (NS_FAILED(rv)) - return; - + int32_t endColIdx = aEndCol->GetIndex(); propBag->SetPropertyAsInt32(NS_LITERAL_STRING("endcolumn"), endColIdx); } diff --git a/layout/xul/tree/nsTreeBodyFrame.h b/layout/xul/tree/nsTreeBodyFrame.h index 5d8a9ddb8cc6..52c7b95fdd14 100644 --- a/layout/xul/tree/nsTreeBodyFrame.h +++ b/layout/xul/tree/nsTreeBodyFrame.h @@ -91,28 +91,28 @@ public: int32_t LastVisibleRow() const { return mTopRowIndex + mPageLength; } int32_t PageLength() const { return mPageLength; } nsresult EnsureRowIsVisible(int32_t aRow); - nsresult EnsureCellIsVisible(int32_t aRow, nsITreeColumn *aCol); + nsresult EnsureCellIsVisible(int32_t aRow, nsTreeColumn *aCol); nsresult ScrollToRow(int32_t aRow); nsresult ScrollByLines(int32_t aNumLines); nsresult ScrollByPages(int32_t aNumPages); - nsresult ScrollToCell(int32_t aRow, nsITreeColumn *aCol); - nsresult ScrollToColumn(nsITreeColumn *aCol); + nsresult ScrollToCell(int32_t aRow, nsTreeColumn *aCol); + nsresult ScrollToColumn(nsTreeColumn *aCol); nsresult ScrollToHorizontalPosition(int32_t aValue); nsresult Invalidate(); - nsresult InvalidateColumn(nsITreeColumn *aCol); + nsresult InvalidateColumn(nsTreeColumn *aCol); nsresult InvalidateRow(int32_t aRow); - nsresult InvalidateCell(int32_t aRow, nsITreeColumn *aCol); + nsresult InvalidateCell(int32_t aRow, nsTreeColumn *aCol); nsresult InvalidateRange(int32_t aStart, int32_t aEnd); nsresult InvalidateColumnRange(int32_t aStart, int32_t aEnd, - nsITreeColumn *aCol); + nsTreeColumn *aCol); nsresult GetRowAt(int32_t aX, int32_t aY, int32_t *aValue); nsresult GetCellAt(int32_t aX, int32_t aY, int32_t *aRow, nsTreeColumn **aCol, nsACString &aChildElt); - nsresult GetCoordsForCellItem(int32_t aRow, nsITreeColumn *aCol, + nsresult GetCoordsForCellItem(int32_t aRow, nsTreeColumn *aCol, const nsACString &aElt, int32_t *aX, int32_t *aY, int32_t *aWidth, int32_t *aHeight); - nsresult IsCellCropped(int32_t aRow, nsITreeColumn *aCol, bool *aResult); + nsresult IsCellCropped(int32_t aRow, nsTreeColumn *aCol, bool *aResult); nsresult RowCountChanged(int32_t aIndex, int32_t aCount); nsresult BeginUpdateBatch(); nsresult EndUpdateBatch(); @@ -385,7 +385,7 @@ protected: // Our internal scroll method, used by all the public scroll methods. nsresult ScrollInternal(const ScrollParts& aParts, int32_t aRow); nsresult ScrollToRowInternal(const ScrollParts& aParts, int32_t aRow); - nsresult ScrollToColumnInternal(const ScrollParts& aParts, nsITreeColumn* aCol); + nsresult ScrollToColumnInternal(const ScrollParts& aParts, nsTreeColumn* aCol); nsresult ScrollHorzInternal(const ScrollParts& aParts, int32_t aPosition); nsresult EnsureRowIsVisibleInternal(const ScrollParts& aParts, int32_t aRow); @@ -430,15 +430,6 @@ protected: } public: - static - already_AddRefed GetColumnImpl(nsITreeColumn* aUnknownCol) { - if (!aUnknownCol) - return nullptr; - - nsCOMPtr col = do_QueryInterface(aUnknownCol); - return col.forget(); - } - /** * Remove an nsITreeImageListener from being tracked by this frame. Only tree * image listeners that are created by this frame are tracked. @@ -515,7 +506,7 @@ protected: * been invalidated only */ void FireInvalidateEvent(int32_t aStartRow, int32_t aEndRow, - nsITreeColumn *aStartCol, nsITreeColumn *aEndCol); + nsTreeColumn *aStartCol, nsTreeColumn *aEndCol); #endif protected: // Data Members diff --git a/layout/xul/tree/nsTreeColumns.cpp b/layout/xul/tree/nsTreeColumns.cpp index bf4953f6aa5e..08112baf5c6d 100644 --- a/layout/xul/tree/nsTreeColumns.cpp +++ b/layout/xul/tree/nsTreeColumns.cpp @@ -306,7 +306,7 @@ nsTreeColumn::Invalidate() nsGkAtoms::_true, eCaseMatters); // Figure out our column type. Default type is text. - mType = nsITreeColumn::TYPE_TEXT; + mType = TreeColumnBinding::TYPE_TEXT; static Element::AttrValuesArray typestrings[] = {&nsGkAtoms::checkbox, &nsGkAtoms::password, nullptr}; @@ -314,8 +314,8 @@ nsTreeColumn::Invalidate() nsGkAtoms::type, typestrings, eCaseMatters)) { - case 0: mType = nsITreeColumn::TYPE_CHECKBOX; break; - case 1: mType = nsITreeColumn::TYPE_PASSWORD; break; + case 0: mType = TreeColumnBinding::TYPE_CHECKBOX; break; + case 1: mType = TreeColumnBinding::TYPE_PASSWORD; break; } // Fetch the crop style. @@ -473,7 +473,7 @@ nsTreeColumns::GetKeyColumn() continue; // Skip non-text column - if (currCol->GetType() != nsITreeColumn::TYPE_TEXT) + if (currCol->GetType() != TreeColumnBinding::TYPE_TEXT) continue; if (!first) diff --git a/layout/xul/tree/nsTreeColumns.h b/layout/xul/tree/nsTreeColumns.h index 709e6beecf31..1ffc1c811ad9 100644 --- a/layout/xul/tree/nsTreeColumns.h +++ b/layout/xul/tree/nsTreeColumns.h @@ -50,12 +50,6 @@ public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_TREECOLUMN_IMPL_CID) - static already_AddRefed From(nsITreeColumn* aColumn) - { - RefPtr col = do_QueryObject(aColumn); - return col.forget(); - } - NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsTreeColumn) NS_DECL_NSITREECOLUMN diff --git a/security/manager/ssl/nsCertTree.cpp b/security/manager/ssl/nsCertTree.cpp index 2aa339b9a5af..4c7e1102a6c8 100644 --- a/security/manager/ssl/nsCertTree.cpp +++ b/security/manager/ssl/nsCertTree.cpp @@ -1014,8 +1014,7 @@ nsCertTree::GetCellText(int32_t row, nsTreeColumn* col, nsresult rv = NS_OK; _retval.Truncate(); - const char16_t* colID; - col->GetIdConst(&colID); + const nsAString& colID = col->GetId(); treeArrayEl *el = GetThreadDescAtIndex(row); if (el) { @@ -1036,8 +1035,7 @@ nsCertTree::GetCellText(int32_t row, nsTreeColumn* col, cert = certdi->mAddonInfo->mCert; } - int32_t colIndex; - col->GetIndex(&colIndex); + int32_t colIndex = col->Index(); uint32_t arrayIndex=absoluteCertOffset+colIndex*(mNumRows-mNumOrgs); uint32_t arrayLength=0; if (mCellText) {