Changeset 37105 in webkit


Ignore:
Timestamp:
Sep 30, 2008 1:09:42 PM (16 years ago)
Author:
hyatt@apple.com
Message:

Make ScrollView's updateContents method cross-platform.

Location:
trunk
Files:
32 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r37098 r37105  
     12008-09-30  Dave Hyatt  <hyatt@apple.com>
     2
     3        http://bugs.webkit.org/show_bug.cgi?id=21250
     4       
     5        Rename updateContents to repaintContentRectangle and make it cross-platform by always sending
     6        repaints up through the ChromeClient.
     7
     8        Reviewed by Darin Adler
     9
     10        * loader/EmptyClients.h:
     11        (WebCore::EmptyChromeClient::repaint):
     12        * page/Chrome.cpp:
     13        (WebCore::Chrome::repaint):
     14        * page/Chrome.h:
     15        * page/ChromeClient.h:
     16        * page/FrameView.cpp:
     17        (WebCore::FrameView::hostWindow):
     18        (WebCore::FrameView::repaintContentRectangle):
     19        * page/FrameView.h:
     20        * platform/HostWindow.h:
     21        * platform/ScrollView.cpp:
     22        (WebCore::ScrollView::repaintContentRectangle):
     23        (WebCore::ScrollView::platformRepaintContentRectangle):
     24        * platform/ScrollView.h:
     25        * platform/gtk/ScrollViewGtk.cpp:
     26        * platform/mac/ScrollViewMac.mm:
     27        (WebCore::ScrollView::platformRepaintContentRectangle):
     28        * platform/qt/ScrollViewQt.cpp:
     29        * platform/win/ScrollViewWin.cpp:
     30        * platform/wx/ScrollViewWx.cpp:
     31        (WebCore::ScrollView::platformRepaintContentRectangle):
     32
    1332008-09-30  Alexey Proskuryakov  <ap@webkit.org>
    234
  • trunk/WebCore/loader/EmptyClients.h

    r35946 r37105  
    114114    virtual void updateBackingStore() { }
    115115
     116    virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false) { }
     117
    116118    virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags) { }
    117119
  • trunk/WebCore/page/Chrome.cpp

    r37061 r37105  
    7777}
    7878
     79void Chrome::repaint(const IntRect& windowRect, bool contentChanged, bool immediate)
     80{
     81    m_client->repaint(windowRect, contentChanged, immediate);
     82}
     83
    7984void Chrome::setWindowRect(const FloatRect& rect) const
    8085{
  • trunk/WebCore/page/Chrome.h

    r37085 r37105  
    5252
    5353        ChromeClient* client() { return m_client; }
     54
     55        // HostWindow methods.
     56        virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false);
    5457
    5558        void setWindowRect(const FloatRect&) const;
  • trunk/WebCore/page/ChromeClient.h

    r35900 r37105  
    109109
    110110        virtual IntRect windowResizerRect() const = 0;
     111
     112        // The following three methods are deprecated and will be removed once all of the callers have been
     113        // eliminated.
    111114        virtual void addToDirtyRegion(const IntRect&) = 0;
    112115        virtual void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect) = 0;
    113116        virtual void updateBackingStore() = 0;
     117        // End deprecated methods.
     118
     119        virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false) = 0;
    114120
    115121        virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags) = 0;
  • trunk/WebCore/page/FrameView.cpp

    r37019 r37105  
    623623}
    624624
     625HostWindow* FrameView::hostWindow() const
     626{
     627    Page* page = frame() ? frame()->page() : 0;
     628    if (!page)
     629        return 0;
     630    return page->chrome();
     631}
     632
    625633const unsigned cRepaintRectUnionThreshold = 25;
    626634
     
    646654        return;
    647655
    648     updateContents(r, immediate);
     656    ScrollView::repaintContentRectangle(r, immediate);
    649657}
    650658
  • trunk/WebCore/page/FrameView.h

    r37019 r37105  
    6161
    6262    virtual ~FrameView();
     63
     64    virtual HostWindow* hostWindow() const;
    6365
    6466    Frame* frame() const { return m_frame.get(); }
     
    167169    void performPostLayoutTasks();
    168170
    169     void repaintContentRectangle(const IntRect&, bool immediate);
     171    virtual void repaintContentRectangle(const IntRect&, bool immediate);
    170172
    171173    unsigned m_refCount;
  • trunk/WebCore/platform/HostWindow.h

    r37085 r37105  
    3131namespace WebCore {
    3232
     33class IntRect;
     34
    3335class HostWindow : Noncopyable {
    3436public:
    3537    HostWindow() {}
    3638    virtual ~HostWindow() {}
     39
     40    // The repaint method asks the host window to repaint a rect in the window's coordinate space.  The
     41    // contentChanged boolean indicates whether or not the Web page content actually changed (or if a repaint
     42    // of unchanged content is being requested).
     43    virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false) = 0;
    3744};
    3845
  • trunk/WebCore/platform/ScrollView.cpp

    r37072 r37105  
    2727#include "ScrollView.h"
    2828
     29#include "HostWindow.h"
    2930#include "PlatformMouseEvent.h"
    3031#include "PlatformWheelEvent.h"
     
    341342}
    342343
     344void ScrollView::repaintContentRectangle(const IntRect& rect, bool now)
     345{
     346    if (rect.isEmpty())
     347        return;
     348
     349    ASSERT(!parent());
     350
     351    if (platformWidget()) {
     352        platformRepaintContentRectangle(rect, now);
     353        return;
     354    }
     355
     356    hostWindow()->repaint(contentsToWindow(rect), true, now);
     357}
     358
    343359#if !PLATFORM(MAC)
    344360void ScrollView::platformSetCanBlitOnScroll()
     
    382398    return true;
    383399}
     400
     401void ScrollView::platformRepaintContentRectangle(const IntRect&, bool now)
     402{
     403}
    384404#endif
    385405
  • trunk/WebCore/platform/ScrollView.h

    r37067 r37105  
    5555namespace WebCore {
    5656
     57class HostWindow;
    5758class PlatformWheelEvent;
    5859class Scrollbar;
     
    6263    ScrollView();
    6364    ~ScrollView();
     65
     66    // The window thats hosts the ScrollView.  The ScrollView will communicate scrolls and repaints to the
     67    // host window in the window's coordinate space.
     68    virtual HostWindow* hostWindow() const = 0;
    6469
    6570    // Methods for child manipulation and inspection.
     
    181186
    182187protected:
    183     void updateContents(const IntRect&, bool now = false);
     188    virtual void repaintContentRectangle(const IntRect&, bool now = false);
    184189    void updateWindowRect(const IntRect&, bool now = false);
    185190public:
     
    213218    bool platformScroll(ScrollDirection, ScrollGranularity);
    214219    void platformSetScrollbarsSuppressed(bool repaintOnUnsuppress);
    215    
     220    void platformRepaintContentRectangle(const IntRect&, bool now);
     221
    216222#if PLATFORM(MAC) && defined __OBJC__
    217223public:
  • trunk/WebCore/platform/gtk/ScrollViewGtk.cpp

    r37092 r37105  
    286286}
    287287
    288 void ScrollView::updateContents(const IntRect& updateRect, bool now)
    289 {
    290     if (updateRect.isEmpty())
    291         return;
    292 
    293     IntPoint windowPoint = contentsToWindow(updateRect.location());
    294     IntRect containingWindowRect = updateRect;
    295     containingWindowRect.setLocation(windowPoint);
    296 
    297     GdkRectangle rect = containingWindowRect;
    298     GdkWindow* window = GTK_WIDGET(containingWindow())->window;
    299 
    300     if (window)
    301         gdk_window_invalidate_rect(window, &rect, true);
    302 
    303     // Cache the dirty spot.
    304     addToDirtyRegion(containingWindowRect);
    305 
    306     if (now && window)
    307         gdk_window_process_updates(window, true);
    308 }
    309 
    310288void ScrollView::update()
    311289{
  • trunk/WebCore/platform/mac/ScrollViewMac.mm

    r37067 r37105  
    157157}
    158158
    159 void ScrollView::updateContents(const IntRect& rect, bool now)
     159void ScrollView::platformRepaintContentRectangle(const IntRect& rect, bool now)
    160160{
    161161    BEGIN_BLOCK_OBJC_EXCEPTIONS;
     
    164164    NSRect visibleRect = visibleContentRect();
    165165
     166    // FIXME: I don't think this intersection is necessary any more now that
     167    // selection doesn't call this method directly (but has to go through FrameView's
     168    // repaintContentRectangle, which does the intersection test also).  Leaving it in
     169    // for now until I'm sure.
    166170    // Checking for rect visibility is an important optimization for the case of
    167171    // Select All of a large document. AppKit does not do this check, and so ends
  • trunk/WebCore/platform/qt/ScrollViewQt.cpp

    r37092 r37105  
    181181}
    182182
    183 void ScrollView::updateContents(const IntRect& rect, bool now)
    184 {
    185     if (rect.isEmpty())
    186         return;
    187 
    188     IntPoint windowPoint = contentsToWindow(rect.location());
    189     IntRect containingWindowRect = rect;
    190     containingWindowRect.setLocation(windowPoint);
    191 
    192     // Cache the dirty spot.
    193     addToDirtyRegion(containingWindowRect);
    194 
    195     if (now)
    196         updateBackingStore();
    197 }
    198 
    199183void ScrollView::update()
    200184{
  • trunk/WebCore/platform/win/ScrollViewWin.cpp

    r37067 r37105  
    202202}
    203203
    204 void ScrollView::updateContents(const IntRect& rect, bool now)
    205 {
    206     if (rect.isEmpty())
    207         return;
    208 
    209     IntPoint windowPoint = contentsToWindow(rect.location());
    210     IntRect containingWindowRect = rect;
    211     containingWindowRect.setLocation(windowPoint);
    212 
    213     updateWindowRect(containingWindowRect, now);
    214 }
    215 
    216204void ScrollView::updateWindowRect(const IntRect& rect, bool now)
    217205{
  • trunk/WebCore/platform/wx/ScrollViewWx.cpp

    r37067 r37105  
    138138}
    139139
    140 void ScrollView::updateContents(const IntRect& updateRect, bool now)
     140void ScrollView::platformRepaintContentRectangle(const IntRect& updateRect, bool now)
    141141{
    142142    // we need to convert coordinates to scrolled position
  • trunk/WebKit/gtk/ChangeLog

    r36532 r37105  
     12008-09-30  Dave Hyatt  <hyatt@apple.com>
     2
     3        http://bugs.webkit.org/show_bug.cgi?id=21250
     4       
     5        Rename updateContents to repaintContentRectangle and make it cross-platform by always sending
     6        repaints up through the ChromeClient.
     7
     8        Reviewed by Darin Adler
     9
     10        * WebCoreSupport/ChromeClientGtk.cpp:
     11        (WebKit::ChromeClient::repaint):
     12        * WebCoreSupport/ChromeClientGtk.h:
     13
    1142008-09-16  Alp Toker  <alp@nuanti.com>
    215
  • trunk/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp

    r34110 r37105  
    260260}
    261261
     262void ChromeClient::repaint(const WebCore::IntRect& windowRect, bool contentChanged, bool immediate)
     263{
     264    // No double buffer.
     265    if (!contentChanged || !m_webView)
     266        return;
     267
     268    GtkWidget* windowWidget = gtk_widget_get_toplevel(GTK_WIDGET(m_webView));
     269    if (!windowWidget)
     270        return;
     271
     272    GdkRectangle rect = windowRect;
     273    GdkWindow* window = GTK_WINDOW(windowWidget);
     274
     275    if (window) {
     276        gdk_window_invalidate_rect(window, &rect, true);
     277        if (immediate)
     278            gdk_window_process_updates(window, true);
     279    }
     280}
     281
    262282void ChromeClient::addToDirtyRegion(const IntRect&)
    263283{
  • trunk/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h

    r29699 r37105  
    8888        virtual void updateBackingStore();
    8989
     90        virtual void repaint(const WebCore::IntRect&, bool contentChanged, bool immediate = false);
     91
    9092        virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags);
    9193
  • trunk/WebKit/mac/ChangeLog

    r37102 r37105  
     12008-09-30  Dave Hyatt  <hyatt@apple.com>
     2
     3        http://bugs.webkit.org/show_bug.cgi?id=21250
     4       
     5        Rename updateContents to repaintContentRectangle and make it cross-platform by always sending
     6        repaints up through the ChromeClient.
     7       
     8        Reviewed by Darin Adler
     9
     10        * WebCoreSupport/WebChromeClient.h:
     11        * WebCoreSupport/WebChromeClient.mm:
     12        (WebChromeClient::repaint):
     13
    1142008-09-30  Anders Carlsson  <andersca@apple.com>
    215
  • trunk/WebKit/mac/WebCoreSupport/WebChromeClient.h

    r37061 r37105  
    9393    virtual void updateBackingStore();
    9494   
     95    virtual void repaint(const WebCore::IntRect&, bool contentChanged, bool immediate = false);
     96
    9597    virtual void setStatusbarText(const WebCore::String&);
    9698
  • trunk/WebKit/mac/WebCoreSupport/WebChromeClient.mm

    r37061 r37105  
    404404}
    405405
     406void WebChromeClient::repaint(const WebCore::IntRect&, bool, bool)
     407{
     408}
     409
    406410void WebChromeClient::addToDirtyRegion(const IntRect&)
    407411{
  • trunk/WebKit/qt/ChangeLog

    r37064 r37105  
     12008-09-30  Dave Hyatt  <hyatt@apple.com>
     2
     3        http://bugs.webkit.org/show_bug.cgi?id=21250
     4       
     5        Rename updateContents to repaintContentRectangle and make it cross-platform by always sending
     6        repaints up through the ChromeClient.
     7
     8        Reviewed by Darin Adler
     9
     10        * WebCoreSupport/ChromeClientQt.cpp:
     11        (WebCore::ChromeClientQt::repaint):
     12        * WebCoreSupport/ChromeClientQt.h:
     13
    1142008-09-29  Gunnar Sletta  <gunnar@trolltech.com>
    215
  • trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp

    r36534 r37105  
    297297}
    298298
     299void ChromeClientQt::repaint(const WebCore::IntRect& windowRect, bool contentChanged, bool)
     300{
     301    // No double buffer.
     302    if (!contentChanged)
     303        return;
     304
     305    QWidget* view = m_webPage->view();
     306    if (view) {
     307        QRect rect(r);
     308        rect = rect.intersected(QRect(QPoint(0, 0), m_webPage->viewportSize()));
     309        if (!r.isEmpty())
     310            view->update(r);
     311    } else
     312        emit m_webPage->repaintRequested(r);
     313   
     314    // FIXME: There is no "immediate" support.
     315}
     316
    299317void ChromeClientQt::addToDirtyRegion(const IntRect& r)
    300318{
  • trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.h

    r32209 r37105  
    104104        virtual void updateBackingStore();
    105105
     106        virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false);
     107
    106108        virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
    107109
  • trunk/WebKit/win/ChangeLog

    r37083 r37105  
     12008-09-30  Dave Hyatt  <hyatt@apple.com>
     2
     3        http://bugs.webkit.org/show_bug.cgi?id=21250
     4       
     5        Rename updateContents to repaintContentRectangle and make it cross-platform by always sending
     6        repaints up through the ChromeClient.
     7
     8        Reviewed by Darin Adler
     9
     10        * WebCoreSupport/WebChromeClient.cpp:
     11        (WebChromeClient::repaint):
     12        * WebCoreSupport/WebChromeClient.h:
     13        * WebView.cpp:
     14        (WebView::repaint):
     15        * WebView.h:
     16
    1172008-09-29  Dan Bernstein  <mitz@apple.com>
    218
  • trunk/WebKit/win/WebCoreSupport/WebChromeClient.cpp

    r36971 r37105  
    418418}
    419419
     420void WebChromeClient::repaint(const IntRect& windowRect, bool contentChanged, bool immediate)
     421{
     422    ASSERT(core(m_webView->topLevelFrame()));
     423    m_webView->repaint(windowRect, contentChanged, immediate);
     424}
     425
    420426void WebChromeClient::addToDirtyRegion(const IntRect& dirtyRect)
    421427{
  • trunk/WebKit/win/WebCoreSupport/WebChromeClient.h

    r35308 r37105  
    9292    virtual bool tabsToLinks() const;
    9393    virtual WebCore::IntRect windowResizerRect() const;
     94
     95    virtual void repaint(const WebCore::IntRect&, bool contentChanged, bool immediate = false);
     96
    9497    virtual void addToDirtyRegion(const WebCore::IntRect&);
    9598    virtual void scrollBackingStore(int dx, int dy, const WebCore::IntRect& scrollViewRect, const WebCore::IntRect& clipRect);
  • trunk/WebKit/win/WebView.cpp

    r37021 r37105  
    620620
    621621    deleteBackingStore();
     622}
     623
     624void WebView::repaint(const WebCore::IntRect& windowRect, bool contentChanged, bool immediate)
     625{
     626    RECT rect = windowRect;
     627    ::InvalidateRect(m_viewWindow, &rect, false);
     628    if (contentChanged)
     629        addToDirtyRegion(windowRect);
     630    if (immediate)
     631        ::UpdateWindow(m_viewWindow);
    622632}
    623633
  • trunk/WebKit/win/WebView.h

    r36652 r37105  
    712712    void updateBackingStore(WebCore::FrameView*, HDC, bool backingStoreCompletelyDirty);
    713713    void deleteBackingStore();
     714    void repaint(const WebCore::IntRect&, bool contentChanged, bool immediate = false);
    714715    void frameRect(RECT* rect);
    715716    void closeWindow();
  • trunk/WebKit/wx/ChangeLog

    r36980 r37105  
     12008-09-30  Dave Hyatt  <hyatt@apple.com>
     2
     3        http://bugs.webkit.org/show_bug.cgi?id=21250
     4       
     5        Rename updateContents to repaintContentRectangle and make it cross-platform by always sending
     6        repaints up through the ChromeClient.
     7
     8        Reviewed by Darin Adler
     9
     10        * WebKitSupport/ChromeClientWx.cpp:
     11        (WebCore::ChromeClientWx::repaint):
     12        * WebKitSupport/ChromeClientWx.h:
     13
    1142008-09-26  Kevin Ollivier  <kevino@theolliviers.com>
    215
  • trunk/WebKit/wx/WebKitSupport/ChromeClientWx.cpp

    r35437 r37105  
    284284}
    285285
     286void ChromeClientWx::repaint(const WebCore::IntRect&, bool, bool)
     287{
     288    notImplemented();
     289}
     290
    286291void ChromeClientWx::addToDirtyRegion(const IntRect&)
    287292{
  • trunk/WebKit/wx/WebKitSupport/ChromeClientWx.h

    r29698 r37105  
    9999    virtual void updateBackingStore();
    100100   
     101    virtual void repaint(const IntRect&, bool contentChanged, bool immediate = false);
     102
    101103    virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
    102104
Note: See TracChangeset for help on using the changeset viewer.