Changeset 54082 in webkit
- Timestamp:
- Jan 29, 2010 3:39:41 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r54078 r54082 1 2010-01-29 Victor Wang <victorw@chromium.org> 2 3 Reviewed by darin@apple.com. 4 5 Fix the issue that both main frome and iframe are 6 focused if window.onblur calls window.focus. 7 https://bugs.webkit.org/show_bug.cgi?id=31692 8 9 The problem is caused by the focused frame in FocusController 10 is messed up if window.onblur calls window.focus: 11 When user clicks iframe to switch focus from main frame to iframe, 12 FocusController::setFocusedFrame fires onblur event, which calls 13 window.focus and then calls setFocusedFrame again to switch back. 14 This messes up the old focused frame and new focused frame and 15 leaves the FocusController confused. As a result, controlls 16 in both main frame and iframe look like get focused. 17 18 To fix it, add a flag to FocusController and do no switch the focused 19 frame when FocusController is in the middle of changing the focused frame. 20 21 * fast/events/change-frame-focus-expected.txt: Added. 22 * fast/events/change-frame-focus.html: Added. 23 1 24 2010-01-28 Jon Honeycutt <jhoneycutt@apple.com> 2 25 -
trunk/WebCore/ChangeLog
r54081 r54082 1 2010-01-29 Victor Wang <victorw@chromium.org> 2 3 Reviewed by darin@apple.com. 4 5 Fix the issue that both main frome and iframe are 6 focused if window.onblur calls window.focus. 7 https://bugs.webkit.org/show_bug.cgi?id=31692 8 9 The problem is caused by the focused frame in FocusController 10 is messed up if window.onblur calls window.focus: 11 When user clicks iframe to switch focus from main frame to iframe, 12 FocusController::setFocusedFrame fires onblur event, which calls 13 window.focus and then calls setFocusedFrame again to switch back. 14 This messes up the old focused frame and new focused frame and 15 leaves the FocusController confused. As a result, controlls 16 in both main frame and iframe look like get focused. 17 18 To fix it, add a flag to FocusController and do no switch the focused 19 frame when FocusController is in the middle of changing the focused frame. 20 21 Test: fast/events/change-frame-focus.html 22 23 * page/FocusController.cpp: 24 (WebCore::FocusController::FocusController): 25 (WebCore::FocusController::setFocusedFrame): 26 * page/FocusController.h: 27 (WebCore::FocusController::focusedFrame): 28 (WebCore::FocusController::isActive): 29 (WebCore::FocusController::isFocused): 30 1 31 2010-01-29 Alexey Proskuryakov <ap@apple.com> 2 32 -
trunk/WebCore/page/FocusController.cpp
r48701 r54082 39 39 #include "ExceptionCode.h" 40 40 #include "Frame.h" 41 #include "FrameTree.h" 41 42 #include "FrameView.h" 42 #include "FrameTree.h"43 43 #include "HTMLFrameOwnerElement.h" 44 44 #include "HTMLNames.h" … … 73 73 , m_isActive(false) 74 74 , m_isFocused(false) 75 , m_isChangingFocusedFrame(false) 75 76 { 76 77 } … … 78 79 void FocusController::setFocusedFrame(PassRefPtr<Frame> frame) 79 80 { 80 if (m_focusedFrame == frame) 81 return; 81 if (m_focusedFrame == frame || m_isChangingFocusedFrame) 82 return; 83 84 m_isChangingFocusedFrame = true; 82 85 83 86 RefPtr<Frame> oldFrame = m_focusedFrame; … … 96 99 newFrame->document()->dispatchWindowEvent(Event::create(eventNames().focusEvent, false, false)); 97 100 } 101 102 m_isChangingFocusedFrame = false; 98 103 } 99 104 -
trunk/WebCore/page/FocusController.h
r50810 r54082 34 34 namespace WebCore { 35 35 36 37 38 39 36 class Frame; 37 class KeyboardEvent; 38 class Node; 39 class Page; 40 40 41 42 43 41 class FocusController : public Noncopyable { 42 public: 43 FocusController(Page*); 44 44 45 46 47 45 void setFocusedFrame(PassRefPtr<Frame>); 46 Frame* focusedFrame() const { return m_focusedFrame.get(); } 47 Frame* focusedOrMainFrame(); 48 48 49 50 49 bool setInitialFocus(FocusDirection, KeyboardEvent*); 50 bool advanceFocus(FocusDirection, KeyboardEvent*, bool initialFocus = false); 51 51 52 52 bool setFocusedNode(Node*, PassRefPtr<Frame>); 53 53 54 55 54 void setActive(bool); 55 bool isActive() const { return m_isActive; } 56 56 57 58 57 void setFocused(bool); 58 bool isFocused() const { return m_isFocused; } 59 59 60 private: 61 Page* m_page; 62 RefPtr<Frame> m_focusedFrame; 63 bool m_isActive; 64 bool m_isFocused; 65 }; 60 private: 61 Page* m_page; 62 RefPtr<Frame> m_focusedFrame; 63 bool m_isActive; 64 bool m_isFocused; 65 bool m_isChangingFocusedFrame; 66 }; 66 67 67 68 } // namespace WebCore
Note: See TracChangeset
for help on using the changeset viewer.