* Avoid crashes by making sure everything is layouted before
authorzecke@webkit.org <zecke@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Dec 2007 18:05:11 +0000 (18:05 +0000)
committerzecke@webkit.org <zecke@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Dec 2007 18:05:11 +0000 (18:05 +0000)
  we start painting. This avoids a crash in Widget::invalidateRect
  because QPainter::begin would fail
* The QWebFrame::layout() methods and calls are left untouched because
  this would be an API decision.

Signed-off-by: Simon
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28353 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/page/FrameView.cpp
WebCore/page/FrameView.h
WebCore/platform/ScrollView.h
WebCore/platform/qt/ScrollViewQt.cpp
WebKit/qt/Api/qwebframe.cpp
WebKit/qt/Api/qwebpage.cpp
WebKit/qt/ChangeLog

index 530b4f86d27ce8798f28f00b00cc7a09d309f533..dfebd917e87a322225b5056b6af85f55f1b197e5 100644 (file)
@@ -1,3 +1,23 @@
+2007-12-03  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
+
+        Reviewed by Simon.
+
+        * Avoid crashes by making sure everything is layouted before
+        we start painting. This avoids a crash in Widget::invalidateRect
+        because QPainter::begin would fail
+        * The QWebFrame::layout() methods and calls are left untouched because
+        this would be an API decision.
+        
+
+        WARNING: NO TEST CASES ADDED OR CHANGED
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::updateControlTints):
+        * page/FrameView.h:
+        * platform/ScrollView.h:
+        * platform/qt/ScrollViewQt.cpp:
+        (WebCore::ScrollView::children):
+
 2007-12-03  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
 
         Reviewed by Simon.
index 596226f5ebfcf403c229d2d8e6228ea8ce6ad9b6..c6849fdf6a67adadc5e0228f36eccadda26f58af 100644 (file)
@@ -986,7 +986,7 @@ void FrameView::setWasScrolledByUser(bool wasScrolledByUser)
     d->m_wasScrolledByUser = wasScrolledByUser;
 }
 
-#if PLATFORM(WIN) || PLATFORM(GTK)
+#if PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(QT)
 void FrameView::layoutIfNeededRecursive()
 {
     // We have to crawl our entire tree looking for any FrameViews that need
index 624dbc525a2ad55b8076ba99f56aa62037fb4c70..e794c3de0f0476be1e1ea748fa82121c36700bf2 100644 (file)
@@ -132,7 +132,7 @@ public:
 
     // FIXME: This method should be used by all platforms, but currently depends on ScrollView::children,
     // which not all methods have. Once FrameView and ScrollView are merged, this #if should be removed.
-#if PLATFORM(WIN) || PLATFORM(GTK)
+#if PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(QT)
     void layoutIfNeededRecursive();
 #endif
 
index 1c15608bb8a5c1db090de007c58e7faa2ca08869..ec8a1685cd961135298337f6861572456f2d09e2 100644 (file)
@@ -203,6 +203,8 @@ namespace WebCore {
         PlatformScrollbar *horizontalScrollBar() const;
         PlatformScrollbar *verticalScrollBar() const;
 
+        HashSet<Widget*>* children();
+
     private:
         void updateScrollbars(const IntSize& desiredOffset);
         IntSize maximumScroll() const;
index 9e717d42f2f58d8f7a7ae66999bed68eac59571f..61ebdc0cd9aa911164107a229bc4ef9dfeca0558 100644 (file)
@@ -291,6 +291,11 @@ void ScrollView::setFrameGeometry(const IntRect& newGeometry)
     geometryChanged();
 }
 
+HashSet<Widget*>* ScrollView::children()
+{
+    return &(m_data->m_children);
+}
+
 void ScrollView::geometryChanged() const
 {
     HashSet<Widget*>::const_iterator end = m_data->m_children.end();
index 20dd4263919dd58376dbc5591b921c064ce41ddd..46832955620853ccf5c428e180876495acb542b2 100644 (file)
@@ -248,13 +248,10 @@ void QWebFrame::render(QPainter *painter, const QRect &source)
 
 void QWebFrame::layout()
 {
-    if (d->frameView->needsLayout()) {
-        d->frameView->layout();
-    }
+    if (!d->frameView)
+        return;
 
-    foreach (QWebFrame *child, childFrames()) {
-        child->layout();
-    }
+    d->frameView->layoutIfNeededRecursive();
 }
 
 QPoint QWebFrame::pos() const
index 5ca770e182b8740e9fb2bec1fa9e7d472e57e817..0f8b6136c84737e67e61cd36c2ee470928109a7b 100644 (file)
@@ -830,6 +830,7 @@ void QWebPage::paintEvent(QPaintEvent *ev)
     time.start();
 #endif
 
+    mainFrame()->layout();
     QPainter p(this);
 
     QVector<QRect> vector = ev->region().rects();
index 4ada9fb9111efc34fe84f457b3f2a127a16ce920..068a9acf1d782d302a6281da252fbf48bb3728cf 100644 (file)
@@ -1,3 +1,19 @@
+2007-12-03  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
+
+        Reviewed by Simon.
+
+        * Avoid crashes by making sure everything is layouted before
+        we start painting. This avoids a crash in Widget::invalidateRect
+        because QPainter::begin would fail
+        * The QWebFrame::layout() methods and calls are left untouched because
+        this would be an API decision.
+        
+
+        * Api/qwebframe.cpp:
+        (QWebFrame::layout):
+        * Api/qwebpage.cpp:
+        (QWebPage::paintEvent):
+
 2007-12-03  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
 
         Reviewed by Simon.