From da7c2da05561c514d7768eebacf313c063b123e4 Mon Sep 17 00:00:00 2001 From: "roc+%cs.cmu.edu" Date: Tue, 8 Apr 2008 12:28:35 +0000 Subject: [PATCH] Bug 422678. Table rows whose style-height doesn't fit in the available height (but whose cells do) should be marked incomplete during reflow. r=bernd,sr=dbaron git-svn-id: svn://10.0.0.236/trunk@249790 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/reftests/bugs/231823-1-ref.html | 59 +++++++++++++++++ mozilla/layout/reftests/bugs/231823-1.html | 66 +++++++++++++++++++ .../layout/reftests/bugs/422249-1-ref.html | 20 ++++++ mozilla/layout/reftests/bugs/422249-1.html | 18 +++++ .../layout/reftests/bugs/422678-1-ref.html | 12 ++++ mozilla/layout/reftests/bugs/422678-1.html | 12 ++++ mozilla/layout/reftests/bugs/reftest.list | 3 + mozilla/layout/tables/nsTableCellFrame.cpp | 14 +++- mozilla/layout/tables/nsTableRowFrame.cpp | 19 +++--- 9 files changed, 214 insertions(+), 9 deletions(-) create mode 100644 mozilla/layout/reftests/bugs/231823-1-ref.html create mode 100644 mozilla/layout/reftests/bugs/231823-1.html create mode 100644 mozilla/layout/reftests/bugs/422249-1-ref.html create mode 100644 mozilla/layout/reftests/bugs/422249-1.html create mode 100644 mozilla/layout/reftests/bugs/422678-1-ref.html create mode 100644 mozilla/layout/reftests/bugs/422678-1.html diff --git a/mozilla/layout/reftests/bugs/231823-1-ref.html b/mozilla/layout/reftests/bugs/231823-1-ref.html new file mode 100644 index 00000000000..dadf23e8f0b --- /dev/null +++ b/mozilla/layout/reftests/bugs/231823-1-ref.html @@ -0,0 +1,59 @@ + + + +
+
Location:
+ +

+We are located at 333 West San Carlos Street, Suite 1650, San Jose. +Our building has a parking garage, and we will validate your parking. +After you park, as you are walking out of the parking garage, you will +see a bank of elevators. These elevators only go up and down in the +garage – they don’t connect to the office building. You +should walk past those elevators, walk out of the garage, walk across a +courtyard, and into the doors for the main building. There is another +bank of elevators in that building. Take these elevators to the 16th +Floor. +

+ +

+From Highway 280 heading northbound to San Jose: Take the Guadalupe +Parkway exit, also called Highway 87. This exit splits into a +northbound and a southbound direction. Take the northbound direction. +Once on the Guadalupe Parkway take the first exit, which is the Santa +Clara Street exit. Bear right on Santa Clara Street as you come off +that exit. The first light you come to is Almaden Blvd. Turn right on +Almaden. Go down 3 lights to West San Carlos Street. Turn right on +West San Carlos. The next light you come to is a small street called +Woz Way. Turn right on Woz. The parking garage for our building is on +your right. Turn right into the garage. Then follow the directions +above from the garage to our office. +

+ +

+From Highway 101 heading southbound to San Jose: Take the Guadalupe +Parkway exit, also called Highway 87. Stay on the Guadalupe as it +turns into a surface street and you cross over Hedding and Coleman. +Once it turns into an expressway again, the second exit is the Park +Avenue exit. Take this exit. Turn left on Park Avenue. After you +turn left you will come under the freeway and immediately come to a +traffic light at a small street called Woz Way. Turn right on Woz +Way. The parking garage for our building is on your left. Turn left +into the garage. Then follow the directions above from the garage to +our office. +

+ +

+From Highway 101 heading northbound to San Jose: Turn on to Highway +280 headed north. Then follow directions above for Highway 280 heading +northbound to San Jose. +

+ +

+From Highway 880: Take Highway 880 to Highway 280 South, and then +follow directions above from Highway 280 heading southbound to San +Jose. +

+
+ + diff --git a/mozilla/layout/reftests/bugs/231823-1.html b/mozilla/layout/reftests/bugs/231823-1.html new file mode 100644 index 00000000000..7430cd9c296 --- /dev/null +++ b/mozilla/layout/reftests/bugs/231823-1.html @@ -0,0 +1,66 @@ + + + + + + + + + + +
+
Location:
+ +

+We are located at 333 West San Carlos Street, Suite 1650, San Jose. +Our building has a parking garage, and we will validate your parking. +After you park, as you are walking out of the parking garage, you will +see a bank of elevators. These elevators only go up and down in the +garage – they don’t connect to the office building. You +should walk past those elevators, walk out of the garage, walk across a +courtyard, and into the doors for the main building. There is another +bank of elevators in that building. Take these elevators to the 16th +Floor. +

+ +

+From Highway 280 heading northbound to San Jose: Take the Guadalupe +Parkway exit, also called Highway 87. This exit splits into a +northbound and a southbound direction. Take the northbound direction. +Once on the Guadalupe Parkway take the first exit, which is the Santa +Clara Street exit. Bear right on Santa Clara Street as you come off +that exit. The first light you come to is Almaden Blvd. Turn right on +Almaden. Go down 3 lights to West San Carlos Street. Turn right on +West San Carlos. The next light you come to is a small street called +Woz Way. Turn right on Woz. The parking garage for our building is on +your right. Turn right into the garage. Then follow the directions +above from the garage to our office. +

+ +

+From Highway 101 heading southbound to San Jose: Take the Guadalupe +Parkway exit, also called Highway 87. Stay on the Guadalupe as it +turns into a surface street and you cross over Hedding and Coleman. +Once it turns into an expressway again, the second exit is the Park +Avenue exit. Take this exit. Turn left on Park Avenue. After you +turn left you will come under the freeway and immediately come to a +traffic light at a small street called Woz Way. Turn right on Woz +Way. The parking garage for our building is on your left. Turn left +into the garage. Then follow the directions above from the garage to +our office. +

+ +

+From Highway 101 heading northbound to San Jose: Turn on to Highway +280 headed north. Then follow directions above for Highway 280 heading +northbound to San Jose. +

+ +

+From Highway 880: Take Highway 880 to Highway 280 South, and then +follow directions above from Highway 280 heading southbound to San +Jose. +

+
+ + diff --git a/mozilla/layout/reftests/bugs/422249-1-ref.html b/mozilla/layout/reftests/bugs/422249-1-ref.html new file mode 100644 index 00000000000..9b0c451bb12 --- /dev/null +++ b/mozilla/layout/reftests/bugs/422249-1-ref.html @@ -0,0 +1,20 @@ + + + + + + +
+
+ a
b
c
d
e
f
g
h
i +
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x +
y
z
a
b
c
d
e
f
g
h
i
j
k
l +
m
n
o
p
q
r
s
t
u
v
w
x
y
z +
a
b
c
d
e
f
g
h
i
j
k
l
m
n
+ + diff --git a/mozilla/layout/reftests/bugs/422249-1.html b/mozilla/layout/reftests/bugs/422249-1.html new file mode 100644 index 00000000000..3ee4755e819 --- /dev/null +++ b/mozilla/layout/reftests/bugs/422249-1.html @@ -0,0 +1,18 @@ + + + + + +
a
b
c
d
e
f
g
h
i +
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x +
y
z
a
b
c
d
e
f
g
h
i
j
k
l +
m
n
o
p
q
r
s
t
u
v
w
x
y
z +
a
b
c
d
e
f
g
h
i
j
k
l
m
n
+ + diff --git a/mozilla/layout/reftests/bugs/422678-1-ref.html b/mozilla/layout/reftests/bugs/422678-1-ref.html new file mode 100644 index 00000000000..c36170a4b86 --- /dev/null +++ b/mozilla/layout/reftests/bugs/422678-1-ref.html @@ -0,0 +1,12 @@ + + + + + + + + + +
Hello
+ + diff --git a/mozilla/layout/reftests/bugs/422678-1.html b/mozilla/layout/reftests/bugs/422678-1.html new file mode 100644 index 00000000000..d292a48a598 --- /dev/null +++ b/mozilla/layout/reftests/bugs/422678-1.html @@ -0,0 +1,12 @@ + + + + + + + + + +
Hello
+ + diff --git a/mozilla/layout/reftests/bugs/reftest.list b/mozilla/layout/reftests/bugs/reftest.list index ee031a34571..c22ac8d1944 100644 --- a/mozilla/layout/reftests/bugs/reftest.list +++ b/mozilla/layout/reftests/bugs/reftest.list @@ -126,6 +126,7 @@ fails == 25888-3r.html 25888-3r-ref.html # bug 25888 == 214077-1a.html 214077-1-ref.html == 214077-1b.html 214077-1-ref.html == 218473-1.html 218473-1-ref.html +== 231823-1.html 231823-1-ref.html == 234686-1.html 234686-ref.html == 234686-2.html 234686-ref.html == 234686-3.html 234686-ref.html @@ -775,7 +776,9 @@ fails == 413027-3.html 413027-3-ref.html == 421419-1.html 421419-1-ref.html == 421885-1.xml 421885-1-ref.xml == 421955-1.html 421955-1-ref.html +== 422249-1.html 422249-1-ref.html == 422394-1.html 422394-1-ref.html +== 422678-1.html 422678-1-ref.html == 423130-1.html 423130-1-ref.html == 423385-1.html 423385-1-ref.html == 423599-1.html 423599-1-ref.html diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp index fce69581529..e050f232542 100644 --- a/mozilla/layout/tables/nsTableCellFrame.cpp +++ b/mozilla/layout/tables/nsTableCellFrame.cpp @@ -911,7 +911,19 @@ NS_METHOD nsTableCellFrame::Reflow(nsPresContext* aPresContext, // 0 dimensioned cells need to be treated specially in Standard/NavQuirks mode // see testcase "emptyCells.html" - SetContentEmpty(0 == kidSize.height); + nsIFrame* prevInFlow = GetPrevInFlow(); + PRBool isEmpty; + if (prevInFlow) { + isEmpty = static_cast(prevInFlow)->GetContentEmpty(); + } else { + // XXX this is a bad way to check for empty content. There are various + // ways the cell could have content but the kid could end up with zero + // height. See + // http://www.w3.org/TR/CSS21/tables.html#empty-cells + // and bug 76331. + isEmpty = kidSize.height == 0; + } + SetContentEmpty(isEmpty); // Place the child FinishReflowChild(firstKid, aPresContext, &kidReflowState, kidSize, diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp index 76c4835a578..8166bcf4151 100644 --- a/mozilla/layout/tables/nsTableRowFrame.cpp +++ b/mozilla/layout/tables/nsTableRowFrame.cpp @@ -798,7 +798,8 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext, PRInt32 prevColIndex = firstPrevColIndex; nscoord x = 0; // running total of children x offset - nscoord paginatedHeight = 0; + // This computes the max of all cell heights + nscoord cellMaxHeight = 0; // Reflow each of our existing cell frames for (nsIFrame* kidFrame = iter.First(); kidFrame; kidFrame = iter.Next()) { @@ -946,10 +947,10 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext, UpdateHeight(desiredSize.height, ascent, descent, &aTableFrame, cellFrame); } else { - paginatedHeight = PR_MAX(paginatedHeight, desiredSize.height); + cellMaxHeight = PR_MAX(cellMaxHeight, desiredSize.height); PRInt32 rowSpan = aTableFrame.GetEffectiveRowSpan((nsTableCellFrame&)*kidFrame); if (1 == rowSpan) { - SetContentHeight(paginatedHeight); + SetContentHeight(cellMaxHeight); } } @@ -1010,12 +1011,14 @@ nsTableRowFrame::ReflowChildren(nsPresContext* aPresContext, } } else { // constrained height, paginated - aDesiredSize.height = paginatedHeight; - if (aDesiredSize.height <= aReflowState.availableHeight) { - nscoord height = CalcHeightFromUnpaginatedHeight(aPresContext, *this); - aDesiredSize.height = PR_MAX(aDesiredSize.height, height); - aDesiredSize.height = PR_MIN(aDesiredSize.height, aReflowState.availableHeight); + // Compute the height we should have from style (subtracting the + // height from our prev-in-flows from the style height) + nscoord styleHeight = CalcHeightFromUnpaginatedHeight(aPresContext, *this); + if (styleHeight > aReflowState.availableHeight) { + styleHeight = aReflowState.availableHeight; + NS_FRAME_SET_INCOMPLETE(aStatus); } + aDesiredSize.height = PR_MAX(cellMaxHeight, styleHeight); } nsRect rowRect(0, 0, aDesiredSize.width, aDesiredSize.height); aDesiredSize.mOverflowArea.UnionRect(aDesiredSize.mOverflowArea, rowRect);