Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Bug 1155621 - Make nsIntRect and nsIntPoint typedefs of mozilla::gfx:…
Browse files Browse the repository at this point in the history
…:IntRect and mozilla::gfx::IntPoint. r=Bas
  • Loading branch information
nical committed Apr 21, 2015
1 parent 73014da commit cfff5e5
Show file tree
Hide file tree
Showing 131 changed files with 437 additions and 562 deletions.
2 changes: 1 addition & 1 deletion accessible/base/nsCoreUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ nsCoreUtils::ScrollFrameToPoint(nsIFrame *aScrollableFrame,
return;

nsPoint point =
aPoint.ToAppUnits(aFrame->PresContext()->AppUnitsPerDevPixel());
ToAppUnits(aPoint, aFrame->PresContext()->AppUnitsPerDevPixel());
nsRect frameRect = aFrame->GetScreenRectInAppUnits();
nsPoint deltaPoint(point.x - frameRect.x, point.y - frameRect.y);

Expand Down
2 changes: 1 addition & 1 deletion accessible/generic/Accessible.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
#include "nsString.h"
#include "nsTArray.h"
#include "nsRefPtrHashtable.h"
#include "nsRect.h"

struct nsRoleMapEntry;

struct nsRect;
class nsIFrame;
class nsIAtom;
struct nsIntRect;
class nsIPersistentProperties;
class nsView;

Expand Down
4 changes: 2 additions & 2 deletions accessible/generic/HyperTextAccessible.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ HyperTextAccessible::OffsetAtPoint(int32_t aX, int32_t aY, uint32_t aCoordType)

nsPresContext* presContext = mDoc->PresContext();
nsPoint coordsInAppUnits =
coords.ToAppUnits(presContext->AppUnitsPerDevPixel());
ToAppUnits(coords, presContext->AppUnitsPerDevPixel());

nsRect frameScreenRect = hyperFrame->GetScreenRectInAppUnits();
if (!frameScreenRect.Contains(coordsInAppUnits.x, coordsInAppUnits.y))
Expand Down Expand Up @@ -1568,7 +1568,7 @@ HyperTextAccessible::ScrollSubstringToPoint(int32_t aStartOffset,

nsPresContext* presContext = frame->PresContext();
nsPoint coordsInAppUnits =
coords.ToAppUnits(presContext->AppUnitsPerDevPixel());
ToAppUnits(coords, presContext->AppUnitsPerDevPixel());

bool initialScrolled = false;
nsIFrame *parentFrame = frame;
Expand Down
6 changes: 3 additions & 3 deletions accessible/ipc/PDocAccessible.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ include protocol PContent;

include "mozilla/GfxMessageUtils.h";

using struct nsIntPoint from "nsRect.h";
using struct nsIntRect from "nsRect.h";
using nsIntRect from "nsRect.h";
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";

namespace mozilla {
namespace a11y {
Expand Down Expand Up @@ -135,7 +135,7 @@ child:
prio(high) sync PasteText(uint64_t aID, int32_t aPosition)
returns(bool aValid);

prio(high) sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(nsIntPoint aRetVal);
prio(high) sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(IntPoint aRetVal);
prio(high) sync ImageSize(uint64_t aID) returns(IntSize aRetVal);

prio(high) sync StartOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk);
Expand Down
2 changes: 1 addition & 1 deletion docshell/base/nsIContentViewer.idl
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ interface nsIPrintSettings;

%{ C++
#include "nsTArray.h"
#include "nsRect.h"

class nsIWidget;
struct nsIntRect;
class nsIPresShell;
class nsPresContext;
class nsView;
Expand Down
2 changes: 1 addition & 1 deletion docshell/shistory/public/nsISHEntry.idl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface nsIStructuredCloneContainer;
interface nsIBFCacheEntry;

%{C++
struct nsIntRect;
#include "nsRect.h"
class nsDocShellEditorData;
class nsSHEntryShared;
%}
Expand Down
3 changes: 1 addition & 2 deletions dom/events/WheelHandlingHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
#include "mozilla/EventForwards.h"
#include "nsCoord.h"
#include "nsIFrame.h"
#include "nsPoint.h"

class nsIScrollableFrame;
class nsITimer;

struct nsIntPoint;

namespace mozilla {

class EventStateManager;
Expand Down
10 changes: 5 additions & 5 deletions dom/ipc/PBrowser.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ using nscolor from "nsColor.h";
using class mozilla::WidgetCompositionEvent from "ipc/nsGUIEventIPC.h";
using struct mozilla::widget::IMENotification from "nsIWidget.h";
using struct nsIMEUpdatePreference from "nsIWidget.h";
using struct nsIntPoint from "nsPoint.h";
using struct nsIntRect from "nsRect.h";
using mozilla::gfx::IntSize from "mozilla/gfx/Point.h";
using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h";
using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h";
using class mozilla::WidgetKeyboardEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetMouseEvent from "ipc/nsGUIEventIPC.h";
using class mozilla::WidgetWheelEvent from "ipc/nsGUIEventIPC.h";
Expand Down Expand Up @@ -488,11 +488,11 @@ parent:
uint64_t aObserverId);
SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
nsIntPoint aPointerScreenPoint,
IntPoint aPointerScreenPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
uint64_t aObserverId);
SynthesizeNativeTouchTap(nsIntPoint aPointerScreenPoint,
SynthesizeNativeTouchTap(IntPoint aPointerScreenPoint,
bool aLongTap,
uint64_t aObserverId);
ClearNativeTouchSequence(uint64_t aObserverId);
Expand Down Expand Up @@ -548,7 +548,7 @@ child:

CacheFileDescriptor(nsString path, FileDescriptor fd);

UpdateDimensions(nsIntRect rect, ScreenIntSize size, ScreenOrientation orientation,
UpdateDimensions(IntRect rect, ScreenIntSize size, ScreenOrientation orientation,
LayoutDeviceIntPoint chromeDisp) compress;

UpdateFrame(FrameMetrics frame);
Expand Down
2 changes: 1 addition & 1 deletion dom/ipc/PPluginWidget.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include protocol PBrowser;

include "mozilla/GfxMessageUtils.h";

using struct nsIntRect from "nsRect.h";
using nsIntRect from "nsRect.h";

namespace mozilla {
namespace plugins {
Expand Down
2 changes: 1 addition & 1 deletion dom/ipc/PScreenManager.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include protocol PContent;

include "mozilla/GfxMessageUtils.h";

using struct nsIntRect from "nsRect.h";
using nsIntRect from "nsRect.h";
using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h";

namespace mozilla {
Expand Down
4 changes: 2 additions & 2 deletions dom/ipc/TabChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,7 @@ TabChild::Init()
}
mWidget->Create(
nullptr, 0, // no parents
nsIntRect(nsIntPoint(0, 0), nsIntSize(0, 0)),
gfx::IntRect(gfx::IntPoint(0, 0), gfx::IntSize(0, 0)),
nullptr // HandleWidgetEvent
);

Expand Down Expand Up @@ -3179,7 +3179,7 @@ TabChild::CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut)
initData.mUnicode = false;
initData.clipChildren = true;
initData.clipSiblings = true;
nsresult rv = pluginWidget->Create(aParent, nullptr, nsIntRect(nsIntPoint(0, 0),
nsresult rv = pluginWidget->Create(aParent, nullptr, gfx::IntRect(gfx::IntPoint(0, 0),
nsIntSize(0, 0)), &initData);
if (NS_FAILED(rv)) {
NS_WARNING("Creating native plugin widget on the chrome side failed.");
Expand Down
3 changes: 1 addition & 2 deletions dom/media/VideoUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "mozilla/CheckedInt.h"
#include "nsIThread.h"
#include "nsSize.h"
#include "nsRect.h"

#if !(defined(XP_WIN) || defined(XP_MACOSX) || defined(LINUX)) || \
defined(MOZ_ASAN)
Expand All @@ -28,8 +29,6 @@ using mozilla::CheckedUint64;
using mozilla::CheckedInt32;
using mozilla::CheckedUint32;

struct nsIntRect;

// This file contains stuff we'd rather put elsewhere, but which is
// dependent on other changes which we don't want to wait for. We plan to
// remove this file in the near future.
Expand Down
3 changes: 1 addition & 2 deletions dom/media/wmf/DXVA2Manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#include "WMF.h"
#include "nsAutoPtr.h"
#include "mozilla/Mutex.h"

struct nsIntRect;
#include "nsRect.h"

namespace mozilla {

Expand Down
1 change: 0 additions & 1 deletion dom/plugins/base/nsPluginInstanceOwner.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#endif

class nsIInputStream;
struct nsIntRect;
class nsPluginDOMContextMenuListener;
class nsPluginFrame;
class nsDisplayListBuilder;
Expand Down
2 changes: 1 addition & 1 deletion dom/plugins/ipc/PPluginInstance.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ using gfxIntSize from "nsSize.h";
using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
using mozilla::plugins::WindowsSharedMemoryHandle from "mozilla/plugins/PluginMessageUtils.h";
using mozilla::layers::SurfaceDescriptorX11 from "gfxipc/ShadowLayerUtils.h";
using struct nsIntRect from "nsRect.h";
using nsIntRect from "nsRect.h";

namespace mozilla {
namespace plugins {
Expand Down
2 changes: 1 addition & 1 deletion dom/plugins/ipc/PluginLibrary.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
#include "nsError.h"
#include "mozilla/EventForwards.h"
#include "nsSize.h"
#include "nsRect.h"

class gfxContext;
class nsCString;
struct nsIntRect;
class nsNPAPIPlugin;

namespace mozilla {
Expand Down
3 changes: 1 addition & 2 deletions dom/plugins/ipc/PluginUtilsOSX.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@

#include "npapi.h"
#include "mozilla/gfx/QuartzSupport.h"

struct nsIntRect;
#include "nsRect.h"

namespace mozilla {
namespace plugins {
Expand Down
16 changes: 16 additions & 0 deletions gfx/2d/Rect.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "BaseRect.h"
#include "BaseMargin.h"
#include "NumericTools.h"
#include "Point.h"
#include "Tools.h"

Expand Down Expand Up @@ -105,6 +106,21 @@ struct IntRectTyped :
{
return IntRectTyped<units>::IsEqualEdges(aRect);
}

void InflateToMultiple(const IntSizeTyped<units>& aTileSize)
{
int32_t yMost = this->YMost();
int32_t xMost = this->XMost();

this->x = RoundDownToMultiple(this->x, aTileSize.width);
this->y = RoundDownToMultiple(this->y, aTileSize.height);
xMost = RoundUpToMultiple(xMost, aTileSize.width);
yMost = RoundUpToMultiple(yMost, aTileSize.height);

this->width = xMost - this->x;
this->height = yMost - this->y;
}

};
typedef IntRectTyped<UnknownUnits> IntRect;

Expand Down
35 changes: 17 additions & 18 deletions gfx/gl/GLTextureImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ TextureImage::UpdateFromDataSource(gfx::DataSourceSurface *aSurface,
const gfx::IntPoint* aSrcPoint)
{
nsIntRegion destRegion = aDestRegion ? *aDestRegion
: nsIntRect(0, 0,
: IntRect(0, 0,
aSurface->GetSize().width,
aSurface->GetSize().height);
gfx::IntPoint srcPoint = aSrcPoint ? *aSrcPoint
Expand Down Expand Up @@ -120,13 +120,13 @@ BasicTextureImage::BeginUpdate(nsIntRegion& aRegion)
if (CanUploadSubTextures(mGLContext)) {
GetUpdateRegion(aRegion);
} else {
aRegion = nsIntRect(nsIntPoint(0, 0), mSize);
aRegion = IntRect(IntPoint(0, 0), mSize);
}

mUpdateRegion = aRegion;

nsIntRect rgnSize = mUpdateRegion.GetBounds();
if (!nsIntRect(nsIntPoint(0, 0), mSize).Contains(rgnSize)) {
IntRect rgnSize = mUpdateRegion.GetBounds();
if (!IntRect(IntPoint(0, 0), mSize).Contains(rgnSize)) {
NS_ERROR("update outside of image");
return nullptr;
}
Expand All @@ -147,7 +147,7 @@ BasicTextureImage::GetUpdateRegion(nsIntRegion& aForRegion)
// changed, we need to recreate our backing surface and force the
// client to paint everything
if (mTextureState != Valid) {
aForRegion = nsIntRect(nsIntPoint(0, 0), mSize);
aForRegion = IntRect(IntPoint(0, 0), mSize);
}
}

Expand All @@ -169,7 +169,7 @@ BasicTextureImage::EndUpdate()
mUpdateRegion,
mTexture,
mTextureState == Created,
mUpdateOffset,
ToIntPoint(mUpdateOffset),
relative);
FinishedSurfaceUpload();

Expand Down Expand Up @@ -205,10 +205,10 @@ BasicTextureImage::FinishedSurfaceUpload()
bool
BasicTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, const gfx::IntPoint& aFrom /* = gfx::IntPoint(0, 0) */)
{
nsIntRect bounds = aRegion.GetBounds();
IntRect bounds = aRegion.GetBounds();
nsIntRegion region;
if (mTextureState != Valid) {
bounds = nsIntRect(0, 0, mSize.width, mSize.height);
bounds = IntRect(0, 0, mSize.width, mSize.height);
region = nsIntRegion(bounds);
} else {
region = aRegion;
Expand All @@ -220,7 +220,7 @@ BasicTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion
region,
mTexture,
mTextureState == Created,
bounds.TopLeft() + nsIntPoint(aFrom.x, aFrom.y),
bounds.TopLeft() + IntPoint(aFrom.x, aFrom.y),
false);
mTextureState = Valid;
return true;
Expand Down Expand Up @@ -345,7 +345,7 @@ TiledTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion
nsIntRegion region;

if (mTextureState != Valid) {
nsIntRect bounds = nsIntRect(0, 0, mSize.width, mSize.height);
IntRect bounds = IntRect(0, 0, mSize.width, mSize.height);
region = nsIntRegion(bounds);
} else {
region = aRegion;
Expand All @@ -355,7 +355,7 @@ TiledTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion
int oldCurrentImage = mCurrentImage;
BeginBigImageIteration();
do {
nsIntRect tileRect = ThebesIntRect(GetSrcTileRect());
IntRect tileRect = ThebesIntRect(GetSrcTileRect());
int xPos = tileRect.x;
int yPos = tileRect.y;

Expand Down Expand Up @@ -400,7 +400,7 @@ TiledTextureImage::GetUpdateRegion(nsIntRegion& aForRegion)
// if the texture hasn't been initialized yet, or something important
// changed, we need to recreate our backing surface and force the
// client to paint everything
aForRegion = nsIntRect(nsIntPoint(0, 0), mSize);
aForRegion = IntRect(IntPoint(0, 0), mSize);
return;
}

Expand All @@ -411,7 +411,7 @@ TiledTextureImage::GetUpdateRegion(nsIntRegion& aForRegion)
for (unsigned i = 0; i < mImages.Length(); i++) {
int xPos = (i % mColumns) * mTileSize;
int yPos = (i / mColumns) * mTileSize;
nsIntRect imageRect = nsIntRect(nsIntPoint(xPos,yPos),
IntRect imageRect = IntRect(IntPoint(xPos,yPos),
mImages[i]->GetSize());

if (aForRegion.Intersects(imageRect)) {
Expand Down Expand Up @@ -446,16 +446,16 @@ TiledTextureImage::BeginUpdate(nsIntRegion& aRegion)
// if the texture hasn't been initialized yet, or something important
// changed, we need to recreate our backing surface and force the
// client to paint everything
aRegion = nsIntRect(nsIntPoint(0, 0), mSize);
aRegion = IntRect(IntPoint(0, 0), mSize);
}

nsIntRect bounds = aRegion.GetBounds();
IntRect bounds = aRegion.GetBounds();

for (unsigned i = 0; i < mImages.Length(); i++) {
int xPos = (i % mColumns) * mTileSize;
int yPos = (i / mColumns) * mTileSize;
nsIntRegion imageRegion =
nsIntRegion(nsIntRect(nsIntPoint(xPos,yPos),
nsIntRegion(IntRect(IntPoint(xPos,yPos),
mImages[i]->GetSize()));

// a single Image can handle this update request
Expand Down Expand Up @@ -510,8 +510,7 @@ TiledTextureImage::EndUpdate()
for (unsigned i = 0; i < mImages.Length(); i++) {
int xPos = (i % mColumns) * mTileSize;
int yPos = (i / mColumns) * mTileSize;
nsIntRect imageRect = nsIntRect(nsIntPoint(xPos,yPos),
mImages[i]->GetSize());
IntRect imageRect = IntRect(IntPoint(xPos,yPos), mImages[i]->GetSize());

nsIntRegion subregion;
subregion.And(mUpdateRegion, imageRect);
Expand Down
Loading

0 comments on commit cfff5e5

Please sign in to comment.