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 WebCore; | 60 using namespace blink; |
61 | 61 |
62 namespace blink { | 62 namespace blink { |
63 | 63 |
64 // WebPopupMenu --------------------------------------------------------------- | 64 // WebPopupMenu --------------------------------------------------------------- |
65 | 65 |
66 WebPopupMenu* WebPopupMenu::create(WebWidgetClient* client) | 66 WebPopupMenu* WebPopupMenu::create(WebWidgetClient* client) |
67 { | 67 { |
68 // Pass the WebPopupMenuImpl's self-reference to the caller. | 68 // Pass the WebPopupMenuImpl's self-reference to the caller. |
69 return adoptRef(new WebPopupMenuImpl(client)).leakRef(); | 69 return adoptRef(new WebPopupMenuImpl(client)).leakRef(); |
70 } | 70 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 void WebPopupMenuImpl::handleMouseMove(const WebMouseEvent& event) | 115 void WebPopupMenuImpl::handleMouseMove(const WebMouseEvent& event) |
116 { | 116 { |
117 // Don't send mouse move messages if the mouse hasn't moved. | 117 // Don't send mouse move messages if the mouse hasn't moved. |
118 if (event.x != m_lastMousePosition.x || event.y != m_lastMousePosition.y) { | 118 if (event.x != m_lastMousePosition.x || event.y != m_lastMousePosition.y) { |
119 m_lastMousePosition = WebPoint(event.x, event.y); | 119 m_lastMousePosition = WebPoint(event.x, event.y); |
120 m_widget->handleMouseMoveEvent(PlatformMouseEventBuilder(m_widget, event
)); | 120 m_widget->handleMouseMoveEvent(PlatformMouseEventBuilder(m_widget, event
)); |
121 | 121 |
122 // We cannot call setToolTipText() in PopupContainer, because PopupConta
iner is in WebCore, and we cannot refer to WebKit from Webcore. | 122 // 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); | 123 PopupContainer* container = static_cast<PopupContainer*>(m_widget); |
124 client()->setToolTipText(container->getSelectedItemToolTip(), container-
>menuStyle().textDirection() == WebCore::RTL ? WebTextDirectionRightToLeft : Web
TextDirectionLeftToRight); | 124 client()->setToolTipText(container->getSelectedItemToolTip(), container-
>menuStyle().textDirection() == blink::RTL ? WebTextDirectionRightToLeft : WebTe
xtDirectionLeftToRight); |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 void WebPopupMenuImpl::handleMouseLeave(const WebMouseEvent& event) | 128 void WebPopupMenuImpl::handleMouseLeave(const WebMouseEvent& event) |
129 { | 129 { |
130 m_widget->handleMouseMoveEvent(PlatformMouseEventBuilder(m_widget, event)); | 130 m_widget->handleMouseMoveEvent(PlatformMouseEventBuilder(m_widget, event)); |
131 } | 131 } |
132 | 132 |
133 void WebPopupMenuImpl::handleMouseDown(const WebMouseEvent& event) | 133 void WebPopupMenuImpl::handleMouseDown(const WebMouseEvent& event) |
134 { | 134 { |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 *length = 0; | 360 *length = 0; |
361 return false; | 361 return false; |
362 } | 362 } |
363 | 363 |
364 void WebPopupMenuImpl::setTextDirection(WebTextDirection) | 364 void WebPopupMenuImpl::setTextDirection(WebTextDirection) |
365 { | 365 { |
366 } | 366 } |
367 | 367 |
368 | 368 |
369 //----------------------------------------------------------------------------- | 369 //----------------------------------------------------------------------------- |
370 // WebCore::HostWindow | 370 // blink::HostWindow |
371 | 371 |
372 void WebPopupMenuImpl::invalidateContentsAndRootView(const IntRect& paintRect) | 372 void WebPopupMenuImpl::invalidateContentsAndRootView(const IntRect& paintRect) |
373 { | 373 { |
374 if (paintRect.isEmpty()) | 374 if (paintRect.isEmpty()) |
375 return; | 375 return; |
376 if (m_client) | 376 if (m_client) |
377 m_client->didInvalidateRect(paintRect); | 377 m_client->didInvalidateRect(paintRect); |
378 if (m_rootLayer) | 378 if (m_rootLayer) |
379 m_rootLayer->layer()->invalidateRect(FloatRect(paintRect)); | 379 m_rootLayer->layer()->invalidateRect(FloatRect(paintRect)); |
380 } | 380 } |
(...skipping 18 matching lines...) Expand all Loading... |
399 notImplemented(); | 399 notImplemented(); |
400 return IntRect(); | 400 return IntRect(); |
401 } | 401 } |
402 | 402 |
403 WebScreenInfo WebPopupMenuImpl::screenInfo() const | 403 WebScreenInfo WebPopupMenuImpl::screenInfo() const |
404 { | 404 { |
405 return WebScreenInfo(); | 405 return WebScreenInfo(); |
406 } | 406 } |
407 | 407 |
408 //----------------------------------------------------------------------------- | 408 //----------------------------------------------------------------------------- |
409 // WebCore::FramelessScrollViewClient | 409 // blink::FramelessScrollViewClient |
410 | 410 |
411 void WebPopupMenuImpl::popupClosed(FramelessScrollView* widget) | 411 void WebPopupMenuImpl::popupClosed(FramelessScrollView* widget) |
412 { | 412 { |
413 ASSERT(widget == m_widget); | 413 ASSERT(widget == m_widget); |
414 if (m_widget) { | 414 if (m_widget) { |
415 m_widget->setClient(0); | 415 m_widget->setClient(0); |
416 m_widget = 0; | 416 m_widget = 0; |
417 } | 417 } |
418 if (m_client) | 418 if (m_client) |
419 m_client->closeWidgetSoon(); | 419 m_client->closeWidgetSoon(); |
420 } | 420 } |
421 | 421 |
422 } // namespace blink | 422 } // namespace blink |
OLD | NEW |