[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

commit-queue at webkit.org commit-queue at webkit.org
Mon Feb 21 00:18:08 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 07c79cca6673372b8ebb153ef4799c7bef1b6f1d
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Jan 29 08:27:23 2011 +0000

    2011-01-29  Jeff Miller  <jeffm at apple.com>
    
            Reviewed by Anders Carlsson.
    
            Support find bouncy in WebKit2 on Windows
            https://bugs.webkit.org/show_bug.cgi?id=53329
            <rdar://problem/8565843>
            The Mac implements the find bouncy inside of WebKit in the UI process for WebKit2, but we need to do this inside Safari for WebKit2 on Windows.
            Add infrastructure to call back into the app when the find indicator changes.
    
            * UIProcess/API/C/win/WKView.cpp: Cleanup some code style violations.
            (WKViewSetFindIndicatorCallback): Added.
            (WKViewGetFindIndicatorCallback): Added.
            * UIProcess/API/C/win/WKView.h: Cleanup some code style violations.
            * UIProcess/FindIndicator.cpp:
            (WebKit::FindIndicator::create):
            (WebKit::FindIndicator::FindIndicator):
            (WebKit::FindIndicator::frameRect):
            (WebKit::FindIndicator::draw):
            Rename m_selectionRect to m_selectionRectInWindowCoordinates and m_textRects to m_textRectsInSelectionRectCoordinates (along with similarly named local variables) to be more explict about the coordinate system.
            * UIProcess/FindIndicator.h:
            (WebKit::FindIndicator::selectionRectInWindowCoordinates): Added.
            (WebKit::FindIndicator::textRects): Rename m_textRects to m_textRectsInSelectionRectCoordinates.
            * UIProcess/WebPageProxy.cpp:
            (WebKit::WebPageProxy::setFindIndicator): Rename selectionRect to selectionRectInWindowCoordinates and textRects to textRectsInSelectionRectCoordinates to be more explict about the coordinate system.
            * UIProcess/WebPageProxy.h: Ditto.
            * UIProcess/win/WebView.cpp:
            (WebKit::WebView::WebView):
            (WebKit::WebView::setFindIndicator): Added.
            (WebKit::WebView::setFindIndicatorCallback): Added.
            (WebKit::WebView::getFindIndicatorCallback): Added.
            * UIProcess/win/WebView.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77054 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index 2bdf2b0..f82faf1 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,36 @@
+2011-01-29  Jeff Miller  <jeffm at apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        Support find bouncy in WebKit2 on Windows
+        https://bugs.webkit.org/show_bug.cgi?id=53329
+        <rdar://problem/8565843>
+        The Mac implements the find bouncy inside of WebKit in the UI process for WebKit2, but we need to do this inside Safari for WebKit2 on Windows.
+        Add infrastructure to call back into the app when the find indicator changes.
+
+        * UIProcess/API/C/win/WKView.cpp: Cleanup some code style violations.
+        (WKViewSetFindIndicatorCallback): Added.
+        (WKViewGetFindIndicatorCallback): Added.
+        * UIProcess/API/C/win/WKView.h: Cleanup some code style violations.
+        * UIProcess/FindIndicator.cpp:
+        (WebKit::FindIndicator::create):
+        (WebKit::FindIndicator::FindIndicator):
+        (WebKit::FindIndicator::frameRect):
+        (WebKit::FindIndicator::draw):
+        Rename m_selectionRect to m_selectionRectInWindowCoordinates and m_textRects to m_textRectsInSelectionRectCoordinates (along with similarly named local variables) to be more explict about the coordinate system.
+        * UIProcess/FindIndicator.h:
+        (WebKit::FindIndicator::selectionRectInWindowCoordinates): Added.
+        (WebKit::FindIndicator::textRects): Rename m_textRects to m_textRectsInSelectionRectCoordinates.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::setFindIndicator): Rename selectionRect to selectionRectInWindowCoordinates and textRects to textRectsInSelectionRectCoordinates to be more explict about the coordinate system.
+        * UIProcess/WebPageProxy.h: Ditto.
+        * UIProcess/win/WebView.cpp:
+        (WebKit::WebView::WebView):
+        (WebKit::WebView::setFindIndicator): Added.
+        (WebKit::WebView::setFindIndicatorCallback): Added.
+        (WebKit::WebView::getFindIndicatorCallback): Added.
+        * UIProcess/win/WebView.h:
+
 2011-01-28  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/Source/WebKit2/UIProcess/API/C/win/WKView.cpp b/Source/WebKit2/UIProcess/API/C/win/WKView.cpp
index 6d4772e..62603fe 100644
--- a/Source/WebKit2/UIProcess/API/C/win/WKView.cpp
+++ b/Source/WebKit2/UIProcess/API/C/win/WKView.cpp
@@ -71,3 +71,13 @@ void WKViewSetInitialFocus(WKViewRef viewRef, bool forward)
 {
     toImpl(viewRef)->setInitialFocus(forward);
 }
+
+void WKViewSetFindIndicatorCallback(WKViewRef viewRef, WKViewFindIndicatorCallback callback, void* context)
+{
+    toImpl(viewRef)->setFindIndicatorCallback(callback, context);
+}
+
+WKViewFindIndicatorCallback WKViewGetFindIndicatorCallback(WKViewRef viewRef, void** context)
+{    
+    return toImpl(viewRef)->getFindIndicatorCallback(context);
+}
diff --git a/Source/WebKit2/UIProcess/API/C/win/WKView.h b/Source/WebKit2/UIProcess/API/C/win/WKView.h
index f4226cd..213897e 100644
--- a/Source/WebKit2/UIProcess/API/C/win/WKView.h
+++ b/Source/WebKit2/UIProcess/API/C/win/WKView.h
@@ -46,6 +46,10 @@ WK_EXPORT void WKViewWindowAncestryDidChange(WKViewRef view);
 WK_EXPORT void WKViewSetIsInWindow(WKViewRef view, bool isInWindow);
 WK_EXPORT void WKViewSetInitialFocus(WKViewRef view, bool forward);
 
+typedef void (*WKViewFindIndicatorCallback)(WKViewRef, HBITMAP selectionBitmap, RECT selectionRectInWindowCoordinates, bool fadeout, void*);
+WK_EXPORT void WKViewSetFindIndicatorCallback(WKViewRef view, WKViewFindIndicatorCallback callback, void* context);
+WK_EXPORT WKViewFindIndicatorCallback WKViewGetFindIndicatorCallback(WKViewRef view, void** context);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/Source/WebKit2/UIProcess/FindIndicator.cpp b/Source/WebKit2/UIProcess/FindIndicator.cpp
index f7a9527..e7053f6 100644
--- a/Source/WebKit2/UIProcess/FindIndicator.cpp
+++ b/Source/WebKit2/UIProcess/FindIndicator.cpp
@@ -77,18 +77,18 @@ static const int gradientLightAlpha = 255;
 
 namespace WebKit {
 
-PassRefPtr<FindIndicator> FindIndicator::create(const FloatRect& selectionRect, const Vector<FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle)
+PassRefPtr<FindIndicator> FindIndicator::create(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle)
 {
-    RefPtr<ShareableBitmap> contentImage = ShareableBitmap::create(enclosingIntRect(selectionRect).size(), contentImageHandle);
+    RefPtr<ShareableBitmap> contentImage = ShareableBitmap::create(enclosingIntRect(selectionRectInWindowCoordinates).size(), contentImageHandle);
     if (!contentImage)
         return 0;
 
-    return adoptRef(new FindIndicator(selectionRect, textRects, contentImage.release()));
+    return adoptRef(new FindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImage.release()));
 }
 
-FindIndicator::FindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, PassRefPtr<ShareableBitmap> contentImage)
-    : m_selectionRect(selectionRect)
-    , m_textRects(textRects)
+FindIndicator::FindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, PassRefPtr<ShareableBitmap> contentImage)
+    : m_selectionRectInWindowCoordinates(selectionRectInWindowCoordinates)
+    , m_textRectsInSelectionRectCoordinates(textRectsInSelectionRectCoordinates)
     , m_contentImage(contentImage)
 {
 }
@@ -108,9 +108,9 @@ static FloatRect inflateRect(const FloatRect& rect, float inflateX, float inflat
 
 FloatRect FindIndicator::frameRect() const
 {
-    return FloatRect(m_selectionRect.x() - leftBorderThickness, m_selectionRect.y() - topBorderThickness,
-                     m_selectionRect.width() + rightBorderThickness + leftBorderThickness,
-                     m_selectionRect.height() + topBorderThickness + bottomBorderThickness);
+    return FloatRect(m_selectionRectInWindowCoordinates.x() - leftBorderThickness, m_selectionRectInWindowCoordinates.y() - topBorderThickness,
+                     m_selectionRectInWindowCoordinates.width() + rightBorderThickness + leftBorderThickness,
+                     m_selectionRectInWindowCoordinates.height() + topBorderThickness + bottomBorderThickness);
 }
 
 static Color lightBorderColor()
@@ -143,8 +143,8 @@ static Path pathWithRoundedRect(const FloatRect& pathRect, float radius)
     
 void FindIndicator::draw(GraphicsContext& graphicsContext, const IntRect& dirtyRect)
 {
-    for (size_t i = 0; i < m_textRects.size(); ++i) {
-        FloatRect textRect = m_textRects[i];
+    for (size_t i = 0; i < m_textRectsInSelectionRectCoordinates.size(); ++i) {
+        FloatRect textRect = m_textRectsInSelectionRectCoordinates[i];
         textRect.move(leftBorderThickness, topBorderThickness);
 
         graphicsContext.save();
diff --git a/Source/WebKit2/UIProcess/FindIndicator.h b/Source/WebKit2/UIProcess/FindIndicator.h
index 997d537..69088ce 100644
--- a/Source/WebKit2/UIProcess/FindIndicator.h
+++ b/Source/WebKit2/UIProcess/FindIndicator.h
@@ -42,12 +42,13 @@ class ShareableBitmap;
 
 class FindIndicator : public RefCounted<FindIndicator> {
 public:
-    static PassRefPtr<FindIndicator> create(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle);
+    static PassRefPtr<FindIndicator> create(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle);
     ~FindIndicator();
 
+    WebCore::FloatRect selectionRectInWindowCoordinates() const { return m_selectionRectInWindowCoordinates; }
     WebCore::FloatRect frameRect() const;
 
-    const Vector<WebCore::FloatRect>& textRects() const { return m_textRects; }
+    const Vector<WebCore::FloatRect>& textRects() const { return m_textRectsInSelectionRectCoordinates; }
 
     ShareableBitmap* contentImage() const { return m_contentImage.get(); }
 
@@ -56,8 +57,8 @@ public:
 private:
     FindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, PassRefPtr<ShareableBitmap> contentImage);
 
-    WebCore::FloatRect m_selectionRect;
-    Vector<WebCore::FloatRect> m_textRects;
+    WebCore::FloatRect m_selectionRectInWindowCoordinates;
+    Vector<WebCore::FloatRect> m_textRectsInSelectionRectCoordinates;
     RefPtr<ShareableBitmap> m_contentImage;
 };
 
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp
index 0ca1cbd..faf17c7 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp
@@ -1840,9 +1840,9 @@ void WebPageProxy::didCountStringMatches(const String& string, uint32_t matchCou
     m_findClient.didCountStringMatches(this, string, matchCount);
 }
 
-void WebPageProxy::setFindIndicator(const FloatRect& selectionRect, const Vector<FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle, bool fadeOut)
+void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle, bool fadeOut)
 {
-    RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRect, textRects, contentImageHandle);
+    RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageHandle);
     m_pageClient->setFindIndicator(findIndicator.release(), fadeOut);
 }
 
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h
index 197f31c..a98ea06 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.h
+++ b/Source/WebKit2/UIProcess/WebPageProxy.h
@@ -488,7 +488,7 @@ private:
     
     // Find.
     void didCountStringMatches(const String&, uint32_t matchCount);
-    void setFindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle, bool fadeOut);
+    void setFindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle, bool fadeOut);
     void didFindString(const String&, uint32_t matchCount);
     void didFailToFindString(const String&);
 
diff --git a/Source/WebKit2/UIProcess/win/WebView.cpp b/Source/WebKit2/UIProcess/win/WebView.cpp
index 476a537..ff8d219 100644
--- a/Source/WebKit2/UIProcess/win/WebView.cpp
+++ b/Source/WebKit2/UIProcess/win/WebView.cpp
@@ -30,8 +30,9 @@
 #include "FindIndicator.h"
 #include "LayerBackedDrawingAreaProxy.h"
 #include "Logging.h"
-#include "RunLoop.h"
 #include "NativeWebKeyboardEvent.h"
+#include "RunLoop.h"
+#include "WKAPICast.h"
 #include "WebContext.h"
 #include "WebContextMenuProxyWin.h"
 #include "WebEditCommandProxy.h"
@@ -39,8 +40,10 @@
 #include "WebPageProxy.h"
 #include "WebPopupMenuProxyWin.h"
 #include <Commctrl.h>
+#include <WebCore/BitmapInfo.h>
 #include <WebCore/Cursor.h>
 #include <WebCore/FloatRect.h>
+#include <WebCore/GraphicsContextCG.h>
 #include <WebCore/IntRect.h>
 #include <WebCore/SoftLinking.h>
 #include <WebCore/WebCoreInstanceHandle.h>
@@ -48,17 +51,17 @@
 #include <wtf/text/WTFString.h>
 
 namespace Ime {
-    // We need these functions in a separate namespace, because in the global namespace they conflict
-    // with the definitions in imm.h only by the type modifier (the macro defines them as static) and
-    // imm.h is included by windows.h
-    SOFT_LINK_LIBRARY(IMM32)
-    SOFT_LINK(IMM32, ImmGetContext, HIMC, WINAPI, (HWND hwnd), (hwnd))
-    SOFT_LINK(IMM32, ImmReleaseContext, BOOL, WINAPI, (HWND hWnd, HIMC hIMC), (hWnd, hIMC))
-    SOFT_LINK(IMM32, ImmGetCompositionStringW, LONG, WINAPI, (HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen), (hIMC, dwIndex, lpBuf, dwBufLen))
-    SOFT_LINK(IMM32, ImmSetCandidateWindow, BOOL, WINAPI, (HIMC hIMC, LPCANDIDATEFORM lpCandidate), (hIMC, lpCandidate))
-    SOFT_LINK(IMM32, ImmSetOpenStatus, BOOL, WINAPI, (HIMC hIMC, BOOL fOpen), (hIMC, fOpen))
-    SOFT_LINK(IMM32, ImmNotifyIME, BOOL, WINAPI, (HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue), (hIMC, dwAction, dwIndex, dwValue))
-    SOFT_LINK(IMM32, ImmAssociateContextEx, BOOL, WINAPI, (HWND hWnd, HIMC hIMC, DWORD dwFlags), (hWnd, hIMC, dwFlags))
+// We need these functions in a separate namespace, because in the global namespace they conflict
+// with the definitions in imm.h only by the type modifier (the macro defines them as static) and
+// imm.h is included by windows.h
+SOFT_LINK_LIBRARY(IMM32)
+SOFT_LINK(IMM32, ImmGetContext, HIMC, WINAPI, (HWND hwnd), (hwnd))
+SOFT_LINK(IMM32, ImmReleaseContext, BOOL, WINAPI, (HWND hWnd, HIMC hIMC), (hWnd, hIMC))
+SOFT_LINK(IMM32, ImmGetCompositionStringW, LONG, WINAPI, (HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen), (hIMC, dwIndex, lpBuf, dwBufLen))
+SOFT_LINK(IMM32, ImmSetCandidateWindow, BOOL, WINAPI, (HIMC hIMC, LPCANDIDATEFORM lpCandidate), (hIMC, lpCandidate))
+SOFT_LINK(IMM32, ImmSetOpenStatus, BOOL, WINAPI, (HIMC hIMC, BOOL fOpen), (hIMC, fOpen))
+SOFT_LINK(IMM32, ImmNotifyIME, BOOL, WINAPI, (HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue), (hIMC, dwAction, dwIndex, dwValue))
+SOFT_LINK(IMM32, ImmAssociateContextEx, BOOL, WINAPI, (HWND hWnd, HIMC hIMC, DWORD dwFlags), (hWnd, hIMC, dwFlags))
 };
 
 using namespace WebCore;
@@ -101,93 +104,93 @@ LRESULT WebView::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
     bool handled = true;
 
     switch (message) {
-        case WM_CLOSE:
-            m_page->tryClose();
-            break;
-        case WM_DESTROY:
-            m_isBeingDestroyed = true;
-            close();
-            break;
-        case WM_ERASEBKGND:
-            lResult = 1;
-            break;
-        case WM_PAINT:
-            lResult = onPaintEvent(hWnd, message, wParam, lParam, handled);
-            break;
-        case WM_PRINTCLIENT:
-            lResult = onPrintClientEvent(hWnd, message, wParam, lParam, handled);
-            break;
-        case WM_MOUSEACTIVATE:
-            setWasActivatedByMouseEvent(true);
-            handled = false;
-            break;
-        case WM_MOUSEMOVE:
-        case WM_LBUTTONDOWN:
-        case WM_MBUTTONDOWN:
-        case WM_RBUTTONDOWN:
-        case WM_LBUTTONDBLCLK:
-        case WM_MBUTTONDBLCLK:
-        case WM_RBUTTONDBLCLK:
-        case WM_LBUTTONUP:
-        case WM_MBUTTONUP:
-        case WM_RBUTTONUP:
-        case WM_MOUSELEAVE:
-            lResult = onMouseEvent(hWnd, message, wParam, lParam, handled);
-            break;
-        case WM_MOUSEWHEEL:
-        case WM_VISTA_MOUSEHWHEEL:
-            lResult = onWheelEvent(hWnd, message, wParam, lParam, handled);
-            break;
-        case WM_SYSKEYDOWN:
-        case WM_KEYDOWN:
-        case WM_SYSCHAR:
-        case WM_CHAR:
-        case WM_SYSKEYUP:
-        case WM_KEYUP:
-            lResult = onKeyEvent(hWnd, message, wParam, lParam, handled);
-            break;
-        case WM_SIZE:
-            lResult = onSizeEvent(hWnd, message, wParam, lParam, handled);
-            break;
-        case WM_WINDOWPOSCHANGED:
-            lResult = onWindowPositionChangedEvent(hWnd, message, wParam, lParam, handled);
-            break;
-        case WM_SETFOCUS:
-            lResult = onSetFocusEvent(hWnd, message, wParam, lParam, handled);
-            break;
-        case WM_KILLFOCUS:
-            lResult = onKillFocusEvent(hWnd, message, wParam, lParam, handled);
-            break;
-        case WM_TIMER:
-            lResult = onTimerEvent(hWnd, message, wParam, lParam, handled);
-            break;
-        case WM_SHOWWINDOW:
-            lResult = onShowWindowEvent(hWnd, message, wParam, lParam, handled);
-            break;
-        case WM_SETCURSOR:
-            lResult = onSetCursor(hWnd, message, wParam, lParam, handled);
-            break;
-        case WM_IME_STARTCOMPOSITION:
-            handled = onIMEStartComposition();
-            break;
-        case WM_IME_REQUEST:
-            lResult = onIMERequest(wParam, lParam);
-            break;
-        case WM_IME_COMPOSITION:
-            handled = onIMEComposition(lParam);
-            break;
-        case WM_IME_ENDCOMPOSITION:
-            handled = onIMEEndComposition();
-            break;
-        case WM_IME_SELECT:
-            handled = onIMESelect(wParam, lParam);
-            break;
-        case WM_IME_SETCONTEXT:
-            handled = onIMESetContext(wParam, lParam);
-            break;
-        default:
-            handled = false;
-            break;
+    case WM_CLOSE:
+        m_page->tryClose();
+        break;
+    case WM_DESTROY:
+        m_isBeingDestroyed = true;
+        close();
+        break;
+    case WM_ERASEBKGND:
+        lResult = 1;
+        break;
+    case WM_PAINT:
+        lResult = onPaintEvent(hWnd, message, wParam, lParam, handled);
+        break;
+    case WM_PRINTCLIENT:
+        lResult = onPrintClientEvent(hWnd, message, wParam, lParam, handled);
+        break;
+    case WM_MOUSEACTIVATE:
+        setWasActivatedByMouseEvent(true);
+        handled = false;
+        break;
+    case WM_MOUSEMOVE:
+    case WM_LBUTTONDOWN:
+    case WM_MBUTTONDOWN:
+    case WM_RBUTTONDOWN:
+    case WM_LBUTTONDBLCLK:
+    case WM_MBUTTONDBLCLK:
+    case WM_RBUTTONDBLCLK:
+    case WM_LBUTTONUP:
+    case WM_MBUTTONUP:
+    case WM_RBUTTONUP:
+    case WM_MOUSELEAVE:
+        lResult = onMouseEvent(hWnd, message, wParam, lParam, handled);
+        break;
+    case WM_MOUSEWHEEL:
+    case WM_VISTA_MOUSEHWHEEL:
+        lResult = onWheelEvent(hWnd, message, wParam, lParam, handled);
+        break;
+    case WM_SYSKEYDOWN:
+    case WM_KEYDOWN:
+    case WM_SYSCHAR:
+    case WM_CHAR:
+    case WM_SYSKEYUP:
+    case WM_KEYUP:
+        lResult = onKeyEvent(hWnd, message, wParam, lParam, handled);
+        break;
+    case WM_SIZE:
+        lResult = onSizeEvent(hWnd, message, wParam, lParam, handled);
+        break;
+    case WM_WINDOWPOSCHANGED:
+        lResult = onWindowPositionChangedEvent(hWnd, message, wParam, lParam, handled);
+        break;
+    case WM_SETFOCUS:
+        lResult = onSetFocusEvent(hWnd, message, wParam, lParam, handled);
+        break;
+    case WM_KILLFOCUS:
+        lResult = onKillFocusEvent(hWnd, message, wParam, lParam, handled);
+        break;
+    case WM_TIMER:
+        lResult = onTimerEvent(hWnd, message, wParam, lParam, handled);
+        break;
+    case WM_SHOWWINDOW:
+        lResult = onShowWindowEvent(hWnd, message, wParam, lParam, handled);
+        break;
+    case WM_SETCURSOR:
+        lResult = onSetCursor(hWnd, message, wParam, lParam, handled);
+        break;
+    case WM_IME_STARTCOMPOSITION:
+        handled = onIMEStartComposition();
+        break;
+    case WM_IME_REQUEST:
+        lResult = onIMERequest(wParam, lParam);
+        break;
+    case WM_IME_COMPOSITION:
+        handled = onIMEComposition(lParam);
+        break;
+    case WM_IME_ENDCOMPOSITION:
+        handled = onIMEEndComposition();
+        break;
+    case WM_IME_SELECT:
+        handled = onIMESelect(wParam, lParam);
+        break;
+    case WM_IME_SETCONTEXT:
+        handled = onIMESetContext(wParam, lParam);
+        break;
+    default:
+        handled = false;
+        break;
     }
 
     if (!handled)
@@ -233,6 +236,8 @@ WebView::WebView(RECT rect, WebContext* context, WebPageGroup* pageGroup, HWND p
     , m_wasActivatedByMouseEvent(false)
     , m_isBeingDestroyed(false)
     , m_inIMEComposition(0)
+    , m_findIndicatorCallback(0)
+    , m_findIndicatorCallbackContext(0)
 {
     registerWebViewWindowClass();
 
@@ -333,29 +338,29 @@ LRESULT WebView::onMouseEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
     setWasActivatedByMouseEvent(false);
     
     switch (message) {
-        case WM_LBUTTONDOWN:
-        case WM_MBUTTONDOWN:
-        case WM_RBUTTONDOWN:
-            ::SetFocus(m_window);
-            ::SetCapture(m_window);
-            break; 
-        case WM_LBUTTONUP:
-        case WM_MBUTTONUP:
-        case WM_RBUTTONUP:
-            ::ReleaseCapture();
-            break;
-        case WM_MOUSEMOVE:
-            startTrackingMouseLeave();
-            break;
-        case WM_MOUSELEAVE:
-            stopTrackingMouseLeave();
-            break;
-        case WM_LBUTTONDBLCLK:
-        case WM_MBUTTONDBLCLK:
-        case WM_RBUTTONDBLCLK:
-            break;
-        default:
-            ASSERT_NOT_REACHED();
+    case WM_LBUTTONDOWN:
+    case WM_MBUTTONDOWN:
+    case WM_RBUTTONDOWN:
+        ::SetFocus(m_window);
+        ::SetCapture(m_window);
+        break; 
+    case WM_LBUTTONUP:
+    case WM_MBUTTONUP:
+    case WM_RBUTTONUP:
+        ::ReleaseCapture();
+        break;
+    case WM_MOUSEMOVE:
+        startTrackingMouseLeave();
+        break;
+    case WM_MOUSELEAVE:
+        stopTrackingMouseLeave();
+        break;
+    case WM_LBUTTONDBLCLK:
+    case WM_MBUTTONDBLCLK:
+    case WM_RBUTTONDBLCLK:
+        break;
+    default:
+        ASSERT_NOT_REACHED();
     }
 
     m_page->handleMouseEvent(mouseEvent);
@@ -461,10 +466,10 @@ LRESULT WebView::onKillFocusEvent(HWND, UINT, WPARAM, LPARAM lParam, bool& handl
 LRESULT WebView::onTimerEvent(HWND hWnd, UINT, WPARAM wParam, LPARAM, bool& handled)
 {
     switch (wParam) {
-        case UpdateActiveStateTimer:
-            ::KillTimer(hWnd, UpdateActiveStateTimer);
-            updateActiveState();
-            break;
+    case UpdateActiveStateTimer:
+        ::KillTimer(hWnd, UpdateActiveStateTimer);
+        updateActiveState();
+        break;
     }
 
     handled = true;
@@ -975,11 +980,11 @@ LRESULT WebView::onIMERequest(WPARAM request, LPARAM data)
         return 0;
 
     switch (request) {
-        case IMR_RECONVERTSTRING:
-            return onIMERequestReconvertString(reinterpret_cast<RECONVERTSTRING*>(data));
+    case IMR_RECONVERTSTRING:
+        return onIMERequestReconvertString(reinterpret_cast<RECONVERTSTRING*>(data));
 
-        case IMR_QUERYCHARPOSITION:
-            return onIMERequestCharPosition(reinterpret_cast<IMECHARPOSITION*>(data));
+    case IMR_QUERYCHARPOSITION:
+        return onIMERequestCharPosition(reinterpret_cast<IMECHARPOSITION*>(data));
     }
     return 0;
 }
@@ -1015,9 +1020,52 @@ PassRefPtr<WebContextMenuProxy> WebView::createContextMenuProxy(WebPageProxy* pa
     return WebContextMenuProxyWin::create(m_window, page);
 }
 
-void WebView::setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut)
+void WebView::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut)
+{
+    if (!m_findIndicatorCallback)
+        return;
+    
+    HBITMAP hbmp = 0;
+    ShareableBitmap* contentImage = findIndicator->contentImage();
+    
+    if (contentImage) {
+        // Render the contentImage to an HBITMAP.
+        void* bits;
+        HDC hdc = ::CreateCompatibleDC(0);
+        int width = contentImage->bounds().width();
+        int height = contentImage->bounds().height();
+        BitmapInfo bitmapInfo = BitmapInfo::create(contentImage->size());
+
+        hbmp = CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, static_cast<void**>(&bits), 0, 0);
+        HBITMAP hbmpOld = static_cast<HBITMAP>(SelectObject(hdc, hbmp));
+        RetainPtr<CGContextRef> context(AdoptCF, CGBitmapContextCreate(bits, width, height,
+            8, width * sizeof(RGBQUAD), deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
+
+        GraphicsContext graphicsContext(context.get());
+        contentImage->paint(graphicsContext, IntPoint(), contentImage->bounds());
+
+        ::SelectObject(hdc, hbmpOld);
+        ::DeleteDC(hdc);
+    }
+
+    IntRect selectionRect(findIndicator->selectionRectInWindowCoordinates());
+    
+    // The callback is responsible for calling ::DeleteObject(hbmp).
+    (*m_findIndicatorCallback)(toAPI(this), hbmp, selectionRect, fadeOut, m_findIndicatorCallbackContext);
+}
+
+void WebView::setFindIndicatorCallback(WKViewFindIndicatorCallback callback, void* context)
 {
-    // FIXME: Implement.
+    m_findIndicatorCallback = callback;
+    m_findIndicatorCallbackContext = context;
+}
+
+WKViewFindIndicatorCallback WebView::getFindIndicatorCallback(void** context)
+{
+    if (context)
+        *context = m_findIndicatorCallbackContext;
+    
+    return m_findIndicatorCallback;
 }
 
 void WebView::didCommitLoadForMainFrame(bool useCustomRepresentation)
@@ -1063,14 +1111,14 @@ void WebView::switchToDrawingAreaTypeIfNecessary(DrawingAreaInfo::Type type)
 
     OwnPtr<DrawingAreaProxy> newDrawingArea;
     switch (type) {
-        case DrawingAreaInfo::None:
-            break;
-        case DrawingAreaInfo::ChunkedUpdate:
-            newDrawingArea = ChunkedUpdateDrawingAreaProxy::create(this, m_page.get());
-            break;
-        case DrawingAreaInfo::LayerBacked:
-            newDrawingArea = LayerBackedDrawingAreaProxy::create(this, m_page.get());
-            break;
+    case DrawingAreaInfo::None:
+        break;
+    case DrawingAreaInfo::ChunkedUpdate:
+        newDrawingArea = ChunkedUpdateDrawingAreaProxy::create(this, m_page.get());
+        break;
+    case DrawingAreaInfo::LayerBacked:
+        newDrawingArea = LayerBackedDrawingAreaProxy::create(this, m_page.get());
+        break;
     }
 
     if (m_page->drawingArea())
@@ -1092,12 +1140,12 @@ HWND WebView::nativeWindow()
 void WebView::windowReceivedMessage(HWND, UINT message, WPARAM wParam, LPARAM)
 {
     switch (message) {
-        case WM_NCACTIVATE:
-            updateActiveStateSoon();
-            break;
-        case WM_SETTINGCHANGE:
-            // systemParameterChanged(wParam);
-            break;
+    case WM_NCACTIVATE:
+        updateActiveStateSoon();
+        break;
+    case WM_SETTINGCHANGE:
+        // systemParameterChanged(wParam);
+        break;
     }
 }
 
diff --git a/Source/WebKit2/UIProcess/win/WebView.h b/Source/WebKit2/UIProcess/win/WebView.h
index c04a0c6..70e6e7c 100644
--- a/Source/WebKit2/UIProcess/win/WebView.h
+++ b/Source/WebKit2/UIProcess/win/WebView.h
@@ -28,7 +28,9 @@
 
 #include "APIObject.h"
 #include "PageClient.h"
+#include "WKView.h"
 #include "WebPageProxy.h"
+#include <ShlObj.h>
 #include <WebCore/COMPtr.h>
 #include <WebCore/DragActions.h>
 #include <WebCore/DragData.h>
@@ -36,7 +38,6 @@
 #include <wtf/Forward.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
-#include <ShlObj.h>
 
 interface IDropTargetHelper;
 
@@ -58,8 +59,10 @@ public:
     void setParentWindow(HWND);
     void windowAncestryDidChange();
     void setIsInWindow(bool);
-    void setOverrideCursor(HCURSOR overrideCursor);
+    void setOverrideCursor(HCURSOR);
     void setInitialFocus(bool forward);
+    void setFindIndicatorCallback(WKViewFindIndicatorCallback, void*);
+    WKViewFindIndicatorCallback getFindIndicatorCallback(void**);
     void initialize();
 
     // IUnknown
@@ -186,6 +189,10 @@ private:
     RefPtr<WebPageProxy> m_page;
 
     unsigned m_inIMEComposition;
+
+    WKViewFindIndicatorCallback m_findIndicatorCallback;
+    void* m_findIndicatorCallbackContext;
+
     COMPtr<IDataObject> m_dragData;
     COMPtr<IDropTargetHelper> m_dropTargetHelper;
     // FIXME: This variable is part of a workaround. The drop effect (pdwEffect) passed to Drop is incorrect. 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list