Title: [99911] trunk/Source/WebKit2
Revision
99911
Author
[email protected]
Date
2011-11-10 16:06:02 -0800 (Thu, 10 Nov 2011)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (99910 => 99911)


--- trunk/Source/WebKit2/ChangeLog	2011-11-10 23:59:31 UTC (rev 99910)
+++ trunk/Source/WebKit2/ChangeLog	2011-11-11 00:06:02 UTC (rev 99911)
@@ -1,3 +1,55 @@
+2011-11-10  Beth Dakin  <[email protected]>
+
+        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):
+
 2011-11-10  Timothy Hatcher  <[email protected]>
 
         Make WKViews in NSPopovers render as they would in active windows.

Modified: trunk/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h (99910 => 99911)


--- trunk/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h	2011-11-10 23:59:31 UTC (rev 99910)
+++ trunk/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h	2011-11-11 00:06:02 UTC (rev 99911)
@@ -47,7 +47,7 @@
     static PassOwnPtr<FindIndicatorWindow> create(WKView *);
     ~FindIndicatorWindow();
 
-    void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut);
+    void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate);
 
 private:
     explicit FindIndicatorWindow(WKView *);

Modified: trunk/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm (99910 => 99911)


--- trunk/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm	2011-11-10 23:59:31 UTC (rev 99910)
+++ trunk/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm	2011-11-11 00:06:02 UTC (rev 99911)
@@ -129,7 +129,7 @@
     closeWindow();
 }
 
-void FindIndicatorWindow::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut)
+void FindIndicatorWindow::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut, bool animate)
 {
     if (m_findIndicator == findIndicator)
         return;
@@ -163,13 +163,15 @@
     [[m_wkView window] addChildWindow:m_findIndicatorWindow.get() ordered:NSWindowAbove];
     [m_findIndicatorWindow.get() setReleasedWhenClosed:NO];
 
-    // Start the bounce animation.
-    m_bounceAnimationContext = WKWindowBounceAnimationContextCreate(m_findIndicatorWindow.get());
-    m_bounceAnimation.adoptNS([[WKFindIndicatorWindowAnimation alloc] _initWithFindIndicatorWindow:this
-                                                                                  animationDuration:bounceAnimationDuration
-                                                                          animationProgressCallback:&FindIndicatorWindow::bounceAnimationCallback
-                                                                            animationDidEndCallback:&FindIndicatorWindow::bounceAnimationDidEnd]);
-    [m_bounceAnimation.get() startAnimation];
+    if (animate) {
+        // Start the bounce animation.
+        m_bounceAnimationContext = WKWindowBounceAnimationContextCreate(m_findIndicatorWindow.get());
+        m_bounceAnimation.adoptNS([[WKFindIndicatorWindowAnimation alloc] _initWithFindIndicatorWindow:this
+                                                                                    animationDuration:bounceAnimationDuration
+                                                                            animationProgressCallback:&FindIndicatorWindow::bounceAnimationCallback
+                                                                              animationDidEndCallback:&FindIndicatorWindow::bounceAnimationDidEnd]);
+        [m_bounceAnimation.get() startAnimation];
+    }
 
     if (fadeOut)
         m_startFadeOutTimer.startOneShot(timeBeforeFadeStarts);

Modified: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h (99910 => 99911)


--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h	2011-11-10 23:59:31 UTC (rev 99910)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h	2011-11-11 00:06:02 UTC (rev 99911)
@@ -88,7 +88,7 @@
     virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*);
     virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*);
 
-    void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut);
+    void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate);
 
     virtual void enterAcceleratedCompositingMode(const LayerTreeContext&);
     virtual void exitAcceleratedCompositingMode();

Modified: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm (99910 => 99911)


--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2011-11-10 23:59:31 UTC (rev 99910)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2011-11-11 00:06:02 UTC (rev 99911)
@@ -313,9 +313,9 @@
     return WebContextMenuProxyMac::create(m_wkView, page);
 }
 
-void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut)
+void PageClientImpl::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut, bool animate)
 {
-    [m_wkView _setFindIndicator:findIndicator fadeOut:fadeOut];
+    [m_wkView _setFindIndicator:findIndicator fadeOut:fadeOut animate:animate];
 }
 
 void PageClientImpl::accessibilityWebProcessTokenReceived(const CoreIPC::DataReference& data)

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (99910 => 99911)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2011-11-10 23:59:31 UTC (rev 99910)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2011-11-11 00:06:02 UTC (rev 99911)
@@ -2337,7 +2337,7 @@
     }
 }
 
-- (void)_setFindIndicator:(PassRefPtr<FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut
+- (void)_setFindIndicator:(PassRefPtr<FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate
 {
     if (!findIndicator) {
         _data->_findIndicatorWindow = nullptr;
@@ -2347,7 +2347,7 @@
     if (!_data->_findIndicatorWindow)
         _data->_findIndicatorWindow = FindIndicatorWindow::create(self);
 
-    _data->_findIndicatorWindow->setFindIndicator(findIndicator, fadeOut);
+    _data->_findIndicatorWindow->setFindIndicator(findIndicator, fadeOut, animate);
 }
 
 - (void)_enterAcceleratedCompositingMode:(const LayerTreeContext&)layerTreeContext

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (99910 => 99911)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h	2011-11-10 23:59:31 UTC (rev 99910)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h	2011-11-11 00:06:02 UTC (rev 99911)
@@ -60,7 +60,7 @@
 - (bool)_executeSavedCommandBySelector:(SEL)selector;
 - (NSRect)_convertToDeviceSpace:(NSRect)rect;
 - (NSRect)_convertToUserSpace:(NSRect)rect;
-- (void)_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut;
+- (void)_setFindIndicator:(PassRefPtr<WebKit::FindIndicator>)findIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate;
 
 - (void)_enterAcceleratedCompositingMode:(const WebKit::LayerTreeContext&)layerTreeContext;
 - (void)_exitAcceleratedCompositingMode;

Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (99910 => 99911)


--- trunk/Source/WebKit2/UIProcess/PageClient.h	2011-11-10 23:59:31 UTC (rev 99910)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h	2011-11-11 00:06:02 UTC (rev 99911)
@@ -151,7 +151,7 @@
     virtual PassRefPtr<WebPopupMenuProxy> createPopupMenuProxy(WebPageProxy*) = 0;
     virtual PassRefPtr<WebContextMenuProxy> createContextMenuProxy(WebPageProxy*) = 0;
 
-    virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut) = 0;
+    virtual void setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut, bool animate) = 0;
 #if PLATFORM(WIN)
     virtual void didInstallOrUninstallPageOverlay(bool) = 0;
 #endif

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (99910 => 99911)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-11-10 23:59:31 UTC (rev 99910)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-11-11 00:06:02 UTC (rev 99911)
@@ -2402,10 +2402,10 @@
     m_findClient.didCountStringMatches(this, string, matchCount);
 }
 
-void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut)
+void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut, bool animate)
 {
     RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageScaleFactor, contentImageHandle);
-    m_pageClient->setFindIndicator(findIndicator.release(), fadeOut);
+    m_pageClient->setFindIndicator(findIndicator.release(), fadeOut, animate);
 }
 
 void WebPageProxy::didFindString(const String& string, uint32_t matchCount)

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (99910 => 99911)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2011-11-10 23:59:31 UTC (rev 99910)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2011-11-11 00:06:02 UTC (rev 99911)
@@ -431,7 +431,7 @@
     void hideFindUI();
     void countStringMatches(const String&, FindOptions, unsigned maxMatchCount);
     void didCountStringMatches(const String&, uint32_t matchCount);
-    void setFindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut);
+    void setFindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut, bool animate);
     void didFindString(const String&, uint32_t matchCount);
     void didFailToFindString(const String&);
 #if PLATFORM(WIN)

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (99910 => 99911)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2011-11-10 23:59:31 UTC (rev 99910)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2011-11-11 00:06:02 UTC (rev 99911)
@@ -165,7 +165,7 @@
 
     # Find messages
     DidCountStringMatches(WTF::String string, uint32_t matchCount)
-    SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, float contentImageScaleFactor, WebKit::ShareableBitmap::Handle contentImageHandle, bool fadeOut)
+    SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, float contentImageScaleFactor, WebKit::ShareableBitmap::Handle contentImageHandle, bool fadeOut, bool animate)
     DidFindString(WTF::String string, uint32_t matchCount)
     DidFailToFindString(WTF::String string)
 #if PLATFORM(WIN)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp (99910 => 99911)


--- trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp	2011-11-10 23:59:31 UTC (rev 99910)
+++ trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp	2011-11-11 00:06:02 UTC (rev 99911)
@@ -159,7 +159,7 @@
     hideFindIndicator();
 }
 
-bool FindController::updateFindIndicator(Frame* selectedFrame, bool isShowingOverlay)
+bool FindController::updateFindIndicator(Frame* selectedFrame, bool isShowingOverlay, bool shouldAnimate)
 {
     if (!selectedFrame)
         return false;
@@ -211,8 +211,8 @@
 
         textRectsInSelectionRectCoordinates.append(textRectInSelectionRectCoordinates);
     }            
-    
-    m_webPage->send(Messages::WebPageProxy::SetFindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, m_webPage->corePage()->deviceScaleFactor(), handle, !isShowingOverlay));
+
+    m_webPage->send(Messages::WebPageProxy::SetFindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, m_webPage->corePage()->deviceScaleFactor(), handle, !isShowingOverlay, shouldAnimate));
     m_isShowingFindIndicator = true;
 
     return true;
@@ -224,7 +224,7 @@
         return;
 
     ShareableBitmap::Handle handle;
-    m_webPage->send(Messages::WebPageProxy::SetFindIndicator(FloatRect(), Vector<FloatRect>(), m_webPage->corePage()->deviceScaleFactor(), handle, false));
+    m_webPage->send(Messages::WebPageProxy::SetFindIndicator(FloatRect(), Vector<FloatRect>(), m_webPage->corePage()->deviceScaleFactor(), handle, false, true));
     m_isShowingFindIndicator = false;
 }
 
@@ -237,6 +237,17 @@
     updateFindIndicator(selectedFrame, false);
 }
 
+void FindController::deviceScaleFactorDidChange()
+{
+    ASSERT(isShowingOverlay());
+
+    Frame* selectedFrame = frameWithSelection(m_webPage->corePage());
+    if (!selectedFrame)
+        return;
+
+    updateFindIndicator(selectedFrame, true, false);
+}
+
 Vector<IntRect> FindController::rectsForTextMatches()
 {
     Vector<IntRect> rects;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/FindController.h (99910 => 99911)


--- trunk/Source/WebKit2/WebProcess/WebPage/FindController.h	2011-11-10 23:59:31 UTC (rev 99910)
+++ trunk/Source/WebKit2/WebProcess/WebPage/FindController.h	2011-11-11 00:06:02 UTC (rev 99911)
@@ -55,6 +55,10 @@
     void hideFindIndicator();
     void showFindIndicatorInSelection();
 
+    bool isShowingOverlay() const { return m_isShowingFindIndicator && m_findPageOverlay; }
+
+    void deviceScaleFactorDidChange();
+
 private:
     // PageOverlay::Client.
     virtual void pageOverlayDestroyed(PageOverlay*);
@@ -64,7 +68,7 @@
     virtual void drawRect(PageOverlay*, WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect);
 
     Vector<WebCore::IntRect> rectsForTextMatches();
-    bool updateFindIndicator(WebCore::Frame* selectedFrame, bool isShowingOverlay);
+    bool updateFindIndicator(WebCore::Frame* selectedFrame, bool isShowingOverlay, bool shouldAnimate = true);
 
 private:
     WebPage* m_webPage;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (99910 => 99911)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-11-10 23:59:31 UTC (rev 99910)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-11-11 00:06:02 UTC (rev 99911)
@@ -874,6 +874,12 @@
     for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it)
         (*it)->setDeviceScaleFactor(scaleFactor);
 #endif
+
+    if (m_findController.isShowingOverlay()) {
+        // We must have updated layout to get the selection rects right.
+        layoutIfNeeded();
+        m_findController.deviceScaleFactorDidChange();
+    }
 }
 
 float WebPage::deviceScaleFactor() const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to