Bug 54632 - [chromium] Printing causes view to scroll
Summary: [chromium] Printing causes view to scroll
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Printing (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Yuzo Fujishima
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-17 03:11 PST by Yuzo Fujishima
Modified: 2011-02-18 01:06 PST (History)
6 users (show)

See Also:


Attachments
Patch (2.78 KB, patch)
2011-02-17 03:23 PST, Yuzo Fujishima
hamaji: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuzo Fujishima 2011-02-17 03:11:44 PST
Forked from https://bugs.webkit.org/show_bug.cgi?id=52552 to track Chromium-specific part of the issue.

Steps to reproduce:

1. Open https://bug-52552-attachments.webkit.org/attachment.cgi?id=79128
2. Resize the window small enough such that vertical scrollbar appears.
3. Scroll to the bottom.
4. File > Print... > Cancel
5. Observe the scrollbar has moved upward.

(For Safari, the upward scroll is observed only for very small (around 400 x 300) window, and the amount of scroll is smaller.
The scroll doesn't manifest itself until the window is clicked after printing.)
Comment 1 Yuzo Fujishima 2011-02-17 03:23:29 PST
Created attachment 82778 [details]
Patch
Comment 2 Shinichiro Hamaji 2011-02-17 04:03:04 PST
IIRC, Darin Fisher said he wants to know all chromium API changes.
Comment 3 Shinichiro Hamaji 2011-02-17 04:04:44 PST
Comment on attachment 82778 [details]
Patch

... and this change looks good to me.

I think it's nice to have a link how this API will be used: http://codereview.chromium.org/6539011/
Comment 4 Darin Fisher (:fishd, Google) 2011-02-17 08:53:48 PST
Comment on attachment 82778 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=82778&action=review

> Source/WebKit/chromium/public/WebFrame.h:146
> +    virtual void setScrollOffset(const WebSize&) = 0;

LGTM
Comment 5 Alexey Proskuryakov 2011-02-17 09:19:08 PST
What is different about chromium that makes this problem happen? This doesn't seem to fix the root cause, whatever it is.
Comment 6 Yuzo Fujishima 2011-02-17 17:15:06 PST
(In reply to comment #5)
> What is different about chromium that makes this problem happen? This doesn't seem to fix the root cause, whatever it is.

Chromium resizes WebView to paper size before printing and then
to original on-screen size after printing. The scroll position is lost
during the resizing.

The intention of this patch is to allow Chromium to save the on-screen scroll position
before resizing and restore it after.

I'm not sure how Safari does it differently. Perhaps there is an alternative way of resizing
WebView, which maintains the scroll position?
Comment 7 Yuzo Fujishima 2011-02-17 18:01:33 PST
Committed r78936: <http://trac.webkit.org/changeset/78936>
Comment 8 Andrew Wilson 2011-02-17 19:18:52 PST
Reverted r78936 for reason:

Breaks chromium build

Committed r78940: <http://trac.webkit.org/changeset/78940>
Comment 9 Yuzo Fujishima 2011-02-17 23:44:11 PST
Committed r78967: <http://trac.webkit.org/changeset/78967>
Comment 10 WebKit Review Bot 2011-02-18 01:06:03 PST
http://trac.webkit.org/changeset/78967 might have broken GTK Linux 64-bit Debug