Changeset 77054 in webkit


Ignore:
Timestamp:
Jan 29, 2011 12:27:23 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-01-29 Jeff Miller <jeffm@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:
Location:
trunk/Source/WebKit2
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r77051 r77054  
     12011-01-29  Jeff Miller  <jeffm@apple.com>
     2
     3        Reviewed by Anders Carlsson.
     4
     5        Support find bouncy in WebKit2 on Windows
     6        https://bugs.webkit.org/show_bug.cgi?id=53329
     7        <rdar://problem/8565843>
     8        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.
     9        Add infrastructure to call back into the app when the find indicator changes.
     10
     11        * UIProcess/API/C/win/WKView.cpp: Cleanup some code style violations.
     12        (WKViewSetFindIndicatorCallback): Added.
     13        (WKViewGetFindIndicatorCallback): Added.
     14        * UIProcess/API/C/win/WKView.h: Cleanup some code style violations.
     15        * UIProcess/FindIndicator.cpp:
     16        (WebKit::FindIndicator::create):
     17        (WebKit::FindIndicator::FindIndicator):
     18        (WebKit::FindIndicator::frameRect):
     19        (WebKit::FindIndicator::draw):
     20        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.
     21        * UIProcess/FindIndicator.h:
     22        (WebKit::FindIndicator::selectionRectInWindowCoordinates): Added.
     23        (WebKit::FindIndicator::textRects): Rename m_textRects to m_textRectsInSelectionRectCoordinates.
     24        * UIProcess/WebPageProxy.cpp:
     25        (WebKit::WebPageProxy::setFindIndicator): Rename selectionRect to selectionRectInWindowCoordinates and textRects to textRectsInSelectionRectCoordinates to be more explict about the coordinate system.
     26        * UIProcess/WebPageProxy.h: Ditto.
     27        * UIProcess/win/WebView.cpp:
     28        (WebKit::WebView::WebView):
     29        (WebKit::WebView::setFindIndicator): Added.
     30        (WebKit::WebView::setFindIndicatorCallback): Added.
     31        (WebKit::WebView::getFindIndicatorCallback): Added.
     32        * UIProcess/win/WebView.h:
     33
    1342011-01-28  Alexey Proskuryakov  <ap@apple.com>
    235
  • trunk/Source/WebKit2/UIProcess/API/C/win/WKView.cpp

    r76916 r77054  
    7272    toImpl(viewRef)->setInitialFocus(forward);
    7373}
     74
     75void WKViewSetFindIndicatorCallback(WKViewRef viewRef, WKViewFindIndicatorCallback callback, void* context)
     76{
     77    toImpl(viewRef)->setFindIndicatorCallback(callback, context);
     78}
     79
     80WKViewFindIndicatorCallback WKViewGetFindIndicatorCallback(WKViewRef viewRef, void** context)
     81{   
     82    return toImpl(viewRef)->getFindIndicatorCallback(context);
     83}
  • trunk/Source/WebKit2/UIProcess/API/C/win/WKView.h

    r74296 r77054  
    4747WK_EXPORT void WKViewSetInitialFocus(WKViewRef view, bool forward);
    4848
     49typedef void (*WKViewFindIndicatorCallback)(WKViewRef, HBITMAP selectionBitmap, RECT selectionRectInWindowCoordinates, bool fadeout, void*);
     50WK_EXPORT void WKViewSetFindIndicatorCallback(WKViewRef view, WKViewFindIndicatorCallback callback, void* context);
     51WK_EXPORT WKViewFindIndicatorCallback WKViewGetFindIndicatorCallback(WKViewRef view, void** context);
     52
    4953#ifdef __cplusplus
    5054}
  • trunk/Source/WebKit2/UIProcess/FindIndicator.cpp

    r76916 r77054  
    7878namespace WebKit {
    7979
    80 PassRefPtr<FindIndicator> FindIndicator::create(const FloatRect& selectionRect, const Vector<FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle)
     80PassRefPtr<FindIndicator> FindIndicator::create(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle)
    8181{
    82     RefPtr<ShareableBitmap> contentImage = ShareableBitmap::create(enclosingIntRect(selectionRect).size(), contentImageHandle);
     82    RefPtr<ShareableBitmap> contentImage = ShareableBitmap::create(enclosingIntRect(selectionRectInWindowCoordinates).size(), contentImageHandle);
    8383    if (!contentImage)
    8484        return 0;
    8585
    86     return adoptRef(new FindIndicator(selectionRect, textRects, contentImage.release()));
     86    return adoptRef(new FindIndicator(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImage.release()));
    8787}
    8888
    89 FindIndicator::FindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, PassRefPtr<ShareableBitmap> contentImage)
    90     : m_selectionRect(selectionRect)
    91     , m_textRects(textRects)
     89FindIndicator::FindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, PassRefPtr<ShareableBitmap> contentImage)
     90    : m_selectionRectInWindowCoordinates(selectionRectInWindowCoordinates)
     91    , m_textRectsInSelectionRectCoordinates(textRectsInSelectionRectCoordinates)
    9292    , m_contentImage(contentImage)
    9393{
     
    109109FloatRect FindIndicator::frameRect() const
    110110{
    111     return FloatRect(m_selectionRect.x() - leftBorderThickness, m_selectionRect.y() - topBorderThickness,
    112                      m_selectionRect.width() + rightBorderThickness + leftBorderThickness,
    113                      m_selectionRect.height() + topBorderThickness + bottomBorderThickness);
     111    return FloatRect(m_selectionRectInWindowCoordinates.x() - leftBorderThickness, m_selectionRectInWindowCoordinates.y() - topBorderThickness,
     112                     m_selectionRectInWindowCoordinates.width() + rightBorderThickness + leftBorderThickness,
     113                     m_selectionRectInWindowCoordinates.height() + topBorderThickness + bottomBorderThickness);
    114114}
    115115
     
    144144void FindIndicator::draw(GraphicsContext& graphicsContext, const IntRect& dirtyRect)
    145145{
    146     for (size_t i = 0; i < m_textRects.size(); ++i) {
    147         FloatRect textRect = m_textRects[i];
     146    for (size_t i = 0; i < m_textRectsInSelectionRectCoordinates.size(); ++i) {
     147        FloatRect textRect = m_textRectsInSelectionRectCoordinates[i];
    148148        textRect.move(leftBorderThickness, topBorderThickness);
    149149
  • trunk/Source/WebKit2/UIProcess/FindIndicator.h

    r75527 r77054  
    4343class FindIndicator : public RefCounted<FindIndicator> {
    4444public:
    45     static PassRefPtr<FindIndicator> create(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle);
     45    static PassRefPtr<FindIndicator> create(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle);
    4646    ~FindIndicator();
    4747
     48    WebCore::FloatRect selectionRectInWindowCoordinates() const { return m_selectionRectInWindowCoordinates; }
    4849    WebCore::FloatRect frameRect() const;
    4950
    50     const Vector<WebCore::FloatRect>& textRects() const { return m_textRects; }
     51    const Vector<WebCore::FloatRect>& textRects() const { return m_textRectsInSelectionRectCoordinates; }
    5152
    5253    ShareableBitmap* contentImage() const { return m_contentImage.get(); }
     
    5758    FindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, PassRefPtr<ShareableBitmap> contentImage);
    5859
    59     WebCore::FloatRect m_selectionRect;
    60     Vector<WebCore::FloatRect> m_textRects;
     60    WebCore::FloatRect m_selectionRectInWindowCoordinates;
     61    Vector<WebCore::FloatRect> m_textRectsInSelectionRectCoordinates;
    6162    RefPtr<ShareableBitmap> m_contentImage;
    6263};
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r77043 r77054  
    18411841}
    18421842
    1843 void WebPageProxy::setFindIndicator(const FloatRect& selectionRect, const Vector<FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle, bool fadeOut)
    1844 {
    1845     RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRect, textRects, contentImageHandle);
     1843void WebPageProxy::setFindIndicator(const FloatRect& selectionRectInWindowCoordinates, const Vector<FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle, bool fadeOut)
     1844{
     1845    RefPtr<FindIndicator> findIndicator = FindIndicator::create(selectionRectInWindowCoordinates, textRectsInSelectionRectCoordinates, contentImageHandle);
    18461846    m_pageClient->setFindIndicator(findIndicator.release(), fadeOut);
    18471847}
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r76983 r77054  
    489489    // Find.
    490490    void didCountStringMatches(const String&, uint32_t matchCount);
    491     void setFindIndicator(const WebCore::FloatRect& selectionRect, const Vector<WebCore::FloatRect>& textRects, const SharedMemory::Handle& contentImageHandle, bool fadeOut);
     491    void setFindIndicator(const WebCore::FloatRect& selectionRectInWindowCoordinates, const Vector<WebCore::FloatRect>& textRectsInSelectionRectCoordinates, const SharedMemory::Handle& contentImageHandle, bool fadeOut);
    492492    void didFindString(const String&, uint32_t matchCount);
    493493    void didFailToFindString(const String&);
  • trunk/Source/WebKit2/UIProcess/win/WebView.cpp

    r76916 r77054  
    3131#include "LayerBackedDrawingAreaProxy.h"
    3232#include "Logging.h"
     33#include "NativeWebKeyboardEvent.h"
    3334#include "RunLoop.h"
    34 #include "NativeWebKeyboardEvent.h"
     35#include "WKAPICast.h"
    3536#include "WebContext.h"
    3637#include "WebContextMenuProxyWin.h"
     
    4041#include "WebPopupMenuProxyWin.h"
    4142#include <Commctrl.h>
     43#include <WebCore/BitmapInfo.h>
    4244#include <WebCore/Cursor.h>
    4345#include <WebCore/FloatRect.h>
     46#include <WebCore/GraphicsContextCG.h>
    4447#include <WebCore/IntRect.h>
    4548#include <WebCore/SoftLinking.h>
     
    4952
    5053namespace Ime {
    51     // We need these functions in a separate namespace, because in the global namespace they conflict
    52     // with the definitions in imm.h only by the type modifier (the macro defines them as static) and
    53     // imm.h is included by windows.h
    54     SOFT_LINK_LIBRARY(IMM32)
    55     SOFT_LINK(IMM32, ImmGetContext, HIMC, WINAPI, (HWND hwnd), (hwnd))
    56     SOFT_LINK(IMM32, ImmReleaseContext, BOOL, WINAPI, (HWND hWnd, HIMC hIMC), (hWnd, hIMC))
    57     SOFT_LINK(IMM32, ImmGetCompositionStringW, LONG, WINAPI, (HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen), (hIMC, dwIndex, lpBuf, dwBufLen))
    58     SOFT_LINK(IMM32, ImmSetCandidateWindow, BOOL, WINAPI, (HIMC hIMC, LPCANDIDATEFORM lpCandidate), (hIMC, lpCandidate))
    59     SOFT_LINK(IMM32, ImmSetOpenStatus, BOOL, WINAPI, (HIMC hIMC, BOOL fOpen), (hIMC, fOpen))
    60     SOFT_LINK(IMM32, ImmNotifyIME, BOOL, WINAPI, (HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue), (hIMC, dwAction, dwIndex, dwValue))
    61     SOFT_LINK(IMM32, ImmAssociateContextEx, BOOL, WINAPI, (HWND hWnd, HIMC hIMC, DWORD dwFlags), (hWnd, hIMC, dwFlags))
     54// We need these functions in a separate namespace, because in the global namespace they conflict
     55// with the definitions in imm.h only by the type modifier (the macro defines them as static) and
     56// imm.h is included by windows.h
     57SOFT_LINK_LIBRARY(IMM32)
     58SOFT_LINK(IMM32, ImmGetContext, HIMC, WINAPI, (HWND hwnd), (hwnd))
     59SOFT_LINK(IMM32, ImmReleaseContext, BOOL, WINAPI, (HWND hWnd, HIMC hIMC), (hWnd, hIMC))
     60SOFT_LINK(IMM32, ImmGetCompositionStringW, LONG, WINAPI, (HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen), (hIMC, dwIndex, lpBuf, dwBufLen))
     61SOFT_LINK(IMM32, ImmSetCandidateWindow, BOOL, WINAPI, (HIMC hIMC, LPCANDIDATEFORM lpCandidate), (hIMC, lpCandidate))
     62SOFT_LINK(IMM32, ImmSetOpenStatus, BOOL, WINAPI, (HIMC hIMC, BOOL fOpen), (hIMC, fOpen))
     63SOFT_LINK(IMM32, ImmNotifyIME, BOOL, WINAPI, (HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue), (hIMC, dwAction, dwIndex, dwValue))
     64SOFT_LINK(IMM32, ImmAssociateContextEx, BOOL, WINAPI, (HWND hWnd, HIMC hIMC, DWORD dwFlags), (hWnd, hIMC, dwFlags))
    6265};
    6366
     
    102105
    103106    switch (message) {
    104         case WM_CLOSE:
    105             m_page->tryClose();
    106             break;
    107         case WM_DESTROY:
    108             m_isBeingDestroyed = true;
    109             close();
    110             break;
    111         case WM_ERASEBKGND:
    112             lResult = 1;
    113             break;
    114         case WM_PAINT:
    115             lResult = onPaintEvent(hWnd, message, wParam, lParam, handled);
    116             break;
    117         case WM_PRINTCLIENT:
    118             lResult = onPrintClientEvent(hWnd, message, wParam, lParam, handled);
    119             break;
    120         case WM_MOUSEACTIVATE:
    121             setWasActivatedByMouseEvent(true);
    122             handled = false;
    123             break;
    124         case WM_MOUSEMOVE:
    125         case WM_LBUTTONDOWN:
    126         case WM_MBUTTONDOWN:
    127         case WM_RBUTTONDOWN:
    128         case WM_LBUTTONDBLCLK:
    129         case WM_MBUTTONDBLCLK:
    130         case WM_RBUTTONDBLCLK:
    131         case WM_LBUTTONUP:
    132         case WM_MBUTTONUP:
    133         case WM_RBUTTONUP:
    134         case WM_MOUSELEAVE:
    135             lResult = onMouseEvent(hWnd, message, wParam, lParam, handled);
    136             break;
    137         case WM_MOUSEWHEEL:
    138         case WM_VISTA_MOUSEHWHEEL:
    139             lResult = onWheelEvent(hWnd, message, wParam, lParam, handled);
    140             break;
    141         case WM_SYSKEYDOWN:
    142         case WM_KEYDOWN:
    143         case WM_SYSCHAR:
    144         case WM_CHAR:
    145         case WM_SYSKEYUP:
    146         case WM_KEYUP:
    147             lResult = onKeyEvent(hWnd, message, wParam, lParam, handled);
    148             break;
    149         case WM_SIZE:
    150             lResult = onSizeEvent(hWnd, message, wParam, lParam, handled);
    151             break;
    152         case WM_WINDOWPOSCHANGED:
    153             lResult = onWindowPositionChangedEvent(hWnd, message, wParam, lParam, handled);
    154             break;
    155         case WM_SETFOCUS:
    156             lResult = onSetFocusEvent(hWnd, message, wParam, lParam, handled);
    157             break;
    158         case WM_KILLFOCUS:
    159             lResult = onKillFocusEvent(hWnd, message, wParam, lParam, handled);
    160             break;
    161         case WM_TIMER:
    162             lResult = onTimerEvent(hWnd, message, wParam, lParam, handled);
    163             break;
    164         case WM_SHOWWINDOW:
    165             lResult = onShowWindowEvent(hWnd, message, wParam, lParam, handled);
    166             break;
    167         case WM_SETCURSOR:
    168             lResult = onSetCursor(hWnd, message, wParam, lParam, handled);
    169             break;
    170         case WM_IME_STARTCOMPOSITION:
    171             handled = onIMEStartComposition();
    172             break;
    173         case WM_IME_REQUEST:
    174             lResult = onIMERequest(wParam, lParam);
    175             break;
    176         case WM_IME_COMPOSITION:
    177             handled = onIMEComposition(lParam);
    178             break;
    179         case WM_IME_ENDCOMPOSITION:
    180             handled = onIMEEndComposition();
    181             break;
    182         case WM_IME_SELECT:
    183             handled = onIMESelect(wParam, lParam);
    184             break;
    185         case WM_IME_SETCONTEXT:
    186             handled = onIMESetContext(wParam, lParam);
    187             break;
    188         default:
    189             handled = false;
    190             break;
     107    case WM_CLOSE:
     108        m_page->tryClose();
     109        break;
     110    case WM_DESTROY:
     111        m_isBeingDestroyed = true;
     112        close();
     113        break;
     114    case WM_ERASEBKGND:
     115        lResult = 1;
     116        break;
     117    case WM_PAINT:
     118        lResult = onPaintEvent(hWnd, message, wParam, lParam, handled);
     119        break;
     120    case WM_PRINTCLIENT:
     121        lResult = onPrintClientEvent(hWnd, message, wParam, lParam, handled);
     122        break;
     123    case WM_MOUSEACTIVATE:
     124        setWasActivatedByMouseEvent(true);
     125        handled = false;
     126        break;
     127    case WM_MOUSEMOVE:
     128    case WM_LBUTTONDOWN:
     129    case WM_MBUTTONDOWN:
     130    case WM_RBUTTONDOWN:
     131    case WM_LBUTTONDBLCLK:
     132    case WM_MBUTTONDBLCLK:
     133    case WM_RBUTTONDBLCLK:
     134    case WM_LBUTTONUP:
     135    case WM_MBUTTONUP:
     136    case WM_RBUTTONUP:
     137    case WM_MOUSELEAVE:
     138        lResult = onMouseEvent(hWnd, message, wParam, lParam, handled);
     139        break;
     140    case WM_MOUSEWHEEL:
     141    case WM_VISTA_MOUSEHWHEEL:
     142        lResult = onWheelEvent(hWnd, message, wParam, lParam, handled);
     143        break;
     144    case WM_SYSKEYDOWN:
     145    case WM_KEYDOWN:
     146    case WM_SYSCHAR:
     147    case WM_CHAR:
     148    case WM_SYSKEYUP:
     149    case WM_KEYUP:
     150        lResult = onKeyEvent(hWnd, message, wParam, lParam, handled);
     151        break;
     152    case WM_SIZE:
     153        lResult = onSizeEvent(hWnd, message, wParam, lParam, handled);
     154        break;
     155    case WM_WINDOWPOSCHANGED:
     156        lResult = onWindowPositionChangedEvent(hWnd, message, wParam, lParam, handled);
     157        break;
     158    case WM_SETFOCUS:
     159        lResult = onSetFocusEvent(hWnd, message, wParam, lParam, handled);
     160        break;
     161    case WM_KILLFOCUS:
     162        lResult = onKillFocusEvent(hWnd, message, wParam, lParam, handled);
     163        break;
     164    case WM_TIMER:
     165        lResult = onTimerEvent(hWnd, message, wParam, lParam, handled);
     166        break;
     167    case WM_SHOWWINDOW:
     168        lResult = onShowWindowEvent(hWnd, message, wParam, lParam, handled);
     169        break;
     170    case WM_SETCURSOR:
     171        lResult = onSetCursor(hWnd, message, wParam, lParam, handled);
     172        break;
     173    case WM_IME_STARTCOMPOSITION:
     174        handled = onIMEStartComposition();
     175        break;
     176    case WM_IME_REQUEST:
     177        lResult = onIMERequest(wParam, lParam);
     178        break;
     179    case WM_IME_COMPOSITION:
     180        handled = onIMEComposition(lParam);
     181        break;
     182    case WM_IME_ENDCOMPOSITION:
     183        handled = onIMEEndComposition();
     184        break;
     185    case WM_IME_SELECT:
     186        handled = onIMESelect(wParam, lParam);
     187        break;
     188    case WM_IME_SETCONTEXT:
     189        handled = onIMESetContext(wParam, lParam);
     190        break;
     191    default:
     192        handled = false;
     193        break;
    191194    }
    192195
     
    234237    , m_isBeingDestroyed(false)
    235238    , m_inIMEComposition(0)
     239    , m_findIndicatorCallback(0)
     240    , m_findIndicatorCallbackContext(0)
    236241{
    237242    registerWebViewWindowClass();
     
    334339   
    335340    switch (message) {
    336         case WM_LBUTTONDOWN:
    337         case WM_MBUTTONDOWN:
    338         case WM_RBUTTONDOWN:
    339             ::SetFocus(m_window);
    340             ::SetCapture(m_window);
    341             break;
    342         case WM_LBUTTONUP:
    343         case WM_MBUTTONUP:
    344         case WM_RBUTTONUP:
    345             ::ReleaseCapture();
    346             break;
    347         case WM_MOUSEMOVE:
    348             startTrackingMouseLeave();
    349             break;
    350         case WM_MOUSELEAVE:
    351             stopTrackingMouseLeave();
    352             break;
    353         case WM_LBUTTONDBLCLK:
    354         case WM_MBUTTONDBLCLK:
    355         case WM_RBUTTONDBLCLK:
    356             break;
    357         default:
    358             ASSERT_NOT_REACHED();
     341    case WM_LBUTTONDOWN:
     342    case WM_MBUTTONDOWN:
     343    case WM_RBUTTONDOWN:
     344        ::SetFocus(m_window);
     345        ::SetCapture(m_window);
     346        break;
     347    case WM_LBUTTONUP:
     348    case WM_MBUTTONUP:
     349    case WM_RBUTTONUP:
     350        ::ReleaseCapture();
     351        break;
     352    case WM_MOUSEMOVE:
     353        startTrackingMouseLeave();
     354        break;
     355    case WM_MOUSELEAVE:
     356        stopTrackingMouseLeave();
     357        break;
     358    case WM_LBUTTONDBLCLK:
     359    case WM_MBUTTONDBLCLK:
     360    case WM_RBUTTONDBLCLK:
     361        break;
     362    default:
     363        ASSERT_NOT_REACHED();
    359364    }
    360365
     
    462467{
    463468    switch (wParam) {
    464         case UpdateActiveStateTimer:
    465             ::KillTimer(hWnd, UpdateActiveStateTimer);
    466             updateActiveState();
    467             break;
     469    case UpdateActiveStateTimer:
     470        ::KillTimer(hWnd, UpdateActiveStateTimer);
     471        updateActiveState();
     472        break;
    468473    }
    469474
     
    976981
    977982    switch (request) {
    978         case IMR_RECONVERTSTRING:
    979             return onIMERequestReconvertString(reinterpret_cast<RECONVERTSTRING*>(data));
    980 
    981         case IMR_QUERYCHARPOSITION:
    982             return onIMERequestCharPosition(reinterpret_cast<IMECHARPOSITION*>(data));
     983    case IMR_RECONVERTSTRING:
     984        return onIMERequestReconvertString(reinterpret_cast<RECONVERTSTRING*>(data));
     985
     986    case IMR_QUERYCHARPOSITION:
     987        return onIMERequestCharPosition(reinterpret_cast<IMECHARPOSITION*>(data));
    983988    }
    984989    return 0;
     
    10161021}
    10171022
    1018 void WebView::setFindIndicator(PassRefPtr<FindIndicator>, bool fadeOut)
    1019 {
    1020     // FIXME: Implement.
     1023void WebView::setFindIndicator(PassRefPtr<FindIndicator> findIndicator, bool fadeOut)
     1024{
     1025    if (!m_findIndicatorCallback)
     1026        return;
     1027   
     1028    HBITMAP hbmp = 0;
     1029    ShareableBitmap* contentImage = findIndicator->contentImage();
     1030   
     1031    if (contentImage) {
     1032        // Render the contentImage to an HBITMAP.
     1033        void* bits;
     1034        HDC hdc = ::CreateCompatibleDC(0);
     1035        int width = contentImage->bounds().width();
     1036        int height = contentImage->bounds().height();
     1037        BitmapInfo bitmapInfo = BitmapInfo::create(contentImage->size());
     1038
     1039        hbmp = CreateDIBSection(0, &bitmapInfo, DIB_RGB_COLORS, static_cast<void**>(&bits), 0, 0);
     1040        HBITMAP hbmpOld = static_cast<HBITMAP>(SelectObject(hdc, hbmp));
     1041        RetainPtr<CGContextRef> context(AdoptCF, CGBitmapContextCreate(bits, width, height,
     1042            8, width * sizeof(RGBQUAD), deviceRGBColorSpaceRef(), kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst));
     1043
     1044        GraphicsContext graphicsContext(context.get());
     1045        contentImage->paint(graphicsContext, IntPoint(), contentImage->bounds());
     1046
     1047        ::SelectObject(hdc, hbmpOld);
     1048        ::DeleteDC(hdc);
     1049    }
     1050
     1051    IntRect selectionRect(findIndicator->selectionRectInWindowCoordinates());
     1052   
     1053    // The callback is responsible for calling ::DeleteObject(hbmp).
     1054    (*m_findIndicatorCallback)(toAPI(this), hbmp, selectionRect, fadeOut, m_findIndicatorCallbackContext);
     1055}
     1056
     1057void WebView::setFindIndicatorCallback(WKViewFindIndicatorCallback callback, void* context)
     1058{
     1059    m_findIndicatorCallback = callback;
     1060    m_findIndicatorCallbackContext = context;
     1061}
     1062
     1063WKViewFindIndicatorCallback WebView::getFindIndicatorCallback(void** context)
     1064{
     1065    if (context)
     1066        *context = m_findIndicatorCallbackContext;
     1067   
     1068    return m_findIndicatorCallback;
    10211069}
    10221070
     
    10641112    OwnPtr<DrawingAreaProxy> newDrawingArea;
    10651113    switch (type) {
    1066         case DrawingAreaInfo::None:
    1067             break;
    1068         case DrawingAreaInfo::ChunkedUpdate:
    1069             newDrawingArea = ChunkedUpdateDrawingAreaProxy::create(this, m_page.get());
    1070             break;
    1071         case DrawingAreaInfo::LayerBacked:
    1072             newDrawingArea = LayerBackedDrawingAreaProxy::create(this, m_page.get());
    1073             break;
     1114    case DrawingAreaInfo::None:
     1115        break;
     1116    case DrawingAreaInfo::ChunkedUpdate:
     1117        newDrawingArea = ChunkedUpdateDrawingAreaProxy::create(this, m_page.get());
     1118        break;
     1119    case DrawingAreaInfo::LayerBacked:
     1120        newDrawingArea = LayerBackedDrawingAreaProxy::create(this, m_page.get());
     1121        break;
    10741122    }
    10751123
     
    10931141{
    10941142    switch (message) {
    1095         case WM_NCACTIVATE:
    1096             updateActiveStateSoon();
    1097             break;
    1098         case WM_SETTINGCHANGE:
    1099             // systemParameterChanged(wParam);
    1100             break;
     1143    case WM_NCACTIVATE:
     1144        updateActiveStateSoon();
     1145        break;
     1146    case WM_SETTINGCHANGE:
     1147        // systemParameterChanged(wParam);
     1148        break;
    11011149    }
    11021150}
  • trunk/Source/WebKit2/UIProcess/win/WebView.h

    r76824 r77054  
    2929#include "APIObject.h"
    3030#include "PageClient.h"
     31#include "WKView.h"
    3132#include "WebPageProxy.h"
     33#include <ShlObj.h>
    3234#include <WebCore/COMPtr.h>
    3335#include <WebCore/DragActions.h>
     
    3739#include <wtf/PassRefPtr.h>
    3840#include <wtf/RefPtr.h>
    39 #include <ShlObj.h>
    4041
    4142interface IDropTargetHelper;
     
    5960    void windowAncestryDidChange();
    6061    void setIsInWindow(bool);
    61     void setOverrideCursor(HCURSOR overrideCursor);
     62    void setOverrideCursor(HCURSOR);
    6263    void setInitialFocus(bool forward);
     64    void setFindIndicatorCallback(WKViewFindIndicatorCallback, void*);
     65    WKViewFindIndicatorCallback getFindIndicatorCallback(void**);
    6366    void initialize();
    6467
     
    187190
    188191    unsigned m_inIMEComposition;
     192
     193    WKViewFindIndicatorCallback m_findIndicatorCallback;
     194    void* m_findIndicatorCallbackContext;
     195
    189196    COMPtr<IDataObject> m_dragData;
    190197    COMPtr<IDropTargetHelper> m_dropTargetHelper;
Note: See TracChangeset for help on using the changeset viewer.