Commit bcb09ec8 authored by hyatt's avatar 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:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3322 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 0bb44c36
2003-01-14 David Hyatt <hyatt@apple.com>
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 <darin@apple.com>
Reviewed by Maciej.
......
2003-01-14 David Hyatt <hyatt@apple.com>
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 <darin@apple.com>
Reviewed by Maciej.
......
......@@ -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();
}
......
......@@ -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<CSSStyleSheetImpl *>(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)
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment