Changeset 21454 in webkit
- Timestamp:
- May 14, 2007, 6:30:41 AM (18 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r21452 r21454 1 2007-05-14 Darin Adler <darin@apple.com> 2 3 Reviewed by Antti. 4 5 - fix <rdar://problem/3109180> VIP: after go back, page jumps after loading even if I scrolled while loading 6 7 * history/CachedPage.cpp: (WebCore::CachedPage::clear): Call clearFrame rather than 8 clearPart -- the "part" term was leftover prehistoric terminology. 9 10 * loader/FrameLoader.cpp: 11 (WebCore::FrameLoader::open): Call setWasScrolledByUser(false) on the page, so that we 12 can detect any user scrolling that happens during the "go back" process. 13 (WebCore::FrameLoader::restoreScrollPositionAndViewState): Don't scroll if the view's 14 wasScrolledByUser flag is set. 15 (WebCore::FrameLoader::loadItem): Call setWasScrolledByUser(false) false when we do 16 a new "load" (actually just a scroll) using the same frame. Also moved the line of code that 17 sets m_currentHistoryItem to make this code path mroe similar to recursiveGoToItem. 18 (WebCore::FrameLoader::recursiveGoToItem): Ditto. 19 20 * page/Frame.cpp: 21 (WebCore::Frame::~Frame): Call clearFrame rather than stting m_frame directly. 22 (WebCore::Frame::sendScrollEvent): Call setWasScrolledByUser(true) on FrameView. The FrameView 23 itself knows to ignore this if the scrolling is being done programmatically instead of by the user. 24 25 * page/FrameView.h: Added wasScrolledByUser and setWasScrolledByUser. Also removed unneeded 26 include and class forward declarations, renamed clearPart to clearFrame, removed uneeded function 27 haveDelayedLayoutScheduled, and removed unneeded friend declarations. 28 * page/FrameView.cpp: 29 (WebCore::FrameViewPrivate::FrameViewPrivate): Added m_inProgrammaticScroll and m_wasScrolledByUser. 30 (WebCore::FrameViewPrivate::reset): Set m_wasScrolledByUser to false. 31 (WebCore::FrameView::clearFrame): Renamed from clearPart. 32 (WebCore::FrameView::scrollRectIntoViewRecursively): Added code to set the m_inProgrammaticScroll flag. 33 (WebCore::FrameView::setContentsPos): Ditto. 34 (WebCore::FrameView::wasScrolledByUser): Added. 35 (WebCore::FrameView::setWasScrolledByUser): Added. Does nothing if called when m_inProgrammaticScroll 36 is true. 37 1 38 2007-05-14 Darin Adler <darin@apple.com> 2 39 -
trunk/WebCore/history/CachedPage.cpp
r21179 r21454 145 145 } 146 146 147 m_view->clear Part();147 m_view->clearFrame(); 148 148 } 149 149 -
trunk/WebCore/loader/FrameLoader.cpp
r21430 r21454 2559 2559 m_wasLoadEventEmitted = false; 2560 2560 m_outgoingReferrer = URL.url(); 2561 2562 m_frame->setView(cachedPage.view()); 2561 2562 FrameView* view = cachedPage.view(); 2563 if (view) 2564 view->setWasScrolledByUser(false); 2565 m_frame->setView(view); 2563 2566 2564 2567 m_frame->setDocument(document); … … 3589 3592 } 3590 3593 3591 LOG 3594 LOG(History, "WebCoreHistory: Creating item for %s", url.url().ascii()); 3592 3595 3593 3596 // Frames that have never successfully loaded any content … … 3680 3683 return; 3681 3684 3682 // FIXME: It would be great to work out a way to put this code in WebCore instead of calling through to the client. 3685 // FIXME: It would be great to work out a way to put this code in WebCore instead of calling 3686 // through to the client. It's currently used only for the PDF view on Mac. 3683 3687 m_client->restoreViewState(); 3684 3688 3685 if (m_frame->view()) { 3686 const IntPoint& scrollPoint = m_currentHistoryItem->scrollPoint(); 3687 m_frame->view()->setContentsPos(scrollPoint.x(), scrollPoint.y()); 3688 } 3689 if (FrameView* view = m_frame->view()) 3690 if (!view->wasScrolledByUser()) { 3691 const IntPoint& scrollPoint = m_currentHistoryItem->scrollPoint(); 3692 view->setContentsPos(scrollPoint.x(), scrollPoint.y()); 3693 } 3689 3694 } 3690 3695 … … 3785 3790 // We also do not do anchor-style navigation if we're posting a form. 3786 3791 3787 // FIXME: These checks don't match the ones in _loadURL:referrer:loadType:target:triggeringEvent:isFormSubmission:3788 // Perhaps they should.3789 3792 if (!formData && !shouldReload(itemURL, currentURL) && urlsMatchItem(item)) { 3790 #if 03791 // FIXME: We need to normalize the code paths for anchor navigation. Something3792 // like the following line of code should be done, but also accounting for correct3793 // updates to the back/forward list and scroll position.3794 // rjw 4/9/03 See 3223929.3795 [self _loadURL:itemURL referrer:[[[self dataSource] request] HTTPReferrer] loadType:loadType target:nil triggeringEvent:nil form:nil formValues:nil];3796 #endif3797 3798 3793 // Must do this maintenance here, since we don't go through a real page reload 3799 3794 saveScrollPositionAndViewStateToItem(m_currentHistoryItem.get()); 3800 3795 3801 // FIXME: form state might want to be saved here too 3796 if (FrameView* view = m_frame->view()) 3797 view->setWasScrolledByUser(false); 3798 3799 m_currentHistoryItem = item; 3800 3801 // FIXME: Form state might need to be saved here too. 3802 3802 3803 3803 // We always call scrollToAnchor here, even if the URL doesn't have an … … 3806 3806 3807 3807 // must do this maintenance here, since we don't go through a real page reload 3808 m_currentHistoryItem = item;3809 3808 restoreScrollPositionAndViewState(); 3810 3809 … … 3830 3829 double interval = currentTime() - cachedPage->timeStamp(); 3831 3830 3832 // FIXME: 1800 is the current backforwardcache expiration time, but we actually store as a pref -3833 // previously, this code was -3834 // if (interval <= [[getWebView(self) preferences] _backForwardCacheExpirationInterval]) {3831 // FIXME: 1800 should not be hardcoded, it should come from 3832 // WebKitBackForwardCacheExpirationIntervalKey in WebKit. 3833 // Or we should remove WebKitBackForwardCacheExpirationIntervalKey. 3835 3834 if (interval <= 1800) { 3836 3835 load(cachedPage->documentLoader(), loadType, 0); 3837 3836 inPageCache = true; 3838 3837 } else { 3839 LOG 3838 LOG(PageCache, "Not restoring page for %s from back/forward cache because cache entry has expired", m_provisionalHistoryItem->url().url().ascii()); 3840 3839 item->setCachedPage(0); 3841 3840 } … … 3971 3970 saveDocumentState(); 3972 3971 saveScrollPositionAndViewStateToItem(m_currentHistoryItem.get()); 3972 3973 if (FrameView* view = m_frame->view()) 3974 view->setWasScrolledByUser(false); 3975 3973 3976 m_currentHistoryItem = item; 3974 3977 … … 3976 3979 restoreDocumentState(); 3977 3980 3978 // Restore the scroll position ( taken in favor of going back to the anchor)3981 // Restore the scroll position (we choose to do this rather than going back to the anchor point) 3979 3982 restoreScrollPositionAndViewState(); 3980 3983 -
trunk/WebCore/page/Frame.cpp
r21430 r21454 243 243 if (d->m_view) { 244 244 d->m_view->hide(); 245 d->m_view-> m_frame = 0;245 d->m_view->clearFrame(); 246 246 } 247 247 … … 1397 1397 void Frame::sendScrollEvent() 1398 1398 { 1399 FrameView *v = d->m_view.get(); 1400 if (v) { 1401 Document *doc = document(); 1402 if (!doc) 1403 return; 1404 doc->dispatchHTMLEvent(scrollEvent, true, false); 1405 } 1399 FrameView* v = d->m_view.get(); 1400 if (!v) 1401 return; 1402 v->setWasScrolledByUser(true); 1403 Document* doc = document(); 1404 if (!doc) 1405 return; 1406 doc->dispatchHTMLEvent(scrollEvent, true, false); 1406 1407 } 1407 1408 -
trunk/WebCore/page/FrameView.cpp
r21390 r21454 61 61 , m_overflowStatusDirty(true) 62 62 , m_viewportRenderer(0) 63 , m_wasScrolledByUser(false) 64 , m_inProgrammaticScroll(false) 63 65 { 64 66 isTransparent = false; … … 81 83 firstLayout = true; 82 84 repaintRects.clear(); 85 m_wasScrolledByUser = false; 83 86 } 84 87 … … 117 120 bool m_verticalOverflow; 118 121 RenderObject* m_viewportRenderer; 122 123 bool m_wasScrolledByUser; 124 bool m_inProgrammaticScroll; 119 125 }; 120 126 … … 151 157 } 152 158 153 void FrameView::clear Part()159 void FrameView::clearFrame() 154 160 { 155 161 m_frame = 0; … … 600 606 if (frame()->prohibitsScrolling()) 601 607 return; 608 bool wasInProgrammaticScroll = d->m_inProgrammaticScroll; 609 d->m_inProgrammaticScroll = true; 602 610 ScrollView::scrollRectIntoViewRecursively(r); 611 d->m_inProgrammaticScroll = wasInProgrammaticScroll; 603 612 } 604 613 605 614 void FrameView::setContentsPos(int x, int y) 606 615 { 616 ASSERT(!d->m_inProgrammaticScroll); 607 617 if (frame()->prohibitsScrolling()) 608 618 return; 619 bool wasInProgrammaticScroll = d->m_inProgrammaticScroll; 620 d->m_inProgrammaticScroll = true; 609 621 ScrollView::setContentsPos(x, y); 622 d->m_inProgrammaticScroll = wasInProgrammaticScroll; 610 623 } 611 624 … … 703 716 } 704 717 705 bool FrameView::haveDelayedLayoutScheduled()706 {707 return d->layoutTimer.isActive() && d->delayedLayout;708 }709 710 718 void FrameView::unscheduleRelayout() 711 719 { … … 902 910 } 903 911 904 } 912 bool FrameView::wasScrolledByUser() const 913 { 914 return d->m_wasScrolledByUser; 915 } 916 917 void FrameView::setWasScrolledByUser(bool wasScrolledByUser) 918 { 919 if (d->m_inProgrammaticScroll) 920 return; 921 d->m_wasScrolledByUser = wasScrolledByUser; 922 } 923 924 } -
trunk/WebCore/page/FrameView.h
r20901 r21454 1 /* This file is part of the KDE project 2 1 /* 3 2 Copyright (C) 1997 Martin Jones (mjones@kde.org) 4 3 (C) 1998 Waldo Bastian (bastian@kde.org) … … 6 5 (C) 1999 Lars Knoll (knoll@kde.org) 7 6 (C) 1999 Antti Koivisto (koivisto@kde.org) 8 Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.7 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 9 8 10 9 This library is free software; you can redistribute it and/or … … 29 28 #include "ScrollView.h" 30 29 #include "IntSize.h" 31 #include "PlatformString.h"30 #include <wtf/Forward.h> 32 31 33 32 namespace WebCore { 34 33 35 class AtomicString;36 34 class Color; 37 class Clipboard;38 35 class Event; 39 36 class EventTargetNode; 40 37 class Frame; 41 38 class FrameViewPrivate; 42 class HTMLFrameSetElement;43 class IntPoint;44 39 class IntRect; 45 class KeyboardEvent;46 40 class PlatformMouseEvent; 47 class MouseEventWithHitTestResults;48 41 class Node; 49 42 class RenderLayer; 50 43 class RenderObject; 51 class PlatformWheelEvent;44 class String; 52 45 53 46 template <typename T> class Timer; … … 59 52 60 53 Frame* frame() const { return m_frame.get(); } 54 void clearFrame(); 61 55 62 56 void ref() { ++m_refCount; } … … 72 66 virtual void setHScrollbarMode(ScrollbarMode); 73 67 virtual void setScrollbarsMode(ScrollbarMode); 74 68 75 69 void layout(bool allowSubtree = true); 76 70 bool didFirstLayout() const; … … 79 73 void scheduleRelayoutOfSubtree(Node*); 80 74 void unscheduleRelayout(); 81 bool haveDelayedLayoutScheduled();82 75 bool layoutPending() const; 83 76 … … 96 89 97 90 void clear(); 98 void clearPart();99 91 100 92 bool isTransparent() const; … … 111 103 IntRect windowClipRectForLayer(const RenderLayer*, bool clipToLayerContents) const; 112 104 113 virtual void scrollRectIntoViewRecursively(const IntRect& r);105 virtual void scrollRectIntoViewRecursively(const IntRect&); 114 106 virtual void setContentsPos(int x, int y); 115 107 116 108 String mediaType() const; 109 void setMediaType(const String&); 117 110 118 111 void setUseSlowRepaints(); … … 126 119 void restoreScrollbar(); 127 120 128 void setMediaType(const String&);129 130 121 virtual bool handleMouseMoveEvent(const PlatformMouseEvent&); 131 122 virtual bool handleMouseReleaseEvent(const PlatformMouseEvent&); … … 134 125 void pauseScheduledEvents(); 135 126 void resumeScheduledEvents(); 127 128 bool wasScrolledByUser() const; 129 void setWasScrolledByUser(bool); 136 130 137 131 private: … … 157 151 RefPtr<Frame> m_frame; 158 152 FrameViewPrivate* d; 159 160 friend class Frame;161 friend class FrameMac;162 163 153 }; 164 154 … … 166 156 167 157 #endif 168
Note:
See TracChangeset
for help on using the changeset viewer.