[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdelibs/khtml/rendering
From:       Maks Orlovich <maksim () kde ! org>
Date:       2006-10-28 17:54:51
Message-ID: 1162058091.419755.24263.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 599826 by orlovich:

Make sure to let the widgets know about focus changes before the pesky
JS can change that, not after the fact when it's prolly no longer true.
BUG: 63384


 M  +21 -0     render_replaced.cpp  


--- branches/KDE/3.5/kdelibs/khtml/rendering/render_replaced.cpp #599825:599826
@@ -616,6 +616,14 @@
         return false;
     if ( !element() ) return true;
 
+
+    static bool directToWidget = false;
+    if (directToWidget) {
+      //We're trying to get the event to the widget 
+      //promptly. So get out of here..
+      return false;
+    }
+
     ref();
     element()->ref();
 
@@ -624,12 +632,25 @@
     //kdDebug() << "RenderWidget::eventFilter type=" << e->type() << endl;
     switch(e->type()) {
     case QEvent::FocusOut:
+        // First, forward it to the widget, so that Qt gets a precise
+        // state of the focus before pesky JS can try changing it..
+        directToWidget = true;
+        QApplication::sendEvent(m_widget, e);
+        directToWidget = false;
+        filtered       = true; //We already delivered it!
+        
         // Don't count popup as a valid reason for losing the focus
         // (example: opening the options of a select combobox shouldn't emit onblur)
         if ( QFocusEvent::reason() != QFocusEvent::Popup )
             handleFocusOut();
         break;
     case QEvent::FocusIn:
+        //As above, forward to the widget first...
+        directToWidget = true;
+        QApplication::sendEvent(m_widget, e);
+        directToWidget = false;
+        filtered       = true; //We already delivered it!
+
         //kdDebug(6000) << "RenderWidget::eventFilter captures FocusIn" << endl;
         element()->getDocument()->setFocusNode(element());
 //         if ( isEditable() ) {
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic