Exemplo n.º 1
0
RenderPtr<RenderElement> HTMLProgressElement::createElementRenderer(PassRef<RenderStyle> style)
{
    if (!style.get().hasAppearance())
        return RenderElement::createFor(*this, WTF::move(style));

    return createRenderer<RenderProgress>(*this, WTF::move(style));
}
Exemplo n.º 2
0
RenderPtr<RenderElement> HTMLFrameSetElement::createElementRenderer(PassRef<RenderStyle> style)
{
    if (style.get().hasContent())
        return RenderElement::createFor(*this, WTF::move(style));
    
    return createRenderer<RenderFrameSet>(*this, WTF::move(style));
}
Exemplo n.º 3
0
RenderPtr<RenderElement> HTMLMeterElement::createElementRenderer(PassRef<RenderStyle> style)
{
    if (hasAuthorShadowRoot() || !document().page()->theme().supportsMeter(style.get().appearance()))
        return RenderElement::createFor(*this, std::move(style));

    return createRenderer<RenderMeter>(*this, std::move(style));
}
Exemplo n.º 4
0
RenderPtr<RenderElement> HTMLImageElement::createElementRenderer(PassRef<RenderStyle> style)
{
    if (style.get().hasContent())
        return RenderElement::createFor(*this, std::move(style));

    return createRenderer<RenderImage>(*this, std::move(style));
}
Exemplo n.º 5
0
void RenderFullScreen::createPlaceholder(PassRef<RenderStyle> style, const LayoutRect& frameRect)
{
    if (style.get().width().isAuto())
        style.get().setWidth(Length(frameRect.width(), Fixed));
    if (style.get().height().isAuto())
        style.get().setHeight(Length(frameRect.height(), Fixed));

    if (m_placeholder) {
        m_placeholder->setStyle(WTF::move(style));
        return;
    }

    m_placeholder = new RenderFullScreenPlaceholder(*this, WTF::move(style));
    m_placeholder->initializeStyle();
    if (parent()) {
        parent()->addChild(m_placeholder, this);
        parent()->setNeedsLayoutAndPrefWidthsRecalc();
    }
}
Exemplo n.º 6
0
RenderPtr<RenderElement> SVGGElement::createElementRenderer(PassRef<RenderStyle> style)
{
    // SVG 1.1 testsuite explicitely uses constructs like <g display="none"><linearGradient>
    // We still have to create renderers for the <g> & <linearGradient> element, though the
    // subtree may be hidden - we only want the resource renderers to exist so they can be
    // referenced from somewhere else.
    if (style.get().display() == NONE)
        return createRenderer<RenderSVGHiddenContainer>(*this, std::move(style));

    return createRenderer<RenderSVGTransformableContainer>(*this, std::move(style));
}
Exemplo n.º 7
0
inline unsigned CalculationValueMap::insert(PassRef<CalculationValue> value)
{
    ASSERT(m_nextAvailableHandle);

    // The leakRef below is balanced by the adoptRef in the deref member function.
    Entry leakedValue = value.leakRef();

    // FIXME: This monotonically increasing handle generation scheme is potentially wasteful
    // of the handle space. Consider reusing empty handles. https://bugs.webkit.org/show_bug.cgi?id=80489
    while (!m_map.isValidKey(m_nextAvailableHandle) || !m_map.add(m_nextAvailableHandle, leakedValue).isNewEntry)
        ++m_nextAvailableHandle;

    return m_nextAvailableHandle++;
}
Exemplo n.º 8
0
PassRef<RenderStyle> AnimationController::updateAnimations(RenderElement& renderer, PassRef<RenderStyle> newStyle)
{
    // Don't do anything if we're in the cache
    if (renderer.document().inPageCache())
        return newStyle;

    RenderStyle* oldStyle = renderer.hasInitializedStyle() ? &renderer.style() : nullptr;

    if ((!oldStyle || (!oldStyle->animations() && !oldStyle->transitions())) && (!newStyle.get().animations() && !newStyle.get().transitions()))
        return newStyle;

    // Don't run transitions when printing.
    if (renderer.view().printing())
        return newStyle;

    // Fetch our current set of implicit animations from a hashtable.  We then compare them
    // against the animations in the style and make sure we're in sync.  If destination values
    // have changed, we reset the animation.  We then do a blend to get new values and we return
    // a new style.

    // We don't support anonymous pseudo elements like :first-line or :first-letter.
    ASSERT(renderer.element());

    Ref<RenderStyle> newStyleBeforeAnimation(std::move(newStyle));

    CompositeAnimation& rendererAnimations = m_data->ensureCompositeAnimation(&renderer);
    auto blendedStyle = rendererAnimations.animate(renderer, oldStyle, newStyleBeforeAnimation.get());

    if (renderer.parent() || newStyleBeforeAnimation->animations() || (oldStyle && oldStyle->animations())) {
        m_data->updateAnimationTimerForRenderer(&renderer);
#if ENABLE(REQUEST_ANIMATION_FRAME)
        renderer.view().frameView().scheduleAnimation();
#endif
    }

    if (&blendedStyle.get() != &newStyleBeforeAnimation.get()) {
        // If the animations/transitions change opacity or transform, we need to update
        // the style to impose the stacking rules. Note that this is also
        // done in StyleResolver::adjustRenderStyle().
        if (blendedStyle.get().hasAutoZIndex() && (blendedStyle.get().opacity() < 1.0f || blendedStyle.get().hasTransform()))
            blendedStyle.get().setZIndex(0);
    }
    return blendedStyle;
}
void DocumentStyleSheetCollection::addUserSheet(PassRef<StyleSheetContents> userSheet)
{
    ASSERT(userSheet.get().isUserStyleSheet());
    m_userStyleSheets.append(CSSStyleSheet::create(WTF::move(userSheet), &m_document));
    m_document.styleResolverChanged(RecalcStyleImmediately);
}