Window-relative coordinates in NPWindow

Simon Fraser simon.fraser at apple.com
Sun Feb 20 21:50:37 PST 2011


It's problematic that browsers have to supply plug-ins with an x,y coordinate for their top-left corner, and a port (i.e. window)-relative clipRect. For example, if the plug-in, or some ancestor element has a CSS transform applied to it, the plug-in may not even be axis-aligned, or may be scaled such that its visible area on the page is larger or smaller than the height/width in NPWindow.

For basic painting and hit-testing, there should be no need for plug-ins to know where they are on the page. The browser should send them events and a clipRect in local coordinates, and simply paint them into the current graphics context, which already has a transform applied.

For plug-ins which need to know where they are in the window or on the screen, NPN_ConvertPoint can be used to map points to and from the plug-ins local coordinate system.

To this end I'd like to see NPWindow and NPP_SetWindow deprecated, or changed to not make use of window-relative coordinates. We may have to invent a new replacement to NPP_SetWindow to inform the plugin that its visible area (the clip rect) has has changed. Does the plug-in need to be informed when its window-relative position changes?

Simon



More information about the plugin-futures mailing list