RESOLVED FIXED 167126
Page should be able to request pointer lock without user gesture if it relinquished it without a user gesture
https://bugs.webkit.org/show_bug.cgi?id=167126
Summary Page should be able to request pointer lock without user gesture if it relinq...
Jeremy Jones
Reported 2017-01-17 11:05:00 PST
Page should be able to request pointer lock without user gesture if it relinquished it without a user gesture
Attachments
Patch (7.83 KB, patch)
2017-01-17 11:22 PST, Jeremy Jones
no flags
Patch (8.74 KB, patch)
2017-01-26 11:51 PST, Jeremy Jones
no flags
Patch (8.87 KB, patch)
2017-01-26 16:39 PST, Jeremy Jones
no flags
Patch (8.92 KB, patch)
2017-01-26 17:02 PST, Jeremy Jones
no flags
Jeremy Jones
Comment 1 2017-01-17 11:06:55 PST
Jeremy Jones
Comment 2 2017-01-17 11:07:16 PST
*** Bug 167013 has been marked as a duplicate of this bug. ***
Jeremy Jones
Comment 3 2017-01-17 11:22:20 PST
Jon Lee
Comment 4 2017-01-25 17:51:30 PST
Comment on attachment 299046 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=299046&action=review > Source/WebCore/ChangeLog:11 > + This change allows a page to lock the pointer pointer again without a user gesture if it was unlocked by "pointer pointer" > Source/WebCore/ChangeLog:14 > + * page/PointerLockController.cpp: Please provide some more detail here. > Source/WebCore/page/PointerLockController.cpp:116 > + m_lockPending = false; Replacing clearElement() with two variable assignments seems fragile. Can we factor this out to a separate version of clearElement that indicates leaving m_unlockPending alone? > Source/WebCore/page/PointerLockController.h:69 > + RefPtr<Document> m_documentCanSkipUserGesture; The variable name took a little time for me to understand its purpose since it sounded like a bool type rather than a RefPtr. Maybe m_documentAllowedToRelockWithoutUserGesture?
Jeremy Jones
Comment 5 2017-01-26 11:49:48 PST
(In reply to comment #4) > Comment on attachment 299046 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=299046&action=review > > > Source/WebCore/ChangeLog:11 > > + This change allows a page to lock the pointer pointer again without a user gesture if it was unlocked by > > "pointer pointer" Done. > > > Source/WebCore/ChangeLog:14 > > + * page/PointerLockController.cpp: > > Please provide some more detail here. Added detail. > > > Source/WebCore/page/PointerLockController.cpp:116 > > + m_lockPending = false; > > Replacing clearElement() with two variable assignments seems fragile. Can we > factor this out to a separate version of clearElement that indicates leaving > m_unlockPending alone? Actually, the default should be to leave m_unlockPending alone. So, I've changed clearElement to do that. The two places that need to modify m_unlockPending, should directly modify that flag since it is explicitly part of their function. didNotAcquirePointerLock means we are no longer waiting on unlockPending, it should set the flag explicitly. This also means that more locations can use clearElement. > > > Source/WebCore/page/PointerLockController.h:69 > > + RefPtr<Document> m_documentCanSkipUserGesture; > > The variable name took a little time for me to understand its purpose since > it sounded like a bool type rather than a RefPtr. Maybe > m_documentAllowedToRelockWithoutUserGesture? Done.
Jeremy Jones
Comment 6 2017-01-26 11:51:40 PST
Jon Lee
Comment 7 2017-01-26 13:54:34 PST
Rebase, please
Jon Lee
Comment 8 2017-01-26 13:57:25 PST
Comment on attachment 299830 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=299830&action=review > Source/WebCore/page/PointerLockController.cpp:114 > + clearElement(); Is this expectation that m_unlockPending is always false in clearElement()? I'd suggest adding an ASSERT there, then. On untrained eyes, one might expect that m_unlockPending should also be set to false in that function.
Jeremy Jones
Comment 9 2017-01-26 16:37:10 PST
(In reply to comment #8) > Comment on attachment 299830 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=299830&action=review > > > Source/WebCore/page/PointerLockController.cpp:114 > > + clearElement(); > > Is this expectation that m_unlockPending is always false in clearElement()? > I'd suggest adding an ASSERT there, then. On untrained eyes, one might > expect that m_unlockPending should also be set to false in that function. That is not the expected case. clearElement() is used when document or element are removed, so the element is cleared, but the unlock is still pending. The unlock must be round tripped to the chrome client after the element is cleared. This feature requires knowing that there was a pending request when the unlock completes, so it can't be cleared by clearElement.
Jeremy Jones
Comment 10 2017-01-26 16:39:04 PST
Jeremy Jones
Comment 11 2017-01-26 17:02:31 PST
WebKit Commit Bot
Comment 12 2017-01-26 18:18:45 PST
Comment on attachment 299883 [details] Patch Clearing flags on attachment: 299883 Committed r211249: <http://trac.webkit.org/changeset/211249>
WebKit Commit Bot
Comment 13 2017-01-26 18:18:48 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.