[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
xan at webkit.org
xan at webkit.org
Wed Dec 22 14:57:29 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 676601a38d1949ec2009e9c574507ac535a95a6f
Author: xan at webkit.org <xan at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Oct 26 08:37:32 2010 +0000
WebCore:
2010-10-26 Xan Lopez <xlopez at igalia.com>
Reviewed by Martin Robinson.
[GTK] Port to new GtkScrollable interface in GTK+ 3.x
https://bugs.webkit.org/show_bug.cgi?id=48202
The new GtkScrollable API sets the adjustments individually, so
adjust the code for this fact.
* platform/ScrollView.h:
* platform/gtk/ScrollViewGtk.cpp:
(WebCore::ScrollView::setHorizontalAdjustment): new method to set the horizontal adjustment.
(WebCore::ScrollView::setVerticalAdjustment): new method to set the vertical adjustment.
(WebCore::ScrollView::setGtkAdjustments): make this just call the other two methods.
WebKit/gtk:
2010-10-26 Xan Lopez <xlopez at igalia.com>
Reviewed by Martin Robinson.
[GTK] Port to new GtkScrollable interface in GTK+ 3.x
https://bugs.webkit.org/show_bug.cgi?id=48202
Use the new GtkScrollable interface when compiling against GTK+
3.x.
* webkit/webkitwebview.cpp:
(setHorizontalAdjustment):
(setVerticalAdjustment):
(getHorizontalAdjustment):
(getVerticalAdjustment):
(webkit_web_view_get_property):
(webkit_web_view_set_property):
(webkit_web_view_class_init):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70514 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e310dd0..3483641 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-10-26 Xan Lopez <xlopez at igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Port to new GtkScrollable interface in GTK+ 3.x
+ https://bugs.webkit.org/show_bug.cgi?id=48202
+
+ The new GtkScrollable API sets the adjustments individually, so
+ adjust the code for this fact.
+
+ * platform/ScrollView.h:
+ * platform/gtk/ScrollViewGtk.cpp:
+ (WebCore::ScrollView::setHorizontalAdjustment): new method to set the horizontal adjustment.
+ (WebCore::ScrollView::setVerticalAdjustment): new method to set the vertical adjustment.
+ (WebCore::ScrollView::setGtkAdjustments): make this just call the other two methods.
+
2010-10-26 Sheriff Bot <webkit.review.bot at gmail.com>
Unreviewed, rolling out r70512.
diff --git a/WebCore/platform/ScrollView.h b/WebCore/platform/ScrollView.h
index eef6d0b..89f037f 100644
--- a/WebCore/platform/ScrollView.h
+++ b/WebCore/platform/ScrollView.h
@@ -341,6 +341,8 @@ private:
#if PLATFORM(GTK)
public:
void setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj, bool resetValues = true);
+ void setHorizontalAdjustment(GtkAdjustment* hadj, bool resetValues = true);
+ void setVerticalAdjustment(GtkAdjustment* vadj, bool resetValues = true);
void setScrollOffset(const IntSize& offset) { m_scrollOffset = offset; }
private:
diff --git a/WebCore/platform/gtk/ScrollViewGtk.cpp b/WebCore/platform/gtk/ScrollViewGtk.cpp
index ebcdaa1..891eee0 100644
--- a/WebCore/platform/gtk/ScrollViewGtk.cpp
+++ b/WebCore/platform/gtk/ScrollViewGtk.cpp
@@ -78,47 +78,29 @@ PassRefPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientati
return MainFrameScrollbarGtk::create(this, orientation, m_verticalAdjustment.get());
}
-/*
- * The following is assumed:
- * (hadj && vadj) || (!hadj && !vadj)
- */
-void ScrollView::setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj, bool resetValues)
+void ScrollView::setHorizontalAdjustment(GtkAdjustment* hadj, bool resetValues)
{
- ASSERT(!hadj == !vadj);
-
- // If this is a non-main frame ScrollView, we do not want to set the
- // m_horizontalAdjustments & m_verticalAdjustments members. At the same
- // time we want to to allow FrameLoaderClientGtk.cpp to call
- // ScrollView::setGtkAdjustments(0, 0) unconditionally.
ASSERT(!parent() || !hadj);
if (parent())
return;
m_horizontalAdjustment = hadj;
- m_verticalAdjustment = vadj;
if (!m_horizontalAdjustment) {
MainFrameScrollbarGtk* hScrollbar = reinterpret_cast<MainFrameScrollbarGtk*>(horizontalScrollbar());
if (hScrollbar)
hScrollbar->detachAdjustment();
-
- MainFrameScrollbarGtk* vScrollbar = reinterpret_cast<MainFrameScrollbarGtk*>(verticalScrollbar());
- if (vScrollbar)
- vScrollbar->detachAdjustment();
-
- return;
}
// We may be lacking scrollbars when returning to a cached
// page, this kicks the page to recreate the scrollbars.
- setHasVerticalScrollbar(true);
setHasHorizontalScrollbar(true);
MainFrameScrollbarGtk* hScrollbar = reinterpret_cast<MainFrameScrollbarGtk*>(horizontalScrollbar());
hScrollbar->attachAdjustment(m_horizontalAdjustment.get());
- MainFrameScrollbarGtk* vScrollbar = reinterpret_cast<MainFrameScrollbarGtk*>(verticalScrollbar());
- vScrollbar->attachAdjustment(m_verticalAdjustment.get());
+ if (!m_horizontalAdjustment)
+ return;
// We used to reset everything to 0 here, but when page cache
// is enabled we reuse FrameViews that are cached. Since their
@@ -127,7 +109,6 @@ void ScrollView::setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj, boo
// 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.
-
int horizontalPageStep = max(max<int>(frameRect().width() * Scrollbar::minFractionToStepWhenPaging(), frameRect().width() - Scrollbar::maxOverlapBetweenPages()), 1);
gtk_adjustment_configure(m_horizontalAdjustment.get(),
resetValues ? 0 : scrollOffset().width(), 0,
@@ -135,14 +116,52 @@ void ScrollView::setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj, boo
resetValues ? 0 : Scrollbar::pixelsPerLineStep(),
resetValues ? 0 : horizontalPageStep,
resetValues ? 0 : frameRect().width());
+}
- int verticalPageStep = max(max<int>(frameRect().height() * Scrollbar::minFractionToStepWhenPaging(), frameRect().height() - Scrollbar::maxOverlapBetweenPages()), 1);
+void ScrollView::setVerticalAdjustment(GtkAdjustment* vadj, bool resetValues)
+{
+ ASSERT(!parent() || !vadj);
+ if (parent())
+ return;
+
+ m_verticalAdjustment = vadj;
+
+ if (!m_verticalAdjustment) {
+ MainFrameScrollbarGtk* vScrollbar = reinterpret_cast<MainFrameScrollbarGtk*>(verticalScrollbar());
+ if (vScrollbar)
+ vScrollbar->detachAdjustment();
+ }
+
+ // We may be lacking scrollbars when returning to a cached
+ // page, this kicks the page to recreate the scrollbars.
+ setHasVerticalScrollbar(true);
+
+ MainFrameScrollbarGtk* vScrollbar = reinterpret_cast<MainFrameScrollbarGtk*>(verticalScrollbar());
+ vScrollbar->attachAdjustment(m_verticalAdjustment.get());
+
+ if (!m_verticalAdjustment)
+ return;
+
+ // 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.
+ int verticalPageStep = max(max<int>(frameRect().width() * Scrollbar::minFractionToStepWhenPaging(), frameRect().width() - Scrollbar::maxOverlapBetweenPages()), 1);
gtk_adjustment_configure(m_verticalAdjustment.get(),
- resetValues ? 0 : scrollOffset().height(), 0,
- resetValues ? 0 : contentsSize().height(),
+ resetValues ? 0 : scrollOffset().width(), 0,
+ resetValues ? 0 : contentsSize().width(),
resetValues ? 0 : Scrollbar::pixelsPerLineStep(),
resetValues ? 0 : verticalPageStep,
- resetValues ? 0 : frameRect().height());
+ resetValues ? 0 : frameRect().width());
+}
+
+void ScrollView::setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj, bool resetValues)
+{
+ setHorizontalAdjustment(hadj, resetValues);
+ setVerticalAdjustment(vadj, resetValues);
}
void ScrollView::platformAddChild(Widget* child)
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index d130766..f4d4b08 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,22 @@
+2010-10-26 Xan Lopez <xlopez at igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Port to new GtkScrollable interface in GTK+ 3.x
+ https://bugs.webkit.org/show_bug.cgi?id=48202
+
+ Use the new GtkScrollable interface when compiling against GTK+
+ 3.x.
+
+ * webkit/webkitwebview.cpp:
+ (setHorizontalAdjustment):
+ (setVerticalAdjustment):
+ (getHorizontalAdjustment):
+ (getVerticalAdjustment):
+ (webkit_web_view_get_property):
+ (webkit_web_view_set_property):
+ (webkit_web_view_class_init):
+
2010-10-22 Sam Weinig <sam at webkit.org>
Reviewed by Anders Carlsson.
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index f5d0ef6..974b53f 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -196,12 +196,23 @@ enum {
PROP_CUSTOM_ENCODING,
PROP_ICON_URI,
PROP_IM_CONTEXT,
+#ifdef GTK_API_VERSION_2
PROP_VIEW_MODE
+#else
+ PROP_VIEW_MODE,
+ PROP_HADJUSTMENT,
+ PROP_VADJUSTMENT
+#endif
};
static guint webkit_web_view_signals[LAST_SIGNAL] = { 0, };
+#ifdef GTK_API_VERSION_2
G_DEFINE_TYPE(WebKitWebView, webkit_web_view, GTK_TYPE_CONTAINER)
+#else
+G_DEFINE_TYPE_WITH_CODE(WebKitWebView, webkit_web_view, GTK_TYPE_CONTAINER,
+ G_IMPLEMENT_INTERFACE(GTK_TYPE_SCROLLABLE, 0))
+#endif
static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GParamSpec* pspec, WebKitWebView* webView);
static void webkit_web_view_set_window_features(WebKitWebView* webView, WebKitWebWindowFeatures* webWindowFeatures);
@@ -385,6 +396,42 @@ static gboolean webkit_web_view_popup_menu_handler(GtkWidget* widget)
return webkit_web_view_forward_context_menu_event(WEBKIT_WEB_VIEW(widget), event);
}
+#ifndef GTK_API_VERSION_2
+static void setHorizontalAdjustment(WebKitWebView* webView, GtkAdjustment* adjustment)
+{
+ if (!core(webView))
+ return;
+
+ webView->priv->horizontalAdjustment = adjustment;
+ FrameView* view = core(webkit_web_view_get_main_frame(webView))->view();
+ if (!view)
+ return;
+ view->setHorizontalAdjustment(adjustment);
+}
+
+static void setVerticalAdjustment(WebKitWebView* webView, GtkAdjustment* adjustment)
+{
+ if (!core(webView))
+ return;
+
+ webView->priv->verticalAdjustment = adjustment;
+ FrameView* view = core(webkit_web_view_get_main_frame(webView))->view();
+ if (!view)
+ return;
+ view->setVerticalAdjustment(adjustment);
+}
+
+static GtkAdjustment* getHorizontalAdjustment(WebKitWebView* webView)
+{
+ return webView->priv->horizontalAdjustment.get();
+}
+
+static GtkAdjustment* getVerticalAdjustment(WebKitWebView* webView)
+{
+ return webView->priv->verticalAdjustment.get();
+}
+#endif
+
static void webkit_web_view_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
{
WebKitWebView* webView = WEBKIT_WEB_VIEW(object);
@@ -444,6 +491,14 @@ static void webkit_web_view_get_property(GObject* object, guint prop_id, GValue*
case PROP_VIEW_MODE:
g_value_set_enum(value, webkit_web_view_get_view_mode(webView));
break;
+#ifndef GTK_API_VERSION_2
+ case PROP_HADJUSTMENT:
+ g_value_set_object(value, getHorizontalAdjustment(webView));
+ break;
+ case PROP_VADJUSTMENT:
+ g_value_set_object(value, getVerticalAdjustment(webView));
+ break;
+#endif
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
}
@@ -478,6 +533,14 @@ static void webkit_web_view_set_property(GObject* object, guint prop_id, const G
case PROP_VIEW_MODE:
webkit_web_view_set_view_mode(webView, static_cast<WebKitWebViewViewMode>(g_value_get_enum(value)));
break;
+#ifndef GTK_API_VERSION_2
+ case PROP_HADJUSTMENT:
+ setHorizontalAdjustment(webView, static_cast<GtkAdjustment*>(g_value_get_object(value)));
+ break;
+ case PROP_VADJUSTMENT:
+ setVerticalAdjustment(webView, static_cast<GtkAdjustment*>(g_value_get_object(value)));
+ break;
+#endif
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
}
@@ -908,6 +971,7 @@ static void webkit_web_view_realize(GtkWidget* widget)
gtk_im_context_set_client_window(priv->imContext.get(), window);
}
+#ifdef GTK_API_VERSION_2
static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAdjustment* hadj, GtkAdjustment* vadj)
{
if (!core(webView))
@@ -921,6 +985,7 @@ static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAd
return;
view->setGtkAdjustments(hadj, vadj);
}
+#endif
static void webkit_web_view_container_add(GtkContainer* container, GtkWidget* widget)
{
@@ -2525,6 +2590,7 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
/*
* make us scrollable (e.g. addable to a GtkScrolledWindow)
*/
+#ifdef GTK_API_VERSION_2
webViewClass->set_scroll_adjustments = webkit_web_view_set_scroll_adjustments;
GTK_WIDGET_CLASS(webViewClass)->set_scroll_adjustments_signal = g_signal_new("set-scroll-adjustments",
G_TYPE_FROM_CLASS(webViewClass),
@@ -2534,6 +2600,10 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
webkit_marshal_VOID__OBJECT_OBJECT,
G_TYPE_NONE, 2,
GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
+#else
+ g_object_class_override_property(objectClass, PROP_HADJUSTMENT, "hadjustment");
+ g_object_class_override_property(objectClass, PROP_VADJUSTMENT, "vadjustment");
+#endif
/*
* Key bindings
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list