Bug 1430374 - Remove support for progressmeter tree cells. r=bz,dao

MozReview-Commit-ID: 3hydkeoneC0

--HG--
extra : rebase_source : eca404511d1fc2d9d7e9711fbd1accefd3781b16
This commit is contained in:
Tim Nguyen 2018-01-18 10:36:05 +00:00
Родитель 8ff5dd951d
Коммит 6071f20f6c
31 изменённых файлов: 5 добавлений и 323 удалений

Просмотреть файл

@ -107,7 +107,6 @@ nsTreeView.prototype =
return info.level;
},
getImageSrc: function getImageSrc(aRow, aCol) {},
getProgressMode: function getProgressMode(aRow, aCol) {},
isContainer: function isContainer(aIndex) {
var data = this.getDataForIndex(aIndex);
return data.open != undefined;

Просмотреть файл

@ -128,7 +128,6 @@ pageInfoTreeView.prototype = {
hasNextSibling(index, after) { return false; },
getLevel(index) { return 0; },
getImageSrc(row, column) { },
getProgressMode(row, column) { },
getCellValue(row, column) { },
toggleOpenState(index) { },
cycleHeader(col) { },

Просмотреть файл

@ -1509,7 +1509,6 @@ PlacesTreeView.prototype = {
return node.icon;
},
getProgressMode(aRow, aColumn) { },
getCellValue(aRow, aColumn) { },
getCellText: function PTV_getCellText(aRow, aColumn) {

Просмотреть файл

@ -37,7 +37,6 @@ var gBlocklistManager = {
isContainer(index) { return false; },
setTree(tree) {},
getImageSrc(row, column) {},
getProgressMode(row, column) {},
getCellValue(row, column) {
if (column.id == "selectionCol")
return gBlocklistManager._blockLists[row].selected;

Просмотреть файл

@ -401,7 +401,6 @@ var gCookiesWindow = {
return 0;
},
getImageSrc(aIndex, aColumn) {},
getProgressMode(aIndex, aColumn) {},
getCellValue(aIndex, aColumn) {},
setTree(aTree) {},
toggleOpenState(aIndex) {

Просмотреть файл

@ -630,7 +630,6 @@ EngineView.prototype = {
getParentIndex(index) { return -1; },
hasNextSibling(parentIndex, index) { return false; },
getLevel(index) { return 0; },
getProgressMode(index, column) { },
getCellValue(index, column) {
if (column.id == "engineShown")
return this._engineStore.engines[index].shown;

Просмотреть файл

@ -47,7 +47,6 @@ var gPermissionManager = {
isContainer(aIndex) { return false; },
setTree(aTree) {},
getImageSrc(aRow, aColumn) {},
getProgressMode(aRow, aColumn) {},
getCellValue(aRow, aColumn) {},
cycleHeader(column) {},
getRowProperties(row) { return ""; },

Просмотреть файл

@ -186,7 +186,6 @@ let gSiteDataRemoveSelected = {
getColumnProperties() {},
hasPreviousSibling(index) {},
getImageSrc() {},
getProgressMode() {},
getCellValue() {},
cycleHeader() {},
selectionChanged() {},

Просмотреть файл

@ -64,7 +64,6 @@ Tree.prototype = {
},
setTree(aTree) {},
getImageSrc(aRow, aColumn) {},
getProgressMode(aRow, aColumn) {},
getCellValue(aRow, aColumn) {},
cycleHeader(column) {},
getRowProperties(row) {

Просмотреть файл

@ -362,7 +362,6 @@ var treeView = {
return null;
},
getProgressMode(idx, column) { },
cycleHeader(column) { },
cycleCell(idx, column) { },
selectionChanged() { },

Просмотреть файл

@ -122,16 +122,6 @@ interface TreeView
[Throws]
DOMString getImageSrc(long row, TreeColumn column);
/**
* The progress mode for a given cell. This method is only called for
* columns of type |progressmeter|.
*/
const short PROGRESS_NORMAL = 1;
const short PROGRESS_UNDETERMINED = 2;
const short PROGRESS_NONE = 3;
[Throws]
long getProgressMode(long row, TreeColumn column);
/**
* The value for a given cell. This method is only called for columns
* of type other than |text|.

Просмотреть файл

@ -353,12 +353,6 @@ inDOMView::GetImageSrc(int32_t row, nsITreeColumn* col, nsAString& _retval)
return NS_OK;
}
NS_IMETHODIMP
inDOMView::GetProgressMode(int32_t row, nsITreeColumn* col, int32_t* _retval)
{
return NS_OK;
}
NS_IMETHODIMP
inDOMView::GetCellValue(int32_t row, nsITreeColumn* col, nsAString& _retval)
{

Просмотреть файл

@ -125,7 +125,6 @@ CSS_ANON_BOX(mozTreeTwisty, ":-moz-tree-twisty")
CSS_ANON_BOX(mozTreeImage, ":-moz-tree-image")
CSS_ANON_BOX(mozTreeCellText, ":-moz-tree-cell-text")
CSS_ANON_BOX(mozTreeCheckbox, ":-moz-tree-checkbox")
CSS_ANON_BOX(mozTreeProgressmeter, ":-moz-tree-progressmeter")
CSS_ANON_BOX(mozTreeDropFeedback, ":-moz-tree-drop-feedback")
#endif

Просмотреть файл

@ -1,23 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<tree flex="1">
<treecols>
<treecol label="test" flex="1" type="progressmeter" />
</treecols>
<treechildren>
<treeitem>
<treerow>
<treecell value="50" mode="normal" />
</treerow>
</treeitem>
<treeitem>
<treerow>
<treecell mode="undetermined" />
</treerow>
</treeitem>
</treechildren>
</tree>
</window>

Просмотреть файл

@ -14,7 +14,6 @@ load 399715-1.xhtml
load 409807-1.xul
load 414170-1.xul
load 430394-1.xul
load 454186-1.xul
load 479931-1.xhtml
load 509602-1.xul
load 585815.html

Просмотреть файл

@ -29,8 +29,7 @@ interface nsITreeColumn : nsISupports
const short TYPE_TEXT = 1;
const short TYPE_CHECKBOX = 2;
const short TYPE_PROGRESSMETER = 3;
const short TYPE_PASSWORD = 4;
const short TYPE_PASSWORD = 3;
readonly attribute short type;
nsITreeColumn getNext();

Просмотреть файл

@ -114,15 +114,6 @@ interface nsITreeView : nsISupports
*/
AString getImageSrc(in long row, in nsITreeColumn col);
/**
* The progress mode for a given cell. This method is only called for
* columns of type |progressmeter|.
*/
const short PROGRESS_NORMAL = 1;
const short PROGRESS_UNDETERMINED = 2;
const short PROGRESS_NONE = 3;
long getProgressMode(in long row, in nsITreeColumn col);
/**
* The value for a given cell. This method is only called for columns
* of type other than |text|.

Просмотреть файл

@ -2030,18 +2030,6 @@ nsTreeBodyFrame::PrefillPropertyArray(int32_t aRowIndex, nsTreeColumn* aCol)
mScratchArray.AppendElement(nsGkAtoms::checked);
}
}
else if (aCol->GetType() == nsITreeColumn::TYPE_PROGRESSMETER) {
mScratchArray.AppendElement(nsGkAtoms::progressmeter);
if (aRowIndex != -1) {
int32_t state;
mView->GetProgressMode(aRowIndex, aCol, &state);
if (state == nsITreeView::PROGRESS_NORMAL)
mScratchArray.AppendElement(nsGkAtoms::progressNormal);
else if (state == nsITreeView::PROGRESS_UNDETERMINED)
mScratchArray.AppendElement(nsGkAtoms::progressUndetermined);
}
}
// Read special properties from attributes on the column content node
if (aCol->mContent->IsElement() &&
@ -3415,23 +3403,6 @@ nsTreeBodyFrame::PaintCell(int32_t aRowIndex,
result &= PaintCheckbox(aRowIndex, aColumn, elementRect, aPresContext,
aRenderingContext, aDirtyRect);
break;
case nsITreeColumn::TYPE_PROGRESSMETER:
int32_t state;
mView->GetProgressMode(aRowIndex, aColumn, &state);
switch (state) {
case nsITreeView::PROGRESS_NORMAL:
case nsITreeView::PROGRESS_UNDETERMINED:
result &= PaintProgressMeter(aRowIndex, aColumn, elementRect,
aPresContext, aRenderingContext,
aDirtyRect, aBuilder);
break;
case nsITreeView::PROGRESS_NONE:
default:
result &= PaintText(aRowIndex, aColumn, elementRect, aPresContext,
aRenderingContext, aDirtyRect, currX);
break;
}
break;
}
}
}
@ -3930,110 +3901,6 @@ nsTreeBodyFrame::PaintCheckbox(int32_t aRowIndex,
return result;
}
ImgDrawResult
nsTreeBodyFrame::PaintProgressMeter(int32_t aRowIndex,
nsTreeColumn* aColumn,
const nsRect& aProgressMeterRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nsDisplayListBuilder* aBuilder)
{
NS_PRECONDITION(aColumn && aColumn->GetFrame(), "invalid column passed");
// Resolve style for the progress meter. It contains all the info we need
// to lay ourselves out and to paint.
nsStyleContext* meterContext = GetPseudoStyleContext(nsCSSAnonBoxes::mozTreeProgressmeter);
// Obtain the margins for the progress meter and then deflate our rect by that
// amount. The progress meter is assumed to be contained within the deflated
// rect.
nsRect meterRect(aProgressMeterRect);
nsMargin meterMargin;
meterContext->StyleMargin()->GetMargin(meterMargin);
meterRect.Deflate(meterMargin);
// Paint our borders and background for our progress meter rect.
ImgDrawResult result = PaintBackgroundLayer(meterContext, aPresContext,
aRenderingContext, meterRect,
aDirtyRect);
// Time to paint our progress.
int32_t state;
mView->GetProgressMode(aRowIndex, aColumn, &state);
if (state == nsITreeView::PROGRESS_NORMAL) {
// Adjust the rect for its border and padding.
AdjustForBorderPadding(meterContext, meterRect);
// Now obtain the value for our cell.
nsAutoString value;
mView->GetCellValue(aRowIndex, aColumn, value);
nsresult rv;
int32_t intValue = value.ToInteger(&rv);
if (intValue < 0)
intValue = 0;
else if (intValue > 100)
intValue = 100;
nscoord meterWidth = NSToCoordRound((float)intValue / 100 * meterRect.width);
if (StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL)
meterRect.x += meterRect.width - meterWidth; // right align
meterRect.width = meterWidth;
bool useImageRegion = true;
nsCOMPtr<imgIContainer> image;
GetImage(aRowIndex, aColumn, true, meterContext, useImageRegion, getter_AddRefs(image));
if (image) {
int32_t width, height;
image->GetWidth(&width);
image->GetHeight(&height);
nsSize size(width*nsDeviceContext::AppUnitsPerCSSPixel(),
height*nsDeviceContext::AppUnitsPerCSSPixel());
uint32_t drawFlags = aBuilder && aBuilder->IsPaintingToWindow() ?
imgIContainer::FLAG_HIGH_QUALITY_SCALING : imgIContainer::FLAG_NONE;
result &=
nsLayoutUtils::DrawImage(aRenderingContext, meterContext,
aPresContext, image,
nsLayoutUtils::GetSamplingFilterForFrame(this),
nsRect(meterRect.TopLeft(), size), meterRect, meterRect.TopLeft(),
aDirtyRect, drawFlags);
} else {
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel();
Rect rect =
NSRectToSnappedRect(meterRect, appUnitsPerDevPixel, *drawTarget);
ColorPattern color(ToDeviceColor(meterContext->StyleColor()->mColor));
drawTarget->FillRect(rect, color);
}
}
else if (state == nsITreeView::PROGRESS_UNDETERMINED) {
// Adjust the rect for its border and padding.
AdjustForBorderPadding(meterContext, meterRect);
bool useImageRegion = true;
nsCOMPtr<imgIContainer> image;
GetImage(aRowIndex, aColumn, true, meterContext, useImageRegion, getter_AddRefs(image));
if (image) {
int32_t width, height;
image->GetWidth(&width);
image->GetHeight(&height);
nsSize size(width*nsDeviceContext::AppUnitsPerCSSPixel(),
height*nsDeviceContext::AppUnitsPerCSSPixel());
uint32_t drawFlags = aBuilder && aBuilder->IsPaintingToWindow() ?
imgIContainer::FLAG_HIGH_QUALITY_SCALING : imgIContainer::FLAG_NONE;
result &=
nsLayoutUtils::DrawImage(aRenderingContext, meterContext,
aPresContext, image,
nsLayoutUtils::GetSamplingFilterForFrame(this),
nsRect(meterRect.TopLeft(), size), meterRect, meterRect.TopLeft(),
aDirtyRect, drawFlags);
}
}
return result;
}
ImgDrawResult
nsTreeBodyFrame::PaintDropFeedback(const nsRect& aDropFeedbackRect,
nsPresContext* aPresContext,

Просмотреть файл

@ -277,15 +277,6 @@ protected:
gfxContext& aRenderingContext,
const nsRect& aDirtyRect);
// This method paints the progress meter inside a particular cell of the tree.
ImgDrawResult PaintProgressMeter(int32_t aRowIndex,
nsTreeColumn* aColumn,
const nsRect& aProgressMeterRect,
nsPresContext* aPresContext,
gfxContext& aRenderingContext,
const nsRect& aDirtyRect,
nsDisplayListBuilder* aBuilder);
// This method paints a drop feedback of the tree.
ImgDrawResult PaintDropFeedback(const nsRect& aDropFeedbackRect,
nsPresContext* aPresContext,

Просмотреть файл

@ -320,15 +320,14 @@ nsTreeColumn::Invalidate()
// Figure out our column type. Default type is text.
mType = nsITreeColumn::TYPE_TEXT;
static Element::AttrValuesArray typestrings[] =
{&nsGkAtoms::checkbox, &nsGkAtoms::progressmeter, &nsGkAtoms::password,
{&nsGkAtoms::checkbox, &nsGkAtoms::password,
nullptr};
switch (mContent->AsElement()->FindAttrValueIn(kNameSpaceID_None,
nsGkAtoms::type,
typestrings,
eCaseMatters)) {
case 0: mType = nsITreeColumn::TYPE_CHECKBOX; break;
case 1: mType = nsITreeColumn::TYPE_PROGRESSMETER; break;
case 2: mType = nsITreeColumn::TYPE_PASSWORD; break;
case 1: mType = nsITreeColumn::TYPE_PASSWORD; break;
}
// Fetch the crop style.

Просмотреть файл

@ -493,52 +493,6 @@ nsTreeContentView::GetImageSrc(int32_t aRow, nsITreeColumn* aCol, nsAString& _re
return rv.StealNSResult();
}
int32_t
nsTreeContentView::GetProgressMode(int32_t aRow, nsTreeColumn& aColumn,
ErrorResult& aError)
{
if (!IsValidRowIndex(aRow)) {
aError.Throw(NS_ERROR_INVALID_ARG);
return 0;
}
Row* row = mRows[aRow].get();
nsIContent* realRow =
nsTreeUtils::GetImmediateChild(row->mContent, nsGkAtoms::treerow);
if (realRow) {
Element* cell = GetCell(realRow, aColumn);
if (cell) {
static Element::AttrValuesArray strings[] =
{&nsGkAtoms::normal, &nsGkAtoms::undetermined, nullptr};
switch (cell->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::mode,
strings, eCaseMatters)) {
case 0:
{
return nsITreeView::PROGRESS_NORMAL;
}
case 1:
{
return nsITreeView::PROGRESS_UNDETERMINED;
}
}
}
}
return nsITreeView::PROGRESS_NONE;
}
NS_IMETHODIMP
nsTreeContentView::GetProgressMode(int32_t aRow, nsITreeColumn* aCol, int32_t* _retval)
{
RefPtr<nsTreeColumn> col = nsTreeColumn::From(aCol);
NS_ENSURE_ARG(col);
ErrorResult rv;
*_retval = GetProgressMode(aRow, *col, rv);
return rv.StealNSResult();
}
void
nsTreeContentView::GetCellValue(int32_t aRow, nsTreeColumn& aColumn,
nsAString& aValue, ErrorResult& aError)

Просмотреть файл

@ -82,8 +82,6 @@ class nsTreeContentView final : public nsINativeTreeView,
int32_t GetLevel(int32_t aRow, mozilla::ErrorResult& aError);
void GetImageSrc(int32_t aRow, nsTreeColumn& aColumn, nsAString& aSrc,
mozilla::ErrorResult& aError);
int32_t GetProgressMode(int32_t aRow, nsTreeColumn& aColumn,
mozilla::ErrorResult& aError);
void GetCellValue(int32_t aRow, nsTreeColumn& aColumn, nsAString& aValue,
mozilla::ErrorResult& aError);
void GetCellText(int32_t aRow, nsTreeColumn& aColumn, nsAString& aText,

Просмотреть файл

@ -267,12 +267,6 @@ nsNSSASN1Tree::GetImageSrc(int32_t, nsITreeColumn*, nsAString&)
return NS_OK;
}
NS_IMETHODIMP
nsNSSASN1Tree::GetProgressMode(int32_t, nsITreeColumn*, int32_t*)
{
return NS_OK;
}
NS_IMETHODIMP
nsNSSASN1Tree::GetCellValue(int32_t, nsITreeColumn*, nsAString&)
{

Просмотреть файл

@ -1017,12 +1017,6 @@ nsCertTree::GetImageSrc(int32_t row, nsITreeColumn* col,
return NS_OK;
}
NS_IMETHODIMP
nsCertTree::GetProgressMode(int32_t row, nsITreeColumn* col, int32_t* _retval)
{
return NS_OK;
}
NS_IMETHODIMP
nsCertTree::GetCellValue(int32_t row, nsITreeColumn* col,
nsAString& _retval)

Просмотреть файл

@ -984,13 +984,6 @@ nsAutoCompleteController::GetImageSrc(int32_t row, nsITreeColumn* col, nsAString
return NS_OK;
}
NS_IMETHODIMP
nsAutoCompleteController::GetProgressMode(int32_t row, nsITreeColumn* col, int32_t* _retval)
{
NS_NOTREACHED("tree has no progress cells");
return NS_OK;
}
NS_IMETHODIMP
nsAutoCompleteController::GetCellValue(int32_t row, nsITreeColumn* col, nsAString& _retval)
{

Просмотреть файл

@ -157,7 +157,6 @@ let signonsTreeView = {
return "";
},
getProgressMode(row, column) {},
getCellValue(row, column) {},
getCellText(row, column) {
let time;

Просмотреть файл

@ -35,7 +35,6 @@ var view =
isSorted: function(row) { return false; },
isSelectable: function(row, column) { return true; },
isEditable: function(row, column) { return row != 2 || column.index != 1; },
getProgressMode: function(row, column) { return Components.interfaces.nsITreeView.PROGRESS_NORMAL; },
getParentIndex: function(row, column) { return -1; },
getLevel: function(row) { return 0; },
hasNextSibling: function(row, column) { return row != this.rowCount - 1; },
@ -65,8 +64,7 @@ function getCustomTreeViewCellInfo()
properties: "",
editable: row != 2 || column.index != 1,
selectable: true,
image: "",
mode: Components.interfaces.nsITreeView.PROGRESS_NORMAL });
image: "" });
}
obj.rows.push({ cells: cellInfo,

Просмотреть файл

@ -19,7 +19,7 @@ var columns_hiertree =
];
// XXXndeakin still to add some tests for:
// cycler columns, checkbox cells, progressmeter cells
// cycler columns, checkbox cells
// this test function expects a tree to have 8 rows in it when it isn't
// expanded. The tree should only display four rows at a time. If editable,
@ -913,7 +913,6 @@ function testtag_tree_TreeView_rows(tree, testid, rowInfo, startRow) {
isEditable(row, cell) { return cell.editable; },
isSelectable(row, cell) { return cell.selectable; },
getImageSrc(row, cell) { return cell.image; },
getProgressMode(row, cell) { return cell.mode; }
};
var failedMethods = { };

Просмотреть файл

@ -174,21 +174,6 @@ treechildren::-moz-tree-drop-feedback {
margin-inline-start: 5px;
}
/* ::::: tree progress meter ::::: */
treechildren::-moz-tree-progressmeter {
margin: 2px 4px;
padding: 1px;
border: 1px solid;
border-color: ThreeDShadow ThreeDHighlight ThreeDHighlight ThreeDShadow;
background-color: -moz-Dialog;
color: ThreeDShadow;
}
treechildren::-moz-tree-cell-text(progressmeter) {
margin: 2px 4px;
}
/* ::::: tree columns ::::: */
treecol,

Просмотреть файл

@ -144,19 +144,6 @@ treechildren::-moz-tree-drop-feedback {
margin-inline-start: 5px;
}
/* ::::: tree progress meter ::::: */
treechildren::-moz-tree-progressmeter {
margin: 2px 4px;
border: 1px solid;
border-color: ThreeDShadow ThreeDHighlight ThreeDHighlight ThreeDShadow;
}
treechildren::-moz-tree-cell-text(progressmeter) {
margin: 2px 4px;
-moz-appearance: progressbar;
}
/* ::::: tree columns ::::: */
treecol,

Просмотреть файл

@ -173,21 +173,6 @@ treechildren::-moz-tree-drop-feedback {
margin-inline-start: 5px;
}
/* ::::: tree progress meter ::::: */
treechildren::-moz-tree-progressmeter {
margin: 2px 4px;
padding: 1px;
border: 1px solid;
border-color: ThreeDShadow ThreeDHighlight ThreeDHighlight ThreeDShadow;
background-color: -moz-Dialog;
color: ThreeDShadow;
}
treechildren::-moz-tree-cell-text(progressmeter) {
margin: 2px 4px;
}
/* ::::: tree columns ::::: */
treecol,