Bug 1222661 - Replace FromUntyped(obj) calls with FromUnknown*(obj). r=nical

--HG--
extra : rebase_source : c1afe8560b838e1a3be0ce50847861b1815d3dc9
extra : source : d649f163c825736efaf3ac3ad73040beeb48a6ef
This commit is contained in:
Botond Ballo 2015-11-09 18:22:25 -05:00
parent a592a77364
commit 6a70e1aa18
17 changed files with 32 additions and 55 deletions

View File

@ -214,7 +214,7 @@ ContentEventHandler::QueryContentRect(nsIContent* aContent,
resultRect.UnionRect(resultRect, frameRect);
}
aEvent->mReply.mRect = LayoutDevicePixel::FromUntyped(
aEvent->mReply.mRect = LayoutDeviceIntRect::FromUnknownRect(
resultRect.ToOutsidePixels(mPresContext->AppUnitsPerDevPixel()));
aEvent->mSucceeded = true;
@ -1081,7 +1081,7 @@ ContentEventHandler::OnQueryTextRect(WidgetQueryContentEvent* aEvent)
} else {
rect.UnionRect(rect, frameRect);
}
aEvent->mReply.mRect = LayoutDevicePixel::FromUntyped(
aEvent->mReply.mRect = LayoutDeviceIntRect::FromUnknownRect(
rect.ToOutsidePixels(mPresContext->AppUnitsPerDevPixel()));
aEvent->mReply.mWritingMode = lastFrame->GetWritingMode();
aEvent->mSucceeded = true;
@ -1129,7 +1129,7 @@ ContentEventHandler::OnQueryCaretRect(WidgetQueryContentEvent* aEvent)
NS_ENSURE_SUCCESS(rv, rv);
nscoord appUnitsPerDevPixel =
caretFrame->PresContext()->AppUnitsPerDevPixel();
aEvent->mReply.mRect = LayoutDevicePixel::FromUntyped(
aEvent->mReply.mRect = LayoutDeviceIntRect::FromUnknownRect(
caretRect.ToOutsidePixels(appUnitsPerDevPixel));
aEvent->mReply.mWritingMode = caretFrame->GetWritingMode();
aEvent->mReply.mOffset = aEvent->mInput.mOffset;
@ -1189,7 +1189,7 @@ ContentEventHandler::OnQueryCaretRect(WidgetQueryContentEvent* aEvent)
rv = ConvertToRootRelativeOffset(frame, rect);
NS_ENSURE_SUCCESS(rv, rv);
aEvent->mReply.mRect = LayoutDevicePixel::FromUntyped(
aEvent->mReply.mRect = LayoutDeviceIntRect::FromUnknownRect(
rect.ToOutsidePixels(mPresContext->AppUnitsPerDevPixel()));
// If the caret rect is empty, let's make it non-empty rect.
if (!aEvent->mReply.mRect.width) {

View File

@ -2071,7 +2071,7 @@ public:
RenderTargetIntRect GetIntermediateSurfaceRect()
{
NS_ASSERTION(mUseIntermediateSurface, "Must have intermediate surface");
return RenderTargetPixel::FromUntyped(mVisibleRegion.GetBounds());
return RenderTargetIntRect::FromUnknownRect(mVisibleRegion.GetBounds());
}
/**

View File

@ -669,7 +669,7 @@ RenderIntermediate(ContainerT* aContainer,
compositor->SetRenderTarget(surface);
// pre-render all of the layers into our temporary
RenderLayers(aContainer, aManager, RenderTargetPixel::FromUntyped(aClipRect));
RenderLayers(aContainer, aManager, RenderTargetIntRect::FromUnknownRect(aClipRect));
// Unbind the current surface and rebind the previous one.
compositor->SetRenderTarget(previousTarget);
}
@ -725,7 +725,7 @@ ContainerRender(ContainerT* aContainer,
container->GetEffectiveTransform());
});
} else {
RenderLayers(aContainer, aManager, RenderTargetPixel::FromUntyped(aClipRect));
RenderLayers(aContainer, aManager, RenderTargetIntRect::FromUnknownRect(aClipRect));
}
aContainer->mPrepared = nullptr;

View File

@ -1038,7 +1038,7 @@ LayerManagerComposite::RenderToPresentationSurface()
const IntRect clipRect = IntRect(0, 0, actualWidth, actualHeight);
RootLayer()->Prepare(RenderTargetPixel::FromUntyped(clipRect));
RootLayer()->Prepare(RenderTargetIntRect::FromUnknownRect(clipRect));
RootLayer()->RenderLayer(clipRect);
mCompositor->EndFrame();

View File

@ -844,12 +844,12 @@ public:
return Super::operator=(mozilla::Move(aRegion));
}
static IntRegionTyped FromUntyped(const IntRegionTyped<UnknownUnits>& aRegion)
static IntRegionTyped FromUnknownRegion(const IntRegionTyped<UnknownUnits>& aRegion)
{
return IntRegionTyped(aRegion.Impl());
}
private:
// This is deliberately private, so calling code uses FromUntyped().
// This is deliberately private, so calling code uses FromUnknownRegion().
explicit IntRegionTyped(const nsRegion& aRegion) : Super(aRegion) {}
};

View File

@ -107,7 +107,7 @@ struct ContainerLayerParameters {
nsIntPoint mOffset;
LayerIntPoint Offset() const {
return LayerIntPoint::FromUntyped(mOffset);
return LayerIntPoint::FromUnknownPoint(mOffset);
}
nscolor mBackgroundColor;

View File

@ -235,14 +235,6 @@ struct CSSPixel {
* 2) the "widget scale" (see nsIWidget::GetDefaultScale)
*/
struct LayoutDevicePixel {
static LayoutDeviceIntPoint FromUntyped(const nsIntPoint& aPoint) {
return LayoutDeviceIntPoint(aPoint.x, aPoint.y);
}
static LayoutDeviceIntRect FromUntyped(const nsIntRect& aRect) {
return LayoutDeviceIntRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
static LayoutDeviceRect FromAppUnits(const nsRect& aRect, nscoord aAppUnitsPerDevPixel) {
return LayoutDeviceRect(NSAppUnitsToFloatPixels(aRect.x, float(aAppUnitsPerDevPixel)),
NSAppUnitsToFloatPixels(aRect.y, float(aAppUnitsPerDevPixel)),
@ -268,11 +260,11 @@ struct LayoutDevicePixel {
}
static LayoutDeviceIntPoint FromAppUnitsToNearest(const nsPoint& aPoint, nscoord aAppUnitsPerDevPixel) {
return FromUntyped(aPoint.ToNearestPixels(aAppUnitsPerDevPixel));
return LayoutDeviceIntPoint::FromUnknownPoint(aPoint.ToNearestPixels(aAppUnitsPerDevPixel));
}
static LayoutDeviceIntRect FromAppUnitsToNearest(const nsRect& aRect, nscoord aAppUnitsPerDevPixel) {
return FromUntyped(aRect.ToNearestPixels(aAppUnitsPerDevPixel));
return LayoutDeviceIntRect::FromUnknownRect(aRect.ToNearestPixels(aAppUnitsPerDevPixel));
}
static LayoutDeviceIntSize FromAppUnitsRounded(const nsSize& aSize, nscoord aAppUnitsPerDevPixel) {
@ -321,14 +313,6 @@ struct LayerPixel {
static gfx::Rect ToUnknown(const LayerRect& aRect) {
return gfx::Rect(aRect.x, aRect.y, aRect.width, aRect.height);
}
static LayerIntRect FromUntyped(const nsIntRect& aRect) {
return LayerIntRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
static LayerIntPoint FromUntyped(const nsIntPoint& aPoint) {
return LayerIntPoint(aPoint.x, aPoint.y);
}
};
/*
@ -350,10 +334,6 @@ struct RenderTargetPixel {
static RenderTargetRect FromUnknown(const gfx::Rect& aRect) {
return RenderTargetRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
static RenderTargetIntRect FromUntyped(const nsIntRect& aRect) {
return RenderTargetIntRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
};
/*
@ -366,9 +346,6 @@ struct RenderTargetPixel {
* generally be represented in ScreenPixel units.
*/
struct ScreenPixel {
static ScreenIntPoint FromUntyped(const nsIntPoint& aPoint) {
return ScreenIntPoint(aPoint.x, aPoint.y);
}
};
/* The layer coordinates of the parent frame.

View File

@ -8001,7 +8001,7 @@ nsLayoutUtils::GetContentViewerSize(nsPresContext* aPresContext,
nsIntRect bounds;
cv->GetBounds(bounds);
aOutSize = LayoutDeviceIntRect::FromUntyped(bounds).Size();
aOutSize = LayoutDeviceIntRect::FromUnknownRect(bounds).Size();
return true;
}

View File

@ -8163,7 +8163,7 @@ PresShell::AdjustContextMenuKeyEvent(WidgetMouseEvent* aEvent)
nsCOMPtr<nsIWidget> widget = popupFrame->GetNearestWidget();
aEvent->widget = widget;
LayoutDeviceIntPoint widgetPoint = widget->WidgetToScreenOffset();
aEvent->refPoint = LayoutDeviceIntPoint::FromUntyped(
aEvent->refPoint = LayoutDeviceIntPoint::FromUnknownPoint(
itemFrame->GetScreenRect().BottomLeft()) - widgetPoint;
mCurrentEventContent = itemFrame->GetContent();

View File

@ -230,7 +230,7 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
// than be too large. If the popup is too large it could get flipped
// to the opposite side of the anchor point while resizing.
nsIntRect screenRectPixels = screenRect.ToInsidePixels(aPresContext->AppUnitsPerDevPixel());
rect.IntersectRect(rect, LayoutDevicePixel::FromUntyped(screenRectPixels));
rect.IntersectRect(rect, LayoutDeviceIntRect::FromUnknownRect(screenRectPixels));
}
if (contentToResize) {

View File

@ -486,7 +486,7 @@ nsXULPopupManager::PopupMoved(nsIFrame* aFrame, nsIntPoint aPnt)
menuPopupFrame->SetPopupPosition(nullptr, true, false);
}
else {
CSSPoint cssPos = LayoutDeviceIntPoint::FromUntyped(aPnt)
CSSPoint cssPos = LayoutDeviceIntPoint::FromUnknownPoint(aPnt)
/ menuPopupFrame->PresContext()->CSSToDevPixelScale();
menuPopupFrame->MoveTo(RoundedToInt(cssPos), false);
}

View File

@ -130,7 +130,7 @@ public:
{ return NS_ERROR_UNEXPECTED; }
virtual mozilla::LayoutDeviceIntPoint WidgetToScreenOffset() override
{ return LayoutDeviceIntPoint::FromUntyped(GetWindowPosition() + GetChromeDimensions()); }
{ return LayoutDeviceIntPoint::FromUnknownPoint(GetWindowPosition() + GetChromeDimensions()); }
void InitEvent(WidgetGUIEvent& aEvent,
mozilla::LayoutDeviceIntPoint* aPoint = nullptr);

View File

@ -1551,7 +1551,7 @@ LayoutDeviceIntPoint nsChildView::WidgetToScreenOffset()
FlipCocoaScreenCoordinate(origin);
// convert to device pixels
return LayoutDeviceIntPoint::FromUntyped(CocoaPointsToDevPixels(origin));
return LayoutDeviceIntPoint::FromUnknownPoint(CocoaPointsToDevPixels(origin));
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0));
}
@ -4583,7 +4583,7 @@ NSEvent* gLastDragMouseDownEvent = nil;
EventMessage msg = aEnter ? eMouseEnterIntoWidget : eMouseExitFromWidget;
WidgetMouseEvent event(true, msg, mGeckoChild, WidgetMouseEvent::eReal);
event.refPoint = LayoutDeviceIntPoint::FromUntyped(
event.refPoint = LayoutDeviceIntPoint::FromUnknownPoint(
mGeckoChild->CocoaPointsToDevPixels(localEventLocation));
event.exit = aType;
@ -4915,7 +4915,7 @@ PanGestureTypeForEvent(NSEvent* aEvent)
NSPoint locationInWindow = nsCocoaUtils::EventLocationForWindow(theEvent, [self window]);
ScreenPoint position = ScreenPoint::FromUntyped(
ScreenPoint position = ScreenPoint::FromUnknownPoint(
[self convertWindowCoordinates:locationInWindow]);
bool usePreciseDeltas = nsCocoaUtils::HasPreciseScrollingDeltas(theEvent) &&
@ -4990,7 +4990,7 @@ PanGestureTypeForEvent(NSEvent* aEvent)
CGPoint loc = CGEventGetLocation(cgEvent);
loc.y = nsCocoaUtils::FlippedScreenY(loc.y);
NSPoint locationInWindow = [[self window] convertScreenToBase:NSPointFromCGPoint(loc)];
ScreenIntPoint location = ScreenPixel::FromUntyped([self convertWindowCoordinates:locationInWindow]);
ScreenIntPoint location = ScreenIntPoint::FromUnknownPoint([self convertWindowCoordinates:locationInWindow]);
static NSTimeInterval sStartTime = [NSDate timeIntervalSinceReferenceDate];
static TimeStamp sStartTimeStamp = TimeStamp::Now();
@ -5007,7 +5007,7 @@ PanGestureTypeForEvent(NSEvent* aEvent)
NSPoint locationInWindowMoved = NSMakePoint(
locationInWindow.x + pixelDeltaX,
locationInWindow.y - pixelDeltaY);
ScreenIntPoint locationMoved = ScreenPixel::FromUntyped(
ScreenIntPoint locationMoved = ScreenIntPoint::FromUnknownPoint(
[self convertWindowCoordinates:locationInWindowMoved]);
ScreenPoint delta = ScreenPoint(locationMoved - location);
ScrollableLayerGuid guid;
@ -5154,7 +5154,7 @@ PanGestureTypeForEvent(NSEvent* aEvent)
// convert point to view coordinate system
NSPoint locationInWindow = nsCocoaUtils::EventLocationForWindow(aMouseEvent, [self window]);
outGeckoEvent->refPoint = LayoutDeviceIntPoint::FromUntyped(
outGeckoEvent->refPoint = LayoutDeviceIntPoint::FromUnknownPoint(
[self convertWindowCoordinates:locationInWindow]);
WidgetMouseEventBase* mouseEvent = outGeckoEvent->AsMouseEventBase();
@ -5687,7 +5687,7 @@ PanGestureTypeForEvent(NSEvent* aEvent)
// Convert event from gecko global coords to gecko view coords.
NSPoint draggingLoc = [aSender draggingLocation];
geckoEvent.refPoint = LayoutDeviceIntPoint::FromUntyped(
geckoEvent.refPoint = LayoutDeviceIntPoint::FromUnknownPoint(
[self convertWindowCoordinates:draggingLoc]);
nsAutoRetainCocoaObject kungFuDeathGrip(self);

View File

@ -1973,7 +1973,7 @@ LayoutDeviceIntPoint nsCocoaWindow::WidgetToScreenOffset()
}
r = nsCocoaUtils::CocoaRectToGeckoRectDevPix(rect, BackingScaleFactor());
return LayoutDeviceIntPoint::FromUntyped(r.TopLeft());
return LayoutDeviceIntPoint::FromUnknownPoint(r.TopLeft());
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0,0));
}

View File

@ -286,7 +286,7 @@ nsWindow::SynthesizeNativeTouchPoint(uint32_t aPointerId,
if (index >= 0) {
// found an existing touch point, update it
SingleTouchData& point = mSynthesizedTouchInput->mTouches[index];
point.mScreenPoint = ScreenIntPoint::FromUntyped(aPointerScreenPoint);
point.mScreenPoint = ScreenIntPoint::FromUnknownPoint(aPointerScreenPoint);
point.mRotationAngle = (float)aPointerOrientation;
point.mForce = (float)aPointerPressure;
inputToDispatch.mType = MultiTouchInput::MULTITOUCH_MOVE;
@ -294,7 +294,7 @@ nsWindow::SynthesizeNativeTouchPoint(uint32_t aPointerId,
// new touch point, add it
mSynthesizedTouchInput->mTouches.AppendElement(SingleTouchData(
(int32_t)aPointerId,
ScreenIntPoint::FromUntyped(aPointerScreenPoint),
ScreenIntPoint::FromUnknownPoint(aPointerScreenPoint),
ScreenSize(0, 0),
(float)aPointerOrientation,
(float)aPointerPressure));
@ -312,7 +312,7 @@ nsWindow::SynthesizeNativeTouchPoint(uint32_t aPointerId,
: MultiTouchInput::MULTITOUCH_CANCEL);
inputToDispatch.mTouches.AppendElement(SingleTouchData(
(int32_t)aPointerId,
ScreenIntPoint::FromUntyped(aPointerScreenPoint),
ScreenIntPoint::FromUnknownPoint(aPointerScreenPoint),
ScreenSize(0, 0),
(float)aPointerOrientation,
(float)aPointerPressure));

View File

@ -56,7 +56,7 @@ public:
void SetDragEndPoint(nsIntPoint aEndDragPoint)
{
mEndDragPoint = mozilla::LayoutDeviceIntPoint::FromUntyped(aEndDragPoint);
mEndDragPoint = mozilla::LayoutDeviceIntPoint::FromUnknownPoint(aEndDragPoint);
}
void SetDragEndPoint(mozilla::LayoutDeviceIntPoint aEndDragPoint)
{

View File

@ -5605,7 +5605,7 @@ nsWindow::ProcessMessage(UINT msg, WPARAM& wParam, LPARAM& lParam,
touchPoint = gestureinfo->ptsLocation;
touchPoint.ScreenToClient(mWnd);
WidgetGestureNotifyEvent gestureNotifyEvent(true, eGestureNotify, this);
gestureNotifyEvent.refPoint = LayoutDeviceIntPoint::FromUntyped(touchPoint);
gestureNotifyEvent.refPoint = LayoutDeviceIntPoint::FromUnknownPoint(touchPoint);
nsEventStatus status;
DispatchEvent(&gestureNotifyEvent, status);
mDisplayPanFeedback = gestureNotifyEvent.displayPanFeedback;
@ -6405,7 +6405,7 @@ bool nsWindow::OnTouch(WPARAM wParam, LPARAM lParam)
// Initialize the touch data.
SingleTouchData touchData(pInputs[i].dwID, // aIdentifier
ScreenIntPoint::FromUntyped(touchPoint), // aScreenPoint
ScreenIntPoint::FromUnknownPoint(touchPoint), // aScreenPoint
/* radius, if known */
pInputs[i].dwFlags & TOUCHINPUTMASKF_CONTACTAREA
? ScreenSize(