WebCore:
authoradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Oct 2007 21:05:22 +0000 (21:05 +0000)
committeradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Oct 2007 21:05:22 +0000 (21:05 +0000)
        Reviewed by Darin.

        WebCore part of fix for http://bugs.webkit.org/show_bug.cgi?id=10577
        <rdar://problem/5103625> REGRESSION: Caps lock icon should show in password fields

        Test: manual-tests/password-caps-lock.html

        * WebCore.base.exp: Added symbol for capsLockStateMayHaveChanged.

        * page/Frame.cpp: (WebCore::Frame::setIsActive): Calls capsLockStateMayHaveChanged.
        * page/EventHandler.cpp: (WebCore::EventHandler::capsLockStateMayHaveChanged): Added. Tells the focused node's renderer that the capsLockStateMayHaveChanged.
        * page/EventHandler.h:

        * platform/PlatformKeyboardEvent.h:
        * platform/mac/KeyEventMac.mm: (WebCore::PlatformKeyboardEvent::currentCapsLockState): Added.
        * platform/win/KeyEventWin.cpp: (WebCore::PlatformKeyboardEvent::currentCapsLockState): Added.

        * rendering/RenderTextControl.cpp:
        (WebCore::RenderTextControl::RenderTextControl):
        (WebCore::RenderTextControl::paint): Added.  If m_shouldDrawCapsLockIndicator is true, paints the caps lock indicator after the background.
        (WebCore::RenderTextControl::forwardEvent): When the control gets and loses focus, update the caps lock state.
        (WebCore::RenderTextControl::capsLockStateMayHaveChanged): Added. Updates m_shouldDrawCapsLockIndicator, which is true if the field is a password field,
         and the frame is active, and the element is focused, and the caps lock is on.  Causes a repaint when m_shouldDrawCapsLockIndicator changes state.
        * rendering/RenderTextControl.h: Added m_shouldDrawCapsLockIndicator.
        * rendering/RenderObject.h: (WebCore::RenderObject::capsLockStateMayHaveChanged): Added.

        * rendering/RenderTheme.h: (WebCore::RenderTheme::paintCapsLockIndicator): Added.
        * rendering/RenderThemeMac.h:
        * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::paintCapsLockIndicator): Added.  Calls wkDrawCapsLockIndicator.
        * rendering/RenderThemeSafari.cpp: (WebCore::RenderThemeSafari::paintCapsLockIndicator): Added.  Calls paintThemePart for the CapsLockPart.
        * rendering/RenderThemeSafari.h:

WebKit:

        Reviewed by Darin.

        WebKit part of fix for http://bugs.webkit.org/show_bug.cgi?id=10577
        <rdar://problem/5103625> REGRESSION: Caps lock icon should show in password fields

        * WebView/WebHTMLView.mm:
        (-[WebHTMLView flagsChanged:]): Call capsLockStateMayHaveChanged so WebCore knows it may have to update a password field.
        (+[WebHTMLView _postFlagsChangedEvent:]): Added a comment with a Radar number for why this isn't just in flagsChanged.
        (-[WebHTMLView scrollWheel:]): Instead of calling the next responder explicitly, we can just call super, which will take care of this.

win:

        Reviewed by Darin.

        WebKitWin part of fix for http://bugs.webkit.org/show_bug.cgi?id=10577
        <rdar://problem/5110427> REGRESSION: Caps lock icon should show in password fields

        * WebView.cpp: (WebView::keyDown): Call capsLockStateMayHaveChanged so WebCore knows it may have to update a password field.

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

22 files changed:
WebCore/ChangeLog
WebCore/WebCore.base.exp
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/manual-tests/password-caps-lock.html [new file with mode: 0644]
WebCore/page/EventHandler.cpp
WebCore/page/EventHandler.h
WebCore/page/Frame.cpp
WebCore/platform/PlatformKeyboardEvent.h
WebCore/platform/mac/KeyEventMac.mm
WebCore/platform/win/KeyEventWin.cpp
WebCore/rendering/RenderObject.h
WebCore/rendering/RenderTextControl.cpp
WebCore/rendering/RenderTextControl.h
WebCore/rendering/RenderTheme.h
WebCore/rendering/RenderThemeMac.h
WebCore/rendering/RenderThemeMac.mm
WebCore/rendering/RenderThemeSafari.cpp
WebCore/rendering/RenderThemeSafari.h
WebKit/ChangeLog
WebKit/WebView/WebHTMLView.mm
WebKit/win/ChangeLog
WebKit/win/WebView.cpp

index 0fa84c04a20b38d9bd3b69275c544242d6cf84e2..73fbc63c3944eb94c3d48f678aeeed6dc0e33d40 100644 (file)
@@ -1,3 +1,37 @@
+2007-10-30  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Darin.
+
+        WebCore part of fix for http://bugs.webkit.org/show_bug.cgi?id=10577
+        <rdar://problem/5103625> REGRESSION: Caps lock icon should show in password fields
+
+        Test: manual-tests/password-caps-lock.html
+
+        * WebCore.base.exp: Added symbol for capsLockStateMayHaveChanged.
+
+        * page/Frame.cpp: (WebCore::Frame::setIsActive): Calls capsLockStateMayHaveChanged.
+        * page/EventHandler.cpp: (WebCore::EventHandler::capsLockStateMayHaveChanged): Added. Tells the focused node's renderer that the capsLockStateMayHaveChanged.
+        * page/EventHandler.h:
+
+        * platform/PlatformKeyboardEvent.h:
+        * platform/mac/KeyEventMac.mm: (WebCore::PlatformKeyboardEvent::currentCapsLockState): Added.
+        * platform/win/KeyEventWin.cpp: (WebCore::PlatformKeyboardEvent::currentCapsLockState): Added.
+
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::RenderTextControl):
+        (WebCore::RenderTextControl::paint): Added.  If m_shouldDrawCapsLockIndicator is true, paints the caps lock indicator after the background.
+        (WebCore::RenderTextControl::forwardEvent): When the control gets and loses focus, update the caps lock state.
+        (WebCore::RenderTextControl::capsLockStateMayHaveChanged): Added. Updates m_shouldDrawCapsLockIndicator, which is true if the field is a password field, 
+         and the frame is active, and the element is focused, and the caps lock is on.  Causes a repaint when m_shouldDrawCapsLockIndicator changes state.
+        * rendering/RenderTextControl.h: Added m_shouldDrawCapsLockIndicator.
+        * rendering/RenderObject.h: (WebCore::RenderObject::capsLockStateMayHaveChanged): Added.
+
+        * rendering/RenderTheme.h: (WebCore::RenderTheme::paintCapsLockIndicator): Added.
+        * rendering/RenderThemeMac.h:
+        * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::paintCapsLockIndicator): Added.  Calls wkDrawCapsLockIndicator.
+        * rendering/RenderThemeSafari.cpp: (WebCore::RenderThemeSafari::paintCapsLockIndicator): Added.  Calls paintThemePart for the CapsLockPart.
+        * rendering/RenderThemeSafari.h:
+
 2007-10-30  David Hyatt  <hyatt@apple.com>
 
         Land support for implicit animation in CSS.
index 373416a8c6cbc87d37bcb31b6a6dca42c1086a4e..1a67d59cd670038c6bedfe7d694dcf2154ff36d6 100644 (file)
@@ -206,6 +206,7 @@ __ZN7WebCore12EventHandler14currentNSEventEv
 __ZN7WebCore12EventHandler20handleTextInputEventERKNS_6StringEPNS_5EventEbb
 __ZN7WebCore12EventHandler20hitTestResultAtPointERKNS_8IntPointEb
 __ZN7WebCore12EventHandler20sendContextMenuEventERKNS_18PlatformMouseEventE
+__ZN7WebCore12EventHandler27capsLockStateMayHaveChangedEv
 __ZN7WebCore12EventHandler7mouseUpEP7NSEvent
 __ZN7WebCore12EventHandler8keyEventEP7NSEvent
 __ZN7WebCore12EventHandler9mouseDownEP7NSEvent
index a0699847c002b6de313a9dd3cad533824fad26ad..ccb1f1448b49731c752bfe96d7e52be1f92c490d 100644 (file)
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
+                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
diff --git a/WebCore/manual-tests/password-caps-lock.html b/WebCore/manual-tests/password-caps-lock.html
new file mode 100644 (file)
index 0000000..d63e433
--- /dev/null
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+        "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+<head>
+</head>
+<body onload="document.getElementById('tf').focus()">
+<p><b>BUG ID:</b> <a href="http://bugs.webkit.org/show_bug.cgi?id=10577">10577</a> Caps lock icon should show in password fields</p>
+
+<p id="test" style="background-color:skyblue; padding:3px;"><b>STEPS TO TEST:</b> 
+Press the caps lock key.
+</p>
+
+<p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b> 
+Verify that the caps lock indicator icon is drawn in the password field. Verify that when you open a new window, the password field in the background window no longer has an indicator.
+</p>
+
+<p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>  
+If there is no caps lock indicator, or if the indicator remains when the window is inactive, the test has failed.
+</p>
+
+<input type="password" id="tf">
+
+</body>
+</html>
index 083ec5f209910c3fbc70d0281216d216da3d9b9e..72b6cc9f52223f3d0735437b76128cb2ca640aa7 100644 (file)
@@ -1760,4 +1760,12 @@ void EventHandler::defaultTabEventHandler(Event* event, bool isBackTab)
         event->setDefaultHandled();
 }
 
+void EventHandler::capsLockStateMayHaveChanged()
+{
+    if (Document* d = m_frame->document())
+        if (Node* node = d->focusedNode())
+            if (RenderObject* r = node->renderer())
+                r->capsLockStateMayHaveChanged();
+} 
+
 }
index 92342dd436ba20c41c14327c7a1192ce04abceed..ec74d5301c80cfc296df501d288f978808819880 100644 (file)
@@ -146,6 +146,8 @@ public:
 
     void focusDocumentView();
 
+    void capsLockStateMayHaveChanged();
+    
 #if PLATFORM(MAC)
     PassRefPtr<KeyboardEvent> currentKeyboardEvent() const;
 
index c6eb8d562812d6bfcf01eca68b192911949287f2..1e9b133b96c491892df874ce0a7845c146485d19 100644 (file)
@@ -1564,6 +1564,9 @@ void Frame::setIsActive(bool flag)
         setSelectionFromNone();
     setCaretVisible(flag);
 
+    // Update for caps lock state
+    eventHandler()->capsLockStateMayHaveChanged();
+
     // Because CSSStyleSelector::checkOneSelector() and
     // RenderTheme::isFocused() check if the frame is active, we have to
     // update style and theme state that depended on those.
index 296963c319feb464d556a6bd1b461330f4846adb..2368f6fc8e09ce5c7519e7be8b8b67b13b37ac5f 100644 (file)
@@ -74,6 +74,8 @@ namespace WebCore {
         bool altKey() const { return m_altKey; }
         bool metaKey() const { return m_metaKey; }
 
+        static bool currentCapsLockState();
+
 #if PLATFORM(MAC)
         PlatformKeyboardEvent(NSEvent*, bool forceAutoRepeat = false);
         NSEvent* macEvent() const { return m_macEvent.get(); }
index c7348f8ec678a8bb0f11e985e7e2133a1c1663de..71adc3275bedbbfac2be3ba434d3512c1f0e4d42 100644 (file)
@@ -27,6 +27,7 @@
 #import "PlatformKeyboardEvent.h"
 
 #import "Logging.h"
+#import <Carbon/Carbon.h>
 #import <wtf/ASCIICType.h>
 
 using namespace WTF;
@@ -733,4 +734,9 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(NSEvent *event, bool forceAutoRepea
     }
 }
 
+bool PlatformKeyboardEvent::currentCapsLockState()
+{
+    return GetCurrentKeyModifiers() & alphaLock;
+}
+
 }
index 7147cb25d826dd2f1a8ba4da5e020726e288fbac..c1bb6acb08ebe40be5765154576cff9699cb1c42 100644 (file)
@@ -154,4 +154,9 @@ PlatformKeyboardEvent::PlatformKeyboardEvent(HWND, WPARAM virtualKeyCode, LPARAM
 {
 }
 
+bool PlatformKeyboardEvent::currentCapsLockState()
+{
+     return GetKeyState(VK_CAPITAL) & 1;
+}
+
 }
index 2845014b1b05f9c15c1473eb9fc954d818ca6ca2..3203bb64ec6d3136d295c48d8fc746ea0d8dc898 100644 (file)
@@ -862,6 +862,8 @@ public:
     void invalidateVerticalPosition() { m_verticalPosition = PositionUndefined; }
     
     virtual void removeLeftoverAnonymousBlock(RenderBlock* child);
+    
+    virtual void capsLockStateMayHaveChanged() { }
 
     AnimationController* animationController() const;
 
index c4d684bde28cb2da6f3938943cbb1e0850913892..8df160724dc969e10d79375fa1cae3d037a3e4d1 100644 (file)
@@ -38,6 +38,7 @@
 #include "HitTestResult.h"
 #include "LocalizedStrings.h"
 #include "MouseEvent.h"
+#include "PlatformKeyboardEvent.h"
 #include "PlatformScrollBar.h"
 #include "RenderTheme.h"
 #include "SearchPopupMenu.h"
@@ -77,6 +78,7 @@ RenderTextControl::RenderTextControl(Node* node, bool multiLine)
     , m_multiLine(multiLine)
     , m_placeholderVisible(false)
     , m_userEdited(false)
+    , m_shouldDrawCapsLockIndicator(false)
     , m_searchPopup(0)
     , m_searchPopupIsVisible(false)
     , m_searchEventTimer(this, &RenderTextControl::searchEventTimerFired)
@@ -827,6 +829,13 @@ void RenderTextControl::layout()
     }
 }
 
+void RenderTextControl::paint(PaintInfo& paintInfo, int tx, int ty)
+{
+    RenderBlock::paint(paintInfo, tx, ty);
+    if (paintInfo.phase == PaintPhaseBlockBackground && m_shouldDrawCapsLockIndicator)
+        theme()->paintCapsLockIndicator(this, paintInfo, absoluteContentBox());
+} 
+
 void RenderTextControl::calcPrefWidths()
 {
     ASSERT(prefWidthsDirty());
@@ -895,9 +904,11 @@ void RenderTextControl::forwardEvent(Event* evt)
                 innerLayer->scrollToOffset(style()->direction() == RTL ? innerLayer->scrollWidth() : 0, 0);
         }
         updatePlaceholder();
-    } else if (evt->type() == focusEvent)
+        capsLockStateMayHaveChanged();
+    } else if (evt->type() == focusEvent) {
         updatePlaceholder();
-    else {
+        capsLockStateMayHaveChanged();
+    } else {
         if (evt->isMouseEvent() && m_resultsButton && static_cast<MouseEvent*>(evt)->x() < m_innerText->renderer()->absoluteBoundingBoxRect().x())
             m_resultsButton->defaultEventHandler(evt);
         else if (evt->isMouseEvent() && m_cancelButton && static_cast<MouseEvent*>(evt)->x() > m_innerText->renderer()->absoluteBoundingBoxRect().right())
@@ -1193,4 +1204,25 @@ FontSelector* RenderTextControl::fontSelector() const
     return document()->styleSelector()->fontSelector();
 }
 
+void RenderTextControl::capsLockStateMayHaveChanged()
+{
+    // Only draw the caps lock indicator if these things are true:
+    // 1) The field is a password field
+    // 2) The frame is active
+    // 3) The element is focused
+    // 4) The caps lock is on
+
+    bool shouldDrawCapsLockIndicator = false;
+    if (Node* n = node())
+        if (Document* d = document())
+            if (Frame* f = d->frame())
+                shouldDrawCapsLockIndicator = !m_multiLine && static_cast<HTMLInputElement*>(n)->inputType() == HTMLInputElement::PASSWORD && 
+                                               f->isActive() && d->focusedNode() == n && PlatformKeyboardEvent::currentCapsLockState();
+
+    if (shouldDrawCapsLockIndicator != m_shouldDrawCapsLockIndicator) {
+        m_shouldDrawCapsLockIndicator = shouldDrawCapsLockIndicator;
+        repaint();
+    }
+}
+
 } // namespace WebCore
index a38f645d8fff16868d171496673708b73aec9b81..303b9eadc57d609b59b1d78033c1934f1f183a25 100644 (file)
@@ -54,7 +54,8 @@ public:
     virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
     virtual void layout();
     virtual bool avoidsFloats() const { return true; }
-
+    virtual void paint(PaintInfo&, int tx, int ty);
+    
     virtual bool isEdited() const { return m_dirty; }
     virtual void setEdited(bool isEdited) { m_dirty = isEdited; }
     virtual bool isTextField() const { return !m_multiLine; }
@@ -103,6 +104,8 @@ public:
     
     bool placeholderIsVisible() const { return m_placeholderVisible; }
 
+    virtual void capsLockStateMayHaveChanged();
+
 private:
     // PopupMenuClient methods
     virtual void valueChanged(unsigned listIndex, bool fireEvents = true);
@@ -146,7 +149,8 @@ private:
     bool m_multiLine;
     bool m_placeholderVisible;
     bool m_userEdited;
-
+    bool m_shouldDrawCapsLockIndicator;
+    
     RefPtr<SearchPopupMenu> m_searchPopup;
     bool m_searchPopupIsVisible;
     mutable Vector<String> m_recentSearches;
index b8a767f25be1e4bc9c995df447c9956acc2b463b..6366ff1ca1890fffca65906c8a539552da2fa600 100644 (file)
@@ -139,6 +139,9 @@ public:
     virtual int popupInternalPaddingRight(RenderStyle*) const { return 0; }
     virtual int popupInternalPaddingTop(RenderStyle*) const { return 0; }
     virtual int popupInternalPaddingBottom(RenderStyle*) const { return 0; }
+    
+    // Method for painting the caps lock indicator
+    virtual bool paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo&, const IntRect&) { return 0; };
 
 protected:
     // Methods for each appearance value.
index 37a543894f54fb7c2663da8ad0b66e13643630f2..59be0acedc35d5bda05e5c135cdca783944bcffa 100644 (file)
@@ -74,6 +74,8 @@ public:
     virtual int popupInternalPaddingRight(RenderStyle*) const;
     virtual int popupInternalPaddingTop(RenderStyle*) const;
     virtual int popupInternalPaddingBottom(RenderStyle*) const;
+    
+    virtual bool paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
 
 protected:
     // Methods for each appearance value.
index 35c316d063ab78d0e8178188c5c0a33e251dd21e..16ab241552188074bc8f12ff713a57c842ca6b97 100644 (file)
@@ -668,6 +668,16 @@ void RenderThemeMac::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Eleme
 {
 }
 
+bool RenderThemeMac::paintCapsLockIndicator(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
+{
+    if (paintInfo.context->paintingDisabled())
+        return true;
+
+    wkDrawCapsLockIndicator(paintInfo.context->platformContext(), r);
+    
+    return false;
+}
+
 bool RenderThemeMac::paintTextArea(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
 {
     LocalCurrentGraphicsContext localContext(paintInfo.context);
index 4b6a71c4dcce22f5da74090f9de31fe38e418d4f..99500de3b7e59c48c5316f340016596de35a540f 100644 (file)
@@ -547,6 +547,20 @@ void RenderThemeSafari::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, El
 {
 }
 
+bool RenderThemeSafari::paintCapsLockIndicator(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
+{    
+#if defined(SAFARI_THEME_VERSION) && SAFARI_THEME_VERSION >= 1
+    if (paintInfo.context->paintingDisabled())
+        return true;
+
+    paintThemePart(CapsLockPart, paintInfo.context->platformContext(), r, (NSControlSize)0, (ThemeControlState)0);
+
+    return false;
+#else
+    return true;
+#endif
+}
+
 bool RenderThemeSafari::paintTextArea(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
 {
     paintThemePart(TextAreaPart, paintInfo.context->platformContext(), r, (NSControlSize)0, determineState(o) & ~FocusedState);
index d2eeb6bfd31c733570d9b9f0372a712d6bfd75bf..9e964c6ec8b9ce85813437759b0a0003a0d6644e 100644 (file)
@@ -118,7 +118,8 @@ protected:
 
     virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
     virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
-
+    virtual bool paintCapsLockIndicator(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
 private:
     IntRect inflateRect(const IntRect&, const IntSize&, const int* margins) const;
 
index 3058abdf2a43863da4ba424e518a53184a7dbf17..acbc5bb6dcf27eb53d6aedd63225b335a4d8d468 100644 (file)
@@ -1,3 +1,15 @@
+2007-10-30  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Darin.
+
+        WebKit part of fix for http://bugs.webkit.org/show_bug.cgi?id=10577
+        <rdar://problem/5103625> REGRESSION: Caps lock icon should show in password fields
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView flagsChanged:]): Call capsLockStateMayHaveChanged so WebCore knows it may have to update a password field.
+        (+[WebHTMLView _postFlagsChangedEvent:]): Added a comment with a Radar number for why this isn't just in flagsChanged.
+        (-[WebHTMLView scrollWheel:]): Instead of calling the next responder explicitly, we can just call super, which will take care of this.
+
 2007-10-27  Mark Ambachtsheer  <mark.a@apple.com>
 
         Reviewed by Darin.
index cae8b892adde09903a1614232311df6cfc8f5446..7171e423b3b6cd50f16849f3123c3e345cde429b 100644 (file)
@@ -958,6 +958,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
 
 + (void)_postFlagsChangedEvent:(NSEvent *)flagsChangedEvent
 {
+    // This is a workaround for: <rdar://problem/2981619> NSResponder_Private should include notification for FlagsChanged
     NSEvent *fakeEvent = [NSEvent mouseEventWithType:NSMouseMoved
         location:[[flagsChangedEvent window] convertScreenToBase:[NSEvent mouseLocation]]
         modifierFlags:[flagsChangedEvent modifierFlags]
@@ -2988,7 +2989,7 @@ static void _updateActiveStateTimerCallback(CFRunLoopTimerRef timer, void *info)
     [self retain];
     Frame* frame = core([self _frame]);
     if (!frame || !frame->eventHandler()->wheelEvent(event))
-        [[self nextResponder] scrollWheel:event];    
+        [super scrollWheel:event];
     [self release];
 }
 
@@ -3584,6 +3585,13 @@ noPromisedData:
     [self release];
 }
 
+- (void)flagsChanged:(NSEvent *)event
+{
+    if (Frame* frame = core([self _frame]))
+        frame->eventHandler()->capsLockStateMayHaveChanged();
+    [super flagsChanged:event];
+}
+
 - (id)accessibilityAttributeValue:(NSString*)attributeName
 {
     if ([attributeName isEqualToString: NSAccessibilityChildrenAttribute]) {
index 38001bdb4e01982b94278c6d2013692d0b4eddb9..030e5d30b9cb49801f4ef719453598dd9717af12 100644 (file)
@@ -1,3 +1,12 @@
+2007-10-30  Adele Peterson  <adele@apple.com>
+
+        Reviewed by Darin.
+
+        WebKitWin part of fix for http://bugs.webkit.org/show_bug.cgi?id=10577
+        <rdar://problem/5110427> REGRESSION: Caps lock icon should show in password fields
+
+        * WebView.cpp: (WebView::keyDown): Call capsLockStateMayHaveChanged so WebCore knows it may have to update a password field.
+
 2007-10-29  Kevin McCullough  <kmccullough@apple.com>
 
         Reviewed by Adam and Maciej.
index e596bce99960cd4b025413283ce849b9c5475466..b4101f5cb96e892c7795e9b5c9d98e99b22f43bb 100644 (file)
@@ -1371,6 +1371,10 @@ bool WebView::handleEditingKeyboardEvent(KeyboardEvent* evt)
 
 bool WebView::keyDown(WPARAM virtualKeyCode, LPARAM keyData, bool systemKeyDown)
 {
+    Frame* frame = m_page->focusController()->focusedOrMainFrame();
+    if (virtualKeyCode == VK_CAPITAL)
+        frame->eventHandler()->capsLockStateMayHaveChanged();
+
     // Don't send key events for shift, ctrl, alt and capslock keys when they're by themselves
     if (virtualKeyCode == VK_SHIFT || virtualKeyCode == VK_CONTROL ||  virtualKeyCode == VK_MENU || virtualKeyCode == VK_CAPITAL)
         return false;
@@ -1396,7 +1400,6 @@ bool WebView::keyDown(WPARAM virtualKeyCode, LPARAM keyData, bool systemKeyDown)
         virtualKeyCode = MapVirtualKey(LOBYTE(HIWORD(keyData)), 1);
 
     PlatformKeyboardEvent keyEvent(m_viewWindow, virtualKeyCode, keyData, m_currentCharacterCode);
-    Frame* frame = m_page->focusController()->focusedOrMainFrame();
     bool handled = frame->eventHandler()->keyEvent(keyEvent);
     m_inIMEKeyDown = false;
     if (handled)