[Webkit-unassigned] [Bug 108311] [chromium] Add convenience functions for geometry query

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jan 30 14:01:26 PST 2013


https://bugs.webkit.org/show_bug.cgi?id=108311





--- Comment #5 from Tien-Ren Chen <trchen at chromium.org>  2013-01-30 14:03:26 PST ---
(In reply to comment #4)
> (From update of attachment 185435 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=185435&action=review
> 
> > Source/WebKit/chromium/public/WebFrame.h:172
> > +    // Returns the visible content rect (minus scrollbars, in absolute coordinate)
> 
> blank line before new functions
> 
> how does this interact with contentsSize() + scrollOffset() ?

Nothing to do with contentsSize. It is the current visible area of the frame, in absolute coordinate. In current implementation it would be the same value as IntRect(scrollOffset, ceil(webView()->size() / pageScaleFactor))

> > Source/WebKit/chromium/src/WebViewImpl.cpp:4378
> > +    physicalWindowRect.scale(deviceScaleFactor() * pageScaleFactor());
> 
> I don't understand this function. device and page scale factors are exposed through the WebKit API, why do we need another WebKit API entry point just to multiply them together?

Because it is much less error-prone and easier to understand this way. Saying "foo = bar * deviceScaleFactor * pageScaleFactor;" can be understood by the compiler, but doesn't really translate well to English. While saying "foo = WebViewImpl->physicalWindowFromClient(bar);" even your grandmother can understand what are you trying to do here.

Consider the more complex case, what if we need to convert between absolute and client coordinates? Inner and outer viewport coordinates? Should we add or substract the offset? Translate before scale or after? Doing this all the times kills lots of brain cells.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list