OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "public/platform/WebRect.h" | 50 #include "public/platform/WebRect.h" |
51 #include "public/web/WebInputEvent.h" | 51 #include "public/web/WebInputEvent.h" |
52 #include "public/web/WebRange.h" | 52 #include "public/web/WebRange.h" |
53 #include "public/web/WebViewClient.h" | 53 #include "public/web/WebViewClient.h" |
54 #include "public/web/WebWidgetClient.h" | 54 #include "public/web/WebWidgetClient.h" |
55 #include "web/PopupContainer.h" | 55 #include "web/PopupContainer.h" |
56 #include "web/PopupMenuChromium.h" | 56 #include "web/PopupMenuChromium.h" |
57 #include "web/WebInputEventConversion.h" | 57 #include "web/WebInputEventConversion.h" |
58 #include <skia/ext/platform_canvas.h> | 58 #include <skia/ext/platform_canvas.h> |
59 | 59 |
60 using namespace blink; | |
61 | |
62 namespace blink { | 60 namespace blink { |
63 | 61 |
64 // WebPopupMenu --------------------------------------------------------------- | 62 // WebPopupMenu --------------------------------------------------------------- |
65 | 63 |
66 WebPopupMenu* WebPopupMenu::create(WebWidgetClient* client) | 64 WebPopupMenu* WebPopupMenu::create(WebWidgetClient* client) |
67 { | 65 { |
68 // Pass the WebPopupMenuImpl's self-reference to the caller. | 66 // Pass the WebPopupMenuImpl's self-reference to the caller. |
69 return adoptRef(new WebPopupMenuImpl(client)).leakRef(); | 67 return adoptRef(new WebPopupMenuImpl(client)).leakRef(); |
70 } | 68 } |
71 | 69 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 112 |
115 void WebPopupMenuImpl::handleMouseMove(const WebMouseEvent& event) | 113 void WebPopupMenuImpl::handleMouseMove(const WebMouseEvent& event) |
116 { | 114 { |
117 // Don't send mouse move messages if the mouse hasn't moved. | 115 // Don't send mouse move messages if the mouse hasn't moved. |
118 if (event.x != m_lastMousePosition.x || event.y != m_lastMousePosition.y) { | 116 if (event.x != m_lastMousePosition.x || event.y != m_lastMousePosition.y) { |
119 m_lastMousePosition = WebPoint(event.x, event.y); | 117 m_lastMousePosition = WebPoint(event.x, event.y); |
120 m_widget->handleMouseMoveEvent(PlatformMouseEventBuilder(m_widget, event
)); | 118 m_widget->handleMouseMoveEvent(PlatformMouseEventBuilder(m_widget, event
)); |
121 | 119 |
122 // We cannot call setToolTipText() in PopupContainer, because PopupConta
iner is in WebCore, and we cannot refer to WebKit from Webcore. | 120 // We cannot call setToolTipText() in PopupContainer, because PopupConta
iner is in WebCore, and we cannot refer to WebKit from Webcore. |
123 PopupContainer* container = static_cast<PopupContainer*>(m_widget); | 121 PopupContainer* container = static_cast<PopupContainer*>(m_widget); |
124 client()->setToolTipText(container->getSelectedItemToolTip(), container-
>menuStyle().textDirection() == blink::RTL ? WebTextDirectionRightToLeft : WebTe
xtDirectionLeftToRight); | 122 client()->setToolTipText(container->getSelectedItemToolTip(), container-
>menuStyle().textDirection() == RTL ? WebTextDirectionRightToLeft : WebTextDirec
tionLeftToRight); |
125 } | 123 } |
126 } | 124 } |
127 | 125 |
128 void WebPopupMenuImpl::handleMouseLeave(const WebMouseEvent& event) | 126 void WebPopupMenuImpl::handleMouseLeave(const WebMouseEvent& event) |
129 { | 127 { |
130 m_widget->handleMouseMoveEvent(PlatformMouseEventBuilder(m_widget, event)); | 128 m_widget->handleMouseMoveEvent(PlatformMouseEventBuilder(m_widget, event)); |
131 } | 129 } |
132 | 130 |
133 void WebPopupMenuImpl::handleMouseDown(const WebMouseEvent& event) | 131 void WebPopupMenuImpl::handleMouseDown(const WebMouseEvent& event) |
134 { | 132 { |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 *length = 0; | 358 *length = 0; |
361 return false; | 359 return false; |
362 } | 360 } |
363 | 361 |
364 void WebPopupMenuImpl::setTextDirection(WebTextDirection) | 362 void WebPopupMenuImpl::setTextDirection(WebTextDirection) |
365 { | 363 { |
366 } | 364 } |
367 | 365 |
368 | 366 |
369 //----------------------------------------------------------------------------- | 367 //----------------------------------------------------------------------------- |
370 // blink::HostWindow | 368 // HostWindow |
371 | 369 |
372 void WebPopupMenuImpl::invalidateContentsAndRootView(const IntRect& paintRect) | 370 void WebPopupMenuImpl::invalidateContentsAndRootView(const IntRect& paintRect) |
373 { | 371 { |
374 if (paintRect.isEmpty()) | 372 if (paintRect.isEmpty()) |
375 return; | 373 return; |
376 if (m_client) | 374 if (m_client) |
377 m_client->didInvalidateRect(paintRect); | 375 m_client->didInvalidateRect(paintRect); |
378 if (m_rootLayer) | 376 if (m_rootLayer) |
379 m_rootLayer->layer()->invalidateRect(FloatRect(paintRect)); | 377 m_rootLayer->layer()->invalidateRect(FloatRect(paintRect)); |
380 } | 378 } |
(...skipping 18 matching lines...) Expand all Loading... |
399 notImplemented(); | 397 notImplemented(); |
400 return IntRect(); | 398 return IntRect(); |
401 } | 399 } |
402 | 400 |
403 WebScreenInfo WebPopupMenuImpl::screenInfo() const | 401 WebScreenInfo WebPopupMenuImpl::screenInfo() const |
404 { | 402 { |
405 return WebScreenInfo(); | 403 return WebScreenInfo(); |
406 } | 404 } |
407 | 405 |
408 //----------------------------------------------------------------------------- | 406 //----------------------------------------------------------------------------- |
409 // blink::FramelessScrollViewClient | 407 // FramelessScrollViewClient |
410 | 408 |
411 void WebPopupMenuImpl::popupClosed(FramelessScrollView* widget) | 409 void WebPopupMenuImpl::popupClosed(FramelessScrollView* widget) |
412 { | 410 { |
413 ASSERT(widget == m_widget); | 411 ASSERT(widget == m_widget); |
414 if (m_widget) { | 412 if (m_widget) { |
415 m_widget->setClient(0); | 413 m_widget->setClient(0); |
416 m_widget = 0; | 414 m_widget = 0; |
417 } | 415 } |
418 if (m_client) | 416 if (m_client) |
419 m_client->closeWidgetSoon(); | 417 m_client->closeWidgetSoon(); |
420 } | 418 } |
421 | 419 |
422 } // namespace blink | 420 } // namespace blink |
OLD | NEW |