|
1 /* |
|
2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
|
3 * |
|
4 * Redistribution and use in source and binary forms, with or without |
|
5 * modification, are permitted provided that the following conditions |
|
6 * are met: |
|
7 * 1. Redistributions of source code must retain the above copyright |
|
8 * notice, this list of conditions and the following disclaimer. |
|
9 * 2. Redistributions in binary form must reproduce the above copyright |
|
10 * notice, this list of conditions and the following disclaimer in the |
|
11 * documentation and/or other materials provided with the distribution. |
|
12 * |
|
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
|
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
|
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
|
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
|
23 * THE POSSIBILITY OF SUCH DAMAGE. |
|
24 */ |
|
25 |
|
26 #include "WebView.h" |
|
27 |
|
28 #include "ChunkedUpdateDrawingAreaProxy.h" |
|
29 #include "RunLoop.h" |
|
30 #include "WebEventFactory.h" |
|
31 #include "WebPageNamespace.h" |
|
32 #include "WebPageProxy.h" |
|
33 #include <Commctrl.h> |
|
34 #include <WebCore/IntRect.h> |
|
35 #include <WebCore/PlatformString.h> |
|
36 #include <WebCore/WebCoreInstanceHandle.h> |
|
37 #include <WebCore/WindowMessageBroadcaster.h> |
|
38 |
|
39 using namespace WebCore; |
|
40 |
|
41 namespace WebKit { |
|
42 |
|
43 static const LPCWSTR kWebKit2WebViewWindowClassName = L"WebKit2WebViewWindowClass"; |
|
44 |
|
45 // Constants not available on all platforms. |
|
46 const int WM_XP_THEMECHANGED = 0x031A; |
|
47 const int WM_VISTA_MOUSEHWHEEL = 0x020E; |
|
48 |
|
49 static const int kMaxToolTipWidth = 250; |
|
50 |
|
51 enum { |
|
52 UpdateActiveStateTimer = 1, |
|
53 }; |
|
54 |
|
55 LRESULT CALLBACK WebView::WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
|
56 { |
|
57 LONG_PTR longPtr = ::GetWindowLongPtr(hWnd, 0); |
|
58 |
|
59 if (WebView* webView = reinterpret_cast<WebView*>(longPtr)) |
|
60 return webView->wndProc(hWnd, message, wParam, lParam); |
|
61 |
|
62 if (message == WM_CREATE) { |
|
63 LPCREATESTRUCT createStruct = reinterpret_cast<LPCREATESTRUCT>(lParam); |
|
64 |
|
65 // Associate the WebView with the window. |
|
66 ::SetWindowLongPtr(hWnd, 0, (LONG_PTR)createStruct->lpCreateParams); |
|
67 return 0; |
|
68 } |
|
69 |
|
70 return ::DefWindowProc(hWnd, message, wParam, lParam); |
|
71 } |
|
72 |
|
73 LRESULT WebView::wndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
|
74 { |
|
75 LRESULT lResult = 0; |
|
76 bool handled = true; |
|
77 |
|
78 switch (message) { |
|
79 case WM_DESTROY: |
|
80 m_isBeingDestroyed = true; |
|
81 close(); |
|
82 break; |
|
83 case WM_ERASEBKGND: |
|
84 lResult = 1; |
|
85 break; |
|
86 case WM_PAINT: |
|
87 lResult = onPaintEvent(hWnd, message, wParam, lParam, handled); |
|
88 break; |
|
89 case WM_MOUSEMOVE: |
|
90 case WM_LBUTTONDOWN: |
|
91 case WM_MBUTTONDOWN: |
|
92 case WM_RBUTTONDOWN: |
|
93 case WM_LBUTTONDBLCLK: |
|
94 case WM_MBUTTONDBLCLK: |
|
95 case WM_RBUTTONDBLCLK: |
|
96 case WM_LBUTTONUP: |
|
97 case WM_MBUTTONUP: |
|
98 case WM_RBUTTONUP: |
|
99 case WM_MOUSELEAVE: |
|
100 lResult = onMouseEvent(hWnd, message, wParam, lParam, handled); |
|
101 break; |
|
102 case WM_MOUSEWHEEL: |
|
103 case WM_VISTA_MOUSEHWHEEL: |
|
104 lResult = onWheelEvent(hWnd, message, wParam, lParam, handled); |
|
105 break; |
|
106 case WM_SYSKEYDOWN: |
|
107 case WM_KEYDOWN: |
|
108 case WM_SYSCHAR: |
|
109 case WM_CHAR: |
|
110 case WM_SYSKEYUP: |
|
111 case WM_KEYUP: |
|
112 lResult = onKeyEvent(hWnd, message, wParam, lParam, handled); |
|
113 break; |
|
114 case WM_SIZE: |
|
115 lResult = onSizeEvent(hWnd, message, wParam, lParam, handled); |
|
116 break; |
|
117 case WM_WINDOWPOSCHANGED: |
|
118 lResult = onWindowPositionChangedEvent(hWnd, message, wParam, lParam, handled); |
|
119 break; |
|
120 case WM_SETFOCUS: |
|
121 lResult = onSetFocusEvent(hWnd, message, wParam, lParam, handled); |
|
122 break; |
|
123 case WM_KILLFOCUS: |
|
124 lResult = onKillFocusEvent(hWnd, message, wParam, lParam, handled); |
|
125 break; |
|
126 case WM_TIMER: |
|
127 lResult = onTimerEvent(hWnd, message, wParam, lParam, handled); |
|
128 break; |
|
129 case WM_SHOWWINDOW: |
|
130 lResult = onShowWindowEvent(hWnd, message, wParam, lParam, handled); |
|
131 break; |
|
132 case WM_SETCURSOR: |
|
133 lResult = onSetCursor(hWnd, message, wParam, lParam, handled); |
|
134 break; |
|
135 default: |
|
136 handled = false; |
|
137 break; |
|
138 } |
|
139 |
|
140 if (!handled) |
|
141 lResult = ::DefWindowProc(hWnd, message, wParam, lParam); |
|
142 |
|
143 return lResult; |
|
144 } |
|
145 |
|
146 bool WebView::registerWebViewWindowClass() |
|
147 { |
|
148 static bool haveRegisteredWindowClass = false; |
|
149 if (haveRegisteredWindowClass) |
|
150 return true; |
|
151 haveRegisteredWindowClass = true; |
|
152 |
|
153 WNDCLASSEX wcex; |
|
154 |
|
155 wcex.cbSize = sizeof(WNDCLASSEX); |
|
156 wcex.style = CS_DBLCLKS; |
|
157 wcex.lpfnWndProc = WebView::WebViewWndProc; |
|
158 wcex.cbClsExtra = 0; |
|
159 wcex.cbWndExtra = sizeof(WebView*); |
|
160 wcex.hInstance = instanceHandle(); |
|
161 wcex.hIcon = 0; |
|
162 wcex.hCursor = ::LoadCursor(0, IDC_ARROW); |
|
163 wcex.hbrBackground = 0; |
|
164 wcex.lpszMenuName = 0; |
|
165 wcex.lpszClassName = kWebKit2WebViewWindowClassName; |
|
166 wcex.hIconSm = 0; |
|
167 |
|
168 return !!::RegisterClassEx(&wcex); |
|
169 } |
|
170 |
|
171 WebView::WebView(RECT rect, WebPageNamespace* pageNamespace, HWND hostWindow) |
|
172 : m_rect(rect) |
|
173 , m_hostWindow(hostWindow) |
|
174 , m_topLevelParentWindow(0) |
|
175 , m_toolTipWindow(0) |
|
176 , m_lastCursorSet(0) |
|
177 , m_trackingMouseLeave(false) |
|
178 , m_isBeingDestroyed(false) |
|
179 { |
|
180 registerWebViewWindowClass(); |
|
181 |
|
182 m_page = pageNamespace->createWebPage(); |
|
183 m_page->setPageClient(this); |
|
184 m_page->initializeWebPage(IntRect(rect).size(), new ChunkedUpdateDrawingAreaProxy(this)); |
|
185 |
|
186 m_window = ::CreateWindowEx(0, kWebKit2WebViewWindowClassName, 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, |
|
187 rect.top, rect.left, rect.right - rect.left, rect.bottom - rect.top, m_hostWindow ? m_hostWindow : HWND_MESSAGE, 0, instanceHandle(), this); |
|
188 ASSERT(::IsWindow(m_window)); |
|
189 |
|
190 ::ShowWindow(m_window, SW_SHOW); |
|
191 |
|
192 // FIXME: Initializing the tooltip window here matches WebKit win, but seems like something |
|
193 // we could do on demand to save resources. |
|
194 initializeToolTipWindow(); |
|
195 |
|
196 // Initialize the top level parent window and register it with the WindowMessageBroadcaster. |
|
197 windowAncestryDidChange(); |
|
198 } |
|
199 |
|
200 WebView::~WebView() |
|
201 { |
|
202 // Tooltip window needs to be explicitly destroyed since it isn't a WS_CHILD. |
|
203 if (::IsWindow(m_toolTipWindow)) |
|
204 ::DestroyWindow(m_toolTipWindow); |
|
205 } |
|
206 |
|
207 void WebView::setHostWindow(HWND hostWindow) |
|
208 { |
|
209 if (m_window) { |
|
210 // If the host window hasn't changed, bail. |
|
211 if (GetParent(m_window) == hostWindow) |
|
212 return; |
|
213 if (hostWindow) |
|
214 SetParent(m_window, hostWindow); |
|
215 else if (!m_isBeingDestroyed) { |
|
216 // Turn the WebView into a message-only window so it will no longer be a child of the |
|
217 // old host window and will be hidden from screen. We only do this when |
|
218 // isBeingDestroyed() is false because doing this while handling WM_DESTROY can leave |
|
219 // m_window in a weird state (see <http://webkit.org/b/29337>). |
|
220 SetParent(m_window, HWND_MESSAGE); |
|
221 } |
|
222 } |
|
223 |
|
224 m_hostWindow = hostWindow; |
|
225 |
|
226 windowAncestryDidChange(); |
|
227 } |
|
228 |
|
229 static HWND findTopLevelParentWindow(HWND window) |
|
230 { |
|
231 if (!window) |
|
232 return 0; |
|
233 |
|
234 HWND current = window; |
|
235 for (HWND parent = GetParent(current); current; current = parent, parent = GetParent(parent)) { |
|
236 if (!parent || !(GetWindowLongPtr(current, GWL_STYLE) & (WS_POPUP | WS_CHILD))) |
|
237 return current; |
|
238 } |
|
239 ASSERT_NOT_REACHED(); |
|
240 return 0; |
|
241 } |
|
242 |
|
243 void WebView::windowAncestryDidChange() |
|
244 { |
|
245 HWND newTopLevelParentWindow; |
|
246 if (m_window) |
|
247 newTopLevelParentWindow = findTopLevelParentWindow(m_hostWindow); |
|
248 else { |
|
249 // There's no point in tracking active state changes of our parent window if we don't have |
|
250 // a window ourselves. |
|
251 newTopLevelParentWindow = 0; |
|
252 } |
|
253 |
|
254 if (newTopLevelParentWindow == m_topLevelParentWindow) |
|
255 return; |
|
256 |
|
257 if (m_topLevelParentWindow) |
|
258 WindowMessageBroadcaster::removeListener(m_topLevelParentWindow, this); |
|
259 |
|
260 m_topLevelParentWindow = newTopLevelParentWindow; |
|
261 |
|
262 if (m_topLevelParentWindow) |
|
263 WindowMessageBroadcaster::addListener(m_topLevelParentWindow, this); |
|
264 |
|
265 updateActiveState(); |
|
266 } |
|
267 |
|
268 LRESULT WebView::onMouseEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) |
|
269 { |
|
270 switch (message) { |
|
271 case WM_LBUTTONDOWN: |
|
272 case WM_MBUTTONDOWN: |
|
273 case WM_RBUTTONDOWN: |
|
274 ::SetFocus(m_window); |
|
275 ::SetCapture(m_window); |
|
276 break; |
|
277 case WM_LBUTTONUP: |
|
278 case WM_MBUTTONUP: |
|
279 case WM_RBUTTONUP: |
|
280 ::ReleaseCapture(); |
|
281 break; |
|
282 case WM_MOUSEMOVE: |
|
283 startTrackingMouseLeave(); |
|
284 break; |
|
285 case WM_MOUSELEAVE: |
|
286 stopTrackingMouseLeave(); |
|
287 break; |
|
288 case WM_LBUTTONDBLCLK: |
|
289 case WM_MBUTTONDBLCLK: |
|
290 case WM_RBUTTONDBLCLK: |
|
291 break; |
|
292 default: |
|
293 ASSERT_NOT_REACHED(); |
|
294 } |
|
295 |
|
296 WebMouseEvent mouseEvent = WebEventFactory::createWebMouseEvent(hWnd, message, wParam, lParam); |
|
297 m_page->mouseEvent(mouseEvent); |
|
298 |
|
299 handled = true; |
|
300 return 0; |
|
301 } |
|
302 |
|
303 LRESULT WebView::onWheelEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) |
|
304 { |
|
305 // Ctrl+Mouse wheel doesn't ever go into WebCore. It is used to |
|
306 // zoom instead (Mac zooms the whole Desktop, but Windows browsers trigger their |
|
307 // own local zoom modes for Ctrl+wheel). |
|
308 /* |
|
309 if (wParam & MK_CONTROL) { |
|
310 short delta = static_cast<short>(HIWORD(wParam)); |
|
311 if (delta < 0) |
|
312 m_page->makeTextSmaller(0); |
|
313 else |
|
314 m_page->makeTextLarger(0); |
|
315 |
|
316 handled = true; |
|
317 return 0; |
|
318 } |
|
319 */ |
|
320 |
|
321 WebWheelEvent wheelEvent = WebEventFactory::createWebWheelEvent(hWnd, message, wParam, lParam); |
|
322 m_page->wheelEvent(wheelEvent); |
|
323 |
|
324 handled = true; |
|
325 return 0; |
|
326 } |
|
327 |
|
328 LRESULT WebView::onKeyEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) |
|
329 { |
|
330 WebKeyboardEvent keyboardEvent = WebEventFactory::createWebKeyboardEvent(hWnd, message, wParam, lParam); |
|
331 m_page->keyEvent(keyboardEvent); |
|
332 |
|
333 handled = true; |
|
334 return 0; |
|
335 } |
|
336 |
|
337 LRESULT WebView::onPaintEvent(HWND hWnd, UINT message, WPARAM, LPARAM, bool& handled) |
|
338 { |
|
339 PAINTSTRUCT paintStruct; |
|
340 HDC hdc = ::BeginPaint(m_window, &paintStruct); |
|
341 |
|
342 m_page->drawingArea()->paint(IntRect(paintStruct.rcPaint), hdc); |
|
343 |
|
344 ::EndPaint(m_window, &paintStruct); |
|
345 |
|
346 handled = true; |
|
347 return 0; |
|
348 } |
|
349 |
|
350 LRESULT WebView::onSizeEvent(HWND, UINT, WPARAM, LPARAM lParam, bool& handled) |
|
351 { |
|
352 int width = LOWORD(lParam); |
|
353 int height = HIWORD(lParam); |
|
354 |
|
355 m_page->drawingArea()->setSize(IntSize(width, height)); |
|
356 |
|
357 handled = true; |
|
358 return 0; |
|
359 } |
|
360 |
|
361 LRESULT WebView::onWindowPositionChangedEvent(HWND, UINT, WPARAM, LPARAM lParam, bool& handled) |
|
362 { |
|
363 if (reinterpret_cast<WINDOWPOS*>(lParam)->flags & SWP_SHOWWINDOW) |
|
364 updateActiveStateSoon(); |
|
365 |
|
366 handled = false; |
|
367 return 0; |
|
368 } |
|
369 |
|
370 LRESULT WebView::onSetFocusEvent(HWND, UINT, WPARAM, LPARAM lParam, bool& handled) |
|
371 { |
|
372 m_page->setFocused(true); |
|
373 |
|
374 handled = true; |
|
375 return 0; |
|
376 } |
|
377 |
|
378 LRESULT WebView::onKillFocusEvent(HWND, UINT, WPARAM, LPARAM lParam, bool& handled) |
|
379 { |
|
380 m_page->setFocused(false); |
|
381 |
|
382 handled = true; |
|
383 return 0; |
|
384 } |
|
385 |
|
386 LRESULT WebView::onTimerEvent(HWND hWnd, UINT, WPARAM wParam, LPARAM, bool& handled) |
|
387 { |
|
388 switch (wParam) { |
|
389 case UpdateActiveStateTimer: |
|
390 ::KillTimer(hWnd, UpdateActiveStateTimer); |
|
391 updateActiveState(); |
|
392 break; |
|
393 } |
|
394 |
|
395 handled = true; |
|
396 return 0; |
|
397 } |
|
398 |
|
399 LRESULT WebView::onShowWindowEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) |
|
400 { |
|
401 // lParam is 0 when the message is sent because of a ShowWindow call. |
|
402 // FIXME: Is WM_SHOWWINDOW sent when ShowWindow is called on an ancestor of our window? |
|
403 if (!lParam) { |
|
404 bool isVisible = wParam; |
|
405 |
|
406 // Notify the drawing area that the visibility changed. |
|
407 m_page->drawingArea()->setPageIsVisible(isVisible); |
|
408 |
|
409 handled = true; |
|
410 } |
|
411 |
|
412 return 0; |
|
413 } |
|
414 |
|
415 LRESULT WebView::onSetCursor(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, bool& handled) |
|
416 { |
|
417 handled = ::SetCursor(m_lastCursorSet); |
|
418 return 0; |
|
419 } |
|
420 |
|
421 bool WebView::isActive() |
|
422 { |
|
423 HWND activeWindow = ::GetActiveWindow(); |
|
424 return (activeWindow && m_topLevelParentWindow == findTopLevelParentWindow(activeWindow)); |
|
425 } |
|
426 |
|
427 void WebView::updateActiveState() |
|
428 { |
|
429 m_page->setActive(isActive()); |
|
430 } |
|
431 |
|
432 void WebView::updateActiveStateSoon() |
|
433 { |
|
434 // This function is called while processing the WM_NCACTIVATE message. |
|
435 // While processing WM_NCACTIVATE when we are being deactivated, GetActiveWindow() will |
|
436 // still return our window. If we were to call updateActiveState() in that case, we would |
|
437 // wrongly think that we are still the active window. To work around this, we update our |
|
438 // active state after a 0-delay timer fires, at which point GetActiveWindow() will return |
|
439 // the newly-activated window. |
|
440 |
|
441 ::SetTimer(m_window, UpdateActiveStateTimer, 0, 0); |
|
442 } |
|
443 |
|
444 static bool initCommonControls() |
|
445 { |
|
446 static bool haveInitialized = false; |
|
447 if (haveInitialized) |
|
448 return true; |
|
449 |
|
450 INITCOMMONCONTROLSEX init; |
|
451 init.dwSize = sizeof(init); |
|
452 init.dwICC = ICC_TREEVIEW_CLASSES; |
|
453 haveInitialized = !!::InitCommonControlsEx(&init); |
|
454 return haveInitialized; |
|
455 } |
|
456 |
|
457 void WebView::initializeToolTipWindow() |
|
458 { |
|
459 if (!initCommonControls()) |
|
460 return; |
|
461 |
|
462 m_toolTipWindow = ::CreateWindowEx(WS_EX_TRANSPARENT, TOOLTIPS_CLASS, 0, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, |
|
463 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
|
464 m_window, 0, 0, 0); |
|
465 if (!m_toolTipWindow) |
|
466 return; |
|
467 |
|
468 TOOLINFO info = {0}; |
|
469 info.cbSize = sizeof(info); |
|
470 info.uFlags = TTF_IDISHWND | TTF_SUBCLASS; |
|
471 info.uId = reinterpret_cast<UINT_PTR>(m_window); |
|
472 |
|
473 ::SendMessage(m_toolTipWindow, TTM_ADDTOOL, 0, reinterpret_cast<LPARAM>(&info)); |
|
474 ::SendMessage(m_toolTipWindow, TTM_SETMAXTIPWIDTH, 0, kMaxToolTipWidth); |
|
475 ::SetWindowPos(m_toolTipWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); |
|
476 } |
|
477 |
|
478 void WebView::startTrackingMouseLeave() |
|
479 { |
|
480 if (m_trackingMouseLeave) |
|
481 return; |
|
482 m_trackingMouseLeave = true; |
|
483 |
|
484 TRACKMOUSEEVENT trackMouseEvent; |
|
485 trackMouseEvent.cbSize = sizeof(TRACKMOUSEEVENT); |
|
486 trackMouseEvent.dwFlags = TME_LEAVE; |
|
487 trackMouseEvent.hwndTrack = m_window; |
|
488 |
|
489 ::TrackMouseEvent(&trackMouseEvent); |
|
490 } |
|
491 |
|
492 void WebView::stopTrackingMouseLeave() |
|
493 { |
|
494 if (!m_trackingMouseLeave) |
|
495 return; |
|
496 m_trackingMouseLeave = false; |
|
497 |
|
498 TRACKMOUSEEVENT trackMouseEvent; |
|
499 trackMouseEvent.cbSize = sizeof(TRACKMOUSEEVENT); |
|
500 trackMouseEvent.dwFlags = TME_LEAVE | TME_CANCEL; |
|
501 trackMouseEvent.hwndTrack = m_window; |
|
502 |
|
503 ::TrackMouseEvent(&trackMouseEvent); |
|
504 } |
|
505 |
|
506 void WebView::close() |
|
507 { |
|
508 setHostWindow(0); |
|
509 m_page->close(); |
|
510 } |
|
511 |
|
512 // PageClient |
|
513 |
|
514 void WebView::processDidExit() |
|
515 { |
|
516 } |
|
517 |
|
518 void WebView::processDidRevive() |
|
519 { |
|
520 } |
|
521 |
|
522 void WebView::takeFocus(bool) |
|
523 { |
|
524 } |
|
525 |
|
526 void WebView::toolTipChanged(const String&, const String& newToolTip) |
|
527 { |
|
528 if (!m_toolTipWindow) |
|
529 return; |
|
530 |
|
531 if (!newToolTip.isEmpty()) { |
|
532 // This is necessary because String::charactersWithNullTermination() is not const. |
|
533 String toolTip = newToolTip; |
|
534 |
|
535 TOOLINFO info = {0}; |
|
536 info.cbSize = sizeof(info); |
|
537 info.uFlags = TTF_IDISHWND; |
|
538 info.uId = reinterpret_cast<UINT_PTR>(m_window); |
|
539 info.lpszText = const_cast<UChar*>(toolTip.charactersWithNullTermination()); |
|
540 ::SendMessage(m_toolTipWindow, TTM_UPDATETIPTEXT, 0, reinterpret_cast<LPARAM>(&info)); |
|
541 } |
|
542 |
|
543 ::SendMessage(m_toolTipWindow, TTM_ACTIVATE, !newToolTip.isEmpty(), 0); |
|
544 } |
|
545 |
|
546 void WebView::setCursor(const WebCore::Cursor& cursor) |
|
547 { |
|
548 HCURSOR platformCursor = cursor.platformCursor()->nativeCursor(); |
|
549 if (!platformCursor) |
|
550 return; |
|
551 |
|
552 m_lastCursorSet = platformCursor; |
|
553 ::SetCursor(platformCursor); |
|
554 } |
|
555 |
|
556 #if USE(ACCELERATED_COMPOSITING) |
|
557 void WebView::pageDidEnterAcceleratedCompositing() |
|
558 { |
|
559 } |
|
560 |
|
561 void WebView::pageDidLeaveAcceleratedCompositing() |
|
562 { |
|
563 } |
|
564 #endif // USE(ACCELERATED_COMPOSITING) |
|
565 |
|
566 // WebCore::WindowMessageListener |
|
567 |
|
568 void WebView::windowReceivedMessage(HWND, UINT message, WPARAM wParam, LPARAM) |
|
569 { |
|
570 switch (message) { |
|
571 case WM_NCACTIVATE: |
|
572 updateActiveStateSoon(); |
|
573 break; |
|
574 case WM_SETTINGCHANGE: |
|
575 // systemParameterChanged(wParam); |
|
576 break; |
|
577 } |
|
578 } |
|
579 |
|
580 } // namespace WebKit |