本文整理汇总了C++中FrameView::getScrollOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameView::getScrollOffset方法的具体用法?C++ FrameView::getScrollOffset怎么用?C++ FrameView::getScrollOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameView
的用法示例。
在下文中一共展示了FrameView::getScrollOffset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleInputEvent
bool DevToolsEmulator::handleInputEvent(const WebInputEvent& inputEvent) {
Page* page = m_webViewImpl->page();
if (!page)
return false;
// FIXME: This workaround is required for touch emulation on Mac, where
// compositor-side pinch handling is not enabled. See http://crbug.com/138003.
bool isPinch = inputEvent.type == WebInputEvent::GesturePinchBegin ||
inputEvent.type == WebInputEvent::GesturePinchUpdate ||
inputEvent.type == WebInputEvent::GesturePinchEnd;
if (isPinch && m_touchEventEmulationEnabled) {
FrameView* frameView = page->deprecatedLocalMainFrame()->view();
PlatformGestureEventBuilder gestureEvent(
frameView, static_cast<const WebGestureEvent&>(inputEvent));
float pageScaleFactor = page->pageScaleFactor();
if (gestureEvent.type() == PlatformEvent::GesturePinchBegin) {
m_lastPinchAnchorCss = WTF::wrapUnique(new IntPoint(roundedIntPoint(
gestureEvent.position() + frameView->getScrollOffset())));
m_lastPinchAnchorDip =
WTF::wrapUnique(new IntPoint(gestureEvent.position()));
m_lastPinchAnchorDip->scale(pageScaleFactor, pageScaleFactor);
}
if (gestureEvent.type() == PlatformEvent::GesturePinchUpdate &&
m_lastPinchAnchorCss) {
float newPageScaleFactor = pageScaleFactor * gestureEvent.scale();
IntPoint anchorCss(*m_lastPinchAnchorDip.get());
anchorCss.scale(1.f / newPageScaleFactor, 1.f / newPageScaleFactor);
m_webViewImpl->setPageScaleFactor(newPageScaleFactor);
m_webViewImpl->mainFrame()->setScrollOffset(
toIntSize(*m_lastPinchAnchorCss.get() - toIntSize(anchorCss)));
}
if (gestureEvent.type() == PlatformEvent::GesturePinchEnd) {
m_lastPinchAnchorCss.reset();
m_lastPinchAnchorDip.reset();
}
return true;
}
return false;
}