Changeset 72566 in webkit


Ignore:
Timestamp:
Nov 22, 2010 3:01:28 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-11-22 Charlie Reis <creis@chromium.org>

Reviewed by Darin Fisher.

Update correct content state during back/forward navigations
https://bugs.webkit.org/show_bug.cgi?id=48809

Test that we update content state when leaving a form in a subframe.

  • fast/history/saves-state-after-frame-nav.html:
  • fast/history/saves-state-after-frame-nav-expected.txt:
  • fast/history/resources/subframe-with-form.html:

2010-11-22 Charlie Reis <creis@chromium.org>

Reviewed by Darin Fisher.

Update correct content state during back/forward navigations
https://bugs.webkit.org/show_bug.cgi?id=48809

Ensures that history's previousItem is non-null when clients try to
update content state (e.g., Chromium's UpdateSessionHistory). We now
track load completions with a boolean field rather than by clearing
previousItem.

Test: fast/history/saves-state-after-frame-nav.html

  • loader/HistoryController.cpp:
  • loader/HistoryController.h:
Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r72565 r72566  
     12010-11-22  Charlie Reis  <creis@chromium.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Update correct content state during back/forward navigations
     6        https://bugs.webkit.org/show_bug.cgi?id=48809
     7
     8        Test that we update content state when leaving a form in a subframe.
     9
     10        * fast/history/saves-state-after-frame-nav.html:
     11        * fast/history/saves-state-after-frame-nav-expected.txt:
     12        * fast/history/resources/subframe-with-form.html:
     13
    1142010-11-22  Julie Parent  <jparent@chromium.org>
    215
  • trunk/WebCore/ChangeLog

    r72557 r72566  
     12010-11-22  Charlie Reis  <creis@chromium.org>
     2
     3        Reviewed by Darin Fisher.
     4
     5        Update correct content state during back/forward navigations
     6        https://bugs.webkit.org/show_bug.cgi?id=48809
     7
     8        Ensures that history's previousItem is non-null when clients try to
     9        update content state (e.g., Chromium's UpdateSessionHistory).  We now
     10        track load completions with a boolean field rather than by clearing
     11        previousItem.
     12
     13        Test: fast/history/saves-state-after-frame-nav.html
     14
     15        * loader/HistoryController.cpp:
     16        * loader/HistoryController.h:
     17
    1182010-11-22  Luiz Agostini  <luiz.agostini@openbossa.org>
    219
  • trunk/WebCore/loader/HistoryController.cpp

    r72334 r72566  
    6767HistoryController::HistoryController(Frame* frame)
    6868    : m_frame(frame)
     69    , m_frameLoadComplete(true)
    6970{
    7071}
     
    139140
    140141    // Because of previousItem's "masking" of currentItem for this purpose, it's important
    141     // that previousItem be cleared at the end of a page transition.  We leverage the
    142     // checkLoadComplete recursion to achieve this goal.
    143 
    144     HistoryItem* item = m_previousItem ? m_previousItem.get() : m_currentItem.get();
     142    // that we keep track of the end of a page transition with m_frameLoadComplete.  We
     143    // leverage the checkLoadComplete recursion to achieve this goal.
     144
     145    HistoryItem* item = m_frameLoadComplete ? m_currentItem.get() : m_previousItem.get();
    145146    if (!item)
    146147        return;
     
    246247
    247248    // Must grab the current scroll position before disturbing it
    248     saveScrollPositionAndViewStateToItem(m_previousItem.get());
     249    if (!m_frameLoadComplete)
     250        saveScrollPositionAndViewStateToItem(m_previousItem.get());
    249251}
    250252
     
    393395        // Note previousItem must be set before we close the URL, which will
    394396        // happen when the data source is made non-provisional below
     397        m_frameLoadComplete = false;
    395398        m_previousItem = m_currentItem;
    396399        ASSERT(m_provisionalItem);
     
    419422{
    420423    // Even if already complete, we might have set a previous item on a frame that
    421     // didn't do any data loading on the past transaction. Make sure to clear these out.
    422     m_previousItem = 0;
     424    // didn't do any data loading on the past transaction. Make sure to track that
     425    // the load is complete so that we use the current item instead.
     426    m_frameLoadComplete = true;
    423427}
    424428
    425429void HistoryController::setCurrentItem(HistoryItem* item)
    426430{
     431    m_frameLoadComplete = false;
     432    m_previousItem = m_currentItem;
    427433    m_currentItem = item;
    428434}
     
    499505   
    500506    // Set the item for which we will save document state
     507    m_frameLoadComplete = false;
    501508    m_previousItem = m_currentItem;
    502509    m_currentItem = item;
     
    508515{
    509516    RefPtr<HistoryItem> bfItem = createItem(m_frame->tree()->parent() ? true : false);
    510     if (m_previousItem)
     517    if (!m_frameLoadComplete)
    511518        saveScrollPositionAndViewStateToItem(m_previousItem.get());
    512519
     
    564571    {
    565572        // This content is good, so leave it alone and look for children that need reloading
    566         // Save form state (works from currentItem, since prevItem is nil)
    567         ASSERT(!m_previousItem);
     573        // Save form state (works from currentItem, since m_frameLoadComplete is true)
     574        ASSERT(m_frameLoadComplete);
    568575        saveDocumentState();
    569576        saveScrollPositionAndViewStateToItem(m_currentItem.get());
     
    572579            view->setWasScrolledByUser(false);
    573580
     581        m_previousItem = m_currentItem;
    574582        m_currentItem = item;
    575583               
  • trunk/WebCore/loader/HistoryController.h

    r72334 r72566  
    9797    RefPtr<HistoryItem> m_previousItem;
    9898    RefPtr<HistoryItem> m_provisionalItem;
     99
     100    bool m_frameLoadComplete;
    99101};
    100102
Note: See TracChangeset for help on using the changeset viewer.