[PATCH] New documentation: headerlink style speed issue

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] New documentation: headerlink style speed issue

Robin Stocker
Hi,

Browsing the (very pretty) new documentation with Firefox, I noticed
that selecting text was slow, especially on large pages. For example, on
the module index page, it could take up to 1 second until the blue
selection background would appear after I had selected some text with
the mouse.

I figured it could have something to do with the style sheet and by
commenting out various parts of default.css, I narrowed the cause down
to this:

*:hover > a.headerlink,
*:hover > a.headerlink,
*:hover > a.headerlink,
*:hover > a.headerlink,
*:hover > a.headerlink,
*:hover > a.headerlink {
    visibility: visible;
}

Most likely the problem is with the *:hover quantifier. When the mouse
hovers over any element, Firefox has to check if there's a a.headerlink
in the element. After changing *:hover to the specific elements h1-h6
and dt (are these all?), text selection is as smooth as it should be and
maybe even overall display speed is better.

Attached is a patch for this, which also removes some (unnecessary?)
duplication.

What do you think, could you commit the patch?

  Robin

Index: sphinx/style/default.css
===================================================================
--- sphinx/style/default.css (revision 57882)
+++ sphinx/style/default.css (working copy)
@@ -529,11 +529,6 @@
 div.body h5 { font-size: 110%; }
 div.body h6 { font-size: 100%; }
 
-a.headerlink,
-a.headerlink,
-a.headerlink,
-a.headerlink,
-a.headerlink,
 a.headerlink {
     color: #c60f0f;
     font-size: 0.8em;
@@ -542,20 +537,16 @@
     visibility: hidden;
 }
 
-*:hover > a.headerlink,
-*:hover > a.headerlink,
-*:hover > a.headerlink,
-*:hover > a.headerlink,
-*:hover > a.headerlink,
-*:hover > a.headerlink {
+h1:hover > a.headerlink,
+h2:hover > a.headerlink,
+h3:hover > a.headerlink,
+h4:hover > a.headerlink,
+h5:hover > a.headerlink,
+h6:hover > a.headerlink,
+dt:hover > a.headerlink {
     visibility: visible;
 }
 
-a.headerlink:hover,
-a.headerlink:hover,
-a.headerlink:hover,
-a.headerlink:hover,
-a.headerlink:hover,
 a.headerlink:hover {
     background-color: #c60f0f;
     color: white;

_______________________________________________
Doc-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/doc-sig
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] New documentation: headerlink style speed issue

Georg Brandl-2
Robin Stocker schrieb:

> Hi,
>
> Browsing the (very pretty) new documentation with Firefox, I noticed
> that selecting text was slow, especially on large pages. For example, on
> the module index page, it could take up to 1 second until the blue
> selection background would appear after I had selected some text with
> the mouse.
>
> I figured it could have something to do with the style sheet and by
> commenting out various parts of default.css, I narrowed the cause down
> to this:
>
> *:hover > a.headerlink,
> *:hover > a.headerlink,
> *:hover > a.headerlink,
> *:hover > a.headerlink,
> *:hover > a.headerlink,
> *:hover > a.headerlink {
>     visibility: visible;
> }
>
> Most likely the problem is with the *:hover quantifier. When the mouse
> hovers over any element, Firefox has to check if there's a a.headerlink
> in the element. After changing *:hover to the specific elements h1-h6
> and dt (are these all?), text selection is as smooth as it should be and
> maybe even overall display speed is better.
>
> Attached is a patch for this, which also removes some (unnecessary?)
> duplication.
>
> What do you think, could you commit the patch?

Yes, thank you very much! It's committed as rev. 57898 and will go live
on docs.python.org within 12 hours' time.

Cheers,
Georg

--
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

_______________________________________________
Doc-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/doc-sig