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 28 matching lines...) Expand all Loading... |
39 #include "wtf/OwnPtr.h" | 39 #include "wtf/OwnPtr.h" |
40 #include "wtf/RefCounted.h" | 40 #include "wtf/RefCounted.h" |
41 | 41 |
42 namespace blink { | 42 namespace blink { |
43 class LocalFrame; | 43 class LocalFrame; |
44 class FramelessScrollView; | 44 class FramelessScrollView; |
45 class KeyboardEvent; | 45 class KeyboardEvent; |
46 class Page; | 46 class Page; |
47 class PlatformKeyboardEvent; | 47 class PlatformKeyboardEvent; |
48 class Range; | 48 class Range; |
49 class Widget; | |
50 } | |
51 | |
52 namespace blink { | |
53 class WebContentLayer; | 49 class WebContentLayer; |
54 class WebGestureEvent; | 50 class WebGestureEvent; |
55 class WebKeyboardEvent; | 51 class WebKeyboardEvent; |
56 class WebLayerTreeView; | 52 class WebLayerTreeView; |
57 class WebMouseEvent; | 53 class WebMouseEvent; |
58 class WebMouseWheelEvent; | 54 class WebMouseWheelEvent; |
59 class WebRange; | 55 class WebRange; |
| 56 class WebTouchEvent; |
| 57 class Widget; |
60 struct WebRect; | 58 struct WebRect; |
61 class WebTouchEvent; | |
62 | 59 |
63 class WebPopupMenuImpl : public WebPopupMenu, public blink::FramelessScrollViewC
lient, public WebContentLayerClient, public RefCounted<WebPopupMenuImpl> { | 60 class WebPopupMenuImpl : public WebPopupMenu, public FramelessScrollViewClient,
public WebContentLayerClient, public RefCounted<WebPopupMenuImpl> { |
64 WTF_MAKE_FAST_ALLOCATED; | 61 WTF_MAKE_FAST_ALLOCATED; |
65 public: | 62 public: |
66 // WebWidget functions: | 63 // WebWidget functions: |
67 virtual void close() OVERRIDE FINAL; | 64 virtual void close() OVERRIDE FINAL; |
68 virtual WebSize size() OVERRIDE FINAL { return m_size; } | 65 virtual WebSize size() OVERRIDE FINAL { return m_size; } |
69 virtual void willStartLiveResize() OVERRIDE FINAL; | 66 virtual void willStartLiveResize() OVERRIDE FINAL; |
70 virtual void resize(const WebSize&) OVERRIDE FINAL; | 67 virtual void resize(const WebSize&) OVERRIDE FINAL; |
71 virtual void willEndLiveResize() OVERRIDE FINAL; | 68 virtual void willEndLiveResize() OVERRIDE FINAL; |
72 virtual void beginFrame(const WebBeginFrameArgs&) OVERRIDE FINAL; | 69 virtual void beginFrame(const WebBeginFrameArgs&) OVERRIDE FINAL; |
73 virtual void layout() OVERRIDE FINAL; | 70 virtual void layout() OVERRIDE FINAL; |
(...skipping 14 matching lines...) Expand all Loading... |
88 virtual void setTextDirection(WebTextDirection) OVERRIDE FINAL; | 85 virtual void setTextDirection(WebTextDirection) OVERRIDE FINAL; |
89 virtual bool isAcceleratedCompositingActive() const OVERRIDE FINAL { return
false; } | 86 virtual bool isAcceleratedCompositingActive() const OVERRIDE FINAL { return
false; } |
90 virtual bool isPopupMenu() const OVERRIDE FINAL { return true; } | 87 virtual bool isPopupMenu() const OVERRIDE FINAL { return true; } |
91 virtual void willCloseLayerTreeView() OVERRIDE FINAL; | 88 virtual void willCloseLayerTreeView() OVERRIDE FINAL; |
92 | 89 |
93 // WebContentLayerClient | 90 // WebContentLayerClient |
94 virtual void paintContents(WebCanvas*, const WebRect& clip, bool canPaintLCD
Test, WebFloatRect& opaque, | 91 virtual void paintContents(WebCanvas*, const WebRect& clip, bool canPaintLCD
Test, WebFloatRect& opaque, |
95 WebContentLayerClient::GraphicsContextStatus = GraphicsContextEnabled) O
VERRIDE FINAL; | 92 WebContentLayerClient::GraphicsContextStatus = GraphicsContextEnabled) O
VERRIDE FINAL; |
96 | 93 |
97 // WebPopupMenuImpl | 94 // WebPopupMenuImpl |
98 void initialize(blink::FramelessScrollView* widget, const WebRect& bounds); | 95 void initialize(FramelessScrollView* widget, const WebRect& bounds); |
99 | 96 |
100 WebWidgetClient* client() { return m_client; } | 97 WebWidgetClient* client() { return m_client; } |
101 | 98 |
102 void handleMouseMove(const WebMouseEvent&); | 99 void handleMouseMove(const WebMouseEvent&); |
103 void handleMouseLeave(const WebMouseEvent&); | 100 void handleMouseLeave(const WebMouseEvent&); |
104 void handleMouseDown(const WebMouseEvent&); | 101 void handleMouseDown(const WebMouseEvent&); |
105 void handleMouseUp(const WebMouseEvent&); | 102 void handleMouseUp(const WebMouseEvent&); |
106 void handleMouseDoubleClick(const WebMouseEvent&); | 103 void handleMouseDoubleClick(const WebMouseEvent&); |
107 void handleMouseWheel(const WebMouseWheelEvent&); | 104 void handleMouseWheel(const WebMouseWheelEvent&); |
108 bool handleGestureEvent(const WebGestureEvent&); | 105 bool handleGestureEvent(const WebGestureEvent&); |
109 bool handleTouchEvent(const WebTouchEvent&); | 106 bool handleTouchEvent(const WebTouchEvent&); |
110 bool handleKeyEvent(const WebKeyboardEvent&); | 107 bool handleKeyEvent(const WebKeyboardEvent&); |
111 | 108 |
112 protected: | 109 protected: |
113 friend class WebPopupMenu; // For WebPopupMenu::create. | 110 friend class WebPopupMenu; // For WebPopupMenu::create. |
114 friend class WTF::RefCounted<WebPopupMenuImpl>; | 111 friend class WTF::RefCounted<WebPopupMenuImpl>; |
115 | 112 |
116 explicit WebPopupMenuImpl(WebWidgetClient*); | 113 explicit WebPopupMenuImpl(WebWidgetClient*); |
117 ~WebPopupMenuImpl(); | 114 ~WebPopupMenuImpl(); |
118 | 115 |
119 // blink::HostWindow methods: | 116 // HostWindow methods: |
120 virtual void invalidateContentsAndRootView(const blink::IntRect&) OVERRIDE F
INAL; | 117 virtual void invalidateContentsAndRootView(const IntRect&) OVERRIDE FINAL; |
121 virtual void invalidateContentsForSlowScroll(const blink::IntRect&) OVERRIDE
FINAL; | 118 virtual void invalidateContentsForSlowScroll(const IntRect&) OVERRIDE FINAL; |
122 virtual void scheduleAnimation() OVERRIDE FINAL; | 119 virtual void scheduleAnimation() OVERRIDE FINAL; |
123 virtual void scroll() OVERRIDE FINAL; | 120 virtual void scroll() OVERRIDE FINAL; |
124 virtual blink::IntRect rootViewToScreen(const blink::IntRect&) const OVERRID
E FINAL; | 121 virtual IntRect rootViewToScreen(const IntRect&) const OVERRIDE FINAL; |
125 virtual WebScreenInfo screenInfo() const OVERRIDE FINAL; | 122 virtual WebScreenInfo screenInfo() const OVERRIDE FINAL; |
126 | 123 |
127 // blink::FramelessScrollViewClient methods: | 124 // FramelessScrollViewClient methods: |
128 virtual void popupClosed(blink::FramelessScrollView*) OVERRIDE FINAL; | 125 virtual void popupClosed(FramelessScrollView*) OVERRIDE FINAL; |
129 | 126 |
130 WebWidgetClient* m_client; | 127 WebWidgetClient* m_client; |
131 WebSize m_size; | 128 WebSize m_size; |
132 | 129 |
133 WebLayerTreeView* m_layerTreeView; | 130 WebLayerTreeView* m_layerTreeView; |
134 OwnPtr<WebContentLayer> m_rootLayer; | 131 OwnPtr<WebContentLayer> m_rootLayer; |
135 | 132 |
136 WebPoint m_lastMousePosition; | 133 WebPoint m_lastMousePosition; |
137 | 134 |
138 // This is a non-owning ref. The popup will notify us via popupClosed() | 135 // This is a non-owning ref. The popup will notify us via popupClosed() |
139 // before it is destroyed. | 136 // before it is destroyed. |
140 blink::FramelessScrollView* m_widget; | 137 FramelessScrollView* m_widget; |
141 }; | 138 }; |
142 | 139 |
143 DEFINE_TYPE_CASTS(WebPopupMenuImpl, WebWidget, widget, widget->isPopupMenu(), wi
dget.isPopupMenu()); | 140 DEFINE_TYPE_CASTS(WebPopupMenuImpl, WebWidget, widget, widget->isPopupMenu(), wi
dget.isPopupMenu()); |
144 // WebPopupMenuImpl is the only implementation of FramelessScrollViewClient, so | 141 // WebPopupMenuImpl is the only implementation of FramelessScrollViewClient, so |
145 // no need for further checking. | 142 // no need for further checking. |
146 DEFINE_TYPE_CASTS(WebPopupMenuImpl, blink::FramelessScrollViewClient, client, tr
ue, true); | 143 DEFINE_TYPE_CASTS(WebPopupMenuImpl, FramelessScrollViewClient, client, true, tru
e); |
147 | 144 |
148 } // namespace blink | 145 } // namespace blink |
149 | 146 |
150 #endif | 147 #endif |
OLD | NEW |