Scroll bars in DumpRenderTree snapshots
As you might know, on the Chromium project we're adapted DumpRenderTree into our TestShell, and we use it to dump layout test snapshots and do pixel tests. Well, we run pixel tests on Linux and Windows, but we don't do it on the Mac (yet). And that's because we'd like to compare to the baseline images that Safari uses because a) it eases maintenance for us, b) it's better for web developers if they can rely on the same rendering in Chromium and Safari, and c) I can't think of any more right now, but it should be pretty obvious that it's a Good Thing. The problem we keep hitting is scrollbars. When we draw scrollbars, we're consistently drawing the thumb ~20px too long. I've been looking at this, comparing our version of WebCore to the stock version of WebKit to compare the values passed into the drawing code. I took as an example LayoutTests/css1/basic/inheritance.html. For that case, ScrollbarThemeMac turns a scrollbar with values visible size = 600, total size = 724 into: scrollbar size: 15x585 (we lose 15px to the growbox) min: 0 max: 124 viewsize: 560 (visible size of 600 - cAmountToKeepWhenPaging; see ScrollView::updateScrollbars) OK. I then loaded DumpRenderTree into GDB, and breakpointed in ScrollbarThemeMac.mm. But it wouldn't hit. Nor would breakpoints in Scrollbar.cpp or ScrollView.cpp. In desperation I breakpointed on HIThemeDrawTrack. And that didn't hit either. What *did* hit was -[NSScroller drawRect:] at this damning backtrace: #0 0x96143759 in -[NSScroller drawRect:] #1 0x9605fbf8 in -[NSView _drawRect:clip:] #2 0x9605e6ef in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] #3 0x9605ea86 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] #4 0x9605ea86 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] #5 0x9605ea86 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] #6 0x9605ea86 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] #7 0x9605ea86 in -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] #8 0x9605d045 in -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] #9 0x96145385 in -[NSNextStepFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] #10 0x960594ab in -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] #11 0x95f99e7b in -[NSView displayIfNeeded] #12 0x00011ab4 in -[FrameLoadDelegate webView:didFinishLoadForFrame:] at FrameLoadDelegate.mm:207 That explained things but seriously confused me as well. I thought WebCore had moved away from using Cocoa for scrolling. In the xcodeproj files you clearly are including ScrollbarThemeMac. Any thoughts on what's going on? Avi
On Sep 8, 2009, at 11:25 AM, Darin Adler wrote:
On Sep 8, 2009, at 8:00 AM, Avi Drissman wrote:
I thought WebCore had moved away from using Cocoa for scrolling.
No, it has not.
-- Darin
For document-level scrolling, the Mac still uses an NSScrollView. For scrollbars in overflowing blocks, the Mac is using the theme and no longer uses native scrollbars. dave (hyatt@apple.com)
Aha. Do you have any advice on calculating the HIThemeTrackDrawInfo's viewsize parameter to make the thumb match up size-wise with an NSScroller's thumb? The only advice I've ever found is to make it the page-scroll size (and that's what ScrollbarThemeMac does) but that's giving a thumb too big. Avi On Tue, Sep 8, 2009 at 12:25 PM, Darin Adler <darin@apple.com> wrote:
On Sep 8, 2009, at 8:00 AM, Avi Drissman wrote:
I thought WebCore had moved away from using Cocoa for scrolling.
No, it has not.
-- Darin
participants (3)
-
Avi Drissman
-
Darin Adler
-
David Hyatt