Bug 173152

Summary: [Win][HighDPI] Repaint glitches when scrolling.
Product: WebKit Reporter: Per Arne Vollan <pvollan>
Component: WebKit Misc.Assignee: Per Arne Vollan <pvollan>
Status: RESOLVED FIXED    
Severity: Normal CC: ahmad.saleem792, bfulgham, commit-queue, Hironori.Fujii, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=196339
Attachments:
Description Flags
Patch
bfulgham: review+
Patch none

Per Arne Vollan
Reported 2017-06-09 04:41:07 PDT
This happens when the device scale factor is non-integral, e.g. 1.25x.
Attachments
Patch (2.15 KB, patch)
2017-06-09 04:43 PDT, Per Arne Vollan
bfulgham: review+
Patch (2.30 KB, patch)
2019-01-17 11:26 PST, Per Arne Vollan
no flags
Per Arne Vollan
Comment 1 2017-06-09 04:43:07 PDT
Brent Fulgham
Comment 2 2017-06-09 08:42:39 PDT
Comment on attachment 312426 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=312426&action=review > Source/WebKit/win/WebView.cpp:954 > + // FIXME: This is inefficient, we should be able to blit the scroll rectangle in this case as well. Is this due to a bug in the CA accelerated compositing code path? Or is there a bug in BitBlt in the Windows code?
Per Arne Vollan
Comment 3 2017-06-09 09:01:24 PDT
(In reply to Brent Fulgham from comment #2) > Comment on attachment 312426 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=312426&action=review > > > Source/WebKit/win/WebView.cpp:954 > > + // FIXME: This is inefficient, we should be able to blit the scroll rectangle in this case as well. > > Is this due to a bug in the CA accelerated compositing code path? Or is > there a bug in BitBlt in the Windows code? I believe the problem is the conversion from logical scroll delta to scroll delta in pixel coordinates. When the scale factor is non-integral, this conversion is not correct, since we clamp the result. I would prefer a better fix than the current patch :)
Brent Fulgham
Comment 4 2017-06-20 12:38:02 PDT
Comment on attachment 312426 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=312426&action=review >>> Source/WebKit/win/WebView.cpp:954 >>> + // FIXME: This is inefficient, we should be able to blit the scroll rectangle in this case as well. >> >> Is this due to a bug in the CA accelerated compositing code path? Or is there a bug in BitBlt in the Windows code? > > I believe the problem is the conversion from logical scroll delta to scroll delta in pixel coordinates. When the scale factor is non-integral, this conversion is not correct, since we clamp the result. I would prefer a better fix than the current patch :) Would we be better off using some of the subpixel layout rounding functions Zalan created? Maybe if we took the ceiling of the calculated pixels we would always be drawing enough, without drawing too much? For example, what if instead of "clampTo<int>" we used std::ceil? Also, maybe we could adjust the clipRect like we do the scrollViewRect: FloatRect rawClipRect(logicalClipRect); rawClipRect.scale(scaleFactor); FloatRect clipRect = enclosingIntRect(rawClipRect); Or something like that?
Per Arne Vollan
Comment 5 2017-06-20 12:48:16 PDT
(In reply to Brent Fulgham from comment #4) > Comment on attachment 312426 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=312426&action=review > > >>> Source/WebKit/win/WebView.cpp:954 > >>> + // FIXME: This is inefficient, we should be able to blit the scroll rectangle in this case as well. > >> > >> Is this due to a bug in the CA accelerated compositing code path? Or is there a bug in BitBlt in the Windows code? > > > > I believe the problem is the conversion from logical scroll delta to scroll delta in pixel coordinates. When the scale factor is non-integral, this conversion is not correct, since we clamp the result. I would prefer a better fix than the current patch :) > > Would we be better off using some of the subpixel layout rounding functions > Zalan created? Maybe if we took the ceiling of the calculated pixels we > would always be drawing enough, without drawing too much? > > For example, what if instead of "clampTo<int>" we used std::ceil? > > Also, maybe we could adjust the clipRect like we do the scrollViewRect: > > FloatRect rawClipRect(logicalClipRect); > rawClipRect.scale(scaleFactor); > FloatRect clipRect = enclosingIntRect(rawClipRect); > > Or something like that? Thank you, Brent! I will try out these ideas.
Brent Fulgham
Comment 6 2017-08-18 09:52:46 PDT
Comment on attachment 312426 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=312426&action=review >>>>> Source/WebKit/win/WebView.cpp:954 >>>>> + // FIXME: This is inefficient, we should be able to blit the scroll rectangle in this case as well. >>>> >>>> Is this due to a bug in the CA accelerated compositing code path? Or is there a bug in BitBlt in the Windows code? >>> >>> I believe the problem is the conversion from logical scroll delta to scroll delta in pixel coordinates. When the scale factor is non-integral, this conversion is not correct, since we clamp the result. I would prefer a better fix than the current patch :) >> >> Would we be better off using some of the subpixel layout rounding functions Zalan created? Maybe if we took the ceiling of the calculated pixels we would always be drawing enough, without drawing too much? >> >> For example, what if instead of "clampTo<int>" we used std::ceil? >> >> Also, maybe we could adjust the clipRect like we do the scrollViewRect: >> >> FloatRect rawClipRect(logicalClipRect); >> rawClipRect.scale(scaleFactor); >> FloatRect clipRect = enclosingIntRect(rawClipRect); >> >> Or something like that? > > Thank you, Brent! I will try out these ideas. Did any of those ideas work?
Brent Fulgham
Comment 7 2019-01-17 09:17:28 PST
Comment on attachment 312426 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=312426&action=review >>>>>> Source/WebKit/win/WebView.cpp:954 >>>>>> + // FIXME: This is inefficient, we should be able to blit the scroll rectangle in this case as well. >>>>> >>>>> Is this due to a bug in the CA accelerated compositing code path? Or is there a bug in BitBlt in the Windows code? >>>> >>>> I believe the problem is the conversion from logical scroll delta to scroll delta in pixel coordinates. When the scale factor is non-integral, this conversion is not correct, since we clamp the result. I would prefer a better fix than the current patch :) >>> >>> Would we be better off using some of the subpixel layout rounding functions Zalan created? Maybe if we took the ceiling of the calculated pixels we would always be drawing enough, without drawing too much? >>> >>> For example, what if instead of "clampTo<int>" we used std::ceil? >>> >>> Also, maybe we could adjust the clipRect like we do the scrollViewRect: >>> >>> FloatRect rawClipRect(logicalClipRect); >>> rawClipRect.scale(scaleFactor); >>> FloatRect clipRect = enclosingIntRect(rawClipRect); >>> >>> Or something like that? >> >> Thank you, Brent! I will try out these ideas. > > Did any of those ideas work? I spoke with Per Arne in person. It doesn't look like the other ideas work, so we should proceed with this for now. Can you please change the FIME to reference a bugzilla that documents the need to improve the logic for this case?
Per Arne Vollan
Comment 8 2019-01-17 11:26:15 PST
Per Arne Vollan
Comment 9 2019-01-17 13:20:24 PST
(In reply to Brent Fulgham from comment #7) > Comment on attachment 312426 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=312426&action=review > > >>>>>> Source/WebKit/win/WebView.cpp:954 > >>>>>> + // FIXME: This is inefficient, we should be able to blit the scroll rectangle in this case as well. > >>>>> > >>>>> Is this due to a bug in the CA accelerated compositing code path? Or is there a bug in BitBlt in the Windows code? > >>>> > >>>> I believe the problem is the conversion from logical scroll delta to scroll delta in pixel coordinates. When the scale factor is non-integral, this conversion is not correct, since we clamp the result. I would prefer a better fix than the current patch :) > >>> > >>> Would we be better off using some of the subpixel layout rounding functions Zalan created? Maybe if we took the ceiling of the calculated pixels we would always be drawing enough, without drawing too much? > >>> > >>> For example, what if instead of "clampTo<int>" we used std::ceil? > >>> > >>> Also, maybe we could adjust the clipRect like we do the scrollViewRect: > >>> > >>> FloatRect rawClipRect(logicalClipRect); > >>> rawClipRect.scale(scaleFactor); > >>> FloatRect clipRect = enclosingIntRect(rawClipRect); > >>> > >>> Or something like that? > >> > >> Thank you, Brent! I will try out these ideas. > > > > Did any of those ideas work? > > I spoke with Per Arne in person. It doesn't look like the other ideas work, > so we should proceed with this for now. > > Can you please change the FIME to reference a bugzilla that documents the > need to improve the logic for this case? I have filed https://bugs.webkit.org/show_bug.cgi?id=193542. Thanks for reviewing!
Per Arne Vollan
Comment 10 2019-01-17 13:22:39 PST
WebKit Commit Bot
Comment 11 2019-01-17 13:45:13 PST
Comment on attachment 359395 [details] Patch Clearing flags on attachment: 359395 Committed r240131: <https://trac.webkit.org/changeset/240131>
Note You need to log in before you can comment on or make changes to this bug.