Changeset 151344 in webkit


Ignore:
Timestamp:
Jun 7, 2013 5:11:34 PM (11 years ago)
Author:
andersca@apple.com
Message:

Coalesce multiple calls to WebPageProxy::windowAndViewFramesChanged
https://bugs.webkit.org/show_bug.cgi?id=117364
<rdar://problem/14042099>

Reviewed by Geoffrey Garen.

-[WKView _updateWindowAndViewFrames] can be called many times per run loop iteration so coalesce calls
to WebPageProxy::windowAndViewFrames using dispatch_async.

  • UIProcess/API/mac/WKView.mm:

(-[WKView _updateWindowAndViewFrames]):

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r151332 r151344  
     12013-06-07  Anders Carlsson  <andersca@apple.com>
     2
     3        Coalesce multiple calls to WebPageProxy::windowAndViewFramesChanged
     4        https://bugs.webkit.org/show_bug.cgi?id=117364
     5        <rdar://problem/14042099>
     6
     7        Reviewed by Geoffrey Garen.
     8
     9        -[WKView _updateWindowAndViewFrames] can be called many times per run loop iteration so coalesce calls
     10        to WebPageProxy::windowAndViewFrames using dispatch_async.
     11
     12        * UIProcess/API/mac/WKView.mm:
     13        (-[WKView _updateWindowAndViewFrames]):
     14
    1152013-06-07  Thomas Deniau  <deniau@apple.com>
    216
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r151181 r151344  
    217217    BOOL _viewInWindowChangeWasDeferred;
    218218
     219    BOOL _didScheduleWindowAndViewFrameUpdate;
     220
    219221    // Whether the containing window of the WKView has a valid backing store.
    220222    // The window server invalidates the backing store whenever the window is resized or minimized.
     
    456458- (void)_updateWindowAndViewFrames
    457459{
    458     NSRect viewFrameInWindowCoordinates = [self convertRect:[self frame] toView:nil];
    459     NSPoint accessibilityPosition = NSMakePoint(0, 0);
    460     if (WebCore::AXObjectCache::accessibilityEnabled())
    461         accessibilityPosition = [[self accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
    462    
    463     _data->_page->windowAndViewFramesChanged(viewFrameInWindowCoordinates, accessibilityPosition);
    464460    if (_data->_clipsToVisibleRect)
    465461        [self _updateViewExposedRect];
     462
     463    if (_data->_didScheduleWindowAndViewFrameUpdate)
     464        return;
     465
     466    _data->_didScheduleWindowAndViewFrameUpdate = YES;
     467
     468    dispatch_async(dispatch_get_main_queue(), ^{
     469        NSRect viewFrameInWindowCoordinates = [self convertRect:[self frame] toView:nil];
     470        NSPoint accessibilityPosition = NSMakePoint(0, 0);
     471        if (WebCore::AXObjectCache::accessibilityEnabled())
     472            accessibilityPosition = [[self accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
     473
     474        _data->_page->windowAndViewFramesChanged(viewFrameInWindowCoordinates, accessibilityPosition);
     475        _data->_didScheduleWindowAndViewFrameUpdate = NO;
     476    });
    466477}
    467478
Note: See TracChangeset for help on using the changeset viewer.