本文整理汇总了C++中GraphicsLayer::position方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsLayer::position方法的具体用法?C++ GraphicsLayer::position怎么用?C++ GraphicsLayer::position使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicsLayer
的用法示例。
在下文中一共展示了GraphicsLayer::position方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateOverlayGeometry
static void updateOverlayGeometry(PageOverlay& overlay, GraphicsLayer& graphicsLayer)
{
IntRect overlayFrame = overlay.frame();
if (overlayFrame.location() == graphicsLayer.position() && overlayFrame.size() == graphicsLayer.size())
return;
graphicsLayer.setPosition(overlayFrame.location());
graphicsLayer.setSize(overlayFrame.size());
}
示例2: updateScrollPositionAfterAsyncScroll
void AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(ScrollingNodeID scrollingNodeID, const FloatPoint& scrollPosition, bool programmaticScroll, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
{
ASSERT(isMainThread());
if (!m_page)
return;
FrameView* frameView = m_page->mainFrame().view();
if (!frameView)
return;
// Main frame.
if (scrollingNodeID == frameView->scrollLayerID()) {
bool oldProgrammaticScroll = frameView->inProgrammaticScroll();
frameView->setInProgrammaticScroll(programmaticScroll);
frameView->setConstrainsScrollingToContentEdge(false);
frameView->notifyScrollPositionChanged(roundedIntPoint(scrollPosition));
frameView->setConstrainsScrollingToContentEdge(true);
frameView->setInProgrammaticScroll(oldProgrammaticScroll);
if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) {
GraphicsLayer* counterScrollingLayer = counterScrollingLayerForFrameView(frameView);
GraphicsLayer* insetClipLayer = insetClipLayerForFrameView(frameView);
GraphicsLayer* contentShadowLayer = contentShadowLayerForFrameView(frameView);
GraphicsLayer* scrolledContentsLayer = rootContentLayerForFrameView(frameView);
GraphicsLayer* headerLayer = headerLayerForFrameView(frameView);
GraphicsLayer* footerLayer = footerLayerForFrameView(frameView);
LayoutSize scrollOffsetForFixed = frameView->scrollOffsetForFixedPosition();
float topContentInset = frameView->topContentInset();
FloatPoint positionForInsetClipLayer = FloatPoint(0, FrameView::yPositionForInsetClipLayer(scrollPosition, topContentInset));
FloatPoint positionForContentsLayer = FloatPoint(scrolledContentsLayer->position().x(),
FrameView::yPositionForRootContentLayer(scrollPosition, topContentInset, frameView->headerHeight()));
FloatPoint positionForHeaderLayer = FloatPoint(scrollOffsetForFixed.width(), FrameView::yPositionForHeaderLayer(scrollPosition, topContentInset));
FloatPoint positionForFooterLayer = FloatPoint(scrollOffsetForFixed.width(),
FrameView::yPositionForFooterLayer(scrollPosition, topContentInset, frameView->totalContentsSize().height(), frameView->footerHeight()));
if (programmaticScroll || scrollingLayerPositionAction == SetScrollingLayerPosition) {
scrollLayer->setPosition(-frameView->scrollPosition());
if (counterScrollingLayer)
counterScrollingLayer->setPosition(toLayoutPoint(scrollOffsetForFixed));
if (insetClipLayer)
insetClipLayer->setPosition(positionForInsetClipLayer);
if (contentShadowLayer)
contentShadowLayer->setPosition(positionForContentsLayer);
if (scrolledContentsLayer)
scrolledContentsLayer->setPosition(positionForContentsLayer);
if (headerLayer)
headerLayer->setPosition(positionForHeaderLayer);
if (footerLayer)
footerLayer->setPosition(positionForFooterLayer);
} else {
scrollLayer->syncPosition(-frameView->scrollPosition());
if (counterScrollingLayer)
counterScrollingLayer->syncPosition(toLayoutPoint(scrollOffsetForFixed));
if (insetClipLayer)
insetClipLayer->syncPosition(positionForInsetClipLayer);
if (contentShadowLayer)
contentShadowLayer->syncPosition(positionForContentsLayer);
if (scrolledContentsLayer)
scrolledContentsLayer->syncPosition(positionForContentsLayer);
if (headerLayer)
headerLayer->syncPosition(positionForHeaderLayer);
if (footerLayer)
footerLayer->syncPosition(positionForFooterLayer);
LayoutRect viewportRect = frameView->viewportConstrainedVisibleContentRect();
syncChildPositions(viewportRect);
}
}
return;
}
// Overflow-scroll area.
if (ScrollableArea* scrollableArea = frameView->scrollableAreaForScrollLayerID(scrollingNodeID)) {
scrollableArea->setIsUserScroll(scrollingLayerPositionAction == SyncScrollingLayerPosition);
scrollableArea->scrollToOffsetWithoutAnimation(scrollPosition);
scrollableArea->setIsUserScroll(false);
}
}
示例3: updateScrollPositionAfterAsyncScroll
void AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(ScrollingNodeID scrollingNodeID, const FloatPoint& scrollPosition, bool programmaticScroll, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
{
ASSERT(isMainThread());
if (!m_page)
return;
FrameView* frameViewPtr = frameViewForScrollingNode(scrollingNodeID);
if (!frameViewPtr)
return;
FrameView& frameView = *frameViewPtr;
if (scrollingNodeID == frameView.scrollLayerID()) {
bool oldProgrammaticScroll = frameView.inProgrammaticScroll();
frameView.setInProgrammaticScroll(programmaticScroll);
frameView.setConstrainsScrollingToContentEdge(false);
frameView.notifyScrollPositionChanged(roundedIntPoint(scrollPosition));
frameView.setConstrainsScrollingToContentEdge(true);
frameView.setInProgrammaticScroll(oldProgrammaticScroll);
if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) {
GraphicsLayer* counterScrollingLayer = counterScrollingLayerForFrameView(frameView);
GraphicsLayer* insetClipLayer = insetClipLayerForFrameView(frameView);
GraphicsLayer* contentShadowLayer = contentShadowLayerForFrameView(frameView);
GraphicsLayer* scrolledContentsLayer = rootContentLayerForFrameView(frameView);
GraphicsLayer* headerLayer = headerLayerForFrameView(frameView);
GraphicsLayer* footerLayer = footerLayerForFrameView(frameView);
LayoutSize scrollOffsetForFixed = frameView.scrollOffsetForFixedPosition();
float topContentInset = frameView.topContentInset();
FloatPoint positionForInsetClipLayer = FloatPoint(0, FrameView::yPositionForInsetClipLayer(scrollPosition, topContentInset));
FloatPoint positionForContentsLayer = FloatPoint(scrolledContentsLayer->position().x(),
FrameView::yPositionForRootContentLayer(scrollPosition, topContentInset, frameView.headerHeight()));
FloatPoint positionForHeaderLayer = FloatPoint(scrollOffsetForFixed.width(), FrameView::yPositionForHeaderLayer(scrollPosition, topContentInset));
FloatPoint positionForFooterLayer = FloatPoint(scrollOffsetForFixed.width(),
FrameView::yPositionForFooterLayer(scrollPosition, topContentInset, frameView.totalContentsSize().height(), frameView.footerHeight()));
if (programmaticScroll || scrollingLayerPositionAction == SetScrollingLayerPosition) {
scrollLayer->setPosition(-frameView.scrollPosition());
if (counterScrollingLayer)
counterScrollingLayer->setPosition(toLayoutPoint(scrollOffsetForFixed));
if (insetClipLayer)
insetClipLayer->setPosition(positionForInsetClipLayer);
if (contentShadowLayer)
contentShadowLayer->setPosition(positionForContentsLayer);
if (scrolledContentsLayer)
scrolledContentsLayer->setPosition(positionForContentsLayer);
if (headerLayer)
headerLayer->setPosition(positionForHeaderLayer);
if (footerLayer)
footerLayer->setPosition(positionForFooterLayer);
} else {
scrollLayer->syncPosition(-frameView.scrollPosition());
if (counterScrollingLayer)
counterScrollingLayer->syncPosition(toLayoutPoint(scrollOffsetForFixed));
if (insetClipLayer)
insetClipLayer->syncPosition(positionForInsetClipLayer);
if (contentShadowLayer)
contentShadowLayer->syncPosition(positionForContentsLayer);
if (scrolledContentsLayer)
scrolledContentsLayer->syncPosition(positionForContentsLayer);
if (headerLayer)
headerLayer->syncPosition(positionForHeaderLayer);
if (footerLayer)
footerLayer->syncPosition(positionForFooterLayer);
LayoutRect viewportRect = frameView.viewportConstrainedVisibleContentRect();
syncChildPositions(viewportRect);
}
}
#if PLATFORM(COCOA)
if (m_page->expectsWheelEventTriggers()) {
frameView.scrollAnimator().setWheelEventTestTrigger(m_page->testTrigger());
if (const auto& trigger = m_page->testTrigger())
trigger->removeTestDeferralForReason(reinterpret_cast<WheelEventTestTrigger::ScrollableAreaIdentifier>(scrollingNodeID), WheelEventTestTrigger::ScrollingThreadSyncNeeded);
}
#endif
return;
}
// Overflow-scroll area.
if (ScrollableArea* scrollableArea = frameView.scrollableAreaForScrollLayerID(scrollingNodeID)) {
scrollableArea->setIsUserScroll(scrollingLayerPositionAction == SyncScrollingLayerPosition);
scrollableArea->scrollToOffsetWithoutAnimation(scrollPosition);
scrollableArea->setIsUserScroll(false);
if (scrollingLayerPositionAction == SetScrollingLayerPosition)
m_page->editorClient().overflowScrollPositionChanged();
#if PLATFORM(COCOA)
if (m_page->expectsWheelEventTriggers()) {
frameView.scrollAnimator().setWheelEventTestTrigger(m_page->testTrigger());
if (const auto& trigger = m_page->testTrigger())
trigger->removeTestDeferralForReason(reinterpret_cast<WheelEventTestTrigger::ScrollableAreaIdentifier>(scrollingNodeID), WheelEventTestTrigger::ScrollingThreadSyncNeeded);
}
#endif
//.........这里部分代码省略.........