Changeset 19636 in webkit
- Timestamp:
- Feb 14, 2007 7:17:54 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 10 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r19635 r19636 1 2007-02-14 Adam Roben <aroben@apple.com> 2 3 Reviewed by Darin. 4 5 Test for http://bugs.webkit.org/show_bug.cgi?id=12517 6 <rdar://problem/4971227> REGRESSION: Tab order incorrect when input 7 inside frame/iframe gets initial focus (12517) 8 9 * fast/events/frame-programmatic-focus-expected.txt: Added. 10 * fast/events/frame-programmatic-focus.html: Added. 11 * fast/forms/focus2-expected.txt: Updated results to now-correct 12 behavior. 13 1 14 2007-02-14 Justin Garcia <justin.garcia@apple.com> 2 15 -
trunk/LayoutTests/fast/events/frame-programmatic-focus.html
-
Property
svn:eol-style
set to
native
r19489 r19636 14 14 window.onblur = function() { log('main frame blurred'); } 15 15 16 var input = document.getElementsByTagName('input')[0]; 17 input.onfocus = function() { log('<input> focused'); } 18 input.onblur = function() { log ('<input> blurred'); } 19 16 20 var w = document.getElementById('frame').contentWindow; 17 21 w.onfocus = function() { log('iframe focused'); } 18 22 w.onblur = function() { log('iframe blurred'); } 19 23 20 if (window.eventSender) {21 eventSender.mouseMoveTo(50, 50);22 eventSender.mouseClick();24 var inputInIframe = w.document.getElementsByTagName('input')[0]; 25 inputInIframe.onfocus = function() { log('<input> in iframe focused'); } 26 inputInIframe.onblur = function() { log ('<input> in frame blurred'); } 23 27 24 // We need to "wait" a bit before the second click -- otherwise it is ignored 25 eventSender.leapForward(2000); 26 27 eventSender.mouseMoveTo(1, 300); 28 eventSender.mouseClick(); 29 } 28 input.focus(); 29 inputInIframe.focus(); 30 input.focus(); 30 31 } 31 32 </script> 32 33 </head> 33 34 <body onload="test()"> 34 <i frame id="frame" style="width: 100px; height: 100px; margin: 0px; border: 2px solid black;"></iframe>35 < p>This page tests that frames receive focus events when a click occurs36 within their content area, and blur events when a click occurs outside37 their content area.</p>38 <p>To test, click in the frame and then click on this text.</p>35 <input> 36 <iframe id="frame" src="data:text/html,<input>" style="width: 100px; height: 100px; margin: 0px; border: 2px solid black;"></iframe> 37 <p>This page tests that frames receive focus events when one of their child 38 elements is programmatically focused, and receive blur events when an 39 element not in that frame is programmatically focused.</p> 39 40 40 41 <pre id="log"></pre> -
Property
svn:eol-style
set to
-
trunk/LayoutTests/fast/forms/focus2-expected.txt
r18755 r19636 50 50 focus event: [to] BUTTON 51 51 keypress event: [to] BUTTON 52 focus event: [to] BUTTON53 keypress event: [to] BUTTON54 52 blur event: [to] BUTTON 55 53 focus event: [to] CHECKBOX … … 87 85 blur event: [to] TEXTAREA 88 86 focus event: [to] DIV 87 keypress event: [to] DIV 88 blur event: [to] DIV 89 focus event: [to] ANCHOR 89 90 -
trunk/WebCore/ChangeLog
r19635 r19636 1 2007-02-14 Adam Roben <aroben@apple.com> 2 3 Reviewed by Darin. 4 5 Fix http://bugs.webkit.org/show_bug.cgi?id=12517 6 <rdar://problem/4971227> REGRESSION: Tab order incorrect when input 7 inside frame/iframe gets initial focus (12517) 8 9 Test: fast/events/frame-programmatic-focus.html 10 11 * dom/Element.cpp: 12 (WebCore::Element::focus): Call FocusController::setFocusedNode to set 13 the focus for the whole page. 14 * html/HTMLInputElement.cpp: 15 (WebCore::HTMLInputElement::focus): Ditto. 16 * html/HTMLTextAreaElement.cpp: 17 (WebCore::HTMLTextAreaElement::focus): Ditto. 18 * page/EventHandler.cpp: 19 (WebCore::EventHandler::handleTextInputEvent): Send the textInput 20 event to the same target that was sent the keypress event before it. 21 * page/FocusController.cpp: 22 (WebCore::FocusController::advanceFocus): Added a FIXME. 23 (WebCore::FocusController::setFocusedNode): Added. Sets the focused 24 node for a whole page. 25 * page/FocusController.h: Added declaration. 26 * platform/cf/RetainPtr.h: Removed unused pointer_cast functions. 27 1 28 2007-02-14 Justin Garcia <justin.garcia@apple.com> 2 29 -
trunk/WebCore/dom/Element.cpp
r19595 r19636 31 31 #include "Editor.h" 32 32 #include "ExceptionCode.h" 33 #include "FocusController.h" 33 34 #include "Frame.h" 34 35 #include "FrameView.h" 35 36 #include "HTMLNames.h" 36 37 #include "NamedAttrMap.h" 38 #include "Page.h" 37 39 #include "RenderBlock.h" 38 40 #include "SelectionController.h" … … 872 874 873 875 if (!supportsFocus()) 874 return; 875 876 doc->setFocusedNode(this); 876 return; 877 878 if (Page* page = doc->page()) 879 page->focusController()->setFocusedNode(this); 877 880 878 881 if (!isFocusable()) { -
trunk/WebCore/html/HTMLInputElement.cpp
r19595 r19636 34 34 #include "EventHandler.h" 35 35 #include "EventNames.h" 36 #include "FocusController.h" 36 37 #include "FormDataList.h" 37 38 #include "Frame.h" … … 42 43 #include "LocalizedStrings.h" 43 44 #include "MouseEvent.h" 45 #include "Page.h" 44 46 #include "RenderButton.h" 45 47 #include "RenderFileUploadControl.h" … … 190 192 if (!supportsFocus()) 191 193 return; 192 doc->setFocusedNode(this); 194 if (Page* page = doc->page()) 195 page->focusController()->setFocusedNode(this); 193 196 // FIXME: Should isFocusable do the updateLayout? 194 197 if (!isFocusable()) { -
trunk/WebCore/html/HTMLTextAreaElement.cpp
r19418 r19636 32 32 #include "Event.h" 33 33 #include "EventNames.h" 34 #include "FocusController.h" 34 35 #include "FormDataList.h" 35 36 #include "Frame.h" 36 37 #include "HTMLNames.h" 38 #include "Page.h" 37 39 #include "RenderStyle.h" 38 40 #include "RenderTextControl.h" … … 207 209 if (!supportsFocus()) 208 210 return; 209 doc->setFocusedNode(this); 211 if (Page* page = doc->page()) 212 page->focusController()->setFocusedNode(this); 210 213 // FIXME: Should isFocusable do the updateLayout? 211 214 if (!isFocusable()) { -
trunk/WebCore/page/EventHandler.cpp
r19596 r19636 1360 1360 if (!m_frame) 1361 1361 return false; 1362 EventTargetNode* target = eventTargetNodeForDocument(m_frame->document()); 1362 EventTarget* target; 1363 if (underlyingEvent) 1364 target = underlyingEvent->target(); 1365 else 1366 target = eventTargetNodeForDocument(m_frame->document()); 1363 1367 if (!target) 1364 1368 return false; -
trunk/WebCore/page/FocusController.cpp
r19579 r19636 190 190 return true; 191 191 } 192 193 // FIXME: It would be nice to just be able to call setFocusedNode(node) here, but we can't do 194 // that because some elements (e.g. HTMLInputElement and HTMLTextAreaElement) do extra work in 195 // their focus() methods. 192 196 193 197 Document* newDocument = node->document(); … … 204 208 } 205 209 210 bool FocusController::setFocusedNode(Node* node) 211 { 212 RefPtr<Frame> oldFocusedFrame = focusedFrame(); 213 RefPtr<Document> oldDocument = oldFocusedFrame ? oldFocusedFrame->document() : 0; 214 215 if (!node) { 216 if (oldDocument) 217 oldDocument->setFocusedNode(0); 218 return true; 219 } 220 221 RefPtr<Document> newDocument = node ? node->document() : 0; 222 RefPtr<Frame> newFocusedFrame = newDocument ? newDocument->frame() : 0; 223 224 if (newDocument && newDocument->focusedNode() == node) 225 return true; 226 227 if (oldDocument && oldDocument != newDocument) 228 oldDocument->setFocusedNode(0); 229 230 setFocusedFrame(newFocusedFrame); 231 232 if (newDocument) 233 newDocument->setFocusedNode(node); 234 235 return true; 236 } 237 206 238 } // namespace WebCore -
trunk/WebCore/page/FocusController.h
r19579 r19636 35 35 class Frame; 36 36 class KeyboardEvent; 37 class Node; 37 38 class Page; 38 39 … … 47 48 bool advanceFocus(KeyboardEvent*); 48 49 bool advanceFocus(FocusDirection, KeyboardEvent*); 50 51 bool setFocusedNode(Node*); 49 52 50 53 private: -
trunk/WebCore/platform/cf/RetainPtr.h
r19162 r19636 193 193 return a != b.get(); 194 194 } 195 196 template <typename T, typename U> inline RetainPtr<T> static_pointer_cast(const RetainPtr<U>& p)197 {198 return RetainPtr<T>(static_cast<typename RetainPtr<T>::PtrType>(p.get()));199 }200 201 template <typename T, typename U> inline RetainPtr<T> const_pointer_cast(const RetainPtr<U>& p)202 {203 return RetainPtr<T>(const_cast<typename RetainPtr<T>::PtrType>(p.get()));204 }205 206 template <typename T> inline typename RemovePointer<T>::type getPtr(const RetainPtr<T>& p)207 {208 return p.get();209 }210 195 211 196 }
Note: See TracChangeset
for help on using the changeset viewer.