Changeset 94012 in webkit
- Timestamp:
- Aug 29, 2011, 1:56:57 PM (14 years ago)
- 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 1 2011-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 1 27 2011-06-30 Martin Robinson <mrobinson@igalia.com> 2 28 -
releases/WebKitGTK/webkit-1.4/Source/WebCore/platform/ScrollView.cpp
r81209 r94012 1172 1172 } 1173 1173 1174 #if !PLATFORM(WX) && ! USE(NATIVE_GTK_MAIN_FRAME_SCROLLBAR) && !PLATFORM(EFL)1174 #if !PLATFORM(WX) && !PLATFORM(EFL) 1175 1175 1176 1176 void ScrollView::platformInit() -
releases/WebKitGTK/webkit-1.4/Source/WebCore/platform/ScrollView.h
r81209 r94012 40 40 #endif 41 41 42 #if PLATFORM(GTK)43 #include "GRefPtrGtk.h"44 typedef struct _GtkAdjustment GtkAdjustment;45 #endif46 47 42 #if PLATFORM(WX) 48 43 class wxScrollWinEvent; … … 389 384 #endif 390 385 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 #endif402 403 386 #if PLATFORM(WX) 404 387 public: -
releases/WebKitGTK/webkit-1.4/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.cpp
r84794 r94012 3 3 * Copyright (C) 2010 Gustavo Noronha Silva <gns@gnome.org> 4 4 * Copyright (C) 2010 Collabora Ltd. 5 * Copyright (C) 2010 Igalia S.L.5 * Copyright (C) 2010, 2011 Igalia S.L. 6 6 * 7 7 * This library is free software; you can redistribute it and/or … … 23 23 #include "MainFrameScrollbarGtk.h" 24 24 25 #include "GraphicsContext.h"26 25 #include "GtkVersioning.h" 27 26 #include "IntRect.h" … … 31 30 using namespace WebCore; 32 31 33 PassRefPtr<MainFrameScrollbarGtk> MainFrameScrollbarGtk::create(ScrollableArea* scrollableArea, ScrollbarOrientation orientation , GtkAdjustment* adj)32 PassRefPtr<MainFrameScrollbarGtk> MainFrameScrollbarGtk::create(ScrollableArea* scrollableArea, ScrollbarOrientation orientation) 34 33 { 35 return adoptRef(new MainFrameScrollbarGtk(scrollableArea, orientation , adj));34 return adoptRef(new MainFrameScrollbarGtk(scrollableArea, orientation)); 36 35 } 37 36 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. 43 MainFrameScrollbarGtk::MainFrameScrollbarGtk(ScrollableArea* scrollableArea, ScrollbarOrientation orientation) 46 44 : Scrollbar(scrollableArea, orientation, RegularScrollbar) 47 , m_adjustment(0)48 45 { 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. 52 47 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 to90 // reset the values so that the surrounding scrollbar gets updated, or91 // 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 WebCore120 // scrollbar. If this is the case, deactivate this signal handler. WebCore will121 // 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);130 48 } 131 49 -
releases/WebKitGTK/webkit-1.4/Source/WebCore/platform/gtk/MainFrameScrollbarGtk.h
r76378 r94012 21 21 #define MainFrameScrollbarGtk_h 22 22 23 #include "GRefPtrGtk.h"24 23 #include "Scrollbar.h" 25 24 #include <wtf/PassRefPtr.h> 26 27 typedef struct _GtkAdjustment GtkAdjustment;28 25 29 26 namespace WebCore { … … 31 28 class MainFrameScrollbarGtk : public Scrollbar { 32 29 public: 33 static PassRefPtr<MainFrameScrollbarGtk> create(ScrollableArea*, ScrollbarOrientation, GtkAdjustment*); 34 35 ~MainFrameScrollbarGtk(); 30 static PassRefPtr<MainFrameScrollbarGtk> create(ScrollableArea*, ScrollbarOrientation); 36 31 virtual void paint(GraphicsContext*, const IntRect&); 37 void detachAdjustment();38 void attachAdjustment(GtkAdjustment*);39 40 protected:41 virtual void updateThumbPosition();42 virtual void updateThumbProportion();43 32 44 33 private: 45 MainFrameScrollbarGtk(ScrollableArea*, ScrollbarOrientation, GtkAdjustment*); 46 static void gtkValueChanged(GtkAdjustment*, MainFrameScrollbarGtk*); 47 48 GRefPtr<GtkAdjustment> m_adjustment; 34 MainFrameScrollbarGtk(ScrollableArea*, ScrollbarOrientation); 49 35 }; 50 36 -
releases/WebKitGTK/webkit-1.4/Source/WebCore/platform/gtk/ScrollViewGtk.cpp
r80775 r94012 34 34 #if USE(NATIVE_GTK_MAIN_FRAME_SCROLLBAR) 35 35 36 #include "ChromeClient.h"37 #include "FloatRect.h"38 #include "Frame.h"39 #include "FrameView.h"40 #include "GraphicsContext.h"41 #include "GtkVersioning.h"42 36 #include "HostWindow.h" 43 #include "IntRect.h"44 37 #include "MainFrameScrollbarGtk.h" 45 #include "Page.h"46 #include "PlatformMouseEvent.h"47 #include "PlatformWheelEvent.h"48 38 #include "ScrollbarTheme.h" 49 39 #include <gtk/gtk.h> … … 52 42 53 43 namespace WebCore { 54 55 void ScrollView::platformInit()56 {57 }58 59 void ScrollView::platformDestroy()60 {61 m_horizontalAdjustment = 0;62 m_verticalAdjustment = 0;63 }64 44 65 45 PassRefPtr<Scrollbar> ScrollView::createScrollbar(ScrollbarOrientation orientation) … … 74 54 // may be null here. 75 55 if (orientation == HorizontalScrollbar) 76 return MainFrameScrollbarGtk::create(this, orientation , m_horizontalAdjustment.get());56 return MainFrameScrollbarGtk::create(this, orientation); 77 57 78 58 // 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); 164 60 } 165 61 … … 219 115 // We don't need to report policy changes on ScrollView's unless this 220 116 // one has an adjustment attached and it is a main frame. 221 if ( !m_horizontalAdjustment ||parent() || !isFrameView())117 if (parent() || !isFrameView()) 222 118 return; 223 119 -
releases/WebKitGTK/webkit-1.4/Source/WebCore/plugins/gtk/PluginViewGtk.cpp
r90146 r94012 40 40 #include "Frame.h" 41 41 #include "FrameView.h" 42 #include "GRefPtrGtk.h" 42 43 #include "GraphicsContext.h" 43 44 #include "GtkVersioning.h" -
releases/WebKitGTK/webkit-1.4/Source/WebKit/gtk/ChangeLog
r91381 r94012 1 2011-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 1 50 2011-07-11 Gustavo Noronha Silva <gns@gnome.org> 2 51 -
releases/WebKitGTK/webkit-1.4/Source/WebKit/gtk/GNUmakefile.am
r89272 r94012 191 191 Source/WebKit/gtk/WebCoreSupport/FullscreenVideoController.cpp \ 192 192 Source/WebKit/gtk/WebCoreSupport/FullscreenVideoController.h \ 193 Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.cpp \ 194 Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.h \ 193 195 Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.cpp \ 194 196 Source/WebKit/gtk/WebCoreSupport/InspectorClientGtk.h \ -
releases/WebKitGTK/webkit-1.4/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp
r80836 r94012 72 72 ChromeClient::ChromeClient(WebKitWebView* webView) 73 73 : m_webView(webView) 74 , m_adjustmentWatcher(webView) 74 75 , m_closeSoonTimer(0) 75 76 , m_pendingScrollInvalidations(false) … … 449 450 cairo_region_destroy(invalidRegion); 450 451 #endif 452 453 m_adjustmentWatcher.updateAdjustmentsFromScrollbarsLater(); 451 454 } 452 455 … … 505 508 || (requisition.width != size.width())) 506 509 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(); 507 515 } 508 516 … … 510 518 { 511 519 WebKitWebFrame* webFrame = webkit_web_view_get_main_frame(m_webView); 520 if (!webFrame) 521 return; 512 522 513 523 g_object_notify(G_OBJECT(webFrame), "horizontal-scrollbar-policy"); … … 742 752 #endif 743 753 744 745 } 754 } -
releases/WebKitGTK/webkit-1.4/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h
r80282 r94012 23 23 24 24 #include "ChromeClient.h" 25 #include "GtkAdjustmentWatcher.h" 25 26 #include "KURL.h" 26 27 #include "PopupMenu.h" … … 39 40 ChromeClient(WebKitWebView*); 40 41 WebKitWebView* webView() const { return m_webView; } 42 GtkAdjustmentWatcher* adjustmentWatcher() { return &m_adjustmentWatcher; } 41 43 42 44 virtual void chromeDestroyed(); … … 153 155 private: 154 156 WebKitWebView* m_webView; 157 GtkAdjustmentWatcher m_adjustmentWatcher; 155 158 WebCore::KURL m_hoveredLinkURL; 156 159 unsigned int m_closeSoonTimer; -
releases/WebKitGTK/webkit-1.4/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
r91381 r94012 1239 1239 void FrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame* cachedFrame) 1240 1240 { 1241 // We need to do this here in order to disconnect the scrollbars1242 // that are being used by the frame that is being cached from the1243 // adjustments, otherwise they will react to changes in the1244 // adjustments, and bad things will happen.1245 if (cachedFrame->view())1246 cachedFrame->view()->setGtkAdjustments(0, 0);1247 1241 } 1248 1242 … … 1251 1245 WebKitWebView* containingWindow = getViewFromFrame(frame); 1252 1246 webkit_web_view_clear_resources(containingWindow); 1253 1254 WebKitWebViewPrivate* priv = containingWindow->priv;1255 view->setGtkAdjustments(priv->horizontalAdjustment.get(), priv->verticalAdjustment.get(), resetValues);1256 1247 1257 1248 // Invalidate the viewport attributes - they will only be valid 1258 1249 // again if the page we're beginning to load now has an 1259 1250 // 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"); 1262 1254 1263 1255 if (priv->currentMenu) { -
releases/WebKitGTK/webkit-1.4/Source/WebKit/gtk/webkit/webkitwebview.cpp
r88736 r94012 77 77 #include "ResourceHandle.h" 78 78 #include "ScriptValue.h" 79 #include "Scrollbar.h"80 79 #include "Settings.h" 81 80 #include "webkit/WebKitDOMDocumentPrivate.h" … … 466 465 static void setHorizontalAdjustment(WebKitWebView* webView, GtkAdjustment* adjustment) 467 466 { 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); 476 471 } 477 472 478 473 static void setVerticalAdjustment(WebKitWebView* webView, GtkAdjustment* adjustment) 479 474 { 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); 488 479 } 489 480 490 481 static GtkAdjustment* getHorizontalAdjustment(WebKitWebView* webView) 491 482 { 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; 493 487 } 494 488 495 489 static GtkAdjustment* getVerticalAdjustment(WebKitWebView* webView) 496 490 { 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; 498 495 } 499 496 … … 985 982 static void webkit_web_view_size_allocate(GtkWidget* widget, GtkAllocation* allocation) 986 983 { 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); 988 985 989 986 WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); 990 987 991 Frame* frame = core(webView)->mainFrame(); 988 Page* page = core(webView); 989 Frame* frame = page->mainFrame(); 992 990 if (!frame->view()) 993 991 return; 994 992 995 993 frame->view()->resize(allocation->width, allocation->height); 994 static_cast<WebKit::ChromeClient*>(page->chrome()->client())->adjustmentWatcher()->updateAdjustmentsFromScrollbars(); 996 995 } 997 996 … … 1113 1112 1114 1113 #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)) 1114 static 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) 1118 1119 return; 1119 1120 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); 1127 1124 } 1128 1125 #endif … … 1387 1384 // These smart pointers are cleared manually, because some cleanup operations are 1388 1385 // very sensitive to their value. We may crash if these are done in the wrong order. 1389 priv->horizontalAdjustment.clear();1390 priv->verticalAdjustment.clear();1391 1386 priv->backForwardList.clear(); 1392 1387 … … 3546 3541 priv->viewportAttributes->priv->webView = webView; 3547 3542 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 3552 3543 gtk_widget_set_can_focus(GTK_WIDGET(webView), TRUE); 3553 3544 priv->mainFrame = WEBKIT_WEB_FRAME(webkit_web_frame_new(webView)); -
releases/WebKitGTK/webkit-1.4/Source/WebKit/gtk/webkit/webkitwebviewprivate.h
r86112 r94012 71 71 gboolean transparent; 72 72 73 GRefPtr<GtkAdjustment> horizontalAdjustment;74 GRefPtr<GtkAdjustment> verticalAdjustment;75 76 73 #ifndef GTK_API_VERSION_2 77 74 // GtkScrollablePolicy needs to be checked when
Note:
See TracChangeset
for help on using the changeset viewer.