kdelibs/khtml
Alexander Kellett
lypanov@kde.org
Tue, 14 Jan 2003 09:53:46 +0100
--pf9I7BMVVzbSWLtt
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
hiya antti!
afaics i think you may have missed a few important changes:
css/cssstyleselector.cpp:
make sure to cleanup styleNotYetAvailable in CSSStyleSelector::clear()
html/html_baseimpl.cpp:
1) HTMLFrameElementImpl::attach():
don't assert on renderer() i assume its possible to hit this
codepath with no renderer due to the fouc changes?
2) HTMLFrameElementImpl::contentDocument():
reduce usage of m_render, also assuming this code path hits it
3) HTMLFrameSetElementImpl::attach()
"pay attention if a stylesheet has caused us to delay our loading"
depends on the rendering/render_style.cpp change
html/html_formimpl.cpp:
fix needed for closeRenderer?
html/html_objectimpl.cpp:
not certain, but looks like this would be needed to make sure something
doesn't occur before the renderer is intantiated
html/htmlparser.cpp:
use closeRenderer
rendering/render_style.cpp / rendering/render_style.h:
add RenderStyle::isStyleAvailable
xml/xml_tokenizer.cpp:
use closeRenderer
questionable ones (i.e, i don't know if it should go in):
html/html_documentimpl.cpp
always redraw, maybe related?, didn't test yet...
rendering/render_container.cpp:
without this _very_ ugly fix www.nvidia.com assert's on me
maybe the removal of blockBidi fixes this? i've no idea ;-)
patch attached for the above stuff. though i've hand edited it
a bit, so i may not apply cleanly. also its entirely untested as
kdelibs doesn't want to build for me :(
also, you added m_media, m_type and "disabled" support but
i wasn't sure that this was really needed for fouc. alternative
on the other hand seemed to be needed as otherwise all alternative
css's would delay rendering. well, i guess that would be the case
anyways.
mvg,
Alex
On Tue, Jan 14, 2003 at 03:14:38AM +0100, Antti Koivisto wrote:
> CVS commit by koivisto:
>
> Flash of unstyled content (FOUC) fixes ported from Safari.
>
> - note the changes in html_baseimpl.cpp to prevent creation
> of RenderHtml with display:none.
> - virtual isInline() is evil
>
> CCMAIL: khtml-devel@kde.org
>
>
> M +11 -0 css/cssstyleselector.cpp 1.248
> M +3 -1 css/cssstyleselector.h 1.32
> M +12 -6 html/html_baseimpl.cpp 1.176
> M +44 -1 html/html_elementimpl.cpp 1.153
> M +3 -1 html/html_elementimpl.h 1.63
> M +76 -19 html/html_headimpl.cpp 1.96
> M +14 -4 html/html_headimpl.h 1.39
> M +2 -1 rendering/render_flow.h 1.75
> M +33 -4 xml/dom_docimpl.cpp 1.212
> M +25 -2 xml/dom_docimpl.h 1.104
> M +44 -7 xml/dom_nodeimpl.cpp 1.201
> M +7 -3 xml/dom_nodeimpl.h 1.141
> M +2 -2 xml/xml_tokenizer.cpp 1.41
>
>
>
> _______________________________________________
> Khtml-devel@mail.kde.org
> http://mail.kde.org/mailman/listinfo/khtml-devel
>
--
"[...] Konqueror open source project. Weighing in at less than
one tenth the size of another open source renderer"
Apple, Jan 2003 (http://www.apple.com/safari/)
--pf9I7BMVVzbSWLtt
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="fouc-all-v4.patch"
Index: css/cssstyleselector.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/css/cssstyleselector.cpp,v
retrieving revision 1.248
diff -u -p -B -w -r1.248 cssstyleselector.cpp
--- css/cssstyleselector.cpp 14 Jan 2003 02:14:37 -0000 1.248
+++ css/cssstyleselector.cpp 14 Jan 2003 09:13:58 -0000
@@ -242,10 +242,12 @@ void CSSStyleSelector::clear()
delete defaultQuirksStyle;
delete defaultPrintStyle;
delete defaultSheet;
+ delete styleNotYetAvailable;
defaultStyle = 0;
defaultQuirksStyle = 0;
defaultPrintStyle = 0;
defaultSheet = 0;
+ styleNotYetAvailable = 0;
}
#define MAXFONTSIZES 15
Index: html/html_baseimpl.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/html/html_baseimpl.cpp,v
retrieving revision 1.176
diff -u -p -B -w -r1.176 html_baseimpl.cpp
--- html/html_baseimpl.cpp 14 Jan 2003 02:14:37 -0000 1.176
+++ html/html_baseimpl.cpp 14 Jan 2003 09:13:58 -0000
@@ -298,7 +298,6 @@ void HTMLFrameElementImpl::attach()
{
assert(!attached());
assert(parentNode());
- assert(parentNode()->renderer());
// we should first look up via id, then via name.
// this shortterm hack fixes the ugly case. ### rewrite needed for next release
@@ -370,12 +369,14 @@ void HTMLFrameElementImpl::setFocus(bool
DocumentImpl* HTMLFrameElementImpl::contentDocument() const
{
- if ( !m_render ) return 0;
-
- RenderPart* render = static_cast<RenderPart*>( m_render );
+ KHTMLView* w = getDocument()->view();
- if(render->widget() && render->widget()->inherits("KHTMLView"))
- return static_cast<KHTMLView*>( render->widget() )->part()->xmlDocImpl();
+ if (w) {
+ KHTMLPart *part = w->part()->findFrame( name.string() );
+ if (part) {
+ return part->xmlDocImpl();
+ }
+ }
return 0;
}
@@ -477,10 +478,16 @@ void HTMLFrameSetElementImpl::attach()
node = static_cast<HTMLElementImpl*>(node->parentNode());
}
- // ignore display: none
+ // ignore display: none but do pay attention if a stylesheet has caused us to delay
+ // our loading.
+ RenderStyle* style = getDocument()->styleSelector()->styleForElement(this);
+ style->ref();
+ if (style->isStyleAvailable()) {
m_render = new RenderFrameSet(this);
- m_render->setStyle(getDocument()->styleSelector()->styleForElement(this));
+ m_render->setStyle(style);
parentNode()->renderer()->addChild(m_render, nextRenderer());
+ }
+ style->deref();
NodeBaseImpl::attach();
}
Index: html/html_formimpl.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/html/html_formimpl.cpp,v
retrieving revision 1.308
diff -u -p -B -w -r1.308 html_formimpl.cpp
--- html/html_formimpl.cpp 11 Jan 2003 00:38:44 -0000 1.308
+++ html/html_formimpl.cpp 14 Jan 2003 09:13:58 -0000
@@ -584,10 +584,16 @@ void HTMLGenericFormElementImpl::attach(
if (m_render) {
assert(m_render->style());
parentNode()->renderer()->addChild(m_render, nextRenderer());
- m_render->updateFromElement();
}
NodeBaseImpl::attach();
+
+ // The call to updateFromElement() needs to go after the call through
+ // to the base class's attach() because that can sometimes do a close
+ // on the renderer.
+ if (m_render)
+ m_render->updateFromElement();
+
}
HTMLFormElementImpl *HTMLGenericFormElementImpl::getForm() const
Index: html/html_objectimpl.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/html/html_objectimpl.cpp,v
retrieving revision 1.98
diff -u -p -B -w -r1.98 html_objectimpl.cpp
--- html/html_objectimpl.cpp 13 Jan 2003 20:01:55 -0000 1.98
+++ html/html_objectimpl.cpp 14 Jan 2003 09:13:58 -0000
@@ -443,7 +443,7 @@ void HTMLObjectElementImpl::attach()
void HTMLObjectElementImpl::detach()
{
- if (attached())
+ if (attached() && m_render)
// ### do this when we are actualy removed from document instead
dispatchHTMLEvent(EventImpl::UNLOAD_EVENT,false,false);
Index: html/htmlparser.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/html/htmlparser.cpp,v
retrieving revision 1.318
diff -u -p -B -w -r1.318 htmlparser.cpp
--- html/htmlparser.cpp 13 Jan 2003 12:04:09 -0000 1.318
+++ html/htmlparser.cpp 14 Jan 2003 09:13:58 -0000
@@ -328,8 +328,7 @@ bool KHTMLParser::insertNode(NodeImpl *n
QString state(document->document()->nextState());
if (!state.isNull()) n->restoreState(state);
}
- if(n->renderer())
- n->renderer()->close();
+ n->closeRenderer();
#endif
if(n->isInline()) m_inline = true;
}
@@ -1182,8 +1181,7 @@ void KHTMLParser::popOneBlock()
QString state(document->document()->nextState());
if (!state.isNull()) current->restoreState(state);
}
- if (current->renderer())
- current->renderer()->close();
+ current->closeRenderer();
}
#endif
Index: rendering/render_style.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/rendering/render_style.cpp,v
retrieving revision 1.56
diff -u -p -B -w -r1.56 render_style.cpp
--- rendering/render_style.cpp 12 Jan 2003 20:00:21 -0000 1.56
+++ rendering/render_style.cpp 14 Jan 2003 09:13:58 -0000
@@ -24,6 +24,7 @@
*/
#include "xml/dom_stringimpl.h"
+#include "css/cssstyleselector.h"
#include "render_style.h"
@@ -230,6 +231,11 @@ bool RenderStyle::operator==(const Rende
background == o.background &&
surround == o.surround &&
inherited == o.inherited);
+}
+
+bool RenderStyle::isStyleAvailable() const
+{
+ return this != CSSStyleSelector::styleNotYetAvailable;
}
RenderStyle* RenderStyle::getPseudoStyle(PseudoId pid)
Index: rendering/render_style.h
===================================================================
RCS file: /home/kde/kdelibs/khtml/rendering/render_style.h,v
retrieving revision 1.80
diff -u -p -B -w -r1.80 render_style.h
--- rendering/render_style.h 28 Dec 2002 14:05:05 -0000 1.80
+++ rendering/render_style.h 14 Jan 2003 09:13:58 -0000
@@ -640,6 +640,8 @@ public:
bool visuallyOrdered() const { return inherited_flags._visuallyOrdered; }
void setVisuallyOrdered(bool b) { inherited_flags._visuallyOrdered = b; }
+ bool isStyleAvailable() const;
+
// attribute getter methods
EDisplay display() const { return noninherited_flags._display; }
Index: xml/xml_tokenizer.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/xml/xml_tokenizer.cpp,v
retrieving revision 1.41
diff -u -p -B -w -r1.41 xml_tokenizer.cpp
--- xml/xml_tokenizer.cpp 14 Jan 2003 02:14:38 -0000 1.41
+++ xml/xml_tokenizer.cpp 14 Jan 2003 09:13:58 -0000
@@ -385,9 +385,9 @@ void XMLTokenizer::finish()
// Close the renderers so that they update their display correctly
// ### this should not be necessary, but requires changes in the rendering code...
- h1->renderer()->close();
- pre->renderer()->close();
- body->renderer()->close();
+ h1->closeRenderer();
+ pre->closeRenderer();
+ body->closeRenderer();
m_doc->document()->recalcStyle( NodeImpl::Inherit );
m_doc->document()->updateRendering();
Index: html/html_documentimpl.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/html/html_documentimpl.cpp,v
retrieving revision 1.146
diff -u -p -B -w -r1.146 html_documentimpl.cpp
--- html/html_documentimpl.cpp 13 Jan 2003 10:36:45 -0000 1.146
+++ html/html_documentimpl.cpp 14 Jan 2003 09:13:58 -0000
@@ -302,6 +302,13 @@ void HTMLDocumentImpl::close()
getDocument()->dispatchWindowEvent(EventImpl::LOAD_EVENT, false, false);
updateRendering();
+
+ // Always do a layout/repaint after loading.
+ if (renderer()) {
+ if (!renderer()->layouted())
+ renderer()->layout();
+ renderer()->repaint();
+ }
}
}
Index: rendering/render_container.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/rendering/render_container.cpp,v
retrieving revision 1.37
diff -u -p -B -w -r1.37 render_container.cpp
--- rendering/render_container.cpp 10 Jan 2003 11:59:38 -0000 1.37
+++ rendering/render_container.cpp 14 Jan 2003 09:13:58 -0000
@@ -98,7 +98,8 @@ void RenderContainer::addChild(RenderObj
needsTable = true;
break;
case NONE:
- KHTMLAssert(false);
+ kdWarning() << "DOH! - KHTMLAssert(false)!!!!" << endl;
+ // KHTMLAssert(false);
break;
}
}
--pf9I7BMVVzbSWLtt--