Reviewed by Maciej.
<rdar://problem/
4612079> need a way to prevent pages from scrolling to reveal elements that are focused
by script
* bridge/mac/WebCoreFrameBridge.h:
* bridge/mac/WebCoreFrameBridge.mm:
(-[WebCoreFrameBridge setProhibitsScrolling:]):
* page/Frame.cpp:
(WebCore::Frame::prohibitsScrolling):
(WebCore::Frame::setProhibitsScrolling):
* page/Frame.h:
* page/FramePrivate.h:
(WebCore::FramePrivate::FramePrivate):
* page/FrameView.cpp:
(WebCore::FrameView::scrollPointRecursively):
(WebCore::FrameView::setContentsPos):
* page/FrameView.h:
* platform/ScrollView.h:
WebKit:
Reviewed by Maciej.
<rdar://problem/
4612079> need a way to prevent pages from scrolling to reveal elements that are focused
by script
* WebView/WebViewPrivate.h:
* WebView/WebView.m:
(-[WebView setProhibitsMainFrameScrolling:]):
New method. Prohibits scrolling in the WebView's main frame. Used to "lock" a WebView to a specific
scroll position.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15498
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-07-17 Tim Omernick <timo@apple.com>
+
+ Reviewed by Maciej.
+
+ <rdar://problem/4612079> need a way to prevent pages from scrolling to reveal elements that are focused
+ by script
+
+ * bridge/mac/WebCoreFrameBridge.h:
+ * bridge/mac/WebCoreFrameBridge.mm:
+ (-[WebCoreFrameBridge setProhibitsScrolling:]):
+ * page/Frame.cpp:
+ (WebCore::Frame::prohibitsScrolling):
+ (WebCore::Frame::setProhibitsScrolling):
+ * page/Frame.h:
+ * page/FramePrivate.h:
+ (WebCore::FramePrivate::FramePrivate):
+ * page/FrameView.cpp:
+ (WebCore::FrameView::scrollPointRecursively):
+ (WebCore::FrameView::setContentsPos):
+ * page/FrameView.h:
+ * platform/ScrollView.h:
+
2006-07-17 Maciej Stachowiak <mjs@apple.com>
Reviewed by Dave Harrison.
- (void)setInViewSourceMode:(BOOL)flag;
- (BOOL)inViewSourceMode;
+- (void)setProhibitsScrolling:(BOOL)prohibits;
+
@end
// The WebCoreFrameBridge protocol contains methods for use by the WebCore side of the bridge.
return m_frame->inViewSourceMode();
}
+- (void)setProhibitsScrolling:(BOOL)prohibits
+{
+ m_frame->setProhibitsScrolling(prohibits);
+}
+
@end
@implementation WebCoreFrameBridge (WebCoreBridgeInternal)
return d->m_plugins.size() != 0;
}
+bool Frame::prohibitsScrolling() const
+{
+ return d->m_prohibitsScrolling;
+}
+
+void Frame::setProhibitsScrolling(const bool prohibit)
+{
+ d->m_prohibitsScrolling = prohibit;
+}
+
} // namespace WebCore
bool containsPlugins() const;
+ bool prohibitsScrolling() const;
+ void setProhibitsScrolling(const bool);
+
// split out controller objects
FrameTree* tree() const;
SelectionController& selection() const; // FIXME: Change to pointer?
, m_windowHasFocus(false)
, m_inViewSourceMode(false)
, frameCount(0)
+ , m_prohibitsScrolling(false)
{
}
bool m_inViewSourceMode;
unsigned frameCount;
+
+ bool m_prohibitsScrolling;
};
}
d->resizingFrameSet = frameSet;
}
+void FrameView::scrollPointRecursively(int x, int y)
+{
+ if (frame()->prohibitsScrolling())
+ return;
+
+ ScrollView::scrollPointRecursively(x, y);
+}
+
+void FrameView::setContentsPos(int x, int y)
+{
+ if (frame()->prohibitsScrolling())
+ return;
+
+ ScrollView::setContentsPos(x, y);
+}
+
MouseEventWithHitTestResults FrameView::prepareMouseEvent(bool readonly, bool active, bool mouseMove, const PlatformMouseEvent& mev)
{
ASSERT(m_frame);
void updateDashboardRegions();
#endif
+ virtual void scrollPointRecursively(int x, int y);
+ virtual void setContentsPos(int x, int y);
+
void scheduleEvent(PassRefPtr<Event>, PassRefPtr<EventTargetNode>, bool tempEvent);
void ref() { ++m_refCount; }
int contentsY() const;
IntSize scrollOffset() const;
void scrollBy(int dx, int dy);
- void scrollPointRecursively(int dx, int dy);
+ virtual void scrollPointRecursively(int dx, int dy);
- void setContentsPos(int x, int y);
+ virtual void setContentsPos(int x, int y);
virtual void setVScrollBarMode(ScrollBarMode);
virtual void setHScrollBarMode(ScrollBarMode);
+2006-07-17 Tim Omernick <timo@apple.com>
+
+ Reviewed by Maciej.
+
+ <rdar://problem/4612079> need a way to prevent pages from scrolling to reveal elements that are focused
+ by script
+
+ * WebView/WebViewPrivate.h:
+ * WebView/WebView.m:
+ (-[WebView setProhibitsMainFrameScrolling:]):
+ New method. Prohibits scrolling in the WebView's main frame. Used to "lock" a WebView to a specific
+ scroll position.
+
2006-07-17 Timothy Hatcher <timothy@apple.com>
Reviewed by Darin.
}
}
+- (void)setProhibitsMainFrameScrolling:(BOOL)prohibits
+{
+ [[[self mainFrame] _bridge] setProhibitsScrolling:YES];
+}
+
- (BOOL)alwaysShowHorizontalScroller
{
WebDynamicScrollBarsView *scrollview = (WebDynamicScrollBarsView *)[[[self mainFrame] frameView] _scrollView];
*/
- (BOOL)alwaysShowHorizontalScroller;
+/*!
+ @method setProhibitsMainFrameScrolling:
+ @abstract Prohibits scrolling in the WebView's main frame. Used to "lock" a WebView
+ to a specific scroll position.
+ */
+- (void)setProhibitsMainFrameScrolling:(BOOL)prohibits;
+
/*!
@method _setAdditionalWebPlugInPaths:
@abstract Sets additional plugin search paths for a specific WebView.