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

List:       kde-core-devel
Subject:    [PATCH] Fix KHTML redrawing problems
From:       "Roman Jarosz" <kedgedev () centrum ! cz>
Date:       2008-02-03 13:49:06
Message-ID: op.t5ybb4ycyuholc () localhost
[Download RAW message or body]

Hi, 

KHTML has some really annoying redrawing bugs when the view widget is resized before paint event.

This is because KHTMLView assumes for static widgets that render widget is always at position 0,0,
but for instance when the scroll bars are about to be shown then QScrollArea updates render widget
and changes its position if it's needed. (in QScrollAreaPrivate::updateScrollBars(), the move is called
in QScrollAreaPrivate::updateWidgetPosition() )

When this happens KHTMLView sets it back to 0,0 but KHtmlView isn't changing it back on each occasion
and then the paint position is wrong. This patch fix it by moving the render widget back to 0,0.

This bug affects Kopete.

Can I commit this?

Regards,
Roman Jarosz
["fixkhtml2.diff" (fixkhtml2.diff)]

Index: khtmlview.cpp
===================================================================
--- khtmlview.cpp	(revision 769948)
+++ khtmlview.cpp	(working copy)
@@ -485,6 +485,13 @@
       // not permitting us to forward it up the part hiearchy in our dragEnterEvent,
       // etc. handlers
       return QWidget::event(e);
+    case QEvent::StyleChange:
+    case QEvent::LayoutRequest: {
+        bool ret = QScrollArea::event(e);
+        if (d->staticWidget && widget()->pos() != QPoint(0,0))
+            widget()->move(0,0);
+        return ret;
+    }
     default:
       return QScrollArea::event(e);
     }
@@ -2108,6 +2115,12 @@
     if (o == view) {
         if (widgetEvent(e))
             return true;
+        else if ( e->type() == QEvent::Resize ) {
+            bool ret = QScrollArea::eventFilter(o, e);
+            if (d->staticWidget && view->pos() != QPoint(0,0))
+                view->move(0,0);
+            return ret;
+        }
     } else if (o->isWidgetType()) {
 	QWidget *v = static_cast<QWidget *>(o);
         QWidget *c = v;


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

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