[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.20-1-208-g7f81993

Gustavo Noronha Silva kov at debian.org
Wed Feb 10 22:33:09 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit f75457486976f9d1b05d89aa06d3177fc038d4a2
Author: kov at webkit.org <kov at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Feb 10 21:26:31 2010 +0000

    WebCore
    
    2010-02-10  Gustavo Noronha Silva  <gns at gnome.org>
    
            Reviewed by Xan Lopez.
    
            [GTK] Hits assertion on history back, with page cache enabled, in specific conditions
            https://bugs.webkit.org/show_bug.cgi?id=34773
    
            When unsetting the adjustments from a ScrollView, also disconnect
            them from the Scrollbars.
    
            Test: fast/frames/frame-crash-with-page-cache.html
    
            * platform/gtk/ScrollViewGtk.cpp:
            (WebCore::ScrollView::setGtkAdjustments):
            * platform/gtk/ScrollbarGtk.cpp:
            (ScrollbarGtk::~ScrollbarGtk):
            (ScrollbarGtk::detachAdjustment):
            * platform/gtk/ScrollbarGtk.h:
    
    LayoutTests
    
    2010-02-10  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
    
            Reviewed by Xan Lopez.
    
            [GTK] Hits assertion on history back, with page cache enabled, in specific conditions
            https://bugs.webkit.org/show_bug.cgi?id=34773
    
            * fast/frames/frame-crash-with-page-cache.html: Added.
            * fast/frames/resources/cached-page-1.html: Added.
            * fast/frames/resources/cached-page-2.html: Added.
            * fast/frames/resources/cached-page-3.html: Added.
            * fast/frames/resources/cached-page-iframe.html: Added.
    
    WebKit/gtk
    
    2010-02-09  Gustavo Noronha Silva  <gns at gnome.org>
    
            Reviewed by Xan Lopez.
    
            [GTK] Hits assertion on history back, with page cache enabled, in specific conditions
            https://bugs.webkit.org/show_bug.cgi?id=34773
    
            Make sure cached frames have their scrollbars disconnected from
            the WebView's adjustments.
    
            * WebCoreSupport/FrameLoaderClientGtk.cpp:
            (WebKit::FrameLoaderClient::savePlatformDataToCachedFrame):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54620 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/platform/ScrollView.h b/WebCore/platform/ScrollView.h
index a7173a7..111d6b6 100644
--- a/WebCore/platform/ScrollView.h
+++ b/WebCore/platform/ScrollView.h
@@ -314,7 +314,7 @@ private:
 
 #if PLATFORM(GTK)
 public:
-    void setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj);
+    void setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj, bool resetValues = true);
     GtkAdjustment* m_horizontalAdjustment;
     GtkAdjustment* m_verticalAdjustment;
     void setScrollOffset(const IntSize& offset) { m_scrollOffset = offset; }
diff --git a/WebCore/platform/gtk/ScrollViewGtk.cpp b/WebCore/platform/gtk/ScrollViewGtk.cpp
index a7e7e15..e868250 100644
--- a/WebCore/platform/gtk/ScrollViewGtk.cpp
+++ b/WebCore/platform/gtk/ScrollViewGtk.cpp
@@ -2,7 +2,7 @@
  * Copyright (C) 2006, 2007, 2008 Apple Computer, Inc. All rights reserved.
  * Copyright (C) 2006 Michael Emmel mike.emmel at gmail.com
  * Copyright (C) 2007, 2009 Holger Hans Peter Freyther
- * Copyright (C) 2008 Collabora Ltd.
+ * Copyright (C) 2008, 2010 Collabora Ltd.
  *
  * All rights reserved.
  *
@@ -76,7 +76,7 @@ PassRefPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientati
  * The following is assumed:
  *   (hadj && vadj) || (!hadj && !vadj)
  */
-void ScrollView::setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj)
+void ScrollView::setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj, bool resetValues)
 {
     ASSERT(!hadj == !vadj);
 
@@ -85,17 +85,40 @@ void ScrollView::setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj)
 
     // Reset the adjustments to a sane default
     if (m_horizontalAdjustment) {
+        ScrollbarGtk* hScrollbar = reinterpret_cast<ScrollbarGtk*>(horizontalScrollbar());
+        if (hScrollbar)
+            hScrollbar->attachAdjustment(m_horizontalAdjustment);
+
+        ScrollbarGtk* vScrollbar = reinterpret_cast<ScrollbarGtk*>(verticalScrollbar());
+        if (vScrollbar)
+            vScrollbar->attachAdjustment(m_verticalAdjustment);
+
+        // We used to reset everything to 0 here, but when page cache
+        // is enabled we reuse FrameViews that are cached. Since their
+        // size is not going to change when being restored, (which is
+        // what would cause the upper limit in the adjusments to be
+        // set in the normal case), we make sure they are up-to-date
+        // here. This is needed for the parent scrolling widget to be
+        // able to report correct values.
         m_horizontalAdjustment->lower = 0;
-        m_horizontalAdjustment->upper = 0;
-        m_horizontalAdjustment->value = 0;
+        m_horizontalAdjustment->upper = resetValues ? 0 : frameRect().width();
+        m_horizontalAdjustment->value = resetValues ? 0 : scrollOffset().width();
         gtk_adjustment_changed(m_horizontalAdjustment);
         gtk_adjustment_value_changed(m_horizontalAdjustment);
 
         m_verticalAdjustment->lower = 0;
-        m_verticalAdjustment->upper = 0;
-        m_verticalAdjustment->value = 0;
+        m_verticalAdjustment->upper = resetValues ? 0 : frameRect().height();
+        m_verticalAdjustment->value = resetValues ? 0 : scrollOffset().height();
         gtk_adjustment_changed(m_verticalAdjustment);
         gtk_adjustment_value_changed(m_verticalAdjustment);
+    } else {
+        ScrollbarGtk* hScrollbar = reinterpret_cast<ScrollbarGtk*>(horizontalScrollbar());
+        if (hScrollbar)
+            hScrollbar->detachAdjustment();
+
+        ScrollbarGtk* vScrollbar = reinterpret_cast<ScrollbarGtk*>(verticalScrollbar());
+        if (vScrollbar)
+            vScrollbar->detachAdjustment();
     }
 
     /* reconsider having a scrollbar */
diff --git a/WebCore/platform/gtk/ScrollbarGtk.cpp b/WebCore/platform/gtk/ScrollbarGtk.cpp
index 00c6ea0..0c3037a 100644
--- a/WebCore/platform/gtk/ScrollbarGtk.cpp
+++ b/WebCore/platform/gtk/ScrollbarGtk.cpp
@@ -1,5 +1,6 @@
 /*
  *  Copyright (C) 2007, 2009 Holger Hans Peter Freyther zecke at selfish.org
+ *  Copyright (C) 2010 Gustavo Noronha Silva <gns at gnome.org>
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -87,6 +88,32 @@ ScrollbarGtk::ScrollbarGtk(ScrollbarClient* client, ScrollbarOrientation orienta
 
 ScrollbarGtk::~ScrollbarGtk()
 {
+    if (m_adjustment)
+        detachAdjustment();
+}
+
+void ScrollbarGtk::attachAdjustment(GtkAdjustment* adjustment)
+{
+    if (platformWidget())
+        return;
+
+    if (m_adjustment)
+        detachAdjustment();
+
+    m_adjustment = adjustment;
+
+    g_object_ref(m_adjustment);
+    g_signal_connect(m_adjustment, "value-changed", G_CALLBACK(ScrollbarGtk::gtkValueChanged), this);
+
+    updateThumbProportion();
+    updateThumbPosition();
+}
+
+void ScrollbarGtk::detachAdjustment()
+{
+    if (!m_adjustment)
+        return;
+
     g_signal_handlers_disconnect_by_func(G_OBJECT(m_adjustment), (gpointer)ScrollbarGtk::gtkValueChanged, this);
 
     // For the case where we only operate on the GtkAdjustment it is best to
@@ -98,6 +125,7 @@ ScrollbarGtk::~ScrollbarGtk()
     gtk_adjustment_changed(m_adjustment);
     gtk_adjustment_value_changed(m_adjustment);
     g_object_unref(m_adjustment);
+    m_adjustment = 0;
 }
 
 IntPoint ScrollbarGtk::getLocationInParentWindow(const IntRect& rect)
diff --git a/WebCore/platform/gtk/ScrollbarGtk.h b/WebCore/platform/gtk/ScrollbarGtk.h
index b4b5989..e02bb50 100644
--- a/WebCore/platform/gtk/ScrollbarGtk.h
+++ b/WebCore/platform/gtk/ScrollbarGtk.h
@@ -59,7 +59,9 @@ protected:
 
     virtual void updateThumbPosition();
     virtual void updateThumbProportion();
-    
+
+    void detachAdjustment();
+    void attachAdjustment(GtkAdjustment*);
 private:
     static void gtkValueChanged(GtkAdjustment*, ScrollbarGtk*);
     IntPoint getLocationInParentWindow(const IntRect&);
diff --git a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
index 9ddea6c..cd46aa9 100644
--- a/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
@@ -3,7 +3,7 @@
  *  Copyright (C) 2007, 2008, 2009 Holger Hans Peter Freyther
  *  Copyright (C) 2007 Christian Dywan <christian at twotoasts.de>
  *  Copyright (C) 2008, 2009 Collabora Ltd.  All rights reserved.
- *  Copyright (C) 2009 Gustavo Noronha Silva <gns at gnome.org>
+ *  Copyright (C) 2009, 2010 Gustavo Noronha Silva <gns at gnome.org>
  *  Copyright (C) Research In Motion Limited 2009. All rights reserved.
  *
  *  This library is free software; you can redistribute it and/or
@@ -647,9 +647,7 @@ void FrameLoaderClient::setCopiesOnScroll()
 
 void FrameLoaderClient::detachedFromParent2()
 {
-    FrameView *view = core(m_frame)->view();
-    if (view)
-        view->setGtkAdjustments(0, 0);
+    notImplemented();
 }
 
 void FrameLoaderClient::detachedFromParent3()
@@ -1117,15 +1115,21 @@ void FrameLoaderClient::updateGlobalHistoryRedirectLinks()
     notImplemented();
 }
 
-void FrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame*)
+void FrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame* cachedFrame)
 {
+    // We need to do this here in order to disconnect the scrollbars
+    // that are being used by the frame that is being cached from the
+    // adjustments, otherwise they will react to changes in the
+    // adjustments, and bad things will happen.
+    if (cachedFrame->view())
+        cachedFrame->view()->setGtkAdjustments(0, 0);
 }
 
-static void postCommitFrameViewSetup(WebKitWebFrame *frame, FrameView *view)
+static void postCommitFrameViewSetup(WebKitWebFrame *frame, FrameView *view, bool resetValues)
 {
     WebKitWebView* containingWindow = getViewFromFrame(frame);
     WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(containingWindow);
-    view->setGtkAdjustments(priv->horizontalAdjustment, priv->verticalAdjustment);
+    view->setGtkAdjustments(priv->horizontalAdjustment, priv->verticalAdjustment, resetValues);
 
     if (priv->currentMenu) {
         GtkMenu* menu = priv->currentMenu;
@@ -1144,7 +1148,7 @@ void FrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame* cached
     if (frame != frame->page()->mainFrame())
         return;
 
-    postCommitFrameViewSetup(m_frame, cachedFrame->view());
+    postCommitFrameViewSetup(m_frame, cachedFrame->view(), false);
 }
 
 void FrameLoaderClient::transitionToCommittedForNewPage()
@@ -1163,7 +1167,7 @@ void FrameLoaderClient::transitionToCommittedForNewPage()
     if (frame != frame->page()->mainFrame())
         return;
 
-    postCommitFrameViewSetup(m_frame, frame->view());
+    postCommitFrameViewSetup(m_frame, frame->view(), true);
 }
 
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list