IntRect ScrollView::visibleContentRect(bool includeScrollbars) const { // If we are an interior frame scrollbar or are in some sort of transition // state, just calculate our size based on what the GTK+ theme says the // scrollbar width should be. if (parent() || !hostWindow() || !hostWindow()->platformPageClient()) { return IntRect(IntPoint(m_scrollOffset.width(), m_scrollOffset.height()), IntSize(max(0, m_boundsSize.width() - (verticalScrollbar() && !includeScrollbars ? verticalScrollbar()->width() : 0)), max(0, m_boundsSize.height() - (horizontalScrollbar() && !includeScrollbars ? horizontalScrollbar()->height() : 0)))); } // We don't have a parent, so we are the main frame and thus have // a parent widget which we can use to measure the visible region. GtkWidget* measuredWidget = hostWindow()->platformPageClient(); GtkWidget* parentWidget = 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 (parentWidget && includeScrollbars) measuredWidget = parentWidget; GtkAllocation allocation; gtk_widget_get_allocation(measuredWidget, &allocation); return IntRect(IntPoint(m_scrollOffset.width(), m_scrollOffset.height()), IntSize(allocation.width, allocation.height)); }
void ScrollView::platformRemoveChild(Widget* child) { GtkWidget* parent; // HostWindow can be NULL here. If that's the case // let's grab the child's parent instead. if (hostWindow()) parent = GTK_WIDGET(hostWindow()->platformWindow()); else parent = GTK_WIDGET(child->platformWidget()->parent); if (GTK_IS_CONTAINER(parent) && parent == child->platformWidget()->parent) gtk_container_remove(GTK_CONTAINER(parent), child->platformWidget()); }
bool ScrollableArea::scheduleAnimation() { if (HostWindow* window = hostWindow()) { window->scheduleAnimation(); return true; } return false; }
void ScrollView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalMode, bool horizontalLock, bool verticalLock) { // FIXME: Restructure the ScrollView abstraction so that we do not have to // copy this verbatim from ScrollView.cpp. Until then, we should make sure this // is kept in sync. bool needsUpdate = false; if (horizontalMode != horizontalScrollbarMode() && !m_horizontalScrollbarLock) { m_horizontalScrollbarMode = horizontalMode; needsUpdate = true; } if (verticalMode != verticalScrollbarMode() && !m_verticalScrollbarLock) { m_verticalScrollbarMode = verticalMode; needsUpdate = true; } if (horizontalLock) setHorizontalScrollbarLock(); if (verticalLock) setVerticalScrollbarLock(); if (needsUpdate) updateScrollbars(scrollOffset()); // We don't need to report policy changes on ScrollView's unless this // one has an adjustment attached and it is a main frame. if (!m_horizontalAdjustment || parent() || !isFrameView()) return; // For frames that do have adjustments attached, we want to report // policy changes, so that they may be applied to the widget to // which the WebView's container (e.g. GtkScrolledWindow). if (hostWindow()) hostWindow()->scrollbarsModeDidChange(); }
void ScrollView::setScrollbarModes(ScrollbarMode horizontalMode, ScrollbarMode verticalMode, bool, bool) { if (horizontalMode == m_horizontalScrollbarMode && verticalMode == m_verticalScrollbarMode) return; m_horizontalScrollbarMode = horizontalMode; m_verticalScrollbarMode = verticalMode; // We don't really care about reporting policy changes on frames // that have no adjustments attached to them. if (!m_horizontalAdjustment) { updateScrollbars(scrollOffset()); return; } if (!isFrameView()) return; // For frames that do have adjustments attached, we want to report // policy changes, so that they may be applied to the widget to // which the WebView has been added, for instance. if (hostWindow()) hostWindow()->scrollbarsModeDidChange(); }
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()->platformPageClient(); 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)); }
void FramelessScrollView::invalidateRect(const IntRect& rect) { if (HostWindow* h = hostWindow()) h->invalidateContentsAndRootView(rect); }
void FramelessScrollView::invalidateRect(const IntRect& rect) { if (HostWindow* h = hostWindow()) h->invalidateContentsAndWindow(rect, false /*immediate*/); }
void ScrollView::platformAddChild(Widget* child) { if (!GTK_IS_SOCKET(child->platformWidget())) gtk_container_add(GTK_CONTAINER(hostWindow()->platformWindow()), child->platformWidget()); }
void PopupContainer::invalidateRect(const IntRect& rect) { if (HostWindow* h = hostWindow()) h->invalidateContentsAndRootView(rect); }