• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ WebLayer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中WebLayer的典型用法代码示例。如果您正苦于以下问题:C++ WebLayer类的具体用法?C++ WebLayer怎么用?C++ WebLayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了WebLayer类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: update

void PageOverlay::update() {
  if (!m_frameImpl->frameWidget()->isAcceleratedCompositingActive())
    return;

  LocalFrame* frame = m_frameImpl->frame();
  if (!frame)
    return;

  if (!m_layer) {
    m_layer = GraphicsLayer::create(this);
    m_layer->setDrawsContent(true);

    if (WebDevToolsAgentImpl* devTools = m_frameImpl->devToolsAgentImpl())
      devTools->willAddPageOverlay(m_layer.get());

    // This is required for contents of overlay to stay in sync with the page
    // while scrolling.
    WebLayer* platformLayer = m_layer->platformLayer();
    platformLayer->addMainThreadScrollingReasons(
        MainThreadScrollingReason::kPageOverlay);
    if (frame->isMainFrame()) {
      frame->host()->visualViewport().containerLayer()->addChild(m_layer.get());
    } else {
      toWebFrameWidgetImpl(m_frameImpl->frameWidget())
          ->rootGraphicsLayer()
          ->addChild(m_layer.get());
    }
  }

  FloatSize size(frame->host()->visualViewport().size());
  if (size != m_layer->size())
    m_layer->setSize(size);

  m_layer->setNeedsDisplay();
}
开发者ID:,项目名称:,代码行数:35,代码来源:


示例2: TEST_F

TEST_F(ScrollingCoordinatorTest, fastFractionalScrollingDiv)
{
    registerMockedHttpURLLoad("fractional-scroll-div.html");
    navigateTo(m_baseURL + "fractional-scroll-div.html");
    forceFullCompositingUpdate();

    Document* document = frame()->document();
    Element* scrollableElement = document->getElementById("scroller");
    ASSERT(scrollableElement);

    scrollableElement->setScrollTop(1.0);
    scrollableElement->setScrollLeft(1.0);
    forceFullCompositingUpdate();

    // Make sure the fractional scroll offset change 1.0 -> 1.2 gets propagated
    // to compositor.
    scrollableElement->setScrollTop(1.2);
    scrollableElement->setScrollLeft(1.2);
    forceFullCompositingUpdate();

    LayoutObject* layoutObject = scrollableElement->layoutObject();
    ASSERT_TRUE(layoutObject->isBox());
    LayoutBox* box = toLayoutBox(layoutObject);
    ASSERT_TRUE(box->usesCompositedScrolling());
    CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLayerMapping();
    ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer());
    ASSERT(compositedLayerMapping->scrollingContentsLayer());
    WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()->platformLayer();
    ASSERT_TRUE(webScrollLayer);
    ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().x, 0.01);
    ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().y, 0.01);
}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:32,代码来源:ScrollingCoordinatorTest.cpp


示例3: TEST_F

TEST_F(ScrollingCoordinatorChromiumTest, fastScrollingForFixedPosition)
{
    registerMockedHttpURLLoad("fixed-position.html");
    navigateTo(m_baseURL + "fixed-position.html");

    Page* page = m_webViewImpl->mainFrameImpl()->frame()->page();
    ASSERT_TRUE(page->scrollingCoordinator()->supportsFixedPositionLayers());

    // Fixed position should not fall back to main thread scrolling.
    WebLayer* rootScrollLayer = getRootScrollLayer();
    ASSERT_FALSE(rootScrollLayer->shouldScrollOnMainThread());

    // Verify the properties of the fixed position element starting from the RenderObject all the
    // way to the WebLayer.
    Element* fixedElement = m_webViewImpl->mainFrameImpl()->frame()->document()->getElementById("fixed");
    ASSERT(fixedElement);

    RenderObject* renderer = fixedElement->renderer();
    ASSERT_TRUE(renderer->isBoxModelObject());
    ASSERT_TRUE(renderer->hasLayer());

    RenderLayer* layer = toRenderBoxModelObject(renderer)->layer();
    ASSERT_TRUE(layer->isComposited());

    RenderLayerBacking* layerBacking = layer->backing();
    WebLayer* webLayer = static_cast<WebLayer*>(layerBacking->graphicsLayer()->platformLayer());
    ASSERT_TRUE(webLayer->fixedToContainerLayer());
}
开发者ID:,项目名称:,代码行数:28,代码来源:


示例4: TEST_P

TEST_P(CompositorWorkerTest, disconnectedProxies) {
  // This case is identical to compositor-proxy-basic, but the proxies are
  // disconnected (the result should be the same as
  // compositor-proxy-plumbing-no-proxies).
  registerMockedHttpURLLoad("compositor-proxy-basic-disconnected.html");
  navigateTo(m_baseURL + "compositor-proxy-basic-disconnected.html");

  forceFullCompositingUpdate();

  Document* document = frame()->document();

  Element* tallElement = document->getElementById("tall");
  WebLayer* tallLayer = webLayerFromElement(tallElement);
  EXPECT_TRUE(!tallLayer);

  Element* proxiedElement = document->getElementById("proxied");
  WebLayer* proxiedLayer = webLayerFromElement(proxiedElement);
  EXPECT_TRUE(!proxiedLayer);

  Element* scrollElement = document->getElementById("proxied-scroller");
  WebLayer* scrollLayer = scrollingWebLayerFromElement(scrollElement);
  EXPECT_FALSE(!!scrollLayer->compositorMutableProperties());

  WebLayer* rootScrollLayer = getRootScrollLayer();
  EXPECT_FALSE(!!rootScrollLayer->compositorMutableProperties());
}
开发者ID:mirror,项目名称:chromium,代码行数:26,代码来源:CompositorWorkerTest.cpp


示例5: TEST_F

TEST_F(ScrollingCoordinatorTest, scrollEventHandler)
{
    registerMockedHttpURLLoad("scroll-event-handler.html");
    navigateTo(m_baseURL + "scroll-event-handler.html");
    forceFullCompositingUpdate();

    WebLayer* rootScrollLayer = getRootScrollLayer();
    ASSERT_TRUE(rootScrollLayer->haveScrollEventHandlers());
}
开发者ID:jiayuwang,项目名称:chromium,代码行数:9,代码来源:ScrollingCoordinatorTest.cpp


示例6: contentsLayerIfRegistered

void GraphicsLayerChromium::updateContentsRect()
{
    WebLayer* contentsLayer = contentsLayerIfRegistered();
    if (!contentsLayer)
        return;

    contentsLayer->setPosition(FloatPoint(m_contentsRect.x(), m_contentsRect.y()));
    contentsLayer->setBounds(IntSize(m_contentsRect.width(), m_contentsRect.height()));
}
开发者ID:,项目名称:,代码行数:9,代码来源:


示例7: contentsLayerIfRegistered

void GraphicsLayer::setContentsClippingMaskLayer(GraphicsLayer* contentsClippingMaskLayer)
{
    if (contentsClippingMaskLayer == m_contentsClippingMaskLayer)
        return;

    m_contentsClippingMaskLayer = contentsClippingMaskLayer;
    WebLayer* contentsLayer = contentsLayerIfRegistered();
    if (!contentsLayer)
        return;
    WebLayer* contentsClippingMaskWebLayer = m_contentsClippingMaskLayer ? m_contentsClippingMaskLayer->platformLayer() : 0;
    contentsLayer->setMaskLayer(contentsClippingMaskWebLayer);
    updateContentsRect();
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:13,代码来源:GraphicsLayer.cpp


示例8: scrollingWebLayerForScrollableArea

void ScrollingCoordinatorChromium::scrollableAreaScrollLayerDidChange(ScrollableArea* scrollableArea)
{
    GraphicsLayerChromium* scrollLayer = static_cast<GraphicsLayerChromium*>(scrollLayerForScrollableArea(scrollableArea));
    if (scrollLayer)
        scrollLayer->setScrollableArea(scrollableArea);

    WebLayer* webLayer = scrollingWebLayerForScrollableArea(scrollableArea);
    if (webLayer) {
        webLayer->setScrollable(true);
        webLayer->setScrollPosition(IntPoint(scrollableArea->scrollPosition() - scrollableArea->minimumScrollPosition()));
        webLayer->setMaxScrollPosition(IntSize(scrollableArea->scrollSize(HorizontalScrollbar), scrollableArea->scrollSize(VerticalScrollbar)));
    }
    if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, HorizontalScrollbar))
        setupScrollbarLayer(horizontalScrollbarLayerForScrollableArea(scrollableArea), scrollbarLayer, webLayer);
    if (WebScrollbarLayer* scrollbarLayer = getWebScrollbarLayer(scrollableArea, VerticalScrollbar))
        setupScrollbarLayer(verticalScrollbarLayerForScrollableArea(scrollableArea), scrollbarLayer, webLayer);
}
开发者ID:,项目名称:,代码行数:17,代码来源:


示例9: buildScrollRectsForLayer

static std::unique_ptr<Array<protocol::LayerTree::ScrollRect>>
buildScrollRectsForLayer(GraphicsLayer* graphicsLayer,
                         bool reportWheelScrollers) {
  std::unique_ptr<Array<protocol::LayerTree::ScrollRect>> scrollRects =
      Array<protocol::LayerTree::ScrollRect>::create();
  WebLayer* webLayer = graphicsLayer->platformLayer();
  WebVector<WebRect> nonFastScrollableRects =
      webLayer->nonFastScrollableRegion();
  for (size_t i = 0; i < nonFastScrollableRects.size(); ++i) {
    scrollRects->addItem(buildScrollRect(
        nonFastScrollableRects[i],
        protocol::LayerTree::ScrollRect::TypeEnum::RepaintsOnScroll));
  }
  WebVector<WebRect> touchEventHandlerRects =
      webLayer->touchEventHandlerRegion();
  for (size_t i = 0; i < touchEventHandlerRects.size(); ++i) {
    scrollRects->addItem(buildScrollRect(
        touchEventHandlerRects[i],
        protocol::LayerTree::ScrollRect::TypeEnum::TouchEventHandler));
  }
  if (reportWheelScrollers) {
    WebRect webRect(webLayer->position().x, webLayer->position().y,
                    webLayer->bounds().width, webLayer->bounds().height);
    scrollRects->addItem(buildScrollRect(
        webRect, protocol::LayerTree::ScrollRect::TypeEnum::WheelEventHandler));
  }
  return scrollRects->length() ? std::move(scrollRects) : nullptr;
}
开发者ID:ollie314,项目名称:chromium,代码行数:28,代码来源:InspectorLayerTreeAgent.cpp


示例10: buildObjectForLayer

static std::unique_ptr<protocol::LayerTree::Layer> buildObjectForLayer(
    GraphicsLayer* graphicsLayer,
    int nodeId,
    bool reportWheelEventListeners) {
  WebLayer* webLayer = graphicsLayer->platformLayer();
  std::unique_ptr<protocol::LayerTree::Layer> layerObject =
      protocol::LayerTree::Layer::create()
          .setLayerId(idForLayer(graphicsLayer))
          .setOffsetX(webLayer->position().x)
          .setOffsetY(webLayer->position().y)
          .setWidth(webLayer->bounds().width)
          .setHeight(webLayer->bounds().height)
          .setPaintCount(graphicsLayer->paintCount())
          .setDrawsContent(webLayer->drawsContent())
          .build();

  if (nodeId)
    layerObject->setBackendNodeId(nodeId);

  GraphicsLayer* parent = graphicsLayer->parent();
  if (parent)
    layerObject->setParentLayerId(idForLayer(parent));
  if (!graphicsLayer->contentsAreVisible())
    layerObject->setInvisible(true);
  const TransformationMatrix& transform = graphicsLayer->transform();
  if (!transform.isIdentity()) {
    TransformationMatrix::FloatMatrix4 flattenedMatrix;
    transform.toColumnMajorFloatArray(flattenedMatrix);
    std::unique_ptr<Array<double>> transformArray = Array<double>::create();
    for (size_t i = 0; i < WTF_ARRAY_LENGTH(flattenedMatrix); ++i)
      transformArray->addItem(flattenedMatrix[i]);
    layerObject->setTransform(std::move(transformArray));
    const FloatPoint3D& transformOrigin = graphicsLayer->transformOrigin();
    // FIXME: rename these to setTransformOrigin*
    if (webLayer->bounds().width > 0)
      layerObject->setAnchorX(transformOrigin.x() / webLayer->bounds().width);
    else
      layerObject->setAnchorX(0.0);
    if (webLayer->bounds().height > 0)
      layerObject->setAnchorY(transformOrigin.y() / webLayer->bounds().height);
    else
      layerObject->setAnchorY(0.0);
    layerObject->setAnchorZ(transformOrigin.z());
  }
  std::unique_ptr<Array<protocol::LayerTree::ScrollRect>> scrollRects =
      buildScrollRectsForLayer(graphicsLayer, reportWheelEventListeners);
  if (scrollRects)
    layerObject->setScrollRects(std::move(scrollRects));
  return layerObject;
}
开发者ID:ollie314,项目名称:chromium,代码行数:50,代码来源:InspectorLayerTreeAgent.cpp


示例11: buildScrollRectsForLayer

static PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > buildScrollRectsForLayer(GraphicsLayer* graphicsLayer)
{
    RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > scrollRects = TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect>::create();
    WebLayer* webLayer = graphicsLayer->platformLayer();
    for (size_t i = 0; i < webLayer->nonFastScrollableRegion().size(); ++i) {
        scrollRects->addItem(buildScrollRect(webLayer->nonFastScrollableRegion()[i], TypeBuilder::LayerTree::ScrollRect::Type::RepaintsOnScroll));
    }
    for (size_t i = 0; i < webLayer->touchEventHandlerRegion().size(); ++i) {
        scrollRects->addItem(buildScrollRect(webLayer->touchEventHandlerRegion()[i], TypeBuilder::LayerTree::ScrollRect::Type::TouchEventHandler));
    }
    if (webLayer->haveWheelEventHandlers()) {
        WebRect webRect(webLayer->position().x, webLayer->position().y, webLayer->bounds().width, webLayer->bounds().height);
        scrollRects->addItem(buildScrollRect(webRect, TypeBuilder::LayerTree::ScrollRect::Type::WheelEventHandler));
    }
    return scrollRects->length() ? scrollRects.release() : nullptr;
}
开发者ID:,项目名称:,代码行数:16,代码来源:


示例12: updateChildList

void GraphicsLayer::updateChildList()
{
    WebLayer* childHost = m_layer->layer();
    childHost->removeAllChildren();

    clearContentsLayerIfUnregistered();

    if (m_contentsLayer) {
        // FIXME: add the contents layer in the correct order with negative z-order children.
        // This does not cause visible rendering issues because currently contents layers are only used
        // for replaced elements that don't have children.
        childHost->addChild(m_contentsLayer);
    }

    for (size_t i = 0; i < m_children.size(); ++i)
        childHost->addChild(m_children[i]->platformLayer());

    for (size_t i = 0; i < m_linkHighlights.size(); ++i)
        childHost->addChild(m_linkHighlights[i]->layer());
}
开发者ID:RobinWuDev,项目名称:Qt,代码行数:20,代码来源:GraphicsLayer.cpp


示例13: updateChildList

void GraphicsLayerChromium::updateChildList()
{
    WebLayer* childHost = m_transformLayer ? m_transformLayer.get() : m_layer->layer();
    childHost->removeAllChildren();

    clearContentsLayerIfUnregistered();

    if (m_transformLayer) {
        // Add the primary layer first. Even if we have negative z-order children, the primary layer always comes behind.
        childHost->addChild(m_layer->layer());
    } else if (m_contentsLayer) {
        // FIXME: add the contents layer in the correct order with negative z-order children.
        // This does not cause visible rendering issues because currently contents layers are only used
        // for replaced elements that don't have children.
        childHost->addChild(m_contentsLayer);
    }

    const Vector<GraphicsLayer*>& childLayers = children();
    size_t numChildren = childLayers.size();
    for (size_t i = 0; i < numChildren; ++i) {
        GraphicsLayerChromium* curChild = static_cast<GraphicsLayerChromium*>(childLayers[i]);

        childHost->addChild(curChild->platformLayer());
    }

    if (m_linkHighlight)
        childHost->addChild(m_linkHighlight->layer());

    if (m_transformLayer && m_contentsLayer) {
        // If we have a transform layer, then the contents layer is parented in the
        // primary layer (which is itself a child of the transform layer).
        m_layer->layer()->removeAllChildren();
        m_layer->layer()->addChild(m_contentsLayer);
    }
}
开发者ID:,项目名称:,代码行数:35,代码来源:


示例14: scrollLayer

void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin)
{
    if (!haveScrollLayer())
        return;

    bool visibleRectChanged = m_viewportSize != viewportSize;

    m_viewportSize = viewportSize;
    WebLayer* layer = scrollLayer();
    layer->setScrollPosition(scrollPosition + scrollOrigin);
    layer->setPosition(WebFloatPoint(-scrollPosition));
    // Due to the possibility of pinch zoom, the noncomposited layer is always
    // assumed to be scrollable.
    layer->setScrollable(true);
    m_graphicsLayer->setSize(contentsSize);

    // In RTL-style pages, the origin of the initial containing block for the
    // root layer may be positive; translate the layer to avoid negative
    // coordinates.
    m_layerAdjust = -toSize(scrollOrigin);
    if (m_graphicsLayer->transform().m41() != m_layerAdjust.width() || m_graphicsLayer->transform().m42() != m_layerAdjust.height()) {
        WebCore::TransformationMatrix transform = m_graphicsLayer->transform();
        transform.setM41(m_layerAdjust.width());
        transform.setM42(m_layerAdjust.height());
        m_graphicsLayer->setTransform(transform);

        // If a tiled layer is shifted left or right, the content that goes into
        // each tile will change. Invalidate the entire layer when this happens.
        m_graphicsLayer->setNeedsDisplay();
    } else if (visibleRectChanged)
        m_graphicsLayer->setNeedsDisplay();

    WebCore::GraphicsLayer* clipLayer = m_graphicsLayer->parent()->parent();
    WebCore::GraphicsLayer* rootLayer = clipLayer;
    while (rootLayer->parent())
        rootLayer = rootLayer->parent();
    setScrollbarBoundsContainPageScale(rootLayer, clipLayer);
}
开发者ID:,项目名称:,代码行数:38,代码来源:



注:本文中的WebLayer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WebLocalFrameImpl类代码示例发布时间:2022-05-31
下一篇:
C++ WebKeyboardEvent类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap