I was investigating why fixing bug 418063 didn't make much of an improvement on the performance problems in: http://dbaron.org/mozilla/invert-colors#http://tests.themasta.com/tinderboxpushlog/?tree=MozillaTry I think I've found the next (maybe even last, I hope) problem, which is that nsSVGForeignObjectFrame::PaintSVG doesn't pass a transformed version of aDirtyRect through to the call to nsLayoutUtils::PaintFrame; it just tells PaintFrame that everything is dirty.
Created attachment 422861 [details] [diff] [review] patch This patch seems to work; it makes things involving repainting in foreignObject feel *much* faster. I found this code (and the GetFrameForPoint code) somewhat confusing, but I think I understand it now. However, now that I understand it, I'm not quite sure how to make it simpler, though I think it should be. I've tested that the repainting from selection and link hovering works in http://starkravingfinkle.org/blog/wp-content/uploads/2007/07/foreignobject-transform.svg (including when zoomed), and in a similar testcase that has a viewbox. I should probably have some automated tests for those combinations, though...
(In reply to comment #0) > I was investigating why fixing bug 418063 didn't make much of an improvement on > the performance problems in: > http://dbaron.org/mozilla/invert-colors#http://tests.themasta.com/tinderboxpushlog/?tree=MozillaTry That's no longer a testcase for this, since I reworked it to avoid using foreignObject (it uses 'filter' on HTML elements instead).
Created attachment 422884 [details] the original testcase (invert-colors.xhtml before I changed it to avoid foreignObject)
When I pushed to try, I got this failure on Mac only: REFTEST TEST-UNEXPECTED-FAIL | file:///builds/slave/sendchange-macosx-unittest/mozilla/layout/reftests/svg/moz-only/foreignObject-zoom-01.svg | ... seems like it could be a real problem. (Not sure if it's this bug or bug 418063's patch.)
testcases for this patch are in bug 426980 bug 428379 and bug 484677 It may be possible to turn the first two into reftests using roc's zoomed reftest feature. If the first two bugs still work then it's pretty certain that bug 484677 still will.
Created attachment 423118 [details] [diff] [review] mac reftest failure This is the reftest failure from try server; I confirmed it is due to this patch, and it's happened twice. It's Mac-only. The problem is a very slight color difference down the right edge of the viewport. I expect I need a call to ToOutsidePixels somewhere.
Created attachment 423720 [details] [diff] [review] patch The cause of the reftest failure was that I was inadvertently using the default conversion (truncate) of floats to nscoord rather than using NSToCoordFloor/Ceil as appropriate.
Also, I wonder if we should really be intersecting the dirty rect with the kid's rect (which is what we used to pass as the dirty rect); maybe we shouldn't. I should write some tests...
(In reply to comment #8) > Also, I wonder if we should really be intersecting the dirty rect with the > kid's rect (which is what we used to pass as the dirty rect); maybe we > shouldn't. I should write some tests... It seems like we're always clipping the overflow, so it doesn't matter.