[webkit-changes] cvs commit: WebCore/manual-tests onblur-remove.html

Anders andersca at opensource.apple.com
Sun Dec 4 12:55:48 PST 2005


andersca    05/12/04 12:55:48

  Modified:    .        ChangeLog
               khtml/xml dom_docimpl.cpp dom_nodeimpl.cpp dom_nodeimpl.h
  Added:       manual-tests onblur-remove.html
  Log:
  2005-12-04  Anders Carlsson  <andersca at mac.com>
  
          Reviewed by Darin and Geoffrey.
  
          - Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=4194>
  
          * khtml/xml/dom_docimpl.cpp:
          (DocumentImpl::setFocusNode):
          Don't send onblur to a node if m_inDetach is true.
  
          * khtml/xml/dom_nodeimpl.cpp:
          (DOM::NodeImpl::detach):
          Set m_inDetach to true while calling RenderObject::destroy.
  
          * khtml/xml/dom_nodeimpl.h:
  		  Add m_inDetach flag.
  
          * manual-tests/onblur-remove.html: Added.
  
  Revision  Changes    Path
  1.471     +19 -0     WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.470
  retrieving revision 1.471
  diff -u -r1.470 -r1.471
  --- ChangeLog	4 Dec 2005 13:08:15 -0000	1.470
  +++ ChangeLog	4 Dec 2005 20:55:42 -0000	1.471
  @@ -1,3 +1,22 @@
  +2005-12-04  Anders Carlsson  <andersca at mac.com>
  +
  +        Reviewed by Darin and Geoffrey.
  +
  +        - Fixes <http://bugzilla.opendarwin.org/show_bug.cgi?id=4194>
  +
  +        * khtml/xml/dom_docimpl.cpp:
  +        (DocumentImpl::setFocusNode):
  +        Don't send onblur to a node if m_inDetach is true.
  +
  +        * khtml/xml/dom_nodeimpl.cpp:
  +        (DOM::NodeImpl::detach):
  +        Set m_inDetach to true while calling RenderObject::destroy.
  +
  +        * khtml/xml/dom_nodeimpl.h:
  +		  Add m_inDetach flag.
  +
  +        * manual-tests/onblur-remove.html: Added.
  +
   2005-12-04  Eric Seidel  <eseidel at apple.com>
   
           No review needed, WebCore+SVG build fix only.
  
  
  
  1.282     +1 -1      WebCore/khtml/xml/dom_docimpl.cpp
  
  Index: dom_docimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_docimpl.cpp,v
  retrieving revision 1.281
  retrieving revision 1.282
  diff -u -r1.281 -r1.282
  --- dom_docimpl.cpp	2 Dec 2005 03:48:09 -0000	1.281
  +++ dom_docimpl.cpp	4 Dec 2005 20:55:46 -0000	1.282
  @@ -2284,7 +2284,7 @@
       clearSelectionIfNeeded(newFocusNode);
   
       // Remove focus from the existing focus node (if any)
  -    if (oldFocusNode) {
  +    if (oldFocusNode && !oldFocusNode->m_inDetach) { 
           if (oldFocusNode->active())
               oldFocusNode->setActive(false);
   
  
  
  
  1.221     +2 -0      WebCore/khtml/xml/dom_nodeimpl.cpp
  
  Index: dom_nodeimpl.cpp
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.cpp,v
  retrieving revision 1.220
  retrieving revision 1.221
  diff -u -r1.220 -r1.221
  --- dom_nodeimpl.cpp	2 Dec 2005 09:13:26 -0000	1.220
  +++ dom_nodeimpl.cpp	4 Dec 2005 20:55:46 -0000	1.221
  @@ -1237,6 +1237,7 @@
   
   void NodeImpl::detach()
   {
  +    m_inDetach = true;
   //    assert(m_attached);
   
       if (m_render)
  @@ -1247,6 +1248,7 @@
       if (doc)
           doc->incDOMTreeVersion();
       m_attached = false;
  +    m_inDetach = false;
   }
   
   bool NodeImpl::maintainsState()
  
  
  
  1.119     +1 -1      WebCore/khtml/xml/dom_nodeimpl.h
  
  Index: dom_nodeimpl.h
  ===================================================================
  RCS file: /cvs/root/WebCore/khtml/xml/dom_nodeimpl.h,v
  retrieving revision 1.118
  retrieving revision 1.119
  diff -u -r1.118 -r1.119
  --- dom_nodeimpl.h	2 Dec 2005 03:48:10 -0000	1.118
  +++ dom_nodeimpl.h	4 Dec 2005 20:55:46 -0000	1.119
  @@ -504,7 +504,7 @@
       bool m_styleElement : 1; // contains stylesheet text
       bool m_implicit : 1; // implicitely generated by the parser
   
  -    // 3 bits unused
  +    bool m_inDetach : 1;
   };
   
   class ContainerNodeImpl : public NodeImpl
  
  
  
  1.1                  WebCore/manual-tests/onblur-remove.html
  
  Index: onblur-remove.html
  ===================================================================
  <html>
    <head>
      <script>
          var numBlurs = 0;
          
          function debug(str) {
              var c = document.getElementById('console')
              c.innerHTML += str + "<br>"
  
          }
          
          function doSubmit () {            
              var f = document.getElementById('f')
  
              f.innerHTML = '';
              
              if (numBlurs)
                  debug('FAILURE: Onblur handler called!')
              else
                  debug('SUCCESS!')
                  
          }
      </script>
    </head>
  <body onload="runTests();">
      <p>This tests that elements shouldn't emit any onblur events when they are being removed from the document. To test this, click inside the input field and press enter. If If this test is successful, "SUCCESS" should be shown below, otherwise "FAILURE" is shown.</p>
      <form id='f' onsubmit="doSubmit(this); return false">
        <input onblur="numBlurs++">
      </form>
      <pre id="console"></pre>
    </body>
  </html>
  
  
  



More information about the webkit-changes mailing list