to the right or left hand side.
Part of <rdar://problem/
9017043>.
Reviewed by Maciej Stachowiak.
* UIProcess/API/C/WKPage.cpp:
(WKPageIsPinnedToLeftSide):
(WKPageIsPinnedToRightSide):
* UIProcess/API/C/WKPage.h:
Add new API calls.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::close):
(WebKit::WebPageProxy::processDidCrash):
(WebKit::WebPageProxy::didChangeScrollOffsetPinningForMainFrame):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::isPinnedToLeftSide):
(WebKit::WebPageProxy::isPinnedToRightSide):
Initialize, reset and update the pinned state.
* UIProcess/WebPageProxy.messages.in:
Add message to update the pinned state.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::didChangeScrollOffset):
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
(WebKit::WebPage::didChangeScrollOffsetForMainFrame):
* WebProcess/WebPage/WebPage.h:
Cache the pinned state, and only update the UIProcess when it
changes.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@79025
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-02-18 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Maciej Stachowiak.
+
+ Add the ability to ask the WKPage if the main frame is pinned
+ to the right or left hand side.
+ Part of <rdar://problem/9017043>.
+
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageIsPinnedToLeftSide):
+ (WKPageIsPinnedToRightSide):
+ * UIProcess/API/C/WKPage.h:
+ Add new API calls.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::WebPageProxy):
+ (WebKit::WebPageProxy::close):
+ (WebKit::WebPageProxy::processDidCrash):
+ (WebKit::WebPageProxy::didChangeScrollOffsetPinningForMainFrame):
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::isPinnedToLeftSide):
+ (WebKit::WebPageProxy::isPinnedToRightSide):
+ Initialize, reset and update the pinned state.
+
+ * UIProcess/WebPageProxy.messages.in:
+ Add message to update the pinned state.
+
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::didChangeScrollOffset):
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage):
+ (WebKit::WebPage::didChangeScrollOffsetForMainFrame):
+ * WebProcess/WebPage/WebPage.h:
+ Cache the pinned state, and only update the UIProcess when it
+ changes.
+
2011-02-18 Anders Carlsson <andersca@apple.com>
Reviewed by Simon Fraser.
return toImpl(pageRef)->hasVerticalScrollbar();
}
+bool WKPageIsPinnedToLeftSide(WKPageRef pageRef)
+{
+ return toImpl(pageRef)->isPinnedToLeftSide();
+}
+
+bool WKPageIsPinnedToRightSide(WKPageRef pageRef)
+{
+ return toImpl(pageRef)->isPinnedToRightSide();
+}
+
void WKPageFindString(WKPageRef pageRef, WKStringRef string, WKFindOptions options, unsigned maxMatchCount)
{
toImpl(pageRef)->findString(toImpl(string)->string(), toFindOptions(options), maxMatchCount);
WK_EXPORT bool WKPageHasHorizontalScrollbar(WKPageRef page);
WK_EXPORT bool WKPageHasVerticalScrollbar(WKPageRef page);
+WK_EXPORT bool WKPageIsPinnedToLeftSide(WKPageRef page);
+WK_EXPORT bool WKPageIsPinnedToRightSide(WKPageRef page);
+
WK_EXPORT void WKPageFindString(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount);
WK_EXPORT void WKPageHideFindUI(WKPageRef page);
WK_EXPORT void WKPageCountStringMatches(WKPageRef page, WKStringRef string, WKFindOptions findOptions, unsigned maxMatchCount);
, m_currentDragOperation(DragOperationNone)
, m_mainFrameHasHorizontalScrollbar(false)
, m_mainFrameHasVerticalScrollbar(false)
+ , m_mainFrameIsPinnedToLeftSide(false)
+ , m_mainFrameIsPinnedToRightSide(false)
{
#ifndef NDEBUG
webPageProxyCounter.increment();
m_mainFrameHasHorizontalScrollbar = false;
m_mainFrameHasVerticalScrollbar = false;
+ m_mainFrameIsPinnedToLeftSide = false;
+ m_mainFrameIsPinnedToRightSide = false;
+
invalidateCallbackMap(m_voidCallbacks);
invalidateCallbackMap(m_dataCallbacks);
invalidateCallbackMap(m_stringCallbacks);
m_mainFrameHasHorizontalScrollbar = false;
m_mainFrameHasVerticalScrollbar = false;
+ m_mainFrameIsPinnedToLeftSide = false;
+ m_mainFrameIsPinnedToRightSide = false;
+
invalidateCallbackMap(m_voidCallbacks);
invalidateCallbackMap(m_dataCallbacks);
invalidateCallbackMap(m_stringCallbacks);
m_pageClient->didChangeScrollbarsForMainFrame();
}
+void WebPageProxy::didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide)
+{
+ m_mainFrameIsPinnedToLeftSide = pinnedToLeftSide;
+ m_mainFrameIsPinnedToRightSide = pinnedToRightSide;
+}
+
void WebPageProxy::didFinishLoadingDataForCustomRepresentation(const CoreIPC::DataReference& dataReference)
{
m_pageClient->didFinishLoadingDataForCustomRepresentation(dataReference);
bool hasHorizontalScrollbar() const { return m_mainFrameHasHorizontalScrollbar; }
bool hasVerticalScrollbar() const { return m_mainFrameHasVerticalScrollbar; }
+ bool isPinnedToLeftSide() const { return m_mainFrameIsPinnedToLeftSide; }
+ bool isPinnedToRightSide() const { return m_mainFrameIsPinnedToRightSide; }
+
#if PLATFORM(MAC)
// Called by the web process through a message.
void registerWebProcessAccessibilityToken(const CoreIPC::DataReference&);
void runModal() { m_uiClient.runModal(this); }
void didCompleteRubberBandForMainFrame(const WebCore::IntSize&);
void didChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar);
+ void didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide);
void reattachToWebProcess();
void reattachToWebProcessWithItem(WebBackForwardListItem*);
bool m_mainFrameHasHorizontalScrollbar;
bool m_mainFrameHasVerticalScrollbar;
+ bool m_mainFrameIsPinnedToLeftSide;
+ bool m_mainFrameIsPinnedToRightSide;
+
static WKPageDebugPaintFlags s_debugPaintFlags;
};
RunModal()
DidCompleteRubberBandForMainFrame(WebCore::IntSize initialOverhang)
DidChangeScrollbarsForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar)
+ DidChangeScrollOffsetPinningForMainFrame(bool hasHorizontalScrollbar, bool hasVerticalScrollbar)
#if ENABLE(TILED_BACKING_STORE)
PageDidRequestScroll(WebCore::IntSize delta)
return false;
}
+void WebFrameLoaderClient::didChangeScrollOffset()
+{
+ WebPage* webPage = m_frame->page();
+ if (!webPage)
+ return;
+
+ if (!m_frame->isMainFrame())
+ return;
+
+ webPage->didChangeScrollOffsetForMainFrame();
+}
+
PassRefPtr<FrameNetworkingContext> WebFrameLoaderClient::createNetworkingContext()
{
return WebFrameNetworkingContext::create(m_frame->coreFrame());
#endif
virtual bool shouldUsePluginDocument(const String& /*mimeType*/) const;
-
+
+ virtual void didChangeScrollOffset();
+
virtual PassRefPtr<WebCore::FrameNetworkingContext> createNetworkingContext();
WebFrame* m_frame;
, m_pageID(pageID)
, m_canRunModal(parameters.canRunModal)
, m_isRunningModal(false)
+ , m_cachedMainFrameIsPinnedToLeftSide(false)
+ , m_cachedMainFrameIsPinnedToRightSide(false)
{
ASSERT(m_pageID);
return static_cast<WebFrameLoaderClient*>(mainFrame()->coreFrame()->loader()->client())->frameHasCustomRepresentation();
}
+void WebPage::didChangeScrollOffsetForMainFrame()
+{
+ Frame* frame = m_page->mainFrame();
+ IntPoint scrollPosition = frame->view()->scrollPosition();
+ IntPoint maximumScrollPosition = frame->view()->maximumScrollPosition();
+
+ bool isPinnedToLeftSide = (scrollPosition.x() <= 0);
+ bool isPinnedToRightSide = (scrollPosition.x() >= maximumScrollPosition.x());
+
+ if (isPinnedToLeftSide != m_cachedMainFrameIsPinnedToLeftSide || isPinnedToRightSide != m_cachedMainFrameIsPinnedToRightSide) {
+ send(Messages::WebPageProxy::DidChangeScrollOffsetPinningForMainFrame(isPinnedToLeftSide, isPinnedToRightSide));
+
+ m_cachedMainFrameIsPinnedToLeftSide = isPinnedToLeftSide;
+ m_cachedMainFrameIsPinnedToRightSide = isPinnedToRightSide;
+ }
+}
+
#if PLATFORM(MAC)
void WebPage::addPluginView(PluginView* pluginView)
bool mainFrameHasCustomRepresentation() const;
+ void didChangeScrollOffsetForMainFrame();
+
bool canRunModal() const { return m_canRunModal; }
void runModal();
bool m_canRunModal;
bool m_isRunningModal;
+
+ bool m_cachedMainFrameIsPinnedToLeftSide;
+ bool m_cachedMainFrameIsPinnedToRightSide;
};
} // namespace WebKit