Changeset 24550 in webkit


Ignore:
Timestamp:
Jul 23, 2007 5:04:32 PM (17 years ago)
Author:
thatcher
Message:

Reviewed by Hyatt.

<rdar://problem/5242145> REGRESSION: Clicking on symbol in documentation often doesn't scroll to symbol

A renderer for the anchor wasn't always available at the time parsing finished. So we need
to bail out of gotoAnchor if stylesheets are pending and remember to call gotoAnchor later
once all of the pending stylesheets load.

  • dom/Document.cpp: (WebCore::Document::Document): Initialize m_gotoAnchorNeededAfterStylesheetsLoad to false. (WebCore::Document::stylesheetLoaded): If we have no more pending stylesheets, call gotoAnchor if needed.
  • dom/Document.h: (WebCore::Document::gotoAnchorNeededAfterStylesheetsLoad): New method. (WebCore::Document::setGotoAnchorNeededAfterStylesheetsLoad): Ditto.
  • loader/FrameLoader.cpp: (WebCore::FrameLoader::gotoAnchor): Bail early if the document still has pending stylesheets.
  • loader/FrameLoader.h: Make gotoAnchor() public.
Location:
trunk/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r24549 r24550  
     12007-07-23  Timothy Hatcher  <timothy@apple.com>
     2
     3        Reviewed by Hyatt.
     4
     5        <rdar://problem/5242145> REGRESSION: Clicking on symbol in documentation often doesn't scroll to symbol
     6
     7        A renderer for the anchor wasn't always available at the time parsing finished. So we need
     8        to bail out of gotoAnchor if stylesheets are pending and remember to call gotoAnchor later
     9        once all of the pending stylesheets load.
     10
     11        * dom/Document.cpp:
     12        (WebCore::Document::Document): Initialize m_gotoAnchorNeededAfterStylesheetsLoad to false.
     13        (WebCore::Document::stylesheetLoaded): If we have no more pending stylesheets, call gotoAnchor if needed.
     14        * dom/Document.h:
     15        (WebCore::Document::gotoAnchorNeededAfterStylesheetsLoad): New method.
     16        (WebCore::Document::setGotoAnchorNeededAfterStylesheetsLoad): Ditto.
     17        * loader/FrameLoader.cpp:
     18        (WebCore::FrameLoader::gotoAnchor): Bail early if the document still has pending stylesheets.
     19        * loader/FrameLoader.h: Make gotoAnchor() public.
     20
    1212007-07-23  John Sullivan  <sullivan@apple.com>
    222
  • trunk/WebCore/dom/Document.cpp

    r24541 r24550  
    309309    m_usesFirstLineRules = false;
    310310    m_usesFirstLetterRules = false;
     311    m_gotoAnchorNeededAfterStylesheetsLoad = false;
    311312
    312313    m_styleSelector = new CSSStyleSelector(this, m_usersheet, m_styleSheets.get(), !inCompatMode());
     
    19251926
    19261927    updateStyleSelector();
     1928
     1929    if (!m_pendingStylesheets && m_gotoAnchorNeededAfterStylesheetsLoad)
     1930        m_frame->loader()->gotoAnchor();
    19271931}
    19281932
  • trunk/WebCore/dom/Document.h

    r24541 r24550  
    272272    void addPendingSheet() { m_pendingStylesheets++; }
    273273
     274    bool gotoAnchorNeededAfterStylesheetsLoad() { return m_gotoAnchorNeededAfterStylesheetsLoad; }
     275    void setGotoAnchorNeededAfterStylesheetsLoad(bool b) { m_gotoAnchorNeededAfterStylesheetsLoad = b; }
     276
    274277    /**
    275278     * Called when one or more stylesheets in the document may have been added, removed or changed.
     
    731734    bool m_usesFirstLineRules;
    732735    bool m_usesFirstLetterRules;
     736    bool m_gotoAnchorNeededAfterStylesheetsLoad;
    733737
    734738    String m_title;
  • trunk/WebCore/loader/FrameLoader.cpp

    r24490 r24550  
    14131413    ASSERT(m_frame->document());
    14141414
     1415    if (!m_frame->document()->haveStylesheetsLoaded()) {
     1416        m_frame->document()->setGotoAnchorNeededAfterStylesheetsLoad(true);
     1417        return false;
     1418    }
     1419
     1420    m_frame->document()->setGotoAnchorNeededAfterStylesheetsLoad(false);
     1421
    14151422    Node* anchorNode = m_frame->document()->getElementById(AtomicString(name));
    14161423    if (!anchorNode)
  • trunk/WebCore/loader/FrameLoader.h

    r24490 r24550  
    323323        KJS::JSValue* executeScript(const String& script, bool forceUserGesture = false);
    324324
     325        void gotoAnchor();
    325326        bool gotoAnchor(const String& name); // returns true if the anchor was found
    326327        void scrollToAnchor(const KURL&);
     
    473474        void receivedFirstData();
    474475
    475         void gotoAnchor();
    476 
    477476        void updatePolicyBaseURL();
    478477        void setPolicyBaseURL(const String&);
Note: See TracChangeset for help on using the changeset viewer.