当前位置: 首页>>代码示例>>C++>>正文


C++ RenderElement::setStyleInternal方法代码示例

本文整理汇总了C++中RenderElement::setStyleInternal方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderElement::setStyleInternal方法的具体用法?C++ RenderElement::setStyleInternal怎么用?C++ RenderElement::setStyleInternal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RenderElement的用法示例。


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

示例1: createRenderer

void RenderTreeUpdater::createRenderer(Element& element, RenderStyle&& style)
{
    auto computeInsertionPosition = [this, &element, &style] () {
#if ENABLE(CSS_REGIONS)
        if (element.shouldMoveToFlowThread(style))
            return RenderTreePosition::insertionPositionForFlowThread(renderTreePosition().parent().element(), element, style);
#endif
        renderTreePosition().computeNextSibling(element);
        return renderTreePosition();
    };
    
    if (!shouldCreateRenderer(element, renderTreePosition().parent()))
        return;

#if ENABLE(CSS_REGIONS)
    // Even display: none elements need to be registered in FlowThreadController.
    registerElementForFlowThreadIfNeeded(element, style);
#endif

    if (!element.rendererIsNeeded(style))
        return;

    RenderTreePosition insertionPosition = computeInsertionPosition();
    RenderElement* newRenderer = element.createElementRenderer(WTFMove(style), insertionPosition).leakPtr();
    if (!newRenderer)
        return;
    if (!insertionPosition.canInsert(*newRenderer)) {
        newRenderer->destroy();
        return;
    }

    // Make sure the RenderObject already knows it is going to be added to a RenderFlowThread before we set the style
    // for the first time. Otherwise code using inRenderFlowThread() in the styleWillChange and styleDidChange will fail.
    newRenderer->setFlowThreadState(insertionPosition.parent().flowThreadState());

    element.setRenderer(newRenderer);

    auto& initialStyle = newRenderer->style();
    std::unique_ptr<RenderStyle> animatedStyle;
    newRenderer->animation().updateAnimations(*newRenderer, initialStyle, animatedStyle);
    if (animatedStyle)
        newRenderer->setStyleInternal(WTFMove(*animatedStyle));

    newRenderer->initializeStyle();

#if ENABLE(FULLSCREEN_API)
    if (m_document.webkitIsFullScreen() && m_document.webkitCurrentFullScreenElement() == &element) {
        newRenderer = RenderFullScreen::wrapRenderer(newRenderer, &insertionPosition.parent(), m_document);
        if (!newRenderer)
            return;
    }
#endif
    // Note: Adding newRenderer instead of renderer(). renderer() may be a child of newRenderer.
    insertionPosition.insert(*newRenderer);

    if (AXObjectCache* cache = m_document.axObjectCache())
        cache->updateCacheAfterNodeIsAttached(&element);
}
开发者ID:,项目名称:,代码行数:58,代码来源:

示例2: setRendererStyleInRegion

void RenderNamedFlowFragment::setRendererStyleInRegion(RenderElement& renderer, std::unique_ptr<RenderStyle> styleInRegion, bool objectRegionStyleCached)
{
    ASSERT(renderer.flowThreadContainingBlock());

    std::unique_ptr<RenderStyle> objectOriginalStyle = RenderStyle::clonePtr(renderer.style());
    renderer.setStyleInternal(WTFMove(*styleInRegion));

    if (is<RenderBoxModelObject>(renderer) && !renderer.hasVisibleBoxDecorations()) {
        bool hasVisibleBoxDecorations = is<RenderTableCell>(renderer)
        || renderer.style().hasBackground()
        || renderer.style().hasVisibleBorder()
        || renderer.style().hasAppearance()
        || renderer.style().boxShadow();
        renderer.setHasVisibleBoxDecorations(hasVisibleBoxDecorations);
    }

    ObjectRegionStyleInfo styleInfo;
    styleInfo.style = WTFMove(objectOriginalStyle);
    styleInfo.cached = objectRegionStyleCached;
    m_rendererRegionStyle.set(&renderer, WTFMove(styleInfo));
}
开发者ID:eocanha,项目名称:webkit,代码行数:21,代码来源:RenderNamedFlowFragment.cpp


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