Bug 546071. Compute view-to-widget offset for plugin views. r=mats

--HG--
extra : rebase_source : 483afc3b0d00f5fd6685f760b6ad358a94a7c9ba
This commit is contained in:
Robert O'Callahan 2010-02-24 00:33:41 -08:00
parent f00539aaf8
commit 4600eb89a8
7 changed files with 33 additions and 10 deletions

View file

@ -1205,6 +1205,11 @@ nsObjectFrame::ComputeWidgetGeometry(const nsRegion& aRegion,
nsRect bounds = GetContentRect() + GetParent()->GetOffsetTo(rootFrame);
configuration->mBounds = bounds.ToNearestPixels(appUnitsPerDevPixel);
// This should produce basically the same rectangle (but not relative
// to the root frame). We only call this here for the side-effect of
// setting mViewToWidgetOffset on the view.
mInnerView->CalcWidgetBounds(eWindowType_plugin);
nsRegionRectIterator iter(aRegion);
nsIntPoint pluginOrigin = aPluginOrigin.ToNearestPixels(appUnitsPerDevPixel);
for (const nsRect* r = iter.Next(); r; r = iter.Next()) {

View file

@ -0,0 +1,8 @@
<!DOCTYPE HTML>
<html>
<body>
<div style="width:200px; border:2px solid black; overflow:hidden;">
<embed style="padding-left:1px;" type="application/x-test"></embed>
</div>
</body>
</html>

View file

@ -0,0 +1,8 @@
<!DOCTYPE HTML>
<html>
<body>
<div style="width:200px; border:2px solid black; overflow:hidden;">
<embed style="padding-left:0.5px;" type="application/x-test"></embed>
</div>
</body>
</html>

View file

@ -1403,3 +1403,4 @@ fails HTTP(..) == 518172-2b.html 518172-b-ref.html # bug 518172
== 541382-1.html 541382-1-ref.html
== 541406-1.html 541406-1-ref.html
== 546033-1.html 546033-1-ref.html
== 546071-1.html 546071-1-ref.html

View file

@ -63,8 +63,8 @@ enum nsViewVisibility {
// IID for the nsIView interface
#define NS_IVIEW_IID \
{ 0x4435167c, 0xb627, 0x4073, \
{ 0x9c, 0x92, 0xbc, 0x34, 0x39, 0xd9, 0xf8, 0xd2 } }
{ 0xe981334b, 0x756e, 0x417a, \
{ 0xbf, 0x18, 0x47, 0x4a, 0x2d, 0xfe, 0xc3, 0x87 } }
// Public view flags are defined in this file
#define NS_VIEW_FLAGS_PUBLIC 0x00FF
@ -334,6 +334,11 @@ public:
virtual PRBool ExternalIsRoot() const;
void SetDeletionObserver(nsWeakView* aDeletionObserver);
nsIntRect CalcWidgetBounds(nsWindowType aType);
PRBool IsEffectivelyVisible();
protected:
friend class nsWeakView;
nsViewManager *mViewManager;
@ -346,6 +351,7 @@ protected:
nsViewVisibility mVis;
nscoord mPosX, mPosY;
nsRect mDimBounds; // relative to parent
nsPoint mViewToWidgetOffset;
float mOpacity;
PRUint32 mVFlags;
nsWeakView* mDeletionObserver;

View file

@ -328,16 +328,16 @@ void nsView::ResetWidgetBounds(PRBool aRecurse, PRBool aMoveOnly,
}
}
PRBool nsView::IsEffectivelyVisible()
PRBool nsIView::IsEffectivelyVisible()
{
for (nsView* v = this; v; v = v->mParent) {
for (nsIView* v = this; v; v = v->mParent) {
if (v->GetVisibility() == nsViewVisibility_kHide)
return PR_FALSE;
}
return PR_TRUE;
}
nsIntRect nsView::CalcWidgetBounds(nsWindowType aType)
nsIntRect nsIView::CalcWidgetBounds(nsWindowType aType)
{
nsCOMPtr<nsIDeviceContext> dx;
mViewManager->GetDeviceContext(*getter_AddRefs(dx));

View file

@ -195,17 +195,12 @@ public:
return mViewToWidgetOffset;
}
nsIntRect CalcWidgetBounds(nsWindowType aType);
PRBool IsEffectivelyVisible();
protected:
// Do the actual work of ResetWidgetBounds, unconditionally. Don't
// call this method if we have no widget.
void DoResetWidgetBounds(PRBool aMoveOnly, PRBool aInvalidateChangedSize);
nsRegion* mDirtyRegion;
nsPoint mViewToWidgetOffset;
};
#endif