Bug 66244 - Cached pages don't fully update when going back after changing the display scale factor
Summary: Cached pages don't fully update when going back after changing the display sc...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac (Intel) OS X 10.7
: P2 Normal
Assignee: Beth Dakin
URL:
Keywords: InRadar
Depends on: 66229
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-15 11:58 PDT by Adam Roben (:aroben)
Modified: 2011-08-24 07:46 PDT (History)
5 users (show)

See Also:


Attachments
Patch (6.02 KB, patch)
2011-08-23 16:01 PDT, Beth Dakin
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Roben (:aroben) 2011-08-15 11:58:53 PDT
To reproduce:

1. Go to data:text/html,This%20is%20some%20text
2. Go to about:blank
3. Change your display's scale factor
4. Click Back

The text is blurry because it hasn't been redrawn at the new scale factor. Ew!
Comment 1 Radar WebKit Bug Importer 2011-08-15 11:59:20 PDT
<rdar://problem/9955656>
Comment 2 Beth Dakin 2011-08-23 15:36:36 PDT
Adam's original steps actually don't reproduce a bug any more, but there is still a bug here. Re-titling to reflect the remaining issues. Here are steps to reproduce the remaining issue:

1. Go to data:text/html,%3C!DOCTYPEhtml%3E%3Cstyle%3E@media(-webkit-min-device-pixel-ratio:2)%7Bspan::after%7Bcontent:'2'!important;%7D%7Dspan::after%7Bcontent:'1';%7D%3C/style%3EDevice%20pixel%20ratio:%20%3Cspan%3E%3C/span%3E
2. Go to about:blank
3. Change your display's scale factor
4. Click Back

The displayed scale factor is not appropriately updated to reflect the new scale factor.
Comment 3 Beth Dakin 2011-08-23 16:01:19 PDT
Created attachment 104923 [details]
Patch

Here's a patch!
Comment 4 Darin Adler 2011-08-23 16:10:59 PDT
Comment on attachment 104923 [details]
Patch

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

Patch seems OK. Could be improved a bit.

> Source/WebCore/page/Frame.cpp:1068
> +    pageCache()->markPagesForFullStyleRecalc();

This will run a bit too often. It runs for the top level frame and then runs again for each subframe. That means we’ll run through the page cache over and over again. No need to do that.

Also, this does more work than needed as I mention below.

> Source/WebCore/page/Page.cpp:601
> +    pageCache()->markPagesForFullStyleRecalc();

This does more work than it has to. Items in the page cache might be for the back/forward in other windows that have a different scale factor. It’s overkill to do it on all the pages in the page cache. Instead we could iterate the back/forward list and do it only for the history items found there.
Comment 5 Beth Dakin 2011-08-23 17:30:20 PDT
I revised the patch to address Darin's comments and got an in-person review. Committed with revision 93669.
Comment 6 Adam Roben (:aroben) 2011-08-24 07:46:56 PDT
Nice! It would be great to write a regression test for this. You could probably base it on this one: <http://trac.webkit.org/browser/trunk/Tools/TestWebKitAPI/Tests/mac/DynamicDeviceScaleFactor.mm?rev=93451>. I'd be happy to help with writing such a test.