Hi, In a few situation we have indeed a few rules that match ".stylename TD" I'll see if I can get rid of them.
Thanks, David On Aug 19, 4:11 pm, Jaime Yap <jaime...@google.com> wrote: > Setting the styles directly will still run layout. But It will not run style > matching. This might give you a bit of speed up, but I think you should take > a second look at the way you are styling your application. > > The assumption that CssResource won't help might be a little off. Setting > the style name might be getting very expensive for you because your CSS > might be triggering some pathological performance problems. Things to look > out for: > > 1. Are you using a lot of descendant selectors? > 2. For your descendant selectors, if is important to keep the right most > component of the selector as specific as possible. Styles are matches right > to left and not top down as intuition would suggest. If you have .foo div {} > as a selector, if will first check ALL divs in your page and then walk up to > find an ancestor .foo! > 3. Do you have any ie-CSS expressions? These make doing layout a lot slower. > > If you used CssResource, Style matching should be very very quick because > there will generally be no (or very few) descendant selectors. I would do an > experiment to see if this buys you anything. > > -Jaime > > > > On Thu, Aug 19, 2010 at 9:51 AM, Joel Webber <j...@google.com> wrote: > > [+some people who have looked at this problem in the past] > > > Le 19 août 2010 09:36, stuckagain <david.no...@gmail.com> a écrit : > > > Hi, > > >> I found out that using something like addStylename() in an onmouseover > >> can have really catastrophic effects on performance in IE (6/7 and 8). > >> In fact IE8 seems to be worse than the older versions. In my > >> applications the browser locks up for many seconds even minutes > >> running at 100% CPU. DynaTrace reveals that the browser is busy doing > >> layout calculations. > > >> For example we were doing a style change when moving the mouse over a > >> big table. In some situations this would block the browser for many > >> seconds (sometimes minutes, depending on the complexity of the UI). > > >> If I just directly set the style attribute changes directly in the > >> code it takes almost no CPU with the same complex UI. The problem here > >> is that I loose a lot of flexibility in my UI to use CSS to do the > >> styling (what if I want to change more than just the color for > >> example). > > >> I know there is something like CssResource, but as I understand it, it > >> will not solve the issue in this case since I still need to use an > >> addStyleName. > > >> Would there be a way, or wouldn't it be an great Idea, that GWT would > >> have support in CssResource to copy style attributes from the > >> CssResouce directly in the styles of the element that I am > >> targetting ? That way I would not need a addStylename/addClassname but > >> I still have the flexibility to write down these changes in a CSS > >> file. > > >> Or did I overlook such a feature ? > > >> As I understood, the declarative UI mechanism in GWT is doing such > >> things, but in our apps we can not use this. > > > We haven't built anything like this, but we've definitely seen this problem > > before. It doesn't seem unreasonable to be able to extract the text of a > > CSSResource rule's properties (a bit unfortunate, since it only affects IE > > and would be slower everywhere else -- maybe it would be better to provide a > > more abstract mechanism that could "do the right thing" everywhere). There > > is also some complexity added by the fact that the fastest way to apply such > > a style would be "Element.style = '{css string}'". But the only efficient > > way to do this would be to set the whole thing at once (meaning you couldn't > > easily mix them). > > > If I recall correctly (Kelly, Jaime, & John please check me on this), the > > speed problems on this case in IE tended to be a combination of layout and > > style matching. Layout can be mitigated a bit if you "separate" the table > > from the rest of the page by putting it in a position:absolute container > > (putting it in a layout panel does this), but that may not help enough > > and/or fit your design.- Hide quoted text - > > - Show quoted text - -- http://groups.google.com/group/Google-Web-Toolkit-Contributors