From a1c3edffafd3fbd98dd3e77be5905afd0921bfc5 Mon Sep 17 00:00:00 2001 From: "karnaze%netscape.com" Date: Mon, 25 Feb 2002 14:42:12 +0000 Subject: [PATCH] bug 124041 - prevent infinite splitting of images due to 0 avail height. sr=attinasi, r=alexsavulov, a=asa git-svn-id: svn://10.0.0.236/trunk@115309 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsImageFrame.cpp | 5 ++++- mozilla/layout/html/base/src/nsImageFrame.cpp | 5 ++++- mozilla/layout/html/tests/table/images/pc.gif | Bin 0 -> 42 bytes .../html/tests/table/printing/bug124041.html | 9 +++++++++ .../table/printing/bug124041_iframe.html | 19 ++++++++++++++++++ .../html/tests/table/printing/file_list.txt | 1 + 6 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 mozilla/layout/html/tests/table/images/pc.gif create mode 100644 mozilla/layout/html/tests/table/printing/bug124041.html create mode 100644 mozilla/layout/html/tests/table/printing/bug124041_iframe.html diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index 23401a08b1a..66abfae1108 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -921,7 +921,10 @@ nsImageFrame::Reflow(nsIPresContext* aPresContext, GetFrameType(getter_AddRefs(fType)); // split an image frame but not an image control frame if (nsLayoutAtoms::imageFrame == fType.get()) { - aMetrics.height = aReflowState.availableHeight; + float p2t; + aPresContext->GetScaledPixelsToTwips(&p2t); + // our desired height was greater than 0, so to avoid infinite splitting, use 1 pixel as the min + aMetrics.height = PR_MAX(NSToCoordRound(p2t), aReflowState.availableHeight); aStatus = NS_FRAME_NOT_COMPLETE; } } diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index 23401a08b1a..66abfae1108 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -921,7 +921,10 @@ nsImageFrame::Reflow(nsIPresContext* aPresContext, GetFrameType(getter_AddRefs(fType)); // split an image frame but not an image control frame if (nsLayoutAtoms::imageFrame == fType.get()) { - aMetrics.height = aReflowState.availableHeight; + float p2t; + aPresContext->GetScaledPixelsToTwips(&p2t); + // our desired height was greater than 0, so to avoid infinite splitting, use 1 pixel as the min + aMetrics.height = PR_MAX(NSToCoordRound(p2t), aReflowState.availableHeight); aStatus = NS_FRAME_NOT_COMPLETE; } } diff --git a/mozilla/layout/html/tests/table/images/pc.gif b/mozilla/layout/html/tests/table/images/pc.gif new file mode 100644 index 0000000000000000000000000000000000000000..da26d7092e2ab1e6b127f2af153e5e42af7a6e13 GIT binary patch literal 42 lcmZ?wbhEHbWMp7u_`m=Kia%KxK};PG0g_>0Vq{^k1^|0{1S$Xk literal 0 HcmV?d00001 diff --git a/mozilla/layout/html/tests/table/printing/bug124041.html b/mozilla/layout/html/tests/table/printing/bug124041.html new file mode 100644 index 00000000000..d9f2f52e114 --- /dev/null +++ b/mozilla/layout/html/tests/table/printing/bug124041.html @@ -0,0 +1,9 @@ + + + + +
+ +
diff --git a/mozilla/layout/html/tests/table/printing/bug124041_iframe.html b/mozilla/layout/html/tests/table/printing/bug124041_iframe.html new file mode 100644 index 00000000000..870ba6e93e3 --- /dev/null +++ b/mozilla/layout/html/tests/table/printing/bug124041_iframe.html @@ -0,0 +1,19 @@ + + + + + + + + + + +
+ Click here for 100,000+ Clipart images.
+
+ + + +
+
+
diff --git a/mozilla/layout/html/tests/table/printing/file_list.txt b/mozilla/layout/html/tests/table/printing/file_list.txt index ebfafe09ef5..e2fa757248d 100644 --- a/mozilla/layout/html/tests/table/printing/file_list.txt +++ b/mozilla/layout/html/tests/table/printing/file_list.txt @@ -2,6 +2,7 @@ file:///s|/mozilla/layout/html/tests/table/printing/bug102784.html file:///s|/mozilla/layout/html/tests/table/printing/bug105166.html file:///s|/mozilla/layout/html/tests/table/printing/bug111028.html +file:///s|/mozilla/layout/html/tests/table/printing/bug124041.html file:///s|/mozilla/layout/html/tests/table/printing/bug53690.html file:///s|/mozilla/layout/html/tests/table/printing/bug54829.html file:///s|/mozilla/layout/html/tests/table/printing/bug57378.html