Title: [92016] branches/safari-534.51-branch/Source/WebKit2

Diff

Modified: branches/safari-534.51-branch/Source/WebKit2/ChangeLog (92015 => 92016)


--- branches/safari-534.51-branch/Source/WebKit2/ChangeLog	2011-07-29 21:57:15 UTC (rev 92015)
+++ branches/safari-534.51-branch/Source/WebKit2/ChangeLog	2011-07-29 21:58:43 UTC (rev 92016)
@@ -1,5 +1,43 @@
 2011-07-29  Lucas Forschler  <[email protected]>
 
+    Merged 91085.
+
+    2011-07-15  Anders Carlsson  <[email protected]>
+
+        Find indicator should take scale factor into account
+        https://bugs.webkit.org/show_bug.cgi?id=64611
+        <rdar://problem/9761020>
+
+        Reviewed by Sam Weinig.
+
+        * UIProcess/FindIndicator.cpp:
+        (WebKit::FindIndicator::create):
+        (WebKit::FindIndicator::FindIndicator):
+        Keep track of the scale factor of the find indicator bitmap.
+
+        (WebKit::FindIndicator::draw):
+        Pass the scale factor to ShareableBitmap::draw.
+
+        * UIProcess/FindIndicator.h:
+        Add scale factor member variable.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::setFindIndicator):
+        This now takes the content image scale factor.
+
+        * UIProcess/WebPageProxy.messages.in:
+        Add the scale factor.
+
+        * WebProcess/WebPage/FindController.cpp:
+        (WebKit::FindController::updateFindIndicator):
+        Size the backing store correctly, and apply the scale factor to
+        the graphics context.
+
+        (WebKit::FindController::hideFindIndicator):
+        Pass the scale factor along.
+
+2011-07-29  Lucas Forschler  <[email protected]>
+
     Merged 90293.
 
     2011-07-01  Darin Adler  <[email protected]>

Modified: branches/safari-534.51-branch/Source/WebKit2/UIProcess/FindIndicator.cpp (92015 => 92016)


--- branches/safari-534.51-branch/Source/WebKit2/UIProcess/FindIndicator.cpp	2011-07-29 21:57:15 UTC (rev 92015)
+++ branches/safari-534.51-branch/Source/WebKit2/UIProcess/FindIndicator.cpp	2011-07-29 21:58:43 UTC (rev 92016)
@@ -77,19 +77,20 @@
 
 namespace WebKit {
 
-PassRefPtr<FindIndicator> FindIndicator::create(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, const ShareableBitmap::Handle& contentImageHandle)
+PassRefPtr<FindIndicator> FindIndicator::create(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle)
 {
     RefPtr<ShareableBitmap> contentImage = ShareableBitmap::create(contentImageHandle);
     if (!contentImage)
         return 0;
-    ASSERT(contentImage->size() == enclosingIntRect(selectionRectInWindowCoordinates).size());
+    ASSERT(contentImageScaleFactor != 1 || contentImage->size() == enclosingIntRect(selectionRectInWindowCoordinates).size());
 
-    return adoptRef(new FindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImage.release()));
+    return adoptRef(new FindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageScaleFactor, contentImage.release()));
 }
 
-FindIndicator::FindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, PassRefPtr<ShareableBitmap> contentImage)
+FindIndicator::FindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, PassRefPtr<ShareableBitmap> contentImage)
     : m_selectionRectInWindowCoordinates(selectionRectInWindowCoordinates)
     , m_textRectsInSelectionRectCoordinates(textRectsInSelectionRectCoordinates)
+    , m_contentImageScaleFactor(contentImageScaleFactor)
     , m_contentImage(contentImage)
 {
 }
@@ -171,7 +172,7 @@
         {
             GraphicsContextStateSaver stateSaver(graphicsContext);
             graphicsContext.translate(FloatSize(roundf(leftBorderThickness), roundf(topBorderThickness)));
-            m_contentImage->paint(graphicsContext, IntPoint(0, 0), m_contentImage->bounds());
+            m_contentImage->paint(graphicsContext, m_contentImageScaleFactor, IntPoint(0, 0), m_contentImage->bounds());
         }
     }
 }

Modified: branches/safari-534.51-branch/Source/WebKit2/UIProcess/FindIndicator.h (92015 => 92016)


--- branches/safari-534.51-branch/Source/WebKit2/UIProcess/FindIndicator.h	2011-07-29 21:57:15 UTC (rev 92015)
+++ branches/safari-534.51-branch/Source/WebKit2/UIProcess/FindIndicator.h	2011-07-29 21:58:43 UTC (rev 92016)
@@ -40,7 +40,7 @@
 
 class FindIndicator : public RefCounted<FindIndicator> {
 public:
-    static PassRefPtr<FindIndicator> create(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, const ShareableBitmap::Handle& contentImageHandle);
+    static PassRefPtr<FindIndicator> create(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle);
     ~FindIndicator();
 
     WebCore::FloatRect selectionRectInWindowCoordinates() const { return m_selectionRectInWindowCoordinates; }
@@ -53,10 +53,11 @@
     void draw(WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect);
 
 private:
-    FindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, PassRefPtr<ShareableBitmap> contentImage);
+    FindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, float contentImageScaleFactor, PassRefPtr<ShareableBitmap> contentImage);
 
     WebCore::FloatRect m_selectionRectInWindowCoordinates;
     Vector<WebCore::FloatRect> m_textRectsInSelectionRectCoordinates;
+    float m_contentImageScaleFactor;
     RefPtr<ShareableBitmap> m_contentImage;
 };
 

Modified: branches/safari-534.51-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (92015 => 92016)


--- branches/safari-534.51-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-07-29 21:57:15 UTC (rev 92015)
+++ branches/safari-534.51-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2011-07-29 21:58:43 UTC (rev 92016)
@@ -2257,9 +2257,9 @@
     m_findClient.didCountStringMatches(this, string, matchCount);
 }
 
-void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut)
+void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, float contentImageScaleFactor, const ShareableBitmap::Handle& contentImageHandle, bool fadeOut)
 {
-    RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageHandle);
+    RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageScaleFactor, contentImageHandle);
     m_pageClient->setFindIndicator(findIndicator.release(), fadeOut);
 }
 

Modified: branches/safari-534.51-branch/Source/WebKit2/UIProcess/WebPageProxy.h (92015 => 92016)


--- branches/safari-534.51-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2011-07-29 21:57:15 UTC (rev 92015)
+++ branches/safari-534.51-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2011-07-29 21:58:43 UTC (rev 92016)
@@ -391,7 +391,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, 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);
     void didFindString(const String&, uint32_t matchCount);
     void didFailToFindString(const String&);
 #if PLATFORM(WIN)

Modified: branches/safari-534.51-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in (92015 => 92016)


--- branches/safari-534.51-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2011-07-29 21:57:15 UTC (rev 92015)
+++ branches/safari-534.51-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2011-07-29 21:58:43 UTC (rev 92016)
@@ -160,7 +160,7 @@
 
     # Find messages
     DidCountStringMatches(WTF::String string, uint32_t matchCount)
-    SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, WebKit::ShareableBitmap::Handle contentImageHandle, bool fadeOut)
+    SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, float contentImageScaleFactor, WebKit::ShareableBitmap::Handle contentImageHandle, bool fadeOut)
     DidFindString(WTF::String string, uint32_t matchCount)
     DidFailToFindString(WTF::String string)
 #if PLATFORM(WIN)

Modified: branches/safari-534.51-branch/Source/WebKit2/WebProcess/WebPage/FindController.cpp (92015 => 92016)


--- branches/safari-534.51-branch/Source/WebKit2/WebProcess/WebPage/FindController.cpp	2011-07-29 21:57:15 UTC (rev 92015)
+++ branches/safari-534.51-branch/Source/WebKit2/WebProcess/WebPage/FindController.cpp	2011-07-29 21:58:43 UTC (rev 92016)
@@ -175,12 +175,16 @@
     Vector<FloatRect> textRects;
     selectedFrame->selection()->getClippedVisibleTextRectangles(textRects);
 
+    IntSize backingStoreSize = selectionRect.size();
+    backingStoreSize.scale(m_webPage->userSpaceScaleFactor());
+
     // Create a backing store and paint the find indicator text into it.
-    RefPtr<ShareableBitmap> findIndicatorTextBackingStore = ShareableBitmap::createShareable(selectionRect.size(), ShareableBitmap::SupportsAlpha);
+    RefPtr<ShareableBitmap> findIndicatorTextBackingStore = ShareableBitmap::createShareable(backingStoreSize, ShareableBitmap::SupportsAlpha);
     if (!findIndicatorTextBackingStore)
         return false;
     
     OwnPtr<GraphicsContext> graphicsContext = findIndicatorTextBackingStore->createGraphicsContext();
+    graphicsContext->scale(FloatSize(m_webPage->userSpaceScaleFactor(), m_webPage->userSpaceScaleFactor()));
 
     IntRect paintRect = selectionRect;
     paintRect.move(selectedFrame->view()->frameRect().x(), selectedFrame->view()->frameRect().y());
@@ -207,7 +211,7 @@
         textRectsInSelectionRectCoordinates.append(textRectInSelectionRectCoordinates);
     }            
     
-    m_webPage->send(Messages::WebPageProxy::SetFindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, handle, !isShowingOverlay));
+    m_webPage->send(Messages::WebPageProxy::SetFindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, m_webPage->userSpaceScaleFactor(), handle, !isShowingOverlay));
     m_isShowingFindIndicator = true;
 
     return true;
@@ -219,7 +223,7 @@
         return;
 
     ShareableBitmap::Handle handle;
-    m_webPage->send(Messages::WebPageProxy::SetFindIndicator(FloatRect(), Vector<FloatRect>(), handle, false));
+    m_webPage->send(Messages::WebPageProxy::SetFindIndicator(FloatRect(), Vector<FloatRect>(), m_webPage->userSpaceScaleFactor(), handle, false));
     m_isShowingFindIndicator = false;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to