Title: [102344] branches/safari-534.53-branch/Source/WebKit2

Diff

Modified: branches/safari-534.53-branch/Source/WebKit2/ChangeLog (102343 => 102344)


--- branches/safari-534.53-branch/Source/WebKit2/ChangeLog	2011-12-08 16:36:39 UTC (rev 102343)
+++ branches/safari-534.53-branch/Source/WebKit2/ChangeLog	2011-12-08 17:23:00 UTC (rev 102344)
@@ -1,3 +1,59 @@
+2011-12-08  Lucas Forschler  <lforsch...@apple.com>
+
+    Merge 99911
+
+    2011-11-10  Beth Dakin  <bda...@apple.com>
+
+            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-12-07  Lucas Forschler  <lforsch...@apple.com>
 
     Merge 99617

Modified: branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h (102343 => 102344)


--- branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h	2011-12-08 16:36:39 UTC (rev 102343)
+++ branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.h	2011-12-08 17:23:00 UTC (rev 102344)
@@ -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: branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm (102343 => 102344)


--- branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm	2011-12-08 16:36:39 UTC (rev 102343)
+++ branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/FindIndicatorWindow.mm	2011-12-08 17:23:00 UTC (rev 102344)
@@ -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,14 +163,17 @@
     [[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([[WebFindIndicatorWindowAnimation alloc] _initWithFindIndicatorWindow:this
-                                                                                  animationDuration:bounceAnimationDuration
-                                                                          animationProgressCallback:&FindIndicatorWindow::bounceAnimationCallback
-                                                                            animationDidEndCallback:&FindIndicatorWindow::bounceAnimationDidEnd]);
+    if (animate) {
+        // Start the bounce animation.
+        m_bounceAnimationContext = WKWindowBounceAnimationContextCreate(m_findIndicatorWindow.get());
+        m_bounceAnimation.adoptNS([[WebFindIndicatorWindowAnimation alloc] _initWithFindIndicatorWindow:this
+                                                                                    animationDuration:bounceAnimationDuration
+                                                                            animationProgressCallback:&FindIndicatorWindow::bounceAnimationCallback
+                                                                              animationDidEndCallback:&FindIndicatorWindow::bounceAnimationDidEnd]);
+        
     [m_bounceAnimation.get() startAnimation];
-
+    }
+    
     if (fadeOut)
         m_startFadeOutTimer.startOneShot(timeBeforeFadeStarts);
 }

Modified: branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h (102343 => 102344)


--- branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h	2011-12-08 16:36:39 UTC (rev 102343)
+++ branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/PageClientImpl.h	2011-12-08 17:23:00 UTC (rev 102344)
@@ -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: branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm (102343 => 102344)


--- branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2011-12-08 16:36:39 UTC (rev 102343)
+++ branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2011-12-08 17:23:00 UTC (rev 102344)
@@ -319,9 +319,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: branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm (102343 => 102344)


--- branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm	2011-12-08 16:36:39 UTC (rev 102343)
+++ branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm	2011-12-08 17:23:00 UTC (rev 102344)
@@ -2223,7 +2223,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;
@@ -2233,7 +2233,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: branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (102343 => 102344)


--- branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h	2011-12-08 16:36:39 UTC (rev 102343)
+++ branches/safari-534.53-branch/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h	2011-12-08 17:23:00 UTC (rev 102344)
@@ -59,7 +59,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: branches/safari-534.53-branch/Source/WebKit2/UIProcess/PageClient.h (102343 => 102344)


--- branches/safari-534.53-branch/Source/WebKit2/UIProcess/PageClient.h	2011-12-08 16:36:39 UTC (rev 102343)
+++ branches/safari-534.53-branch/Source/WebKit2/UIProcess/PageClient.h	2011-12-08 17:23:00 UTC (rev 102344)
@@ -136,7 +136,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: branches/safari-534.53-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (102343 => 102344)


--- branches/safari-534.53-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-12-08 16:36:39 UTC (rev 102343)
+++ branches/safari-534.53-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-12-08 17:23:00 UTC (rev 102344)
@@ -2306,10 +2306,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: branches/safari-534.53-branch/Source/WebKit2/UIProcess/WebPageProxy.h (102343 => 102344)


--- branches/safari-534.53-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2011-12-08 16:36:39 UTC (rev 102343)
+++ branches/safari-534.53-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2011-12-08 17:23:00 UTC (rev 102344)
@@ -395,7 +395,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: branches/safari-534.53-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in (102343 => 102344)


--- branches/safari-534.53-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2011-12-08 16:36:39 UTC (rev 102343)
+++ branches/safari-534.53-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2011-12-08 17:23:00 UTC (rev 102344)
@@ -162,7 +162,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: branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/FindController.cpp (102343 => 102344)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/FindController.cpp	2011-12-08 16:36:39 UTC (rev 102343)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/FindController.cpp	2011-12-08 17:23:00 UTC (rev 102344)
@@ -158,7 +158,7 @@
     hideFindIndicator();
 }
 
-bool FindController::updateFindIndicator(Frame* selectedFrame, bool isShowingOverlay)
+bool FindController::updateFindIndicator(Frame* selectedFrame, bool isShowingOverlay, bool shouldAnimate)
 {
     if (!selectedFrame)
         return false;
@@ -210,8 +210,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;
@@ -223,10 +223,21 @@
         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;
 }
 
+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: branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/FindController.h (102343 => 102344)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/FindController.h	2011-12-08 16:36:39 UTC (rev 102343)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/FindController.h	2011-12-08 17:23:00 UTC (rev 102344)
@@ -54,6 +54,10 @@
     
     void hideFindIndicator();
 
+    bool isShowingOverlay() const { return m_isShowingFindIndicator && m_findPageOverlay; }
+
+    void deviceScaleFactorDidChange();
+
 private:
     // PageOverlay::Client.
     virtual void pageOverlayDestroyed(PageOverlay*);
@@ -63,7 +67,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: branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (102343 => 102344)


--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-12-08 16:36:39 UTC (rev 102343)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2011-12-08 17:23:00 UTC (rev 102344)
@@ -795,6 +795,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();
+    }
 }
 
 void WebPage::setUseFixedLayout(bool fixed)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to