Bug 531871 - Clipping problem with some flash [r=mfinkle]

This commit is contained in:
Benjamin Stover 2009-12-01 10:49:53 -08:00
parent a2147505fb
commit 13874dc49a

View File

@ -3045,8 +3045,7 @@ PluginObserver.prototype = {
}
},
/** More accurate version of finding the current visible region. */
// XXX should visible rect call take some of these things into account?
/** More accurate version of finding the current visible region. Returns client coords. */
getCriticalRect: function getCriticalRect() {
let bv = this._bv;
if (!bv.isRendering())
@ -3057,23 +3056,30 @@ PluginObserver.prototype = {
let vs = bv._browserViewportState;
let vr = bv.getVisibleRect();
let crit = BrowserView.Util.visibleRectToCriticalRect(vr, vs);
crit = Browser.browserViewToClientRect(crit);
if (BrowserUI.isToolbarLocked()) {
let urlbar = document.getElementById("toolbar-moveable-container");
let height = urlbar.getBoundingClientRect().height;
crit.top += height;
let urlbar = document.getElementById("toolbar-container");
let urlbarRect = urlbar.getBoundingClientRect();
// Subtract urlbar area from critical rect area. In general subtracting a rect from another
// results in a region that can be described by a union of rects. Luckily in this case,
// we can cheat because the resulting area is still just one rect.
crit.top = Math.max(urlbarRect.height, crit.top);
}
return crit;
},
/** Tell embedded objects where to absolutely render, using crit for clipping. */
/**
* Tell embedded objects where to absolutely render, using crit for clipping.
* @param crit Specified in client coordinates
*/
updateEmbedRegions: function updateEmbedRegions(objects, crit) {
let bv = this._bv;
let oprivate, r, dest, clip;
for (let i = objects.length - 1; i >= 0; i--) {
r = bv.browserToViewportRect(Browser.getBoundingContentRect(objects[i]));
dest = Browser.browserViewToClientRect(r);
clip = Browser.browserViewToClientRect(r.intersect(crit)).translate(-dest.left, -dest.top);
clip = dest.intersect(crit).translate(-dest.left, -dest.top);
oprivate = objects[i].QueryInterface(nsIObjectLoadingContent);
oprivate.setAbsoluteScreenPosition(Browser.contentScrollbox, dest, clip);
}