Changeset 145169 in webkit


Ignore:
Timestamp:
Mar 7, 2013 6:24:34 PM (11 years ago)
Author:
akling@apple.com
Message:

Resizing Cappuccino is very laggy on WebKit since Safari 5.1
<http://webkit.org/b/71354>
<rdar://problem/10565998>

Reviewed by Anders Carlsson.

Source/WebCore:

  • WebCore.exp.in: Export FloatPoint(const NSPoint&)

Source/WebKit2:

On Mac, we already cache the window rect through the WindowAndViewFramesChanged
message, so simply return that in WebChromeClient::windowRect() instead of
sending a synchronous query to the UIProcess.

If a programmatic resize is requested, we bypass the cache until we've received
a new WindowAndViewFramesChanged message. This compromise allows us to return
cached rects in the common case, and handles creating a new window and immediately
resizing it gracefully.

Changed WindowAndViewFramesChanged to pass FloatRect/FloatPoint rather than
IntRect/IntPoint to match the ChromeClient::windowRect() return type.

  • UIProcess/API/mac/WKView.mm:

(-[WKView _updateWindowAndViewFrames]):

  • UIProcess/WebPageProxy.h:

(WebPageProxy):

  • UIProcess/mac/WebPageProxyMac.mm:

(WebKit::WebPageProxy::windowAndViewFramesChanged):

  • WebProcess/Plugins/PluginView.cpp:

(WebKit::PluginView::windowAndViewFramesChanged):

  • WebProcess/Plugins/PluginView.h:

(PluginView):

  • WebProcess/WebCoreSupport/WebChromeClient.cpp:

(WebKit::WebChromeClient::setWindowRect):
(WebKit::WebChromeClient::windowRect):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::WebPage):
(WebKit::WebPage::sendSetWindowFrame):
(WebKit::WebPage::windowAndViewFramesChanged):

  • WebProcess/WebPage/WebPage.h:

(WebPage):
(WebKit::WebPage::windowFrameInScreenCoordinates):
(WebKit::WebPage::viewFrameInWindowCoordinates):
(WebKit::WebPage::hasCachedWindowFrame):
(WebKit::WebPage::accessibilityPosition):

  • WebProcess/WebPage/WebPage.messages.in:
  • WebProcess/WebPage/mac/WKAccessibilityWebPageObject.mm:

(-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):

Location:
trunk/Source
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r145168 r145169  
     12013-03-07  Andreas Kling  <akling@apple.com>
     2
     3        Resizing Cappuccino is very laggy on WebKit since Safari 5.1
     4        <http://webkit.org/b/71354>
     5        <rdar://problem/10565998>
     6
     7        Reviewed by Anders Carlsson.
     8
     9        * WebCore.exp.in: Export FloatPoint(const NSPoint&)
     10
    1112013-03-07  Andreas Kling  <akling@apple.com>
    212
  • trunk/Source/WebCore/WebCore.exp.in

    r145156 r145169  
    7171__ZN7WebCore10CredentialC1ERKN3WTF6StringES4_NS_21CredentialPersistenceE
    7272__ZN7WebCore10CredentialC1Ev
     73__ZN7WebCore10FloatPointC1ERK8_NSPoint
    7374__ZN7WebCore10FloatPointC1ERKNS_8IntPointE
    7475__ZN7WebCore10JSDocument6s_infoE
  • trunk/Source/WebKit2/ChangeLog

    r145167 r145169  
     12013-03-07  Andreas Kling  <akling@apple.com>
     2
     3        Resizing Cappuccino is very laggy on WebKit since Safari 5.1
     4        <http://webkit.org/b/71354>
     5        <rdar://problem/10565998>
     6
     7        Reviewed by Anders Carlsson.
     8
     9        On Mac, we already cache the window rect through the WindowAndViewFramesChanged
     10        message, so simply return that in WebChromeClient::windowRect() instead of
     11        sending a synchronous query to the UIProcess.
     12
     13        If a programmatic resize is requested, we bypass the cache until we've received
     14        a new WindowAndViewFramesChanged message. This compromise allows us to return
     15        cached rects in the common case, and handles creating a new window and immediately
     16        resizing it gracefully.
     17
     18        Changed WindowAndViewFramesChanged to pass FloatRect/FloatPoint rather than
     19        IntRect/IntPoint to match the ChromeClient::windowRect() return type.
     20
     21        * UIProcess/API/mac/WKView.mm:
     22        (-[WKView _updateWindowAndViewFrames]):
     23        * UIProcess/WebPageProxy.h:
     24        (WebPageProxy):
     25        * UIProcess/mac/WebPageProxyMac.mm:
     26        (WebKit::WebPageProxy::windowAndViewFramesChanged):
     27        * WebProcess/Plugins/PluginView.cpp:
     28        (WebKit::PluginView::windowAndViewFramesChanged):
     29        * WebProcess/Plugins/PluginView.h:
     30        (PluginView):
     31        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     32        (WebKit::WebChromeClient::setWindowRect):
     33        (WebKit::WebChromeClient::windowRect):
     34        * WebProcess/WebPage/WebPage.cpp:
     35        (WebKit::WebPage::WebPage):
     36        (WebKit::WebPage::sendSetWindowFrame):
     37        (WebKit::WebPage::windowAndViewFramesChanged):
     38        * WebProcess/WebPage/WebPage.h:
     39        (WebPage):
     40        (WebKit::WebPage::windowFrameInScreenCoordinates):
     41        (WebKit::WebPage::viewFrameInWindowCoordinates):
     42        (WebKit::WebPage::hasCachedWindowFrame):
     43        (WebKit::WebPage::accessibilityPosition):
     44        * WebProcess/WebPage/WebPage.messages.in:
     45        * WebProcess/WebPage/mac/WKAccessibilityWebPageObject.mm:
     46        (-[WKAccessibilityWebPageObject accessibilityAttributeValue:]):
     47
    1482013-03-07  Alexey Proskuryakov  <ap@apple.com>
    249
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r144777 r145169  
    401401    NSPoint accessibilityPosition = [[self accessibilityAttributeValue:NSAccessibilityPositionAttribute] pointValue];
    402402   
    403     _data->_page->windowAndViewFramesChanged(enclosingIntRect(windowFrameInScreenCoordinates), enclosingIntRect(viewFrameInWindowCoordinates), IntPoint(accessibilityPosition));
     403    _data->_page->windowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates, accessibilityPosition);
    404404    if (_data->_expandsToFitContentViaAutoLayout)
    405405        _data->_page->viewExposedRectChanged([self visibleRect]);
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r145164 r145169  
    386386#if PLATFORM(MAC)
    387387    void updateWindowIsVisible(bool windowIsVisible);
    388     void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates);
     388    void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
    389389    void viewExposedRectChanged(const WebCore::FloatRect& exposedRect);
    390390    void setMainFrameIsScrollable(bool);
  • trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm

    r143537 r145169  
    130130}
    131131
    132 void WebPageProxy::windowAndViewFramesChanged(const IntRect& windowFrameInScreenCoordinates, const IntRect& viewFrameInWindowCoordinates, const IntPoint& accessibilityViewCoordinates)
     132void WebPageProxy::windowAndViewFramesChanged(const FloatRect& windowFrameInScreenCoordinates, const FloatRect& viewFrameInWindowCoordinates, const FloatPoint& accessibilityViewCoordinates)
    133133{
    134134    if (!isValid())
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginView.cpp

    r144670 r145169  
    483483}
    484484
    485 void PluginView::windowAndViewFramesChanged(const IntRect& windowFrameInScreenCoordinates, const IntRect& viewFrameInWindowCoordinates)
    486 {
    487     if (!m_isInitialized || !m_plugin)
    488         return;
    489 
    490     m_plugin->windowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates);
     485void PluginView::windowAndViewFramesChanged(const FloatRect& windowFrameInScreenCoordinates, const FloatRect& viewFrameInWindowCoordinates)
     486{
     487    if (!m_isInitialized || !m_plugin)
     488        return;
     489
     490    m_plugin->windowAndViewFramesChanged(enclosingIntRect(windowFrameInScreenCoordinates), enclosingIntRect(viewFrameInWindowCoordinates));
    491491}
    492492
  • trunk/Source/WebKit2/WebProcess/Plugins/PluginView.h

    r144670 r145169  
    7373    void setWindowIsFocused(bool);
    7474    void setDeviceScaleFactor(float);
    75     void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates);
     75    void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates);
    7676    bool sendComplexTextInput(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
    7777    void setLayerHostingMode(LayerHostingMode);
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r145133 r145169  
    108108void WebChromeClient::setWindowRect(const FloatRect& windowFrame)
    109109{
    110     m_page->send(Messages::WebPageProxy::SetWindowFrame(windowFrame));
     110    m_page->sendSetWindowFrame(windowFrame);
    111111}
    112112
    113113FloatRect WebChromeClient::windowRect()
    114114{
     115#if PLATFORM(MAC)
     116    if (m_page->hasCachedWindowFrame())
     117        return m_page->windowFrameInScreenCoordinates();
     118#endif
     119
    115120    FloatRect newWindowFrame;
    116121
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r144907 r145169  
    238238#if PLATFORM(MAC)
    239239    , m_pdfPluginEnabled(false)
     240    , m_hasCachedWindowFrame(false)
    240241    , m_windowIsVisible(false)
    241242    , m_layerHostingMode(parameters.layerHostingMode)
     
    29062907}
    29072908
     2909void WebPage::sendSetWindowFrame(const FloatRect& windowFrame)
     2910{
     2911#if PLATFORM(MAC)
     2912    m_hasCachedWindowFrame = false;
     2913#endif
     2914    send(Messages::WebPageProxy::SetWindowFrame(windowFrame));
     2915}
     2916
    29082917#if PLATFORM(MAC)
    29092918void WebPage::setWindowIsVisible(bool windowIsVisible)
     
    29182927}
    29192928
    2920 void WebPage::windowAndViewFramesChanged(const IntRect& windowFrameInScreenCoordinates, const IntRect& viewFrameInWindowCoordinates, const IntPoint& accessibilityViewCoordinates)
     2929void WebPage::windowAndViewFramesChanged(const FloatRect& windowFrameInScreenCoordinates, const FloatRect& viewFrameInWindowCoordinates, const FloatPoint& accessibilityViewCoordinates)
    29212930{
    29222931    m_windowFrameInScreenCoordinates = windowFrameInScreenCoordinates;
     
    29262935    // Tell all our plug-in views that the window and view frames have changed.
    29272936    for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it)
    2928         (*it)->windowAndViewFramesChanged(windowFrameInScreenCoordinates, viewFrameInWindowCoordinates);
     2937        (*it)->windowAndViewFramesChanged(enclosingIntRect(windowFrameInScreenCoordinates), enclosingIntRect(viewFrameInWindowCoordinates));
     2938
     2939    m_hasCachedWindowFrame = true;
    29292940}
    29302941#endif
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r145156 r145169  
    300300    void sendClose();
    301301
     302    void sendSetWindowFrame(const WebCore::FloatRect&);
     303
    302304    double textZoomFactor() const;
    303305    void setTextZoomFactor(double);
     
    353355    bool windowIsVisible() const { return m_windowIsVisible; }
    354356    void updatePluginsActiveAndFocusedState();
    355     const WebCore::IntRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; }
    356     const WebCore::IntRect& viewFrameInWindowCoordinates() const { return m_viewFrameInWindowCoordinates; }
     357    const WebCore::FloatRect& windowFrameInScreenCoordinates() const { return m_windowFrameInScreenCoordinates; }
     358    const WebCore::FloatRect& viewFrameInWindowCoordinates() const { return m_viewFrameInWindowCoordinates; }
     359
     360    bool hasCachedWindowFrame() const { return m_hasCachedWindowFrame; }
    357361
    358362    void setTopOverhangImage(PassRefPtr<WebImage>);
     
    442446    void registerUIProcessAccessibilityTokens(const CoreIPC::DataReference& elemenToken, const CoreIPC::DataReference& windowToken);
    443447    WKAccessibilityWebPageObject* accessibilityRemoteObject();
    444     WebCore::IntPoint accessibilityPosition() const { return m_accessibilityPosition; }   
     448    const WebCore::FloatPoint& accessibilityPosition() const { return m_accessibilityPosition; }
    445449   
    446450    void sendComplexTextInputToPlugin(uint64_t pluginComplexTextInputIdentifier, const String& textInput);
     
    733737
    734738    void setWindowIsVisible(bool windowIsVisible);
    735     void windowAndViewFramesChanged(const WebCore::IntRect& windowFrameInScreenCoordinates, const WebCore::IntRect& viewFrameInWindowCoordinates, const WebCore::IntPoint& accessibilityViewCoordinates);
     739    void windowAndViewFramesChanged(const WebCore::FloatRect& windowFrameInScreenCoordinates, const WebCore::FloatRect& viewFrameInWindowCoordinates, const WebCore::FloatPoint& accessibilityViewCoordinates);
    736740
    737741    RetainPtr<PDFDocument> pdfDocumentForPrintingFrame(WebCore::Frame*);
     
    842846    bool m_pdfPluginEnabled;
    843847
     848    bool m_hasCachedWindowFrame;
     849
    844850    // Whether the containing window is visible or not.
    845851    bool m_windowIsVisible;
    846852
    847853    // The frame of the containing window in screen coordinates.
    848     WebCore::IntRect m_windowFrameInScreenCoordinates;
     854    WebCore::FloatRect m_windowFrameInScreenCoordinates;
    849855
    850856    // The frame of the view in window coordinates.
    851     WebCore::IntRect m_viewFrameInWindowCoordinates;
     857    WebCore::FloatRect m_viewFrameInWindowCoordinates;
    852858
    853859    // The accessibility position of the view.
    854     WebCore::IntPoint m_accessibilityPosition;
     860    WebCore::FloatPoint m_accessibilityPosition;
    855861   
    856862    // The layer hosting mode.
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

    r144436 r145169  
    261261
    262262    SetWindowIsVisible(bool windowIsVisible)
    263     WindowAndViewFramesChanged(WebCore::IntRect windowFrameInScreenCoordinates, WebCore::IntRect viewFrameInWindowCoordinates, WebCore::IntPoint accessibilityViewCoordinates)
     263    WindowAndViewFramesChanged(WebCore::FloatRect windowFrameInScreenCoordinates, WebCore::FloatRect viewFrameInWindowCoordinates, WebCore::FloatPoint accessibilityViewCoordinates)
    264264    ViewExposedRectChanged(WebCore::FloatRect exposedRect)
    265265    SetMainFrameIsScrollable(bool isScrollable)
  • trunk/Source/WebKit2/WebProcess/WebPage/mac/WKAccessibilityWebPageObject.mm

    r115295 r145169  
    146146
    147147    if ([attribute isEqualToString:NSAccessibilityPositionAttribute]) {
    148         WebCore::IntPoint point = m_page->accessibilityPosition();
     148        const WebCore::FloatPoint& point = m_page->accessibilityPosition();
    149149        return [NSValue valueWithPoint:NSMakePoint(point.x(), point.y())];
    150150    }
Note: See TracChangeset for help on using the changeset viewer.