Example #1
0
void CachedPage::restore(Page& page)
{
    ASSERT(m_cachedMainFrame);
    ASSERT(m_cachedMainFrame->view()->frame().isMainFrame());
    ASSERT(!page.subframeCount());

    m_cachedMainFrame->open();
    
    // Restore the focus appearance for the focused element.
    // FIXME: Right now we don't support pages w/ frames in the b/f cache.  This may need to be tweaked when we add support for that.
    Document* focusedDocument = page.focusController().focusedOrMainFrame().document();
    if (Element* element = focusedDocument->focusedElement())
        element->updateFocusAppearance(true);

    if (m_needStyleRecalcForVisitedLinks) {
        for (Frame* frame = &page.mainFrame(); frame; frame = frame->tree().traverseNext())
            frame->document()->visitedLinkState().invalidateStyleForAllLinks();
    }

#if USE(ACCELERATED_COMPOSITING)
    if (m_needsDeviceScaleChanged) {
        page.mainFrame().deviceOrPageScaleFactorChanged();
    }
#endif

    if (m_needsFullStyleRecalc)
        page.setNeedsRecalcStyleInAllFrames();

#if ENABLE(VIDEO_TRACK)
    if (m_needsCaptionPreferencesChanged)
        page.captionPreferencesChanged();
#endif

    clear();
}