Skip to content
Permalink
Browse files
WebCore:
2008-10-02  David Hyatt  <hyatt@apple.com>

        https://bugs.webkit.org/show_bug.cgi?id=21314

        Make scrollBackingStore cross-platform.

        Reviewed by Sam Weinig

        * loader/EmptyClients.h:
        (WebCore::EmptyChromeClient::repaint):
        (WebCore::EmptyChromeClient::scroll):
        * page/Chrome.cpp:
        (WebCore::Chrome::repaint):
        (WebCore::Chrome::scroll):
        * page/Chrome.h:
        * page/ChromeClient.h:
        * page/EventHandler.cpp:
        (WebCore::EventHandler::handleAutoscroll):
        * platform/HostWindow.h:
        * platform/ScrollView.cpp:
        (WebCore::ScrollView::scrollContents):
        (WebCore::ScrollView::addPanScrollIcon):
        (WebCore::ScrollView::removePanScrollIcon):
        * platform/ScrollView.h:
        * platform/gtk/ScrollViewGtk.cpp:
        * platform/qt/ScrollViewQt.cpp:
        (WebCore::ScrollView::ScrollViewPrivate::ScrollViewPrivate):
        (WebCore::ScrollView::~ScrollView):
        * platform/win/ScrollViewWin.cpp:
        (WebCore::ScrollView::ScrollView):
        (WebCore::ScrollView::~ScrollView):

WebKit/gtk:

2008-10-02  David Hyatt  <hyatt@apple.com>

        https://bugs.webkit.org/show_bug.cgi?id=21314

        Make scrollBackingStore cross-platform.

        Reviewed by Sam Weinig

        * WebCoreSupport/ChromeClientGtk.cpp:
        (WebKit::ChromeClient::repaint):
        (WebKit::ChromeClient::scroll):
        * WebCoreSupport/ChromeClientGtk.h:

WebKit/mac:

2008-10-02  David Hyatt  <hyatt@apple.com>

        https://bugs.webkit.org/show_bug.cgi?id=21314

        Make scrollBackingStore cross-platform.

        Reviewed by Sam Weinig

        * WebCoreSupport/WebChromeClient.h:
        * WebCoreSupport/WebChromeClient.mm:
        (WebChromeClient::repaint):
        (WebChromeClient::scroll):

WebKit/qt:

2008-10-02  David Hyatt  <hyatt@apple.com>

        https://bugs.webkit.org/show_bug.cgi?id=21314

        Make scrollBackingStore cross-platform.

        Reviewed by Sam Weinig

        * WebCoreSupport/ChromeClientQt.cpp:
        (WebCore::ChromeClientQt::repaint):
        (WebCore::ChromeClientQt::scroll):
        * WebCoreSupport/ChromeClientQt.h:

WebKit/win:

2008-10-02  David Hyatt  <hyatt@apple.com>

        https://bugs.webkit.org/show_bug.cgi?id=21314

        Make scrollBackingStore cross-platform.

        Reviewed by Sam Weinig

        * WebCoreSupport/WebChromeClient.cpp:
        (WebChromeClient::repaint):
        (WebChromeClient::scroll):
        * WebCoreSupport/WebChromeClient.h:
        * WebView.cpp:
        (WebView::repaint):
        * WebView.h:



Canonical link: https://commits.webkit.org/29464@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@37204 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
David Hyatt committed Oct 2, 2008
1 parent cc87691 commit b64b8414747609e76d7585b21b4d83937bbcccd7
@@ -1,3 +1,35 @@
2008-10-02 David Hyatt <hyatt@apple.com>

https://bugs.webkit.org/show_bug.cgi?id=21314

Make scrollBackingStore cross-platform.

Reviewed by Sam Weinig

* loader/EmptyClients.h:
(WebCore::EmptyChromeClient::repaint):
(WebCore::EmptyChromeClient::scroll):
* page/Chrome.cpp:
(WebCore::Chrome::repaint):
(WebCore::Chrome::scroll):
* page/Chrome.h:
* page/ChromeClient.h:
* page/EventHandler.cpp:
(WebCore::EventHandler::handleAutoscroll):
* platform/HostWindow.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::scrollContents):
(WebCore::ScrollView::addPanScrollIcon):
(WebCore::ScrollView::removePanScrollIcon):
* platform/ScrollView.h:
* platform/gtk/ScrollViewGtk.cpp:
* platform/qt/ScrollViewQt.cpp:
(WebCore::ScrollView::ScrollViewPrivate::ScrollViewPrivate):
(WebCore::ScrollView::~ScrollView):
* platform/win/ScrollViewWin.cpp:
(WebCore::ScrollView::ScrollView):
(WebCore::ScrollView::~ScrollView):

2008-10-02 Kevin Ollivier <kevino@theolliviers.com>

wx build fixes after Frame/ScrollView changes.
@@ -113,7 +113,8 @@ class EmptyChromeClient : public ChromeClient {
virtual void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect) { }
virtual void updateBackingStore() { }

virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false) { }
virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false) { }
virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) { }
virtual IntPoint screenToWindow(const IntPoint& p) const { return p; }
virtual IntRect windowToScreen(const IntRect& r) const { return r; }

@@ -76,9 +76,14 @@ Chrome::~Chrome()
m_client->chromeDestroyed();
}

void Chrome::repaint(const IntRect& windowRect, bool contentChanged, bool immediate)
void Chrome::repaint(const IntRect& windowRect, bool contentChanged, bool immediate, bool repaintContentOnly)
{
m_client->repaint(windowRect, contentChanged, immediate);
m_client->repaint(windowRect, contentChanged, immediate, repaintContentOnly);
}

void Chrome::scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)
{
m_client->scroll(scrollDelta, rectToScroll, clipRect);
}

IntPoint Chrome::screenToWindow(const IntPoint& point) const
@@ -314,16 +319,6 @@ void Chrome::addToDirtyRegion(const IntRect& rect)
m_client->addToDirtyRegion(rect);
}

void Chrome::scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect)
{
m_client->scrollBackingStore(dx, dy, scrollViewRect, clipRect);
}

void Chrome::updateBackingStore()
{
m_client->updateBackingStore();
}

void Chrome::mouseDidMoveOverElement(const HitTestResult& result, unsigned modifierFlags)
{
if (result.innerNode()) {
@@ -53,7 +53,8 @@ namespace WebCore {
ChromeClient* client() { return m_client; }

// HostWindow methods.
virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false);
virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false);
virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
virtual IntPoint screenToWindow(const IntPoint&) const;
virtual IntRect windowToScreen(const IntRect&) const;

@@ -104,8 +105,6 @@ namespace WebCore {

IntRect windowResizerRect() const;
void addToDirtyRegion(const IntRect&);
void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect);
void updateBackingStore();

void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);

@@ -109,15 +109,12 @@ namespace WebCore {

virtual IntRect windowResizerRect() const = 0;

// The following three methods are deprecated and will be removed once all of the callers have been
// eliminated.
// This method is deprecated and will be removed once all of the callers have been eliminated.
virtual void addToDirtyRegion(const IntRect&) = 0;
virtual void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect) = 0;
virtual void updateBackingStore() = 0;
// End deprecated methods.

// Methods used by HostWindow.
virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false) = 0;
virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false) = 0;
virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) = 0;
virtual IntPoint screenToWindow(const IntPoint&) const = 0;
virtual IntRect windowToScreen(const IntRect&) const = 0;
// End methods used by HostWindow.
@@ -573,7 +573,7 @@ void EventHandler::handleAutoscroll(RenderObject* renderer)
#if PLATFORM(WIN)
if (m_panScrollInProgress) {
m_panScrollStartPos = currentMousePosition();
m_frame->view()->printPanScrollIcon(m_panScrollStartPos);
m_frame->view()->addPanScrollIcon(m_panScrollStartPos);
// If we're not in the top frame we notify it that we are using the panScroll
if (m_frame != m_frame->page()->mainFrame())
m_frame->page()->mainFrame()->eventHandler()->setPanScrollInProgress(true);
@@ -42,7 +42,8 @@ class HostWindow : Noncopyable {
// The repaint method asks the host window to repaint a rect in the window's coordinate space. The
// contentChanged boolean indicates whether or not the Web page content actually changed (or if a repaint
// of unchanged content is being requested).
virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false) = 0;
virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false) = 0;
virtual void scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) = 0;

// The paint method just causes a synchronous update of the window to happen for platforms that need it (Windows).
void paint() { repaint(IntRect(), false, true); }
@@ -373,12 +373,44 @@ void ScrollView::updateScrollbars(const IntSize& desiredOffset)
m_inUpdateScrollbars = false;
}

#if PLATFORM(MAC) || PLATFORM(WX)
// FIXME: This is just temporary so we can commit a cross-platform version of updateScrollbars.
void ScrollView::scrollContents(const IntSize&)
const int panIconSizeLength = 20;

void ScrollView::scrollContents(const IntSize& scrollDelta)
{
// Since scrolling is double buffered, we will be blitting the scroll view's intersection
// with the clip rect every time to keep it smooth.
IntRect clipRect = static_cast<Widget*>(this)->windowClipRect();
IntRect scrollViewRect = convertToContainingWindow(IntRect(0, 0, visibleWidth(), visibleHeight()));
IntRect updateRect = clipRect;
updateRect.intersect(scrollViewRect);

// Invalidate the window (not the backing store).
hostWindow()->repaint(updateRect, false);

if (m_drawPanScrollIcon) {
int panIconDirtySquareSizeLength = 2 * (panIconSizeLength + max(abs(scrollDelta.width()), abs(scrollDelta.height()))); // We only want to repaint what's necessary
IntPoint panIconDirtySquareLocation = IntPoint(m_panScrollIconPoint.x() - (panIconDirtySquareSizeLength / 2), m_panScrollIconPoint.y() - (panIconDirtySquareSizeLength / 2));
IntRect panScrollIconDirtyRect = IntRect(panIconDirtySquareLocation , IntSize(panIconDirtySquareSizeLength, panIconDirtySquareSizeLength));
panScrollIconDirtyRect.intersect(clipRect);
hostWindow()->repaint(panScrollIconDirtyRect, true, true);
}

if (canBlitOnScroll()) { // The main frame can just blit the WebView window
// FIXME: Find a way to blit subframes without blitting overlapping content
hostWindow()->scroll(-scrollDelta, scrollViewRect, clipRect);
} else {
// We need to go ahead and repaint the entire backing store. Do it now before moving the
// plugins.
hostWindow()->repaint(updateRect, true, false, true); // Invalidate the backing store and repaint it synchronously
}

// This call will move children with native widgets (plugins) and invalidate them as well.
frameRectsChanged();

// Now update the window (which should do nothing but a blit of the backing store's updateRect and so should
// be very fast).
hostWindow()->paint();
}
#endif

IntPoint ScrollView::windowToContents(const IntPoint& windowPoint) const
{
@@ -702,6 +734,20 @@ bool ScrollView::isOffscreen() const
return false;
}


void ScrollView::addPanScrollIcon(const IntPoint& iconPosition)
{
m_drawPanScrollIcon = true;
m_panScrollIconPoint = IntPoint(iconPosition.x() - panIconSizeLength / 2 , iconPosition.y() - panIconSizeLength / 2) ;
hostWindow()->repaint(IntRect(m_panScrollIconPoint, IntSize(panIconSizeLength,panIconSizeLength)), true, true);
}

void ScrollView::removePanScrollIcon()
{
m_drawPanScrollIcon = false;
hostWindow()->repaint(IntRect(m_panScrollIconPoint, IntSize(panIconSizeLength, panIconSizeLength)), true, true);
}

#if !PLATFORM(MAC)
void ScrollView::platformSetCanBlitOnScroll()
{
@@ -202,14 +202,16 @@ class ScrollView : public Widget, public ScrollbarClient {
virtual void hide();
virtual void setParentVisible(bool);

// Pan scrolling methods.
void addPanScrollIcon(const IntPoint&);
void removePanScrollIcon();

protected:
virtual void repaintContentRectangle(const IntRect&, bool now = false);
virtual void paintContents(GraphicsContext*, const IntRect& damageRect) = 0;

virtual void contentsResized() = 0;
virtual void visibleContentsResized() = 0;

void updateWindowRect(const IntRect&, bool now = false);

private:
RefPtr<Scrollbar> m_horizontalScrollbar;
@@ -270,7 +272,7 @@ class ScrollView : public Widget, public ScrollbarClient {
NSScrollView<WebCoreFrameScrollView>* scrollView() const;
#endif

#if !PLATFORM(MAC)
#if !PLATFORM(MAC) && !PLATFORM(WIN)
// FIXME: ScrollViewPrivate will eventually be completely gone.
class ScrollViewPrivate;
ScrollViewPrivate* m_data;
@@ -281,16 +283,6 @@ class ScrollView : public Widget, public ScrollbarClient {
#if !PLATFORM(MAC) && !PLATFORM(WX)
public:
void addToDirtyRegion(const IntRect&);
void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect);
void updateBackingStore();
#endif

#if PLATFORM(WIN)
public:
virtual void themeChanged();

void printPanScrollIcon(const IntPoint&);
void removePanScrollIcon();
#endif

#if PLATFORM(QT)
@@ -74,8 +74,6 @@ class ScrollView::ScrollViewPrivate
}
}

void scrollBackingStore(const IntSize& scrollDelta);

static void adjustmentChanged(GtkAdjustment*, gpointer);

ScrollView* view;
@@ -84,35 +82,6 @@ class ScrollView::ScrollViewPrivate
GtkAdjustment* verticalAdjustment;
};

void ScrollView::ScrollViewPrivate::scrollBackingStore(const IntSize& scrollDelta)
{
// Since scrolling is double buffered, we will be blitting the scroll view's intersection
// with the clip rect every time to keep it smooth.
IntRect clipRect = view->windowClipRect();
IntRect scrollViewRect = view->convertToContainingWindow(IntRect(0, 0, view->visibleWidth(), view->visibleHeight()));

IntRect updateRect = clipRect;
updateRect.intersect(scrollViewRect);

//FIXME update here?

if (view->canBlitOnScroll()) // The main frame can just blit the WebView window
// FIXME: Find a way to blit subframes without blitting overlapping content
view->scrollBackingStore(-scrollDelta.width(), -scrollDelta.height(), scrollViewRect, clipRect);
else {
// We need to go ahead and repaint the entire backing store. Do it now before moving the
// plugins.
view->addToDirtyRegion(updateRect);
view->updateBackingStore();
}

view->frameRectsChanged();

// Now update the window (which should do nothing but a blit of the backing store's updateRect and so should
// be very fast).
invalidate();
}

void ScrollView::ScrollViewPrivate::adjustmentChanged(GtkAdjustment* adjustment, gpointer _that)
{
ScrollViewPrivate* that = reinterpret_cast<ScrollViewPrivate*>(_that);
@@ -243,24 +212,4 @@ void ScrollView::addToDirtyRegion(const IntRect& containingWindowRect)
page->chrome()->addToDirtyRegion(containingWindowRect);
}

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::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();
}

}

0 comments on commit b64b841

Please sign in to comment.