diff --git a/layout/xul/base/Makefile.in b/layout/xul/base/Makefile.in index 99d2ec7d635..5494a8738cb 100644 --- a/layout/xul/base/Makefile.in +++ b/layout/xul/base/Makefile.in @@ -44,9 +44,5 @@ include $(DEPTH)/config/autoconf.mk DIRS = public src -ifdef MOZ_MOCHITEST -DIRS += test -endif - include $(topsrcdir)/config/rules.mk diff --git a/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp b/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp index a3a5cbb2b4c..d4b54badf3d 100644 --- a/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp +++ b/layout/xul/base/src/grid/nsGridRowLeafLayout.cpp @@ -143,46 +143,46 @@ nsGridRowLeafLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, ns // If we are a row lets change the sizes to match our columns. If we are a column then do the opposite // and make them match or rows. if (grid) { - nsGridRow* column; - PRInt32 count = grid->GetColumnCount(isHorizontal); - nsBoxSize* start = nsnull; - nsBoxSize* last = nsnull; - nsBoxSize* current = nsnull; - nsIBox* child = aBox->GetChildBox(); - for (int i=0; i < count; i++) - { - column = grid->GetColumnAt(i,isHorizontal); + nsGridRow* column; + PRInt32 count = grid->GetColumnCount(isHorizontal); + nsBoxSize* start = nsnull; + nsBoxSize* last = nsnull; + nsBoxSize* current = nsnull; + nsIBox* child = aBox->GetChildBox(); + for (int i=0; i < count; i++) + { + column = grid->GetColumnAt(i,isHorizontal); - // make sure the value was computed before we use it. - // !isHorizontal is passed in to invert the behavior of these methods. - nscoord pref = - grid->GetPrefRowHeight(aState, i, !isHorizontal); // GetPrefColumnWidth - nscoord min = - grid->GetMinRowHeight(aState, i, !isHorizontal); // GetMinColumnWidth - nscoord max = - grid->GetMaxRowHeight(aState, i, !isHorizontal); // GetMaxColumnWidth - nscoord flex = - grid->GetRowFlex(aState, i, !isHorizontal); // GetColumnFlex - nscoord left = 0; - nscoord right = 0; - grid->GetRowOffsets(aState, i, left, right, !isHorizontal); // GetColumnOffsets - nsIBox* box = column->GetBox(); - PRBool collapsed = PR_FALSE; - nscoord topMargin = column->mTopMargin; - nscoord bottomMargin = column->mBottomMargin; + // make sure the value was computed before we use it. + // !isHorizontal is passed in to invert the behavior of these methods. + nscoord pref = + grid->GetPrefRowHeight(aState, i, !isHorizontal); // GetPrefColumnWidth + nscoord min = + grid->GetMinRowHeight(aState, i, !isHorizontal); // GetMinColumnWidth + nscoord max = + grid->GetMaxRowHeight(aState, i, !isHorizontal); // GetMaxColumnWidth + nscoord flex = + grid->GetRowFlex(aState, i, !isHorizontal); // GetColumnFlex + nscoord left = 0; + nscoord right = 0; + grid->GetRowOffsets(aState, i, left, right, !isHorizontal); // GetColumnOffsets + nsIBox* box = column->GetBox(); + PRBool collapsed = PR_FALSE; + nscoord topMargin = column->mTopMargin; + nscoord bottomMargin = column->mBottomMargin; - if (box) - collapsed = box->IsCollapsed(aState); + if (box) + collapsed = box->IsCollapsed(aState); - pref = pref - (left + right); - if (pref < 0) - pref = 0; + pref = pref - (left + right); + if (pref < 0) + pref = 0; - // if this is the first or last column. Take into account that - // our row could have a border that could affect our left or right - // padding from our columns. If the row has padding subtract it. - // would should always be able to garentee that our margin is smaller - // or equal to our left or right + // if this is the first or last column. Take into account that + // our row could have a border that could affect our left or right + // padding from our columns. If the row has padding subtract it. + // would should always be able to garentee that our margin is smaller + // or equal to our left or right PRInt32 firstIndex = 0; PRInt32 lastIndex = 0; nsGridRow* firstRow = nsnull; @@ -216,33 +216,33 @@ nsGridRowLeafLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, ns right -= offset.bottom; } } + + // initialize the box size here + nsBox::BoundsCheck(min, pref, max); + + current = new (aState) nsBoxSize(); + current->pref = pref; + current->min = min; + current->max = max; + current->flex = flex; + current->bogus = column->mIsBogus; + current->left = left + topMargin; + current->right = right + bottomMargin; + current->collapsed = collapsed; - // initialize the box size here - nsBox::BoundsCheck(min, pref, max); - - current = new (aState) nsBoxSize(); - current->pref = pref; - current->min = min; - current->max = max; - current->flex = flex; - current->bogus = column->mIsBogus; - current->left = left + topMargin; - current->right = right + bottomMargin; - current->collapsed = collapsed; - - if (!start) { + if (!start) { start = current; last = start; - } else { + } else { last->next = current; last = current; - } + } - if (child && !column->mIsBogus) - child = child->GetNextBox(); + if (child && !column->mIsBogus) + child = child->GetNextBox(); - } - aBoxSizes = start; + } + aBoxSizes = start; } nsSprocketLayout::PopulateBoxSizes(aBox, aState, aBoxSizes, aComputedBoxSizes, aMinSize, aMaxSize, aFlexes); @@ -258,51 +258,49 @@ nsGridRowLeafLayout::ComputeChildSizes(nsIBox* aBox, // see if we are in a scrollable frame. If we are then there could be scrollbars present // if so we need to subtract them out to make sure our columns line up. if (aBox) { - PRBool isHorizontal = aBox->IsHorizontal(); + PRBool isHorizontal = aBox->IsHorizontal(); - // go up the parent chain looking for scrollframes - nscoord diff = 0; - nsCOMPtr parent; - nsIBox* parentBox; - GetParentGridPart(aBox, &parentBox, getter_AddRefs(parent)); - while (parentBox) { - nsIBox* scrollbox = nsGrid::GetScrollBox(parentBox); - nsCOMPtr scrollable = do_QueryInterface(scrollbox); - if (scrollable) { - nsMargin scrollbarSizes = scrollable->GetActualScrollbarSizes(); + // go up the parent chain looking for scrollframes + aBox = aBox->GetParentBox(); + nsIBox* scrollbox = nsGrid::GetScrollBox(aBox); + + nsCOMPtr scrollable = do_QueryInterface(scrollbox); + if (scrollable) { + nsMargin scrollbarSizes = scrollable->GetActualScrollbarSizes(); - if (isHorizontal) { - diff += scrollbarSizes.left + scrollbarSizes.right; - } else { - diff += scrollbarSizes.top + scrollbarSizes.bottom; - } - } + nsRect ourRect(scrollbox->GetRect()); + nsMargin padding(0,0,0,0); + scrollbox->GetBorderAndPadding(padding); + ourRect.Deflate(padding); - GetParentGridPart(parentBox, &parentBox, getter_AddRefs(parent)); - } + nscoord diff; + if (isHorizontal) { + diff = scrollbarSizes.left + scrollbarSizes.right; + } else { + diff = scrollbarSizes.top + scrollbarSizes.bottom; + } - if (diff > 0) { - aGivenSize += diff; + if (diff > 0) { + aGivenSize += diff; - nsSprocketLayout::ComputeChildSizes(aBox, aState, aGivenSize, aBoxSizes, aComputedBoxSizes); + nsSprocketLayout::ComputeChildSizes(aBox, aState, aGivenSize, aBoxSizes, aComputedBoxSizes); - aGivenSize -= diff; + aGivenSize -= diff; - nsComputedBoxSize* s = aComputedBoxSizes; - nsComputedBoxSize* last = aComputedBoxSizes; - while(s) - { - last = s; - s = s->next; - } - - if (last) - last->size -= diff; - - return; - } + nsComputedBoxSize* s = aComputedBoxSizes; + nsComputedBoxSize* last = aComputedBoxSizes; + while(s) + { + last = s; + s = s->next; + } + + if (last) + last->size -= diff; + } + } } - + nsSprocketLayout::ComputeChildSizes(aBox, aState, aGivenSize, aBoxSizes, aComputedBoxSizes); } diff --git a/layout/xul/base/test/Makefile.in b/layout/xul/base/test/Makefile.in deleted file mode 100644 index 677cbe89d25..00000000000 --- a/layout/xul/base/test/Makefile.in +++ /dev/null @@ -1,51 +0,0 @@ -# -# ***** BEGIN LICENSE BLOCK ***** -# Version: MPL 1.1/GPL 2.0/LGPL 2.1 -# -# The contents of this file are subject to the Mozilla Public License Version -# 1.1 (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -# for the specific language governing rights and limitations under the -# License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is -# Wladimir Palant. -# Portions created by the Initial Developer are Copyright (C) 2007 -# the Initial Developer. All Rights Reserved. -# -# Contributor(s): -# -# Alternatively, the contents of this file may be used under the terms of -# either of the GNU General Public License Version 2 or later (the "GPL"), -# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), -# in which case the provisions of the GPL or the LGPL are applicable instead -# of those above. If you wish to allow use of your version of this file only -# under the terms of either the GPL or the LGPL, and not to allow others to -# use your version of this file under the terms of the MPL, indicate your -# decision by deleting the provisions above and replace them with the notice -# and other provisions required by the GPL or the LGPL. If you do not delete -# the provisions above, a recipient may use your version of this file under -# the terms of any one of the MPL, the GPL or the LGPL. -# -# ***** END LICENSE BLOCK ***** - -DEPTH = ../../../.. -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ -relativesrcdir = layout/xul/base/test - -include $(DEPTH)/config/autoconf.mk -include $(topsrcdir)/config/rules.mk - -_TEST_FILES = test_bug393970.xul \ - $(NULL) - -libs:: $(_TEST_FILES) - $(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir) diff --git a/layout/xul/base/test/test_bug393970.xul b/layout/xul/base/test/test_bug393970.xul deleted file mode 100644 index e69de29bb2d..00000000000