Changeset 94012 in webkit


Ignore:
Timestamp:
Aug 29, 2011, 1:56:57 PM (14 years ago)
Author:
Martin Robinson
Message:

Merging r86102

Location:
releases/WebKitGTK/webkit-1.4/Source
Files:
2 added
14 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-1.4/Source/WebCore/ChangeLog

    r90150 r94012  
     12011-08-29  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Gustavo Noronha Silva.
     4
     5        [GTK] Untangle GtkAdjustments from WebCore
     6        https://bugs.webkit.org/show_bug.cgi?id=59821
     7
     8        Completely remove the ability for WebKit to set GtkAdjustments on ScrollViews
     9        and, consequently, Scrollbars. Handling adjustment updates can now be managed
     10        in WebKit.
     11
     12        No new tests. This is covered by existing Scrollbar tests.
     13
     14        * platform/ScrollView.cpp: platformInit and platformDestroy can now be shared
     15        between ScrollView.cpp and ScrollViewGtk.cpp.
     16        * platform/ScrollView.h: Remove unused methods.
     17        * platform/gtk/MainFrameScrollbarGtk.cpp:
     18        (MainFrameScrollbarGtk::create): No longer need to pass in the adjustment.
     19        (MainFrameScrollbarGtk::MainFrameScrollbarGtk): Update the comments here.
     20        * platform/gtk/MainFrameScrollbarGtk.h: Lots of code removal.
     21        * platform/gtk/ScrollViewGtk.cpp: Ditto.
     22        (WebCore::ScrollView::createScrollbar): Ditto.
     23        (WebCore::ScrollView::setScrollbarModes): Ditto.
     24        * plugins/gtk/PluginViewGtk.cpp: This file needs the GRefPtrGtk.h include now
     25        that it doesn't receive it transitively.
     26
    1272011-06-30  Martin Robinson  <mrobinson@igalia.com>
    228
  • releases/WebKitGTK/webkit-1.4/Source/WebCore/platform/ScrollView.cpp

    r81209 r94012  
    11721172}
    11731173
    1174 #if !PLATFORM(WX) && !USE(NATIVE_GTK_MAIN_FRAME_SCROLLBAR) && !PLATFORM(EFL)
     1174#if !PLATFORM(WX) && !PLATFORM(EFL)
    11751175
    11761176void ScrollView::platformInit()
  • releases/WebKitGTK/webkit-1.4/Source/WebCore/platform/ScrollView.h

    r81209 r94012  
    4040#endif
    4141
    42 #if PLATFORM(GTK)
    43 #include "GRefPtrGtk.h"
    44 typedef struct _GtkAdjustment GtkAdjustment;
    45 #endif
    46 
    4742#if PLATFORM(WX)
    4843class wxScrollWinEvent;
     
    389384#endif
    390385
    391 #if PLATFORM(GTK)
    392 public:
    393     void setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj, bool resetValues = true);
    394     void setHorizontalAdjustment(GtkAdjustment* hadj, bool resetValues = true);
    395     void setVerticalAdjustment(GtkAdjustment* vadj, bool resetValues = true);
    396     void setScrollOffset(const IntSize& offset) { m_scrollOffset = offset; }
    397 
    398 private:
    399     GRefPtr<GtkAdjustment> m_horizontalAdjustment;
    400     GRefPtr<GtkAdjustment> m_verticalAdjustment;
    401 #endif
    402 
    403386#if PLATFORM(WX)
    404387public:
  • releases/WebKitGTK/webkit-1.4/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp

    r84794 r94012  
    33 *  Copyright (C) 2010 Gustavo Noronha Silva <gns@gnome.org>
    44 *  Copyright (C) 2010 Collabora Ltd.
    5  *  Copyright (C) 2010 Igalia S.L.
     5 *  Copyright (C) 2010, 2011 Igalia S.L.
    66 *
    77 *  This library is free software; you can redistribute it and/or
     
    2323#include "MainFrameScrollbarGtk.h"
    2424
    25 #include "GraphicsContext.h"
    2625#include "GtkVersioning.h"
    2726#include "IntRect.h"
     
    3130using namespace WebCore;
    3231
    33 PassRefPtr<MainFrameScrollbarGtk> MainFrameScrollbarGtk::create(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, GtkAdjustment* adj)
     32PassRefPtr<MainFrameScrollbarGtk> MainFrameScrollbarGtk::create(ScrollableArea* scrollableArea, ScrollbarOrientation orientation)
    3433{
    35     return adoptRef(new MainFrameScrollbarGtk(scrollableArea, orientation, adj));
     34    return adoptRef(new MainFrameScrollbarGtk(scrollableArea, orientation));
    3635}
    3736
    38 // Main frame scrollbars are slaves to a GtkAdjustment. If a main frame
    39 // scrollbar has an m_adjustment, it belongs to the container (a GtkWidget such
    40 // as GtkScrolledWindow). The adjustment may also be null, in which case there
    41 // is no containing view or the parent ScrollView is in some sort of transition
    42 // state. These scrollbars are never painted, as the container takes care of
    43 // that. They exist only to shuttle data from the GtkWidget container into
    44 // WebCore and vice-versa.
    45 MainFrameScrollbarGtk::MainFrameScrollbarGtk(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, GtkAdjustment* adjustment)
     37// A MainFrameScrollbar is just a non-painting scrollbar. Otherwise it is fully
     38// functional. A non-painting scrollbar allows a main-frame ScrollView to use
     39// a containing GtkScrolledWindow as its user interface. The ChromeClient in the
     40// WebKit layer just listens for scrolling and sizing changes and updates its
     41// container (the GtkScrolledWindow) accordingly. The ScrollView is responsible
     42// for deciding whether or not to create a MainFrameScrollbar or native scrollbar.
     43MainFrameScrollbarGtk::MainFrameScrollbarGtk(ScrollableArea* scrollableArea, ScrollbarOrientation orientation)
    4644    : Scrollbar(scrollableArea, orientation, RegularScrollbar)
    47     , m_adjustment(0)
    4845{
    49     attachAdjustment(adjustment);
    50 
    51     // We have nothing to show as we are solely operating on the GtkAdjustment.
     46    // We don't want to take up any space.
    5247    resize(0, 0);
    53 }
    54 
    55 MainFrameScrollbarGtk::~MainFrameScrollbarGtk()
    56 {
    57     if (m_adjustment)
    58         detachAdjustment();
    59 }
    60 
    61 void MainFrameScrollbarGtk::attachAdjustment(GtkAdjustment* adjustment)
    62 {
    63     if (m_adjustment.get() == adjustment)
    64         return;
    65     if (m_adjustment)
    66         detachAdjustment();
    67 
    68     m_adjustment = adjustment;
    69     if (!m_adjustment)
    70         return;
    71 
    72     // In some cases this adjustment may still be attached to a living MainFrameScrollbar.
    73     // If that's the case we want to force a disconnection now, before we modify the values.
    74     g_signal_handlers_disconnect_matched(m_adjustment.get(), G_SIGNAL_MATCH_FUNC, 0, 0, 0,
    75                                          reinterpret_cast<void*>(MainFrameScrollbarGtk::gtkValueChanged), 0);
    76 
    77     updateThumbProportion();
    78     updateThumbPosition();
    79     g_signal_connect(m_adjustment.get(), "value-changed", G_CALLBACK(MainFrameScrollbarGtk::gtkValueChanged), this);
    80 }
    81 
    82 void MainFrameScrollbarGtk::detachAdjustment()
    83 {
    84     if (!m_adjustment)
    85         return;
    86 
    87     g_signal_handlers_disconnect_by_func(G_OBJECT(m_adjustment.get()), (gpointer)MainFrameScrollbarGtk::gtkValueChanged, this);
    88 
    89     // For the case where we only operate on the GtkAdjustment it is best to
    90     // reset the values so that the surrounding scrollbar gets updated, or
    91     // e.g. for a GtkScrolledWindow the scrollbar gets hidden.
    92     gtk_adjustment_configure(m_adjustment.get(), 0, 0, 0, 0, 0, 0);
    93 
    94     m_adjustment = 0;
    95 }
    96 
    97 void MainFrameScrollbarGtk::updateThumbPosition()
    98 {
    99     if (!m_adjustment || gtk_adjustment_get_value(m_adjustment.get()) == m_currentPos)
    100         return;
    101     gtk_adjustment_set_value(m_adjustment.get(), m_currentPos);
    102 }
    103 
    104 void MainFrameScrollbarGtk::updateThumbProportion()
    105 {
    106     if (!m_adjustment)
    107         return;
    108     gtk_adjustment_configure(m_adjustment.get(),
    109                              gtk_adjustment_get_value(m_adjustment.get()),
    110                              gtk_adjustment_get_lower(m_adjustment.get()),
    111                              m_totalSize,
    112                              m_lineStep,
    113                              m_pageStep,
    114                              m_visibleSize);
    115 }
    116 
    117 void MainFrameScrollbarGtk::gtkValueChanged(GtkAdjustment*, MainFrameScrollbarGtk* that)
    118 {
    119     // If we've been removed from our parent, we no longer get to control the WebCore
    120     // scrollbar. If this is the case, deactivate this signal handler. WebCore will
    121     // create a fresh MainFrameScrollbar when the scrollbar reappears.
    122     if (!that->parent()) {
    123         that->detachAdjustment();
    124         return;
    125     }
    126 
    127     int newValue = static_cast<int>(gtk_adjustment_get_value(that->m_adjustment.get()));
    128     if (newValue != that->value())
    129         that->scrollableArea()->scrollToOffsetWithoutAnimation(that->orientation(), newValue);
    13048}
    13149
  • releases/WebKitGTK/webkit-1.4/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.h

    r76378 r94012  
    2121#define MainFrameScrollbarGtk_h
    2222
    23 #include "GRefPtrGtk.h"
    2423#include "Scrollbar.h"
    2524#include <wtf/PassRefPtr.h>
    26 
    27 typedef struct _GtkAdjustment GtkAdjustment;
    2825
    2926namespace WebCore {
     
    3128class MainFrameScrollbarGtk : public Scrollbar {
    3229public:
    33     static PassRefPtr<MainFrameScrollbarGtk> create(ScrollableArea*, ScrollbarOrientation, GtkAdjustment*);
    34 
    35     ~MainFrameScrollbarGtk();
     30    static PassRefPtr<MainFrameScrollbarGtk> create(ScrollableArea*, ScrollbarOrientation);
    3631    virtual void paint(GraphicsContext*, const IntRect&);
    37     void detachAdjustment();
    38     void attachAdjustment(GtkAdjustment*);
    39 
    40 protected:
    41     virtual void updateThumbPosition();
    42     virtual void updateThumbProportion();
    4332
    4433private:
    45     MainFrameScrollbarGtk(ScrollableArea*, ScrollbarOrientation, GtkAdjustment*);
    46     static void gtkValueChanged(GtkAdjustment*, MainFrameScrollbarGtk*);
    47 
    48     GRefPtr<GtkAdjustment> m_adjustment;
     34    MainFrameScrollbarGtk(ScrollableArea*, ScrollbarOrientation);
    4935};
    5036
  • releases/WebKitGTK/webkit-1.4/Source/WebCore/platform/gtk/ScrollViewGtk.cpp

    r80775 r94012  
    3434#if USE(NATIVE_GTK_MAIN_FRAME_SCROLLBAR)
    3535
    36 #include "ChromeClient.h"
    37 #include "FloatRect.h"
    38 #include "Frame.h"
    39 #include "FrameView.h"
    40 #include "GraphicsContext.h"
    41 #include "GtkVersioning.h"
    4236#include "HostWindow.h"
    43 #include "IntRect.h"
    4437#include "MainFrameScrollbarGtk.h"
    45 #include "Page.h"
    46 #include "PlatformMouseEvent.h"
    47 #include "PlatformWheelEvent.h"
    4838#include "ScrollbarTheme.h"
    4939#include <gtk/gtk.h>
     
    5242
    5343namespace WebCore {
    54 
    55 void ScrollView::platformInit()
    56 {
    57 }
    58 
    59 void ScrollView::platformDestroy()
    60 {
    61     m_horizontalAdjustment = 0;
    62     m_verticalAdjustment = 0;
    63 }
    6444
    6545PassRefPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientation)
     
    7454    // may be null here.
    7555    if (orientation == HorizontalScrollbar)
    76         return MainFrameScrollbarGtk::create(this, orientation, m_horizontalAdjustment.get());
     56        return MainFrameScrollbarGtk::create(this, orientation);
    7757
    7858    // VerticalScrollbar
    79     return MainFrameScrollbarGtk::create(this, orientation, m_verticalAdjustment.get());
    80 }
    81 
    82 void ScrollView::setHorizontalAdjustment(GtkAdjustment* hadj, bool resetValues)
    83 {
    84     ASSERT(!parent() || !hadj);
    85     if (parent())
    86         return;
    87 
    88     m_horizontalAdjustment = hadj;
    89 
    90     if (!m_horizontalAdjustment) {
    91         MainFrameScrollbarGtk* hScrollbar = reinterpret_cast<MainFrameScrollbarGtk*>(horizontalScrollbar());
    92         if (hScrollbar)
    93             hScrollbar->detachAdjustment();
    94 
    95         return;
    96     }
    97 
    98     // We may be lacking scrollbars when returning to a cached
    99     // page, this kicks the page to recreate the scrollbars.
    100     setHasHorizontalScrollbar(true);
    101 
    102     MainFrameScrollbarGtk* hScrollbar = reinterpret_cast<MainFrameScrollbarGtk*>(horizontalScrollbar());
    103     hScrollbar->attachAdjustment(m_horizontalAdjustment.get());
    104 
    105     // We used to reset everything to 0 here, but when page cache
    106     // is enabled we reuse FrameViews that are cached. Since their
    107     // size is not going to change when being restored, (which is
    108     // what would cause the upper limit in the adjusments to be
    109     // set in the normal case), we make sure they are up-to-date
    110     // here. This is needed for the parent scrolling widget to be
    111     // able to report correct values.
    112     int horizontalPageStep = max(max<int>(frameRect().width() * Scrollbar::minFractionToStepWhenPaging(), frameRect().width() - Scrollbar::maxOverlapBetweenPages()), 1);
    113     gtk_adjustment_configure(m_horizontalAdjustment.get(),
    114                              resetValues ? 0 : scrollOffset().width(), 0,
    115                              resetValues ? 0 : contentsSize().width(),
    116                              resetValues ? 0 : Scrollbar::pixelsPerLineStep(),
    117                              resetValues ? 0 : horizontalPageStep,
    118                              resetValues ? 0 : frameRect().width());
    119 }
    120 
    121 void ScrollView::setVerticalAdjustment(GtkAdjustment* vadj, bool resetValues)
    122 {
    123     ASSERT(!parent() || !vadj);
    124     if (parent())
    125         return;
    126 
    127     m_verticalAdjustment = vadj;
    128 
    129     if (!m_verticalAdjustment) {
    130         MainFrameScrollbarGtk* vScrollbar = reinterpret_cast<MainFrameScrollbarGtk*>(verticalScrollbar());
    131         if (vScrollbar)
    132             vScrollbar->detachAdjustment();
    133 
    134         return;
    135     }
    136 
    137     // We may be lacking scrollbars when returning to a cached
    138     // page, this kicks the page to recreate the scrollbars.
    139     setHasVerticalScrollbar(true);
    140 
    141     MainFrameScrollbarGtk* vScrollbar = reinterpret_cast<MainFrameScrollbarGtk*>(verticalScrollbar());
    142     vScrollbar->attachAdjustment(m_verticalAdjustment.get());
    143 
    144     // We used to reset everything to 0 here, but when page cache
    145     // is enabled we reuse FrameViews that are cached. Since their
    146     // size is not going to change when being restored, (which is
    147     // what would cause the upper limit in the adjusments to be
    148     // set in the normal case), we make sure they are up-to-date
    149     // here. This is needed for the parent scrolling widget to be
    150     // able to report correct values.
    151     int verticalPageStep = max(max<int>(frameRect().width() * Scrollbar::minFractionToStepWhenPaging(), frameRect().width() - Scrollbar::maxOverlapBetweenPages()), 1);
    152     gtk_adjustment_configure(m_verticalAdjustment.get(),
    153                              resetValues ? 0 : scrollOffset().height(), 0,
    154                              resetValues ? 0 : contentsSize().height(),
    155                              resetValues ? 0 : Scrollbar::pixelsPerLineStep(),
    156                              resetValues ? 0 : verticalPageStep,
    157                              resetValues ? 0 : frameRect().height());
    158 }
    159 
    160 void ScrollView::setGtkAdjustments(GtkAdjustment* hadj, GtkAdjustment* vadj, bool resetValues)
    161 {
    162     setHorizontalAdjustment(hadj, resetValues);
    163     setVerticalAdjustment(vadj, resetValues);
     59    return MainFrameScrollbarGtk::create(this, orientation);
    16460}
    16561
     
    219115    // We don't need to report policy changes on ScrollView's unless this
    220116    // one has an adjustment attached and it is a main frame.
    221     if (!m_horizontalAdjustment || parent() || !isFrameView())
     117    if (parent() || !isFrameView())
    222118        return;
    223119
  • releases/WebKitGTK/webkit-1.4/Source/WebCore/plugins/gtk/PluginViewGtk.cpp

    r90146 r94012  
    4040#include "Frame.h"
    4141#include "FrameView.h"
     42#include "GRefPtrGtk.h"
    4243#include "GraphicsContext.h"
    4344#include "GtkVersioning.h"
  • releases/WebKitGTK/webkit-1.4/Source/WebKit/gtk/ChangeLog

    r91381 r94012  
     12011-08-29  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Gustavo Noronha Silva.
     4
     5        [GTK] Untangle GtkAdjustments from WebCore
     6        https://bugs.webkit.org/show_bug.cgi?id=59821
     7
     8        Have ChromeClient manage the GtkAdjustments of the parent widget instead of passing
     9        them to WebCore to manage. This simplifies the code quite a bit and should be less
     10        crash prone in the future.
     11
     12        * GNUmakefile.am: Added new GtkAdjustmentWatcher class to the sources list.
     13        * WebCoreSupport/ChromeClientGtk.cpp: Added new GtkAdjustmentWatcher member.
     14        (WebKit::ChromeClient::ChromeClient) Initialize the new member.
     15        (WebKit::ChromeClient::scroll): Poke the adjustment watcher to update the adjustments.
     16        (WebKit::ChromeClient::contentsSizeChanged): Ditto.
     17        (WebKit::ChromeClient::scrollbarsModeDidChange): This may now be called at a time when there
     18        is no main frame, so do an early return in that case.
     19        * WebCoreSupport/ChromeClientGtk.h: Add the new member.
     20        (WebKit::ChromeClient::adjustmentWatcher): Add this getter for WebKitWebView.
     21        * WebCoreSupport/FrameLoaderClientGtk.cpp: Remove calls which pushed the adjustments into
     22        WebCore.
     23        (WebKit::FrameLoaderClient::savePlatformDataToCachedFrame):
     24        (WebKit::postCommitFrameViewSetup):
     25        * WebCoreSupport/GtkAdjustmentWatcher.cpp: Added.
     26        (WebKit::GtkAdjustmentWatcher::GtkAdjustmentWatcher):
     27        (WebKit::updateAdjustmentFromScrollbar):
     28        (WebKit::GtkAdjustmentWatcher::updateAdjustmentsFromScrollbars):
     29        (WebKit::updateAdjustmentCallback):
     30        (WebKit::GtkAdjustmentWatcher::updateAdjustmentsFromScrollbarsLater):
     31        (WebKit::adjustmentValueChangedCallback):
     32        (WebKit::setAdjustment):
     33        (WebKit::GtkAdjustmentWatcher::setHorizontalAdjustment):
     34        (WebKit::GtkAdjustmentWatcher::setVerticalAdjustment):
     35        (WebKit::GtkAdjustmentWatcher::adjustmentValueChanged):
     36        * WebCoreSupport/GtkAdjustmentWatcher.h: Added.
     37        (WebKit::GtkAdjustmentWatcher::horizontalAdjustment):
     38        (WebKit::GtkAdjustmentWatcher::verticalAdjustment):
     39        * webkit/webkitwebview.cpp:
     40        (setHorizontalAdjustment):
     41        (setVerticalAdjustment): Remove the adjustment member. Call into the adjustment watcher.
     42        (getHorizontalAdjustment): Ditto.
     43        (getVerticalAdjustment): Ditto.
     44        (webkit_web_view_size_allocate): Ditto.
     45        (webkit_web_view_set_scroll_adjustments): Ditto.
     46        (webkit_web_view_dispose): Ditto.
     47        (webkit_web_view_init): Ditto.
     48        * webkit/webkitwebviewprivate.h: Ditto.
     49
    1502011-07-11  Gustavo Noronha Silva  <gns@gnome.org>
    251
  • releases/WebKitGTK/webkit-1.4/Source/WebKit/gtk/GNUmakefile.am

    r89272 r94012  
    191191        Source/WebKit/gtk/WebCoreSupport/FullscreenVideoController.cpp \
    192192        Source/WebKit/gtk/WebCoreSupport/FullscreenVideoController.h \
     193        Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.cpp \
     194        Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.h \
    193195        Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp \
    194196        Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h \
  • releases/WebKitGTK/webkit-1.4/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp

    r80836 r94012  
    7272ChromeClient::ChromeClient(WebKitWebView* webView)
    7373    : m_webView(webView)
     74    , m_adjustmentWatcher(webView)
    7475    , m_closeSoonTimer(0)
    7576    , m_pendingScrollInvalidations(false)
     
    449450    cairo_region_destroy(invalidRegion);
    450451#endif
     452
     453    m_adjustmentWatcher.updateAdjustmentsFromScrollbarsLater();
    451454}
    452455
     
    505508        || (requisition.width != size.width()))
    506509        gtk_widget_queue_resize_no_redraw(widget);
     510
     511    // If this was a main frame size change, update the scrollbars.
     512    if (frame != frame->page()->mainFrame())
     513        return;
     514    m_adjustmentWatcher.updateAdjustmentsFromScrollbarsLater();
    507515}
    508516
     
    510518{
    511519    WebKitWebFrame* webFrame = webkit_web_view_get_main_frame(m_webView);
     520    if (!webFrame)
     521        return;
    512522
    513523    g_object_notify(G_OBJECT(webFrame), "horizontal-scrollbar-policy");
     
    742752#endif
    743753
    744 
    745 }
     754}
  • releases/WebKitGTK/webkit-1.4/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h

    r80282 r94012  
    2323
    2424#include "ChromeClient.h"
     25#include "GtkAdjustmentWatcher.h"
    2526#include "KURL.h"
    2627#include "PopupMenu.h"
     
    3940        ChromeClient(WebKitWebView*);
    4041        WebKitWebView* webView() const { return m_webView; }
     42        GtkAdjustmentWatcher* adjustmentWatcher() { return &m_adjustmentWatcher; }
    4143
    4244        virtual void chromeDestroyed();
     
    153155    private:
    154156        WebKitWebView* m_webView;
     157        GtkAdjustmentWatcher m_adjustmentWatcher;
    155158        WebCore::KURL m_hoveredLinkURL;
    156159        unsigned int m_closeSoonTimer;
  • releases/WebKitGTK/webkit-1.4/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp

    r91381 r94012  
    12391239void FrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame* cachedFrame)
    12401240{
    1241     // We need to do this here in order to disconnect the scrollbars
    1242     // that are being used by the frame that is being cached from the
    1243     // adjustments, otherwise they will react to changes in the
    1244     // adjustments, and bad things will happen.
    1245     if (cachedFrame->view())
    1246         cachedFrame->view()->setGtkAdjustments(0, 0);
    12471241}
    12481242
     
    12511245    WebKitWebView* containingWindow = getViewFromFrame(frame);
    12521246    webkit_web_view_clear_resources(containingWindow);
    1253 
    1254     WebKitWebViewPrivate* priv = containingWindow->priv;
    1255     view->setGtkAdjustments(priv->horizontalAdjustment.get(), priv->verticalAdjustment.get(), resetValues);
    12561247
    12571248    // Invalidate the viewport attributes - they will only be valid
    12581249    // again if the page we're beginning to load now has an
    12591250    // appropriate viewport meta tag.
    1260     containingWindow->priv->viewportAttributes->priv->isValid = FALSE;
    1261     g_object_notify(G_OBJECT(containingWindow->priv->viewportAttributes.get()), "valid");
     1251    WebKitWebViewPrivate* priv = containingWindow->priv;
     1252    priv->viewportAttributes->priv->isValid = FALSE;
     1253    g_object_notify(G_OBJECT(priv->viewportAttributes.get()), "valid");
    12621254
    12631255    if (priv->currentMenu) {
  • releases/WebKitGTK/webkit-1.4/Source/WebKit/gtk/webkit/webkitwebview.cpp

    r88736 r94012  
    7777#include "ResourceHandle.h"
    7878#include "ScriptValue.h"
    79 #include "Scrollbar.h"
    8079#include "Settings.h"
    8180#include "webkit/WebKitDOMDocumentPrivate.h"
     
    466465static void setHorizontalAdjustment(WebKitWebView* webView, GtkAdjustment* adjustment)
    467466{
    468     if (!core(webView))
    469         return;
    470 
    471     webView->priv->horizontalAdjustment = adjustment;
    472     FrameView* view = core(webkit_web_view_get_main_frame(webView))->view();
    473     if (!view)
    474         return;
    475     view->setHorizontalAdjustment(adjustment);
     467    // This may be called after the page has been destroyed, in which case we do nothing.
     468    Page* page = core(webView);
     469    if (page)
     470        static_cast<WebKit::ChromeClient*>(page->chrome()->client())->adjustmentWatcher()->setHorizontalAdjustment(adjustment);
    476471}
    477472
    478473static void setVerticalAdjustment(WebKitWebView* webView, GtkAdjustment* adjustment)
    479474{
    480     if (!core(webView))
    481         return;
    482 
    483     webView->priv->verticalAdjustment = adjustment;
    484     FrameView* view = core(webkit_web_view_get_main_frame(webView))->view();
    485     if (!view)
    486         return;
    487     view->setVerticalAdjustment(adjustment);
     475    // This may be called after the page has been destroyed, in which case we do nothing.
     476    Page* page = core(webView);
     477    if (page)
     478        static_cast<WebKit::ChromeClient*>(page->chrome()->client())->adjustmentWatcher()->setVerticalAdjustment(adjustment);
    488479}
    489480
    490481static GtkAdjustment* getHorizontalAdjustment(WebKitWebView* webView)
    491482{
    492     return webView->priv->horizontalAdjustment.get();
     483    Page* page = core(webView);
     484    if (page)
     485        return static_cast<WebKit::ChromeClient*>(page->chrome()->client())->horizontalAdjustment();
     486    return 0;
    493487}
    494488
    495489static GtkAdjustment* getVerticalAdjustment(WebKitWebView* webView)
    496490{
    497     return webView->priv->verticalAdjustment.get();
     491    Page* page = core(webView);
     492    if (page)
     493        return static_cast<WebKit::ChromeClient*>(page->chrome()->client())->verticalAdjustment();
     494    return 0;
    498495}
    499496
     
    985982static void webkit_web_view_size_allocate(GtkWidget* widget, GtkAllocation* allocation)
    986983{
    987     GTK_WIDGET_CLASS(webkit_web_view_parent_class)->size_allocate(widget,allocation);
     984    GTK_WIDGET_CLASS(webkit_web_view_parent_class)->size_allocate(widget, allocation);
    988985
    989986    WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
    990987
    991     Frame* frame = core(webView)->mainFrame();
     988    Page* page = core(webView);
     989    Frame* frame = page->mainFrame();
    992990    if (!frame->view())
    993991        return;
    994992
    995993    frame->view()->resize(allocation->width, allocation->height);
     994    static_cast<WebKit::ChromeClient*>(page->chrome()->client())->adjustmentWatcher()->updateAdjustmentsFromScrollbars();
    996995}
    997996
     
    11131112
    11141113#ifdef GTK_API_VERSION_2
    1115 static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAdjustment* hadj, GtkAdjustment* vadj)
    1116 {
    1117     if (!core(webView))
     1114static void webkit_web_view_set_scroll_adjustments(WebKitWebView* webView, GtkAdjustment* horizontalAdjustment, GtkAdjustment* verticalAdjustment)
     1115{
     1116    // This may be called after the page has been destroyed, in which case we do nothing.
     1117    Page* page = core(webView);
     1118    if (!page)
    11181119        return;
    11191120
    1120     webView->priv->horizontalAdjustment = hadj;
    1121     webView->priv->verticalAdjustment = vadj;
    1122 
    1123     FrameView* view = core(webkit_web_view_get_main_frame(webView))->view();
    1124     if (!view)
    1125         return;
    1126     view->setGtkAdjustments(hadj, vadj);
     1121    WebKit::ChromeClient* client = static_cast<WebKit::ChromeClient*>(page->chrome()->client());
     1122    client->adjustmentWatcher()->setHorizontalAdjustment(horizontalAdjustment);
     1123    client->adjustmentWatcher()->setVerticalAdjustment(verticalAdjustment);
    11271124}
    11281125#endif
     
    13871384    // These smart pointers are cleared manually, because some cleanup operations are
    13881385    // very sensitive to their value. We may crash if these are done in the wrong order.
    1389     priv->horizontalAdjustment.clear();
    1390     priv->verticalAdjustment.clear();
    13911386    priv->backForwardList.clear();
    13921387
     
    35463541    priv->viewportAttributes->priv->webView = webView;
    35473542
    3548     // The smart pointer will call g_object_ref_sink on these adjustments.
    3549     priv->horizontalAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
    3550     priv->verticalAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
    3551 
    35523543    gtk_widget_set_can_focus(GTK_WIDGET(webView), TRUE);
    35533544    priv->mainFrame = WEBKIT_WEB_FRAME(webkit_web_frame_new(webView));
  • releases/WebKitGTK/webkit-1.4/Source/WebKit/gtk/webkit/webkitwebviewprivate.h

    r86112 r94012  
    7171    gboolean transparent;
    7272
    73     GRefPtr<GtkAdjustment> horizontalAdjustment;
    74     GRefPtr<GtkAdjustment> verticalAdjustment;
    75 
    7673#ifndef GTK_API_VERSION_2
    7774    // GtkScrollablePolicy needs to be checked when
Note: See TracChangeset for help on using the changeset viewer.