Changeset 133225 in webkit


Ignore:
Timestamp:
Nov 1, 2012 1:57:46 PM (11 years ago)
Author:
aroben@webkit.org
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.

Location:
trunk/Source/WebKit/mac
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/mac/ChangeLog

    r133109 r133225  
     12012-11-01  Adam Roben  <aroben@webkit.org>
     2
     3        [WK1] Fixed-position elements jiggle up and down slightly during scrolling on a Retina display
     4        https://bugs.webkit.org/show_bug.cgi?id=100957
     5
     6        Reviewed by Simon Fraser.
     7
     8        WebCore doesn't yet support subpixel scrolling. WebKit2 forces
     9        scrolling to always be integral. Now WebKit1 forces this as well.
     10
     11        I'm not sure how to write a test for this.
     12
     13        * WebView/WebDynamicScrollBarsView.mm:
     14        (shouldRoundScrollOrigin): Returns YES if there are any position:fixed
     15        or position:sticky elements in the page.
     16        (-[WebDynamicScrollBarsView scrollClipView:toPoint:]): Round the
     17        scroll origin to the nearest pixel if needed.
     18
    1192012-10-31  Anders Carlsson  <andersca@apple.com>
    220
  • trunk/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm

    r122400 r133225  
    3030#import "WebFrameView.h"
    3131#import "WebHTMLViewInternal.h"
    32 #import <WebCore/Frame.h>
    3332#import <WebCore/FrameView.h>
    3433#import <WebKitSystemInterface.h>
     
    187186{
    188187    return _private->verticalScrollingAllowedButScrollerHidden || [self hasVerticalScroller];
     188}
     189
     190static BOOL shouldRoundScrollOrigin(WebDynamicScrollBarsView *view)
     191{
     192    NSView *documentView = [view documentView];
     193    if (![documentView isKindOfClass:[WebHTMLView class]])
     194        return NO;
     195
     196    Frame* frame = core([(WebHTMLView *)documentView _frame]);
     197    if (!frame)
     198        return NO;
     199   
     200    FrameView *frameView = frame->view();
     201    if (!frameView)
     202        return NO;
     203
     204    return frameView->hasViewportConstrainedObjects();
     205}
     206
     207- (void)scrollClipView:(NSClipView *)clipView toPoint:(NSPoint)point
     208{
     209    if (shouldRoundScrollOrigin(self)) {
     210        // WebCore isn't yet able to handle subpixel scrolling, as can happen on Retina displays. For
     211        // now we'll round to the nearest pixel. Once subpixel layout is enabled in WebCore we may be
     212        // able to remove this method entirely.
     213        point.x = round(point.x);
     214        point.y = round(point.y);
     215    }
     216
     217    [super scrollClipView:clipView toPoint:point];
    189218}
    190219
Note: See TracChangeset for help on using the changeset viewer.