Changeset 106134 in webkit
- Timestamp:
- Jan 27, 2012, 11:06:41 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 14 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r106131 r106134 1 2012-01-24 Vincent Scheib <scheib@chromium.org> 2 3 Pointer Lock: Implement pointer interface 4 https://bugs.webkit.org/show_bug.cgi?id=75762 5 6 Reviewed by Julien Chaffraix. 7 8 * pointer-lock/lock-already-locked-expected.txt: Added. 9 * pointer-lock/lock-already-locked.html: Added. 10 * pointer-lock/lock-fail-responses-expected.txt: Added. 11 * pointer-lock/lock-fail-responses.html: Added. 12 * pointer-lock/mouse-event-delivery-expected.txt: Added. 13 * pointer-lock/mouse-event-delivery.html: Added. 14 * pointer-lock/pointerlocklost-event-expected.txt: Added. 15 * pointer-lock/pointerlocklost-event.html: Added. 16 1 17 2012-01-27 Levi Weintraub <leviw@chromium.org> 2 18 -
trunk/LayoutTests/pointer-lock/mouse-event-api.html
r101025 r106134 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">1 <!DOCTYPE HTML> 2 2 <html> 3 3 <head> -
trunk/LayoutTests/pointer-lock/pointer-lock-api.html
r105011 r106134 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">1 <!DOCTYPE HTML> 2 2 <html> 3 3 <head> -
trunk/Source/WebCore/ChangeLog
r106130 r106134 1 2012-01-24 Vincent Scheib <scheib@chromium.org> 2 3 Pointer Lock: Implement pointer interface 4 https://bugs.webkit.org/show_bug.cgi?id=75762 5 6 Reviewed by Julien Chaffraix. 7 8 Implement the navigator.pointer interface via a new 9 PointerLockController class, as per 10 http://dvcs.w3.org/hg/webevents/raw-file/default/mouse-lock.html. 11 12 The implementation is being made in steps, the feature is still behind 13 compile-time and run-time flags, 'webkit' prefixed, and not yet enabled 14 in any browser. (Chromium has a developer flag required.) Follow-up 15 work will include handling DOM elements being removed, making all 16 callbacks asynchronous, iframe permissions (similar to Full Screen), 17 etc. 18 19 PointerLockController maintains state of which Element is the current 20 lock target and the success and failure callbacks. ChromeClient has 21 methods added to expose the required state change requests. 22 23 Tests: pointer-lock/lock-already-locked.html 24 pointer-lock/lock-fail-responses.html 25 pointer-lock/mouse-event-delivery.html 26 pointer-lock/pointerlocklost-event.html 27 28 * WebCore.gypi: 29 * dom/EventNames.h: 30 * page/ChromeClient.h: 31 (WebCore::ChromeClient::requestPointerLock): 32 (WebCore::ChromeClient::requestPointerUnlock): 33 (WebCore::ChromeClient::isPointerLocked): 34 * page/Navigator.cpp: 35 (WebCore::Navigator::webkitPointer): 36 * page/Page.cpp: 37 (WebCore::Page::Page): 38 * page/Page.h: 39 (WebCore::Page::pointerLockController): 40 * page/PointerLock.cpp: 41 (WebCore::PointerLock::PointerLock): 42 (WebCore::PointerLock::create): 43 (WebCore::PointerLock::lock): 44 (WebCore::PointerLock::unlock): 45 (WebCore::PointerLock::isLocked): 46 * page/PointerLock.h: 47 (WebCore::PointerLock::create): 48 * page/PointerLockController.cpp: Added. 49 (WebCore::PointerLockController::PointerLockController): 50 (WebCore::PointerLockController::requestPointerLock): 51 (WebCore::PointerLockController::requestPointerUnlock): 52 (WebCore::PointerLockController::isLocked): 53 (WebCore::PointerLockController::didAcquirePointerLock): 54 (WebCore::PointerLockController::didNotAcquirePointerLock): 55 (WebCore::PointerLockController::didLosePointerLock): 56 (WebCore::PointerLockController::dispatchLockedMouseEvent): 57 * page/PointerLockController.h: Copied from Source/WebCore/page/PointerLock.h. 58 1 59 2012-01-27 Abhishek Arya <inferno@chromium.org> 2 60 -
trunk/Source/WebCore/WebCore.gypi
r105962 r106134 2648 2648 'page/PointerLock.cpp', 2649 2649 'page/PointerLock.h', 2650 'page/PointerLockController.cpp', 2651 'page/PointerLockController.h', 2650 2652 'page/PrintContext.cpp', 2651 2653 'page/Screen.cpp', -
trunk/Source/WebCore/dom/EventNames.h
r104838 r106134 198 198 macro(show) \ 199 199 \ 200 macro(webkitpointerlocklost) \ 201 \ 200 202 201 203 // end of DOM_EVENT_NAMES_FOR_EACH -
trunk/Source/WebCore/page/ChromeClient.h
r104347 r106134 329 329 virtual bool isSVGImageChromeClient() const { return false; } 330 330 331 #if ENABLE(POINTER_LOCK) 332 virtual bool requestPointerLock() { return false; } 333 virtual void requestPointerUnlock() { } 334 virtual bool isPointerLocked() { return false; } 335 #endif 336 331 337 protected: 332 338 virtual ~ChromeClient() { } -
trunk/Source/WebCore/page/Navigator.cpp
r104380 r106134 162 162 PointerLock* Navigator::webkitPointer() const 163 163 { 164 if (!m_pointer )165 m_pointer = PointerLock::create( );164 if (!m_pointer && m_frame && m_frame->page()) 165 m_pointer = PointerLock::create(m_frame); 166 166 return m_pointer.get(); 167 167 } -
trunk/Source/WebCore/page/Page.cpp
r103365 r106134 60 60 #include "PluginView.h" 61 61 #include "PluginViewBase.h" 62 #include "PointerLockController.h" 62 63 #include "ProgressTracker.h" 63 64 #include "RenderTheme.h" … … 146 147 #if ENABLE(NOTIFICATIONS) 147 148 , m_notificationController(NotificationController::create(this, pageClients.notificationClient)) 149 #endif 150 #if ENABLE(POINTER_LOCK) 151 , m_pointerLockController(PointerLockController::create(this)) 148 152 #endif 149 153 #if ENABLE(INPUT_SPEECH) -
trunk/Source/WebCore/page/Page.h
r103007 r106134 77 77 class PageGroup; 78 78 class PluginData; 79 class PointerLockController; 79 80 class ProgressTracker; 80 81 class Range; … … 191 192 NotificationController* notificationController() const { return m_notificationController.get(); } 192 193 #endif 194 #if ENABLE(POINTER_LOCK) 195 PointerLockController* pointerLockController() const { return m_pointerLockController.get(); } 196 #endif 193 197 #if ENABLE(INPUT_SPEECH) 194 198 SpeechInput* speechInput(); … … 387 391 OwnPtr<NotificationController> m_notificationController; 388 392 #endif 393 #if ENABLE(POINTER_LOCK) 394 OwnPtr<PointerLockController> m_pointerLockController; 395 #endif 389 396 #if ENABLE(INPUT_SPEECH) 390 397 SpeechInputClient* m_speechInputClient; -
trunk/Source/WebCore/page/PointerLock.cpp
r100373 r106134 26 26 #include "PointerLock.h" 27 27 28 #include "Frame.h" 29 #include "Page.h" 30 #include "PointerLockController.h" 31 28 32 #if ENABLE(POINTER_LOCK) 29 33 30 34 namespace WebCore { 31 35 32 PointerLock::PointerLock() 36 PointerLock::PointerLock(Frame* frame) 37 : DOMWindowProperty(frame) 38 , m_controller(0) 33 39 { 40 ASSERT(m_frame); 41 m_controller = frame->page()->pointerLockController(); 34 42 } 35 43 36 44 PointerLock::~PointerLock() 37 45 { 46 ASSERT(!m_controller); 47 } 48 49 void PointerLock::disconnectFrame() 50 { 51 DOMWindowProperty::disconnectFrame(); 52 m_controller = 0; 38 53 } 39 54 40 55 void PointerLock::lock(Element* target, PassRefPtr<VoidCallback> successCallback, PassRefPtr<VoidCallback> failureCallback) 41 56 { 42 // FIXME: Implement 57 if (m_controller) 58 m_controller->requestPointerLock(target, successCallback, failureCallback); 43 59 } 44 60 45 61 void PointerLock::unlock() 46 62 { 47 // FIXME: Implement 63 if (m_controller) 64 m_controller->requestPointerUnlock(); 48 65 } 49 66 50 67 bool PointerLock::isLocked() 51 68 { 52 // FIXME: Implement 53 return false; 69 return m_controller && m_controller->isLocked(); 54 70 } 55 71 -
trunk/Source/WebCore/page/PointerLock.h
r100373 r106134 28 28 #if ENABLE(POINTER_LOCK) 29 29 30 #include "DOMWindowProperty.h" 30 31 #include "VoidCallback.h" 31 32 #include <wtf/PassRefPtr.h> … … 35 36 36 37 class Element; 38 class Frame; 39 class PointerLockController; 37 40 38 class PointerLock : public RefCounted<PointerLock> {41 class PointerLock : public RefCounted<PointerLock>, public DOMWindowProperty { 39 42 public: 40 static PassRefPtr<PointerLock> create( ) { return adoptRef(new PointerLock()); }43 static PassRefPtr<PointerLock> create(Frame* frame) { return adoptRef(new PointerLock(frame)); } 41 44 42 45 ~PointerLock(); 46 47 // DOMWindowProperty Interface 48 virtual void disconnectFrame() OVERRIDE; 43 49 44 50 void lock(Element* target, PassRefPtr<VoidCallback> successCallback, PassRefPtr<VoidCallback> failureCallback); … … 47 53 48 54 private: 49 PointerLock(); 55 explicit PointerLock(Frame*); 56 57 PointerLockController* m_controller; 50 58 }; 51 59 -
trunk/Source/WebCore/page/PointerLockController.h
r106132 r106134 1 1 /* 2 * Copyright (C) 201 1Google Inc. All rights reserved.2 * Copyright (C) 2012 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 23 23 */ 24 24 25 #ifndef PointerLock _h26 #define PointerLock _h25 #ifndef PointerLockController_h 26 #define PointerLockController_h 27 27 28 28 #if ENABLE(POINTER_LOCK) 29 29 30 #include "VoidCallback.h" 31 #include <wtf/PassRefPtr.h> 32 #include <wtf/RefCounted.h> 30 #include <wtf/RefPtr.h> 31 #include <wtf/text/AtomicString.h> 33 32 34 33 namespace WebCore { 35 34 36 35 class Element; 36 class Page; 37 class PlatformMouseEvent; 38 class VoidCallback; 37 39 38 class PointerLock : public RefCounted<PointerLock> { 40 class PointerLockController { 41 WTF_MAKE_NONCOPYABLE(PointerLockController); 42 WTF_MAKE_FAST_ALLOCATED; 39 43 public: 40 static Pass RefPtr<PointerLock> create() { return adoptRef(new PointerLock()); }44 static PassOwnPtr<PointerLockController> create(Page*); 41 45 42 ~PointerLock(); 43 44 void lock(Element* target, PassRefPtr<VoidCallback> successCallback, PassRefPtr<VoidCallback> failureCallback); 45 void unlock(); 46 void requestPointerLock(Element* target, PassRefPtr<VoidCallback> successCallback, PassRefPtr<VoidCallback> failureCallback); 47 void requestPointerUnlock(); 46 48 bool isLocked(); 47 49 50 void didAcquirePointerLock(); 51 void didNotAcquirePointerLock(); 52 void didLosePointerLock(); 53 void dispatchLockedMouseEvent(const PlatformMouseEvent&, const AtomicString& eventType); 54 48 55 private: 49 PointerLock(); 56 explicit PointerLockController(Page*); 57 Page* m_page; 58 RefPtr<Element> m_element; 59 RefPtr<VoidCallback> m_successCallback; 60 RefPtr<VoidCallback> m_failureCallback; 50 61 }; 51 62 … … 54 65 #endif // ENABLE(POINTER_LOCK) 55 66 56 #endif // PointerLock_h 57 67 #endif // PointerLockController_h -
trunk/Source/WebKit/chromium/ChangeLog
r106084 r106134 1 2012-01-24 Vincent Scheib <scheib@chromium.org> 2 3 Pointer Lock: Implement pointer interface 4 https://bugs.webkit.org/show_bug.cgi?id=75762 5 6 Add calls to the PointerLockController added in this patch to WebCore. 7 8 * src/WebViewImpl.cpp: 9 (WebKit::WebViewImpl::close): 10 (WebKit::WebViewImpl::didAcquirePointerLock): 11 (WebKit::WebViewImpl::didNotAcquirePointerLock): 12 (WebKit::WebViewImpl::didLosePointerLock): 13 (WebKit::WebViewImpl::pointerLockMouseEvent): 14 1 15 2012-01-26 Kent Tamura <tkent@chromium.org> 2 16 -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r106063 r106134 90 90 #include "PlatformThemeChromiumLinux.h" 91 91 #include "PlatformWheelEvent.h" 92 #include "PointerLock.h" 93 #include "PointerLockController.h" 92 94 #include "PopupContainer.h" 93 95 #include "PopupMenuClient.h" … … 1753 1755 void WebViewImpl::didAcquirePointerLock() 1754 1756 { 1755 // FIXME: Implement when PointerLockController lands. 1757 #if ENABLE(POINTER_LOCK) 1758 if (page()) 1759 page()->pointerLockController()->didAcquirePointerLock(); 1760 #endif 1756 1761 } 1757 1762 1758 1763 void WebViewImpl::didNotAcquirePointerLock() 1759 1764 { 1760 // FIXME: Implement when PointerLockController lands. 1765 #if ENABLE(POINTER_LOCK) 1766 if (page()) 1767 page()->pointerLockController()->didNotAcquirePointerLock(); 1768 #endif 1761 1769 } 1762 1770 1763 1771 void WebViewImpl::didLosePointerLock() 1764 1772 { 1765 // FIXME: Implement when PointerLockController lands. 1773 #if ENABLE(POINTER_LOCK) 1774 if (page()) 1775 page()->pointerLockController()->didLosePointerLock(); 1776 #endif 1766 1777 } 1767 1778 … … 3212 3223 void WebViewImpl::pointerLockMouseEvent(const WebInputEvent& event) 3213 3224 { 3214 // FIXME: Implement when PointerLockController lands. 3225 AtomicString eventType; 3226 switch (event.type) { 3227 case WebInputEvent::MouseDown: 3228 eventType = eventNames().mousedownEvent; 3229 break; 3230 case WebInputEvent::MouseUp: 3231 eventType = eventNames().mouseupEvent; 3232 break; 3233 case WebInputEvent::MouseMove: 3234 eventType = eventNames().mousemoveEvent; 3235 break; 3236 default: 3237 ASSERT_NOT_REACHED(); 3238 } 3239 3240 const WebMouseEvent& mouseEvent = static_cast<const WebMouseEvent&>(event); 3241 3242 if (page()) 3243 page()->pointerLockController()->dispatchLockedMouseEvent( 3244 PlatformMouseEventBuilder(mainFrameImpl()->frameView(), mouseEvent), 3245 eventType); 3215 3246 } 3216 3247 #endif
Note:
See TracChangeset
for help on using the changeset viewer.