Title: [133225] trunk/Source/WebKit/mac
Revision
133225
Author
aro...@webkit.org
Date
2012-11-01 13:57:46 -0700 (Thu, 01 Nov 2012)

Log Message

[WK1] Fixed-position elements jiggle up and down slightly during scrolling on a Retina display
https://bugs.webkit.org/show_bug.cgi?id=100957

Reviewed by Simon Fraser.

WebCore doesn't yet support subpixel scrolling. WebKit2 forces
scrolling to always be integral. Now WebKit1 forces this as well.

I'm not sure how to write a test for this.

* WebView/WebDynamicScrollBarsView.mm:
(shouldRoundScrollOrigin): Returns YES if there are any position:fixed
or position:sticky elements in the page.
(-[WebDynamicScrollBarsView scrollClipView:toPoint:]): Round the
scroll origin to the nearest pixel if needed.

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (133224 => 133225)


--- trunk/Source/WebKit/mac/ChangeLog	2012-11-01 20:54:20 UTC (rev 133224)
+++ trunk/Source/WebKit/mac/ChangeLog	2012-11-01 20:57:46 UTC (rev 133225)
@@ -1,3 +1,21 @@
+2012-11-01  Adam Roben  <aro...@webkit.org>
+
+        [WK1] Fixed-position elements jiggle up and down slightly during scrolling on a Retina display
+        https://bugs.webkit.org/show_bug.cgi?id=100957
+
+        Reviewed by Simon Fraser.
+
+        WebCore doesn't yet support subpixel scrolling. WebKit2 forces
+        scrolling to always be integral. Now WebKit1 forces this as well.
+
+        I'm not sure how to write a test for this.
+
+        * WebView/WebDynamicScrollBarsView.mm:
+        (shouldRoundScrollOrigin): Returns YES if there are any position:fixed
+        or position:sticky elements in the page.
+        (-[WebDynamicScrollBarsView scrollClipView:toPoint:]): Round the
+        scroll origin to the nearest pixel if needed.
+
 2012-10-31  Anders Carlsson  <ander...@apple.com>
 
         Fix build.

Modified: trunk/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm (133224 => 133225)


--- trunk/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm	2012-11-01 20:54:20 UTC (rev 133224)
+++ trunk/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm	2012-11-01 20:57:46 UTC (rev 133225)
@@ -29,7 +29,6 @@
 #import "WebFrameInternal.h"
 #import "WebFrameView.h"
 #import "WebHTMLViewInternal.h"
-#import <WebCore/Frame.h>
 #import <WebCore/FrameView.h>
 #import <WebKitSystemInterface.h>
 
@@ -188,6 +187,36 @@
     return _private->verticalScrollingAllowedButScrollerHidden || [self hasVerticalScroller];
 }
 
+static BOOL shouldRoundScrollOrigin(WebDynamicScrollBarsView *view)
+{
+    NSView *documentView = [view documentView];
+    if (![documentView isKindOfClass:[WebHTMLView class]])
+        return NO;
+
+    Frame* frame = core([(WebHTMLView *)documentView _frame]);
+    if (!frame)
+        return NO;
+    
+    FrameView *frameView = frame->view();
+    if (!frameView)
+        return NO;
+
+    return frameView->hasViewportConstrainedObjects();
+}
+
+- (void)scrollClipView:(NSClipView *)clipView toPoint:(NSPoint)point
+{
+    if (shouldRoundScrollOrigin(self)) {
+        // WebCore isn't yet able to handle subpixel scrolling, as can happen on Retina displays. For
+        // now we'll round to the nearest pixel. Once subpixel layout is enabled in WebCore we may be
+        // able to remove this method entirely.
+        point.x = round(point.x);
+        point.y = round(point.y);
+    }
+
+    [super scrollClipView:clipView toPoint:point];
+}
+
 @end
 
 @implementation WebDynamicScrollBarsView (WebInternal)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to