mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1229665 - Convert widget clip regions to LayoutDevicePixels. r=botond.
This commit is contained in:
parent
3add85f0a5
commit
ca0f34e019
@ -3037,7 +3037,7 @@ void nsPluginInstanceOwner::FixUpPluginWindow(int32_t inPaintState)
|
||||
|
||||
SetPluginPort();
|
||||
|
||||
nsIntSize widgetClip = mPluginFrame->GetWidgetlessClipRect().Size();
|
||||
LayoutDeviceIntSize widgetClip = mPluginFrame->GetWidgetlessClipRect().Size();
|
||||
|
||||
mPluginWindow->x = 0;
|
||||
mPluginWindow->y = 0;
|
||||
|
@ -206,26 +206,26 @@ CompositorChild::RecvInvalidateAll()
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
static void CalculatePluginClip(const gfx::IntRect& aBounds,
|
||||
const nsTArray<gfx::IntRect>& aPluginClipRects,
|
||||
const nsIntPoint& aContentOffset,
|
||||
const nsIntRegion& aParentLayerVisibleRegion,
|
||||
nsTArray<gfx::IntRect>& aResult,
|
||||
static void CalculatePluginClip(const LayoutDeviceIntRect& aBounds,
|
||||
const nsTArray<LayoutDeviceIntRect>& aPluginClipRects,
|
||||
const LayoutDeviceIntPoint& aContentOffset,
|
||||
const LayoutDeviceIntRegion& aParentLayerVisibleRegion,
|
||||
nsTArray<LayoutDeviceIntRect>& aResult,
|
||||
LayoutDeviceIntRect& aVisibleBounds,
|
||||
bool& aPluginIsVisible)
|
||||
{
|
||||
aPluginIsVisible = true;
|
||||
nsIntRegion contentVisibleRegion;
|
||||
LayoutDeviceIntRegion contentVisibleRegion;
|
||||
// aPluginClipRects (plugin widget origin) - contains *visible* rects
|
||||
for (uint32_t idx = 0; idx < aPluginClipRects.Length(); idx++) {
|
||||
gfx::IntRect rect = aPluginClipRects[idx];
|
||||
LayoutDeviceIntRect rect = aPluginClipRects[idx];
|
||||
// shift to content origin
|
||||
rect.MoveBy(aBounds.x, aBounds.y);
|
||||
// accumulate visible rects
|
||||
contentVisibleRegion.OrWith(rect);
|
||||
}
|
||||
// apply layers clip (window origin)
|
||||
nsIntRegion region = aParentLayerVisibleRegion;
|
||||
LayoutDeviceIntRegion region = aParentLayerVisibleRegion;
|
||||
region.MoveBy(-aContentOffset.x, -aContentOffset.y);
|
||||
contentVisibleRegion.AndWith(region);
|
||||
if (contentVisibleRegion.IsEmpty()) {
|
||||
@ -234,18 +234,17 @@ static void CalculatePluginClip(const gfx::IntRect& aBounds,
|
||||
}
|
||||
// shift to plugin widget origin
|
||||
contentVisibleRegion.MoveBy(-aBounds.x, -aBounds.y);
|
||||
nsIntRegionRectIterator iter(contentVisibleRegion);
|
||||
for (const gfx::IntRect* rgnRect = iter.Next(); rgnRect; rgnRect = iter.Next()) {
|
||||
LayoutDeviceIntRegion::RectIterator iter(contentVisibleRegion);
|
||||
for (const LayoutDeviceIntRect* rgnRect = iter.Next(); rgnRect; rgnRect = iter.Next()) {
|
||||
aResult.AppendElement(*rgnRect);
|
||||
aVisibleBounds.UnionRect(aVisibleBounds,
|
||||
LayoutDeviceIntRect::FromUnknownRect(*rgnRect));
|
||||
aVisibleBounds.UnionRect(aVisibleBounds, *rgnRect);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
CompositorChild::RecvUpdatePluginConfigurations(const nsIntPoint& aContentOffset,
|
||||
const nsIntRegion& aParentLayerVisibleRegion,
|
||||
CompositorChild::RecvUpdatePluginConfigurations(const LayoutDeviceIntPoint& aContentOffset,
|
||||
const LayoutDeviceIntRegion& aParentLayerVisibleRegion,
|
||||
nsTArray<PluginWindowData>&& aPlugins)
|
||||
{
|
||||
#if !defined(XP_WIN) && !defined(MOZ_WIDGET_GTK)
|
||||
@ -274,7 +273,7 @@ CompositorChild::RecvUpdatePluginConfigurations(const nsIntPoint& aContentOffset
|
||||
}
|
||||
bool isVisible = aPlugins[pluginsIdx].visible();
|
||||
if (widget && !widget->Destroyed()) {
|
||||
gfx::IntRect bounds;
|
||||
LayoutDeviceIntRect bounds;
|
||||
LayoutDeviceIntRect visibleBounds;
|
||||
// If the plugin is visible update it's geometry.
|
||||
if (isVisible) {
|
||||
@ -286,10 +285,11 @@ CompositorChild::RecvUpdatePluginConfigurations(const nsIntPoint& aContentOffset
|
||||
aContentOffset.y + bounds.y,
|
||||
bounds.width, bounds.height, false);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "widget call failure");
|
||||
nsTArray<gfx::IntRect> rectsOut;
|
||||
nsTArray<LayoutDeviceIntRect> rectsOut;
|
||||
// This call may change the value of isVisible
|
||||
CalculatePluginClip(bounds, aPlugins[pluginsIdx].clip(),
|
||||
aContentOffset, aParentLayerVisibleRegion,
|
||||
aContentOffset,
|
||||
aParentLayerVisibleRegion,
|
||||
rectsOut, visibleBounds, isVisible);
|
||||
// content clipping region (widget origin)
|
||||
rv = widget->SetWindowClipRegion(rectsOut, false);
|
||||
|
@ -85,8 +85,8 @@ public:
|
||||
RecvOverfill(const uint32_t &aOverfill) override;
|
||||
|
||||
virtual bool
|
||||
RecvUpdatePluginConfigurations(const nsIntPoint& aContentOffset,
|
||||
const nsIntRegion& aVisibleRegion,
|
||||
RecvUpdatePluginConfigurations(const LayoutDeviceIntPoint& aContentOffset,
|
||||
const LayoutDeviceIntRegion& aVisibleRegion,
|
||||
nsTArray<PluginWindowData>&& aPlugins) override;
|
||||
|
||||
virtual bool
|
||||
|
@ -2147,9 +2147,10 @@ CompositorParent::UpdatePluginWindowState(uint64_t aId)
|
||||
}
|
||||
mPluginsLayerOffset = offset;
|
||||
mPluginsLayerVisibleRegion = visibleRegion;
|
||||
Unused <<
|
||||
lts.mParent->SendUpdatePluginConfigurations(offset, visibleRegion,
|
||||
lts.mPluginData);
|
||||
Unused << lts.mParent->SendUpdatePluginConfigurations(
|
||||
LayoutDeviceIntPoint::FromUnknownPoint(offset),
|
||||
LayoutDeviceIntRegion::FromUnknownRegion(visibleRegion),
|
||||
lts.mPluginData);
|
||||
lts.mUpdatedPluginDataAvailable = false;
|
||||
PLUGINS_LOG("[%" PRIu64 "] updated", aId);
|
||||
} else {
|
||||
|
@ -36,6 +36,7 @@ using mozilla::LayerPoint from "Units.h";
|
||||
using mozilla::LayerRect from "Units.h";
|
||||
using mozilla::LayerIntRegion from "Units.h";
|
||||
using mozilla::ParentLayerIntRect from "Units.h";
|
||||
using mozilla::LayoutDeviceIntRect from "Units.h";
|
||||
using mozilla::layers::ScaleMode from "mozilla/layers/LayersTypes.h";
|
||||
using mozilla::layers::EventRegions from "mozilla/layers/LayersTypes.h";
|
||||
using mozilla::layers::EventRegionsOverride from "mozilla/layers/LayersTypes.h";
|
||||
@ -280,8 +281,8 @@ struct LayerAttributes {
|
||||
// See nsIWidget Configurations
|
||||
struct PluginWindowData {
|
||||
uintptr_t windowId;
|
||||
IntRect[] clip;
|
||||
IntRect bounds;
|
||||
LayoutDeviceIntRect[] clip;
|
||||
LayoutDeviceIntRect bounds;
|
||||
bool visible;
|
||||
};
|
||||
|
||||
|
@ -19,6 +19,8 @@ using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
|
||||
using mozilla::layers::LayersBackend from "mozilla/layers/LayersTypes.h";
|
||||
using mozilla::CrossProcessMutexHandle from "mozilla/ipc/CrossProcessMutex.h";
|
||||
using mozilla::ipc::SharedMemoryBasic::Handle from "mozilla/ipc/SharedMemoryBasic.h";
|
||||
using mozilla::LayoutDeviceIntPoint from "Units.h";
|
||||
using mozilla::LayoutDeviceIntRegion from "Units.h";
|
||||
using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
|
||||
using class mozilla::layers::FrameUniformityData from "mozilla/layers/FrameUniformityData.h";
|
||||
|
||||
@ -65,8 +67,8 @@ child:
|
||||
* application on the widgets. Used on Windows and Linux in managing
|
||||
* plugin widgets.
|
||||
*/
|
||||
async UpdatePluginConfigurations(IntPoint aContentOffset,
|
||||
nsIntRegion aVisibleRegion,
|
||||
async UpdatePluginConfigurations(LayoutDeviceIntPoint aContentOffset,
|
||||
LayoutDeviceIntRegion aVisibleRegion,
|
||||
PluginWindowData[] aPlugins);
|
||||
|
||||
/**
|
||||
|
@ -481,7 +481,7 @@ ShadowLayerForwarder::StorePluginWidgetConfigurations(const nsTArray<nsIWidget::
|
||||
const nsIWidget::Configuration& configuration = aConfigurations[idx];
|
||||
mPluginWindowData.AppendElement(PluginWindowData(configuration.mWindowID,
|
||||
configuration.mClipRegion,
|
||||
configuration.mBounds.ToUnknownRect(),
|
||||
configuration.mBounds,
|
||||
configuration.mVisible));
|
||||
}
|
||||
}
|
||||
|
@ -3099,11 +3099,11 @@ nsRootPresContext::CancelApplyPluginGeometryTimer()
|
||||
|
||||
static bool
|
||||
HasOverlap(const LayoutDeviceIntPoint& aOffset1,
|
||||
const nsTArray<nsIntRect>& aClipRects1,
|
||||
const nsTArray<LayoutDeviceIntRect>& aClipRects1,
|
||||
const LayoutDeviceIntPoint& aOffset2,
|
||||
const nsTArray<nsIntRect>& aClipRects2)
|
||||
const nsTArray<LayoutDeviceIntRect>& aClipRects2)
|
||||
{
|
||||
nsIntPoint offsetDelta = (aOffset1 - aOffset2).ToUnknownPoint();
|
||||
LayoutDeviceIntPoint offsetDelta = aOffset1 - aOffset2;
|
||||
for (uint32_t i = 0; i < aClipRects1.Length(); ++i) {
|
||||
for (uint32_t j = 0; j < aClipRects2.Length(); ++j) {
|
||||
if ((aClipRects1[i] + offsetDelta).Intersects(aClipRects2[j])) {
|
||||
@ -3149,7 +3149,7 @@ SortConfigurations(nsTArray<nsIWidget::Configuration>* aConfigurations)
|
||||
continue;
|
||||
LayoutDeviceIntRect bounds;
|
||||
pluginsToMove[j].mChild->GetBounds(bounds);
|
||||
nsAutoTArray<nsIntRect,1> clipRects;
|
||||
nsAutoTArray<LayoutDeviceIntRect,1> clipRects;
|
||||
pluginsToMove[j].mChild->GetWindowClipRegion(&clipRects);
|
||||
if (HasOverlap(bounds.TopLeft(), clipRects,
|
||||
config->mBounds.TopLeft(),
|
||||
|
@ -412,8 +412,7 @@ nsPluginFrame::GetWidgetConfiguration(nsTArray<nsIWidget::Configuration>* aConfi
|
||||
|
||||
nsIWidget::Configuration* configuration = aConfigurations->AppendElement();
|
||||
configuration->mChild = mWidget;
|
||||
configuration->mBounds =
|
||||
LayoutDeviceIntRect::FromUnknownRect(mNextConfigurationBounds);
|
||||
configuration->mBounds = mNextConfigurationBounds;
|
||||
configuration->mClipRegion = mNextConfigurationClipRegion;
|
||||
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
|
||||
if (XRE_IsContentProcess()) {
|
||||
@ -1016,7 +1015,8 @@ nsDisplayPlugin::ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
||||
f->GetContentRectRelativeToSelf(), ReferenceFrame());
|
||||
nscoord appUnitsPerDevPixel =
|
||||
ReferenceFrame()->PresContext()->AppUnitsPerDevPixel();
|
||||
f->mNextConfigurationBounds = rAncestor.ToNearestPixels(appUnitsPerDevPixel);
|
||||
f->mNextConfigurationBounds = LayoutDeviceIntRect::FromUnknownRect(
|
||||
rAncestor.ToNearestPixels(appUnitsPerDevPixel));
|
||||
|
||||
nsRegion visibleRegion;
|
||||
visibleRegion.And(*aVisibleRegion, GetClippedBounds(aBuilder));
|
||||
@ -1028,8 +1028,9 @@ nsDisplayPlugin::ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
||||
for (const nsRect* r = iter.Next(); r; r = iter.Next()) {
|
||||
nsRect rAncestor =
|
||||
nsLayoutUtils::TransformFrameRectToAncestor(f, *r, ReferenceFrame());
|
||||
nsIntRect rPixels = rAncestor.ToNearestPixels(appUnitsPerDevPixel)
|
||||
- f->mNextConfigurationBounds.TopLeft();
|
||||
LayoutDeviceIntRect rPixels =
|
||||
LayoutDeviceIntRect::FromUnknownRect(rAncestor.ToNearestPixels(appUnitsPerDevPixel)) -
|
||||
f->mNextConfigurationBounds.TopLeft();
|
||||
if (!rPixels.IsEmpty()) {
|
||||
f->mNextConfigurationClipRegion.AppendElement(rPixels);
|
||||
}
|
||||
|
@ -52,6 +52,9 @@ class nsPluginFrame : public nsPluginFrameSuper,
|
||||
{
|
||||
public:
|
||||
typedef mozilla::LayerState LayerState;
|
||||
typedef mozilla::LayoutDeviceIntPoint LayoutDeviceIntPoint;
|
||||
typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect;
|
||||
typedef mozilla::LayoutDeviceIntRegion LayoutDeviceIntRegion;
|
||||
typedef mozilla::layers::Layer Layer;
|
||||
typedef mozilla::layers::LayerManager LayerManager;
|
||||
typedef mozilla::layers::ImageContainer ImageContainer;
|
||||
@ -120,7 +123,7 @@ public:
|
||||
*/
|
||||
void SetEmptyWidgetConfiguration()
|
||||
{
|
||||
mNextConfigurationBounds = nsIntRect(0,0,0,0);
|
||||
mNextConfigurationBounds = LayoutDeviceIntRect(0,0,0,0);
|
||||
mNextConfigurationClipRegion.Clear();
|
||||
}
|
||||
/**
|
||||
@ -128,7 +131,7 @@ public:
|
||||
*/
|
||||
void GetWidgetConfiguration(nsTArray<nsIWidget::Configuration>* aConfigurations);
|
||||
|
||||
nsIntRect GetWidgetlessClipRect() {
|
||||
LayoutDeviceIntRect GetWidgetlessClipRect() {
|
||||
return RegionFromArray(mNextConfigurationClipRegion).GetBounds();
|
||||
}
|
||||
|
||||
@ -249,7 +252,7 @@ protected:
|
||||
* the origin of the chrome window. In non-e10s, this return 0,0.
|
||||
* This api sends a sync ipc request so be careful about use.
|
||||
*/
|
||||
mozilla::LayoutDeviceIntPoint GetRemoteTabChromeOffset();
|
||||
LayoutDeviceIntPoint GetRemoteTabChromeOffset();
|
||||
|
||||
static void PaintPrintPlugin(nsIFrame* aFrame,
|
||||
nsRenderingContext* aRenderingContext,
|
||||
@ -277,9 +280,10 @@ private:
|
||||
// stored in mRootPresContextRegisteredWith.
|
||||
void UnregisterPluginForGeometryUpdates();
|
||||
|
||||
static const nsIntRegion RegionFromArray(const nsTArray<nsIntRect>& aRects)
|
||||
static const LayoutDeviceIntRegion
|
||||
RegionFromArray(const nsTArray<LayoutDeviceIntRect>& aRects)
|
||||
{
|
||||
nsIntRegion region;
|
||||
LayoutDeviceIntRegion region;
|
||||
for (uint32_t i = 0; i < aRects.Length(); ++i) {
|
||||
region.Or(region, aRects[i]);
|
||||
}
|
||||
@ -311,12 +315,12 @@ private:
|
||||
* for plugins with widgets. For plugins without widgets, bounds in device
|
||||
* pixels relative to the nearest frame that's a display list reference frame.
|
||||
*/
|
||||
nsIntRect mNextConfigurationBounds;
|
||||
LayoutDeviceIntRect mNextConfigurationBounds;
|
||||
/**
|
||||
* Clip region that we should set the plugin's widget to
|
||||
* in the next composite. Only meaningful for plugins with widgets.
|
||||
*/
|
||||
nsTArray<nsIntRect> mNextConfigurationClipRegion;
|
||||
nsTArray<LayoutDeviceIntRect> mNextConfigurationClipRegion;
|
||||
|
||||
bool mReflowCallbackPosted;
|
||||
|
||||
|
@ -588,11 +588,11 @@ nsViewManager::InvalidateWidgetArea(nsView *aWidgetView,
|
||||
LayoutDeviceIntRect bounds;
|
||||
childWidget->GetBounds(bounds);
|
||||
|
||||
nsTArray<nsIntRect> clipRects;
|
||||
nsTArray<LayoutDeviceIntRect> clipRects;
|
||||
childWidget->GetWindowClipRegion(&clipRects);
|
||||
for (uint32_t i = 0; i < clipRects.Length(); ++i) {
|
||||
nsRect rr = ToAppUnits(clipRects[i] + bounds.TopLeft().ToUnknownPoint(),
|
||||
AppUnitsPerDevPixel());
|
||||
nsRect rr = LayoutDeviceIntRect::ToAppUnits(
|
||||
clipRects[i] + bounds.TopLeft(), AppUnitsPerDevPixel());
|
||||
children.Or(children, rr - aWidgetView->ViewToWidgetOffset());
|
||||
children.SimplifyInward(20);
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ PluginWidgetProxy::Destroy()
|
||||
}
|
||||
|
||||
void
|
||||
PluginWidgetProxy::GetWindowClipRegion(nsTArray<nsIntRect>* aRects)
|
||||
PluginWidgetProxy::GetWindowClipRegion(nsTArray<LayoutDeviceIntRect>* aRects)
|
||||
{
|
||||
if (mClipRects && mClipRectCount) {
|
||||
aRects->AppendElements(mClipRects.get(), mClipRectCount);
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
#endif
|
||||
virtual nsTransparencyMode GetTransparencyMode() override
|
||||
{ return eTransparencyOpaque; }
|
||||
virtual void GetWindowClipRegion(nsTArray<nsIntRect>* aRects) override;
|
||||
virtual void GetWindowClipRegion(nsTArray<LayoutDeviceIntRect>* aRects) override;
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -2045,7 +2045,7 @@ gdk_window_flash(GdkWindow * aGdkWindow,
|
||||
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
static bool
|
||||
ExtractExposeRegion(nsIntRegion& aRegion, GdkEventExpose* aEvent)
|
||||
ExtractExposeRegion(LayoutDeviceIntRegion& aRegion, GdkEventExpose* aEvent)
|
||||
{
|
||||
GdkRectangle* rects;
|
||||
gint nrects;
|
||||
@ -2058,7 +2058,7 @@ ExtractExposeRegion(nsIntRegion& aRegion, GdkEventExpose* aEvent)
|
||||
}
|
||||
|
||||
for (GdkRectangle* r = rects; r < rects + nrects; r++) {
|
||||
aRegion.Or(aRegion, nsIntRect(r->x, r->y, r->width, r->height));
|
||||
aRegion.Or(aRegion, LayoutDeviceIntRect(r->x, r->y, r->width, r->height));
|
||||
LOGDRAW(("\t%d %d %d %d\n", r->x, r->y, r->width, r->height));
|
||||
}
|
||||
|
||||
@ -2071,7 +2071,7 @@ ExtractExposeRegion(nsIntRegion& aRegion, GdkEventExpose* aEvent)
|
||||
# error "Looks like we're including Mozilla's cairo instead of system cairo"
|
||||
# endif
|
||||
static bool
|
||||
ExtractExposeRegion(nsIntRegion& aRegion, cairo_t* cr)
|
||||
ExtractExposeRegion(LayoutDeviceIntRegion& aRegion, cairo_t* cr)
|
||||
{
|
||||
cairo_rectangle_list_t* rects = cairo_copy_clip_rectangle_list(cr);
|
||||
if (rects->status != CAIRO_STATUS_SUCCESS) {
|
||||
@ -2081,7 +2081,7 @@ ExtractExposeRegion(nsIntRegion& aRegion, cairo_t* cr)
|
||||
|
||||
for (int i = 0; i < rects->num_rectangles; i++) {
|
||||
const cairo_rectangle_t& r = rects->rectangles[i];
|
||||
aRegion.Or(aRegion, nsIntRect(r.x, r.y, r.width, r.height));
|
||||
aRegion.Or(aRegion, LayoutDeviceIntRect(r.x, r.y, r.width, r.height));
|
||||
LOGDRAW(("\t%d %d %d %d\n", r.x, r.y, r.width, r.height));
|
||||
}
|
||||
|
||||
@ -2115,7 +2115,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
|
||||
if (!listener)
|
||||
return FALSE;
|
||||
|
||||
nsIntRegion exposeRegion;
|
||||
LayoutDeviceIntRegion exposeRegion;
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
if (!ExtractExposeRegion(exposeRegion, aEvent)) {
|
||||
#else
|
||||
@ -2125,7 +2125,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
|
||||
}
|
||||
|
||||
gint scale = GdkScaleFactor();
|
||||
nsIntRegion region = exposeRegion;
|
||||
LayoutDeviceIntRegion region = exposeRegion;
|
||||
region.ScaleRoundOut(scale, scale);
|
||||
|
||||
ClientLayerManager *clientLayers =
|
||||
@ -2137,7 +2137,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
|
||||
// We need to paint to the screen even if nothing changed, since if we
|
||||
// don't have a compositing window manager, our pixels could be stale.
|
||||
clientLayers->SetNeedsComposite(true);
|
||||
clientLayers->SendInvalidRegion(region);
|
||||
clientLayers->SendInvalidRegion(region.ToUnknownRegion());
|
||||
}
|
||||
|
||||
// Dispatch WillPaintWindow notification to allow scripts etc. to run
|
||||
@ -2170,7 +2170,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
|
||||
// Our bounds may have changed after calling WillPaintWindow. Clip
|
||||
// to the new bounds here. The region is relative to this
|
||||
// window.
|
||||
region.And(region, nsIntRect(0, 0, mBounds.width, mBounds.height));
|
||||
region.And(region, LayoutDeviceIntRect(0, 0, mBounds.width, mBounds.height));
|
||||
|
||||
bool shaped = false;
|
||||
if (eTransparencyTransparent == GetTransparencyMode()) {
|
||||
@ -2194,13 +2194,12 @@ nsWindow::OnExposeEvent(cairo_t *cr)
|
||||
GdkWindow *gdkWin = GDK_WINDOW(children->data);
|
||||
nsWindow *kid = get_window_for_gdk_window(gdkWin);
|
||||
if (kid && gdk_window_is_visible(gdkWin)) {
|
||||
nsAutoTArray<nsIntRect,1> clipRects;
|
||||
nsAutoTArray<LayoutDeviceIntRect,1> clipRects;
|
||||
kid->GetWindowClipRegion(&clipRects);
|
||||
LayoutDeviceIntRect bounds;
|
||||
kid->GetBounds(bounds);
|
||||
for (uint32_t i = 0; i < clipRects.Length(); ++i) {
|
||||
nsIntRect r = clipRects[i] +
|
||||
bounds.TopLeft().ToUnknownPoint();
|
||||
LayoutDeviceIntRect r = clipRects[i] + bounds.TopLeft();
|
||||
region.Sub(region, r);
|
||||
}
|
||||
}
|
||||
@ -2214,13 +2213,13 @@ nsWindow::OnExposeEvent(cairo_t *cr)
|
||||
|
||||
// If this widget uses OMTC...
|
||||
if (GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
|
||||
listener->PaintWindow(this, region);
|
||||
listener->PaintWindow(this, region.ToUnknownRegion());
|
||||
listener->DidPaintWindow();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
RefPtr<DrawTarget> dt = GetDrawTarget(region);
|
||||
if(!dt) {
|
||||
RefPtr<DrawTarget> dt = GetDrawTarget(region.ToUnknownRegion());
|
||||
if (!dt) {
|
||||
return FALSE;
|
||||
}
|
||||
RefPtr<gfxContext> ctx;
|
||||
@ -2233,10 +2232,10 @@ nsWindow::OnExposeEvent(cairo_t *cr)
|
||||
// call UpdateTranslucentWindowAlpha once. After we have dropped
|
||||
// support for non-Thebes graphics, UpdateTranslucentWindowAlpha will be
|
||||
// our private interface so we can rework things to avoid this.
|
||||
boundsRect = region.GetBounds();
|
||||
boundsRect = region.GetBounds().ToUnknownRect();
|
||||
dt->PushClipRect(Rect(boundsRect));
|
||||
} else {
|
||||
gfxUtils::ClipToRegion(dt, region);
|
||||
gfxUtils::ClipToRegion(dt, region.ToUnknownRegion());
|
||||
}
|
||||
|
||||
BufferMode layerBuffering;
|
||||
@ -2278,7 +2277,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
|
||||
{
|
||||
if (GetLayerManager()->GetBackendType() == LayersBackend::LAYERS_BASIC) {
|
||||
AutoLayerManagerSetup setupLayerManager(this, ctx, layerBuffering);
|
||||
painted = listener->PaintWindow(this, region);
|
||||
painted = listener->PaintWindow(this, region.ToUnknownRegion());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2303,7 +2302,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
|
||||
|
||||
# ifdef MOZ_HAVE_SHMIMAGE
|
||||
if (mShmImage && MOZ_LIKELY(!mIsDestroyed)) {
|
||||
mShmImage->Put(mXDisplay, mXWindow, region);
|
||||
mShmImage->Put(mXDisplay, mXWindow, region.ToUnknownRegion());
|
||||
}
|
||||
# endif // MOZ_HAVE_SHMIMAGE
|
||||
#endif // MOZ_X11
|
||||
@ -4308,19 +4307,19 @@ nsWindow::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsWindow::SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
|
||||
nsWindow::SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects,
|
||||
bool aIntersectWithExisting)
|
||||
{
|
||||
const nsTArray<nsIntRect>* newRects = &aRects;
|
||||
const nsTArray<LayoutDeviceIntRect>* newRects = &aRects;
|
||||
|
||||
nsAutoTArray<nsIntRect,1> intersectRects;
|
||||
nsAutoTArray<LayoutDeviceIntRect,1> intersectRects;
|
||||
if (aIntersectWithExisting) {
|
||||
nsAutoTArray<nsIntRect,1> existingRects;
|
||||
nsAutoTArray<LayoutDeviceIntRect,1> existingRects;
|
||||
GetWindowClipRegion(&existingRects);
|
||||
|
||||
nsIntRegion existingRegion = RegionFromArray(existingRects);
|
||||
nsIntRegion newRegion = RegionFromArray(aRects);
|
||||
nsIntRegion intersectRegion;
|
||||
LayoutDeviceIntRegion existingRegion = RegionFromArray(existingRects);
|
||||
LayoutDeviceIntRegion newRegion = RegionFromArray(aRects);
|
||||
LayoutDeviceIntRegion intersectRegion;
|
||||
intersectRegion.And(newRegion, existingRegion);
|
||||
|
||||
// If mClipRects is null we haven't set a clip rect yet, so we
|
||||
@ -4346,7 +4345,7 @@ nsWindow::SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
|
||||
#if (MOZ_WIDGET_GTK == 2)
|
||||
GdkRegion *region = gdk_region_new(); // aborts on OOM
|
||||
for (uint32_t i = 0; i < newRects->Length(); ++i) {
|
||||
const nsIntRect& r = newRects->ElementAt(i);
|
||||
const LayoutDeviceIntRect& r = newRects->ElementAt(i);
|
||||
GdkRectangle rect = { r.x, r.y, r.width, r.height };
|
||||
gdk_region_union_with_rect(region, &rect);
|
||||
}
|
||||
@ -4356,7 +4355,7 @@ nsWindow::SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
|
||||
#else
|
||||
cairo_region_t *region = cairo_region_create();
|
||||
for (uint32_t i = 0; i < newRects->Length(); ++i) {
|
||||
const nsIntRect& r = newRects->ElementAt(i);
|
||||
const LayoutDeviceIntRect& r = newRects->ElementAt(i);
|
||||
cairo_rectangle_int_t rect = { r.x, r.y, r.width, r.height };
|
||||
cairo_region_union_rectangle(region, &rect);
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ public:
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener,
|
||||
bool aDoCapture) override;
|
||||
NS_IMETHOD GetAttention(int32_t aCycleCount) override;
|
||||
virtual nsresult SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
|
||||
virtual nsresult SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects,
|
||||
bool aIntersectWithExisting) override;
|
||||
virtual bool HasPendingInputEvent() override;
|
||||
|
||||
|
@ -693,37 +693,37 @@ nsTransparencyMode nsBaseWidget::GetTransparencyMode() {
|
||||
}
|
||||
|
||||
bool
|
||||
nsBaseWidget::IsWindowClipRegionEqual(const nsTArray<nsIntRect>& aRects)
|
||||
nsBaseWidget::IsWindowClipRegionEqual(const nsTArray<LayoutDeviceIntRect>& aRects)
|
||||
{
|
||||
return mClipRects &&
|
||||
mClipRectCount == aRects.Length() &&
|
||||
memcmp(mClipRects.get(), aRects.Elements(), sizeof(nsIntRect)*mClipRectCount) == 0;
|
||||
memcmp(mClipRects.get(), aRects.Elements(), sizeof(LayoutDeviceIntRect)*mClipRectCount) == 0;
|
||||
}
|
||||
|
||||
void
|
||||
nsBaseWidget::StoreWindowClipRegion(const nsTArray<nsIntRect>& aRects)
|
||||
nsBaseWidget::StoreWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects)
|
||||
{
|
||||
mClipRectCount = aRects.Length();
|
||||
mClipRects = MakeUnique<nsIntRect[]>(mClipRectCount);
|
||||
mClipRects = MakeUnique<LayoutDeviceIntRect[]>(mClipRectCount);
|
||||
if (mClipRects) {
|
||||
memcpy(mClipRects.get(), aRects.Elements(), sizeof(nsIntRect)*mClipRectCount);
|
||||
memcpy(mClipRects.get(), aRects.Elements(), sizeof(LayoutDeviceIntRect)*mClipRectCount);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsBaseWidget::GetWindowClipRegion(nsTArray<nsIntRect>* aRects)
|
||||
nsBaseWidget::GetWindowClipRegion(nsTArray<LayoutDeviceIntRect>* aRects)
|
||||
{
|
||||
if (mClipRects) {
|
||||
aRects->AppendElements(mClipRects.get(), mClipRectCount);
|
||||
} else {
|
||||
aRects->AppendElement(nsIntRect(0, 0, mBounds.width, mBounds.height));
|
||||
aRects->AppendElement(LayoutDeviceIntRect(0, 0, mBounds.width, mBounds.height));
|
||||
}
|
||||
}
|
||||
|
||||
const nsIntRegion
|
||||
nsBaseWidget::RegionFromArray(const nsTArray<nsIntRect>& aRects)
|
||||
const LayoutDeviceIntRegion
|
||||
nsBaseWidget::RegionFromArray(const nsTArray<LayoutDeviceIntRect>& aRects)
|
||||
{
|
||||
nsIntRegion region;
|
||||
LayoutDeviceIntRegion region;
|
||||
for (uint32_t i = 0; i < aRects.Length(); ++i) {
|
||||
region.Or(region, aRects[i]);
|
||||
}
|
||||
@ -731,33 +731,34 @@ nsBaseWidget::RegionFromArray(const nsTArray<nsIntRect>& aRects)
|
||||
}
|
||||
|
||||
void
|
||||
nsBaseWidget::ArrayFromRegion(const nsIntRegion& aRegion, nsTArray<nsIntRect>& aRects)
|
||||
nsBaseWidget::ArrayFromRegion(const LayoutDeviceIntRegion& aRegion,
|
||||
nsTArray<LayoutDeviceIntRect>& aRects)
|
||||
{
|
||||
const nsIntRect* r;
|
||||
for (nsIntRegionRectIterator iter(aRegion); (r = iter.Next());) {
|
||||
const LayoutDeviceIntRect* r;
|
||||
for (LayoutDeviceIntRegion::RectIterator iter(aRegion); (r = iter.Next()); ) {
|
||||
aRects.AppendElement(*r);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsBaseWidget::SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
|
||||
nsBaseWidget::SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects,
|
||||
bool aIntersectWithExisting)
|
||||
{
|
||||
if (!aIntersectWithExisting) {
|
||||
StoreWindowClipRegion(aRects);
|
||||
} else {
|
||||
// get current rects
|
||||
nsTArray<nsIntRect> currentRects;
|
||||
nsTArray<LayoutDeviceIntRect> currentRects;
|
||||
GetWindowClipRegion(¤tRects);
|
||||
// create region from them
|
||||
nsIntRegion currentRegion = RegionFromArray(currentRects);
|
||||
LayoutDeviceIntRegion currentRegion = RegionFromArray(currentRects);
|
||||
// create region from new rects
|
||||
nsIntRegion newRegion = RegionFromArray(aRects);
|
||||
LayoutDeviceIntRegion newRegion = RegionFromArray(aRects);
|
||||
// intersect regions
|
||||
nsIntRegion intersection;
|
||||
LayoutDeviceIntRegion intersection;
|
||||
intersection.And(currentRegion, newRegion);
|
||||
// create int rect array from intersection
|
||||
nsTArray<nsIntRect> rects;
|
||||
nsTArray<LayoutDeviceIntRect> rects;
|
||||
ArrayFromRegion(intersection, rects);
|
||||
// store
|
||||
StoreWindowClipRegion(rects);
|
||||
|
@ -139,7 +139,7 @@ public:
|
||||
virtual void ClearCachedCursor() override { mUpdateCursor = true; }
|
||||
virtual void SetTransparencyMode(nsTransparencyMode aMode) override;
|
||||
virtual nsTransparencyMode GetTransparencyMode() override;
|
||||
virtual void GetWindowClipRegion(nsTArray<nsIntRect>* aRects) override;
|
||||
virtual void GetWindowClipRegion(nsTArray<LayoutDeviceIntRect>* aRects) override;
|
||||
NS_IMETHOD SetWindowShadowStyle(int32_t aStyle) override;
|
||||
virtual void SetShowsToolbarButton(bool aShow) override {}
|
||||
virtual void SetShowsFullScreenButton(bool aShow) override {}
|
||||
@ -175,7 +175,7 @@ public:
|
||||
NS_IMETHOD SetModal(bool aModal) override;
|
||||
virtual uint32_t GetMaxTouchPoints() const override;
|
||||
NS_IMETHOD SetWindowClass(const nsAString& xulWinType) override;
|
||||
virtual nsresult SetWindowClipRegion(const nsTArray<nsIntRect>& aRects, bool aIntersectWithExisting) override;
|
||||
virtual nsresult SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects, bool aIntersectWithExisting) override;
|
||||
// Return whether this widget interprets parameters to Move and Resize APIs
|
||||
// as "global display pixels" rather than "device pixels", and therefore
|
||||
// applies its GetDefaultScale() value to them before using them as mBounds
|
||||
@ -363,8 +363,9 @@ protected:
|
||||
uint64_t aInputBlockId,
|
||||
nsEventStatus aApzResponse);
|
||||
|
||||
const nsIntRegion RegionFromArray(const nsTArray<nsIntRect>& aRects);
|
||||
void ArrayFromRegion(const nsIntRegion& aRegion, nsTArray<nsIntRect>& aRects);
|
||||
const LayoutDeviceIntRegion RegionFromArray(const nsTArray<LayoutDeviceIntRect>& aRects);
|
||||
void ArrayFromRegion(const LayoutDeviceIntRegion& aRegion,
|
||||
nsTArray<LayoutDeviceIntRect>& aRects);
|
||||
|
||||
virtual nsIContent* GetLastRollup() override
|
||||
{
|
||||
@ -428,10 +429,10 @@ protected:
|
||||
protected:
|
||||
// Utility to check if an array of clip rects is equal to our
|
||||
// internally stored clip rect array mClipRects.
|
||||
bool IsWindowClipRegionEqual(const nsTArray<nsIntRect>& aRects);
|
||||
bool IsWindowClipRegionEqual(const nsTArray<LayoutDeviceIntRect>& aRects);
|
||||
|
||||
// Stores the clip rectangles in aRects into mClipRects.
|
||||
void StoreWindowClipRegion(const nsTArray<nsIntRect>& aRects);
|
||||
void StoreWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects);
|
||||
|
||||
virtual already_AddRefed<nsIWidget>
|
||||
AllocateChildPopupWidget()
|
||||
@ -510,7 +511,7 @@ protected:
|
||||
nsIntRect mBounds;
|
||||
CSSIntRect* mOriginalBounds;
|
||||
// When this pointer is null, the widget is not clipped
|
||||
mozilla::UniquePtr<nsIntRect[]> mClipRects;
|
||||
mozilla::UniquePtr<LayoutDeviceIntRect[]> mClipRects;
|
||||
uint32_t mClipRectCount;
|
||||
nsSizeMode mSizeMode;
|
||||
nsPopupLevel mPopupLevel;
|
||||
|
@ -985,7 +985,7 @@ class nsIWidget : public nsISupports {
|
||||
uintptr_t mWindowID; // e10s specific, the unique plugin port id
|
||||
bool mVisible; // e10s specific, widget visibility
|
||||
LayoutDeviceIntRect mBounds;
|
||||
nsTArray<nsIntRect> mClipRegion;
|
||||
nsTArray<LayoutDeviceIntRect> mClipRegion;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1005,7 +1005,7 @@ class nsIWidget : public nsISupports {
|
||||
* moved in that order.
|
||||
*/
|
||||
virtual nsresult ConfigureChildren(const nsTArray<Configuration>& aConfigurations) = 0;
|
||||
virtual nsresult SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
|
||||
virtual nsresult SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects,
|
||||
bool aIntersectWithExisting) = 0;
|
||||
|
||||
/**
|
||||
@ -1013,7 +1013,7 @@ class nsIWidget : public nsISupports {
|
||||
* region. If this widget is not clipped, appends a single rectangle
|
||||
* (0, 0, bounds.width, bounds.height).
|
||||
*/
|
||||
virtual void GetWindowClipRegion(nsTArray<nsIntRect>* aRects) = 0;
|
||||
virtual void GetWindowClipRegion(nsTArray<LayoutDeviceIntRect>* aRects) = 0;
|
||||
|
||||
/**
|
||||
* Register or unregister native plugin widgets which receive Configuration
|
||||
|
@ -1425,7 +1425,7 @@ NS_METHOD nsWindow::Move(double aX, double aY)
|
||||
if (IsPlugin() &&
|
||||
(!mLayerManager || mLayerManager->GetBackendType() == LayersBackend::LAYERS_D3D9) &&
|
||||
mClipRects &&
|
||||
(mClipRectCount != 1 || !mClipRects[0].IsEqualInterior(nsIntRect(0, 0, mBounds.width, mBounds.height)))) {
|
||||
(mClipRectCount != 1 || !mClipRects[0].IsEqualInterior(LayoutDeviceIntRect(0, 0, mBounds.width, mBounds.height)))) {
|
||||
flags |= SWP_NOCOPYBITS;
|
||||
}
|
||||
VERIFY(::SetWindowPos(mWnd, nullptr, x, y, 0, 0, flags));
|
||||
@ -6557,7 +6557,7 @@ nsWindow::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
|
||||
}
|
||||
|
||||
static HRGN
|
||||
CreateHRGNFromArray(const nsTArray<nsIntRect>& aRects)
|
||||
CreateHRGNFromArray(const nsTArray<LayoutDeviceIntRect>& aRects)
|
||||
{
|
||||
int32_t size = sizeof(RGNDATAHEADER) + sizeof(RECT)*aRects.Length();
|
||||
nsAutoTArray<uint8_t,100> buf;
|
||||
@ -6567,9 +6567,9 @@ CreateHRGNFromArray(const nsTArray<nsIntRect>& aRects)
|
||||
data->rdh.dwSize = sizeof(data->rdh);
|
||||
data->rdh.iType = RDH_RECTANGLES;
|
||||
data->rdh.nCount = aRects.Length();
|
||||
nsIntRect bounds;
|
||||
LayoutDeviceIntRect bounds;
|
||||
for (uint32_t i = 0; i < aRects.Length(); ++i) {
|
||||
const nsIntRect& r = aRects[i];
|
||||
const LayoutDeviceIntRect& r = aRects[i];
|
||||
bounds.UnionRect(bounds, r);
|
||||
::SetRect(&rects[i], r.x, r.y, r.XMost(), r.YMost());
|
||||
}
|
||||
@ -6578,7 +6578,7 @@ CreateHRGNFromArray(const nsTArray<nsIntRect>& aRects)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsWindow::SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
|
||||
nsWindow::SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects,
|
||||
bool aIntersectWithExisting)
|
||||
{
|
||||
if (IsWindowClipRegionEqual(aRects)) {
|
||||
|
@ -453,7 +453,7 @@ protected:
|
||||
*/
|
||||
void StopFlashing();
|
||||
static bool IsTopLevelMouseExit(HWND aWnd);
|
||||
virtual nsresult SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
|
||||
virtual nsresult SetWindowClipRegion(const nsTArray<LayoutDeviceIntRect>& aRects,
|
||||
bool aIntersectWithExisting) override;
|
||||
nsIntRegion GetRegionToPaint(bool aForceFullRepaint,
|
||||
PAINTSTRUCT ps, HDC aDC);
|
||||
|
Loading…
Reference in New Issue
Block a user