Setting CSS props and timers from JavaScript

David Faure david at mandrakesoft.com
Sun Nov 3 15:20:35 GMT 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 03 November 2002 15:17, Koos Vriezen wrote:
> Hi,
> 
> Looking why a page was eating all my CPU:
>   function makeStatic() {

Ah, the famous makeStatic....... found it in two sites already (from bug reports).

> KHTML ends with 12538 on my box while eating all CPU. Mozilla ends with
> 185, probably has a limit of 16ms.
> It's quite easy to set a limit in WindowQObject::installTimeout (2 times).

Oh, I didn't think we could do this (it's effectively forbidding sites from using
a setting < 16). But indeed it leads to much better useability, I'm all for it
(seems to be the only fix against this "extreme polling" those sites do).

> Another thing is that setting the top property. Now a property is first
> removed and than added, marking it as changed trggering a recalcStyle.
> Adding 'if (styleDecl.getPropertyValue(prop) == propvalue) return;'
> in DOMCSSStyleDeclaration::tryPut does seem to prevent this (but may slow
> down cases where propvalue != current value).

Hmm, indeed. Which is why it might not be a good idea - in the common case
it _is_ different. And if not, the recalc might be intentionnal. Websites which
want to do this in a smarter way (for this case where the value is usually
unchanged), can query the prop before setting it...

[ The real problem IMHO is that there is no DOM event for "scrollbars moved",
which such sites could use to move the static thingie, instead of polling :} ]

- -- 
David FAURE, david at mandrakesoft.com, faure at kde.org
http://people.mandrakesoft.com/~david/
Contributing to: http://www.konqueror.org/, http://www.koffice.org/
Get the latest KOffice - http://download.kde.org/stable/koffice-1.2/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9xT7D72KcVAmwbhARArmFAKCqnK3nXvQ79BdXz+YHj79b05Y+kACfZwZT
A/zIFDPz4FIcXdYwr+JavRE=
=Qma+
-----END PGP SIGNATURE-----





More information about the kfm-devel mailing list