Skip to content
Permalink
Browse files
Add a pageDidScroll BundleUIClient callback
https://bugs.webkit.org/show_bug.cgi?id=48260
<rdar://problem/8531159>

Reviewed by Adam Roben.

WebKit2:

* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
(WebKit::InjectedBundlePageUIClient::pageDidScroll):
Call the pageDidScroll callback.

* WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::invalidateContentsForSlowScroll):
(WebKit::WebChromeClient::scroll):
Call pageDidScroll.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::pageDidScroll):
Hide the find banner UI and call the BundleUIClient pageDidScroll callback.

WebKitTools:

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::InjectedBundlePage):

Canonical link: https://commits.webkit.org/61014@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@70480 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Anders Carlsson committed Oct 25, 2010
1 parent 4d7fbc6 commit 8dd24e0057d34505efc1d11a424ba6d8b5e3d67d
Showing 9 changed files with 57 additions and 7 deletions.
@@ -1,3 +1,26 @@
2010-10-25 Anders Carlsson <andersca@apple.com>

Reviewed by Adam Roben.

Add a pageDidScroll BundleUIClient callback
https://bugs.webkit.org/show_bug.cgi?id=48260
<rdar://problem/8531159>

* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/InjectedBundle/InjectedBundlePageUIClient.cpp:
(WebKit::InjectedBundlePageUIClient::pageDidScroll):
Call the pageDidScroll callback.

* WebProcess/InjectedBundle/InjectedBundlePageUIClient.h:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::invalidateContentsForSlowScroll):
(WebKit::WebChromeClient::scroll):
Call pageDidScroll.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::pageDidScroll):
Hide the find banner UI and call the BundleUIClient pageDidScroll callback.

2010-10-25 Brian Weinstein <bweinstein@apple.com>

Reviewed by Adam Roben.
@@ -119,6 +119,7 @@ typedef void (*WKBundlePageWillRunJavaScriptAlertCallback)(WKBundlePageRef page,
typedef void (*WKBundlePageWillRunJavaScriptConfirmCallback)(WKBundlePageRef page, WKStringRef message, WKBundleFrameRef frame, const void *clientInfo);
typedef void (*WKBundlePageWillRunJavaScriptPromptCallback)(WKBundlePageRef page, WKStringRef message, WKStringRef defaultValue, WKBundleFrameRef frame, const void *clientInfo);
typedef void (*WKBundlePageMouseDidMoveOverElementCallback)(WKBundlePageRef page, WKBundleHitTestResultRef hitTestResult, WKEventModifiers modifiers, WKTypeRef* userData, const void *clientInfo);
typedef void (*WKBundlePageDidScrollCallback)(WKBundlePageRef page, const void *clientInfo);

struct WKBundlePageUIClient {
int version;
@@ -129,6 +130,7 @@ struct WKBundlePageUIClient {
WKBundlePageWillRunJavaScriptConfirmCallback willRunJavaScriptConfirm;
WKBundlePageWillRunJavaScriptPromptCallback willRunJavaScriptPrompt;
WKBundlePageMouseDidMoveOverElementCallback mouseDidMoveOverElement;
WKBundlePageDidScrollCallback pageDidScroll;
};
typedef struct WKBundlePageUIClient WKBundlePageUIClient;

@@ -89,4 +89,10 @@ void InjectedBundlePageUIClient::mouseDidMoveOverElement(WebPage* page, const Hi
userData = adoptRef(toImpl(userDataToPass));
}

void InjectedBundlePageUIClient::pageDidScroll(WebPage* page)
{
if (m_client.pageDidScroll)
m_client.pageDidScroll(toAPI(page), m_client.clientInfo);
}

} // namespace WebKit
@@ -51,6 +51,7 @@ class InjectedBundlePageUIClient {
void willRunJavaScriptConfirm(WebPage*, const String&, WebFrame*);
void willRunJavaScriptPrompt(WebPage*, const String&, const String&, WebFrame*);
void mouseDidMoveOverElement(WebPage*, const WebCore::HitTestResult&, WebEvent::Modifiers, RefPtr<APIObject>& userData);
void pageDidScroll(WebPage*);

private:
WKBundlePageUIClient m_client;
@@ -325,17 +325,13 @@ void WebChromeClient::invalidateContentsAndWindow(const IntRect& rect, bool imme

void WebChromeClient::invalidateContentsForSlowScroll(const IntRect& rect, bool immediate)
{
// Hide the find indicator.
m_page->findController().hideFindIndicator();

m_page->pageDidScroll();
m_page->drawingArea()->invalidateContentsForSlowScroll(rect, immediate);
}

void WebChromeClient::scroll(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)
{
// Hide the find indicator.
m_page->findController().hideFindIndicator();

m_page->pageDidScroll();
m_page->drawingArea()->scroll(scrollDelta, rectToScroll, clipRect);
}

@@ -448,6 +448,14 @@ void WebPage::uninstallPageOverlay()
m_drawingArea->setNeedsDisplay(IntRect(IntPoint(0, 0), m_viewSize));
}

void WebPage::pageDidScroll()
{
// Hide the find indicator.
m_findController.hideFindIndicator();

m_uiClient.pageDidScroll(this);
}

// Events

static const WebEvent* g_currentEvent = 0;
@@ -168,6 +168,8 @@ class WebPage : public APIObject {

FindController& findController() { return m_findController; }

void pageDidScroll();

private:
WebPage(uint64_t pageID, const WebPageCreationParameters&);

@@ -1,3 +1,14 @@
2010-10-25 Anders Carlsson <andersca@apple.com>

Reviewed by Adam Roben.

Add a pageDidScroll BundleUIClient callback
https://bugs.webkit.org/show_bug.cgi?id=48260
<rdar://problem/8531159>

* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::InjectedBundlePage):

2010-10-25 Johnny Ding <jnd@chromium.org>

Reviewed by Tony Chang.
@@ -189,7 +189,8 @@ InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page)
willRunJavaScriptAlert,
willRunJavaScriptConfirm,
willRunJavaScriptPrompt,
0 /*mouseDidMoveOverElement*/
0, /*mouseDidMoveOverElement*/
0, /*pageDidScroll*/
};
WKBundlePageSetUIClient(m_page, &uiClient);

0 comments on commit 8dd24e0

Please sign in to comment.