<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.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@24550
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-07-23 Timothy Hatcher <timothy@apple.com>
+
+ 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.
+
2007-07-23 John Sullivan <sullivan@apple.com>
Reviewed by Darin
m_usesSiblingRules = false;
m_usesFirstLineRules = false;
m_usesFirstLetterRules = false;
+ m_gotoAnchorNeededAfterStylesheetsLoad = false;
m_styleSelector = new CSSStyleSelector(this, m_usersheet, m_styleSheets.get(), !inCompatMode());
m_didCalculateStyleSelector = false;
#endif
updateStyleSelector();
+
+ if (!m_pendingStylesheets && m_gotoAnchorNeededAfterStylesheetsLoad)
+ m_frame->loader()->gotoAnchor();
}
void Document::updateStyleSelector()
*/
void addPendingSheet() { m_pendingStylesheets++; }
+ bool gotoAnchorNeededAfterStylesheetsLoad() { return m_gotoAnchorNeededAfterStylesheetsLoad; }
+ void setGotoAnchorNeededAfterStylesheetsLoad(bool b) { m_gotoAnchorNeededAfterStylesheetsLoad = b; }
+
/**
* Called when one or more stylesheets in the document may have been added, removed or changed.
*
bool m_usesSiblingRules;
bool m_usesFirstLineRules;
bool m_usesFirstLetterRules;
+ bool m_gotoAnchorNeededAfterStylesheetsLoad;
String m_title;
bool m_titleSetExplicitly;
{
ASSERT(m_frame->document());
+ if (!m_frame->document()->haveStylesheetsLoaded()) {
+ m_frame->document()->setGotoAnchorNeededAfterStylesheetsLoad(true);
+ return false;
+ }
+
+ m_frame->document()->setGotoAnchorNeededAfterStylesheetsLoad(false);
+
Node* anchorNode = m_frame->document()->getElementById(AtomicString(name));
if (!anchorNode)
anchorNode = m_frame->document()->anchors()->namedItem(name, !m_frame->document()->inCompatMode());
KJS::JSValue* executeScript(const String& URL, int baseLine, const String& script);
KJS::JSValue* executeScript(const String& script, bool forceUserGesture = false);
+ void gotoAnchor();
bool gotoAnchor(const String& name); // returns true if the anchor was found
void scrollToAnchor(const KURL&);
void receivedFirstData();
- void gotoAnchor();
-
void updatePolicyBaseURL();
void setPolicyBaseURL(const String&);