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 4e972ba..a2ad092 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 86e6c8e..77d1738 100644 (file)
@@ -154,10 +154,12 @@ _wkInitializeGlyphVector
 _wkPathFromFont
 _wkPopupMenu
 _wkReleaseStyleGroup
+_wkSecureEventInput
 _wkSetCGFontRenderingMode
 _wkSetDragImage
 _wkSetNSURLConnectionDefersCallbacks
 _wkSetPatternPhaseInUserSpace
+_wkSetSecureEventInput
 _wkSetUpFontCache
 _wkSignalCFReadStreamEnd
 _wkSignalCFReadStreamError
index dbd134c..909fe97 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 04f45be..0830f95 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 38edfb4..57269e9 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 74afd8a..4c6b064 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 7240f10..616b945 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 c952620..ca47891 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 65bf982..67d4d17 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 1da3258..1c598b4 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 f73629d..dcc53c5 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 d293344..192d9c2 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 f7128e9..701e6ea 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 eaf262b..249cbe2 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterface.a and b/WebKitLibraries/libWebKitSystemInterface.a differ