Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: sky/engine/web/WebViewImpl.cpp

Issue 640143004: Remove context menus. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/engine/web/WebViewImpl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "core/frame/FrameHost.h" 49 #include "core/frame/FrameHost.h"
50 #include "core/frame/FrameView.h" 50 #include "core/frame/FrameView.h"
51 #include "core/frame/LocalFrame.h" 51 #include "core/frame/LocalFrame.h"
52 #include "core/frame/PinchViewport.h" 52 #include "core/frame/PinchViewport.h"
53 #include "core/frame/Settings.h" 53 #include "core/frame/Settings.h"
54 #include "core/html/HTMLMediaElement.h" 54 #include "core/html/HTMLMediaElement.h"
55 #include "core/html/ime/InputMethodContext.h" 55 #include "core/html/ime/InputMethodContext.h"
56 #include "core/loader/FrameLoader.h" 56 #include "core/loader/FrameLoader.h"
57 #include "core/loader/UniqueIdentifier.h" 57 #include "core/loader/UniqueIdentifier.h"
58 #include "core/page/Chrome.h" 58 #include "core/page/Chrome.h"
59 #include "core/page/ContextMenuController.h"
60 #include "core/page/ContextMenuProvider.h"
61 #include "core/page/EventHandler.h" 59 #include "core/page/EventHandler.h"
62 #include "core/page/EventWithHitTestResults.h" 60 #include "core/page/EventWithHitTestResults.h"
63 #include "core/page/FocusController.h" 61 #include "core/page/FocusController.h"
64 #include "core/page/Page.h" 62 #include "core/page/Page.h"
65 #include "core/page/TouchDisambiguation.h" 63 #include "core/page/TouchDisambiguation.h"
66 #include "core/rendering/RenderView.h" 64 #include "core/rendering/RenderView.h"
67 #include "core/rendering/RenderWidget.h" 65 #include "core/rendering/RenderWidget.h"
68 #include "core/rendering/compositing/RenderLayerCompositor.h" 66 #include "core/rendering/compositing/RenderLayerCompositor.h"
69 #include "platform/ContextMenu.h"
70 #include "platform/ContextMenuItem.h"
71 #include "platform/Cursor.h" 67 #include "platform/Cursor.h"
72 #include "platform/KeyboardCodes.h" 68 #include "platform/KeyboardCodes.h"
73 #include "platform/Logging.h" 69 #include "platform/Logging.h"
74 #include "platform/NotImplemented.h" 70 #include "platform/NotImplemented.h"
75 #include "platform/PlatformGestureEvent.h" 71 #include "platform/PlatformGestureEvent.h"
76 #include "platform/PlatformKeyboardEvent.h" 72 #include "platform/PlatformKeyboardEvent.h"
77 #include "platform/PlatformMouseEvent.h" 73 #include "platform/PlatformMouseEvent.h"
78 #include "platform/PlatformWheelEvent.h" 74 #include "platform/PlatformWheelEvent.h"
79 #include "platform/RuntimeEnabledFeatures.h" 75 #include "platform/RuntimeEnabledFeatures.h"
80 #include "platform/TraceEvent.h" 76 #include "platform/TraceEvent.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 145
150 void WebViewImpl::setSpellCheckClient(WebSpellCheckClient* spellCheckClient) 146 void WebViewImpl::setSpellCheckClient(WebSpellCheckClient* spellCheckClient)
151 { 147 {
152 m_spellCheckClient = spellCheckClient; 148 m_spellCheckClient = spellCheckClient;
153 } 149 }
154 150
155 WebViewImpl::WebViewImpl(WebViewClient* client) 151 WebViewImpl::WebViewImpl(WebViewClient* client)
156 : m_client(client) 152 : m_client(client)
157 , m_spellCheckClient(0) 153 , m_spellCheckClient(0)
158 , m_chromeClientImpl(this) 154 , m_chromeClientImpl(this)
159 , m_contextMenuClientImpl(this)
160 , m_editorClientImpl(this) 155 , m_editorClientImpl(this)
161 , m_spellCheckerClientImpl(this) 156 , m_spellCheckerClientImpl(this)
162 , m_fixedLayoutSizeLock(false) 157 , m_fixedLayoutSizeLock(false)
163 , m_zoomLevel(0) 158 , m_zoomLevel(0)
164 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier)) 159 , m_minimumZoomLevel(zoomFactorToZoomLevel(minTextSizeMultiplier))
165 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier)) 160 , m_maximumZoomLevel(zoomFactorToZoomLevel(maxTextSizeMultiplier))
166 , m_contextMenuAllowed(false)
167 , m_doingDragAndDrop(false) 161 , m_doingDragAndDrop(false)
168 , m_ignoreInputEvents(false) 162 , m_ignoreInputEvents(false)
169 , m_compositorDeviceScaleFactorOverride(0) 163 , m_compositorDeviceScaleFactorOverride(0)
170 , m_rootLayerScale(1) 164 , m_rootLayerScale(1)
171 , m_suppressNextKeypressEvent(false) 165 , m_suppressNextKeypressEvent(false)
172 , m_imeAcceptEvents(true) 166 , m_imeAcceptEvents(true)
173 , m_operationsAllowed(WebDragOperationNone) 167 , m_operationsAllowed(WebDragOperationNone)
174 , m_dragOperation(WebDragOperationNone) 168 , m_dragOperation(WebDragOperationNone)
175 , m_isTransparent(false) 169 , m_isTransparent(false)
176 , m_tabsToLinks(false) 170 , m_tabsToLinks(false)
177 , m_layerTreeView(0) 171 , m_layerTreeView(0)
178 , m_rootLayer(0) 172 , m_rootLayer(0)
179 , m_rootGraphicsLayer(0) 173 , m_rootGraphicsLayer(0)
180 , m_rootTransformLayer(0) 174 , m_rootTransformLayer(0)
181 , m_graphicsLayerFactory(adoptPtr(new GraphicsLayerFactoryChromium(this))) 175 , m_graphicsLayerFactory(adoptPtr(new GraphicsLayerFactoryChromium(this)))
182 , m_isAcceleratedCompositingActive(false) 176 , m_isAcceleratedCompositingActive(false)
183 , m_layerTreeViewCommitsDeferred(false) 177 , m_layerTreeViewCommitsDeferred(false)
184 , m_layerTreeViewClosed(false) 178 , m_layerTreeViewClosed(false)
185 , m_matchesHeuristicsForGpuRasterization(false) 179 , m_matchesHeuristicsForGpuRasterization(false)
186 , m_recreatingGraphicsContext(false)
ojan 2014/10/24 00:02:36 wat
187 , m_flingModifier(0) 180 , m_flingModifier(0)
188 , m_flingSourceDevice(false) 181 , m_flingSourceDevice(false)
189 , m_showFPSCounter(false) 182 , m_showFPSCounter(false)
190 , m_showPaintRects(false) 183 , m_showPaintRects(false)
191 , m_showDebugBorders(false) 184 , m_showDebugBorders(false)
192 , m_continuousPaintingEnabled(false) 185 , m_continuousPaintingEnabled(false)
193 , m_showScrollBottleneckRects(false) 186 , m_showScrollBottleneckRects(false)
194 , m_baseBackgroundColor(Color::white) 187 , m_baseBackgroundColor(Color::white)
195 , m_backgroundColorOverride(Color::transparent) 188 , m_backgroundColorOverride(Color::transparent)
196 , m_zoomFactorOverride(0) 189 , m_zoomFactorOverride(0)
197 , m_userGestureObserved(false) 190 , m_userGestureObserved(false)
198 { 191 {
199 Page::PageClients pageClients; 192 Page::PageClients pageClients;
200 pageClients.chromeClient = &m_chromeClientImpl; 193 pageClients.chromeClient = &m_chromeClientImpl;
201 pageClients.contextMenuClient = &m_contextMenuClientImpl;
202 pageClients.editorClient = &m_editorClientImpl; 194 pageClients.editorClient = &m_editorClientImpl;
203 pageClients.spellCheckerClient = &m_spellCheckerClientImpl; 195 pageClients.spellCheckerClient = &m_spellCheckerClientImpl;
204 196
205 m_page = adoptPtrWillBeNoop(new Page(pageClients)); 197 m_page = adoptPtrWillBeNoop(new Page(pageClients));
206 m_page->makeOrdinary(); 198 m_page->makeOrdinary();
207 199
208 setDeviceScaleFactor(m_client->screenInfo().deviceScaleFactor); 200 setDeviceScaleFactor(m_client->screenInfo().deviceScaleFactor);
209 setVisibilityState(m_client->visibilityState(), true); 201 setVisibilityState(m_client->visibilityState(), true);
210 202
211 m_layerTreeView = m_client->initializeLayerTreeView(); 203 m_layerTreeView = m_client->initializeLayerTreeView();
(...skipping 28 matching lines...) Expand all
240 } 232 }
241 233
242 void WebViewImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEvent& ev ent) 234 void WebViewImpl::handleMouseDown(LocalFrame& mainFrame, const WebMouseEvent& ev ent)
243 { 235 {
244 m_lastMouseDownPoint = WebPoint(event.x, event.y); 236 m_lastMouseDownPoint = WebPoint(event.x, event.y);
245 237
246 PageWidgetEventHandler::handleMouseDown(mainFrame, event); 238 PageWidgetEventHandler::handleMouseDown(mainFrame, event);
247 239
248 if (event.button == WebMouseEvent::ButtonLeft && m_mouseCaptureNode) 240 if (event.button == WebMouseEvent::ButtonLeft && m_mouseCaptureNode)
249 m_mouseCaptureGestureToken = mainFrame.eventHandler().takeLastMouseDownG estureToken(); 241 m_mouseCaptureGestureToken = mainFrame.eventHandler().takeLastMouseDownG estureToken();
250
251 // Dispatch the contextmenu event regardless of if the click was swallowed.
252 #if OS(MACOSX)
253 if (event.button == WebMouseEvent::ButtonRight
254 || (event.button == WebMouseEvent::ButtonLeft
255 && event.modifiers & WebMouseEvent::ControlKey))
256 mouseContextMenu(event);
257 #else
258 if (event.button == WebMouseEvent::ButtonRight)
259 mouseContextMenu(event);
260 #endif
261 }
262
263 void WebViewImpl::mouseContextMenu(const WebMouseEvent& event)
264 {
265 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
266 return;
267
268 m_page->contextMenuController().clearContextMenu();
269
270 PlatformMouseEventBuilder pme(mainFrameImpl()->frameView(), event);
271
272 // Find the right target frame. See issue 1186900.
273 HitTestResult result = hitTestResultForWindowPos(pme.position());
274 LocalFrame* targetFrame;
275 if (result.innerNonSharedNode())
276 targetFrame = result.innerNonSharedNode()->document().frame();
277 else
278 targetFrame = m_page->focusController().focusedOrMainFrame();
279
280 LocalFrame* targetLocalFrame = targetFrame;
281
282 m_contextMenuAllowed = true;
283 targetLocalFrame->eventHandler().sendContextMenuEvent(pme);
284 m_contextMenuAllowed = false;
285 // Actually showing the context menu is handled by the ContextMenuClient
286 // implementation...
287 } 242 }
288 243
289 void WebViewImpl::handleMouseUp(LocalFrame& mainFrame, const WebMouseEvent& even t) 244 void WebViewImpl::handleMouseUp(LocalFrame& mainFrame, const WebMouseEvent& even t)
290 { 245 {
291 PageWidgetEventHandler::handleMouseUp(mainFrame, event); 246 PageWidgetEventHandler::handleMouseUp(mainFrame, event);
292
293 #if OS(WIN)
294 // Dispatch the contextmenu event regardless of if the click was swallowed.
295 // On Mac/Linux, we handle it on mouse down, not up.
296 if (event.button == WebMouseEvent::ButtonRight)
297 mouseContextMenu(event);
298 #endif
299 } 247 }
300 248
301 bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve nt& event) 249 bool WebViewImpl::handleMouseWheel(LocalFrame& mainFrame, const WebMouseWheelEve nt& event)
302 { 250 {
303 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event); 251 return PageWidgetEventHandler::handleMouseWheel(mainFrame, event);
304 } 252 }
305 253
306 bool WebViewImpl::scrollBy(const WebFloatSize& delta, const WebFloatSize& veloci ty) 254 bool WebViewImpl::scrollBy(const WebFloatSize& delta, const WebFloatSize& veloci ty)
307 { 255 {
308 if (m_flingSourceDevice == WebGestureDeviceTouchpad) { 256 if (m_flingSourceDevice == WebGestureDeviceTouchpad) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(platformEvent); 378 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(platformEvent);
431 break; 379 break;
432 } 380 }
433 case WebInputEvent::GestureTwoFingerTap: 381 case WebInputEvent::GestureTwoFingerTap:
434 case WebInputEvent::GestureLongPress: 382 case WebInputEvent::GestureLongPress:
435 case WebInputEvent::GestureLongTap: { 383 case WebInputEvent::GestureLongTap: {
436 if (!mainFrameImpl() || !mainFrameImpl()->frameView()) 384 if (!mainFrameImpl() || !mainFrameImpl()->frameView())
437 break; 385 break;
438 386
439 m_client->cancelScheduledContentIntents(); 387 m_client->cancelScheduledContentIntents();
440 m_page->contextMenuController().clearContextMenu();
441 m_contextMenuAllowed = true;
442 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(platformEvent); 388 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(platformEvent);
443 m_contextMenuAllowed = false;
444
445 break; 389 break;
446 } 390 }
447 case WebInputEvent::GestureShowPress: { 391 case WebInputEvent::GestureShowPress: {
448 m_client->cancelScheduledContentIntents(); 392 m_client->cancelScheduledContentIntents();
449 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(platformEvent); 393 eventSwallowed = mainFrameImpl()->frame()->eventHandler().handleGestureE vent(platformEvent);
450 break; 394 break;
451 } 395 }
452 case WebInputEvent::GestureDoubleTap: 396 case WebInputEvent::GestureDoubleTap:
453 // GestureDoubleTap is currently only used by Android for zooming. For W ebCore, 397 // GestureDoubleTap is currently only used by Android for zooming. For W ebCore,
454 // GestureTap with tap count = 2 is used instead. So we drop GestureDoub leTap here. 398 // GestureTap with tap count = 2 is used instead. So we drop GestureDoub leTap here.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 536
593 if (frame->eventHandler().keyEvent(evt)) { 537 if (frame->eventHandler().keyEvent(evt)) {
594 if (WebInputEvent::RawKeyDown == event.type) { 538 if (WebInputEvent::RawKeyDown == event.type) {
595 // Suppress the next keypress event unless the focused node is a plu g-in node. 539 // Suppress the next keypress event unless the focused node is a plu g-in node.
596 // (Flash needs these keypress events to handle non-US keyboards.) 540 // (Flash needs these keypress events to handle non-US keyboards.)
597 m_suppressNextKeypressEvent = true; 541 m_suppressNextKeypressEvent = true;
598 } 542 }
599 return true; 543 return true;
600 } 544 }
601 545
602 #if !OS(MACOSX)
603 const WebInputEvent::Type contextMenuTriggeringEventType =
604 #if OS(WIN)
605 WebInputEvent::KeyUp;
606 #else
607 WebInputEvent::RawKeyDown;
608 #endif
609
610 bool isUnmodifiedMenuKey = !(event.modifiers & WebInputEvent::InputModifiers ) && event.windowsKeyCode == VKEY_APPS;
611 bool isShiftF10 = event.modifiers == WebInputEvent::ShiftKey && event.window sKeyCode == VKEY_F10;
612 if ((isUnmodifiedMenuKey || isShiftF10) && event.type == contextMenuTriggeri ngEventType) {
613 sendContextMenuEvent(event);
614 return true;
615 }
616 #endif // !OS(MACOSX)
617
618 return keyEventDefault(event); 546 return keyEventDefault(event);
619 } 547 }
620 548
621 bool WebViewImpl::handleCharEvent(const WebKeyboardEvent& event) 549 bool WebViewImpl::handleCharEvent(const WebKeyboardEvent& event)
622 { 550 {
623 ASSERT(event.type == WebInputEvent::Char); 551 ASSERT(event.type == WebInputEvent::Char);
624 552
625 // Please refer to the comments explaining the m_suppressNextKeypressEvent 553 // Please refer to the comments explaining the m_suppressNextKeypressEvent
626 // member. The m_suppressNextKeypressEvent is set if the KeyDown is 554 // member. The m_suppressNextKeypressEvent is set if the KeyDown is
627 // handled by Webkit. A keyDown event is typically associated with a 555 // handled by Webkit. A keyDown event is typically associated with a
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 { 783 {
856 m_client->hasTouchEventHandlers(hasTouchHandlers); 784 m_client->hasTouchEventHandlers(hasTouchHandlers);
857 } 785 }
858 786
859 bool WebViewImpl::hasTouchEventHandlersAt(const WebPoint& point) 787 bool WebViewImpl::hasTouchEventHandlersAt(const WebPoint& point)
860 { 788 {
861 // FIXME: Implement this. Note that the point must be divided by pageScaleFa ctor. 789 // FIXME: Implement this. Note that the point must be divided by pageScaleFa ctor.
862 return true; 790 return true;
863 } 791 }
864 792
865 #if !OS(MACOSX)
866 // Mac has no way to open a context menu based on a keyboard event.
867 bool WebViewImpl::sendContextMenuEvent(const WebKeyboardEvent& event)
868 {
869 // The contextMenuController() holds onto the last context menu that was
870 // popped up on the page until a new one is created. We need to clear
871 // this menu before propagating the event through the DOM so that we can
872 // detect if we create a new menu for this event, since we won't create
873 // a new menu if the DOM swallows the event and the defaultEventHandler does
874 // not run.
875 page()->contextMenuController().clearContextMenu();
876
877 m_contextMenuAllowed = true;
878 LocalFrame* focusedFrame = page()->focusController().focusedOrMainFrame();
879 bool handled = focusedFrame->eventHandler().sendContextMenuEventForKey();
880 m_contextMenuAllowed = false;
881 return handled;
882 }
883 #endif
884
885 void WebViewImpl::showContextMenuAtPoint(float x, float y, PassRefPtr<ContextMen uProvider> menuProvider)
886 {
887 m_contextMenuAllowed = true;
888 page()->contextMenuController().clearContextMenu();
889 page()->contextMenuController().showContextMenuAtPoint(page()->mainFrame(), x, y, menuProvider);
890 m_contextMenuAllowed = false;
891 }
892
893 bool WebViewImpl::keyEventDefault(const WebKeyboardEvent& event) 793 bool WebViewImpl::keyEventDefault(const WebKeyboardEvent& event)
894 { 794 {
895 LocalFrame* frame = focusedCoreFrame(); 795 LocalFrame* frame = focusedCoreFrame();
896 if (!frame) 796 if (!frame)
897 return false; 797 return false;
898 798
899 switch (event.type) { 799 switch (event.type) {
900 case WebInputEvent::Char: 800 case WebInputEvent::Char:
901 if (event.windowsKeyCode == VKEY_SPACE) { 801 if (event.windowsKeyCode == VKEY_SPACE) {
902 int keyCode = ((event.modifiers & WebInputEvent::ShiftKey) ? VKEY_PR IOR : VKEY_NEXT); 802 int keyCode = ((event.modifiers & WebInputEvent::ShiftKey) ? VKEY_PR IOR : VKEY_NEXT);
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 case WebInputEvent::MouseDown: 1125 case WebInputEvent::MouseDown:
1226 return EventTypeNames::mousedown; 1126 return EventTypeNames::mousedown;
1227 case WebInputEvent::MouseUp: 1127 case WebInputEvent::MouseUp:
1228 return EventTypeNames::mouseup; 1128 return EventTypeNames::mouseup;
1229 case WebInputEvent::MouseMove: 1129 case WebInputEvent::MouseMove:
1230 return EventTypeNames::mousemove; 1130 return EventTypeNames::mousemove;
1231 case WebInputEvent::MouseEnter: 1131 case WebInputEvent::MouseEnter:
1232 return EventTypeNames::mouseenter; 1132 return EventTypeNames::mouseenter;
1233 case WebInputEvent::MouseLeave: 1133 case WebInputEvent::MouseLeave:
1234 return EventTypeNames::mouseleave; 1134 return EventTypeNames::mouseleave;
1235 case WebInputEvent::ContextMenu:
1236 return EventTypeNames::contextmenu;
1237 case WebInputEvent::MouseWheel: 1135 case WebInputEvent::MouseWheel:
1238 return EventTypeNames::mousewheel; 1136 return EventTypeNames::mousewheel;
1239 case WebInputEvent::KeyDown: 1137 case WebInputEvent::KeyDown:
1240 return EventTypeNames::keydown; 1138 return EventTypeNames::keydown;
1241 case WebInputEvent::KeyUp: 1139 case WebInputEvent::KeyUp:
1242 return EventTypeNames::keyup; 1140 return EventTypeNames::keyup;
1243 case WebInputEvent::GestureScrollBegin: 1141 case WebInputEvent::GestureScrollBegin:
1244 return EventTypeNames::gesturescrollstart; 1142 return EventTypeNames::gesturescrollstart;
1245 case WebInputEvent::GestureScrollEnd: 1143 case WebInputEvent::GestureScrollEnd:
1246 return EventTypeNames::gesturescrollend; 1144 return EventTypeNames::gesturescrollend;
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 { 2110 {
2213 if (m_rootLayerScale == rootLayerScale && m_rootLayerOffset == rootLayerOffs et) 2111 if (m_rootLayerScale == rootLayerScale && m_rootLayerOffset == rootLayerOffs et)
2214 return; 2112 return;
2215 m_rootLayerScale = rootLayerScale; 2113 m_rootLayerScale = rootLayerScale;
2216 m_rootLayerOffset = rootLayerOffset; 2114 m_rootLayerOffset = rootLayerOffset;
2217 if (mainFrameImpl()) 2115 if (mainFrameImpl())
2218 mainFrameImpl()->setInputEventsTransformForEmulation(m_rootLayerOffset, m_rootLayerScale); 2116 mainFrameImpl()->setInputEventsTransformForEmulation(m_rootLayerOffset, m_rootLayerScale);
2219 updateRootLayerTransform(); 2117 updateRootLayerTransform();
2220 } 2118 }
2221 2119
2222 void WebViewImpl::performCustomContextMenuAction(unsigned action)
2223 {
2224 if (!m_page)
2225 return;
2226 ContextMenu* menu = m_page->contextMenuController().contextMenu();
2227 if (!menu)
2228 return;
2229 const ContextMenuItem* item = menu->itemWithAction(static_cast<ContextMenuAc tion>(ContextMenuItemBaseCustomTag + action));
2230 if (item)
2231 m_page->contextMenuController().contextMenuItemSelected(item);
2232 m_page->contextMenuController().clearContextMenu();
2233 }
2234
2235 void WebViewImpl::showContextMenu()
2236 {
2237 if (!page())
2238 return;
2239
2240 page()->contextMenuController().clearContextMenu();
2241 m_contextMenuAllowed = true;
2242 if (LocalFrame* focusedFrame = page()->focusController().focusedOrMainFrame( ))
2243 focusedFrame->eventHandler().sendContextMenuEventForKey();
2244 m_contextMenuAllowed = false;
2245 }
2246
2247 void WebViewImpl::extractSmartClipData(WebRect rect, WebString& clipText, WebStr ing& clipHtml, WebRect& clipRect) 2120 void WebViewImpl::extractSmartClipData(WebRect rect, WebString& clipText, WebStr ing& clipHtml, WebRect& clipRect)
2248 { 2121 {
2249 } 2122 }
2250 2123
2251 void WebViewImpl::setIsTransparent(bool isTransparent) 2124 void WebViewImpl::setIsTransparent(bool isTransparent)
2252 { 2125 {
2253 // Set any existing frames to be transparent. 2126 // Set any existing frames to be transparent.
2254 m_page->mainFrame()->view()->setTransparent(isTransparent); 2127 m_page->mainFrame()->view()->setTransparent(isTransparent);
2255 2128
2256 // Future frames check this to know whether to be transparent. 2129 // Future frames check this to know whether to be transparent.
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
2685 m_layerTreeView->setVisible(visible); 2558 m_layerTreeView->setVisible(visible);
2686 } 2559 }
2687 } 2560 }
2688 2561
2689 bool WebViewImpl::shouldDisableDesktopWorkarounds() 2562 bool WebViewImpl::shouldDisableDesktopWorkarounds()
2690 { 2563 {
2691 return true; 2564 return true;
2692 } 2565 }
2693 2566
2694 } // namespace blink 2567 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/web/WebViewImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698