Bug 1224403 (part 1) - Make Configuration::mBounds a LayoutDeviceIntRect. r=kats.
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -508,17 +508,17 @@ ShadowLayerForwarder::StorePluginWidgetC
{
// Cache new plugin widget configs here until we call update, at which
// point this data will get shipped over to chrome.
mPluginWindowData.Clear();
for (uint32_t idx = 0; idx < aConfigurations.Length(); idx++) {
const nsIWidget::Configuration& configuration = aConfigurations[idx];
mPluginWindowData.AppendElement(PluginWindowData(configuration.mWindowID,
configuration.mClipRegion,
- configuration.mBounds,
+ configuration.mBounds.ToUnknownRect(),
configuration.mVisible));
}
}
bool
ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies,
const nsIntRegion& aRegionToClear,
uint64_t aId,
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -3127,17 +3127,17 @@ SortConfigurations(nsTArray<nsIWidget::C
for (uint32_t j = 0; j < pluginsToMove.Length(); ++j) {
if (i == j)
continue;
nsIntRect bounds;
pluginsToMove[j].mChild->GetBoundsUntyped(bounds);
nsAutoTArray<nsIntRect,1> clipRects;
pluginsToMove[j].mChild->GetWindowClipRegion(&clipRects);
if (HasOverlap(bounds.TopLeft(), clipRects,
- config->mBounds.TopLeft(),
+ config->mBounds.ToUnknownRect().TopLeft(),
config->mClipRegion)) {
foundOverlap = true;
break;
}
}
if (!foundOverlap)
break;
}
--- a/layout/generic/nsPluginFrame.cpp
+++ b/layout/generic/nsPluginFrame.cpp
@@ -403,17 +403,18 @@ nsPluginFrame::GetWidgetConfiguration(ns
// geometry updates and this should not be called. But apparently we
// have bugs where mWidget sometimes is toplevel here. Bail out.
NS_ERROR("Plugin widgets registered for geometry updates should not be toplevel");
return;
}
nsIWidget::Configuration* configuration = aConfigurations->AppendElement();
configuration->mChild = mWidget;
- configuration->mBounds = mNextConfigurationBounds;
+ configuration->mBounds =
+ LayoutDeviceIntRect::FromUnknownRect(mNextConfigurationBounds);
configuration->mClipRegion = mNextConfigurationClipRegion;
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
if (XRE_IsContentProcess()) {
configuration->mWindowID = (uintptr_t)mWidget->GetNativeData(NS_NATIVE_PLUGIN_PORT);
configuration->mVisible = mWidget->IsVisible();
}
#endif // defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
}
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -235,18 +235,18 @@ nsresult
PuppetWidget::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
{
for (uint32_t i = 0; i < aConfigurations.Length(); ++i) {
const Configuration& configuration = aConfigurations[i];
PuppetWidget* w = static_cast<PuppetWidget*>(configuration.mChild.get());
NS_ASSERTION(w->GetParent() == this,
"Configured widget is not a child");
w->SetWindowClipRegion(configuration.mClipRegion, true);
- nsIntRect bounds;
- w->GetBoundsUntyped(bounds);
+ LayoutDeviceIntRect bounds;
+ w->GetBounds(bounds);
if (bounds.Size() != configuration.mBounds.Size()) {
w->Resize(configuration.mBounds.x, configuration.mBounds.y,
configuration.mBounds.width, configuration.mBounds.height,
true);
} else if (bounds.TopLeft() != configuration.mBounds.TopLeft()) {
w->Move(configuration.mBounds.x, configuration.mBounds.y);
}
w->SetWindowClipRegion(configuration.mClipRegion, false);
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -4295,24 +4295,26 @@ nsWindow::ConfigureChildren(const nsTArr
return NS_OK;
}
for (uint32_t i = 0; i < aConfigurations.Length(); ++i) {
const Configuration& configuration = aConfigurations[i];
nsWindow* w = static_cast<nsWindow*>(configuration.mChild.get());
NS_ASSERTION(w->GetParent() == this,
"Configured widget is not a child");
+ LayoutDeviceIntRect wBounds =
+ LayoutDeviceIntRect::FromUnknownRect(w->mBounds);
w->SetWindowClipRegion(configuration.mClipRegion, true);
- if (w->mBounds.Size() != configuration.mBounds.Size()) {
+ if (wBounds.Size() != configuration.mBounds.Size()) {
w->Resize(configuration.mBounds.x, configuration.mBounds.y,
configuration.mBounds.width, configuration.mBounds.height,
true);
- } else if (w->mBounds.TopLeft() != configuration.mBounds.TopLeft()) {
+ } else if (wBounds.TopLeft() != configuration.mBounds.TopLeft()) {
w->Move(configuration.mBounds.x, configuration.mBounds.y);
- }
+ }
w->SetWindowClipRegion(configuration.mClipRegion, false);
}
return NS_OK;
}
nsresult
nsWindow::SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
bool aIntersectWithExisting)
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -1003,17 +1003,17 @@ class nsIWidget : public nsISupports {
/**
* This represents a command to set the bounds and clip region of
* a child widget.
*/
struct Configuration {
nsCOMPtr<nsIWidget> mChild;
uintptr_t mWindowID; // e10s specific, the unique plugin port id
bool mVisible; // e10s specific, widget visibility
- nsIntRect mBounds;
+ mozilla::LayoutDeviceIntRect mBounds;
nsTArray<nsIntRect> mClipRegion;
};
/**
* Sets the clip region of each mChild (which must actually be a child
* of this widget) to the union of the pixel rects given in
* mClipRegion, all relative to the top-left of the child
* widget. Clip regions are not implemented on all platforms and only
--- a/widget/qt/nsWindow.cpp
+++ b/widget/qt/nsWindow.cpp
@@ -596,21 +596,23 @@ nsWindow::ConfigureChildren(const nsTArr
{
for (uint32_t i = 0; i < aConfigurations.Length(); ++i) {
const Configuration& configuration = aConfigurations[i];
nsWindow* w = static_cast<nsWindow*>(configuration.mChild);
NS_ASSERTION(w->GetParent() == this,
"Configured widget is not a child");
- if (w->mBounds.Size() != configuration.mBounds.Size()) {
+ LayoutDeviceIntRect wBounds =
+ LayoutDeviceIntRect::FromUnknownRect(w->mBounds);
+ if (wBounds.Size() != configuration.mBounds.Size()) {
w->Resize(configuration.mBounds.x, configuration.mBounds.y,
configuration.mBounds.width, configuration.mBounds.height,
true);
- } else if (w->mBounds.TopLeft() != configuration.mBounds.TopLeft()) {
+ } else if (wBounds.TopLeft() != configuration.mBounds.TopLeft()) {
w->Move(configuration.mBounds.x, configuration.mBounds.y);
}
}
return NS_OK;
}
NS_IMETHODIMP
nsWindow::Invalidate(const nsIntRect &aRect)
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -6525,34 +6525,34 @@ nsWindow::ConfigureChildren(const nsTArr
// need.
for (uint32_t i = 0; i < aConfigurations.Length(); ++i) {
const Configuration& configuration = aConfigurations[i];
nsWindow* w = static_cast<nsWindow*>(configuration.mChild.get());
NS_ASSERTION(w->GetParent() == this,
"Configured widget is not a child");
nsresult rv = w->SetWindowClipRegion(configuration.mClipRegion, true);
NS_ENSURE_SUCCESS(rv, rv);
- nsIntRect bounds;
- w->GetBoundsUntyped(bounds);
+ LayoutDeviceIntRect bounds;
+ w->GetBounds(bounds);
if (bounds.Size() != configuration.mBounds.Size()) {
w->Resize(configuration.mBounds.x, configuration.mBounds.y,
configuration.mBounds.width, configuration.mBounds.height,
true);
} else if (bounds.TopLeft() != configuration.mBounds.TopLeft()) {
w->Move(configuration.mBounds.x, configuration.mBounds.y);
if (gfxWindowsPlatform::GetPlatform()->GetRenderMode() ==
gfxWindowsPlatform::RENDER_DIRECT2D ||
GetLayerManager()->GetBackendType() != LayersBackend::LAYERS_BASIC) {
// XXX - Workaround for Bug 587508. This will invalidate the part of the
// plugin window that might be touched by moving content somehow. The
// underlying problem should be found and fixed!
nsIntRegion r;
- r.Sub(bounds, configuration.mBounds);
+ r.Sub(bounds.ToUnknownRect(), configuration.mBounds.ToUnknownRect());
r.MoveBy(-bounds.x,
-bounds.y);
nsIntRect toInvalidate = r.GetBounds();
WinUtils::InvalidatePluginAsWorkaround(w, toInvalidate);
}
}
rv = w->SetWindowClipRegion(configuration.mClipRegion, false);