Changeset 151403 in webkit


Ignore:
Timestamp:
Jun 10, 2013 2:32:35 PM (11 years ago)
Author:
andersca@apple.com
Message:

-[WKView _updateWindowAndViewFrames] should avoid updating the view frame in window coordinates if we don't have plugins
https://bugs.webkit.org/show_bug.cgi?id=117420
<rdar://problem/14073034>

Reviewed by Tim Horton.

If plug-ins are disabled there's no need for the web process to know about the view frame in window coordinates so only
send it when plug-ins are enabled. In addition, if accessibility is disabled we don't need to send a message at all.

  • UIProcess/API/mac/PageClientImpl.h:
  • UIProcess/API/mac/PageClientImpl.mm:

(WebKit::PageClientImpl::preferencesDidChange):
Call through to -[WKView _preferencesDidChange].

  • UIProcess/API/mac/WKView.mm:

(-[WKView _updateWindowAndViewFrames]):
Don't compute viewFrameInWindowCoordinates or accessibilityPosition unless they're required. If neither are required,
don't even send a message to the web process.

(-[WKView _preferencesDidChange]):
Update _needsViewFrameInWindowCoordinates and call -[WKView _updateWindowAndViewFrames] if needed.

(-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
Set _needsViewFrameInWindowCoordinates based on whether plug-ins are enabled or not.

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::preferencesDidChange):
Call the page client.

Location:
trunk/Source/WebKit2
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r151402 r151403  
     12013-06-10  Anders Carlsson  <andersca@apple.com>
     2
     3        -[WKView _updateWindowAndViewFrames] should avoid updating the view frame in window coordinates if we don't have plugins
     4        https://bugs.webkit.org/show_bug.cgi?id=117420
     5        <rdar://problem/14073034>
     6
     7        Reviewed by Tim Horton.
     8
     9        If plug-ins are disabled there's no need for the web process to know about the view frame in window coordinates so only
     10        send it when plug-ins are enabled. In addition, if accessibility is disabled we don't need to send a message at all.
     11
     12        * UIProcess/API/mac/PageClientImpl.h:
     13        * UIProcess/API/mac/PageClientImpl.mm:
     14        (WebKit::PageClientImpl::preferencesDidChange):
     15        Call through to -[WKView _preferencesDidChange].
     16
     17        * UIProcess/API/mac/WKView.mm:
     18        (-[WKView _updateWindowAndViewFrames]):
     19        Don't compute viewFrameInWindowCoordinates or accessibilityPosition unless they're required. If neither are required,
     20        don't even send a message to the web process.
     21
     22        (-[WKView _preferencesDidChange]):
     23        Update _needsViewFrameInWindowCoordinates and call -[WKView _updateWindowAndViewFrames] if needed.
     24
     25        (-[WKView initWithFrame:contextRef:pageGroupRef:relatedToPage:]):
     26        Set _needsViewFrameInWindowCoordinates based on whether plug-ins are enabled or not.
     27
     28        * UIProcess/WebPageProxy.cpp:
     29        (WebKit::WebPageProxy::preferencesDidChange):
     30        Call the page client.
     31
    1322013-06-10  Bear Travis  <betravis@adobe.com>
    233
  • trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h

    r150291 r151403  
    6969    virtual void pageClosed();
    7070    virtual void didRelaunchProcess();
     71    virtual void preferencesDidChange() OVERRIDE;
    7172    virtual void toolTipChanged(const String& oldToolTip, const String& newToolTip);
    7273    virtual void setCursor(const WebCore::Cursor&);
  • trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm

    r150291 r151403  
    259259}
    260260
     261void PageClientImpl::preferencesDidChange()
     262{
     263    [m_wkView _preferencesDidChange];
     264}
     265
    261266void PageClientImpl::toolTipChanged(const String& oldToolTip, const String& newToolTip)
    262267{
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r151344 r151403  
    6363#import "WebFullScreenManagerProxy.h"
    6464#import "WebPage.h"
     65#import "WebPageGroup.h"
    6566#import "WebPageProxy.h"
     67#import "WebPreferences.h"
    6668#import "WebProcessProxy.h"
    6769#import "WebSystemInterface.h"
     
    217219    BOOL _viewInWindowChangeWasDeferred;
    218220
     221    BOOL _needsViewFrameInWindowCoordinates;
    219222    BOOL _didScheduleWindowAndViewFrameUpdate;
    220223
     
    467470
    468471    dispatch_async(dispatch_get_main_queue(), ^{
    469         NSRect viewFrameInWindowCoordinates = [self convertRect:[self frame] toView:nil];
    470         NSPoint accessibilityPosition = NSMakePoint(0, 0);
     472        _data->_didScheduleWindowAndViewFrameUpdate = NO;
     473
     474        if (!_data->_needsViewFrameInWindowCoordinates && !WebCore::AXObjectCache::accessibilityEnabled())
     475            return;
     476
     477        NSRect viewFrameInWindowCoordinates = NSZeroRect;
     478        NSPoint accessibilityPosition = NSZeroPoint;
     479
     480        if (_data->_needsViewFrameInWindowCoordinates)
     481            viewFrameInWindowCoordinates = [self convertRect:self.frame toView:nil];
     482
    471483        if (WebCore::AXObjectCache::accessibilityEnabled())
    472484            accessibilityPosition = [[self accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
    473485
    474486        _data->_page->windowAndViewFramesChanged(viewFrameInWindowCoordinates, accessibilityPosition);
    475         _data->_didScheduleWindowAndViewFrameUpdate = NO;
    476487    });
    477488}
     
    24252436}
    24262437
     2438- (void)_preferencesDidChange
     2439{
     2440    BOOL needsViewFrameInWindowCoordinates = _data->_page->pageGroup()->preferences()->pluginsEnabled();
     2441
     2442    if (!!needsViewFrameInWindowCoordinates == !!_data->_needsViewFrameInWindowCoordinates)
     2443        return;
     2444
     2445    _data->_needsViewFrameInWindowCoordinates = needsViewFrameInWindowCoordinates;
     2446    if ([self window])
     2447        [self _updateWindowAndViewFrames];
     2448}
     2449
    24272450- (void)_setCursor:(NSCursor *)cursor
    24282451{
     
    31283151#endif
    31293152
     3153    _data->_needsViewFrameInWindowCoordinates = _data->_page->pageGroup()->preferences()->pluginsEnabled();
    31303154    _data->_frameOrigin = NSZeroPoint;
    31313155    _data->_contentAnchor = WKContentAnchorTopLeft;
  • trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h

    r150291 r151403  
    5656- (void)_pageClosed;
    5757- (void)_didRelaunchProcess;
     58- (void)_preferencesDidChange;
    5859- (void)_toolTipChangedFrom:(NSString *)oldToolTip to:(NSString *)newToolTip;
    5960- (void)_setCursor:(NSCursor *)cursor;
  • trunk/Source/WebKit2/UIProcess/PageClient.h

    r150291 r151403  
    113113    virtual void pageClosed() = 0;
    114114
     115    virtual void preferencesDidChange() = 0;
     116
    115117    virtual void toolTipChanged(const String&, const String&) = 0;
    116118
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r151234 r151403  
    21462146    m_process->pagePreferencesChanged(this);
    21472147
     2148    m_pageClient->preferencesDidChange();
     2149
    21482150    // FIXME: It probably makes more sense to send individual preference changes.
    21492151    // However, WebKitTestRunner depends on getting a preference change notification
Note: See TracChangeset for help on using the changeset viewer.