Bug 339548. Part 10.5: Eagerly fix up Mac plugin clip rect to be consistent with other platforms.

This commit is contained in:
Robert O'Callahan 2009-07-22 12:45:02 +12:00
Родитель 7a00ba7269
Коммит 598587160e
4 изменённых файлов: 38 добавлений и 4 удалений

Просмотреть файл

@ -2329,4 +2329,19 @@ nsRootPresContext::UpdatePluginGeometry(nsIFrame* aChangedSubtree)
nsIWidget* widget = configurations[0].mChild->GetParent();
NS_ASSERTION(widget, "Plugin must have a parent");
widget->ConfigureChildren(configurations);
DidApplyPluginGeometryUpdates();
}
static PLDHashOperator
PluginDidSetGeometryEnumerator(nsPtrHashKey<nsObjectFrame>* aEntry, void* userArg)
{
nsObjectFrame* f = aEntry->GetKey();
f->DidSetWidgetGeometry();
return PL_DHASH_NEXT;
}
void
nsRootPresContext::DidApplyPluginGeometryUpdates()
{
mRegisteredPlugins.EnumerateEntries(PluginDidSetGeometryEnumerator, nsnull);
}

Просмотреть файл

@ -1102,6 +1102,13 @@ public:
void GetPluginGeometryUpdates(nsIFrame* aChangedRoot,
nsTArray<nsIWidget::Configuration>* aConfigurations);
/**
* When all geometry updates have been applied, call this function
* in case the nsObjectFrames have work to do after the widgets
* have been updated.
*/
void DidApplyPluginGeometryUpdates();
private:
nsTHashtable<nsPtrHashKey<nsObjectFrame> > mRegisteredPlugins;
};

Просмотреть файл

@ -529,10 +529,10 @@ private:
};
// Mac specific code to fix up port position and clip during paint
// Mac specific code to fix up port position and clip
#ifdef XP_MACOSX
enum { ePluginPaintIgnore, ePluginPaintEnable, ePluginPaintDisable };
enum { ePluginPaintEnable, ePluginPaintDisable };
#endif // XP_MACOSX
@ -1184,6 +1184,16 @@ nsObjectFrame::ComputeWidgetGeometry(const nsRegion& aRegion,
}
}
void
nsObjectFrame::DidSetWidgetGeometry()
{
#if defined(XP_MACOSX)
if (mInstanceOwner) {
mInstanceOwner->FixUpPluginWindow(ePluginPaintEnable);
}
#endif
}
PRBool
nsObjectFrame::IsOpaque() const
{
@ -4094,7 +4104,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
}
PRBool eventHandled = PR_FALSE;
WindowRef window = FixUpPluginWindow(ePluginPaintIgnore);
WindowRef window = FixUpPluginWindow(ePluginPaintEnable);
if (window) {
nsPluginEvent pluginEvent = { (EventRecord*)event, nsPluginPlatformWindowRef(window) };
mInstance->HandleEvent(&pluginEvent, &eventHandled);
@ -4787,7 +4797,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::Notify(nsITimer* /* timer */)
if (mInstance) {
nsCOMPtr<nsIPluginWidget> pluginWidget = do_QueryInterface(mWidget);
if (pluginWidget && NS_SUCCEEDED(pluginWidget->StartDrawPlugin())) {
WindowRef window = FixUpPluginWindow(ePluginPaintIgnore);
WindowRef window = FixUpPluginWindow(ePluginPaintEnable);
if (window) {
EventRecord idleEvent;
InitializeEventRecord(&idleEvent);

Просмотреть файл

@ -138,6 +138,8 @@ public:
ComputeWidgetGeometry(nsRegion(), nsPoint(0,0), aConfigurations);
}
void DidSetWidgetGeometry();
// accessibility support
#ifdef ACCESSIBILITY
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);