--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -274,17 +274,17 @@ void
nsTreeBodyFrame::DestroyFrom(nsIFrame* aDestructRoot)
{
if (mScrollbarActivity) {
mScrollbarActivity->Destroy();
mScrollbarActivity = nullptr;
}
mScrollEvent.Revoke();
- // Make sure we cancel any posted callbacks.
+ // Make sure we cancel any posted callbacks.
if (mReflowCallbackPosted) {
PresContext()->PresShell()->CancelReflowCallback(this);
mReflowCallbackPosted = false;
}
if (mColumns)
mColumns->SetTree(nullptr);
@@ -488,21 +488,21 @@ nsTreeBodyFrame::SetView(nsITreeView * a
mView->SetTree(nullptr);
// Only reset the top row index and delete the columns if we had an old non-null view.
mTopRowIndex = 0;
}
// Tree, meet the view.
mView = aView;
-
+
// Changing the view causes us to refetch our data. This will
// necessarily entail a full invalidation of the tree.
Invalidate();
-
+
nsIContent *treeContent = GetBaseElement();
if (treeContent) {
#ifdef ACCESSIBILITY
nsAccessibilityService* accService = nsIPresShell::AccService();
if (accService)
accService->TreeViewChanged(PresContext()->GetPresShell(), treeContent, mView);
#endif
FireDOMEvent(NS_LITERAL_STRING("TreeViewChanged"), treeContent);
@@ -521,26 +521,26 @@ nsTreeBodyFrame::SetView(nsITreeView * a
mView->SetSelection(sel);
}
// View, meet the tree.
nsWeakFrame weakFrame(this);
mView->SetTree(mTreeBoxObject);
NS_ENSURE_STATE(weakFrame.IsAlive());
mView->GetRowCount(&mRowCount);
-
+
if (!PresContext()->PresShell()->IsReflowLocked()) {
// The scrollbar will need to be updated.
FullScrollbarsUpdate(false);
} else if (!mReflowCallbackPosted) {
mReflowCallbackPosted = true;
PresContext()->PresShell()->PostReflowCallback(this);
}
}
-
+
return NS_OK;
}
nsresult
nsTreeBodyFrame::SetFocused(bool aFocused)
{
if (mFocused != aFocused) {
mFocused = aFocused;
@@ -771,17 +771,17 @@ nsTreeBodyFrame::InvalidateColumnRange(i
if (nsIPresShell::IsAccessibilityActive()) {
int32_t end =
mRowCount > 0 ? ((mRowCount <= aEnd) ? mRowCount - 1 : aEnd) : 0;
FireInvalidateEvent(aStart, end, aCol, aCol);
}
#endif
nsRect rangeRect;
- nsresult rv = col->GetRect(this,
+ nsresult rv = col->GetRect(this,
mInnerBox.y+mRowHeight*(aStart-mTopRowIndex),
mRowHeight*(aEnd-aStart+1),
&rangeRect);
NS_ENSURE_SUCCESS(rv, rv);
InvalidateFrameWithRect(rangeRect);
return NS_OK;
@@ -792,32 +792,32 @@ FindScrollParts(nsIFrame* aCurrFrame, ns
{
if (!aResult->mColumnsScrollFrame) {
nsIScrollableFrame* f = do_QueryFrame(aCurrFrame);
if (f) {
aResult->mColumnsFrame = aCurrFrame;
aResult->mColumnsScrollFrame = f;
}
}
-
+
nsScrollbarFrame *sf = do_QueryFrame(aCurrFrame);
if (sf) {
if (!aCurrFrame->IsXULHorizontal()) {
if (!aResult->mVScrollbar) {
aResult->mVScrollbar = sf;
}
} else {
if (!aResult->mHScrollbar) {
aResult->mHScrollbar = sf;
}
}
// don't bother searching inside a scrollbar
return;
}
-
+
nsIFrame* child = aCurrFrame->PrincipalChildList().FirstChild();
while (child &&
!child->GetContent()->IsRootOfNativeAnonymousSubtree() &&
(!aResult->mVScrollbar || !aResult->mHScrollbar ||
!aResult->mColumnsScrollFrame)) {
FindScrollParts(child, aResult);
child = child->GetNextSibling();
}
@@ -889,17 +889,17 @@ nsTreeBodyFrame::CheckOverflow(const Scr
mVerticalOverflow = false;
verticalOverflowChanged = true;
}
if (aParts.mColumnsFrame) {
nsRect bounds = aParts.mColumnsFrame->GetRect();
if (bounds.width != 0) {
/* Ignore overflows that are less than half a pixel. Yes these happen
- all over the place when flex boxes are compressed real small.
+ all over the place when flex boxes are compressed real small.
Probably a result of a rounding errors somewhere in the layout code. */
bounds.width += nsPresContext::CSSPixelsToAppUnits(0.5f);
if (!mHorizontalOverflow && bounds.width < mHorzWidth) {
mHorizontalOverflow = true;
horizontalOverflowChanged = true;
} else if (mHorizontalOverflow && bounds.width >= mHorzWidth) {
mHorizontalOverflow = false;
horizontalOverflowChanged = true;
@@ -949,17 +949,17 @@ nsTreeBodyFrame::CheckOverflow(const Scr
void
nsTreeBodyFrame::InvalidateScrollbars(const ScrollParts& aParts, nsWeakFrame& aWeakColumnsFrame)
{
if (mUpdateBatchNest || !mView)
return;
nsWeakFrame weakFrame(this);
if (aParts.mVScrollbar) {
- // Do Vertical Scrollbar
+ // Do Vertical Scrollbar
nsAutoString maxposStr;
nscoord rowHeightAsPixels = nsPresContext::AppUnitsToIntCSSPixels(mRowHeight);
int32_t size = rowHeightAsPixels * (mRowCount > mPageLength ? mRowCount - mPageLength : 0);
maxposStr.AppendInt(size);
aParts.mVScrollbarContent->
SetAttr(kNameSpaceID_None, nsGkAtoms::maxpos, maxposStr, true);
@@ -978,23 +978,23 @@ nsTreeBodyFrame::InvalidateScrollbars(co
// And now Horizontal scrollbar
nsRect bounds = aParts.mColumnsFrame->GetRect();
nsAutoString maxposStr;
maxposStr.AppendInt(mHorzWidth > bounds.width ? mHorzWidth - bounds.width : 0);
aParts.mHScrollbarContent->
SetAttr(kNameSpaceID_None, nsGkAtoms::maxpos, maxposStr, true);
ENSURE_TRUE(weakFrame.IsAlive());
-
+
nsAutoString pageStr;
pageStr.AppendInt(bounds.width);
aParts.mHScrollbarContent->
SetAttr(kNameSpaceID_None, nsGkAtoms::pageincrement, pageStr, true);
ENSURE_TRUE(weakFrame.IsAlive());
-
+
pageStr.Truncate();
pageStr.AppendInt(nsPresContext::CSSPixelsToAppUnits(16));
aParts.mHScrollbarContent->
SetAttr(kNameSpaceID_None, nsGkAtoms::increment, pageStr, true);
}
if (weakFrame.IsAlive() && mScrollbarActivity) {
mScrollbarActivity->ActivityOccurred();
@@ -1071,46 +1071,46 @@ nsTreeBodyFrame::GetCellAt(int32_t aX, i
return NS_OK;
}
//
// GetCoordsForCellItem
//
// Find the x/y location and width/height (all in PIXELS) of the given object
-// in the given column.
+// in the given column.
//
// XXX IMPORTANT XXX:
// Hyatt says in the bug for this, that the following needs to be done:
-// (1) You need to deal with overflow when computing cell rects. See other column
-// iteration examples... if you don't deal with this, you'll mistakenly extend the
+// (1) You need to deal with overflow when computing cell rects. See other column
+// iteration examples... if you don't deal with this, you'll mistakenly extend the
// cell into the scrollbar's rect.
//
-// (2) You are adjusting the cell rect by the *row" border padding. That's
-// wrong. You need to first adjust a row rect by its border/padding, and then the
-// cell rect fits inside the adjusted row rect. It also can have border/padding
-// as well as margins. The vertical direction isn't that important, but you need
+// (2) You are adjusting the cell rect by the *row" border padding. That's
+// wrong. You need to first adjust a row rect by its border/padding, and then the
+// cell rect fits inside the adjusted row rect. It also can have border/padding
+// as well as margins. The vertical direction isn't that important, but you need
// to get the horizontal direction right.
//
-// (3) GetImageSize() does not include margins (but it does include border/padding).
+// (3) GetImageSize() does not include margins (but it does include border/padding).
// 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, nsITreeColumn* aCol, const nsACString& aElement,
int32_t *aX, int32_t *aY, int32_t *aWidth, int32_t *aHeight)
{
*aX = 0;
*aY = 0;
*aWidth = 0;
*aHeight = 0;
bool isRTL = StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
nscoord currX = mInnerBox.x - mHorzPosition;
- // The Rect for the requested item.
+ // The Rect for the requested item.
nsRect theRect;
nsPresContext* presContext = PresContext();
for (nsTreeColumn* currCol = mColumns->GetFirstColumn(); currCol; currCol = currCol->GetNext()) {
// The Rect for the current cell.
nscoord colWidth;
@@ -1118,91 +1118,91 @@ nsTreeBodyFrame::GetCoordsForCellItem(in
nsresult rv =
#endif
currCol->GetWidthInTwips(this, &colWidth);
NS_ASSERTION(NS_SUCCEEDED(rv), "invalid column");
nsRect cellRect(currX, mInnerBox.y + mRowHeight * (aRow - mTopRowIndex),
colWidth, mRowHeight);
- // Check the ID of the current column to see if it matches. If it doesn't
+ // Check the ID of the current column to see if it matches. If it doesn't
// increment the current X value and continue to the next column.
if (currCol != aCol) {
currX += cellRect.width;
continue;
}
// Now obtain the properties for our cell.
PrefillPropertyArray(aRow, currCol);
nsAutoString properties;
mView->GetCellProperties(aRow, currCol, properties);
nsTreeUtils::TokenizeProperties(properties, mScratchArray);
nsStyleContext* rowContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreerow);
// We don't want to consider any of the decorations that may be present
- // on the current row, so we have to deflate the rect by the border and
- // padding and offset its left and top coordinates appropriately.
+ // on the current row, so we have to deflate the rect by the border and
+ // padding and offset its left and top coordinates appropriately.
AdjustForBorderPadding(rowContext, cellRect);
nsStyleContext* cellContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreecell);
NS_NAMED_LITERAL_CSTRING(cell, "cell");
if (currCol->IsCycler() || cell.Equals(aElement)) {
- // If the current Column is a Cycler, then the Rect is just the cell - the margins.
- // Similarly, if we're just being asked for the cell rect, provide it.
+ // If the current Column is a Cycler, then the Rect is just the cell - the margins.
+ // Similarly, if we're just being asked for the cell rect, provide it.
theRect = cellRect;
nsMargin cellMargin;
cellContext->StyleMargin()->GetMargin(cellMargin);
theRect.Deflate(cellMargin);
break;
}
// Since we're not looking for the cell, and since the cell isn't a cycler,
- // we're looking for some subcomponent, and now we need to subtract the
- // borders and padding of the cell from cellRect so this does not
+ // we're looking for some subcomponent, and now we need to subtract the
+ // borders and padding of the cell from cellRect so this does not
// interfere with our computations.
AdjustForBorderPadding(cellContext, cellRect);
nsRenderingContext rc(
presContext->PresShell()->CreateReferenceRenderingContext());
- // Now we'll start making our way across the cell, starting at the edge of
- // the cell and proceeding until we hit the right edge. |cellX| is the
+ // Now we'll start making our way across the cell, starting at the edge of
+ // the cell and proceeding until we hit the right edge. |cellX| is the
// working X value that we will increment as we crawl from left to right.
nscoord cellX = cellRect.x;
nscoord remainWidth = cellRect.width;
if (currCol->IsPrimary()) {
// If the current Column is a Primary, then we need to take into account the indentation
- // and possibly a twisty.
-
- // The amount of indentation is the indentation width (|mIndentation|) by the level.
+ // and possibly a twisty.
+
+ // The amount of indentation is the indentation width (|mIndentation|) by the level.
int32_t level;
mView->GetLevel(aRow, &level);
if (!isRTL)
cellX += mIndentation * level;
remainWidth -= mIndentation * level;
- // Find the twisty rect by computing its size.
+ // Find the twisty rect by computing its size.
nsRect imageRect;
nsRect twistyRect(cellRect);
nsStyleContext* twistyContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreetwisty);
GetTwistyRect(aRow, currCol, imageRect, twistyRect, presContext,
twistyContext);
if (NS_LITERAL_CSTRING("twisty").Equals(aElement)) {
// If we're looking for the twisty Rect, just return the size
theRect = twistyRect;
break;
}
-
- // Now we need to add in the margins of the twisty element, so that we
- // can find the offset of the next element in the cell.
+
+ // Now we need to add in the margins of the twisty element, so that we
+ // can find the offset of the next element in the cell.
nsMargin twistyMargin;
twistyContext->StyleMargin()->GetMargin(twistyMargin);
twistyRect.Inflate(twistyMargin);
// Adjust our working X value with the twisty width (image size, margins,
// borders, padding.
if (!isRTL)
cellX += twistyRect.width;
@@ -1222,34 +1222,34 @@ nsTreeBodyFrame::GetCoordsForCellItem(in
// Add in the margins of the cell image.
nsMargin imageMargin;
imageContext->StyleMargin()->GetMargin(imageMargin);
imageSize.Inflate(imageMargin);
// Increment cellX by the image width
if (!isRTL)
cellX += imageSize.width;
-
- // Cell Text
+
+ // Cell Text
nsAutoString cellText;
mView->GetCellText(aRow, currCol, cellText);
// We're going to measure this text so we need to ensure bidi is enabled if
// necessary
CheckTextForBidi(cellText);
- // Create a scratch rect to represent the text rectangle, with the current
- // X and Y coords, and a guess at the width and height. The width is the
+ // Create a scratch rect to represent the text rectangle, with the current
+ // X and Y coords, and a guess at the width and height. The width is the
// remaining width we have left to traverse in the cell, which will be the
- // widest possible value for the text rect, and the row height.
+ // widest possible value for the text rect, and the row height.
nsRect textRect(cellX, cellRect.y, remainWidth, cellRect.height);
- // Measure the width of the text. If the width of the text is greater than
- // the remaining width available, then we just assume that the text has
+ // Measure the width of the text. If the width of the text is greater than
+ // the remaining width available, then we just assume that the text has
// been cropped and use the remaining rect as the text Rect. Otherwise,
- // we add in borders and padding to the text dimension and give that back.
+ // we add in borders and padding to the text dimension and give that back.
nsStyleContext* textContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreecelltext);
RefPtr<nsFontMetrics> fm =
nsLayoutUtils::GetFontMetricsForStyleContext(textContext);
nscoord height = fm->MaxHeight();
nsMargin textMargin;
textContext->StyleMargin()->GetMargin(textMargin);
@@ -1476,32 +1476,32 @@ nsTreeBodyFrame::AdjustForCellText(nsAut
}
break;
}
aTextRect.width = width;
}
nsIAtom*
-nsTreeBodyFrame::GetItemWithinCellAt(nscoord aX, const nsRect& aCellRect,
+nsTreeBodyFrame::GetItemWithinCellAt(nscoord aX, const nsRect& aCellRect,
int32_t aRowIndex,
nsTreeColumn* aColumn)
{
NS_PRECONDITION(aColumn && aColumn->GetFrame(), "invalid column passed");
// Obtain the properties for our cell.
PrefillPropertyArray(aRowIndex, aColumn);
nsAutoString properties;
mView->GetCellProperties(aRowIndex, aColumn, properties);
nsTreeUtils::TokenizeProperties(properties, mScratchArray);
// Resolve style for the cell.
nsStyleContext* cellContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreecell);
- // Obtain the margins for the cell and then deflate our rect by that
+ // Obtain the margins for the cell and then deflate our rect by that
// amount. The cell is assumed to be contained within the deflated rect.
nsRect cellRect(aCellRect);
nsMargin cellMargin;
cellContext->StyleMargin()->GetMargin(cellMargin);
cellRect.Deflate(cellMargin);
// Adjust the rect for its border and padding.
AdjustForBorderPadding(cellContext, cellRect);
@@ -1571,22 +1571,22 @@ nsTreeBodyFrame::GetItemWithinCellAt(nsc
if (hasTwisty)
return nsCSSAnonBoxes::moztreetwisty;
else
return nsCSSAnonBoxes::moztreecell;
}
if (!isRTL)
currX += twistyRect.width;
- remainingWidth -= twistyRect.width;
+ remainingWidth -= twistyRect.width;
}
-
+
// Now test to see if the user hit the icon for the cell.
nsRect iconRect(currX, cellRect.y, remainingWidth, cellRect.height);
-
+
// Resolve style for the image.
nsStyleContext* imageContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreeimage);
nsRect iconSize = GetImageSize(aRowIndex, aColumn, false, imageContext);
nsMargin imageMargin;
imageContext->StyleMargin()->GetMargin(imageMargin);
iconSize.Inflate(imageMargin);
iconRect.width = iconSize.width;
@@ -1595,17 +1595,17 @@ nsTreeBodyFrame::GetItemWithinCellAt(nsc
if (aX >= iconRect.x && aX < iconRect.x + iconRect.width) {
// The user clicked on the image.
return nsCSSAnonBoxes::moztreeimage;
}
if (!isRTL)
currX += iconRect.width;
- remainingWidth -= iconRect.width;
+ remainingWidth -= iconRect.width;
nsAutoString cellText;
mView->GetCellText(aRowIndex, aColumn, cellText);
// We're going to measure this text so we need to ensure bidi is enabled if
// necessary
CheckTextForBidi(cellText);
nsRect textRect(currX, cellRect.y, remainingWidth, cellRect.height);
@@ -1635,17 +1635,17 @@ nsTreeBodyFrame::GetCellAt(nscoord aX, n
*aCol = nullptr;
*aChildElt = nullptr;
*aRow = GetRowAt(aX, aY);
if (*aRow < 0)
return;
// Determine the column hit.
- for (nsTreeColumn* currCol = mColumns->GetFirstColumn(); currCol;
+ for (nsTreeColumn* currCol = mColumns->GetFirstColumn(); currCol;
currCol = currCol->GetNext()) {
nsRect cellRect;
nsresult rv = currCol->GetRect(this,
mInnerBox.y +
mRowHeight * (*aRow - mTopRowIndex),
mRowHeight,
&cellRect);
if (NS_FAILED(rv)) {
@@ -1693,24 +1693,24 @@ nsTreeBodyFrame::GetCellWidth(int32_t aR
nsStyleContext* cellContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreecell);
nsMargin bp(0,0,0,0);
GetBorderPadding(cellContext, bp);
aCurrentSize = cellRect.width;
aDesiredSize = bp.left + bp.right;
if (aCol->IsPrimary()) {
- // If the current Column is a Primary, then we need to take into account
- // the indentation and possibly a twisty.
+ // If the current Column is a Primary, then we need to take into account
+ // the indentation and possibly a twisty.
// The amount of indentation is the indentation width (|mIndentation|) by the level.
int32_t level;
mView->GetLevel(aRow, &level);
aDesiredSize += mIndentation * level;
-
+
// Find the twisty rect by computing its size.
nsStyleContext* twistyContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreetwisty);
nsRect imageSize;
nsRect twistyRect(cellRect);
GetTwistyRect(aRow, aCol, imageSize, twistyRect, PresContext(),
twistyContext);
@@ -1727,17 +1727,17 @@ nsTreeBodyFrame::GetCellWidth(int32_t aR
// Account for the width of the cell image.
nsRect imageSize = GetImageSize(aRow, aCol, false, imageContext);
// Add in the margins of the cell image.
nsMargin imageMargin;
imageContext->StyleMargin()->GetMargin(imageMargin);
imageSize.Inflate(imageMargin);
aDesiredSize += imageSize.width;
-
+
// Get the cell text.
nsAutoString cellText;
mView->GetCellText(aRow, aCol, cellText);
// We're going to measure this text so we need to ensure bidi is enabled if
// necessary
CheckTextForBidi(cellText);
nsStyleContext* textContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreecelltext);
@@ -1752,17 +1752,17 @@ nsTreeBodyFrame::GetCellWidth(int32_t aR
*aRenderingContext);
nscoord totalTextWidth = width + bp.left + bp.right;
aDesiredSize += totalTextWidth;
return NS_OK;
}
nsresult
nsTreeBodyFrame::IsCellCropped(int32_t aRow, nsITreeColumn* aCol, bool *_retval)
-{
+{
nscoord currentSize, desiredSize;
nsresult rv;
RefPtr<nsTreeColumn> col = GetColumnImpl(aCol);
if (!col)
return NS_ERROR_INVALID_ARG;
nsRenderingContext rc(
@@ -1842,20 +1842,20 @@ nsTreeBodyFrame::RowCountChanged(int32_t
mView->GetRowCount(&rowCount);
NS_ASSERTION(rowCount == mRowCount, "row count did not change by the amount suggested, check caller");
#endif
int32_t count = Abs(aCount);
int32_t last = LastVisibleRow();
if (aIndex >= mTopRowIndex && aIndex <= last)
InvalidateRange(aIndex, last);
-
+
ScrollParts parts = GetScrollParts();
- if (mTopRowIndex == 0) {
+ if (mTopRowIndex == 0) {
// Just update the scrollbar and return.
if (FullScrollbarsUpdate(false)) {
MarkDirtyIfSelect();
}
return NS_OK;
}
bool needsInvalidation = false;
@@ -1917,17 +1917,17 @@ nsTreeBodyFrame::EndUpdateBatch()
return NS_OK;
}
void
nsTreeBodyFrame::PrefillPropertyArray(int32_t aRowIndex, nsTreeColumn* aCol)
{
NS_PRECONDITION(!aCol || aCol->GetFrame(), "invalid column passed");
mScratchArray.Clear();
-
+
// focus
if (mFocused)
mScratchArray.AppendElement(nsGkAtoms::focus);
// sort
bool sorted = false;
mView->IsSorted(&sorted);
if (sorted)
@@ -1935,33 +1935,33 @@ nsTreeBodyFrame::PrefillPropertyArray(in
// drag session
if (mSlots && mSlots->mIsDragging)
mScratchArray.AppendElement(nsGkAtoms::dragSession);
if (aRowIndex != -1) {
if (aRowIndex == mMouseOverRow)
mScratchArray.AppendElement(nsGkAtoms::hover);
-
+
nsCOMPtr<nsITreeSelection> selection;
mView->GetSelection(getter_AddRefs(selection));
if (selection) {
// selected
bool isSelected;
selection->IsSelected(aRowIndex, &isSelected);
if (isSelected)
mScratchArray.AppendElement(nsGkAtoms::selected);
// current
int32_t currentIndex;
selection->GetCurrentIndex(¤tIndex);
if (aRowIndex == currentIndex)
mScratchArray.AppendElement(nsGkAtoms::current);
-
+
// active
if (aCol) {
nsCOMPtr<nsITreeColumn> currentColumn;
selection->GetCurrentColumn(getter_AddRefs(currentColumn));
if (aCol == currentColumn)
mScratchArray.AppendElement(nsGkAtoms::active);
}
}
@@ -2250,43 +2250,43 @@ nsRect nsTreeBodyFrame::GetImageSize(int
}
if (myPosition->mWidth.GetUnit() == eStyleUnit_Coord) {
int32_t val = myPosition->mWidth.GetCoordValue();
r.width += val;
}
else if (useImageRegion && myList->mImageRegion.width > 0)
r.width += myList->mImageRegion.width;
- else
+ else
needWidth = true;
if (myPosition->mHeight.GetUnit() == eStyleUnit_Coord) {
int32_t val = myPosition->mHeight.GetCoordValue();
r.height += val;
}
else if (useImageRegion && myList->mImageRegion.height > 0)
r.height += myList->mImageRegion.height;
- else
+ else
needHeight = true;
if (image) {
if (needWidth || needHeight) {
// Get the natural image size.
if (needWidth) {
// Get the size from the image.
nscoord width;
image->GetWidth(&width);
- r.width += nsPresContext::CSSPixelsToAppUnits(width);
+ r.width += nsPresContext::CSSPixelsToAppUnits(width);
}
-
+
if (needHeight) {
nscoord height;
image->GetHeight(&height);
- r.height += nsPresContext::CSSPixelsToAppUnits(height);
+ r.height += nsPresContext::CSSPixelsToAppUnits(height);
}
}
}
return r;
}
// GetImageDestSize returns the destination size of the image.
@@ -2490,18 +2490,18 @@ nsTreeBodyFrame::CalcHorzWidth(const Scr
// visibility of the columnpicker and the scrollbar.
if (aParts.mColumnsFrame)
mAdjustWidth = mRect.width - aParts.mColumnsFrame->GetRect().width;
else
mAdjustWidth = 0;
nscoord width = 0;
- // We calculate this from the scrollable frame, so that it
- // properly covers all contingencies of what could be
+ // We calculate this from the scrollable frame, so that it
+ // properly covers all contingencies of what could be
// scrollable (columns, body, etc...)
if (aParts.mColumnsScrollFrame) {
width = aParts.mColumnsScrollFrame->GetScrollRange().width +
aParts.mColumnsScrollFrame->GetScrollPortRect().width;
}
// If no horz scrolling periphery is present, then just return our width
@@ -2644,17 +2644,17 @@ nsTreeBodyFrame::HandleEvent(nsPresConte
LazyScrollCallback, nsITimer::TYPE_ONE_SHOT,
getter_AddRefs(mSlots->mTimer));
}
#endif
// Bail out to prevent spring loaded timer and feedback line settings.
return NS_OK;
}
- // If changed from last time, invalidate primary cell at the old location and if allowed,
+ // If changed from last time, invalidate primary cell at the old location and if allowed,
// invalidate primary cell at the new location. If nothing changed, just bail.
if (mSlots->mDropRow != lastDropRow ||
mSlots->mDropOrient != lastDropOrient ||
mSlots->mDragAction != lastDragAction) {
// Invalidate row at the old location.
if (mSlots->mDropAllowed) {
mSlots->mDropAllowed = false;
@@ -2988,17 +2988,17 @@ nsTreeBodyFrame::PaintColumn(nsTreeColum
nsAutoString properties;
mView->GetColumnProperties(aColumn, properties);
nsTreeUtils::TokenizeProperties(properties, mScratchArray);
// Resolve style for the column. It contains all the info we need to lay ourselves
// out and to paint.
nsStyleContext* colContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreecolumn);
- // Obtain the margins for the cell and then deflate our rect by that
+ // Obtain the margins for the cell and then deflate our rect by that
// amount. The cell is assumed to be contained within the deflated rect.
nsRect colRect(aColumnRect);
nsMargin colMargin;
colContext->StyleMargin()->GetMargin(colMargin);
colRect.Deflate(colMargin);
return PaintBackgroundLayer(colContext, aPresContext, aRenderingContext,
colRect, aDirtyRect);
@@ -3009,17 +3009,17 @@ nsTreeBodyFrame::PaintRow(int32_t
const nsRect& aRowRect,
nsPresContext* aPresContext,
nsRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
nsPoint aPt)
{
// We have been given a rect for our row. We treat this row like a full-blown
// frame, meaning that it can have borders, margins, padding, and a background.
-
+
// Without a view, we have no data. Check for this up front.
if (!mView) {
return DrawResult::SUCCESS;
}
nsresult rv;
// Now obtain the properties for our row.
@@ -3029,17 +3029,17 @@ nsTreeBodyFrame::PaintRow(int32_t
nsAutoString properties;
mView->GetRowProperties(aRowIndex, properties);
nsTreeUtils::TokenizeProperties(properties, mScratchArray);
// Resolve style for the row. It contains all the info we need to lay ourselves
// out and to paint.
nsStyleContext* rowContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreerow);
- // Obtain the margins for the row and then deflate our rect by that
+ // Obtain the margins for the row and then deflate our rect by that
// amount. The row is assumed to be contained within the deflated rect.
nsRect rowRect(aRowRect);
nsMargin rowMargin;
rowContext->StyleMargin()->GetMargin(rowMargin);
rowRect.Deflate(rowMargin);
DrawResult result = DrawResult::SUCCESS;
@@ -3062,17 +3062,17 @@ nsTreeBodyFrame::PaintRow(int32_t
nsRect dirty;
dirty.IntersectRect(rowRect, aDirtyRect);
theme->DrawWidgetBackground(&aRenderingContext, this, appearance, rowRect,
dirty);
} else {
result &= PaintBackgroundLayer(rowContext, aPresContext, aRenderingContext,
rowRect, aDirtyRect);
}
-
+
// Adjust the rect for its border and padding.
nsRect originalRowRect = rowRect;
AdjustForBorderPadding(rowContext, rowRect);
bool isSeparator = false;
mView->IsSeparator(aRowIndex, &isSeparator);
if (isSeparator) {
// The row is a separator.
@@ -3194,31 +3194,31 @@ nsTreeBodyFrame::PaintSeparator(int32_t
DrawResult result = DrawResult::SUCCESS;
// use -moz-appearance if provided.
if (useTheme) {
nsRect dirty;
dirty.IntersectRect(aSeparatorRect, aDirtyRect);
theme->DrawWidgetBackground(&aRenderingContext, this,
- displayData->mAppearance, aSeparatorRect, dirty);
+ displayData->mAppearance, aSeparatorRect, dirty);
}
else {
const nsStylePosition* stylePosition = separatorContext->StylePosition();
// Obtain the height for the separator or use the default value.
nscoord height;
if (stylePosition->mHeight.GetUnit() == eStyleUnit_Coord)
height = stylePosition->mHeight.GetCoordValue();
else {
// Use default height 2px.
height = nsPresContext::CSSPixelsToAppUnits(2);
}
- // Obtain the margins for the separator and then deflate our rect by that
+ // Obtain the margins for the separator and then deflate our rect by that
// amount. The separator is assumed to be contained within the deflated rect.
nsRect separatorRect(aSeparatorRect.x, aSeparatorRect.y, aSeparatorRect.width, height);
nsMargin separatorMargin;
separatorContext->StyleMargin()->GetMargin(separatorMargin);
separatorRect.Deflate(separatorMargin);
// Center the separator.
separatorRect.y += (aSeparatorRect.height - height) / 2;
@@ -3251,17 +3251,17 @@ nsTreeBodyFrame::PaintCell(int32_t
nsTreeUtils::TokenizeProperties(properties, mScratchArray);
// Resolve style for the cell. It contains all the info we need to lay ourselves
// out and to paint.
nsStyleContext* cellContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreecell);
bool isRTL = StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
- // Obtain the margins for the cell and then deflate our rect by that
+ // Obtain the margins for the cell and then deflate our rect by that
// amount. The cell is assumed to be contained within the deflated rect.
nsRect cellRect(aCellRect);
nsMargin cellMargin;
cellContext->StyleMargin()->GetMargin(cellMargin);
cellRect.Deflate(cellMargin);
// Paint our borders and background for our row rect.
DrawResult result = PaintBackgroundLayer(cellContext, aPresContext,
@@ -3270,34 +3270,34 @@ nsTreeBodyFrame::PaintCell(int32_t
// Adjust the rect for its border and padding.
AdjustForBorderPadding(cellContext, cellRect);
nscoord currX = cellRect.x;
nscoord remainingWidth = cellRect.width;
// Now we paint the contents of the cells.
- // Directionality of the tree determines the order in which we paint.
+ // Directionality of the tree determines the order in which we paint.
// NS_STYLE_DIRECTION_LTR means paint from left to right.
// NS_STYLE_DIRECTION_RTL means paint from right to left.
if (aColumn->IsPrimary()) {
// If we're the primary column, we need to indent and paint the twisty and any connecting lines
// between siblings.
int32_t level;
mView->GetLevel(aRowIndex, &level);
if (!isRTL)
currX += mIndentation * level;
remainingWidth -= mIndentation * level;
// Resolve the style to use for the connecting lines.
nsStyleContext* lineContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreeline);
-
+
if (mIndentation && level &&
lineContext->StyleVisibility()->IsVisibleOrCollapsed()) {
// Paint the thread lines.
// Get the size of the twisty. We don't want to paint the twisty
// before painting of connecting lines since it would paint lines over
// the twisty. But we need to leave a place for it.
nsStyleContext* twistyContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreetwisty);
@@ -3362,17 +3362,17 @@ nsTreeBodyFrame::PaintCell(int32_t
if (hasNextSibling)
p2.y = pc->AppUnitsToGfxUnits(lineY + mRowHeight);
else if (i == level)
p2.y = pc->AppUnitsToGfxUnits(lineY + mRowHeight / 2);
SnapLineToDevicePixelsForStroking(p1, p2, *drawTarget,
strokeOptions.mLineWidth);
drawTarget->StrokeLine(p1, p2, colorPatt, strokeOptions);
- }
+ }
}
int32_t parent;
if (NS_FAILED(mView->GetParentIndex(currentParent, &parent)) || parent < 0)
break;
currentParent = parent;
srcX -= mIndentation;
}
@@ -3381,28 +3381,28 @@ nsTreeBodyFrame::PaintCell(int32_t
}
// Always leave space for the twisty.
nsRect twistyRect(currX, cellRect.y, remainingWidth, cellRect.height);
result &= PaintTwisty(aRowIndex, aColumn, twistyRect, aPresContext,
aRenderingContext, aDirtyRect, remainingWidth,
currX);
}
-
+
// Now paint the icon for our cell.
nsRect iconRect(currX, cellRect.y, remainingWidth, cellRect.height);
nsRect dirtyRect;
if (dirtyRect.IntersectRect(aDirtyRect, iconRect)) {
result &= PaintImage(aRowIndex, aColumn, iconRect, aPresContext,
aRenderingContext, aDirtyRect, remainingWidth,
currX);
}
// Now paint our element, but only if we aren't a cycler column.
- // XXX until we have the ability to load images, allow the view to
+ // XXX until we have the ability to load images, allow the view to
// insert text into cycler columns...
if (!aColumn->IsCycler()) {
nsRect elementRect(currX, cellRect.y, remainingWidth, cellRect.height);
nsRect dirtyRect;
if (dirtyRect.IntersectRect(aDirtyRect, elementRect)) {
switch (aColumn->GetType()) {
case nsITreeColumn::TYPE_TEXT:
case nsITreeColumn::TYPE_PASSWORD:
@@ -3462,28 +3462,28 @@ nsTreeBodyFrame::PaintTwisty(int32_t
mView->IsContainerEmpty(aRowIndex, &isContainerEmpty);
if (!isContainerEmpty)
shouldPaint = true;
}
// Resolve style for the twisty.
nsStyleContext* twistyContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreetwisty);
- // Obtain the margins for the twisty and then deflate our rect by that
+ // Obtain the margins for the twisty and then deflate our rect by that
// amount. The twisty is assumed to be contained within the deflated rect.
nsRect twistyRect(aTwistyRect);
nsMargin twistyMargin;
twistyContext->StyleMargin()->GetMargin(twistyMargin);
twistyRect.Deflate(twistyMargin);
nsRect imageSize;
nsITheme* theme = GetTwistyRect(aRowIndex, aColumn, imageSize, twistyRect,
aPresContext, twistyContext);
- // Subtract out the remaining width. This is done even when we don't actually paint a twisty in
+ // Subtract out the remaining width. This is done even when we don't actually paint a twisty in
// this cell, so that cells in different rows still line up.
nsRect copyRect(twistyRect);
copyRect.Inflate(twistyMargin);
aRemainingWidth -= copyRect.width;
if (!isRTL)
aCurrX += copyRect.width;
DrawResult result = DrawResult::SUCCESS;
@@ -3497,17 +3497,17 @@ nsTreeBodyFrame::PaintTwisty(int32_t
if (theme) {
if (isRTL)
twistyRect.x = rightEdge - twistyRect.width;
// yeah, I know it says we're drawing a background, but a twisty is really a fg
// object since it doesn't have anything that gecko would want to draw over it. Besides,
// we have to prevent imagelib from drawing it.
nsRect dirty;
dirty.IntersectRect(twistyRect, aDirtyRect);
- theme->DrawWidgetBackground(&aRenderingContext, this,
+ theme->DrawWidgetBackground(&aRenderingContext, this,
twistyContext->StyleDisplay()->mAppearance, twistyRect, dirty);
}
else {
// Time to paint the twisty.
// Adjust the rect for its border and padding.
nsMargin bp(0,0,0,0);
GetBorderPadding(twistyContext, bp);
twistyRect.Deflate(bp);
@@ -3760,17 +3760,17 @@ nsTreeBodyFrame::PaintText(int32_t
// Resolve style for the text. It contains all the info we need to lay ourselves
// out and to paint.
nsStyleContext* textContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreecelltext);
// Obtain opacity value for the image.
float opacity = textContext->StyleEffects()->mOpacity;
- // Obtain the margins for the text and then deflate our rect by that
+ // Obtain the margins for the text and then deflate our rect by that
// amount. The text is assumed to be contained within the deflated rect.
nsRect textRect(aTextRect);
nsMargin textMargin;
textContext->StyleMargin()->GetMargin(textMargin);
textRect.Deflate(textMargin);
// Adjust the rect for its border and padding.
nsMargin bp(0,0,0,0);
@@ -3869,23 +3869,23 @@ nsTreeBodyFrame::PaintCheckbox(int32_t
{
NS_PRECONDITION(aColumn && aColumn->GetFrame(), "invalid column passed");
// Resolve style for the checkbox.
nsStyleContext* checkboxContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreecheckbox);
nscoord rightEdge = aCheckboxRect.XMost();
- // Obtain the margins for the checkbox and then deflate our rect by that
+ // Obtain the margins for the checkbox and then deflate our rect by that
// amount. The checkbox is assumed to be contained within the deflated rect.
nsRect checkboxRect(aCheckboxRect);
nsMargin checkboxMargin;
checkboxContext->StyleMargin()->GetMargin(checkboxMargin);
checkboxRect.Deflate(checkboxMargin);
-
+
nsRect imageSize = GetImageSize(aRowIndex, aColumn, true, checkboxContext);
if (imageSize.height > checkboxRect.height)
imageSize.height = checkboxRect.height;
if (imageSize.width > checkboxRect.width)
imageSize.width = checkboxRect.width;
if (StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL)
@@ -3903,17 +3903,17 @@ nsTreeBodyFrame::PaintCheckbox(int32_t
checkboxRect.Deflate(bp);
// Get the image for drawing.
nsCOMPtr<imgIContainer> image;
bool useImageRegion = true;
GetImage(aRowIndex, aColumn, true, checkboxContext, useImageRegion, getter_AddRefs(image));
if (image) {
nsPoint pt = checkboxRect.TopLeft();
-
+
if (imageSize.height < checkboxRect.height) {
pt.y += (checkboxRect.height - imageSize.height)/2;
}
if (imageSize.width < checkboxRect.width) {
pt.x += (checkboxRect.width - imageSize.width)/2;
}
@@ -3937,30 +3937,30 @@ nsTreeBodyFrame::PaintProgressMeter(int3
const nsRect& aDirtyRect)
{
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
+ // 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.
DrawResult result = PaintBackgroundLayer(meterContext, aPresContext,
aRenderingContext, meterRect,
aDirtyRect);
- // Time to paint our progress.
+ // 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;
@@ -4060,17 +4060,17 @@ nsTreeBodyFrame::PaintDropFeedback(const
DrawResult result = DrawResult::SUCCESS;
// Paint only if it is visible.
if (feedbackContext->StyleVisibility()->IsVisibleOrCollapsed()) {
int32_t level;
mView->GetLevel(mSlots->mDropRow, &level);
- // If our previous or next row has greater level use that for
+ // If our previous or next row has greater level use that for
// correct visual indentation.
if (mSlots->mDropOrient == nsITreeView::DROP_BEFORE) {
if (mSlots->mDropRow > 0) {
int32_t previousLevel;
mView->GetLevel(mSlots->mDropRow - 1, &previousLevel);
if (previousLevel > level)
level = previousLevel;
}
@@ -4212,17 +4212,17 @@ nsTreeBodyFrame::EnsureCellIsVisible(int
nscoord columnWidth;
rv = col->GetWidthInTwips(this, &columnWidth);
if(NS_FAILED(rv)) return rv;
// If the start of the column is before the
// start of the horizontal view, then scroll
if (columnPos < mHorzPosition)
result = columnPos;
- // If the end of the column is past the end of
+ // If the end of the column is past the end of
// the horizontal view, then scroll
else if ((columnPos + columnWidth) > (mHorzPosition + mInnerBox.width))
result = ((columnPos + columnWidth) - (mHorzPosition + mInnerBox.width)) + mHorzPosition;
if (result != -1) {
rv = ScrollHorzInternal(parts, result);
if(NS_FAILED(rv)) return rv;
}
@@ -4351,17 +4351,17 @@ nsTreeBodyFrame::ScrollHorzInternal(cons
if (aPosition == mHorzPosition)
return NS_OK;
if (aPosition < 0 || aPosition > mHorzWidth)
return NS_OK;
nsRect bounds = aParts.mColumnsFrame->GetRect();
- if (aPosition > (mHorzWidth - bounds.width))
+ if (aPosition > (mHorzWidth - bounds.width))
aPosition = mHorzWidth - bounds.width;
mHorzPosition = aPosition;
Invalidate();
// Update the column scroll view
nsWeakFrame weakFrame(this);
@@ -4384,17 +4384,17 @@ nsTreeBodyFrame::ScrollByPage(nsScrollba
ScrollByPages(aDirection);
}
void
nsTreeBodyFrame::ScrollByWhole(nsScrollbarFrame* aScrollbar, int32_t aDirection,
nsIScrollbarMediator::ScrollSnapMode aSnap)
{
// CSS Scroll Snapping is not enabled for XUL, aSnap is ignored
- MOZ_ASSERT(aScrollbar != nullptr);
+ MOZ_ASSERT(aScrollbar != nullptr);
int32_t newIndex = aDirection < 0 ? 0 : mTopRowIndex;
ScrollToRow(newIndex);
}
void
nsTreeBodyFrame::ScrollByLine(nsScrollbarFrame* aScrollbar, int32_t aDirection,
nsIScrollbarMediator::ScrollSnapMode aSnap)
{
@@ -4435,23 +4435,23 @@ nsTreeBodyFrame::RepeatButtonScroll(nsSc
}
void
nsTreeBodyFrame::ThumbMoved(nsScrollbarFrame* aScrollbar,
nscoord aOldPos,
nscoord aNewPos)
{
ScrollParts parts = GetScrollParts();
-
+
if (aOldPos == aNewPos)
return;
nsWeakFrame weakFrame(this);
- // Vertical Scrollbar
+ // Vertical Scrollbar
if (parts.mVScrollbar == aScrollbar) {
nscoord rh = nsPresContext::AppUnitsToIntCSSPixels(mRowHeight);
nscoord newIndex = nsPresContext::AppUnitsToIntCSSPixels(aNewPos);
nscoord newrow = newIndex/rh;
ScrollInternal(parts, newrow);
// Horizontal Scrollbar
} else if (parts.mHScrollbar == aScrollbar) {
int32_t newIndex = nsPresContext::AppUnitsToIntCSSPixels(aNewPos);
@@ -4528,17 +4528,17 @@ nsTreeBodyFrame::DidSetStyleContext(nsSt
// XXX The following is hacky, but it's not incorrect,
// and appears to fix a few bugs with style changes, like text zoom and
// dpi changes
mIndentation = GetIndentation();
mRowHeight = GetRowHeight();
mStringWidth = -1;
}
-bool
+bool
nsTreeBodyFrame::OffsetForHorzScroll(nsRect& rect, bool clip)
{
rect.x -= mHorzPosition;
// Scrolled out before
if (rect.XMost() <= mInnerBox.x)
return false;
@@ -4580,17 +4580,17 @@ nsTreeBodyFrame::CanAutoScroll(int32_t a
// Doesn't query the content about if the drag is allowable, that's done elsewhere.
//
// For containers, we break up the vertical space of the row as follows: if in
// the topmost 25%, the drop is _before_ the row the mouse is over; if in the
// last 25%, _after_; in the middle 50%, we consider it a drop _on_ the container.
//
// For non-containers, if the mouse is in the top 50% of the row, the drop is
// _before_ and the bottom 50% _after_
-void
+void
nsTreeBodyFrame::ComputeDropPosition(WidgetGUIEvent* aEvent,
int32_t* aRow,
int16_t* aOrient,
int16_t* aScrollLines)
{
*aOrient = -1;
*aScrollLines = 0;
@@ -4599,17 +4599,17 @@ nsTreeBodyFrame::ComputeDropPosition(Wid
nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, this);
int32_t xTwips = pt.x - mInnerBox.x;
int32_t yTwips = pt.y - mInnerBox.y;
*aRow = GetRowAt(xTwips, yTwips);
if (*aRow >=0) {
// Compute the top/bottom of the row in question.
int32_t yOffset = yTwips - mRowHeight * (*aRow - mTopRowIndex);
-
+
bool isContainer = false;
mView->IsContainer (*aRow, &isContainer);
if (isContainer) {
// for a container, use a 25%/50%/25% breakdown
if (yOffset < mRowHeight / 4)
*aOrient = nsITreeView::DROP_BEFORE;
else if (yOffset > mRowHeight - (mRowHeight / 4))
*aOrient = nsITreeView::DROP_AFTER;