void Widget::invalidateRect(const IntRect& r) { if (data->suppressInvalidation) return; if (!parent()) { RECT rect = r; ::InvalidateRect(containingWindow(), &rect, false); if (isFrameView()) static_cast<FrameView*>(this)->addToDirtyRegion(r); return; } // Get the root widget. ScrollView* outermostView = parent(); while (outermostView && outermostView->parent()) outermostView = outermostView->parent(); if (!outermostView) return; IntRect windowRect = convertToContainingWindow(r); // Get our clip rect and intersect with it to ensure we don't invalidate too much. IntRect clipRect = windowClipRect(); windowRect.intersect(clipRect); RECT rect = windowRect; ::InvalidateRect(containingWindow(), &rect, false); outermostView->addToDirtyRegion(windowRect); }
void Widget::invalidateRect(const IntRect& rect) { if (data->suppressInvalidation) return; if (!parent()) { gtk_widget_queue_draw_area(GTK_WIDGET(containingWindow()), rect.x(), rect.y(), rect.width(), rect.height()); if (isFrameView()) static_cast<FrameView*>(this)->addToDirtyRegion(rect); return; } // Get the root widget. ScrollView* outermostView = parent(); while (outermostView && outermostView->parent()) outermostView = outermostView->parent(); if (!outermostView) return; IntRect windowRect = convertToContainingWindow(rect); gtk_widget_queue_draw_area(GTK_WIDGET(containingWindow()), windowRect.x(), windowRect.y(), windowRect.width(), windowRect.height()); outermostView->addToDirtyRegion(windowRect); }
void ScrollView::updateBackingStore() { ASSERT(isFrameView()); const FrameView* frameView = static_cast<const FrameView*>(this); Page* page = frameView->frame() ? frameView->frame()->page() : 0; if (!page) return; page->chrome()->updateBackingStore(); }
void ScrollView::scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect) { ASSERT(isFrameView()); const FrameView* frameView = static_cast<const FrameView*>(this); Page* page = frameView->frame() ? frameView->frame()->page() : 0; if (!page) return; page->chrome()->scrollBackingStore(dx, dy, scrollViewRect, clipRect); }
void ScrollView::addToDirtyRegion(const IntRect& containingWindowRect) { ASSERT(isFrameView()); const FrameView* frameView = static_cast<const FrameView*>(this); Page* page = frameView->frame() ? frameView->frame()->page() : 0; if (!page) return; page->chrome()->addToDirtyRegion(containingWindowRect); }
IntRect ScrollView::windowResizerRect() { ASSERT(isFrameView()); const FrameView* frameView = static_cast<const FrameView*>(this); Page* page = frameView->frame() ? frameView->frame()->page() : 0; if (!page) return IntRect(); return page->chrome()->windowResizerRect(); }
void Widget::setCursor(const Cursor& cursor) { #if PLATFORM(AMIGAOS4) if (!isFrameView()) return; static const Cursor *waitCursorPtr = &waitCursor(); HostWindow *hostWindow = static_cast<FrameView*>(this)->hostWindow(); BalWidget *widget = hostWindow ? hostWindow->platformWindow() : 0; Window *window = widget ? widget->window : 0; if (window) if (waitCursorPtr == &cursor && !cursor.impl()) IIntuition->SetWindowPointer(window, WA_BusyPointer, TRUE, TAG_DONE); else if (widget->curentCursor != cursor.impl()) { IIntuition->SetWindowPointer(window, WA_Pointer, cursor.impl(), TAG_DONE); widget->curentCursor = cursor.impl(); } #endif }
void Widget::invalidateRect(const IntRect& rect) { //printf("invalidateRect x=%d y=%d w=%d h=%d\n", rect.x(), rect.y(), rect.width(), rect.height()); if (data->suppressInvalidation) return; if (!parent()) { if (isFrameView()) static_cast<FrameView*>(this)->addToDirtyRegion(rect); return; } // Get the root widget. ScrollView* outermostView = parent(); while (outermostView && outermostView->parent()) outermostView = outermostView->parent(); if (!outermostView) return; IntRect windowRect = convertToContainingWindow(rect); outermostView->addToDirtyRegion(windowRect); }
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(); }
void ScrollView::paint(GraphicsContext* context, const IntRect& rect) { // FIXME: This code is here so we don't have to fork FrameView.h/.cpp. // In the end, FrameView should just merge with ScrollView. ASSERT(isFrameView()); if (context->paintingDisabled() && !context->updatingControlTints()) return; IntRect documentDirtyRect = rect; documentDirtyRect.intersect(frameGeometry()); context->save(); context->translate(x(), y()); documentDirtyRect.move(-x(), -y()); context->translate(-contentsX(), -contentsY()); documentDirtyRect.move(contentsX(), contentsY()); context->clip(enclosingIntRect(visibleContentRect())); static_cast<const FrameView*>(this)->frame()->paint(context, documentDirtyRect); context->restore(); // Now paint the scrollbars. if (!m_data->m_scrollbarsSuppressed && (m_data->m_hBar || m_data->m_vBar)) { context->save(); IntRect scrollViewDirtyRect = rect; scrollViewDirtyRect.intersect(frameGeometry()); context->translate(x(), y()); scrollViewDirtyRect.move(-x(), -y()); if (m_data->m_hBar) m_data->m_hBar->paint(context, scrollViewDirtyRect); if (m_data->m_vBar) m_data->m_vBar->paint(context, scrollViewDirtyRect); // Fill the scroll corner with white. IntRect hCorner; if (m_data->m_hBar && width() - m_data->m_hBar->width() > 0) { hCorner = IntRect(m_data->m_hBar->width(), height() - m_data->m_hBar->height(), width() - m_data->m_hBar->width(), m_data->m_hBar->height()); if (hCorner.intersects(scrollViewDirtyRect)) context->fillRect(hCorner, Color::white); } if (m_data->m_vBar && height() - m_data->m_vBar->height() > 0) { IntRect vCorner(width() - m_data->m_vBar->width(), m_data->m_vBar->height(), m_data->m_vBar->width(), height() - m_data->m_vBar->height()); if (vCorner != hCorner && vCorner.intersects(scrollViewDirtyRect)) context->fillRect(vCorner, Color::white); } context->restore(); } }