Changeset 219950 in webkit
- Timestamp:
- Jul 26, 2017, 10:15:31 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fullscreen/requestFullscreen-escape-key-expected.txt (added)
-
LayoutTests/fullscreen/requestFullscreen-escape-key.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/Document.cpp (modified) (1 diff)
-
Source/WebCore/dom/UserGestureIndicator.cpp (modified) (2 diffs)
-
Source/WebCore/dom/UserGestureIndicator.h (modified) (5 diffs)
-
Source/WebCore/page/EventHandler.cpp (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/DumpRenderTree/mac/EventSendingController.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r219949 r219950 1 2017-07-26 Chris Dumez <cdumez@apple.com> 2 3 Pressing the Escape key should not be a valid user gesture to enter fullscreen 4 https://bugs.webkit.org/show_bug.cgi?id=174864 5 <rdar://problem/33009088> 6 7 Reviewed by Geoffrey Garen. 8 9 Add layout test coverage. 10 11 * fullscreen/requestFullscreen-escape-key-expected.txt: Added. 12 * fullscreen/requestFullscreen-escape-key.html: Added. 13 1 14 2017-07-26 Nan Wang <n_wang@apple.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r219949 r219950 1 2017-07-26 Chris Dumez <cdumez@apple.com> 2 3 Pressing the Escape key should not be a valid user gesture to enter fullscreen 4 https://bugs.webkit.org/show_bug.cgi?id=174864 5 <rdar://problem/33009088> 6 7 Reviewed by Geoffrey Garen. 8 9 Pressing the Escape key should not be a valid user gesture to enter fullscreen since this 10 is the gesture to exit fullscreen already. 11 12 Test: fullscreen/requestFullscreen-escape-key.html 13 14 * dom/Document.cpp: 15 (WebCore::Document::requestFullScreenForElement): 16 * dom/UserGestureIndicator.cpp: 17 (WebCore::UserGestureIndicator::UserGestureIndicator): 18 * dom/UserGestureIndicator.h: 19 (WebCore::UserGestureToken::create): 20 (WebCore::UserGestureToken::gestureType): 21 (WebCore::UserGestureToken::UserGestureToken): 22 * page/EventHandler.cpp: 23 (WebCore::EventHandler::internalKeyEvent): 24 1 25 2017-07-26 Nan Wang <n_wang@apple.com> 2 26 -
trunk/Source/WebCore/dom/Document.cpp
r219856 r219950 5786 5786 // - an activation behavior is currently being processed whose click event was trusted, or 5787 5787 // - the event listener for a trusted click event is being handled. 5788 if (! ScriptController::processingUserGesture())5788 if (!UserGestureIndicator::processingUserGesture()) 5789 5789 break; 5790 5791 // We do not allow pressing the Escape key as a user gesture to enter fullscreen since this is the key 5792 // to exit fullscreen. 5793 if (UserGestureIndicator::currentUserGesture()->gestureType() == UserGestureType::EscapeKey) { 5794 addConsoleMessage(MessageSource::Security, MessageLevel::Error, ASCIILiteral("The Escape key may not be used as a user gesture to enter fullscreen")); 5795 break; 5796 } 5790 5797 5791 5798 // There is a previously-established user preference, security risk, or platform limitation. -
trunk/Source/WebCore/dom/UserGestureIndicator.cpp
r219531 r219950 47 47 } 48 48 49 UserGestureIndicator::UserGestureIndicator(std::optional<ProcessingUserGestureState> state, Document* document )49 UserGestureIndicator::UserGestureIndicator(std::optional<ProcessingUserGestureState> state, Document* document, UserGestureType gestureType) 50 50 : m_previousToken(currentToken()) 51 51 { … … 55 55 56 56 if (state) 57 currentToken() = UserGestureToken::create(state.value() );57 currentToken() = UserGestureToken::create(state.value(), gestureType); 58 58 59 59 if (document && currentToken()->processingUserGesture()) { -
trunk/Source/WebCore/dom/UserGestureIndicator.h
r208985 r219950 43 43 }; 44 44 45 enum class UserGestureType { EscapeKey, Other }; 46 45 47 class UserGestureToken : public RefCounted<UserGestureToken> { 46 48 public: 47 static RefPtr<UserGestureToken> create(ProcessingUserGestureState state )49 static RefPtr<UserGestureToken> create(ProcessingUserGestureState state, UserGestureType gestureType) 48 50 { 49 return adoptRef(new UserGestureToken(state ));51 return adoptRef(new UserGestureToken(state, gestureType)); 50 52 } 51 53 … … 55 57 bool processingUserGesture() const { return m_state == ProcessingUserGesture; } 56 58 bool processingUserGestureForMedia() const { return m_state == ProcessingUserGesture || m_state == ProcessingPotentialUserGesture; } 59 UserGestureType gestureType() const { return m_gestureType; } 57 60 58 61 void addDestructionObserver(WTF::Function<void (UserGestureToken&)>&& observer) … … 62 65 63 66 private: 64 UserGestureToken(ProcessingUserGestureState state )67 UserGestureToken(ProcessingUserGestureState state, UserGestureType gestureType) 65 68 : m_state(state) 69 , m_gestureType(gestureType) 66 70 { 67 71 } … … 69 73 ProcessingUserGestureState m_state = NotProcessingUserGesture; 70 74 Vector<WTF::Function<void (UserGestureToken&)>> m_destructionObservers; 75 UserGestureType m_gestureType; 71 76 }; 72 77 … … 80 85 81 86 // If a document is provided, its last known user gesture timestamp is updated. 82 WEBCORE_EXPORT explicit UserGestureIndicator(std::optional<ProcessingUserGestureState>, Document* = nullptr );87 WEBCORE_EXPORT explicit UserGestureIndicator(std::optional<ProcessingUserGestureState>, Document* = nullptr, UserGestureType = UserGestureType::Other); 83 88 WEBCORE_EXPORT explicit UserGestureIndicator(RefPtr<UserGestureToken>); 84 89 WEBCORE_EXPORT ~UserGestureIndicator(); -
trunk/Source/WebCore/page/EventHandler.cpp
r219568 r219950 3171 3171 return false; 3172 3172 3173 UserGestureIndicator gestureIndicator(ProcessingUserGesture, m_frame.document()); 3173 UserGestureType gestureType = UserGestureType::Other; 3174 if (initialKeyEvent.windowsVirtualKeyCode() == VK_ESCAPE) 3175 gestureType = UserGestureType::EscapeKey; 3176 3177 UserGestureIndicator gestureIndicator(ProcessingUserGesture, m_frame.document(), gestureType); 3174 3178 UserTypingGestureIndicator typingGestureIndicator(m_frame); 3175 3179 -
trunk/Tools/ChangeLog
r219941 r219950 1 2017-07-26 Chris Dumez <cdumez@apple.com> 2 3 Pressing the Escape key should not be a valid user gesture to enter fullscreen 4 https://bugs.webkit.org/show_bug.cgi?id=174864 5 <rdar://problem/33009088> 6 7 Reviewed by Geoffrey Garen. 8 9 Add support for eventSender.keyDown('escape') in DRT to match the behavior of 10 WKTR. 11 12 * DumpRenderTree/mac/EventSendingController.mm: 13 (-[EventSendingController keyDown:withModifiers:withLocation:]): 14 1 15 2017-07-26 Romain Bellessort <romain.bellessort@crf.canon.fr> 2 16 -
trunk/Tools/DumpRenderTree/mac/EventSendingController.mm
r212663 r219950 935 935 eventCharacter = [NSString stringWithCharacters:&ch length:1]; 936 936 keyCode = 0x75; 937 } else if ([character isEqualToString:@"escape"]) { 938 const unichar ch = 0x1B; 939 eventCharacter = [NSString stringWithCharacters:&ch length:1]; 940 keyCode = 0x35; 937 941 } else if ([character isEqualToString:@"printScreen"]) { 938 942 const unichar ch = NSPrintScreenFunctionKey;
Note:
See TracChangeset
for help on using the changeset viewer.