Changeset 238078 in webkit
- Timestamp:
- Nov 11, 2018 1:32:53 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 38 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r238075 r238078 1 2018-11-11 Daniel Bates <dabates@apple.com> 2 3 [iOS] Draw caps lock indicator in password fields 4 https://bugs.webkit.org/show_bug.cgi?id=190565 5 <rdar://problem/45262343> 6 7 Unreviewed. 8 9 Update expected results now that iOS supports showing the caps lock indictor. 10 11 * platform/ios/fast/css/text-overflow-input-expected.txt: 12 * platform/ios/fast/forms/basic-inputs-expected.txt: 13 * platform/ios/fast/forms/input-appearance-height-expected.txt: 14 * platform/ios/fast/forms/input-value-expected.txt: 15 * platform/ios/fast/forms/placeholder-pseudo-style-expected.txt: 16 * platform/ios/tables/mozilla_expected_failures/bugs/bug92647-1-expected.txt: 17 1 18 2018-11-11 Myles C. Maxfield <mmaxfield@apple.com> 2 19 -
trunk/LayoutTests/platform/ios/fast/css/text-overflow-input-expected.txt
r201397 r238078 32 32 text run at (569,21) width 5: " " 33 33 RenderTextControl {INPUT} at (575,22) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)] 34 RenderFlexibleBox {DIV} at (6,3) size 123x15 35 RenderBlock {DIV} at (0,0) size 123x14 34 36 RenderBR {BR} at (712,21) size 1x19 35 37 RenderTextControl {INPUT} at (2,47) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)] … … 54 56 text run at (569,46) width 5: " " 55 57 RenderTextControl {INPUT} at (575,47) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)] 58 RenderFlexibleBox {DIV} at (6,3) size 123x15 59 RenderBlock {DIV} at (0,0) size 123x14 56 60 RenderText {#text} at (0,0) size 0x0 57 61 RenderBlock {P} at (0,122) size 784x70 … … 80 84 text run at (569,21) width 5: " " 81 85 RenderTextControl {INPUT} at (575,22) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)] 86 RenderFlexibleBox {DIV} at (6,3) size 123x15 87 RenderBlock {DIV} at (0,0) size 123x14 82 88 RenderBR {BR} at (712,21) size 1x19 83 89 RenderTextControl {INPUT} at (2,47) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)] … … 102 108 text run at (569,46) width 5: " " 103 109 RenderTextControl {INPUT} at (575,47) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)] 110 RenderFlexibleBox {DIV} at (6,3) size 123x15 111 RenderBlock {DIV} at (0,0) size 123x14 104 112 RenderText {#text} at (0,0) size 0x0 105 113 RenderBlock {P} at (0,208) size 784x70 … … 146 154 text run at (0,0) width 265: "Lorem ipsum dolor sit amet, consectetur adipiscing elit" 147 155 layer at (590,77) size 122x14 scrollWidth 366 148 RenderBlock {DIV} at ( 6,3) size 123x15156 RenderBlock {DIV} at (0,0) size 123x14 149 157 RenderText {#text} at (0,0) size 366x14 150 158 text run at (0,0) width 366: "\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}" … … 170 178 text run at (-142,0) width 265: "Lorem ipsum dolor sit amet, consectetur adipiscing elit" 171 179 layer at (590,102) size 122x14 scrollWidth 366 172 RenderBlock {DIV} at ( 6,3) size 123x15180 RenderBlock {DIV} at (0,0) size 123x14 173 181 RenderText {#text} at (0,0) size 366x14 174 182 text run at (0,0) width 366: "\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}" … … 194 202 text run at (0,0) width 265: "Lorem ipsum dolor sit amet, consectetur adipiscing elit" 195 203 layer at (590,163) size 122x14 scrollWidth 366 196 RenderBlock {DIV} at ( 6,3) size 123x15204 RenderBlock {DIV} at (0,0) size 123x14 197 205 RenderText {#text} at (0,0) size 366x14 198 206 text run at (0,0) width 366: "\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}" … … 218 226 text run at (-142,0) width 265: "Lorem ipsum dolor sit amet, consectetur adipiscing elit" 219 227 layer at (590,188) size 122x14 scrollWidth 371 220 RenderBlock {DIV} at ( 6,3) size 123x15228 RenderBlock {DIV} at (0,0) size 123x14 221 229 RenderText {#text} at (5,0) size 366x14 222 230 text run at (5,0) width 366: "\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}" -
trunk/LayoutTests/platform/ios/fast/forms/basic-inputs-expected.txt
r179104 r238078 43 43 text run at (326,2) width 8: "a" 44 44 RenderTextControl {INPUT} at (3,28) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)] 45 RenderFlexibleBox {DIV} at (6,3) size 123x15 46 RenderBlock {DIV} at (0,0) size 123x14 45 47 RenderText {#text} at (140,27) size 65x19 46 48 text run at (140,27) width 65: "password " … … 68 70 text run at (0,0) width 147: "foobarbazfoobarbazfoobarbaz" 69 71 layer at (28,389) size 122x14 70 RenderBlock {DIV} at ( 6,3) size 123x1572 RenderBlock {DIV} at (0,0) size 123x14 71 73 RenderText {#text} at (0,0) size 20x14 72 74 text run at (0,0) width 20: "\x{25CF}\x{25CF}\x{25CF}" … … 79 81 layer at (225,386) size 135x21 80 82 RenderTextControl {INPUT} at (206,28) size 137x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)] 83 RenderFlexibleBox {DIV} at (6,3) size 123x15 84 RenderBlock {DIV} at (0,0) size 123x14 81 85 layer at (231,389) size 122x14 82 RenderBlock {DIV} at ( 6,3) size 123x15[color=#545454]86 RenderBlock {DIV} at (0,0) size 123x14 [color=#545454] 83 87 RenderText {#text} at (0,0) size 20x14 84 88 text run at (0,0) width 20: "\x{25CF}\x{25CF}\x{25CF}" -
trunk/LayoutTests/platform/ios/fast/forms/input-appearance-height-expected.txt
r179104 r238078 84 84 text run at (0,235) width 65: "password " 85 85 RenderTextControl {INPUT} at (66,236) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)] 86 RenderFlexibleBox {DIV} at (6,3) size 123x15 87 RenderBlock {DIV} at (0,0) size 123x14 86 88 RenderText {#text} at (203,235) size 5x19 87 89 text run at (203,235) width 5: " " … … 102 104 RenderBlock {DIV} at (6,3) size 123x15 103 105 layer at (81,267) size 122x14 104 RenderBlock {DIV} at ( 6,3) size 123x15106 RenderBlock {DIV} at (0,0) size 123x14 105 107 layer at (61,292) size 122x14 106 108 RenderBlock {DIV} at (0,0) size 123x14 -
trunk/LayoutTests/platform/ios/fast/forms/input-value-expected.txt
r191623 r238078 47 47 RenderTableCell {TD} at (395,29) size 240x27 [r=1 c=1 rs=1 cs=1] 48 48 RenderTextControl {INPUT} at (3,3) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)] 49 RenderFlexibleBox {DIV} at (6,3) size 123x15 50 RenderBlock {DIV} at (0,0) size 123x14 49 51 RenderTableCell {TD} at (636,31) size 63x23 [r=1 c=2 rs=1 cs=1] 50 52 RenderText {#text} at (1,1) size 30x20 … … 206 208 text run at (0,0) width 32: "before" 207 209 layer at (413,171) size 122x14 208 RenderBlock {DIV} at ( 6,3) size 123x15210 RenderBlock {DIV} at (0,0) size 123x14 209 211 RenderText {#text} at (0,0) size 40x14 210 212 text run at (0,0) width 40: "\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}\x{25CF}" -
trunk/LayoutTests/platform/ios/fast/forms/placeholder-pseudo-style-expected.txt
r179104 r238078 18 18 text run at (282,21) width 5: " " 19 19 RenderTextControl {INPUT} at (288,22) size 137x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)] 20 RenderFlexibleBox {DIV} at (6,3) size 123x15 21 RenderBlock {DIV} at (0,0) size 123x14 20 22 RenderText {#text} at (426,21) size 5x19 21 23 text run at (426,21) width 5: " " … … 44 46 text run at (0,0) width 48: "password" 45 47 layer at (303,33) size 122x14 46 RenderBlock {DIV} at ( 6,3) size 123x1548 RenderBlock {DIV} at (0,0) size 123x14 47 49 layer at (590,33) size 122x14 48 50 RenderBlock {DIV} at (6,3) size 123x15 [color=#A9A9A9] -
trunk/LayoutTests/platform/ios/tables/mozilla_expected_failures/bugs/bug92647-1-expected.txt
r191623 r238078 25 25 RenderTableCell {TD} at (82,48) size 185x29 [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1] 26 26 RenderTextControl {INPUT} at (4,4) size 136x22 [bgcolor=#FFFFFF] [border: (1px solid #4C4C4C)] 27 RenderFlexibleBox {DIV} at (6,3) size 123x15 28 RenderBlock {DIV} at (0,0) size 123x14 27 29 RenderText {#text} at (0,0) size 0x0 28 30 RenderTableCell {TD} at (268,60) size 5x5 [border: (1px inset #808080)] [r=1 c=2 rs=1 cs=1] … … 30 32 RenderBlock {DIV} at (6,3) size 123x15 31 33 layer at (108,70) size 122x14 32 RenderBlock {DIV} at ( 6,3) size 123x1534 RenderBlock {DIV} at (0,0) size 123x14 -
trunk/Source/WebCore/ChangeLog
r238077 r238078 1 2018-11-11 Daniel Bates <dabates@apple.com> 2 3 [iOS] Draw caps lock indicator in password fields 4 https://bugs.webkit.org/show_bug.cgi?id=190565 5 <rdar://problem/45262343> 6 7 Reviewed by Dean Jackson. 8 9 Draw the caps lock indicator in a focused password field on iOS. This makes the behavior of password 10 fields on iOS more closely match the behavior of password fields on Mac. 11 12 The majority of this patch is implementing PlatformKeyboardEvent::currentCapsLockState() for iOS. 13 In Legacy WebKit, the implementation boils down to calling call -[::WebEvent modifierFlags]. In 14 Modern WebKit the UIProcess is responsible for -[::WebEvent modifierFlags] and passing it the 15 WebProcess to store such that invocations of PlatformKeyboardEvent::currentCapsLockState() consult 16 the store in the WebProcess. A smaller part of this patch is having both the legacy and modern 17 web views listen for keyboard availability changes so as to update the the caps lock state when 18 a hardware keyboard is detached or attached. 19 20 * WebCore.xcodeproj/project.pbxproj: 21 * page/EventHandler.cpp: 22 (WebCore::EventHandler::capsLockStateMayHaveChanged const): Extracted from EventHandler::internalKeyEvent() 23 so that it can shared between WebCore, Modern WebKit, and Legacy WebKit code. 24 (WebCore::EventHandler::internalKeyEvent): Modified to call capsLockStateMayHaveChanged(). 25 * page/EventHandler.h: 26 * platform/cocoa/KeyEventCocoa.mm: 27 (WebCore::PlatformKeyboardEvent::currentCapsLockState): Moved from KeyEventMac.mm. 28 (WebCore::PlatformKeyboardEvent::getCurrentModifierState): Moved from KeyEventMac.mm. 29 * platform/ios/KeyEventIOS.mm: 30 (WebCore::PlatformKeyboardEvent::currentStateOfModifierKeys): Fetch the current modifier state. 31 (WebCore::PlatformKeyboardEvent::currentCapsLockState): Deleted; we now use the Cocoa implementation. 32 (WebCore::PlatformKeyboardEvent::getCurrentModifierState): Deleted; we now use the Cocoa implementation. 33 * platform/ios/WebEvent.h: 34 * platform/ios/WebEvent.mm: 35 (+[WebEvent modifierFlags]): Added. 36 * platform/mac/KeyEventMac.mm: 37 (WebCore::PlatformKeyboardEvent::currentCapsLockState): Deleted; moved to KeyEventCocoa.mm to be shared 38 by both Mac and iOS. 39 (WebCore::PlatformKeyboardEvent::getCurrentModifierState): Deleted; moved to KeyEventCocoa.mm to be shared 40 by both Mac and iOS. 41 * rendering/RenderThemeCocoa.h: 42 * rendering/RenderThemeCocoa.mm: 43 (WebCore::RenderThemeCocoa::shouldHaveCapsLockIndicator const): Moved from RenderThemeMac.mm. 44 * rendering/RenderThemeIOS.h: 45 * rendering/RenderThemeIOS.mm: 46 (WebCore::RenderThemeIOS::shouldHaveCapsLockIndicator const): Deleted. 47 * rendering/RenderThemeMac.h: 48 * rendering/RenderThemeMac.mm: 49 (WebCore::RenderThemeMac::shouldHaveCapsLockIndicator const): Deleted; moved to RenderThemeCocoa.mm to be 50 shared by both Mac and iOS. 51 1 52 2018-11-11 Zalan Bujtas <zalan@apple.com> 2 53 -
trunk/Source/WebCore/PAL/ChangeLog
r238062 r238078 1 2018-11-11 Daniel Bates <dabates@apple.com> 2 3 [iOS] Draw caps lock indicator in password fields 4 https://bugs.webkit.org/show_bug.cgi?id=190565 5 <rdar://problem/45262343> 6 7 Reviewed by Dean Jackson. 8 9 Forward declare some more SPI. 10 11 * pal/spi/ios/GraphicsServicesSPI.h: 12 * pal/spi/ios/UIKitSPI.h: 13 1 14 2018-11-09 Ryan Haddad <ryanhaddad@apple.com> 2 15 -
trunk/Source/WebCore/PAL/pal/spi/ios/GraphicsServicesSPI.h
r238062 r238078 1 1 /* 2 * Copyright (C) 2014 Apple Inc. All rights reserved.2 * Copyright (C) 2014-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 44 44 void GSFontPurgeFontCache(void); 45 45 46 typedef struct __GSKeyboard* GSKeyboardRef; 47 uint32_t GSKeyboardGetModifierState(GSKeyboardRef); 48 Boolean GSEventIsHardwareKeyboardAttached(); 49 50 extern const char *kGSEventHardwareKeyboardAvailabilityChangedNotification; 51 46 52 WTF_EXTERN_C_END 47 53 -
trunk/Source/WebCore/PAL/pal/spi/ios/UIKitSPI.h
r238062 r238078 24 24 */ 25 25 26 WTF_EXTERN_C_BEGIN 27 typedef struct __GSKeyboard* GSKeyboardRef; 28 WTF_EXTERN_C_END 29 26 30 #if USE(APPLE_INTERNAL_SDK) 27 31 … … 45 49 @interface UIApplication () 46 50 + (UIApplicationSceneClassicMode)_classicMode; 51 - (GSKeyboardRef)_hardwareKeyboard; 47 52 @end 48 53 … … 76 81 77 82 @interface UIApplication () 78 79 83 - (BOOL)_isClassic; 80 84 + (UIApplicationSceneClassicMode)_classicMode; 81 85 - (GSKeyboardRef)_hardwareKeyboard; 82 86 @end 83 87 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r238062 r238078 13688 13688 CE5CB1B314EDAB6F00BB2795 /* EventSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventSender.h; sourceTree = "<group>"; }; 13689 13689 CE5FA253209E48C50051D700 /* ContentSecurityPolicyClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ContentSecurityPolicyClient.h; path = csp/ContentSecurityPolicyClient.h; sourceTree = "<group>"; }; 13690 CE68C8FF21924EE5001230B3 /* PlatformKeyboardEvent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformKeyboardEvent.cpp; sourceTree = "<group>"; }; 13690 13691 CE6D89294C7AACE0AD89B3DD /* MathMLMencloseElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MathMLMencloseElement.h; sourceTree = "<group>"; }; 13691 13692 CE6DADF71C591E6A003F6A88 /* ContentSecurityPolicyResponseHeaders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ContentSecurityPolicyResponseHeaders.cpp; path = csp/ContentSecurityPolicyResponseHeaders.cpp; sourceTree = "<group>"; }; … … 25090 25091 BC5C76291497FE1400BC4775 /* PlatformEvent.h */, 25091 25092 A723F77A1484CA4C008C6DBE /* PlatformExportMacros.h */, 25093 CE68C8FF21924EE5001230B3 /* PlatformKeyboardEvent.cpp */, 25092 25094 935C476609AC4D4300A6AAB4 /* PlatformKeyboardEvent.h */, 25093 25095 935C476709AC4D4300A6AAB4 /* PlatformMouseEvent.h */, -
trunk/Source/WebCore/page/EventHandler.cpp
r238062 r238078 3163 3163 } 3164 3164 3165 void EventHandler::capsLockStateMayHaveChanged() const 3166 { 3167 auto* focusedElement = m_frame.document()->focusedElement(); 3168 if (!is<HTMLInputElement>(focusedElement)) 3169 return; 3170 downcast<HTMLInputElement>(*focusedElement).capsLockStateMayHaveChanged(); 3171 } 3172 3165 3173 bool EventHandler::internalKeyEvent(const PlatformKeyboardEvent& initialKeyEvent) 3166 3174 { … … 3195 3203 #endif 3196 3204 3197 if (initialKeyEvent.windowsVirtualKeyCode() == VK_CAPITAL) { 3198 if (auto* element = m_frame.document()->focusedElement()) { 3199 if (is<HTMLInputElement>(*element)) 3200 downcast<HTMLInputElement>(*element).capsLockStateMayHaveChanged(); 3201 } 3202 } 3205 if (initialKeyEvent.windowsVirtualKeyCode() == VK_CAPITAL) 3206 capsLockStateMayHaveChanged(); 3203 3207 3204 3208 #if ENABLE(PAN_SCROLLING) -
trunk/Source/WebCore/page/EventHandler.h
r238062 r238078 257 257 WEBCORE_EXPORT bool keyEvent(const PlatformKeyboardEvent&); 258 258 void defaultKeyboardEventHandler(KeyboardEvent&); 259 WEBCORE_EXPORT void capsLockStateMayHaveChanged() const; 259 260 260 261 bool accessibilityPreventsEventPropagation(KeyboardEvent&); -
trunk/Source/WebCore/platform/cocoa/KeyEventCocoa.mm
r238062 r238078 28 28 29 29 #import "Logging.h" 30 #import "PlatformKeyboardEvent.h" 30 31 #import "WindowsKeyboardCodes.h" 31 32 #import <wtf/ASCIICType.h> 33 #import <wtf/MainThread.h> 32 34 #import <wtf/text/WTFString.h> 33 35 … … 39 41 40 42 namespace WebCore { 43 44 bool PlatformKeyboardEvent::currentCapsLockState() 45 { 46 return currentStateOfModifierKeys().contains(PlatformEvent::Modifier::CapsLockKey); 47 } 48 49 void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey) 50 { 51 auto currentModifiers = currentStateOfModifierKeys(); 52 shiftKey = currentModifiers.contains(PlatformEvent::Modifier::ShiftKey); 53 ctrlKey = currentModifiers.contains(PlatformEvent::Modifier::CtrlKey); 54 altKey = currentModifiers.contains(PlatformEvent::Modifier::AltKey); 55 metaKey = currentModifiers.contains(PlatformEvent::Modifier::MetaKey); 56 } 41 57 42 58 // https://w3c.github.io/uievents-key/ -
trunk/Source/WebCore/platform/ios/KeyEventIOS.mm
r238062 r238078 32 32 #import "KeyEventCodesIOS.h" 33 33 #import "NotImplemented.h" 34 #import "WebEvent.h" 34 35 #import "WindowsKeyboardCodes.h" 35 36 #import <pal/spi/cocoa/IOKitSPI.h> 37 #import <wtf/MainThread.h> 36 38 37 39 using namespace WTF; … … 313 315 } 314 316 315 bool PlatformKeyboardEvent::currentCapsLockState() 316 { 317 notImplemented(); 318 return false; 319 } 320 321 void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey) 322 { 323 notImplemented(); 324 shiftKey = false; 325 ctrlKey = false; 326 altKey = false; 327 metaKey = false; 317 OptionSet<PlatformEvent::Modifier> PlatformKeyboardEvent::currentStateOfModifierKeys() 318 { 319 // s_currentModifiers is only set in the WebContent process, not in the UI process. 320 if (s_currentModifiers) { 321 ASSERT(isMainThread()); 322 return *s_currentModifiers; 323 } 324 325 ::WebEventFlags currentModifiers = [::WebEvent modifierFlags]; 326 327 OptionSet<PlatformEvent::Modifier> modifiers; 328 if (currentModifiers & ::WebEventFlagMaskShiftKey) 329 modifiers.add(PlatformEvent::Modifier::ShiftKey); 330 if (currentModifiers & ::WebEventFlagMaskControlKey) 331 modifiers.add(PlatformEvent::Modifier::CtrlKey); 332 if (currentModifiers & ::WebEventFlagMaskOptionKey) 333 modifiers.add(PlatformEvent::Modifier::AltKey); 334 if (currentModifiers & ::WebEventFlagMaskCommandKey) 335 modifiers.add(PlatformEvent::Modifier::MetaKey); 336 if (currentModifiers & ::WebEventFlagMaskLeftCapsLockKey) 337 modifiers.add(PlatformEvent::Modifier::CapsLockKey); 338 339 return modifiers; 328 340 } 329 341 -
trunk/Source/WebCore/platform/ios/WebEvent.h
r238062 r238078 217 217 @property(nonatomic) BOOL wasHandled; 218 218 219 @property (class, readonly) WebEventFlags modifierFlags; 220 219 221 @end 220 222 -
trunk/Source/WebCore/platform/ios/WebEvent.mm
r238062 r238078 37 37 #import "WAKAppKitStubs.h" 38 38 #import <pal/spi/cocoa/IOKitSPI.h> 39 #import <pal/spi/ios/GraphicsServicesSPI.h> 40 #import <pal/spi/ios/UIKitSPI.h> 41 #import <wtf/SoftLinking.h> 42 43 SOFT_LINK_FRAMEWORK(UIKit) 44 SOFT_LINK_CLASS(UIKit, UIApplication); 45 46 #define UIApplication getUIApplicationClass() 39 47 40 48 using WebCore::windowsKeyCodeForKeyCode; … … 492 500 } 493 501 502 + (WebEventFlags)modifierFlags 503 { 504 return GSEventIsHardwareKeyboardAttached() ? GSKeyboardGetModifierState([UIApplication sharedApplication]._hardwareKeyboard) : 0; 505 } 506 494 507 @end 495 508 -
trunk/Source/WebCore/platform/mac/KeyEventMac.mm
r238062 r238078 259 259 } 260 260 261 bool PlatformKeyboardEvent::currentCapsLockState()262 {263 auto currentModifiers = currentStateOfModifierKeys();264 return currentModifiers.contains(PlatformEvent::Modifier::CapsLockKey);265 }266 267 void PlatformKeyboardEvent::getCurrentModifierState(bool& shiftKey, bool& ctrlKey, bool& altKey, bool& metaKey)268 {269 auto currentModifiers = currentStateOfModifierKeys();270 shiftKey = currentModifiers.contains(PlatformEvent::Modifier::ShiftKey);271 ctrlKey = currentModifiers.contains(PlatformEvent::Modifier::CtrlKey);272 altKey = currentModifiers.contains(PlatformEvent::Modifier::AltKey);273 metaKey = currentModifiers.contains(PlatformEvent::Modifier::MetaKey);274 }275 276 261 OptionSet<PlatformEvent::Modifier> PlatformKeyboardEvent::currentStateOfModifierKeys() 277 262 { -
trunk/Source/WebCore/rendering/RenderThemeCocoa.h
r238062 r238078 37 37 class RenderThemeCocoa : public RenderTheme { 38 38 private: 39 bool shouldHaveCapsLockIndicator(const HTMLInputElement&) const final; 40 39 41 #if ENABLE(APPLE_PAY) 40 42 void adjustApplePayButtonStyle(StyleResolver&, RenderStyle&, const Element*) const override; -
trunk/Source/WebCore/rendering/RenderThemeCocoa.mm
r238062 r238078 28 28 29 29 #import "GraphicsContextCG.h" 30 #import "HTMLInputElement.h" 30 31 #import "RenderText.h" 31 32 … … 51 52 52 53 namespace WebCore { 54 55 bool RenderThemeCocoa::shouldHaveCapsLockIndicator(const HTMLInputElement& element) const 56 { 57 return element.isPasswordField(); 58 } 53 59 54 60 #if ENABLE(APPLE_PAY) -
trunk/Source/WebCore/rendering/RenderThemeIOS.h
r238062 r238078 118 118 119 119 bool shouldHaveSpinButton(const HTMLInputElement&) const override; 120 bool shouldHaveCapsLockIndicator(const HTMLInputElement&) const override;121 120 122 121 #if ENABLE(VIDEO) -
trunk/Source/WebCore/rendering/RenderThemeIOS.mm
r238062 r238078 1136 1136 } 1137 1137 1138 bool RenderThemeIOS::shouldHaveCapsLockIndicator(const HTMLInputElement&) const1139 {1140 return false;1141 }1142 1143 1138 FontCascadeDescription& RenderThemeIOS::cachedSystemFontDescription(CSSValueID valueID) const 1144 1139 { -
trunk/Source/WebCore/rendering/RenderThemeMac.h
r238062 r238078 165 165 #endif 166 166 167 bool shouldHaveCapsLockIndicator(const HTMLInputElement&) const final;168 169 167 bool paintSnapshottedPluginOverlay(const RenderObject&, const PaintInfo&, const IntRect&) final; 170 168 -
trunk/Source/WebCore/rendering/RenderThemeMac.mm
r238074 r238078 2343 2343 } 2344 2344 2345 bool RenderThemeMac::shouldHaveCapsLockIndicator(const HTMLInputElement& element) const2346 {2347 return element.isPasswordField();2348 }2349 2350 2345 NSPopUpButtonCell* RenderThemeMac::popupButton() const 2351 2346 { -
trunk/Source/WebKit/ChangeLog
r238076 r238078 1 2018-11-11 Daniel Bates <dabates@apple.com> 2 3 [iOS] Draw caps lock indicator in password fields 4 https://bugs.webkit.org/show_bug.cgi?id=190565 5 <rdar://problem/45262343> 6 7 Reviewed by Dean Jackson. 8 9 Notify the WebContent process with the current modifer state on window activation changes. Notify 10 the WebContent process when hardware keyboard availability changes (e.g. a keyboard is attached). 11 12 * UIProcess/API/Cocoa/WKWebView.mm: 13 (-[WKWebView _initializeWithConfiguration:]): Register for hardware keyboard availability changed notifications. 14 (-[WKWebView dealloc]): Unregister from hardware availability changed notifications. 15 (hardwareKeyboardAvailabilityChangedCallback): Added. 16 * UIProcess/WebPageProxy.cpp: 17 (WebKit::WebPageProxy::updateCurrentModifierState): Compile this code when building for iOS. 18 * UIProcess/WebPageProxy.h: 19 * UIProcess/ios/WKContentViewInteraction.mm: 20 (-[WKContentView _handleKeyUIEvent:]): Update the current modifier state if this event is a hardware 21 keyboard flags changed event. 22 * UIProcess/ios/WebPageProxyIOS.mm: 23 (WebKit::WebPageProxy::hardwareKeyboardAvailabilityChanged): Added. 24 25 * WebProcess/WebPage/WebPage.h: 26 * WebProcess/WebPage/WebPage.messages.in: 27 * WebProcess/WebPage/ios/WebPageIOS.mm: 28 (WebKit::WebPage::hardwareKeyboardAvailabilityChanged): 29 Added new message HardwareKeyboardAvailabilityChanged. Notify the focused HTML input element (if we have 30 one) that the caps lock state may have changed when we receive message HardwareKeyboardAvailabilityChanged 31 so that we toggle visibility of the caps lock indicator. 32 1 33 2018-11-11 Dan Bernstein <mitz@apple.com> 2 34 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r238070 r238078 154 154 #import <pal/spi/cg/CoreGraphicsSPI.h> 155 155 #import <pal/spi/cocoa/QuartzCoreSPI.h> 156 #import <pal/spi/ios/GraphicsServicesSPI.h> 156 157 #import <wtf/cocoa/Entitlements.h> 157 158 … … 713 714 [[_configuration _contentProviderRegistry] addPage:*_page]; 714 715 _page->setForceAlwaysUserScalable([_configuration ignoresViewportScaleLimits]); 716 717 CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), (__bridge const void *)(self), hardwareKeyboardAvailabilityChangedCallback, (CFStringRef)[NSString stringWithUTF8String:kGSEventHardwareKeyboardAvailabilityChangedNotification], nullptr, CFNotificationSuspensionBehaviorCoalesce); 715 718 #endif 716 719 … … 850 853 [[NSNotificationCenter defaultCenter] removeObserver:self]; 851 854 [_scrollView setInternalDelegate:nil]; 855 856 CFNotificationCenterRemoveObserver(CFNotificationCenterGetDarwinNotifyCenter(), (__bridge const void *)(self), (CFStringRef)[NSString stringWithUTF8String:kGSEventHardwareKeyboardAvailabilityChangedNotification], nullptr); 852 857 #endif 853 858 … … 3106 3111 3107 3112 [self _keyboardChangedWithInfo:notification.userInfo adjustScrollView:YES]; 3113 } 3114 3115 static void hardwareKeyboardAvailabilityChangedCallback(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef) 3116 { 3117 ASSERT(observer); 3118 WKWebView *webView = (__bridge WKWebView *)observer; 3119 webView._page->hardwareKeyboardAvailabilityChanged(); 3108 3120 } 3109 3121 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r238062 r238078 8151 8151 void WebPageProxy::updateCurrentModifierState() 8152 8152 { 8153 #if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) 8153 #if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING) || PLATFORM(IOS_FAMILY) 8154 8154 auto modifiers = PlatformKeyboardEvent::currentStateOfModifierKeys(); 8155 8155 m_process->send(Messages::WebPage::UpdateCurrentModifierState(modifiers), m_pageID); -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r238062 r238078 650 650 void startAutoscrollAtPosition(const WebCore::FloatPoint& positionInWindow); 651 651 void cancelAutoscroll(); 652 void hardwareKeyboardAvailabilityChanged(); 652 653 #if ENABLE(DATA_INTERACTION) 653 654 void didHandleStartDataInteractionRequest(bool started); … … 1369 1370 void didCloseSuggestions(); 1370 1371 #endif 1372 1373 void updateCurrentModifierState(); 1371 1374 1372 1375 private: … … 1852 1855 #endif 1853 1856 1854 void updateCurrentModifierState();1855 1856 1857 void reportPageLoadResult(const WebCore::ResourceError& = { }); 1857 1858 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r238062 r238078 3798 3798 - (void)_handleKeyUIEvent:(::UIEvent *)event 3799 3799 { 3800 bool isHardwareKeyboardEvent = !!event._hidEvent; 3801 if (isHardwareKeyboardEvent && ((UIPhysicalKeyboardEvent *)event)._inputFlags & kUIKeyboardInputModifierFlagsChanged) 3802 _page->updateCurrentModifierState(); 3803 3800 3804 // We only want to handle key event from the hardware keyboard when we are 3801 3805 // first responder and we are not interacting with editable content. 3802 if ([self isFirstResponder] && event._hidEvent && !_page->editorState().isContentEditable) {3806 if ([self isFirstResponder] && isHardwareKeyboardEvent && !_page->editorState().isContentEditable) { 3803 3807 [self handleKeyEvent:event]; 3804 3808 return; -
trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
r238062 r238078 1090 1090 } 1091 1091 1092 void WebPageProxy::hardwareKeyboardAvailabilityChanged() 1093 { 1094 updateCurrentModifierState(); 1095 m_process->send(Messages::WebPage::HardwareKeyboardAvailabilityChanged(), m_pageID); 1096 } 1097 1092 1098 #if ENABLE(DATA_INTERACTION) 1093 1099 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r238062 r238078 914 914 bool platformPrefersTextLegibilityBasedZoomScaling() const; 915 915 const WebCore::ViewportConfiguration& viewportConfiguration() const { return m_viewportConfiguration; } 916 917 void hardwareKeyboardAvailabilityChanged(); 916 918 #endif 917 919 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in
r238062 r238078 107 107 CancelAutoscroll() 108 108 RequestAssistedNodeInformation(WebKit::CallbackID callbackID) 109 HardwareKeyboardAvailabilityChanged() 109 110 #endif 110 111 -
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
r238062 r238078 3088 3088 } 3089 3089 3090 void WebPage::hardwareKeyboardAvailabilityChanged() 3091 { 3092 if (auto* focusedFrame = m_page->focusController().focusedFrame()) 3093 focusedFrame->eventHandler().capsLockStateMayHaveChanged(); 3094 } 3095 3090 3096 #if USE(QUICK_LOOK) 3091 3097 void WebPage::didReceivePasswordForQuickLookDocument(const String& password) -
trunk/Source/WebKitLegacy/mac/ChangeLog
r238074 r238078 1 2018-11-11 Daniel Bates <dabates@apple.com> 2 3 [iOS] Draw caps lock indicator in password fields 4 https://bugs.webkit.org/show_bug.cgi?id=190565 5 <rdar://problem/45262343> 6 7 Reviewed by Dean Jackson. 8 9 Update the caps lock state when a hardware keyboard is attached or detached. 10 11 * WebView/WebHTMLView.mm: 12 (hardwareKeyboardAvailabilityChangedCallback): Added. 13 (-[WebHTMLView initWithFrame:]): Register for hardware keyboard availability changed notifications. 14 (-[WebHTMLView dealloc]): Unregister from hardware keyboard availability changed notifications. 15 1 16 2018-11-11 Benjamin Poulain <benjamin@webkit.org> 2 17 -
trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm
r238074 r238078 165 165 #import <WebCore/WAKWindow.h> 166 166 #import <WebCore/WKGraphics.h> 167 #import <WebCore/WebCoreThreadRun.h> 167 168 #import <WebCore/WebEvent.h> 169 #import <pal/spi/ios/GraphicsServicesSPI.h> 168 170 #endif 169 171 … … 815 817 #if PLATFORM(IOS_FAMILY) 816 818 static NSString * const WebMarkedTextUpdatedNotification = @"WebMarkedTextUpdated"; 819 820 static void hardwareKeyboardAvailabilityChangedCallback(CFNotificationCenterRef, void* observer, CFStringRef, const void*, CFDictionaryRef) 821 { 822 ASSERT(observer); 823 WebThreadRun(^{ 824 WebHTMLView *webView = (__bridge WebHTMLView *)observer; 825 if (Frame* coreFrame = core([webView _frame])) 826 coreFrame->eventHandler().capsLockStateMayHaveChanged(); 827 }); 828 } 817 829 #endif 818 830 … … 2611 2623 addObserver:self selector:@selector(markedTextUpdate:) 2612 2624 name:WebMarkedTextUpdatedNotification object:nil]; 2625 CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), (__bridge const void *)(self), hardwareKeyboardAvailabilityChangedCallback, (CFStringRef)[NSString stringWithUTF8String:kGSEventHardwareKeyboardAvailabilityChangedNotification], nullptr, CFNotificationSuspensionBehaviorCoalesce); 2613 2626 #endif 2614 2627 … … 2627 2640 #if PLATFORM(IOS_FAMILY) 2628 2641 [[NSNotificationCenter defaultCenter] removeObserver:self name:WebMarkedTextUpdatedNotification object:nil]; 2642 CFNotificationCenterRemoveObserver(CFNotificationCenterGetDarwinNotifyCenter(), (__bridge const void *)(self), (CFStringRef)[NSString stringWithUTF8String:kGSEventHardwareKeyboardAvailabilityChangedNotification], nullptr); 2629 2643 #endif 2630 2644 -
trunk/WebKitLibraries/ChangeLog
r238062 r238078 1 2018-11-11 Daniel Bates <dabates@apple.com> 2 3 [iOS] Draw caps lock indicator in password fields 4 https://bugs.webkit.org/show_bug.cgi?id=190565 5 <rdar://problem/45262343> 6 7 Reviewed by Dean Jackson. 8 9 Expose some more symbols. 10 11 * WebKitPrivateFrameworkStubs/iOS/12/GraphicsServices.framework/GraphicsServices.tbd: 12 1 13 2018-11-09 Ryan Haddad <ryanhaddad@apple.com> 2 14 -
trunk/WebKitLibraries/WebKitPrivateFrameworkStubs/iOS/12/GraphicsServices.framework/GraphicsServices.tbd
r238062 r238078 16 16 symbols: 17 17 - _GSCurrentEventTimestamp 18 - _GSEventIsHardwareKeyboardAttached 18 19 - _GSFontInitialize 19 20 - _GSFontPurgeFontCache 20 21 - _GSInitialize 22 - _GSKeyboardGetModifierState 21 23 - _GSSystemRootDirectory 24 - _kGSEventHardwareKeyboardAvailabilityChangedNotification 22 25 install-name: /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices 23 26 objc-constraint: none
Note: See TracChangeset
for help on using the changeset viewer.