diff options
Diffstat (limited to 'WebCore/platform/gtk/ScrollViewGtk.cpp')
-rw-r--r-- | WebCore/platform/gtk/ScrollViewGtk.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/WebCore/platform/gtk/ScrollViewGtk.cpp b/WebCore/platform/gtk/ScrollViewGtk.cpp index 0f066fc..0e811ef 100644 --- a/WebCore/platform/gtk/ScrollViewGtk.cpp +++ b/WebCore/platform/gtk/ScrollViewGtk.cpp @@ -121,4 +121,25 @@ void ScrollView::platformRemoveChild(Widget* child) gtk_container_remove(GTK_CONTAINER(parent), child->platformWidget()); } +IntRect ScrollView::visibleContentRect(bool includeScrollbars) const +{ + if (!m_horizontalAdjustment) + return IntRect(IntPoint(m_scrollOffset.width(), m_scrollOffset.height()), + IntSize(max(0, width() - (verticalScrollbar() && !includeScrollbars ? verticalScrollbar()->width() : 0)), + max(0, height() - (horizontalScrollbar() && !includeScrollbars ? horizontalScrollbar()->height() : 0)))); + + // Main frame. + GtkWidget* measuredWidget = hostWindow()->platformWindow(); + GtkWidget* parent = gtk_widget_get_parent(measuredWidget); + + // We may not be in a widget that displays scrollbars, but we may + // have other kinds of decoration that make us smaller. + if (parent && includeScrollbars) + measuredWidget = parent; + + return IntRect(IntPoint(m_scrollOffset.width(), m_scrollOffset.height()), + IntSize(measuredWidget->allocation.width, + measuredWidget->allocation.height)); +} + } |