diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25 index aa06f0cf62299bdb5acca4e77ad03fd476474a47..c850aef2bee480d9421762adce63d6bdee1f0bf6 100644 --- a/WebCore/ChangeLog-2003-10-25 +++ b/WebCore/ChangeLog-2003-10-25 @@ -1,3 +1,19 @@ +2003-01-14 David Hyatt + + Make FOUC work with XML. + + Reviewed by darin. + + * khtml/html/html_baseimpl.cpp: + (HTMLBodyElementImpl::attach): + * khtml/xml/dom_xmlimpl.cpp: + (ProcessingInstructionImpl::ProcessingInstructionImpl): + (ProcessingInstructionImpl::checkStyleSheet): + (ProcessingInstructionImpl::isLoading): + (ProcessingInstructionImpl::sheetLoaded): + (ProcessingInstructionImpl::setStyleSheet): + * khtml/xml/dom_xmlimpl.h: + 2003-01-14 Darin Adler Reviewed by Maciej. diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23 index aa06f0cf62299bdb5acca4e77ad03fd476474a47..c850aef2bee480d9421762adce63d6bdee1f0bf6 100644 --- a/WebCore/ChangeLog-2005-08-23 +++ b/WebCore/ChangeLog-2005-08-23 @@ -1,3 +1,19 @@ +2003-01-14 David Hyatt + + Make FOUC work with XML. + + Reviewed by darin. + + * khtml/html/html_baseimpl.cpp: + (HTMLBodyElementImpl::attach): + * khtml/xml/dom_xmlimpl.cpp: + (ProcessingInstructionImpl::ProcessingInstructionImpl): + (ProcessingInstructionImpl::checkStyleSheet): + (ProcessingInstructionImpl::isLoading): + (ProcessingInstructionImpl::sheetLoaded): + (ProcessingInstructionImpl::setStyleSheet): + * khtml/xml/dom_xmlimpl.h: + 2003-01-14 Darin Adler Reviewed by Maciej. diff --git a/WebCore/khtml/html/html_baseimpl.cpp b/WebCore/khtml/html/html_baseimpl.cpp index 694ddc8a4d6b8b9817178073a589c66db0df0813..1a8788b24265840039b7ede6860801126baead1c 100644 --- a/WebCore/khtml/html/html_baseimpl.cpp +++ b/WebCore/khtml/html/html_baseimpl.cpp @@ -185,17 +185,18 @@ void HTMLBodyElementImpl::attach() { assert(!m_render); assert(parentNode()); - assert(parentNode()->renderer()); - - RenderStyle* style = getDocument()->styleSelector()->styleForElement(this); - style->ref(); - if (style->display() != NONE) { - m_render = new (getDocument()->renderArena()) RenderBody(this); - m_render->setStyle(style); - parentNode()->renderer()->addChild(m_render, nextRenderer()); + + if (parentNode()->renderer()) { + RenderStyle* style = getDocument()->styleSelector()->styleForElement(this); + style->ref(); + if (style->display() != NONE) { + m_render = new (getDocument()->renderArena()) RenderBody(this); + m_render->setStyle(style); + parentNode()->renderer()->addChild(m_render, nextRenderer()); + } + style->deref(); } - style->deref(); - + NodeBaseImpl::attach(); } diff --git a/WebCore/khtml/xml/dom_xmlimpl.cpp b/WebCore/khtml/xml/dom_xmlimpl.cpp index 2f24e8fce5fbdae9b8b54254b2c6a4c37fde8354..10c30f0baf6123d096893010e047c965ab94147b 100644 --- a/WebCore/khtml/xml/dom_xmlimpl.cpp +++ b/WebCore/khtml/xml/dom_xmlimpl.cpp @@ -257,6 +257,7 @@ ProcessingInstructionImpl::ProcessingInstructionImpl(DocumentPtr *doc) : NodeBas m_localHref = 0; m_sheet = 0; m_cachedSheet = 0; + m_loading = false; } ProcessingInstructionImpl::ProcessingInstructionImpl(DocumentPtr *doc, DOMString _target, DOMString _data) : NodeBaseImpl(doc) @@ -378,6 +379,8 @@ void ProcessingInstructionImpl::checkStyleSheet() { // ### some validation on the URL? // ### FIXME charset + m_loading = true; + getDocument()->addPendingSheet(); if (m_cachedSheet) m_cachedSheet->deref(this); m_cachedSheet = getDocument()->docLoader()->requestStyleSheet(getDocument()->completeURL(href.string()), QString::null); if (m_cachedSheet) @@ -393,6 +396,19 @@ StyleSheetImpl *ProcessingInstructionImpl::sheet() const return m_sheet; } +bool ProcessingInstructionImpl::isLoading() const +{ + if(m_loading) return true; + if(!m_sheet) return false; + return static_cast(m_sheet)->isLoading(); +} + +void ProcessingInstructionImpl::sheetLoaded() +{ + if (!isLoading()) + getDocument()->stylesheetLoaded(); +} + void ProcessingInstructionImpl::setStyleSheet(const DOM::DOMString &url, const DOM::DOMString &sheet) { if (m_sheet) @@ -404,7 +420,11 @@ void ProcessingInstructionImpl::setStyleSheet(const DOM::DOMString &url, const D m_cachedSheet->deref(this); m_cachedSheet = 0; - getDocument()->updateStyleSelector(); + m_loading = false; + + // Tell the doc about the sheet. + if (!isLoading() && m_sheet) + getDocument()->stylesheetLoaded(); } void ProcessingInstructionImpl::setStyleSheet(CSSStyleSheetImpl* sheet) diff --git a/WebCore/khtml/xml/dom_xmlimpl.h b/WebCore/khtml/xml/dom_xmlimpl.h index 37f56cc6237d9243dc308b120cef7ec1deb7357a..31501d0de8970c6eef34e38591489a7e224690fe 100644 --- a/WebCore/khtml/xml/dom_xmlimpl.h +++ b/WebCore/khtml/xml/dom_xmlimpl.h @@ -152,7 +152,9 @@ public: void checkStyleSheet(); virtual void setStyleSheet(const DOM::DOMString &url, const DOM::DOMString &sheet); virtual void setStyleSheet(CSSStyleSheetImpl* sheet); - + bool isLoading() const; + void sheetLoaded(); + #if APPLE_CHANGES static ProcessingInstruction createInstance(ProcessingInstructionImpl *impl); #endif @@ -163,6 +165,7 @@ protected: DOMStringImpl *m_localHref; khtml::CachedCSSStyleSheet *m_cachedSheet; CSSStyleSheetImpl *m_sheet; + bool m_loading; }; class XMLAttributeReader : public QXmlDefaultHandler