WebCore:
authoradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Aug 2006 01:50:51 +0000 (01:50 +0000)
committeradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Aug 2006 01:50:51 +0000 (01:50 +0000)
        Reviewed by Hyatt.

        WebCore part of fix for  http://bugzilla.opendarwin.org/show_bug.cgi?id=10575
        Enable secure input mode for new password fields

        * WebCore.exp: Added wkSetSecureEventInput and wkSecureEventInput.
        * platform/mac/WebCoreSystemInterface.h: ditto.
        * platform/mac/WebCoreSystemInterface.mm: ditto.

        * page/Frame.cpp: (WebCore::Frame::setIsActive): Enables and disables secure keyboard entry based on whether the frame becomes active.
        * bridge/mac/FrameMac.h:
        * bridge/mac/FrameMac.mm:
        (WebCore::FrameMac::setSecureKeyboardEntry): Added. Calls wkSetSecureEventInput.
        (WebCore::FrameMac::secureKeyboardEntry): Added. Calls wkSecureEventInput.
        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::dispatchFocusEvent): For password fields, enable secure keyboard entry.
        (WebCore::HTMLInputElement::dispatchBlurEvent): For password fields, disable secure keyboard entry.
        * page/Frame.h:
        (WebCore::Frame::setSecureKeyboardEntry):
        (WebCore::Frame::secureKeyboardEntry):

WebKit:

        Reviewed by Hyatt.

        WebKit part of fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=10575
        Enable secure input mode for new password fields

        * WebCoreSupport/WebSystemInterface.m: (InitWebCoreSystemInterface):

WebKitLibraries:

        Reviewed by Hyatt.

        Updated for http://bugzilla.opendarwin.org/show_bug.cgi?id=10575
        Enable secure input mode for new password fields

        * WebKitSystemInterface.h: Added WKSetSecureEventInput and WKSecureEventInput;
        * libWebKitSystemInterface.a:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16136 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
WebCore/ChangeLog
WebCore/WebCore.exp
WebCore/bridge/mac/FrameMac.h
WebCore/bridge/mac/FrameMac.mm
WebCore/html/HTMLInputElement.cpp
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebCore/platform/mac/WebCoreSystemInterface.h
WebCore/platform/mac/WebCoreSystemInterface.mm
WebKit/ChangeLog
WebKit/WebCoreSupport/WebSystemInterface.m
WebKitLibraries/ChangeLog
WebKitLibraries/WebKitSystemInterface.h
WebKitLibraries/libWebKitSystemInterface.a

index 4e972ba0096c34aae08120f7b0d9ddb68b700cf6..a2ad092328569faab013f917098544ec72ea7145 100644 (file)
@@ -1,3 +1,26 @@
+2006-08-30  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Hyatt.
+
+        WebCore part of fix for  http://bugzilla.opendarwin.org/show_bug.cgi?id=10575
+        Enable secure input mode for new password fields
+
+        * WebCore.exp: Added wkSetSecureEventInput and wkSecureEventInput.
+        * platform/mac/WebCoreSystemInterface.h: ditto.
+        * platform/mac/WebCoreSystemInterface.mm: ditto.
+
+        * page/Frame.cpp: (WebCore::Frame::setIsActive): Enables and disables secure keyboard entry based on whether the frame becomes active.
+        * bridge/mac/FrameMac.h:
+        * bridge/mac/FrameMac.mm:
+        (WebCore::FrameMac::setSecureKeyboardEntry): Added. Calls wkSetSecureEventInput.
+        (WebCore::FrameMac::secureKeyboardEntry): Added. Calls wkSecureEventInput.
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::dispatchFocusEvent): For password fields, enable secure keyboard entry.
+        (WebCore::HTMLInputElement::dispatchBlurEvent): For password fields, disable secure keyboard entry.
+        * page/Frame.h:
+        (WebCore::Frame::setSecureKeyboardEntry):
+        (WebCore::Frame::secureKeyboardEntry):
+
 2006-08-30  Darin Adler  <darin@apple.com>
 
         Reviewed by Tim Hatcher.
index 86e6c8e5bceef6ee2647ae596cca3bb4d790ee47..77d1738c82535abd508177547b5e088306e618f4 100644 (file)
@@ -154,10 +154,12 @@ _wkInitializeGlyphVector
 _wkPathFromFont
 _wkPopupMenu
 _wkReleaseStyleGroup
+_wkSecureEventInput
 _wkSetCGFontRenderingMode
 _wkSetDragImage
 _wkSetNSURLConnectionDefersCallbacks
 _wkSetPatternPhaseInUserSpace
+_wkSetSecureEventInput
 _wkSetUpFontCache
 _wkSignalCFReadStreamEnd
 _wkSignalCFReadStreamError
index dbd134c2ca0113a4af3324d50f9da8e11d9bd982..909fe9757e5acb28724890ec46e0044ef12a30de 100644 (file)
@@ -279,6 +279,9 @@ public:
     virtual void textDidChangeInTextArea(Element*);
     
     virtual bool inputManagerHasMarkedText() const;
+    
+    virtual void setSecureKeyboardEntry(bool);
+    virtual bool secureKeyboardEntry();
 
     KJS::Bindings::RootObject* executionContextForDOM();
     KJS::Bindings::RootObject* bindingRootObject();
index 04f45bec2e4ffc25c3f70a70ef340389f16b19fc..0830f955d1a407f6dfd7f157b6c424eecb71aa90 100644 (file)
@@ -47,6 +47,7 @@
 #import "HTMLFormElement.h"
 #import "HTMLFrameElement.h"
 #import "HTMLGenericFormElement.h"
+#import "HTMLInputElement.h"
 #import "HTMLNames.h"
 #import "HTMLTableCellElement.h"
 #import "WebCoreEditCommand.h"
@@ -74,6 +75,7 @@
 #import "htmlediting.h"
 #import "kjs_window.h"
 #import "visible_units.h"
+#import "WebCoreSystemInterface.h"
 #import <JavaScriptCore/NP_jsobject.h>
 #import <JavaScriptCore/npruntime_impl.h>
 
@@ -3337,6 +3339,16 @@ bool FrameMac::inputManagerHasMarkedText() const
     return false;
 }
 
+void FrameMac::setSecureKeyboardEntry(bool enable)
+{
+    wkSetSecureEventInput(enable);
+}
+
+bool FrameMac::secureKeyboardEntry()
+{
+    return wkSecureEventInput();
+}
+
 static DeprecatedValueList<MarkedTextUnderline> convertAttributesToUnderlines(const Range *markedTextRange, NSArray *attributes, NSArray *ranges)
 {
     DeprecatedValueList<MarkedTextUnderline> result;
index 38edfb455f1427d2757f0b00c7cb410b2fd3ded3..57269e9d641f38434b0a6bd04dfb6d4b9e0bca51 100644 (file)
@@ -212,15 +212,21 @@ void HTMLInputElement::aboutToUnload()
 
 void HTMLInputElement::dispatchFocusEvent()
 {
-    if (isNonWidgetTextField())
+    if (isNonWidgetTextField()) {
         setAutofilled(false);
+        if (inputType() == PASSWORD && document()->frame())
+            document()->frame()->setSecureKeyboardEntry(true);
+    }
     HTMLGenericFormElement::dispatchFocusEvent();
 }
 
 void HTMLInputElement::dispatchBlurEvent()
 {
-    if (isNonWidgetTextField() && document()->frame())
+    if (isNonWidgetTextField() && document()->frame()) {
+        if (inputType() == PASSWORD)
+            document()->frame()->setSecureKeyboardEntry(false);
         document()->frame()->textFieldDidEndEditing(static_cast<Element*>(this));
+    }
     HTMLGenericFormElement::dispatchBlurEvent();
 }
 
index 74afd8ac249a83ed05c88f5ba27ce225cce31c1c..4c6b0645ce5bff2caffe43b29be31c4fe96e3910 100644 (file)
@@ -3347,7 +3347,7 @@ void Frame::setIsActive(bool flag)
         }
     }
     
-    // 4, Changing the tint of controls from clear to aqua/graphite and vice versa.  We
+    // 4. Changing the tint of controls from clear to aqua/graphite and vice versa.  We
     // do a "fake" paint.  When the theme gets a paint call, it can then do an invalidate.  This is only
     // done if the theme supports control tinting.
     if (doc && d->m_view && theme()->supportsControlTints() && renderer()) {
@@ -3357,6 +3357,12 @@ void Frame::setIsActive(bool flag)
         context.setUpdatingControlTints(true);
         paint(&context, visibleRect);
     }
+   
+    // 5. Enable or disable secure keyboard entry
+    if ((flag && !secureKeyboardEntry() && doc && doc->focusNode()->hasTagName(inputTag) && 
+            static_cast<HTMLInputElement*>(doc->focusNode())->inputType() == HTMLInputElement::PASSWORD) ||
+        (!flag && secureKeyboardEntry()))
+            setSecureKeyboardEntry(flag);
 }
 
 void Frame::setWindowHasFocus(bool flag)
index 7240f102e752643bcf96e618f605ffebe8512d64..616b9455e704d37d329abfb547d58cec2f1ceead 100644 (file)
@@ -417,6 +417,9 @@ public:
 
   virtual bool inputManagerHasMarkedText() const { return false; }
   
+  virtual void setSecureKeyboardEntry(bool) {};
+  virtual bool secureKeyboardEntry() { return false; }
+  
   /**
    * Returns the most recent edit command applied.
    */
index c952620001fd942b08be93c0d6d199ff35fa3dab..ca47891152408f16701e5e9ecbac2f4427001aa8 100644 (file)
@@ -89,9 +89,11 @@ extern OSStatus (*wkInitializeGlyphVector)(int count, void* glyphs);
 extern NSString* (*wkPathFromFont)(NSFont*);
 extern void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
 extern void (*wkReleaseStyleGroup)(void* group);
+extern BOOL (*wkSecureEventInput)(void);
 extern void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*);
 extern void (*wkSetDragImage)(NSImage*, NSPoint offset);
 extern void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint point);
+extern void (*wkSetSecureEventInput)(BOOL);
 extern void (*wkSetUpFontCache)(size_t);
 extern void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream);
 extern void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream);
index 65bf98201b0d1a6926c84c7ea953d53ff9dadbba..67d4d1769a673586deb5fcc49786fda80b431d3a 100644 (file)
@@ -49,9 +49,11 @@ OSStatus (*wkInitializeGlyphVector)(int count, void* glyphs);
 NSString* (*wkPathFromFont)(NSFont*);
 void (*wkPopupMenu)(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*);
 void (*wkReleaseStyleGroup)(void* group);
+BOOL (*wkSecureEventInput)(void);
 void (*wkSetCGFontRenderingMode)(CGContextRef, NSFont*);
 void (*wkSetDragImage)(NSImage*, NSPoint offset);
 void (*wkSetPatternPhaseInUserSpace)(CGContextRef, CGPoint point);
+void (*wkSetSecureEventInput)(BOOL);
 void (*wkSetUpFontCache)(size_t);
 void (*wkSignalCFReadStreamEnd)(CFReadStreamRef stream);
 void (*wkSignalCFReadStreamHasBytes)(CFReadStreamRef stream);
@@ -67,3 +69,4 @@ CFReadStreamRef (*wkCreateCustomCFReadStream)(void *(*formCreate)(CFReadStreamRe
     void *context);
 void (*wkSetNSURLConnectionDefersCallbacks)(NSURLConnection *, BOOL);
 id (*wkCreateNSURLConnectionDelegateProxy)(void);
+
index 1da3258135e0fb1005aaae2536e2eab13c057b10..1c598b41b54906ed5741632464780517b800582e 100644 (file)
@@ -1,3 +1,12 @@
+2006-08-30  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Hyatt.
+
+        WebKit part of fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=10575
+        Enable secure input mode for new password fields
+
+        * WebCoreSupport/WebSystemInterface.m: (InitWebCoreSystemInterface):
+
 2006-08-30  Brady Eidson  <beidson@apple.com>
 
         Reviewed by John
index f73629de99b9771bc46449637ee6b5ef011df92b..dcc53c58b4bbf9ff3b53b0688f53aca2086c7bac 100644 (file)
@@ -62,9 +62,11 @@ void InitWebCoreSystemInterface(void)
     INIT(PathFromFont);
     INIT(PopupMenu);
     INIT(ReleaseStyleGroup);
+    INIT(SecureEventInput);
     INIT(SetCGFontRenderingMode);
     INIT(SetDragImage);
     INIT(SetPatternPhaseInUserSpace);
+    INIT(SetSecureEventInput);
     INIT(SetUpFontCache);
     INIT(SignalCFReadStreamEnd);
     INIT(SignalCFReadStreamHasBytes);
index d2933446ae04ea32510cba066c692dedc46de055..192d9c218aa1066ce6932397795fb46d335693c5 100644 (file)
@@ -1,3 +1,13 @@
+2006-08-30  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Hyatt.
+
+        Updated for http://bugzilla.opendarwin.org/show_bug.cgi?id=10575
+        Enable secure input mode for new password fields
+
+        * WebKitSystemInterface.h: Added WKSetSecureEventInput and WKSecureEventInput;
+        * libWebKitSystemInterface.a:
+
 2006-07-09  Anders Carlsson  <acarlsson@apple.com>
 
         Reviewed by Darin.
index f7128e9a44b823465ce92faf7e6a77de19b33f00..701e6ea008a5f8c7d830a9efb1e9262697c501b9 100644 (file)
@@ -51,6 +51,9 @@ WKNSURLConnectionDelegateProxyPtr WKCreateNSURLConnectionDelegateProxy(void);
 
 void WKDisableCGDeferredUpdates(void);
 
+void WKSetSecureEventInput(BOOL enable);
+BOOL WKSecureEventInput(void);
+
 Class WKNSURLProtocolClassForReqest(NSURLRequest *request);
 
 unsigned WKGetNSAutoreleasePoolCount(void);
index eaf262baa35ee17b7e8442ddd5bdb630d0978d2e..249cbe2a8869b48fc1fce732d4161ee0007467f9 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterface.a and b/WebKitLibraries/libWebKitSystemInterface.a differ