Re: style bug, perhaps

Johannes Hofmann <[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <[email protected]>
On Mon, Aug 01, 2011 at 11:50:59PM +0200, Johannes Hofmann wrote:
> On Mon, Aug 01, 2011 at 04:03:32AM +0000, corvid wrote:
> > 
> > I reload the following, and the link border around the first image
> > disappears. If the problem's in the style attr copying/comparison/etc.,
> > I'm failing to see it. I can see that the style has border type of none
> > and border width of 0. I started to try to watch ":link img,
> > :visited img {border: 1px solid}" get applied, but...
> > 
> > 
> > <html>
> > <body>
> > <a href="whatever.html">
> >   <img src="whatever.jpg">
> > </a>
> > 
> > <button type='submit' name='button'">
> >   <img src="something.jpg" alt="Search">
> > </button>
> > </body>
> > </html>
> 
> Oh, this is a nasty one!
> 
> It seems the problem is an optimization in CssSelector::match()
> together with the fact that we reuse the user agent - and the user -
> style for all pages.
> 
> I try to get this fixed soon.

I just committed a fix. 
Now the user- and the useragent-stylesheets are no longer shared
between CssContexts.
With attached debug-patch you can test the time needed to recreate
them on each page load.
For me the times were below 1ms.
As a bonus you can now modify your user stylesheet
(~/.dillo/style.css) while dillo is running.

Cheers,
Johannes

_______________________________________________
Dillo-dev mailing list
[email protected]
http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
gettimeofday.diff (text/plain, 781 B)
diff -r 8a670750be3d src/css.cc
--- a/src/css.cc	Tue Aug 02 23:25:49 2011 +0200
+++ b/src/css.cc	Tue Aug 02 23:29:12 2011 +0200
@@ -10,6 +10,7 @@
  */
 
 #include <stdio.h>
+#include <sys/time.h>
 #include "../dlib/dlib.h"
 #include "misc.h"
 #include "msg.h"
@@ -490,6 +491,11 @@
 }
 
 CssContext::CssContext () {
+   struct timeval start, finish ;
+   float msec;
+
+   gettimeofday (&start, NULL);
+
    pos = 0;
 
    memset (sheet, 0, sizeof(sheet));
@@ -499,6 +505,11 @@
 
    buildUserAgentStyle ();
    buildUserStyle ();
+
+   gettimeofday (&finish, NULL);
+   msec = finish.tv_sec * 10000 + finish.tv_usec / 100;
+   msec -= start.tv_sec * 10000 + start.tv_usec / 100;
+   fprintf(stderr, "=======> user styles %f msecs\n", msec / 10);
 }
 
 CssContext::~CssContext () {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.