Changeset 99911 in webkit


Ignore:
Timestamp:
Nov 10, 2011, 4:06:02 PM (14 years ago)
Author:
Beth Dakin
Message:

https://bugs.webkit.org/show_bug.cgi?id=66584
WebKit2's find bouncy looks blurry after dragging window onto >1.0 scale factor
display
-and corresponding-
<rdar://problem/9987559>

Reviewed by Anders Carlsson.

The setFindIndicator message and various functions of the same name must all take
an additional parameter indicating whether or not setting the find indicator
should result in a bounce animation. This is because when the device scale factor
changes, if there is currently a find indicator, it must be re-set to a higher or
lower resolution version, but we don't want the bounce animation to happen again.

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

(WebKit::FindIndicatorWindow::setFindIndicator):

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

(WebKit::PageClientImpl::setFindIndicator):

  • UIProcess/API/mac/WKView.mm:

(-[WKView _setFindIndicator:fadeOut:animate:]):

  • UIProcess/API/mac/WKViewInternal.h:
  • UIProcess/PageClient.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::setFindIndicator):

  • UIProcess/WebPageProxy.h:
  • UIProcess/WebPageProxy.messages.in:

New function FindController::isShowingOverlay() is used to determine if
FindController::deviceScaleFactorDidChange() needs to be called.

  • WebProcess/WebPage/FindController.h:

(WebKit::FindController::isShowingOverlay):

FindController::deviceScaleFactorDidChange() calls updateFindIndicator to re-
generate the bitmap at the appropriate scale factor, but tells it not to animate
this time.
(WebKit::FindController::deviceScaleFactorDidChange):

updateFindIndicator() takes a new parameter indicating whether or not the
FindIndicator should animate. It defaults to true since the deviceScaleFactor
changing is the only case currently where we do not want it to animate.

  • WebProcess/WebPage/FindController.cpp:

(WebKit::FindController::updateFindIndicator):
(WebKit::FindController::hideFindIndicator):

Calls into FindController::deviceScaleFactorDidChange() when the scale factor has
changed and the find overlay is showing.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::setDeviceScaleFactor):

Location:
trunk/Source/WebKit2
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r99894 r99911  
     12011-11-10  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=66584
     4        WebKit2's find bouncy looks blurry after dragging window onto >1.0 scale factor
     5        display
     6        -and corresponding-
     7        <rdar://problem/9987559>
     8
     9        Reviewed by Anders Carlsson.
     10
     11        The setFindIndicator message and various functions of the same name must all take
     12        an additional parameter indicating whether or not setting the find indicator
     13        should result in a bounce animation. This is because when the device scale factor
     14        changes, if there is currently a find indicator, it must be re-set to a higher or
     15        lower resolution version, but we don't want the bounce animation to happen again.
     16        * UIProcess/API/mac/FindIndicatorWindow.h:
     17        * UIProcess/API/mac/FindIndicatorWindow.mm:
     18        (WebKit::FindIndicatorWindow::setFindIndicator):
     19        * UIProcess/API/mac/PageClientImpl.h:
     20        * UIProcess/API/mac/PageClientImpl.mm:
     21        (WebKit::PageClientImpl::setFindIndicator):
     22        * UIProcess/API/mac/WKView.mm:
     23        (-[WKView _setFindIndicator:fadeOut:animate:]):
     24        * UIProcess/API/mac/WKViewInternal.h:
     25        * UIProcess/PageClient.h:
     26        * UIProcess/WebPageProxy.cpp:
     27        (WebKit::WebPageProxy::setFindIndicator):
     28        * UIProcess/WebPageProxy.h:
     29        * UIProcess/WebPageProxy.messages.in:
     30
     31        New function FindController::isShowingOverlay() is used to determine if
     32        FindController::deviceScaleFactorDidChange() needs to be called.
     33        * WebProcess/WebPage/FindController.h:
     34        (WebKit::FindController::isShowingOverlay):
     35
     36        FindController::deviceScaleFactorDidChange() calls updateFindIndicator to re-
     37        generate the bitmap at the appropriate scale factor, but tells it not to animate
     38        this time.
     39        (WebKit::FindController::deviceScaleFactorDidChange):
     40
     41        updateFindIndicator() takes a new parameter indicating whether or not the
     42        FindIndicator should animate. It defaults to true since the deviceScaleFactor
     43        changing is the only case currently where we do not want it to animate.
     44        * WebProcess/WebPage/FindController.cpp:
     45        (WebKit::FindController::updateFindIndicator):
     46        (WebKit::FindController::hideFindIndicator):
     47
     48        Calls into FindController::deviceScaleFactorDidChange() when the scale factor has
     49        changed and the find overlay is showing.
     50        * WebProcess/WebPage/WebPage.cpp:
     51        (WebKit::WebPage::setDeviceScaleFactor):
     52
    1532011-11-10  Timothy Hatcher  <timothy@apple.com>
    254
  • trunk/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h

    r95901 r99911  
    4848    ~FindIndicatorWindow();
    4949
    50     void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut);
     50    void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate);
    5151
    5252private:
  • trunk/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm

    r95901 r99911  
    130130}
    131131
    132 void FindIndicatorWindow::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut)
     132void FindIndicatorWindow::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut, bool animate)
    133133{
    134134    if (m_findIndicator == findIndicator)
     
    164164    [m_findIndicatorWindow.get() setReleasedWhenClosed:NO];
    165165
    166     // Start the bounce animation.
    167     m_bounceAnimationContext = WKWindowBounceAnimationContextCreate(m_findIndicatorWindow.get());
    168     m_bounceAnimation.adoptNS([[WKFindIndicatorWindowAnimation alloc] _initWithFindIndicatorWindow:this
    169                                                                                   animationDuration:bounceAnimationDuration
    170                                                                           animationProgressCallback:&FindIndicatorWindow::bounceAnimationCallback
    171                                                                             animationDidEndCallback:&FindIndicatorWindow::bounceAnimationDidEnd]);
    172     [m_bounceAnimation.get() startAnimation];
     166    if (animate) {
     167        // Start the bounce animation.
     168        m_bounceAnimationContext = WKWindowBounceAnimationContextCreate(m_findIndicatorWindow.get());
     169        m_bounceAnimation.adoptNS([[WKFindIndicatorWindowAnimation alloc] _initWithFindIndicatorWindow:this
     170                                                                                    animationDuration:bounceAnimationDuration
     171                                                                            animationProgressCallback:&FindIndicatorWindow::bounceAnimationCallback
     172                                                                              animationDidEndCallback:&FindIndicatorWindow::bounceAnimationDidEnd]);
     173        [m_bounceAnimation.get() startAnimation];
     174    }
    173175
    174176    if (fadeOut)
  • trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h

    r98472 r99911  
    8989    virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
    9090
    91     void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut);
     91    void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate);
    9292
    9393    virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
  • trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm

    r98472 r99911  
    314314}
    315315
    316 void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut)
    317 {
    318     [m_wkView _setFindIndicator:findIndicator fadeOut:fadeOut];
     316void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut, bool animate)
     317{
     318    [m_wkView _setFindIndicator:findIndicator fadeOut:fadeOut animate:animate];
    319319}
    320320
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r99894 r99911  
    23382338}
    23392339
    2340 - (void)_setFindIndicator:(PassRefPtr<FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut
     2340- (void)_setFindIndicator:(PassRefPtr<FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate
    23412341{
    23422342    if (!findIndicator) {
     
    23482348        _data->_findIndicatorWindow = FindIndicatorWindow::create(self);
    23492349
    2350     _data->_findIndicatorWindow->setFindIndicator(findIndicator, fadeOut);
     2350    _data->_findIndicatorWindow->setFindIndicator(findIndicator, fadeOut, animate);
    23512351}
    23522352
  • trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h

    r97804 r99911  
    6161- (NSRect)_convertToDeviceSpace:(NSRect)rect;
    6262- (NSRect)_convertToUserSpace:(NSRect)rect;
    63 - (void)_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut;
     63- (void)_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate;
    6464
    6565- (void)_enterAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext;
  • trunk/Source/WebKit2/UIProcess/PageClient.h

    r99178 r99911  
    152152    virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) = 0;
    153153
    154     virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut) = 0;
     154    virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate) = 0;
    155155#if PLATFORM(WIN)
    156156    virtual void didInstallOrUninstallPageOverlay(bool) = 0;
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r99188 r99911  
    24032403}
    24042404
    2405 void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut)
     2405void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut, bool animate)
    24062406{
    24072407    RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageScaleFactor, contentImageHandle);
    2408     m_pageClient->setFindIndicator(findIndicator.release(), fadeOut);
     2408    m_pageClient->setFindIndicator(findIndicator.release(), fadeOut, animate);
    24092409}
    24102410
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r99188 r99911  
    432432    void countStringMatches(const String&, FindOptions, unsigned maxMatchCount);
    433433    void didCountStringMatches(const String&, uint32_t matchCount);
    434     void setFindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut);
     434    void setFindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut, bool animate);
    435435    void didFindString(const String&, uint32_t matchCount);
    436436    void didFailToFindString(const String&);
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in

    r99108 r99911  
    166166    # Find messages
    167167    DidCountStringMatches(WTF::String string, uint32_t matchCount)
    168     SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, float contentImageScaleFactor, WebKit::ShareableBitmap::Handle contentImageHandle, bool fadeOut)
     168    SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, float contentImageScaleFactor, WebKit::ShareableBitmap::Handle contentImageHandle, bool fadeOut, bool animate)
    169169    DidFindString(WTF::String string, uint32_t matchCount)
    170170    DidFailToFindString(WTF::String string)
  • trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp

    r95901 r99911  
    160160}
    161161
    162 bool FindController::updateFindIndicator(Frame* selectedFrame, bool isShowingOverlay)
     162bool FindController::updateFindIndicator(Frame* selectedFrame, bool isShowingOverlay, bool shouldAnimate)
    163163{
    164164    if (!selectedFrame)
     
    212212        textRectsInSelectionRectCoordinates.append(textRectInSelectionRectCoordinates);
    213213    }           
    214    
    215     m_webPage->send(Messages::WebPageProxy::SetFindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, m_webPage->corePage()->deviceScaleFactor(), handle, !isShowingOverlay));
     214
     215    m_webPage->send(Messages::WebPageProxy::SetFindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, m_webPage->corePage()->deviceScaleFactor(), handle, !isShowingOverlay, shouldAnimate));
    216216    m_isShowingFindIndicator = true;
    217217
     
    225225
    226226    ShareableBitmap::Handle handle;
    227     m_webPage->send(Messages::WebPageProxy::SetFindIndicator(FloatRect(), Vector<FloatRect>(), m_webPage->corePage()->deviceScaleFactor(), handle, false));
     227    m_webPage->send(Messages::WebPageProxy::SetFindIndicator(FloatRect(), Vector<FloatRect>(), m_webPage->corePage()->deviceScaleFactor(), handle, false, true));
    228228    m_isShowingFindIndicator = false;
    229229}
     
    236236   
    237237    updateFindIndicator(selectedFrame, false);
     238}
     239
     240void FindController::deviceScaleFactorDidChange()
     241{
     242    ASSERT(isShowingOverlay());
     243
     244    Frame* selectedFrame = frameWithSelection(m_webPage->corePage());
     245    if (!selectedFrame)
     246        return;
     247
     248    updateFindIndicator(selectedFrame, true, false);
    238249}
    239250
  • trunk/Source/WebKit2/WebProcess/WebPage/FindController.h

    r95901 r99911  
    5656    void showFindIndicatorInSelection();
    5757
     58    bool isShowingOverlay() const { return m_isShowingFindIndicator && m_findPageOverlay; }
     59
     60    void deviceScaleFactorDidChange();
     61
    5862private:
    5963    // PageOverlay::Client.
     
    6569
    6670    Vector<WebCore::IntRect> rectsForTextMatches();
    67     bool updateFindIndicator(WebCore::Frame* selectedFrame, bool isShowingOverlay);
     71    bool updateFindIndicator(WebCore::Frame* selectedFrame, bool isShowingOverlay, bool shouldAnimate = true);
    6872
    6973private:
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r99725 r99911  
    875875        (*it)->setDeviceScaleFactor(scaleFactor);
    876876#endif
     877
     878    if (m_findController.isShowingOverlay()) {
     879        // We must have updated layout to get the selection rects right.
     880        layoutIfNeeded();
     881        m_findController.deviceScaleFactorDidChange();
     882    }
    877883}
    878884
Note: See TracChangeset for help on using the changeset viewer.