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!
<rdar://problem/9955656>
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.
Created attachment 104923 [details] Patch Here's a patch!
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.
I revised the patch to address Darin's comments and got an in-person review. Committed with revision 93669.
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.