[GTK] Send onscroll events for the main FrameView
2009-05-10 Holger Hans Peter Freyther <zecke@selfish.org>
Reviewed by Dave Hyatt.
https://bugs.webkit.org/show_bug.cgi?id=25646
[GTK] Send onscroll events for the main FrameView
WebKit/GTK+ is currently not sending any onscroll
events for a frame with external adjustments. This is
due the fact that the value-changed signal of the GtkAdjustment
is handled by WebCore::ScrollView directly and is not going through
the WebCore::Scrollbar -> WebCore::ScrollbarClient ->
WebCore::FrameView::valueChanged -> WebCore::ScrollView::valueChanged
path.
Fix the above problem by wrapping the GtkAdjustment we get
assigned from GTK+ in a ScrollbarGtk that will not have any
visual appearance. Remove code from ScrollView that knows
about adjustments and create a special case for
WebCore::ScrollView::createScrollbar that will create such
a special WebCore::ScrollbarGtk.
* platform/ScrollView.cpp: Remove adjustment code
(WebCore::ScrollView::setHasHorizontalScrollbar):
(WebCore::ScrollView::setHasVerticalScrollbar):
(WebCore::ScrollView::updateScrollbars):
(WebCore::ScrollView::wheelEvent):
* platform/ScrollView.h: Remove adjustment code
* platform/gtk/ScrollViewGtk.cpp:
(WebCore::ScrollView::platformDestroy):
(WebCore::ScrollView::createScrollbar):
(WebCore::ScrollView::setGtkAdjustments):
* platform/gtk/ScrollbarGtk.cpp:
(ScrollbarGtk::createScrollbar): Special case.
(ScrollbarGtk::ScrollbarGtk): New ctor and work on the adjustment
(ScrollbarGtk::~ScrollbarGtk): Disconnect signal
(ScrollbarGtk::frameRectsChanged): Do nothing when we lack a platformWidget
* platform/gtk/ScrollbarGtk.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44177 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/platform/ScrollView.cpp b/WebCore/platform/ScrollView.cpp
index 1f19d27..9f0da3a 100644
--- a/WebCore/platform/ScrollView.cpp
+++ b/WebCore/platform/ScrollView.cpp
@@ -78,7 +78,7 @@
void ScrollView::setHasHorizontalScrollbar(bool hasBar)
{
- if (hasBar && !m_horizontalScrollbar && !platformHasHorizontalAdjustment()) {
+ if (hasBar && !m_horizontalScrollbar) {
m_horizontalScrollbar = createScrollbar(HorizontalScrollbar);
addChild(m_horizontalScrollbar.get());
} else if (!hasBar && m_horizontalScrollbar) {
@@ -89,7 +89,7 @@
void ScrollView::setHasVerticalScrollbar(bool hasBar)
{
- if (hasBar && !m_verticalScrollbar && !platformHasVerticalAdjustment()) {
+ if (hasBar && !m_verticalScrollbar) {
m_verticalScrollbar = createScrollbar(VerticalScrollbar);
addChild(m_verticalScrollbar.get());
} else if (!hasBar && m_verticalScrollbar) {
@@ -98,10 +98,12 @@
}
}
+#if !PLATFORM(GTK)
PassRefPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientation)
{
return Scrollbar::createNativeScrollbar(this, orientation, RegularScrollbar);
}
+#endif
void ScrollView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalMode)
{
@@ -406,7 +408,7 @@
IntSize scroll = desiredOffset.shrunkTo(maxScrollPosition);
scroll.clampNegativeToZero();
- if (!platformHandleHorizontalAdjustment(scroll) && m_horizontalScrollbar) {
+ if (m_horizontalScrollbar) {
int clientWidth = visibleWidth();
m_horizontalScrollbar->setEnabled(contentsWidth() > clientWidth);
int pageStep = (clientWidth - cAmountToKeepWhenPaging);
@@ -430,7 +432,7 @@
m_horizontalScrollbar->setSuppressInvalidation(false);
}
- if (!platformHandleVerticalAdjustment(scroll) && m_verticalScrollbar) {
+ if (m_verticalScrollbar) {
int clientHeight = visibleHeight();
m_verticalScrollbar->setEnabled(contentsHeight() > clientHeight);
int pageStep = (clientHeight - cAmountToKeepWhenPaging);
@@ -959,28 +961,5 @@
#endif
-#if !PLATFORM(GTK)
-
-bool ScrollView::platformHandleHorizontalAdjustment(const IntSize&)
-{
- return false;
}
-bool ScrollView::platformHandleVerticalAdjustment(const IntSize&)
-{
- return false;
-}
-
-bool ScrollView::platformHasHorizontalAdjustment() const
-{
- return false;
-}
-
-bool ScrollView::platformHasVerticalAdjustment() const
-{
- return false;
-}
-
-#endif
-
-}