I think we've got request animation frame for the invisible content scenario.
For the height/width/resolution, CSS selectors and SVG are probably the easier case. Canvas however, that's not so easy. -Charles On May 8, 2012, at 5:30 PM, Gregg Tavares (勤) <g...@google.com> wrote: > Imagine you want to make a Web Component that draws a graph > Imagine that you'd like the graph to show more data if it's larger and less > if it's smaller. In other words, you don't want it to scale the data. > Imagine you set that component's size to width: 100%; height: 100% to scale > to its container > > Question: How does the Web Component know when to repaint its content? > > AFAICT the resize event only fires on window. If the point of Web Components > is to allow people to make self contained components it seems like there > might be the need for some way of letting the component know it needs to > repaint. > > Resize is just one example. > > Imagine a relatively heavy to repaint WebComponent like one that draws an > representation of an audio wave. If that component is hidden behind some > other component it would be nice if it didn't re-draw itself. When it becomes > visible thought needs to know it should redraw itself. > > Does a 'paint' event make sense? >