[WK1 Mac] Fix repaints of fixed-background elements in layer-backed WebViews
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Oct 2016 00:20:05 +0000 (00:20 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 8 Oct 2016 00:20:05 +0000 (00:20 +0000)
commita25f94af99031f753c1ce4527310a49cf599e81a
tree7ccfac991228d4c7513c49af89f37631d7aa1586
parent413c8aacc9c59d457010df937526a7971cc9640d
[WK1 Mac] Fix repaints of fixed-background elements in layer-backed WebViews
https://bugs.webkit.org/show_bug.cgi?id=163154
rdar://problem/28674216

Reviewed by Tim Horton.

r55159 added code to counteract AppKit's adjustment of dirty regions during scrolling,
by offsetting the dirty rect in -setNeedsDisplayInRect: if the call happens during
the NSViewBoundsDidChangeNotification handling.

However, AppKit only does dirty region adjustment in the code path that blits ("copy
on scroll"), so r55159 produces incorrect behavior in, for example, layer-backed views.

Fix by overriding -[NSClipView _canCopyOnScrollForDeltaX:deltaY:] to know if a single
scroll is going to blit, and only do adjustments in -setNeedsDisplayInRect: if it is.

* WebView/WebClipView.h:
* WebView/WebClipView.mm:
(-[WebClipView _immediateScrollToPoint:]):
(-[WebClipView _canCopyOnScrollForDeltaX:deltaY:]):
(-[WebClipView currentScrollIsBlit]):
* WebView/WebHTMLView.mm:
(-[WebHTMLView setNeedsDisplayInRect:]):
(-[WebHTMLView drawRect:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206945 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebClipView.h
Source/WebKit/mac/WebView/WebClipView.mm
Source/WebKit/mac/WebView/WebHTMLView.mm