本文整理汇总了C++中PlatformWebView类的典型用法代码示例。如果您正苦于以下问题:C++ PlatformWebView类的具体用法?C++ PlatformWebView怎么用?C++ PlatformWebView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PlatformWebView类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dumpPixelsAndCompareWithExpected
void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef image, WKArrayRef repaintRects)
{
PlatformWebView* webView = TestController::shared().mainWebView();
WKRetainPtr<WKImageRef> windowSnapshot = webView->windowSnapshotImage();
// There is no way at this time to fake a window's scale factor, so we need to avoid the window
// snapshots for HiDPI tests.
if (WKPageGetBackingScaleFactor(webView->page()) != 1)
windowSnapshot = 0;
RetainPtr<CGContextRef> context;
if (windowSnapshot)
context = adoptCF(createCGContextFromImage(windowSnapshot.get(), DontFlipGraphicsContext));
else
context = adoptCF(createCGContextFromImage(image));
// A non-null repaintRects array means we're doing a repaint test.
if (repaintRects)
paintRepaintRectOverlay(context.get(), image, repaintRects);
char actualHash[33];
computeMD5HashStringForContext(context.get(), actualHash);
if (!compareActualHashToExpectedAndDumpResults(actualHash))
dumpBitmap(context.get(), actualHash);
}
示例2: runModal
void TestController::runModal(WKPageRef page, const void* clientInfo)
{
PlatformWebView* view = static_cast<PlatformWebView*>(const_cast<void*>(clientInfo));
view->setWindowIsKey(false);
runModal(view);
view->setWindowIsKey(true);
}
示例3: didFinishDocumentLoadForFrame
static void didFinishDocumentLoadForFrame(WKPageRef page, WKFrameRef frame, WKTypeRef userData, const void *clientInfo)
{
WKPageSetScrollPinningBehavior(page, kWKScrollPinningBehaviorPinToBottom);
EXPECT_JS_EQ(page, "window.scrollY", "2434");
PlatformWebView* webView = (PlatformWebView*)clientInfo;
webView->resizeTo(800, 200);
EXPECT_JS_EQ(page, "window.scrollY", "2834");
EXPECT_JS_EQ(page, "window.scrollTo(0,0)", "undefined");
EXPECT_JS_EQ(page, "window.scrollY", "2834");
WKPageSetScrollPinningBehavior(page, kWKScrollPinningBehaviorPinToTop);
EXPECT_JS_EQ(page, "window.scrollY", "0");
EXPECT_JS_EQ(page, "window.scrollTo(0,200)", "undefined");
EXPECT_JS_EQ(page, "window.scrollY", "0");
WKPageSetScrollPinningBehavior(page, kWKScrollPinningBehaviorDoNotPin);
EXPECT_JS_EQ(page, "window.scrollY", "0");
EXPECT_JS_EQ(page, "window.scrollTo(0,200)", "undefined");
EXPECT_JS_EQ(page, "window.scrollY", "200");
testDone = true;
}
示例4: PlatformWebView
WKPageRef TestController::createOtherPage(WKPageRef oldPage, WKURLRequestRef, WKDictionaryRef, WKEventModifiers, WKEventMouseButton, const void*)
{
PlatformWebView* view = new PlatformWebView(WKPageGetContext(oldPage), WKPageGetPageGroup(oldPage));
WKPageRef newPage = view->page();
view->resizeTo(800, 600);
WKPageUIClient otherPageUIClient = {
kWKPageUIClientCurrentVersion,
view,
0, // createNewPage_deprecatedForUseWithV0
0, // showPage
closeOtherPage,
0, // takeFocus
focus,
unfocus,
0, // runJavaScriptAlert
0, // runJavaScriptConfirm
0, // runJavaScriptPrompt
0, // setStatusText
0, // mouseDidMoveOverElement_deprecatedForUseWithV0
0, // missingPluginButtonClicked
0, // didNotHandleKeyEvent
0, // didNotHandleWheelEvent
0, // toolbarsAreVisible
0, // setToolbarsAreVisible
0, // menuBarIsVisible
0, // setMenuBarIsVisible
0, // statusBarIsVisible
0, // setStatusBarIsVisible
0, // isResizable
0, // setIsResizable
getWindowFrameOtherPage,
setWindowFrameOtherPage,
runBeforeUnloadConfirmPanel,
0, // didDraw
0, // pageDidScroll
exceededDatabaseQuota,
0, // runOpenPanel
0, // decidePolicyForGeolocationPermissionRequest
0, // headerHeight
0, // footerHeight
0, // drawHeader
0, // drawFooter
0, // printFrame
runModal,
0, // didCompleteRubberBandForMainFrame
0, // saveDataToFileInDownloadsFolder
0, // shouldInterruptJavaScript
createOtherPage,
0, // mouseDidMoveOverElement
0, // decidePolicyForNotificationPermissionRequest
};
WKPageSetPageUIClient(newPage, &otherPageUIClient);
WKRetain(newPage);
return newPage;
}
示例5: initialize
static void initialize(const PlatformWebView& webView)
{
WKPageLoaderClient loaderClient;
memset(&loaderClient, 0, sizeof(loaderClient));
loaderClient.version = 0;
loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
WKPageSetPageLoaderClient(webView.page(), &loaderClient);
WKViewSetFindIndicatorCallback(webView.platformView(), findIndicatorCallback, 0);
}
示例6: didLayout
static void didLayout(WKPageRef page, WKLayoutMilestones milestones, WKTypeRef, const void* clientInfo)
{
if (milestones & kWKDidFirstLayoutAfterSuppressedIncrementalRendering) {
PlatformWebView* webView = (PlatformWebView*)clientInfo;
unsigned pageCount = WKPageGetPageCount(page);
EXPECT_EQ(expectedPageCount, pageCount);
webView->resizeTo((pageLength * pageCount) + (pageGap * (pageCount - 1)), 500);
EXPECT_JS_EQ(page, "window.scrollX", "0");
testDone = true;
}
}
示例7: setupView
void setupView(PlatformWebView& webView)
{
WKPageUIClientV2 uiClient;
memset(&uiClient, 0, sizeof(uiClient));
uiClient.base.version = 2;
uiClient.decidePolicyForGeolocationPermissionRequest = decidePolicyForGeolocationPermissionRequestCallBack;
WKPageSetPageUIClient(webView.page(), &uiClient.base);
}
示例8: unfocus
static void unfocus(WKPageRef page, const void* clientInfo)
{
PlatformWebView* view = static_cast<PlatformWebView*>(const_cast<void*>(clientInfo));
view->setWindowIsKey(false);
}
示例9: setWindowFrame
static void setWindowFrame(WKPageRef page, WKRect frame, const void* clientInfo)
{
PlatformWebView* view = static_cast<PlatformWebView*>(const_cast<void*>(clientInfo));
view->setWindowFrame(frame);
}
示例10: getWindowFrame
static WKRect getWindowFrame(WKPageRef page, const void* clientInfo)
{
PlatformWebView* view = static_cast<PlatformWebView*>(const_cast<void*>(clientInfo));
return view->windowFrame();
}
示例11: setWindowFrameMainPage
static void setWindowFrameMainPage(WKPageRef page, WKRect frame, const void* clientInfo)
{
PlatformWebView* view = static_cast<TestController*>(const_cast<void*>(clientInfo))->mainWebView();
view->setWindowFrame(frame);
}
示例12: getWindowFrameMainPage
static WKRect getWindowFrameMainPage(WKPageRef page, const void* clientInfo)
{
PlatformWebView* view = static_cast<TestController*>(const_cast<void*>(clientInfo))->mainWebView();
return view->windowFrame();
}