Changeset 12872 in webkit
- Timestamp:
- Feb 17, 2006 1:54:15 AM (18 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r12871 r12872 1 2006-02-17 Vicki Murley <vicki@apple.com> 2 3 Reviewed by Justin. 4 5 Get rid of handleFocusOut on text fields and textareas - move this functionality to the place 6 where we resign focus on the previous node in setFocusNode. Add isTextField on RenderObject 7 as one way to distinguish from contenteditable elements - Win IE does not fire onChange for 8 contenteditable elements, so we won't either. Also, expose the dirty bit variables previously 9 checked in handleFocusOut methods in isEdited() and setEdited(). 10 11 Fixes the following bugs: 12 <rdar://problem/4315673> REGRESSION (1.2.2 - 1.3): onChange and onFocus events firing order differs for mouse click and tab (7227) 13 <rdar://problem/4447009> for text fields, onChange should fire before onBlur to match Win IE 14 15 Test case is on the way. 16 17 * dom/DocumentImpl.cpp: 18 (WebCore::DocumentImpl::setFocusNode): For textareas and text fields, fire a change event 19 on the node that is resigning focus. Make sure the blur event fires after the change event - 4447009. 20 * rendering/render_form.cpp: 21 (WebCore::RenderLineEdit::slotReturnPressed): Replace call to handleFocusOut with equivalent code. 22 (WebCore::RenderLineEdit::isEdited): Added. 23 (WebCore::RenderLineEdit::setEdited): Added. 24 (WebCore::RenderTextArea::setEdited): Added. 25 * rendering/render_form.h: 26 (WebCore::RenderLineEdit::isTextField): Added. 27 (WebCore::RenderTextArea::isTextArea): Make this non-virtual. 28 (WebCore::RenderTextArea::isEdited): Added. 29 * rendering/render_object.h: 30 (WebCore::RenderObject::isEdited): Added. 31 (WebCore::RenderObject::setEdited): Added. 32 (WebCore::RenderObject::isTextField): Added. 33 * rendering/render_replaced.h: Remove handleFocusOut(). 34 * rendering/render_replaced.cpp: Ditto. 35 (WebCore::RenderWidget::eventFilter): Remove call to handleFocusOut(). Safe to do here, 36 since we call setFocusNode immediately beforehand. 37 1 38 2006-02-17 Mitz Pettel <opendarwin.org@mitzpettel.com> 2 39 -
trunk/WebCore/dom/DocumentImpl.cpp
r12865 r12872 2053 2053 2054 2054 oldFocusNode->setFocus(false); 2055 2056 // Dispatch a change event for text fields or textareas that have been edited 2057 RenderObject *r = static_cast<RenderObject*>(oldFocusNode.get()->renderer()); 2058 if ((r->isTextArea() || r->isTextField()) && r->isEdited()) { 2059 oldFocusNode->dispatchHTMLEvent(changeEvent, true, false); 2060 r->setEdited(false); 2061 } 2062 2055 2063 oldFocusNode->dispatchHTMLEvent(blurEvent, false, false); 2064 2056 2065 if (m_focusNode) { 2057 2066 // handler shifted focus -
trunk/WebCore/rendering/render_form.cpp
r12801 r12872 225 225 // Works but might not be enough, dirk said he had another solution at 226 226 // hand (can't remember which) - David 227 handleFocusOut(); 227 if (isTextField() && isEdited()) { 228 element()->onChange(); 229 setEdited(false); 230 } 228 231 229 232 HTMLFormElementImpl* fe = element()->form(); … … 242 245 if (widget()) 243 246 widget()->addSearchResult(); 244 }245 246 void RenderLineEdit::handleFocusOut()247 {248 if ( widget() && widget()->edited() && element()) {249 element()->onChange();250 widget()->setEdited( false );251 }252 247 } 253 248 … … 376 371 } 377 372 373 bool RenderLineEdit::isEdited() const 374 { 375 return static_cast<QLineEdit*>(m_widget)->edited(); 376 } 377 void RenderLineEdit::setEdited(bool x) 378 { 379 static_cast<QLineEdit*>(m_widget)->setEdited(x); 380 } 381 378 382 void RenderLineEdit::setSelectionRange(int start, int end) 379 383 { … … 521 525 if (isInline()) 522 526 setReplaced(true); 523 } 524 527 } 528 525 529 // ------------------------------------------------------------------------- 526 530 … … 996 1000 } 997 1001 998 void RenderTextArea::handleFocusOut()999 {1000 if ( m_dirty && element() ) {1001 element()->updateValue();1002 element()->onChange();1003 }1004 m_dirty = false;1005 }1006 1007 1002 void RenderTextArea::calcMinMaxWidth() 1008 1003 { … … 1047 1042 1048 1043 w->setScrollBarModes(horizontalScrollMode, scrollMode); 1044 } 1045 1046 void RenderTextArea::setEdited(bool x) { 1047 m_dirty = x; 1049 1048 } 1050 1049 -
trunk/WebCore/rendering/render_form.h
r12782 r12872 132 132 void setSelectionEnd(int); 133 133 134 bool isEdited() const; 135 void setEdited(bool); 136 bool isTextField() const { return true; } 134 137 void select(); 135 138 void setSelectionRange(int, int); … … 146 149 public: 147 150 void addSearchResult(); 148 149 protected:150 virtual void handleFocusOut();151 151 152 152 private: … … 321 321 virtual void setStyle(RenderStyle *); 322 322 323 virtual bool isTextArea() const { return true; } 323 bool isTextArea() const { return true; } 324 bool isEdited() const { return m_dirty; } 325 void setEdited (bool); 324 326 325 327 // don't even think about making this method virtual! … … 344 346 345 347 protected: 346 virtual void handleFocusOut();347 348 348 virtual bool isEditable() const { return true; } 349 349 -
trunk/WebCore/rendering/render_object.h
r12527 r12872 164 164 virtual int getBaselineOfLastLineBox() const { return -1; } 165 165 virtual bool isEmpty() const { return firstChild() == 0; } 166 167 virtual bool isEdited() const { return false; } 168 virtual void setEdited(bool) { return; }; 166 169 167 170 // Obtains the nearest enclosing block (including this block) that contributes a first-line style to our inline … … 263 266 virtual bool isImage() const { return false; } 264 267 virtual bool isTextArea() const { return false; } 268 virtual bool isTextField() const { return false; } 265 269 virtual bool isFrameSet() const { return false; } 266 270 virtual bool isApplet() const { return false; } -
trunk/WebCore/rendering/render_replaced.cpp
r12803 r12872 412 412 } 413 413 414 void RenderWidget::handleFocusOut()415 {416 }417 418 414 bool RenderWidget::eventFilter(QObject* /*o*/, QEvent* e) 419 415 { … … 438 434 if (elem->getDocument()->focusNode() == elem) 439 435 elem->getDocument()->setFocusNode(0); 440 handleFocusOut();441 436 } 442 437 break; -
trunk/WebCore/rendering/render_replaced.h
r12782 r12872 107 107 void setQWidget(Widget *widget, bool deleteWidget = true); 108 108 void resizeWidget( Widget *widget, int w, int h ); 109 virtual void handleFocusOut();110 109 111 110 bool m_deleteWidget;
Note: See TracChangeset
for help on using the changeset viewer.