[patch] #63348 Konqueror looses style sheets on kde.org and gentoo.org

Germain Garand germain at ebooksfrance.org
Fri Nov 14 17:03:08 GMT 2003


Le Jeudi 13 Novembre 2003 23:30, Dirk Mueller a écrit :
> On Thursday 13 November 2003 05:53, Germain Garand wrote:
> > Problem: when parsing isn't finished, it can't know whether there will be
> > other sheets added or not, and it often ends up not electing any sheet.
>
> Yeah, I see that quite often :(
>
> The problem is that upon completion of the loading it should realize that
> this stylesheet does not exist anymore, and then set the default
> alternative.
>
> the code is in KHTMPart::checkCompleted near the end. Did you figure out
> why it doesn't work sometimes?

mmh, Zeus, I think I just understood something... I assumed "Basic Page Style" 
meant "No style", because that was the result, but reading the code, I wonder 
if it wasn't intended as "Default Page Style"? 8)

In which case there is indeed a bug in KHTMLPart:
It does:

d->m_paUseStylesheet->setCurrentItem(kMax(sheets.findIndex(d->m_sheetUsed),0));
slotUseStylesheet();

Thus setting the sheet to "Basic Page Style" if the previous one doesn't exist 
anymore.
But for this to work, slotUseStyleSheet would need to look rather like:

 void KHTMLPart::slotUseStylesheet()
 {
-  if (d->m_doc && d->m_paUseStylesheet->currentText() != d->m_sheetUsed) {
-    d->m_sheetUsed = d->m_paUseStylesheet->currentText();
+  bool defaultStyle = (d->m_paUseStylesheet->currentItem() == 0);
+
+  if (d->m_doc && (defaultStyle || d->m_paUseStylesheet->currentText() != 
d->m_sheetUsed))
+  {
+    d->m_sheetUsed = defaultStyle ? QString() : 
d->m_paUseStylesheet->currentText();
     d->m_doc->updateStyleSelector();
   }
 }

However, that alone doesn't solve the issue, because when m_sheetUsed is 
bogus, you still have to wait until everything is loaded before the Default 
sheet gets applied... so you get a big FOUC.

Germain




More information about the kfm-devel mailing list