本文整理汇总了C++中FrameView::contentsToContainingViewContents方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameView::contentsToContainingViewContents方法的具体用法?C++ FrameView::contentsToContainingViewContents怎么用?C++ FrameView::contentsToContainingViewContents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameView
的用法示例。
在下文中一共展示了FrameView::contentsToContainingViewContents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: absoluteNonFastScrollableRegionForFrame
Region ScrollingCoordinator::absoluteNonFastScrollableRegionForFrame(const Frame& frame) const
{
RenderView* renderView = frame.contentRenderer();
if (!renderView || renderView->documentBeingDestroyed())
return Region();
#if ENABLE(IOS_TOUCH_EVENTS)
// On iOS, we use nonFastScrollableRegion to represent the region covered by elements with touch event handlers.
ASSERT(frame.isMainFrame());
Document* document = frame.document();
if (!document)
return Region();
Vector<IntRect> touchRects;
document->getTouchRects(touchRects);
Region touchRegion;
for (const auto& rect : touchRects)
touchRegion.unite(rect);
// FIXME: use absoluteRegionForEventTargets().
return touchRegion;
#else
Region nonFastScrollableRegion;
FrameView* frameView = frame.view();
if (!frameView)
return nonFastScrollableRegion;
// FIXME: should ASSERT(!frameView->needsLayout()) here, but need to fix DebugPageOverlays
// to not ask for regions at bad times.
if (const FrameView::ScrollableAreaSet* scrollableAreas = frameView->scrollableAreas()) {
for (auto& scrollableArea : *scrollableAreas) {
// Composited scrollable areas can be scrolled off the main thread.
if (scrollableArea->usesAsyncScrolling())
continue;
bool isInsideFixed;
IntRect box = scrollableArea->scrollableAreaBoundingBox(&isInsideFixed);
if (isInsideFixed)
box = IntRect(frameView->fixedScrollableAreaBoundsInflatedForScrolling(LayoutRect(box)));
nonFastScrollableRegion.unite(box);
}
}
for (auto& widget : frameView->widgetsInRenderTree()) {
RenderWidget* renderWidget = RenderWidget::find(widget);
if (!renderWidget || !is<PluginViewBase>(*widget))
continue;
if (downcast<PluginViewBase>(*widget).wantsWheelEvents())
nonFastScrollableRegion.unite(renderWidget->absoluteBoundingBoxRect());
}
// FIXME: if we've already accounted for this subframe as a scrollable area, we can avoid recursing into it here.
for (Frame* subframe = frame.tree().firstChild(); subframe; subframe = subframe->tree().nextSibling()) {
FrameView* subframeView = subframe->view();
if (!subframeView)
continue;
Region subframeRegion = absoluteNonFastScrollableRegionForFrame(*subframe);
// Map from the frame document to our document.
IntPoint offset = subframeView->contentsToContainingViewContents(IntPoint());
// FIXME: this translation ignores non-trival transforms on the frame.
subframeRegion.translate(toIntSize(offset));
nonFastScrollableRegion.unite(subframeRegion);
}
Document::RegionFixedPair wheelHandlerRegion = frame.document()->absoluteRegionForEventTargets(frame.document()->wheelEventTargets());
bool wheelHandlerInFixedContent = wheelHandlerRegion.second;
if (wheelHandlerInFixedContent) {
// FIXME: need to handle position:sticky here too.
LayoutRect inflatedWheelHandlerBounds = frameView->fixedScrollableAreaBoundsInflatedForScrolling(LayoutRect(wheelHandlerRegion.first.bounds()));
wheelHandlerRegion.first.unite(enclosingIntRect(inflatedWheelHandlerBounds));
}
nonFastScrollableRegion.unite(wheelHandlerRegion.first);
// FIXME: If this is not the main frame, we could clip the region to the frame's bounds.
return nonFastScrollableRegion;
#endif
}