[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andersca at apple.com andersca at apple.com
Wed Dec 22 14:35:28 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit c4535c5ccb1e93e35203ea8b6e1323521f9d0867
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 13 20:18:09 2010 +0000

    Send over find indicator information to the UI process
    https://bugs.webkit.org/show_bug.cgi?id=47612
    
    Reviewed by Sam Weinig.
    
    WebCore:
    
    Export symbols needed by WebKit2.
    
    * WebCore.exp.in:
    
    WebKit2:
    
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::setFindIndicator):
    Add stub.
    
    * UIProcess/WebPageProxy.messages.in:
    Add SetFindIndicator.
    
    * WebProcess/WebPage/FindController.cpp:
    (WebKit::FindController::FindController):
    Initialize m_isShowingFindIndicator.
    
    (WebKit::FindController::findString):
    Update the find indicator if needed.
    
    (WebKit::FindController::updateFindIndicator):
    Compute find indicator information, paint the find indicator text into a
    backing store and send it over.
    
    (WebKit::FindController::resetFindIndicator):
    Send a SetFindIndicator message with a null backing store.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69689 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4b0ef3c..3fbe2d2 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,14 @@
+2010-10-13  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Send over find indicator information to the UI process
+        https://bugs.webkit.org/show_bug.cgi?id=47612
+
+        Export symbols needed by WebKit2.
+
+        * WebCore.exp.in:
+
 2010-10-13  Gavin Barraclough  <barraclough at apple.com>
 
         Reviewed by Oliver Hunt.
diff --git a/WebCore/WebCore.exp.in b/WebCore/WebCore.exp.in
index 8b15968..29f224a 100644
--- a/WebCore/WebCore.exp.in
+++ b/WebCore/WebCore.exp.in
@@ -351,8 +351,8 @@ __ZN7WebCore15GraphicsContext21setCompositeOperationENS_17CompositeOperatorE
 __ZN7WebCore15GraphicsContext22beginTransparencyLayerEf
 __ZN7WebCore15GraphicsContext4clipERKNS_9FloatRectE
 __ZN7WebCore15GraphicsContext4saveEv
-__ZN7WebCore15GraphicsContext8fillRectERKNS_9FloatRectERKNS_5ColorENS_10ColorSpaceE
 __ZN7WebCore15GraphicsContext7restoreEv
+__ZN7WebCore15GraphicsContext8fillRectERKNS_9FloatRectERKNS_5ColorENS_10ColorSpaceE
 __ZN7WebCore15GraphicsContext9translateEff
 __ZN7WebCore15GraphicsContextC1EP9CGContext
 __ZN7WebCore15GraphicsContextD1Ev
@@ -407,6 +407,7 @@ __ZN7WebCore16colorFromNSColorEP7NSColor
 __ZN7WebCore16createFullMarkupEPKNS_4NodeE
 __ZN7WebCore16createFullMarkupEPKNS_5RangeE
 __ZN7WebCore16enclosingIntRectERK7_NSRect
+__ZN7WebCore16enclosingIntRectERKNS_9FloatRectE
 __ZN7WebCore16isEndOfParagraphERKNS_15VisiblePositionE
 __ZN7WebCore16jsStringSlowCaseEPN3JSC9ExecStateERNS0_9WeakGCMapIPN3WTF10StringImplEPNS0_8JSStringEEES6_
 __ZN7WebCore17CredentialStorage3getERKNS_15ProtectionSpaceE
@@ -549,9 +550,9 @@ __ZN7WebCore46contextMenuItemTagCorrectSpellingAutomaticallyEv
 __ZN7WebCore4Font11setCodePathENS0_8CodePathE
 __ZN7WebCore4Font18shouldUseSmoothingEv
 __ZN7WebCore4Font21setShouldUseSmoothingEb
-__ZN7WebCore4FontaSERKS0_
 __ZN7WebCore4FontC1ERKNS_16FontPlatformDataEbNS_17FontSmoothingModeE
 __ZN7WebCore4FontC1Ev
+__ZN7WebCore4FontaSERKS0_
 __ZN7WebCore4Icon18createIconForFilesERKN3WTF6VectorINS1_6StringELm0EEE
 __ZN7WebCore4IconD1Ev
 __ZN7WebCore4KURL10invalidateEv
@@ -686,6 +687,7 @@ __ZN7WebCore7IntSizeC1ERK7_NSSize
 __ZN7WebCore7cookiesEPKNS_8DocumentERKNS_4KURLE
 __ZN7WebCore7nsColorERKNS_5ColorE
 __ZN7WebCore8Document11createRangeEv
+__ZN7WebCore8Document12updateLayoutEv
 __ZN7WebCore8Document13svgExtensionsEv
 __ZN7WebCore8Document14setFocusedNodeEN3WTF10PassRefPtrINS_4NodeEEE
 __ZN7WebCore8Document16isPageBoxVisibleEi
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 0588217..5f194ad 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -15,6 +15,34 @@
 
         Reviewed by Sam Weinig.
 
+        Send over find indicator information to the UI process
+        https://bugs.webkit.org/show_bug.cgi?id=47612
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::setFindIndicator):
+        Add stub.
+
+        * UIProcess/WebPageProxy.messages.in:
+        Add SetFindIndicator.
+
+        * WebProcess/WebPage/FindController.cpp:
+        (WebKit::FindController::FindController):
+        Initialize m_isShowingFindIndicator.
+
+        (WebKit::FindController::findString):
+        Update the find indicator if needed.
+
+        (WebKit::FindController::updateFindIndicator):
+        Compute find indicator information, paint the find indicator text into a 
+        backing store and send it over.
+
+        (WebKit::FindController::resetFindIndicator):
+        Send a SetFindIndicator message with a null backing store.
+
+2010-10-13  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Sam Weinig.
+
         Add BackingStoreQt.cpp file with stubbed out BackingStore member functions
         https://bugs.webkit.org/show_bug.cgi?id=47614
 
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index f5e2fa9..5819e09 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -956,6 +956,11 @@ void WebPageProxy::didCountStringMatches(const String& string, uint32_t numMatch
     m_findClient.didCountStringMatches(this, string, numMatches);
 }
 
+void WebPageProxy::setFindIndicator(const FloatRect& selectionRect, const Vector<FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle)
+{
+    // FIXME: Implement.
+}
+
 void WebPageProxy::registerEditCommand(PassRefPtr<WebEditCommandProxy> commandProxy, UndoOrRedo undoOrRedo)
 {
     m_pageClient->registerEditCommand(commandProxy, undoOrRedo);
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 51d8671..5a5378f 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -30,6 +30,7 @@
 #include "DrawingAreaProxy.h"
 #include "FindOptions.h"
 #include "GenericCallback.h"
+#include "SharedMemory.h"
 #include "WKBase.h"
 #include "WebEvent.h"
 #include "WebFindClient.h"
@@ -281,6 +282,7 @@ private:
 
     // Find.
     void didCountStringMatches(const String&, uint32_t numMatches);
+    void setFindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle);
 
     void takeFocus(bool direction);
     void setToolTip(const String&);
diff --git a/WebKit2/UIProcess/WebPageProxy.messages.in b/WebKit2/UIProcess/WebPageProxy.messages.in
index b01560a..028fb8a 100644
--- a/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -93,6 +93,7 @@ messages -> WebPageProxy {
 
     # Find.
     DidCountStringMatches(WTF::String string, uint32_t numMatches)
+    SetFindIndicator(WebCore::FloatRect selectionRect, Vector<WebCore::FloatRect> textRects, WebKit::SharedMemory::Handle contentImageHandle)
 
 #if USE(ACCELERATED_COMPOSITING)
     # Accelerated compsiting messages.
diff --git a/WebKit2/WebProcess/WebPage/FindController.cpp b/WebKit2/WebProcess/WebPage/FindController.cpp
index 2c0272c..f230023 100644
--- a/WebKit2/WebProcess/WebPage/FindController.cpp
+++ b/WebKit2/WebProcess/WebPage/FindController.cpp
@@ -25,9 +25,14 @@
 
 #include "FindController.h"
 
+#include "BackingStore.h"
 #include "FindPageOverlay.h"
 #include "WebPage.h"
+#include "WebPageProxyMessages.h"
+#include "WebProcess.h"
 #include <WebCore/Frame.h>
+#include <WebCore/FrameView.h>
+#include <WebCore/GraphicsContext.h>
 #include <WebCore/Page.h>
 
 using namespace WebCore;
@@ -37,6 +42,7 @@ namespace WebKit {
 FindController::FindController(WebPage* webPage)
     : m_webPage(webPage)
     , m_findPageOverlay(0)
+    , m_isShowingFindIndicator(false)
 {
 }
 
@@ -68,6 +74,8 @@ void FindController::findString(const String& string, FindDirection findDirectio
         // And clear the selection.
         if (selectedFrame)
             selectedFrame->selection()->clear();
+
+        resetFindIndicator();
     } else {
         shouldShowOverlay = findOptions & FindOptionsShowOverlay;
 
@@ -78,6 +86,11 @@ void FindController::findString(const String& string, FindDirection findDirectio
             if (numMatches > maxNumMatches)
                 shouldShowOverlay = false;
         }
+
+        if (!(findOptions & FindOptionsShowFindIndicator) || !updateFindIndicator(selectedFrame)) {
+            // Either we shouldn't show the find indicator, or we couldn't update it.
+            resetFindIndicator();
+        }
     }
 
     if (!shouldShowOverlay) {
@@ -111,4 +124,59 @@ void FindController::findPageOverlayDestroyed()
     m_findPageOverlay = 0;
 }
 
+bool FindController::updateFindIndicator(Frame* selectedFrame)
+{
+    if (!selectedFrame)
+        return false;
+
+    IntRect selectionRect = enclosingIntRect(selectedFrame->selection()->bounds());
+    Vector<FloatRect> textRects;
+    selectedFrame->selection()->getClippedVisibleTextRectangles(textRects);
+
+    // Create a backing store and paint the find indicator text into it.
+    RefPtr<BackingStore> findIndicatorTextBackingStore = BackingStore::createSharable(selectionRect.size());
+    OwnPtr<GraphicsContext> graphicsContext = findIndicatorTextBackingStore->createGraphicsContext();
+
+    graphicsContext->translate(-selectionRect.x(), -selectionRect.y());
+    selectedFrame->view()->setPaintBehavior(PaintBehaviorSelectionOnly | PaintBehaviorForceBlackText | PaintBehaviorFlattenCompositingLayers);
+    selectedFrame->document()->updateLayout();
+    
+    graphicsContext->clip(selectionRect);
+    selectedFrame->view()->paint(graphicsContext.get(), selectionRect);
+    selectedFrame->view()->setPaintBehavior(PaintBehaviorNormal);
+    
+    SharedMemory::Handle handle;
+    if (!findIndicatorTextBackingStore->createHandle(handle))
+        return false;
+
+    // We want the selection rect in window coordinates.
+    IntRect selectionRectInWindowCoordinates = selectedFrame->view()->contentsToWindow(selectionRect);
+
+    // We want the text rects in selection rect coordinates.
+    Vector<FloatRect> textRectsInSelectionRectCoordinates;
+    
+    for (size_t i = 0; i < textRects.size(); ++i) {
+        IntRect textRectInSelectionRectCoordinates = selectedFrame->view()->contentsToWindow(enclosingIntRect(textRects[i]));
+        textRectInSelectionRectCoordinates.move(-selectionRectInWindowCoordinates.x(), -selectionRectInWindowCoordinates.y());
+
+        textRectsInSelectionRectCoordinates.append(textRectInSelectionRectCoordinates);
+    }            
+    
+    WebProcess::shared().connection()->send(Messages::WebPageProxy::SetFindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, handle), m_webPage->pageID());
+    m_isShowingFindIndicator = true;
+
+    return true;
+}
+
+void FindController::resetFindIndicator()
+{
+    if (!m_isShowingFindIndicator)
+        return;
+
+    SharedMemory::Handle handle;
+    WebProcess::shared().connection()->send(Messages::WebPageProxy::SetFindIndicator(FloatRect(), Vector<FloatRect>(), handle), m_webPage->pageID());
+    m_isShowingFindIndicator = false;
+}
+
+
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/WebPage/FindController.h b/WebKit2/WebProcess/WebPage/FindController.h
index 1678fc6..620a0c2 100644
--- a/WebKit2/WebProcess/WebPage/FindController.h
+++ b/WebKit2/WebProcess/WebPage/FindController.h
@@ -51,8 +51,15 @@ public:
     void findPageOverlayDestroyed();
 
 private:
+    bool updateFindIndicator(WebCore::Frame* selectedFrame);
+    void resetFindIndicator();
+    
     WebPage* m_webPage;
     FindPageOverlay* m_findPageOverlay;
+
+    // Whether the UI process is showing the find indicator. Note that this can be true even if
+    // the find indicator isn't showing, but it will never be false when it is showing.
+    bool m_isShowingFindIndicator;
 };
 
 } // namespace WebKit

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list