Bug 19650 - -webkit-gradient slows down scrolling when page has horizontal scrollbar
Summary: -webkit-gradient slows down scrolling when page has horizontal scrollbar
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://w3future.com/weblog/stories/20...
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2008-06-18 02:06 PDT by Jon Honeycutt
Modified: 2010-01-25 15:21 PST (History)
7 users (show)

See Also:


Attachments
simplified version of http://www.apple.com/safari/whats-new.html (8.78 KB, text/html)
2009-06-10 16:50 PDT, Ryosuke Niwa
no flags Details
sample HTML copied from http://www.apple.com/safari/whats-new.html (deleted)
2009-06-10 16:52 PDT, Ryosuke Niwa
no flags Details
reduced test case (323 bytes, text/html)
2009-06-10 17:12 PDT, Eric Seidel (no email)
no flags Details
Use 1-by-n tiles for horizontal and vertical linear gradients (7.67 KB, patch)
2010-01-14 20:33 PST, mitz
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jon Honeycutt 2008-06-18 02:06:27 PDT
The site above has very slow scrolling. Not reproducible in Opera. Site uses some WebKit-specific CSS that could be responsible. Disabling styles results in normal scrolling speed.
Comment 1 Mark Rowe (bdash) 2008-06-18 18:30:47 PDT
<rdar://problem/6020083>
Comment 2 Adam Bryzak 2009-06-10 16:23:08 PDT
(In reply to comment #0)
> The site above has very slow scrolling. Not reproducible in Opera. Site uses
> some WebKit-specific CSS that could be responsible. Disabling styles results in
> normal scrolling speed.
> 

The slow vertical scrolling only seems to happen for me when the horizontal scrollbar is not scrolled completely to the left. As soon as the page is scrolled 1px horizontally, the vertical scrolling slows down considerably. If the horizontal scrollbar is on the left the vertical scrolling is fine. It also happens on http://www.apple.com/safari/whats-new.html
Comment 3 Ryosuke Niwa 2009-06-10 16:50:51 PDT
Created attachment 31144 [details]
simplified version of http://www.apple.com/safari/whats-new.html

this reproduces the bug in Safari 4 (Windows 528.17) but the effect cannot be experienced (by human) in Chrome 3.0.183.1.
Comment 4 Ryosuke Niwa 2009-06-10 16:52:59 PDT
Created attachment 31145 [details]
sample HTML copied from http://www.apple.com/safari/whats-new.html

This HTML reproduces the bug both in Chrome and Safari.  The bug disappears when -webkit-gradient is removed.
Comment 5 Eric Seidel (no email) 2009-06-10 17:12:29 PDT
Hyatt wrote the scroll code and the gradient code. :)
Comment 6 Eric Seidel (no email) 2009-06-10 17:12:54 PDT
Created attachment 31147 [details]
reduced test case
Comment 7 Eric Seidel (no email) 2009-06-10 17:15:08 PDT
This does not reproduce for me on a TOT Debug build.
Comment 8 Eric Seidel (no email) 2009-06-10 17:15:31 PDT
This may have been fixed since Safari 4?
Comment 9 Adam Bryzak 2009-06-10 17:16:21 PDT
I tested it using Safari 4 final and with the latest WebKit running on OS X 10.5.7
Comment 10 Ryosuke Niwa 2009-06-10 17:22:37 PDT
WebKit build 44547 on Windows reproduced the problem with the reduced test case.
Comment 11 Eric Seidel (no email) 2009-06-10 17:25:59 PDT
Wow.  This still reproduces on TOT, but I only notice it in Release builds!
Comment 12 mitz 2009-06-10 22:33:11 PDT
This is similar to bug 24130. GeneratedImage::drawPattern() is used to draw the gradient rather than GeneratedImage::draw(), the reason being that, even with the fix for bug 24130, the rect to paint legitimately contains more than one tile. As mentioned in that bug, the way to address this is probably by way of bug 24178.
Comment 13 mitz 2009-06-10 22:40:55 PDT
There are other possible optimizations for vertical and horizontal gradients (adjusting the tile dimensions in the direction perpendicular to the gradient; won’t help with the “reduced test case” attached to this bug, but should help with the What’s New page, for example).
Comment 14 Simon Fraser (smfr) 2009-06-10 23:12:32 PDT
I gather this is on Mac and Windows?
Comment 15 Ryosuke Niwa 2009-06-19 18:54:42 PDT
(In reply to comment #14)
> I gather this is on Mac and Windows?
> 

Yes, we have observed it on Mac and Windows.  But it may still reproduce in Linux.
Comment 16 mitz 2010-01-14 20:33:59 PST
Created attachment 46638 [details]
Use 1-by-n tiles for horizontal and vertical linear gradients
Comment 17 Simon Fraser (smfr) 2010-01-14 20:41:02 PST
Comment on attachment 46638 [details]
Use 1-by-n tiles for horizontal and vertical linear gradients

> Index: WebCore/platform/graphics/Generator.h
> ===================================================================

>      virtual void fill(GraphicsContext*, const FloatRect&) = 0;
> +    virtual void adjustParametersForTiledDrawing(IntSize& /* size */, FloatRect& /* srcRect */, TransformationMatrix& /* patternTransform */, FloatPoint& /* phase */) { 

Maybe remove patternTransform and phase from this method if you think they will never be used. They can easily be added if we find a use.

r=me
Comment 18 mitz 2010-01-14 21:11:44 PST
Fixed in <http://trac.webkit.org/projects/webkit/changeset/53318>
Comment 19 Dimitri Glazkov (Google) 2010-01-25 15:21:31 PST
Committed r53816: <http://trac.webkit.org/changeset/53816>