On Jun 23, 2011, at 11:46 AM, Levi Weintraub wrote:

> We’ve been getting an increasing number of complaints lately about the 
> zooming support in webkit and how hard it is to correctly support zooming in 
> complex web applications.
> 
> To address this we plan to convert the rendering tree to float to allow for 
> better zooming and scaling support. Furthermore this could be expanded to 
> support sub-pixel layout and positioning which in turn would allow higher 
> precision layout when zoomed. We’re the only rendering engine that hasn’t yet 
> made this change.
> 
> Changing rendering (and hit testing) to use floats does not necessarily mean 
> that we need to expose floats through the dom api, however if we are to 
> support sub-pixel layout (i.e. style=”left: 12.3px”) this would be required. 
> Specifically we’d need to change the offsetLeft/Top/Width/Height properties 
> to return floating point values [2]. 
> 
> We tried two strategies for building a proof of concept, one of which 
> involved accumulating error when laying out with an applied zoom, and the 
> other was a wholesale swap of integers for floats in the layout engine. 
> Ultimately, we discovered that our hopes of the former being a less-invasive 
> solution were lost when the patch grew to the size of the more-invasive 
> latter, and we decided to focus our efforts there.
> 
> In the span of 10 days, we built a working prototype that passes over 90% of 
> our layout tests and renders most webpages correctly, including our original 
> zooming test cases. There are still numerous rounding errors, but tracking 
> these down and fixing them is beyond the scope of our proof of concept. We’ve 
> uploaded the resulting patch on the meta bug [1] tracking our work. It’s been 
> tested on the Mac and QT ports.
> 
> To make this transition as painless as possible (read: to avoid landing one 
> massive patch), we plan on first moving our current int values to an 
> abstraction that will begin as a typedef to int and its progeny IntRect, 
> IntPoint, and IntSize. We’ll also implement requisite rounding functionality 
> behind a USE(FLOAT_OFFSETS) [or other name, pending discussion] flag. These 
> steps are transitional only, and this abstraction and USE flag will both be 
> removed once we successfully make the jump from int->float.

While compact, the 32-bit float type has poor precision and doesn’t match some 
platforms’ graphics layers’ underlying floating-point type (such as CGFloat in 
64-bit OS X). As long as you are using a typedef, it might be better to make 
the render tree floating-point type easily configurable, so that different 
ports can use (or at least experiment with) different types.
_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to