void RemoteFrame::createView()
{
    setView(nullptr);
    if (!tree().parent() || !tree().parent()->isLocalFrame()) {
        // FIXME: This is not the right place to clear the previous frame's
        // widget. We do it here because the LocalFrame cleanup after a swap is
        // still work in progress.
        if (ownerLayoutObject()) {
            HTMLFrameOwnerElement* owner = deprecatedLocalOwner();
            ASSERT(owner);
            owner->setWidget(nullptr);
        }

        return;
    }

    RefPtrWillBeRawPtr<RemoteFrameView> view = RemoteFrameView::create(this);
    setView(view);

    if (ownerLayoutObject()) {
        HTMLFrameOwnerElement* owner = deprecatedLocalOwner();
        ASSERT(owner);
        owner->setWidget(view);
    }
}
Beispiel #2
0
void RemoteFrame::createView()
{
    RefPtrWillBeRawPtr<RemoteFrameView> view = RemoteFrameView::create(this);
    setView(view);

    if (ownerRenderer()) {
        HTMLFrameOwnerElement* owner = deprecatedLocalOwner();
        ASSERT(owner);
        owner->setWidget(view);
    }
}
Beispiel #3
0
void LocalFrame::createView(const IntSize& viewportSize,
                            const Color& backgroundColor,
                            bool transparent,
                            ScrollbarMode horizontalScrollbarMode,
                            bool horizontalLock,
                            ScrollbarMode verticalScrollbarMode,
                            bool verticalLock) {
  ASSERT(this);
  ASSERT(page());

  bool isLocalRoot = this->isLocalRoot();

  if (isLocalRoot && view())
    view()->setParentVisible(false);

  setView(nullptr);

  FrameView* frameView = nullptr;
  if (isLocalRoot) {
    frameView = FrameView::create(this, viewportSize);

    // The layout size is set by WebViewImpl to support @viewport
    frameView->setLayoutSizeFixedToFrameSize(false);
  } else {
    frameView = FrameView::create(this);
  }

  frameView->setScrollbarModes(horizontalScrollbarMode, verticalScrollbarMode,
                               horizontalLock, verticalLock);

  setView(frameView);

  frameView->updateBackgroundRecursively(backgroundColor, transparent);

  if (isLocalRoot)
    frameView->setParentVisible(true);

  // FIXME: Not clear what the right thing for OOPI is here.
  if (!ownerLayoutItem().isNull()) {
    HTMLFrameOwnerElement* owner = deprecatedLocalOwner();
    ASSERT(owner);
    // FIXME: OOPI might lead to us temporarily lying to a frame and telling it
    // that it's owned by a FrameOwner that knows nothing about it. If we're
    // lying to this frame, don't let it clobber the existing widget.
    if (owner->contentFrame() == this)
      owner->setWidget(frameView);
  }

  if (owner())
    view()->setCanHaveScrollbars(owner()->scrollingMode() !=
                                 ScrollbarAlwaysOff);
}
Beispiel #4
0
void LocalFrame::createView(const IntSize& viewportSize, const Color& backgroundColor, bool transparent,
    ScrollbarMode horizontalScrollbarMode, bool horizontalLock,
    ScrollbarMode verticalScrollbarMode, bool verticalLock)
{
    ASSERT(this);
    ASSERT(page());

    bool isMainFrame = this->isMainFrame();

    if (isMainFrame && view())
        view()->setParentVisible(false);

    setView(nullptr);

    RefPtr<FrameView> frameView;
    if (isMainFrame) {
        frameView = FrameView::create(this, viewportSize);

        // The layout size is set by WebViewImpl to support @viewport
        frameView->setLayoutSizeFixedToFrameSize(false);
    } else
        frameView = FrameView::create(this);

    frameView->setScrollbarModes(horizontalScrollbarMode, verticalScrollbarMode, horizontalLock, verticalLock);

    setView(frameView);

    frameView->updateBackgroundRecursively(backgroundColor, transparent);

    if (isMainFrame)
        frameView->setParentVisible(true);

    // FIXME: Not clear what the right thing for OOPI is here.
    if (ownerRenderer()) {
        HTMLFrameOwnerElement* owner = deprecatedLocalOwner();
        ASSERT(owner);
        owner->setWidget(frameView);
    }

    if (HTMLFrameOwnerElement* owner = deprecatedLocalOwner())
        view()->setCanHaveScrollbars(owner->scrollingMode() != ScrollbarAlwaysOff);
}
Beispiel #5
0
bool WebFrame::swap(WebFrame* frame)
{
    using std::swap;
    RefPtrWillBeRawPtr<Frame> oldFrame = toCoreFrame(this);

    // All child frames must be detached first.
    oldFrame->detachChildren();

    // If the frame has been detached during detaching its children, return
    // immediately.
    // FIXME: There is no unit test for this condition, so one needs to be
    // written.
    if (!oldFrame->host())
        return false;

    if (m_parent) {
        if (m_parent->m_firstChild == this)
            m_parent->m_firstChild = frame;
        if (m_parent->m_lastChild == this)
            m_parent->m_lastChild = frame;
        swap(m_parent, frame->m_parent);
    }

    if (m_previousSibling) {
        m_previousSibling->m_nextSibling = frame;
        swap(m_previousSibling, frame->m_previousSibling);
    }
    if (m_nextSibling) {
        m_nextSibling->m_previousSibling = frame;
        swap(m_nextSibling, frame->m_nextSibling);
    }

    if (m_opener) {
        m_opener->m_openedFrameTracker->remove(this);
        m_opener->m_openedFrameTracker->add(frame);
        swap(m_opener, frame->m_opener);
    }
    if (!m_openedFrameTracker->isEmpty()) {
        m_openedFrameTracker->updateOpener(frame);
        frame->m_openedFrameTracker.reset(m_openedFrameTracker.release());
    }

    // Finally, clone the state of the current Frame into one matching
    // the type of the passed in WebFrame.
    // FIXME: This is a bit clunky; this results in pointless decrements and
    // increments of connected subframes.
    FrameOwner* owner = oldFrame->owner();
    oldFrame->disconnectOwnerElement();
    if (Frame* newFrame = toCoreFrame(frame)) {
        ASSERT(owner == newFrame->owner());
        if (owner->isLocal()) {
            HTMLFrameOwnerElement* ownerElement = toHTMLFrameOwnerElement(owner);
            ownerElement->setContentFrame(*newFrame);
            if (newFrame->isLocalFrame())
                ownerElement->setWidget(toLocalFrame(newFrame)->view());
        }
    } else if (frame->isWebLocalFrame()) {
        toWebLocalFrameImpl(frame)->initializeCoreFrame(oldFrame->host(), owner, oldFrame->tree().name(), nullAtom);
    } else {
        toWebRemoteFrameImpl(frame)->initializeCoreFrame(oldFrame->host(), owner, oldFrame->tree().name());
    }

    return true;
}