void LayoutTextTrackContainer::layout() {
  LayoutBlockFlow::layout();
  if (style()->display() == EDisplay::None)
    return;

  DeprecatedScheduleStyleRecalcDuringLayout marker(
      node()->document().lifecycle());

  LayoutObject* mediaLayoutObject = parent();
  if (!mediaLayoutObject || !mediaLayoutObject->isVideo())
    return;
  if (updateSizes(toLayoutVideo(*mediaLayoutObject)))
    toElement(node())->setInlineStyleProperty(
        CSSPropertyFontSize, m_fontSize, CSSPrimitiveValue::UnitType::Pixels);
}
Exemple #2
0
LayoutImageResource* ImageLoader::layoutImageResource() {
    LayoutObject* layoutObject = m_element->layoutObject();

    if (!layoutObject)
        return 0;

    // We don't return style generated image because it doesn't belong to the
    // ImageLoader. See <https://bugs.webkit.org/show_bug.cgi?id=42840>
    if (layoutObject->isImage() &&
            !static_cast<LayoutImage*>(layoutObject)->isGeneratedContent())
        return toLayoutImage(layoutObject)->imageResource();

    if (layoutObject->isSVGImage())
        return toLayoutSVGImage(layoutObject)->imageResource();

    if (layoutObject->isVideo())
        return toLayoutVideo(layoutObject)->imageResource();

    return 0;
}
static LayoutVideo* findFullscreenVideoLayoutObject(Document& document)
{
    // Recursively find the document that is in fullscreen.
    Element* fullscreenElement = Fullscreen::fullscreenElementFrom(document);
    Document* contentDocument = &document;
    while (fullscreenElement && fullscreenElement->isFrameOwnerElement()) {
        contentDocument = toHTMLFrameOwnerElement(fullscreenElement)->contentDocument();
        if (!contentDocument)
            return nullptr;
        fullscreenElement = Fullscreen::fullscreenElementFrom(*contentDocument);
    }
    // Get the current fullscreen element from the document.
    fullscreenElement = Fullscreen::currentFullScreenElementFrom(*contentDocument);
    if (!isHTMLVideoElement(fullscreenElement))
        return nullptr;
    LayoutObject* layoutObject = fullscreenElement->layoutObject();
    if (!layoutObject)
        return nullptr;
    return toLayoutVideo(layoutObject);
}