Closed Bug 480345 Opened 16 years ago Closed 16 years ago

Crash when printing or scrolling in print preview [@ nsCSSRendering::PaintBackgroundWithSC]

Categories

(Core :: Layout, defect)

defect
Not set
critical

Tracking

()

VERIFIED FIXED
mozilla1.9.2a1

People

(Reporter: andreasjunghw, Assigned: roc)

References

Details

(4 keywords)

Crash Data

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b3pre) Gecko/20090226 Shiretoko/3.1b3pre
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b3pre) Gecko/20090226 Shiretoko/3.1b3pre

The attached testcase crashes Shiretoko but not Firefox 3.0.x if printed or viewed in print preview and trying to scroll down.

Reproducible: Always

Steps to Reproduce:
1.Make sure File -> Page Setup -> Print Background is checked / turned on
2.Open the testcase
3.Print the testcase

alternative:
3.Open print preview
4.Scroll to the second page
Actual Results:  
Shiretoko crashes.
Only first page can be viewed in print preview.
Only first page is printed.

Expected Results:  
Shiretoko doesn't crash.
All pages can be viewed in print preview.
All pages are printed.

http://crash-stats.mozilla.com/report/index/836fc351-8417-4759-94a6-8d3b62090226

nsCSSRendering::PaintBackgroundWithSC(nsPresContext*, nsIRenderingContext&, nsIFrame*, nsRect const&, nsRect const&, nsStyleBackground const&, nsStyleBorder const&, int, nsRect*)

0  	xul.dll  	nsCSSRendering::PaintBackgroundWithSC  	layout/base/nsCSSRendering.cpp:1374
1 	xul.dll 	nsCSSRendering::PaintBackground 	layout/base/nsCSSRendering.cpp:1220
2 	xul.dll 	nsDisplayCanvasBackground::Paint 	layout/generic/nsHTMLFrame.cpp:449
3 	xul.dll 	nsDisplayList::Paint 	layout/base/nsDisplayList.cpp:311
4 	xul.dll 	nsLayoutUtils::PaintFrame 	layout/base/nsLayoutUtils.cpp:1139
5 	xul.dll 	nsPageFrame::PaintPageContent 	layout/generic/nsPageFrame.cpp:582
6 	xul.dll 	PaintPageContent 	layout/generic/nsPageFrame.cpp:405
7 	xul.dll 	nsDisplayGeneric::Paint 	layout/base/nsDisplayList.h:874
8 	xul.dll 	nsDisplayList::Paint 	layout/base/nsDisplayList.cpp:311
9 	xul.dll 	nsLayoutUtils::PaintFrame 	layout/base/nsLayoutUtils.cpp:1139
10 	xul.dll 	nsSimplePageSequenceFrame::PrintNextPage 	layout/generic/nsSimplePageSequence.cpp:647
11 	xul.dll 	nsPrintEngine::PrintPage 	layout/printing/nsPrintEngine.cpp:2397
12 	xul.dll 	nsPagePrintTimer::Notify 	layout/printing/nsPagePrintTimer.cpp:90
13 	xul.dll 	nsTimerImpl::Fire 	xpcom/threads/nsTimerImpl.cpp:465
14 	xul.dll 	nsTimerEvent::Run 	xpcom/threads/nsTimerImpl.cpp:512
15 	xul.dll 	nsThread::ProcessNextEvent 	xpcom/threads/nsThread.cpp:510
16 	xul.dll 	nsBaseAppShell::Run 	widget/src/xpwidgets/nsBaseAppShell.cpp:170
17 	xul.dll 	nsAppStartup::Run 	toolkit/components/startup/src/nsAppStartup.cpp:192
18 	nspr4.dll 	PR_GetEnv 	
19 	firefox.exe 	wmain 	toolkit/xre/nsWindowsWMain.cpp:87
20 	firefox.exe 	firefox.exe@0x2197 	
21 	kernel32.dll 	kernel32.dll@0x17066
Attached file testcase (deleted) —
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2a1pre) Gecko/20090225 Minefield/3.2a1pre ID:20090225033705

I can reproduce this using Print Preview. top of stack is similar to bug 477560
Confirmed.
Status: UNCONFIRMED → NEW
Component: General → Layout
Ever confirmed: true
Product: Firefox → Core
QA Contact: general → layout
Version: unspecified → Trunk
Flags: blocking1.9.2?
Flags: blocking1.9.1?
Keywords: regression, testcase
Same happens on OS X just by clicking on preview after the print dialog comes up. The stack on OS X is a bit different:

crash report: bp-cfa6867e-2d27-4bf3-8673-5765f2090301

Martijn, why this is a regression? Does it work in older versions?
OS: Windows XP → All
Hardware: x86 → All
With a debug build I hit an assertion. I filed this as bug 480861. A fix could eventually fix this bug.
Confirmed on 
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2a1pre) Gecko/20090301 Minefield/3.2a1pre

You can easily turn on the "print backgrounds behavior" in print-preview by creating the boolean pref "print.[DEFAULT_PRINTER_NAME].print_bgimages" in about:config, and set it to "true".  (That works on Linux, at least.)
Flags: blocking1.9.1? → wanted1.9.1+
works:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b2pre) Gecko/20081104 Minefield/3.1b2pre ID:20081104040308
http://hg.mozilla.org/mozilla-central/rev/fbae114d6133
fails:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b2pre) Gecko/20081105 Minefield/3.1b2pre ID:20081105032350
http://hg.mozilla.org/mozilla-central/rev/dcec193ba5d7

=> range:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=fbae114d6133&tochange=dcec193ba5d7

while regressionwindow finding i got a crash [@ PaintBackgroundLayer] (bp-1d2c0dc9-d53e-476d-85fc-38d362090315) with build 20090220102957
Keywords: crash
Roc, could this have been regressed because of the fix on bug 458487? It would fall into this regression range.
Assignee: nobody → roc
Attached patch fix (deleted) — Splinter Review
This is pretty simple ... the CanvasFrame for a page that's only being used for overflow containers can in fact have no in-flow child frame, so we need to handle that here. I just treat the root element frame border rect as (0,0,0,0) (relative to the aBorderArea for the canvas) which I think is reasonable. If the root element had margins we might prefer something else but that doesn't seem worth worrying about. I also considered not painting the root element background at all but I think we should paint it since nominally we're propagating the root element background to the viewport here and the "viewport" does extend to these overflow container pages.

To make the crashtest work I had to enable background colors and images for reftest-print tests. I did that by removing the lines from nsPresContext that set these to false for non-galley presentations. nsPrintEngine sets these from preferences itself so these lines aren't needed for actual printing and print preview.
Attachment #367530 - Flags: superreview?(dbaron)
Attachment #367530 - Flags: review?(dbaron)
Whiteboard: [needs review]
Status: NEW → ASSIGNED
Flags: in-testsuite?
Comment on attachment 367530 [details] [diff] [review]
fix

r+sr=dbaron
Attachment #367530 - Flags: superreview?(dbaron)
Attachment #367530 - Flags: superreview+
Attachment #367530 - Flags: review?(dbaron)
Attachment #367530 - Flags: review+
Whiteboard: [needs review] → [needs landing]
http://hg.mozilla.org/mozilla-central/rev/3eacf3930b93
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Flags: in-testsuite? → in-testsuite+
Resolution: --- → FIXED
Whiteboard: [needs landing] → [needs 191 landing]
Comment on attachment 367530 [details] [diff] [review]
fix

Crash regression, encountered in real-world, low-risk patch
Attachment #367530 - Flags: approval1.9.1?
Verified fixed on Windows and OS X:

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2a1pre) Gecko/20090322 Minefield/3.6a1pre ID:20090322035551
Status: RESOLVED → VERIFIED
Target Milestone: --- → mozilla1.9.2a1
Comment on attachment 367530 [details] [diff] [review]
fix

a1.9.1=dbaron
Attachment #367530 - Flags: approval1.9.1? → approval1.9.1+
Verified fixed on 1.9.1 with Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b4pre) Gecko/20090410 Shiretoko/3.5b4pre ID:20090410035055 and on WinXP.
Flags: blocking1.9.2?
Crash Signature: [@ nsCSSRendering::PaintBackgroundWithSC]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: