--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -1362,17 +1362,17 @@ NS_IMETHODIMP nsAccessible::GetBounds(PR
*x = presContext->AppUnitsToDevPixels(unionRectTwips.x);
*y = presContext->AppUnitsToDevPixels(unionRectTwips.y);
*width = presContext->AppUnitsToDevPixels(unionRectTwips.width);
*height = presContext->AppUnitsToDevPixels(unionRectTwips.height);
// We have the union of the rectangle, now we need to put it in absolute screen coords
- nsIntRect orgRectPixels = aBoundingFrame->GetScreenRectExternal();
+ nsRect orgRectPixels = aBoundingFrame->GetScreenRectExternal();
*x += orgRectPixels.x;
*y += orgRectPixels.y;
return NS_OK;
}
// helpers
--- a/accessible/src/base/nsCaretAccessible.cpp
+++ b/accessible/src/base/nsCaretAccessible.cpp
@@ -339,20 +339,20 @@ nsCaretAccessible::SpellcheckSelectionCh
nsCOMPtr<nsIAccessibleEvent> event =
new nsAccEvent(nsIAccessibleEvent::EVENT_TEXT_ATTRIBUTE_CHANGED,
containerAccessible, nsnull);
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
return mRootAccessible->FireAccessibleEvent(event);
}
-nsIntRect
+nsRect
nsCaretAccessible::GetCaretRect(nsIWidget **aOutWidget)
{
- nsIntRect caretRect;
+ nsRect caretRect;
NS_ENSURE_TRUE(aOutWidget, caretRect);
*aOutWidget = nsnull;
NS_ENSURE_TRUE(mRootAccessible, caretRect);
if (!mLastTextAccessible) {
return caretRect; // Return empty rect
}
@@ -370,37 +370,38 @@ nsCaretAccessible::GetCaretRect(nsIWidge
presShell->GetCaret(getter_AddRefs(caret));
NS_ENSURE_TRUE(caret, caretRect);
PRBool isCollapsed;
nsIView *view;
nsCOMPtr<nsISelection> caretSelection(do_QueryReferent(mLastUsedSelection));
NS_ENSURE_TRUE(caretSelection, caretRect);
- nsRect rect;
caret->GetCaretCoordinates(nsCaret::eRenderingViewCoordinates, caretSelection,
- &rect, &isCollapsed, &view);
- if (!view || rect.IsEmpty()) {
- return nsIntRect(); // Return empty rect
+ &caretRect, &isCollapsed, &view);
+ if (!view || caretRect.IsEmpty()) {
+ return nsRect(); // Return empty rect
}
PRBool isVisible;
caret->GetCaretVisible(&isVisible);
if (!isVisible) {
- return nsIntRect(); // Return empty rect
+ return nsRect(); // Return empty rect
}
nsPoint offsetFromWidget;
*aOutWidget = view->GetNearestWidget(&offsetFromWidget);
- NS_ENSURE_TRUE(*aOutWidget, nsIntRect());
+ NS_ENSURE_TRUE(*aOutWidget, nsRect());
nsPresContext *presContext = presShell->GetPresContext();
- NS_ENSURE_TRUE(presContext, nsIntRect());
+ NS_ENSURE_TRUE(presContext, nsRect());
- rect += offsetFromWidget;
- caretRect = nsRect::ToOutsidePixels(rect, presContext->AppUnitsPerDevPixel());
+ caretRect.x = presContext->AppUnitsToDevPixels(caretRect.x + offsetFromWidget.x);
+ caretRect.y = presContext->AppUnitsToDevPixels(caretRect.y + offsetFromWidget.y);
+ caretRect.width = presContext->AppUnitsToDevPixels(caretRect.width);
+ caretRect.height = presContext->AppUnitsToDevPixels(caretRect.height);
(*aOutWidget)->WidgetToScreen(caretRect, caretRect);
// Correct for character size, so that caret always matches the size of the character
// This is important for font size transitions, and is necessary because the Gecko caret uses the
// previous character's size as the user moves forward in the text by character.
PRInt32 charX, charY, charWidth, charHeight;
if (NS_SUCCEEDED(mLastTextAccessible->GetCharacterExtents(mLastCaretOffset, &charX, &charY,
--- a/accessible/src/base/nsCaretAccessible.h
+++ b/accessible/src/base/nsCaretAccessible.h
@@ -114,17 +114,17 @@ public:
* If the document goes away, this method needs to be called for
* that document by the owner of the caret. We use presShell because
* instead of document because it is more direct than getting it from
* the document, and in any case it is unavailable from the doc after a pagehide.
* @param aShell PresShell for document to no longer listen to selection events from.
*/
nsresult RemoveDocSelectionListener(nsIPresShell *aShell);
- nsIntRect GetCaretRect(nsIWidget **aOutWidget);
+ nsRect GetCaretRect(nsIWidget **aOutWidget);
protected:
nsresult NormalSelectionChanged(nsIDOMDocument *aDoc, nsISelection *aSel);
nsresult SpellcheckSelectionChanged(nsIDOMDocument *aDoc, nsISelection *aSel);
already_AddRefed<nsISelectionController>
GetSelectionControllerForNode(nsIDOMNode *aNode);
--- a/accessible/src/html/nsHTMLAreaAccessible.cpp
+++ b/accessible/src/html/nsHTMLAreaAccessible.cpp
@@ -144,18 +144,17 @@ nsHTMLAreaAccessible::GetBounds(PRInt32
nsIImageFrame *imageFrame;
nsresult rv = frame->QueryInterface(NS_GET_IID(nsIImageFrame), (void**)&imageFrame);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIImageMap> map;
imageFrame->GetImageMap(presContext, getter_AddRefs(map));
NS_ENSURE_TRUE(map, NS_ERROR_FAILURE);
- nsRect rect;
- nsIntRect orgRectPixels;
+ nsRect rect, orgRectPixels;
rv = map->GetBoundsForAreaContent(ourContent, presContext, rect);
NS_ENSURE_SUCCESS(rv, rv);
*x = presContext->AppUnitsToDevPixels(rect.x);
*y = presContext->AppUnitsToDevPixels(rect.y);
// XXX Areas are screwy; they return their rects as a pair of points, one pair
// stored into the width and height.
--- a/accessible/src/html/nsHyperTextAccessible.cpp
+++ b/accessible/src/html/nsHyperTextAccessible.cpp
@@ -296,23 +296,23 @@ nsIntRect nsHyperTextAccessible::GetBoun
frame->GetOffsets(startFrameTextOffset, endFrameTextOffset);
PRInt32 frameTotalTextLength = endFrameTextOffset - startFrameTextOffset;
PRInt32 seekLength = endContentOffset - startContentOffset;
PRInt32 frameSubStringLength = PR_MIN(frameTotalTextLength - startContentOffsetInFrame, seekLength);
// Add the point where the string starts to the frameScreenRect
nsPoint frameTextStartPoint;
rv = frame->GetPointFromOffset(startContentOffset, &frameTextStartPoint);
- NS_ENSURE_SUCCESS(rv, nsIntRect());
+ NS_ENSURE_SUCCESS(rv, nsRect());
frameScreenRect.x += context->AppUnitsToDevPixels(frameTextStartPoint.x);
// Use the point for the end offset to calculate the width
nsPoint frameTextEndPoint;
rv = frame->GetPointFromOffset(startContentOffset + frameSubStringLength, &frameTextEndPoint);
- NS_ENSURE_SUCCESS(rv, nsIntRect());
+ NS_ENSURE_SUCCESS(rv, nsRect());
frameScreenRect.width = context->AppUnitsToDevPixels(frameTextEndPoint.x - frameTextStartPoint.x);
screenRect.UnionRect(frameScreenRect, screenRect);
// Get ready to loop back for next frame continuation
startContentOffset += frameSubStringLength;
startContentOffsetInFrame = 0;
frame = frame->GetNextContinuation();
@@ -1341,22 +1341,22 @@ nsHyperTextAccessible::GetOffsetAtPoint(
this, &coords);
NS_ENSURE_SUCCESS(rv, rv);
// coords are currently screen coordinates, and we need to turn them into
// frame coordinates relative to the current accessible
if (!frameScreenRect.Contains(coords.x, coords.y)) {
return NS_OK; // Not found, will return -1
}
- nsIntPoint pxInHyperText(coords.x - frameScreenRect.x,
+ nsPoint pointInHyperText(coords.x - frameScreenRect.x,
coords.y - frameScreenRect.y);
nsPresContext *context = GetPresContext();
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
- nsPoint pointInHyperText(context->DevPixelsToAppUnits(pxInHyperText.x),
- context->DevPixelsToAppUnits(pxInHyperText.y));
+ pointInHyperText.x = context->DevPixelsToAppUnits(pointInHyperText.x);
+ pointInHyperText.y = context->DevPixelsToAppUnits(pointInHyperText.y);
// Go through the frames to check if each one has the point.
// When one does, add up the character offsets until we have a match
// We have an point in an accessible child of this, now we need to add up the
// offsets before it to what we already have
nsCOMPtr<nsIAccessible> accessible;
PRInt32 offset = 0;
--- a/accessible/src/msaa/nsAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsAccessibleWrap.cpp
@@ -1917,17 +1917,17 @@ void nsAccessibleWrap::UpdateSystemCaret
}
nsRefPtr<nsCaretAccessible> caretAccessible = rootAccessible->GetCaretAccessible();
if (!caretAccessible) {
return;
}
nsIWidget *widget;
- nsIntRect caretRect = caretAccessible->GetCaretRect(&widget);
+ nsRect caretRect = caretAccessible->GetCaretRect(&widget);
HWND caretWnd;
if (caretRect.IsEmpty() || !(caretWnd = (HWND)widget->GetNativeData(NS_NATIVE_WINDOW))) {
return;
}
// Create invisible bitmap for caret, otherwise its appearance interferes
// with Gecko caret
HBITMAP caretBitMap = CreateBitmap(1, caretRect.height, 1, 1, NULL);
--- a/accessible/src/msaa/nsTextAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsTextAccessibleWrap.cpp
@@ -110,31 +110,31 @@ STDMETHODIMP nsTextAccessibleWrap::get_c
/* [in] */ unsigned int aEndIndex,
/* [out] */ int __RPC_FAR *aX,
/* [out] */ int __RPC_FAR *aY,
/* [out] */ int __RPC_FAR *aWidth,
/* [out] */ int __RPC_FAR *aHeight)
{
__try {
*aX = *aY = *aWidth = *aHeight = 0;
- PRInt32 x, y, width, height, docX, docY, docWidth, docHeight;
+ nscoord x, y, width, height, docX, docY, docWidth, docHeight;
HRESULT rv = get_unclippedSubstringBounds(aStartIndex, aEndIndex, &x, &y, &width, &height);
if (FAILED(rv)) {
return rv;
}
nsCOMPtr<nsIAccessibleDocument> docAccessible(GetDocAccessible());
nsCOMPtr<nsIAccessible> accessible(do_QueryInterface(docAccessible));
NS_ASSERTION(accessible, "There must always be a doc accessible, but there isn't");
accessible->GetBounds(&docX, &docY, &docWidth, &docHeight);
- nsIntRect unclippedRect(x, y, width, height);
- nsIntRect docRect(docX, docY, docWidth, docHeight);
- nsIntRect clippedRect;
+ nsRect unclippedRect(x, y, width, height);
+ nsRect docRect(docX, docY, docWidth, docHeight);
+ nsRect clippedRect;
clippedRect.IntersectRect(unclippedRect, docRect);
*aX = clippedRect.x;
*aY = clippedRect.y;
*aWidth = clippedRect.width;
*aHeight = clippedRect.height;
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
@@ -216,21 +216,21 @@ nsresult nsTextAccessibleWrap::GetCharac
nsPoint startPoint, endPoint;
nsIFrame *startFrame = GetPointFromOffset(frame, aStartOffset, PR_TRUE, startPoint);
nsIFrame *endFrame = GetPointFromOffset(frame, aEndOffset, PR_FALSE, endPoint);
if (!startFrame || !endFrame) {
return E_FAIL;
}
- nsIntRect sum(0, 0, 0, 0);
+ nsRect sum(0, 0, 0, 0);
nsIFrame *iter = startFrame;
nsIFrame *stopLoopFrame = endFrame->GetNextContinuation();
for (; iter != stopLoopFrame; iter = iter->GetNextContinuation()) {
- nsIntRect rect = iter->GetScreenRectExternal();
+ nsRect rect = iter->GetScreenRectExternal();
nscoord start = (iter == startFrame) ? presContext->AppUnitsToDevPixels(startPoint.x) : 0;
nscoord end = (iter == endFrame) ? presContext->AppUnitsToDevPixels(endPoint.x) :
rect.width;
rect.x += start;
rect.width = end - start;
sum.UnionRect(sum, rect);
}
--- a/content/base/src/nsImageLoadingContent.cpp
+++ b/content/base/src/nsImageLoadingContent.cpp
@@ -153,17 +153,17 @@ nsImageLoadingContent::~nsImageLoadingCo
/*
* imgIContainerObserver impl
*/
NS_IMETHODIMP
nsImageLoadingContent::FrameChanged(imgIContainer* aContainer,
gfxIImageFrame* aFrame,
- nsIntRect* aDirtyRect)
+ nsRect* aDirtyRect)
{
LOOP_OVER_OBSERVERS(FrameChanged(aContainer, aFrame, aDirtyRect));
return NS_OK;
}
/*
* imgIDecoderObserver impl
*/
@@ -199,17 +199,17 @@ nsImageLoadingContent::OnStartFrame(imgI
{
LOOP_OVER_OBSERVERS(OnStartFrame(aRequest, aFrame));
return NS_OK;
}
NS_IMETHODIMP
nsImageLoadingContent::OnDataAvailable(imgIRequest* aRequest,
gfxIImageFrame* aFrame,
- const nsIntRect* aRect)
+ const nsRect* aRect)
{
LOOP_OVER_OBSERVERS(OnDataAvailable(aRequest, aFrame, aRect));
return NS_OK;
}
NS_IMETHODIMP
nsImageLoadingContent::OnStopFrame(imgIRequest* aRequest,
gfxIImageFrame* aFrame)
--- a/content/events/src/nsDOMUIEvent.cpp
+++ b/content/events/src/nsDOMUIEvent.cpp
@@ -116,63 +116,59 @@ NS_IMPL_RELEASE_INHERITED(nsDOMUIEvent,
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMUIEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMUIEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMNSUIEvent)
NS_INTERFACE_MAP_ENTRY(nsIPrivateCompositionEvent)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(UIEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
-nsIntPoint
-nsDOMUIEvent::GetScreenPoint()
-{
+nsPoint nsDOMUIEvent::GetScreenPoint() {
if (!mEvent ||
(mEvent->eventStructType != NS_MOUSE_EVENT &&
mEvent->eventStructType != NS_POPUP_EVENT &&
mEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
mEvent->eventStructType != NS_DRAG_EVENT)) {
- return nsIntPoint(0, 0);
+ return nsPoint(0, 0);
}
if (!((nsGUIEvent*)mEvent)->widget ) {
return mEvent->refPoint;
}
- nsIntRect bounds(mEvent->refPoint, nsIntSize(1, 1));
- nsIntRect offset;
+ nsRect bounds(mEvent->refPoint, nsSize(1, 1));
+ nsRect offset;
((nsGUIEvent*)mEvent)->widget->WidgetToScreen ( bounds, offset );
- nscoord factor = mPresContext->DeviceContext()->UnscaledAppUnitsPerDevPixel();
- return nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor),
- nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor));
+ PRInt32 factor = mPresContext->DeviceContext()->UnscaledAppUnitsPerDevPixel();
+ return nsPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor),
+ nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor));
}
-nsIntPoint
-nsDOMUIEvent::GetClientPoint()
-{
+nsPoint nsDOMUIEvent::GetClientPoint() {
if (!mEvent ||
(mEvent->eventStructType != NS_MOUSE_EVENT &&
mEvent->eventStructType != NS_POPUP_EVENT &&
mEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
mEvent->eventStructType != NS_DRAG_EVENT) ||
!mPresContext ||
!((nsGUIEvent*)mEvent)->widget) {
return mClientPoint;
}
nsPoint pt(0, 0);
nsIPresShell* shell = mPresContext->GetPresShell();
if (!shell) {
- return nsIntPoint(0, 0);
+ return pt;
}
nsIFrame* rootFrame = shell->GetRootFrame();
if (rootFrame)
pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(mEvent, rootFrame);
- return nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(pt.x),
- nsPresContext::AppUnitsToIntCSSPixels(pt.y));
+ return nsPoint(nsPresContext::AppUnitsToIntCSSPixels(pt.x),
+ nsPresContext::AppUnitsToIntCSSPixels(pt.y));
}
NS_IMETHODIMP
nsDOMUIEvent::GetView(nsIDOMAbstractView** aView)
{
*aView = mView;
NS_IF_ADDREF(*aView);
return NS_OK;
@@ -193,33 +189,33 @@ nsDOMUIEvent::InitUIEvent(const nsAStrin
mDetail = detailArg;
mView = viewArg;
return NS_OK;
}
// ---- nsDOMNSUIEvent implementation -------------------
-nsIntPoint
+nsPoint
nsDOMUIEvent::GetPagePoint()
{
if (mPrivateDataDuplicated) {
return mPagePoint;
}
- nsIntPoint pagePoint(GetClientPoint());
+ nsPoint pagePoint = GetClientPoint();
// If there is some scrolling, add scroll info to client point.
if (mPresContext && mPresContext->GetPresShell()) {
nsIPresShell* shell = mPresContext->GetPresShell();
nsIScrollableFrame* scrollframe = shell->GetRootScrollFrameAsScrollable();
if (scrollframe) {
nsPoint pt = scrollframe->GetScrollPosition();
- pagePoint += nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(pt.x),
- nsPresContext::AppUnitsToIntCSSPixels(pt.y));
+ pagePoint += nsPoint(nsPresContext::AppUnitsToIntCSSPixels(pt.x),
+ nsPresContext::AppUnitsToIntCSSPixels(pt.y));
}
}
return pagePoint;
}
NS_IMETHODIMP
nsDOMUIEvent::GetPageX(PRInt32* aPageX)
@@ -305,37 +301,36 @@ nsDOMUIEvent::SetCancelBubble(PRBool aCa
if (aCancelBubble) {
mEvent->flags |= NS_EVENT_FLAG_STOP_DISPATCH;
} else {
mEvent->flags &= ~NS_EVENT_FLAG_STOP_DISPATCH;
}
return NS_OK;
}
-nsIntPoint
-nsDOMUIEvent::GetLayerPoint()
-{
+nsPoint nsDOMUIEvent::GetLayerPoint() {
if (!mEvent ||
(mEvent->eventStructType != NS_MOUSE_EVENT &&
mEvent->eventStructType != NS_POPUP_EVENT &&
mEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
mEvent->eventStructType != NS_DRAG_EVENT) ||
!mPresContext ||
mEventIsInternal) {
return mLayerPoint;
}
// XXX I'm not really sure this is correct; it's my best shot, though
nsIFrame* targetFrame;
mPresContext->EventStateManager()->GetEventTarget(&targetFrame);
if (!targetFrame)
return mLayerPoint;
nsIFrame* layer = nsLayoutUtils::GetClosestLayer(targetFrame);
nsPoint pt(nsLayoutUtils::GetEventCoordinatesRelativeTo(mEvent, layer));
- return nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(pt.x),
- nsPresContext::AppUnitsToIntCSSPixels(pt.y));
+ pt.x = nsPresContext::AppUnitsToIntCSSPixels(pt.x);
+ pt.y = nsPresContext::AppUnitsToIntCSSPixels(pt.y);
+ return pt;
}
NS_IMETHODIMP
nsDOMUIEvent::GetLayerX(PRInt32* aLayerX)
{
NS_ENSURE_ARG_POINTER(aLayerX);
*aLayerX = GetLayerPoint().x;
return NS_OK;
@@ -389,17 +384,17 @@ NS_METHOD nsDOMUIEvent::GetCompositionRe
NS_METHOD
nsDOMUIEvent::DuplicatePrivateData()
{
mClientPoint = GetClientPoint();
mLayerPoint = GetLayerPoint();
mPagePoint = GetPagePoint();
// GetScreenPoint converts mEvent->refPoint to right coordinates.
- nsIntPoint screenPoint(GetScreenPoint());
+ nsPoint screenPoint = GetScreenPoint();
nsresult rv = nsDOMEvent::DuplicatePrivateData();
if (NS_SUCCEEDED(rv)) {
mEvent->refPoint = screenPoint;
}
return rv;
}
nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
--- a/content/events/src/nsDOMUIEvent.h
+++ b/content/events/src/nsDOMUIEvent.h
@@ -69,27 +69,27 @@ public:
NS_IMETHOD GetCompositionReply(nsTextEventReply** aReply);
// Forward to nsDOMEvent
NS_FORWARD_TO_NSDOMEVENT
protected:
// Internal helper functions
- nsIntPoint GetClientPoint();
- nsIntPoint GetScreenPoint();
- nsIntPoint GetLayerPoint();
- nsIntPoint GetPagePoint();
+ nsPoint GetClientPoint();
+ nsPoint GetScreenPoint();
+ nsPoint GetLayerPoint();
+ nsPoint GetPagePoint();
protected:
nsCOMPtr<nsIDOMAbstractView> mView;
PRInt32 mDetail;
- nsIntPoint mClientPoint;
+ nsPoint mClientPoint;
// Screenpoint is mEvent->refPoint.
- nsIntPoint mLayerPoint;
- nsIntPoint mPagePoint;
+ nsPoint mLayerPoint;
+ nsPoint mPagePoint;
};
#define NS_FORWARD_TO_NSDOMUIEVENT \
NS_FORWARD_NSIDOMUIEVENT(nsDOMUIEvent::) \
NS_FORWARD_TO_NSDOMEVENT
#endif // nsDOMUIEvent_h__
--- a/content/events/src/nsEventListenerManager.cpp
+++ b/content/events/src/nsEventListenerManager.cpp
@@ -1375,17 +1375,17 @@ nsEventListenerManager::FixContextMenuEv
aEvent->refPoint.y = 0;
}
ret = NS_NewDOMMouseEvent(aDOMEvent, aPresContext, static_cast<nsInputEvent*>(aEvent));
NS_ENSURE_SUCCESS(ret, ret);
}
// see if we should use the caret position for the popup
if (contextMenuKey) {
- nsIntPoint caretPoint;
+ nsPoint caretPoint;
// Beware! This may flush notifications via synchronous
// ScrollSelectionIntoView.
if (PrepareToUseCaretPosition(((nsGUIEvent*)aEvent)->widget,
shell, caretPoint)) {
// caret position is good
aEvent->refPoint.x = caretPoint.x;
aEvent->refPoint.y = caretPoint.y;
return NS_OK;
@@ -1408,17 +1408,17 @@ nsEventListenerManager::FixContextMenuEv
if (focusController)
focusController->GetFocusedElement(getter_AddRefs(currentFocus));
}
}
}
if (currentFocus) {
// Reset event coordinates relative to focused frame in view
- nsIntPoint targetPt;
+ nsPoint targetPt;
GetCoordinatesFor(currentFocus, aPresContext, shell, targetPt);
aEvent->refPoint.x = targetPt.x;
aEvent->refPoint.y = targetPt.y;
currentTarget = do_QueryInterface(currentFocus);
nsCOMPtr<nsIPrivateDOMEvent> pEvent(do_QueryInterface(*aDOMEvent));
pEvent->SetTarget(currentTarget);
}
@@ -1436,17 +1436,17 @@ nsEventListenerManager::FixContextMenuEv
// The event widget should be the widget that generated the event, and
// whose coordinate system the resulting event's refPoint should be
// relative to. The returned point is in device pixels realtive to the
// widget passed in.
PRBool
nsEventListenerManager::PrepareToUseCaretPosition(nsIWidget* aEventWidget,
nsIPresShell* aShell,
- nsIntPoint& aTargetPt)
+ nsPoint& aTargetPt)
{
nsresult rv;
// check caret visibility
nsRefPtr<nsCaret> caret;
rv = aShell->GetCaret(getter_AddRefs(caret));
NS_ENSURE_SUCCESS(rv, PR_FALSE);
NS_ENSURE_TRUE(caret, PR_FALSE);
@@ -1529,31 +1529,31 @@ nsEventListenerManager::PrepareToUseCare
// in case the view used for caret coordinates was something else, we need
// to bring those coordinates into the space of the widget view
nsIView* widgetView = nsIView::GetViewFor(aEventWidget);
NS_ENSURE_TRUE(widgetView, PR_FALSE);
nsPoint viewToWidget;
widgetView->GetNearestWidget(&viewToWidget);
nsPoint viewDelta = view->GetOffsetTo(widgetView) + viewToWidget;
- // caret coordinates are in app units, convert to pixels
+ // caret coordinates are in twips, convert to pixels
nsPresContext* presContext = aShell->GetPresContext();
aTargetPt.x = presContext->AppUnitsToDevPixels(viewDelta.x + caretCoords.x + caretCoords.width);
aTargetPt.y = presContext->AppUnitsToDevPixels(viewDelta.y + caretCoords.y + caretCoords.height);
return PR_TRUE;
}
// Get coordinates in device pixels relative to root view for element,
// first ensuring the element is onscreen
void
nsEventListenerManager::GetCoordinatesFor(nsIDOMElement *aCurrentEl,
nsPresContext *aPresContext,
nsIPresShell *aPresShell,
- nsIntPoint& aTargetPt)
+ nsPoint& aTargetPt)
{
nsCOMPtr<nsIContent> focusedContent(do_QueryInterface(aCurrentEl));
aPresShell->ScrollContentIntoView(focusedContent,
NS_PRESSHELL_SCROLL_ANYWHERE,
NS_PRESSHELL_SCROLL_ANYWHERE);
PRBool istree = PR_FALSE, checkLineHeight = PR_TRUE;
PRInt32 extraPixelsY = 0, extraTreeY = 0;
--- a/content/events/src/nsEventListenerManager.h
+++ b/content/events/src/nsEventListenerManager.h
@@ -176,19 +176,19 @@ protected:
const EventTypeData* GetTypeDataForIID(const nsIID& aIID);
const EventTypeData* GetTypeDataForEventName(nsIAtom* aName);
nsresult FixContextMenuEvent(nsPresContext* aPresContext,
nsISupports* aCurrentTarget,
nsEvent* aEvent,
nsIDOMEvent** aDOMEvent);
PRBool PrepareToUseCaretPosition(nsIWidget* aEventWidget,
nsIPresShell* aShell,
- nsIntPoint& aTargetPt);
+ nsPoint& aTargetPt);
void GetCoordinatesFor(nsIDOMElement *aCurrentEl, nsPresContext *aPresContext,
- nsIPresShell *aPresShell, nsIntPoint& aTargetPt);
+ nsIPresShell *aPresShell, nsPoint& aTargetPt);
nsresult GetDOM2EventGroup(nsIDOMEventGroup** aGroup);
PRBool ListenerCanHandle(nsListenerStruct* aLs, nsEvent* aEvent);
nsAutoTObserverArray<nsListenerStruct, 2> mListeners;
nsISupports* mTarget; //WEAK
PRUint32 mMayHaveMutationListeners : 1;
// These two member variables are used to cache the information
// about the last event which was handled but for which event listener manager
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -308,17 +308,17 @@ class nsMouseWheelTransaction {
public:
static nsIFrame* GetTargetFrame() { return sTargetFrame; }
static void BeginTransaction(nsIFrame* aTargetFrame,
nsGUIEvent* aEvent);
static void UpdateTransaction();
static void EndTransaction();
static void OnEvent(nsEvent* aEvent);
protected:
- static nsIntPoint GetScreenPoint(nsGUIEvent* aEvent);
+ static nsPoint GetScreenPoint(nsGUIEvent* aEvent);
static PRUint32 GetTimeoutTime();
static PRUint32 GetIgnoreMoveDelayTime();
static nsWeakFrame sTargetFrame;
static PRUint32 sTime; // in milliseconds
static PRUint32 sMouseMoved; // in milliseconds
};
@@ -380,17 +380,17 @@ nsMouseWheelTransaction::OnEvent(nsEvent
EndTransaction();
}
return;
case NS_MOUSE_MOVE:
case NS_DRAGDROP_OVER:
if (((nsMouseEvent*)aEvent)->reason == nsMouseEvent::eReal) {
// If the cursor is moving to be outside the frame,
// terminate the scrollwheel transaction.
- nsIntPoint pt(GetScreenPoint((nsGUIEvent*)aEvent));
+ nsPoint pt = GetScreenPoint((nsGUIEvent*)aEvent);
nsIntRect r = sTargetFrame->GetScreenRectExternal();
if (!r.Contains(pt)) {
EndTransaction();
return;
}
// If the cursor is moving inside the frame, and it is less than
// ignoremovedelay milliseconds since the last scroll operation, ignore
@@ -411,23 +411,23 @@ nsMouseWheelTransaction::OnEvent(nsEvent
case NS_MOUSE_CLICK:
case NS_CONTEXTMENU:
case NS_DRAGDROP_DROP:
EndTransaction();
return;
}
}
-nsIntPoint
+nsPoint
nsMouseWheelTransaction::GetScreenPoint(nsGUIEvent* aEvent)
{
NS_ASSERTION(aEvent, "aEvent is null");
NS_ASSERTION(aEvent->widget, "aEvent-widget is null");
- nsIntRect tmpRect;
- aEvent->widget->WidgetToScreen(nsIntRect(aEvent->refPoint, nsIntSize(1, 1)),
+ nsRect tmpRect;
+ aEvent->widget->WidgetToScreen(nsRect(aEvent->refPoint, nsSize(1, 1)),
tmpRect);
return tmpRect.TopLeft();
}
PRUint32
nsMouseWheelTransaction::GetTimeoutTime()
{
return (PRUint32)
@@ -1880,18 +1880,18 @@ nsEventStateManager::FireContextClick()
//
void
nsEventStateManager::BeginTrackingDragGesture(nsPresContext* aPresContext,
nsMouseEvent* inDownEvent,
nsIFrame* inDownFrame)
{
// Note that |inDownEvent| could be either a mouse down event or a
// synthesized mouse move event.
- nsIntRect screenPt;
- inDownEvent->widget->WidgetToScreen(nsIntRect(inDownEvent->refPoint, nsIntSize(1, 1)),
+ nsRect screenPt;
+ inDownEvent->widget->WidgetToScreen(nsRect(inDownEvent->refPoint, nsSize(1, 1)),
screenPt);
mGestureDownPoint = screenPt.TopLeft();
inDownFrame->GetContentForEvent(aPresContext, inDownEvent,
getter_AddRefs(mGestureDownContent));
mGestureDownFrameOwner = inDownFrame->GetContent();
mGestureDownShift = inDownEvent->isShift;
@@ -1924,17 +1924,17 @@ void
nsEventStateManager::FillInEventFromGestureDown(nsMouseEvent* aEvent)
{
NS_ASSERTION(aEvent->widget == mCurrentTarget->GetWindow(),
"Incorrect widget in event");
// Set the coordinates in the new event to the coordinates of
// the old event, adjusted for the fact that the widget might be
// different
- nsIntRect tmpRect(0, 0, 1, 1);
+ nsRect tmpRect(0, 0, 1, 1);
aEvent->widget->WidgetToScreen(tmpRect, tmpRect);
aEvent->refPoint = mGestureDownPoint - tmpRect.TopLeft();
aEvent->isShift = mGestureDownShift;
aEvent->isControl = mGestureDownControl;
aEvent->isAlt = mGestureDownAlt;
aEvent->isMeta = mGestureDownMeta;
}
@@ -1985,20 +1985,20 @@ nsEventStateManager::GenerateDragGesture
lf->GetMetric(nsILookAndFeel::eMetric_DragThresholdY, pixelThresholdY);
if (!pixelThresholdX)
pixelThresholdX = 5;
if (!pixelThresholdY)
pixelThresholdY = 5;
}
// fire drag gesture if mouse has moved enough
- nsIntRect tmpRect;
- aEvent->widget->WidgetToScreen(nsIntRect(aEvent->refPoint, nsIntSize(1, 1)),
+ nsRect tmpRect;
+ aEvent->widget->WidgetToScreen(nsRect(aEvent->refPoint, nsSize(1, 1)),
tmpRect);
- nsIntPoint pt(tmpRect.TopLeft());
+ nsPoint pt = tmpRect.TopLeft();
if (PR_ABS(pt.x - mGestureDownPoint.x) > pixelThresholdX ||
PR_ABS(pt.y - mGestureDownPoint.y) > pixelThresholdY) {
#ifdef CLICK_HOLD_CONTEXT_MENUS
// stop the click-hold before we fire off the drag gesture, in case
// it takes a long time
KillClickHoldTimer();
#endif
--- a/content/events/src/nsEventStateManager.h
+++ b/content/events/src/nsEventStateManager.h
@@ -380,17 +380,17 @@ protected:
nsWeakFrame mCurrentTarget;
nsCOMPtr<nsIContent> mCurrentTargetContent;
nsWeakFrame mLastMouseOverFrame;
nsCOMPtr<nsIContent> mLastMouseOverElement;
nsWeakFrame mLastDragOverFrame;
// member variables for the d&d gesture state machine
- nsIntPoint mGestureDownPoint; // screen coordinates
+ nsPoint mGestureDownPoint; // screen coordinates
// The content to use as target if we start a d&d (what we drag).
nsCOMPtr<nsIContent> mGestureDownContent;
// The content of the frame where the mouse-down event occurred. It's the same
// as the target in most cases but not always - for example when dragging
// an <area> of an image map this is the image. (bug 289667)
nsCOMPtr<nsIContent> mGestureDownFrameOwner;
// State of keys when the original gesture-down happened
PRPackedBool mGestureDownShift;
--- a/content/events/src/nsQueryContentEventHandler.cpp
+++ b/content/events/src/nsQueryContentEventHandler.cpp
@@ -432,35 +432,35 @@ nsQueryContentEventHandler::QueryRectFor
nsIFrame* frame;
nsresult rv = GetStartFrameAndOffset(aRange, &frame, &offsetInFrame);
NS_ENSURE_SUCCESS(rv, rv);
nsPoint posInFrame;
rv = frame->GetPointFromOffset(aRange->StartOffset(), &posInFrame);
NS_ENSURE_SUCCESS(rv, rv);
- nsRect rect;
- rect.y = posInFrame.y;
- rect.height = frame->GetSize().height;
+ aEvent->mReply.mRect.y = posInFrame.y;
+ aEvent->mReply.mRect.height = frame->GetSize().height;
if (aEvent->message == NS_QUERY_CHARACTER_RECT) {
nsPoint nextPos;
rv = frame->GetPointFromOffset(aRange->EndOffset(), &nextPos);
NS_ENSURE_SUCCESS(rv, rv);
- rect.x = PR_MIN(posInFrame.x, nextPos.x);
- rect.width = PR_ABS(posInFrame.x - nextPos.x);
+ aEvent->mReply.mRect.x = PR_MIN(posInFrame.x, nextPos.x);
+ aEvent->mReply.mRect.width = PR_ABS(posInFrame.x - nextPos.x);
} else {
- rect.x = posInFrame.x;
- rect.width = aCaret->GetCaretRect().width;
+ aEvent->mReply.mRect.x = posInFrame.x;
+ aEvent->mReply.mRect.width = aCaret->GetCaretRect().width;
}
- rv = ConvertToRootViewRelativeOffset(frame, rect);
+ // The coordinates are app units here, they will be converted to system
+ // coordinates by view manager.
+ rv = ConvertToRootViewRelativeOffset(frame, aEvent->mReply.mRect);
NS_ENSURE_SUCCESS(rv, rv);
- aEvent->mReply.mRect = nsRect::ToOutsidePixels(rect, mPresContext->AppUnitsPerDevPixel());
aEvent->mSucceeded = PR_TRUE;
return NS_OK;
}
nsresult
nsQueryContentEventHandler::OnQueryCharacterRect(nsQueryContentEvent* aEvent)
{
nsresult rv = Init(aEvent);
@@ -499,21 +499,19 @@ nsQueryContentEventHandler::OnQueryCaret
NS_ENSURE_SUCCESS(rv, rv);
if (selectionIsCollapsed) {
PRUint32 offset;
rv = GetFlatTextOffsetOfRange(mFirstSelectedRange, &offset);
NS_ENSURE_SUCCESS(rv, rv);
if (offset == aEvent->mInput.mOffset) {
PRBool isCollapsed;
- nsRect rect;
rv = caret->GetCaretCoordinates(nsCaret::eTopLevelWindowCoordinates,
- mSelection, &rect,
+ mSelection, &aEvent->mReply.mRect,
&isCollapsed, nsnull);
- aEvent->mReply.mRect = nsRect::ToOutsidePixels(rect, mPresContext->AppUnitsPerDevPixel());
NS_ENSURE_SUCCESS(rv, rv);
aEvent->mSucceeded = PR_TRUE;
return NS_OK;
}
}
// Otherwise, we should set the guessed caret rect.
nsCOMPtr<nsIRange> range = new nsRange();
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -5490,17 +5490,17 @@ nsDocShell::CaptureState()
if (shell) {
nsIViewManager *vm = shell->GetViewManager();
if (vm) {
nsIView *rootView = nsnull;
vm->GetRootView(rootView);
if (rootView) {
nsIWidget *widget = rootView->GetWidget();
if (widget) {
- nsIntRect bounds(0, 0, 0, 0);
+ nsRect bounds(0, 0, 0, 0);
widget->GetBounds(bounds);
rv = mOSHE->SetViewerBounds(bounds);
}
}
}
}
// Capture the docshell hierarchy.
@@ -5815,17 +5815,17 @@ nsDocShell::RestoreFromHistory()
}
}
// Save off the root view's parent and sibling so that we can insert the
// new content viewer's root view at the same position. Also save the
// bounds of the root view's widget.
nsIView *rootViewSibling = nsnull, *rootViewParent = nsnull;
- nsIntRect newBounds(0, 0, 0, 0);
+ nsRect newBounds(0, 0, 0, 0);
nsCOMPtr<nsIPresShell> oldPresShell;
nsDocShell::GetPresShell(getter_AddRefs(oldPresShell));
if (oldPresShell) {
nsIViewManager *vm = oldPresShell->GetViewManager();
if (vm) {
nsIView *oldRootView = nsnull;
vm->GetRootView(oldRootView);
@@ -5871,17 +5871,17 @@ nsDocShell::RestoreFromHistory()
PRInt32 i = 0;
nsCOMPtr<nsIDocShellTreeItem> child;
while (NS_SUCCEEDED(mLSHE->ChildShellAt(i++, getter_AddRefs(child))) &&
child) {
childShells.AppendObject(child);
}
// get the previous content viewer size
- nsIntRect oldBounds(0, 0, 0, 0);
+ nsRect oldBounds(0, 0, 0, 0);
mLSHE->GetViewerBounds(oldBounds);
// Restore the refresh URI list. The refresh timers will be restarted
// when EndPageLoad() is called.
nsCOMPtr<nsISupportsArray> refreshURIList;
mLSHE->GetRefreshURIList(getter_AddRefs(refreshURIList));
// Reattach to the window object.
@@ -6445,17 +6445,17 @@ nsDocShell::SetupNewViewer(nsIContentVie
mContentViewer = nsnull;
}
mContentViewer = aNewViewer;
nsCOMPtr<nsIWidget> widget;
NS_ENSURE_SUCCESS(GetMainWidget(getter_AddRefs(widget)), NS_ERROR_FAILURE);
- nsIntRect bounds(x, y, cx, cy);
+ nsRect bounds(x, y, cx, cy);
if (NS_FAILED(mContentViewer->Init(widget, bounds))) {
mContentViewer = nsnull;
NS_ERROR("ContentViewer Initialization failed");
return NS_ERROR_FAILURE;
}
// If we have old state to copy, set the old state onto the new content
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -615,30 +615,30 @@ protected:
/**
* Content-Type Hint of the most-recently initiated load. Used for
* session history entries.
*/
nsCString mContentTypeHint;
nsCOMPtr<nsISupportsArray> mRefreshURIList;
nsCOMPtr<nsISupportsArray> mSavedRefreshURIList;
nsRefPtr<nsDSURIContentListener> mContentListener;
- nsIntRect mBounds; // Dimensions of the docshell
+ nsRect mBounds; // Dimensions of the docshell
nsCOMPtr<nsIContentViewer> mContentViewer;
nsCOMPtr<nsIDocumentCharsetInfo> mDocumentCharsetInfo;
nsCOMPtr<nsIWidget> mParentWidget;
nsCOMPtr<nsIPrefBranch> mPrefs;
// mCurrentURI should be marked immutable on set if possible.
nsCOMPtr<nsIURI> mCurrentURI;
nsCOMPtr<nsIURI> mReferrerURI;
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobal;
nsCOMPtr<nsISHistory> mSessionHistory;
nsCOMPtr<nsIGlobalHistory2> mGlobalHistory;
nsCOMPtr<nsIWebBrowserFind> mFind;
- nsIntPoint mDefaultScrollbarPref; // persistent across doc loads
+ nsPoint mDefaultScrollbarPref; // persistent across doc loads
// Reference to the SHEntry for this docshell until the page is destroyed.
// Somebody give me better name
nsCOMPtr<nsISHEntry> mOSHE;
// Reference to the SHEntry for this docshell until the page is loaded
// Somebody give me better name
nsCOMPtr<nsISHEntry> mLSHE;
// Holds a weak pointer to a RestorePresentationEvent object if any that
--- a/docshell/base/nsIContentViewer.idl
+++ b/docshell/base/nsIContentViewer.idl
@@ -2,28 +2,28 @@
interface nsIDOMDocument;
interface nsISHEntry;
interface nsIPrintSettings;
%{ C++
class nsIWidget;
-struct nsIntRect;
+struct nsRect;
%}
[ptr] native nsIWidgetPtr(nsIWidget);
-[ref] native nsIntRectRef(nsIntRect);
+[ref] native nsRectRef(nsRect);
-[scriptable, uuid(c9aba5da-7d8b-46a8-87cd-9ab7e16480b8)]
+[scriptable, uuid(05b290ac-d880-4900-bb1f-2211b5f8accc)]
interface nsIContentViewer : nsISupports
{
[noscript] void init(in nsIWidgetPtr aParentWidget,
- [const] in nsIntRectRef aBounds);
+ [const] in nsRectRef aBounds);
attribute nsISupports container;
void loadStart(in nsISupports aDoc);
void loadComplete(in unsigned long aStatus);
boolean permitUnload();
void pageHide(in boolean isUnload);
@@ -50,18 +50,18 @@ interface nsIContentViewer : nsISupports
*/
void close(in nsISHEntry historyEntry);
void destroy();
void stop();
attribute nsIDOMDocument DOMDocument;
- [noscript] void getBounds(in nsIntRectRef aBounds);
- [noscript] void setBounds([const] in nsIntRectRef aBounds);
+ [noscript] void getBounds(in nsRectRef aBounds);
+ [noscript] void setBounds([const] in nsRectRef aBounds);
/**
* The previous content viewer, which has been |close|d but not
* |destroy|ed.
*/
[noscript] attribute nsIContentViewer previousViewer;
void move(in long aX, in long aY);
--- a/docshell/shistory/public/nsISHEntry.idl
+++ b/docshell/shistory/public/nsISHEntry.idl
@@ -46,24 +46,24 @@
interface nsILayoutHistoryState;
interface nsIContentViewer;
interface nsIURI;
interface nsIInputStream;
interface nsIDocShellTreeItem;
interface nsISupportsArray;
%{C++
-struct nsIntRect;
+struct nsRect;
class nsDocShellEditorData;
%}
-[ref] native nsIntRect(nsIntRect);
+[ref] native nsRect(nsRect);
[ptr] native nsDocShellEditorDataPtr(nsDocShellEditorData);
-[scriptable, uuid(09fecea6-5453-43ba-bf91-3ff32618f037)]
+[scriptable, uuid(c16fde76-3108-450e-8c8c-ae8286f286ed)]
interface nsISHEntry : nsIHistoryEntry
{
/** URI for the document */
void setURI(in nsIURI aURI);
/** Referrer URI */
attribute nsIURI referrerURI;
@@ -76,18 +76,18 @@ interface nsISHEntry : nsIHistoryEntry
/** Saved state of the global window object */
attribute nsISupports windowState;
/**
* Saved position and dimensions of the content viewer; we must adjust the
* root view's widget accordingly if this has changed when the presentation
* is restored.
*/
- [noscript] void getViewerBounds(in nsIntRect bounds);
- [noscript] void setViewerBounds([const] in nsIntRect bounds);
+ [noscript] void getViewerBounds(in nsRect bounds);
+ [noscript] void setViewerBounds([const] in nsRect bounds);
/**
* Saved child docshells corresponding to contentViewer. The child shells
* are restored as children of the parent docshell, in this order, when the
* parent docshell restores a saved presentation.
*/
/** Append a child shell to the end of our list. */
--- a/docshell/shistory/src/nsSHEntry.cpp
+++ b/docshell/shistory/src/nsSHEntry.cpp
@@ -531,24 +531,24 @@ nsSHEntry::SetWindowState(nsISupports *a
NS_IMETHODIMP
nsSHEntry::GetWindowState(nsISupports **aState)
{
NS_IF_ADDREF(*aState = mWindowState);
return NS_OK;
}
NS_IMETHODIMP
-nsSHEntry::SetViewerBounds(const nsIntRect &aBounds)
+nsSHEntry::SetViewerBounds(const nsRect &aBounds)
{
mViewerBounds = aBounds;
return NS_OK;
}
NS_IMETHODIMP
-nsSHEntry::GetViewerBounds(nsIntRect &aBounds)
+nsSHEntry::GetViewerBounds(nsRect &aBounds)
{
aBounds = mViewerBounds;
return NS_OK;
}
NS_IMETHODIMP
nsSHEntry::GetOwner(nsISupports **aOwner)
{
--- a/docshell/shistory/src/nsSHEntry.h
+++ b/docshell/shistory/src/nsSHEntry.h
@@ -105,17 +105,17 @@ private:
PRPackedBool mIsFrameNavigation;
PRPackedBool mSaveLayoutState;
PRPackedBool mExpired;
PRPackedBool mSticky;
nsCString mContentType;
nsCOMPtr<nsISupports> mCacheKey;
nsISHEntry * mParent; // weak reference
nsCOMPtr<nsISupports> mWindowState;
- nsIntRect mViewerBounds;
+ nsRect mViewerBounds;
nsCOMArray<nsIDocShellTreeItem> mChildShells;
nsCOMPtr<nsISupportsArray> mRefreshURIList;
nsCOMPtr<nsISupports> mOwner;
nsExpirationState mExpirationState;
nsAutoPtr<nsDocShellEditorData> mEditorData;
};
#endif /* nsSHEntry_h */
--- a/editor/libeditor/base/nsEditor.cpp
+++ b/editor/libeditor/base/nsEditor.cpp
@@ -1978,33 +1978,28 @@ nsEditor::QueryComposition(nsTextEventRe
if (restoreFlags)
SetFlags(flags);
}
// XXX_kin: END HACK! HACK! HACK!
nsIView *view = nsnull;
- nsRect rect;
result =
caretP->GetCaretCoordinates(nsCaret::eRenderingViewCoordinates,
selection,
- &rect,
+ &(aReply->mCursorPosition),
&(aReply->mCursorIsCollapsed),
&view);
- aReply->mCursorPosition =
- nsRect::ToOutsidePixels(rect,
- ps->GetPresContext()->AppUnitsPerDevPixel());
if (NS_SUCCEEDED(result) && view)
aReply->mReferenceWidget = view->GetWidget();
}
}
return result;
}
-
NS_IMETHODIMP
nsEditor::BeginComposition(nsTextEventReply* aReply)
{
#ifdef DEBUG_tague
printf("nsEditor::StartComposition\n");
#endif
nsresult ret = QueryComposition(aReply);
mInIMEMode = PR_TRUE;
--- a/editor/libeditor/text/nsPlaintextEditor.cpp
+++ b/editor/libeditor/text/nsPlaintextEditor.cpp
@@ -1732,25 +1732,21 @@ nsPlaintextEditor::SetCompositionString(
SetFlags(flags);
// XXX_kin: END HACK! HACK! HACK!
}
if (caretP)
{
nsIView *view = nsnull;
- nsRect rect;
result = caretP->GetCaretCoordinates(nsCaret::eRenderingViewCoordinates,
selection,
- &rect,
+ &(aReply->mCursorPosition),
&(aReply->mCursorIsCollapsed),
&view);
- aReply->mCursorPosition =
- nsRect::ToOutsidePixels(rect,
- ps->GetPresContext()->AppUnitsPerDevPixel());
NS_ASSERTION(NS_SUCCEEDED(result), "cannot get caret position");
if (NS_SUCCEEDED(result) && view)
aReply->mReferenceWidget = view->GetWidget();
}
return result;
}
--- a/embedding/browser/gtk/src/EmbedContextMenuInfo.cpp
+++ b/embedding/browser/gtk/src/EmbedContextMenuInfo.cpp
@@ -89,17 +89,17 @@ EmbedContextMenuInfo::EmbedContextMenuIn
{
mOwner = aOwner;
mEventNode = nsnull;
mCtxDocument = nsnull;
mNSHHTMLElement = nsnull;
mNSHHTMLElementSc = nsnull;
mCtxEvent = nsnull;
mEventNode = nsnull;
- mFormRect = nsIntRect(0,0,0,0);
+ mFormRect = nsRect(0,0,0,0);
}
EmbedContextMenuInfo::~EmbedContextMenuInfo(void)
{
mEventNode = nsnull;
mCtxDocument = nsnull;
mNSHHTMLElement = nsnull;
mNSHHTMLElementSc = nsnull;
--- a/embedding/browser/gtk/src/EmbedContextMenuInfo.h
+++ b/embedding/browser/gtk/src/EmbedContextMenuInfo.h
@@ -79,17 +79,17 @@ public:
PRInt32 mX, mY, mObjWidth, mObjHeight, mCtxFrameNum;
nsString mCtxURI, mCtxHref, mCtxImgHref;
PRUint32 mEmbedCtxType;
PRInt32 mCtxFormType;
nsCOMPtr<nsIDOMNode> mEventNode;
nsCOMPtr<nsIDOMEventTarget> mEventTarget;
nsCOMPtr<nsIDOMDocument>mCtxDocument;
- nsIntRect mFormRect;
+ nsRect mFormRect;
nsCOMPtr<nsIDOMWindow> mCtxDomWindow;
nsCOMPtr<nsIDOMEvent> mCtxEvent;
nsCOMPtr<nsIDOMNSHTMLElement> mNSHHTMLElement;
nsCOMPtr<nsIDOMNSHTMLElement> mNSHHTMLElementSc;
private:
nsresult SetFrameIndex();
nsresult SetFormControlType(nsIDOMEventTarget *originalTarget);
nsresult CheckDomHtmlNode(nsIDOMNode *aNode = nsnull);
--- a/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp
+++ b/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp
@@ -1477,18 +1477,18 @@ ChromeTooltipListener::sTooltipCallback(
PRBool textFound = PR_FALSE;
self->mTooltipTextProvider->GetNodeText(
self->mPossibleTooltipNode, getter_Copies(tooltipText), &textFound);
if (textFound) {
nsString tipText(tooltipText);
self->CreateAutoHideTimer();
- nsIntRect widgetDot(0, 0, 1, 1);
- nsIntRect screenDot;
+ nsRect widgetDot(0, 0, 1, 1);
+ nsRect screenDot;
widget->WidgetToScreen(widgetDot, screenDot);
self->ShowTooltip (self->mMouseScreenX - screenDot.x,
self->mMouseScreenY - screenDot.y,
tipText);
}
}
// release tooltip target if there is one, NO MATTER WHAT
--- a/embedding/browser/webBrowser/nsWebBrowser.cpp
+++ b/embedding/browser/webBrowser/nsWebBrowser.cpp
@@ -1124,17 +1124,17 @@ NS_IMETHODIMP nsWebBrowser::Create()
docShellParentWidget = mInternalWidget;
nsWidgetInitData widgetInit;
widgetInit.clipChildren = PR_TRUE;
widgetInit.mContentType = (mContentType == typeChrome ||
mContentType == typeChromeWrapper)? eContentTypeUI: eContentTypeContent;
widgetInit.mWindowType = eWindowType_child;
- nsIntRect bounds(mInitInfo->x, mInitInfo->y, mInitInfo->cx, mInitInfo->cy);
+ nsRect bounds(mInitInfo->x, mInitInfo->y, mInitInfo->cx, mInitInfo->cy);
mInternalWidget->SetClientData(static_cast<nsWebBrowser *>(this));
mInternalWidget->Create(mParentNativeWindow, bounds, nsWebBrowser::HandleEvent,
nsnull, nsnull, nsnull, &widgetInit);
}
nsCOMPtr<nsIDocShell> docShell(do_CreateInstance("@mozilla.org/webshell;1"));
NS_ENSURE_SUCCESS(SetDocShell(docShell), NS_ERROR_FAILURE);
@@ -1312,17 +1312,17 @@ NS_IMETHODIMP nsWebBrowser::GetPositionA
*aCX = mInitInfo->cx;
if(aCY)
*aCY = mInitInfo->cy;
}
else
{
if(mInternalWidget)
{
- nsIntRect bounds;
+ nsRect bounds;
NS_ENSURE_SUCCESS(mInternalWidget->GetBounds(bounds), NS_ERROR_FAILURE);
if(aX)
*aX = bounds.x;
if(aY)
*aY = bounds.y;
if(aCX)
*aCX = bounds.width;
--- a/embedding/components/printingui/src/win/nsPrintDialogUtil.cpp
+++ b/embedding/components/printingui/src/win/nsPrintDialogUtil.cpp
@@ -508,17 +508,17 @@ static void Show(HWND aWnd, PRBool bStat
//--------------------------------------------------------
// Create a child window "control"
static HWND CreateControl(LPCTSTR aType,
DWORD aStyle,
HINSTANCE aHInst,
HWND aHdlg,
int aId,
const nsAString& aStr,
- const nsIntRect& aRect)
+ const nsRect& aRect)
{
nsCAutoString str;
if (NS_FAILED(NS_CopyUnicodeToNative(aStr, str)))
return NULL;
HWND hWnd = ::CreateWindow (aType, str.get(),
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | aStyle,
aRect.x, aRect.y, aRect.width, aRect.height,
@@ -536,30 +536,30 @@ static HWND CreateControl(LPCTSTR
}
//--------------------------------------------------------
// Create a Radio Button
static HWND CreateRadioBtn(HINSTANCE aHInst,
HWND aHdlg,
int aId,
const char* aStr,
- const nsIntRect& aRect)
+ const nsRect& aRect)
{
nsString cStr;
cStr.AssignWithConversion(aStr);
return CreateControl("BUTTON", BS_RADIOBUTTON, aHInst, aHdlg, aId, cStr, aRect);
}
//--------------------------------------------------------
// Create a Group Box
static HWND CreateGroupBox(HINSTANCE aHInst,
HWND aHdlg,
int aId,
const nsAString& aStr,
- const nsIntRect& aRect)
+ const nsRect& aRect)
{
return CreateControl("BUTTON", BS_GROUPBOX, aHInst, aHdlg, aId, aStr, aRect);
}
//--------------------------------------------------------
// Localizes and initializes the radio buttons and group
static void InitializeExtendedDialog(HWND hdlg, PRInt16 aHowToEnableFrameUI)
{
@@ -660,17 +660,17 @@ static UINT CALLBACK PrintHookProc(HWND
int rbGap = rad3Rect.top - rad1Rect.bottom; // gap between radiobtns
int grpBotGap = dlgRect.bottom - rad2Rect.bottom; // gap from bottom rb to bottom of grpbox
int grpGap = dlgRect.top - prtRect.bottom ; // gap between group boxes
int top = dlgRect.bottom + grpGap;
int radHgt = rad1Rect.bottom - rad1Rect.top + 1; // top of new group box
int y = top+(rad1Rect.top-dlgRect.top); // starting pos of first radio
int rbWidth = dlgRect.right - rad1Rect.left - 5; // measure from rb left to the edge of the groupbox
// (5 is arbitrary)
- nsIntRect rect;
+ nsRect rect;
// Create and position the radio buttons
//
// If any one control cannot be created then
// hide the others and bail out
//
rect.SetRect(rad1Rect.left, y, rbWidth,radHgt);
HWND rad4Wnd = CreateRadioBtn(hInst, hdlg, rad4, kAsLaidOutOnScreenStr, rect);
--- a/gfx/public/nsITheme.h
+++ b/gfx/public/nsITheme.h
@@ -41,30 +41,30 @@
#ifndef nsITheme_h_
#define nsITheme_h_
#include "nsISupports.h"
#include "nsCOMPtr.h"
#include "nsColor.h"
struct nsRect;
-struct nsIntSize;
+struct nsSize;
struct nsFont;
-struct nsIntMargin;
+struct nsMargin;
class nsPresContext;
class nsIRenderingContext;
class nsIDeviceContext;
class nsIFrame;
class nsIContent;
class nsIAtom;
// IID for the nsITheme interface
-// {887e8902-db6b-41b4-8481-a80f49c5a93a}
+// {df8baf21-5ea7-49eb-a2bc-f2fd4a9fd896}
#define NS_ITHEME_IID \
-{ 0x887e8902, 0xdb6b, 0x41b4, { 0x84, 0x81, 0xa8, 0x0f, 0x49, 0xc5, 0xa9, 0x3a } }
+{ 0xdf8baf21, 0x5ea7, 0x49eb, { 0xa2, 0xbc, 0xf2, 0xfd, 0x4a, 0x9f, 0xd8, 0x96 } }
// {D930E29B-6909-44e5-AB4B-AF10D6923705}
#define NS_THEMERENDERER_CID \
{ 0xd930e29b, 0x6909, 0x44e5, { 0xab, 0x4b, 0xaf, 0x10, 0xd6, 0x92, 0x37, 0x5 } }
/**
* nsITheme is a service that provides platform-specific native
* rendering for widgets. In other words, it provides the necessary
@@ -86,31 +86,31 @@ public:
const nsRect& aDirtyRect)=0;
/**
* Get the computed CSS border for the widget, in pixels.
*/
NS_IMETHOD GetWidgetBorder(nsIDeviceContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntMargin* aResult)=0;
+ nsMargin* aResult)=0;
/**
* This method can return PR_FALSE to indicate that the CSS padding
* value should be used. Otherwise, it will fill in aResult with the
* computed padding, in pixels, and return PR_TRUE.
*
* XXXldb This ought to be required to return true for non-containers
* so that we don't let specified padding that has no effect change
* the computed padding and potentially the size.
*/
virtual PRBool GetWidgetPadding(nsIDeviceContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntMargin* aResult) = 0;
+ nsMargin* aResult) = 0;
/**
* On entry, *aResult is positioned at 0,0 and sized to the new size
* of aFrame (aFrame->GetSize() may be stale and should not be used).
* This method can return PR_FALSE to indicate that no special
* overflow area is required by the native widget. Otherwise it will
* fill in aResult with the desired overflow area, in appunits, relative
* to the frame origin, and return PR_TRUE.
@@ -125,17 +125,17 @@ public:
* Get the minimum border-box size of a widget, in *pixels* (in
* |aResult|). If |aIsOverridable| is set to true, this size is a
* minimum size; if false, this size is the only valid size for the
* widget.
*/
NS_IMETHOD GetMinimumWidgetSize(nsIRenderingContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntSize* aResult,
+ nsSize* aResult,
PRBool* aIsOverridable)=0;
NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
nsIAtom* aAttribute, PRBool* aShouldRepaint)=0;
NS_IMETHOD ThemeChanged()=0;
/**
--- a/gfx/public/nsMargin.h
+++ b/gfx/public/nsMargin.h
@@ -100,39 +100,24 @@ struct nsMargin {
return *this;}
nsMargin& operator-=(const nsMargin& aMargin) {left -= aMargin.left;
top -= aMargin.top;
right -= aMargin.right;
bottom -= aMargin.bottom;
return *this;}
};
+#ifdef NS_COORD_IS_FLOAT
struct nsIntMargin {
PRInt32 top, right, bottom, left;
// Constructors
nsIntMargin() {}
nsIntMargin(const nsIntMargin& aMargin) {*this = aMargin;}
nsIntMargin(PRInt32 aLeft, PRInt32 aTop,
PRInt32 aRight, PRInt32 aBottom) {left = aLeft; top = aTop;
right = aRight; bottom = aBottom;}
- void SizeTo(PRInt32 aLeft, PRInt32 aTop,
- PRInt32 aRight, PRInt32 aBottom) {left = aLeft; top = aTop;
- right = aRight; bottom = aBottom;}
- PRInt32& side(PRUint8 aSide) {
- NS_PRECONDITION(aSide <= NS_SIDE_LEFT, "Out of range side");
- return *(&top + aSide);
- }
-
- PRInt32 side(PRUint8 aSide) const {
- NS_PRECONDITION(aSide <= NS_SIDE_LEFT, "Out of range side");
- return *(&top + aSide);
- }
- PRInt32 LeftRight() const { return left + right; }
- PRInt32 TopBottom() const { return top + bottom; }
-
- nsIntMargin operator+(const nsIntMargin& aMargin) const {
- return nsIntMargin(left + aMargin.left, top + aMargin.top,
- right + aMargin.right, bottom + aMargin.bottom);
- }
};
+#else
+typedef nsMargin nsIntMargin;
+#endif
#endif /* NSMARGIN_H */
--- a/gfx/public/nsPoint.h
+++ b/gfx/public/nsPoint.h
@@ -76,42 +76,64 @@ struct nsPoint {
return *this;
}
nsPoint operator-() const {
return nsPoint(-x, -y);
}
};
+#ifdef NS_COORD_IS_FLOAT
struct nsIntPoint {
PRInt32 x, y;
// Constructors
nsIntPoint() {}
nsIntPoint(const nsIntPoint& aPoint) { x = aPoint.x; y = aPoint.y;}
nsIntPoint(PRInt32 aX, PRInt32 aY) { x = aX; y = aY;}
- PRBool operator==(const nsIntPoint& aPoint) const {
+ void MoveTo(PRInt32 aX, PRInt32 aY) {x = aX; y = aY;}
+};
+
+typedef nsPoint nsFloatPoint;
+#else
+typedef nsPoint nsIntPoint;
+
+struct nsFloatPoint {
+ float x, y;
+
+ // Constructors
+ nsFloatPoint() {}
+ nsFloatPoint(const nsFloatPoint& aPoint) {x = aPoint.x; y = aPoint.y;}
+ nsFloatPoint(float aX, float aY) {x = aX; y = aY;}
+
+ void MoveTo(float aX, float aY) {x = aX; y = aY;}
+ void MoveTo(nscoord aX, nscoord aY) {x = (float)aX; y = (float)aY;}
+ void MoveBy(float aDx, float aDy) {x += aDx; y += aDy;}
+
+ // Overloaded operators. Note that '=' isn't defined so we'll get the
+ // compiler generated default assignment operator
+ PRBool operator==(const nsFloatPoint& aPoint) const {
return (PRBool) ((x == aPoint.x) && (y == aPoint.y));
}
- PRBool operator!=(const nsIntPoint& aPoint) const {
+ PRBool operator!=(const nsFloatPoint& aPoint) const {
return (PRBool) ((x != aPoint.x) || (y != aPoint.y));
}
- nsIntPoint operator+(const nsIntPoint& aPoint) const {
- return nsIntPoint(x + aPoint.x, y + aPoint.y);
+ nsFloatPoint operator+(const nsFloatPoint& aPoint) const {
+ return nsFloatPoint(x + aPoint.x, y + aPoint.y);
}
- nsIntPoint operator-(const nsIntPoint& aPoint) const {
- return nsIntPoint(x - aPoint.x, y - aPoint.y);
+ nsFloatPoint operator-(const nsFloatPoint& aPoint) const {
+ return nsFloatPoint(x - aPoint.x, y - aPoint.y);
}
- nsIntPoint& operator+=(const nsIntPoint& aPoint) {
+ nsFloatPoint& operator+=(const nsFloatPoint& aPoint) {
x += aPoint.x;
y += aPoint.y;
return *this;
}
- nsIntPoint& operator-=(const nsIntPoint& aPoint) {
+ nsFloatPoint& operator-=(const nsFloatPoint& aPoint) {
x -= aPoint.x;
y -= aPoint.y;
return *this;
}
- void MoveTo(PRInt32 aX, PRInt32 aY) {x = aX; y = aY;}
};
+#endif // !NS_COORD_IS_FLOAT
#endif /* NSPOINT_H */
--- a/gfx/public/nsRect.h
+++ b/gfx/public/nsRect.h
@@ -42,18 +42,16 @@
#include <stdio.h>
#include "nsCoord.h"
#include "nsPoint.h"
#include "nsSize.h"
#include "nsMargin.h"
#include "gfxCore.h"
#include "nsTraceRefcnt.h"
-struct nsIntRect;
-
struct NS_GFX nsRect {
nscoord x, y;
nscoord width, height;
// Constructors
nsRect() : x(0), y(0), width(0), height(0) {
MOZ_COUNT_CTOR(nsRect);
}
@@ -165,216 +163,91 @@ struct NS_GFX nsRect {
return nsRect(x + aPoint.x, y + aPoint.y, width, height);
}
nsRect operator-(const nsPoint& aPoint) const {
return nsRect(x - aPoint.x, y - aPoint.y, width, height);
}
nsRect& operator+=(const nsPoint& aPoint) {x += aPoint.x; y += aPoint.y; return *this;}
nsRect& operator-=(const nsPoint& aPoint) {x -= aPoint.x; y -= aPoint.y; return *this;}
+ nsRect& operator*=(const float aScale) {x = NSToCoordRound(x * aScale);
+ y = NSToCoordRound(y * aScale);
+ width = NSToCoordRound(width * aScale);
+ height = NSToCoordRound(height * aScale);
+ return *this;}
+
+ // Scale by aScale, converting coordinates to integers so that the result
+ // is the smallest integer-coordinate rectangle containing the unrounded result
+ nsRect& ScaleRoundOut(float aScale);
+ // Scale by the inverse of aScale, converting coordinates to integers so that the result
+ // is the smallest integer-coordinate rectangle containing the unrounded result.
+ // More accurate than ScaleRoundOut(1.0/aScale).
+ nsRect& ScaleRoundOutInverse(float aScale);
+ // Scale by aScale, converting coordinates to integers so that the result
+ // is the larges integer-coordinate rectangle contained in the unrounded result
+ nsRect& ScaleRoundIn(float aScale);
+ // Scale by the inverse of aScale, converting coordinates to integers so that
+ // the result contains the same pixel centers as the unrounded result
+ nsRect& ScaleRoundPreservingCentersInverse(float aScale);
+
// Helpers for accessing the vertices
nsPoint TopLeft() const { return nsPoint(x, y); }
nsPoint TopRight() const { return nsPoint(XMost(), y); }
nsPoint BottomLeft() const { return nsPoint(x, YMost()); }
nsPoint BottomRight() const { return nsPoint(XMost(), YMost()); }
nsSize Size() const { return nsSize(width, height); }
// Helper methods for computing the extents
nscoord XMost() const {return x + width;}
nscoord YMost() const {return y + height;}
-
- inline nsRect ScaleRoundOutInverse(float aFactor);
-
- static inline nsIntRect ToNearestPixels(const nsRect &aRect, nscoord aAppUnitsPerPixel);
- static inline nsIntRect ToOutsidePixels(const nsRect &aRect, nscoord aAppUnitsPerPixel);
- static inline nsIntRect ToInsidePixels(const nsRect &aRect, nscoord aAppUnitsPerPixel);
};
+#ifdef NS_COORD_IS_FLOAT
struct NS_GFX nsIntRect {
PRInt32 x, y;
PRInt32 width, height;
// Constructors
nsIntRect() : x(0), y(0), width(0), height(0) {}
nsIntRect(const nsIntRect& aRect) {*this = aRect;}
- nsIntRect(const nsIntPoint& aOrigin, const nsIntSize &aSize) {
- x = aOrigin.x; y = aOrigin.y;
- width = aSize.width; height = aSize.height;
- }
nsIntRect(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight) {
x = aX; y = aY; width = aWidth; height = aHeight;
}
// Emptiness. An empty rect is one that has no area, i.e. its height or width
// is <= 0
PRBool IsEmpty() const {
return (PRBool) ((height <= 0) || (width <= 0));
}
- void Empty() {width = height = 0;}
-
- // Inflate the rect by the specified width/height or margin
- void Inflate(PRInt32 aDx, PRInt32 aDy) {
- x -= aDx;
- y -= aDy;
- width += aDx*2;
- height += aDy*2;
- }
- void Inflate(const nsIntMargin &aMargin) {
- x -= aMargin.left;
- y -= aMargin.top;
- width += aMargin.left + aMargin.right;
- height += aMargin.top + aMargin.bottom;
- }
-
- // Overloaded operators. Note that '=' isn't defined so we'll get the
- // compiler generated default assignment operator.
- PRBool operator==(const nsIntRect& aRect) const {
- return (PRBool) ((IsEmpty() && aRect.IsEmpty()) ||
- ((x == aRect.x) && (y == aRect.y) &&
- (width == aRect.width) && (height == aRect.height)));
- }
- PRBool operator!=(const nsIntRect& aRect) const {
- return (PRBool) !operator==(aRect);
- }
-
- nsIntRect operator+(const nsIntPoint& aPoint) const {
- return nsIntRect(x + aPoint.x, y + aPoint.y, width, height);
- }
- nsIntRect operator-(const nsIntPoint& aPoint) const {
- return nsIntRect(x - aPoint.x, y - aPoint.y, width, height);
- }
- nsIntRect& operator+=(const nsIntPoint& aPoint) {x += aPoint.x; y += aPoint.y; return *this;}
- nsIntRect& operator-=(const nsIntPoint& aPoint) {x -= aPoint.x; y -= aPoint.y; return *this;}
void SetRect(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight) {
x = aX; y = aY; width = aWidth; height = aHeight;
}
- void MoveTo(PRInt32 aX, PRInt32 aY) {x = aX; y = aY;}
- void MoveTo(const nsIntPoint& aPoint) {x = aPoint.x; y = aPoint.y;}
- void MoveBy(PRInt32 aDx, PRInt32 aDy) {x += aDx; y += aDy;}
- void MoveBy(const nsIntPoint& aPoint) {x += aPoint.x; y += aPoint.y;}
- void SizeTo(PRInt32 aWidth, PRInt32 aHeight) {width = aWidth; height = aHeight;}
- void SizeTo(const nsIntSize& aSize) {SizeTo(aSize.width, aSize.height);}
- void SizeBy(PRInt32 aDeltaWidth, PRInt32 aDeltaHeight) {width += aDeltaWidth;
- height += aDeltaHeight;}
-
- PRBool Contains(const nsIntRect& aRect) const
- {
- return (PRBool) ((aRect.x >= x) && (aRect.y >= y) &&
- (aRect.XMost() <= XMost()) && (aRect.YMost() <= YMost()));
- }
- PRBool Contains(PRInt32 aX, PRInt32 aY) const
- {
- return (PRBool) ((aX >= x) && (aY >= y) &&
- (aX < XMost()) && (aY < YMost()));
- }
- PRBool Contains(const nsIntPoint& aPoint) const { return Contains(aPoint.x, aPoint.y); }
-
- // Intersection. Returns TRUE if the receiver overlaps aRect and
- // FALSE otherwise
- PRBool Intersects(const nsIntRect& aRect) const {
- return (PRBool) ((x < aRect.XMost()) && (y < aRect.YMost()) &&
- (aRect.x < XMost()) && (aRect.y < YMost()));
- }
-
// Computes the area in which aRect1 and aRect2 overlap, and fills 'this' with
// the result. Returns FALSE if the rectangles don't intersect, and sets 'this'
// rect to be an empty rect.
//
// 'this' can be the same object as either aRect1 or aRect2
PRBool IntersectRect(const nsIntRect& aRect1, const nsIntRect& aRect2);
// Computes the smallest rectangle that contains both aRect1 and aRect2 and
// fills 'this' with the result. Returns FALSE and sets 'this' rect to be an
// empty rect if both aRect1 and aRect2 are empty
//
// 'this' can be the same object as either aRect1 or aRect2
PRBool UnionRect(const nsIntRect& aRect1, const nsIntRect& aRect2);
- // Helpers for accessing the vertices
- nsIntPoint TopLeft() const { return nsIntPoint(x, y); }
- nsIntPoint TopRight() const { return nsIntPoint(XMost(), y); }
- nsIntPoint BottomLeft() const { return nsIntPoint(x, YMost()); }
- nsIntPoint BottomRight() const { return nsIntPoint(XMost(), YMost()); }
-
- nsIntSize Size() const { return nsIntSize(width, height); }
-
// Helper methods for computing the extents
PRInt32 XMost() const {return x + width;}
PRInt32 YMost() const {return y + height;}
-
- static inline nsRect ToAppUnits(const nsIntRect &aRect, nscoord aAppUnitsPerPixel);
};
-
-inline nsRect
-nsRect::ScaleRoundOutInverse(float aFactor)
-{
- nsRect rect;
- rect.x = NSToIntFloor(x / aFactor);
- rect.y = NSToIntFloor(y / aFactor);
- rect.width = NSToIntCeil(XMost() / aFactor) - rect.x;
- rect.height = NSToIntCeil(YMost() / aFactor) - rect.y;
- return rect;
-}
-
-/*
- * App Unit/Pixel conversions
- */
-// scale the rect but round to preserve centers
-inline nsIntRect
-nsRect::ToNearestPixels(const nsRect &aRect, nscoord aAppUnitsPerPixel)
-{
- nsIntRect rect;
- rect.x = NSToIntRound(NSAppUnitsToFloatPixels(aRect.x, aAppUnitsPerPixel));
- rect.y = NSToIntRound(NSAppUnitsToFloatPixels(aRect.y, aAppUnitsPerPixel));
- rect.width = NSToIntRound(NSAppUnitsToFloatPixels(aRect.XMost(),
- aAppUnitsPerPixel)) - rect.x;
- rect.height = NSToIntRound(NSAppUnitsToFloatPixels(aRect.YMost(),
- aAppUnitsPerPixel)) - rect.y;
- return rect;
-}
-
-// scale the rect but round to smallest containing rect
-inline nsIntRect
-nsRect::ToOutsidePixels(const nsRect &aRect, nscoord aAppUnitsPerPixel)
-{
- nsIntRect rect;
- rect.x = NSToIntFloor(NSAppUnitsToFloatPixels(aRect.x, aAppUnitsPerPixel));
- rect.y = NSToIntFloor(NSAppUnitsToFloatPixels(aRect.y, aAppUnitsPerPixel));
- rect.width = NSToIntCeil(NSAppUnitsToFloatPixels(aRect.XMost(),
- aAppUnitsPerPixel)) - rect.x;
- rect.height = NSToIntCeil(NSAppUnitsToFloatPixels(aRect.YMost(),
- aAppUnitsPerPixel)) - rect.y;
- return rect;
-}
-
-// scale the rect but round to largest contained rect
-inline nsIntRect
-nsRect::ToInsidePixels(const nsRect &aRect, nscoord aAppUnitsPerPixel)
-{
- nsIntRect rect;
- rect.x = NSToIntCeil(NSAppUnitsToFloatPixels(aRect.x, aAppUnitsPerPixel));
- rect.y = NSToIntCeil(NSAppUnitsToFloatPixels(aRect.y, aAppUnitsPerPixel));
- rect.width = NSToIntFloor(NSAppUnitsToFloatPixels(aRect.XMost(),
- aAppUnitsPerPixel)) - rect.x;
- rect.height = NSToIntFloor(NSAppUnitsToFloatPixels(aRect.YMost(),
- aAppUnitsPerPixel)) - rect.y;
- return rect;
-}
-
-// app units are integer multiples of pixels, so no rounding needed
-inline nsRect
-nsIntRect::ToAppUnits(const nsIntRect &aRect, nscoord aAppUnitsPerPixel)
-{
- return nsRect(NSIntPixelsToAppUnits(aRect.x, aAppUnitsPerPixel),
- NSIntPixelsToAppUnits(aRect.y, aAppUnitsPerPixel),
- NSIntPixelsToAppUnits(aRect.width, aAppUnitsPerPixel),
- NSIntPixelsToAppUnits(aRect.height, aAppUnitsPerPixel));
-}
+#else
+typedef nsRect nsIntRect;
+#endif
#ifdef DEBUG
// Diagnostics
extern NS_GFX FILE* operator<<(FILE* out, const nsRect& rect);
#endif // DEBUG
#endif /* NSRECT_H */
--- a/gfx/public/nsSize.h
+++ b/gfx/public/nsSize.h
@@ -66,28 +66,23 @@ struct nsSize {
nsSize operator+(const nsSize& aSize) const {
return nsSize(width + aSize.width, height + aSize.height);
}
nsSize& operator+=(const nsSize& aSize) {width += aSize.width;
height += aSize.height;
return *this;}
};
+#ifdef NS_COORD_IS_FLOAT
struct nsIntSize {
PRInt32 width, height;
nsIntSize() {}
nsIntSize(const nsIntSize& aSize) {width = aSize.width; height = aSize.height;}
nsIntSize(PRInt32 aWidth, PRInt32 aHeight) {width = aWidth; height = aHeight;}
- // Overloaded operators. Note that '=' isn't defined so we'll get the
- // compiler generated default assignment operator
- PRBool operator==(const nsIntSize& aSize) const {
- return (PRBool) ((width == aSize.width) && (height == aSize.height));
- }
- PRBool operator!=(const nsIntSize& aSize) const {
- return (PRBool) ((width != aSize.width) || (height != aSize.height));
- }
-
void SizeTo(PRInt32 aWidth, PRInt32 aHeight) {width = aWidth; height = aHeight;}
};
+#else
+typedef nsSize nsIntSize;
+#endif
#endif /* NSSIZE_H */
--- a/gfx/src/nsRect.cpp
+++ b/gfx/src/nsRect.cpp
@@ -168,16 +168,62 @@ void nsRect::Deflate(nscoord aDx, nscoor
void nsRect::Deflate(const nsMargin &aMargin)
{
x += aMargin.left;
y += aMargin.top;
width = PR_MAX(0, width - aMargin.LeftRight());
height = PR_MAX(0, height - aMargin.TopBottom());
}
+// scale the rect but round to smallest containing rect
+nsRect& nsRect::ScaleRoundOut(float aScale)
+{
+ nscoord right = NSToCoordCeil(float(XMost()) * aScale);
+ nscoord bottom = NSToCoordCeil(float(YMost()) * aScale);
+ x = NSToCoordFloor(float(x) * aScale);
+ y = NSToCoordFloor(float(y) * aScale);
+ width = (right - x);
+ height = (bottom - y);
+ return *this;
+}
+
+nsRect& nsRect::ScaleRoundOutInverse(float aScale)
+{
+ nscoord right = NSToCoordCeil(float(XMost()) / aScale);
+ nscoord bottom = NSToCoordCeil(float(YMost()) / aScale);
+ x = NSToCoordFloor(float(x) / aScale);
+ y = NSToCoordFloor(float(y) / aScale);
+ width = (right - x);
+ height = (bottom - y);
+ return *this;
+}
+
+// scale the rect but round to largest contained rect
+nsRect& nsRect::ScaleRoundIn(float aScale)
+{
+ nscoord right = NSToCoordFloor(float(XMost()) * aScale);
+ nscoord bottom = NSToCoordFloor(float(YMost()) * aScale);
+ x = NSToCoordCeil(float(x) * aScale);
+ y = NSToCoordCeil(float(y) * aScale);
+ width = (right - x);
+ height = (bottom - y);
+ return *this;
+}
+
+nsRect& nsRect::ScaleRoundPreservingCentersInverse(float aScale)
+{
+ nscoord right = NSToCoordRound(float(XMost()) / aScale);
+ nscoord bottom = NSToCoordRound(float(YMost()) / aScale);
+ x = NSToCoordRound(float(x) / aScale);
+ y = NSToCoordRound(float(y) / aScale);
+ width = (right - x);
+ height = (bottom - y);
+ return *this;
+}
+
#ifdef DEBUG
// Diagnostics
FILE* operator<<(FILE* out, const nsRect& rect)
{
nsAutoString tmp;
// Output the coordinates in fractional pixels so they're easier to read
@@ -193,18 +239,17 @@ FILE* operator<<(FILE* out, const nsRect
tmp.AppendLiteral(", ");
tmp.AppendFloat(NSAppUnitsToFloatPixels(rect.height,
nsIDeviceContext::AppUnitsPerCSSPixel()));
tmp.AppendLiteral("}");
fputs(NS_LossyConvertUTF16toASCII(tmp).get(), out);
return out;
}
-#endif // DEBUG
-
+#ifdef NS_COORD_IS_FLOAT
// Computes the area in which aRect1 and aRect2 overlap and fills 'this' with
// the result. Returns FALSE if the rectangles don't intersect.
PRBool nsIntRect::IntersectRect(const nsIntRect &aRect1, const nsIntRect &aRect2)
{
PRInt32 xmost1 = aRect1.XMost();
PRInt32 ymost1 = aRect1.YMost();
PRInt32 xmost2 = aRect2.XMost();
PRInt32 ymost2 = aRect2.YMost();
@@ -264,9 +309,11 @@ PRBool nsIntRect::UnionRect(const nsIntR
// Compute the size
width = PR_MAX(xmost1, xmost2) - x;
height = PR_MAX(ymost1, ymost2) - y;
}
return result;
}
+#endif
+#endif // DEBUG
--- a/gfx/src/thebes/nsThebesImage.cpp
+++ b/gfx/src/thebes/nsThebesImage.cpp
@@ -215,17 +215,17 @@ nsThebesImage::GetAlphaBits()
PRInt32
nsThebesImage::GetAlphaLineStride()
{
return (mAlphaDepth > 0) ? mStride : 0;
}
nsresult
-nsThebesImage::ImageUpdated(nsIDeviceContext *aContext, PRUint8 aFlags, nsIntRect *aUpdateRect)
+nsThebesImage::ImageUpdated(nsIDeviceContext *aContext, PRUint8 aFlags, nsRect *aUpdateRect)
{
// Check to see if we are running OOM
nsCOMPtr<nsIMemory> mem;
NS_GetMemoryManager(getter_AddRefs(mem));
if (!mem)
return NS_ERROR_UNEXPECTED;
PRBool lowMemory;
@@ -240,17 +240,17 @@ nsThebesImage::ImageUpdated(nsIDeviceCon
#endif
return NS_OK;
}
PRBool
nsThebesImage::GetIsImageComplete()
{
if (!mImageComplete)
- mImageComplete = (mDecoded == nsIntRect(0, 0, mWidth, mHeight));
+ mImageComplete = (mDecoded == nsRect(0, 0, mWidth, mHeight));
return mImageComplete;
}
nsresult
nsThebesImage::Optimize(nsIDeviceContext* aContext)
{
if (gDisableOptimize)
return NS_OK;
--- a/gfx/src/thebes/nsThebesImage.h
+++ b/gfx/src/thebes/nsThebesImage.h
@@ -66,17 +66,17 @@ public:
virtual PRInt32 GetWidth();
virtual PRInt32 GetHeight();
virtual PRUint8 *GetBits();
virtual PRInt32 GetLineStride();
virtual PRBool GetHasAlphaMask();
virtual PRUint8 *GetAlphaBits();
virtual PRInt32 GetAlphaLineStride();
virtual PRBool GetIsImageComplete();
- virtual nsresult ImageUpdated(nsIDeviceContext *aContext, PRUint8 aFlags, nsIntRect *aUpdateRect);
+ virtual nsresult ImageUpdated(nsIDeviceContext *aContext, PRUint8 aFlags, nsRect *aUpdateRect);
virtual nsresult Optimize(nsIDeviceContext* aContext);
virtual nsColorMap *GetColorMap();
NS_IMETHOD Draw(nsIRenderingContext &aContext,
const gfxRect &aSourceRect,
const gfxRect &aSubimageRect,
const gfxRect &aDestRect);
@@ -154,17 +154,17 @@ protected:
}
return PR_TRUE;
}
gfxImageSurface::gfxImageFormat mFormat;
PRInt32 mWidth;
PRInt32 mHeight;
PRInt32 mStride;
- nsIntRect mDecoded;
+ nsRect mDecoded;
PRPackedBool mImageComplete;
PRPackedBool mSinglePixel;
PRPackedBool mFormatChanged;
#ifdef XP_WIN
PRPackedBool mIsDDBSurface;
#endif
gfxRGBA mSinglePixelColor;
--- a/gfx/src/thebes/nsThebesRenderingContext.cpp
+++ b/gfx/src/thebes/nsThebesRenderingContext.cpp
@@ -775,17 +775,17 @@ nsThebesRenderingContext::DrawTile(imgIC
nscoord containerWidth, containerHeight;
aImage->GetWidth(&containerWidth);
aImage->GetHeight(&containerHeight);
nsCOMPtr<gfxIImageFrame> imgFrame;
aImage->GetCurrentFrame(getter_AddRefs(imgFrame));
if (!imgFrame) return NS_ERROR_FAILURE;
- nsIntRect imgFrameRect;
+ nsRect imgFrameRect;
imgFrame->GetRect(imgFrameRect);
nsCOMPtr<nsIImage> img(do_GetInterface(imgFrame));
if (!img) return NS_ERROR_FAILURE;
nsThebesImage *thebesImage = static_cast<nsThebesImage*>((nsIImage*) img.get());
/* Phase offset of the repeated image from the origin */
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -1577,23 +1577,22 @@ nsCSSRendering::PaintBackgroundWithSC(ns
PaintBackgroundColor(aPresContext, aRenderingContext, aForFrame, bgClipArea,
aColor, aBorder, canDrawBackgroundColor);
return;
}
nsCOMPtr<imgIContainer> image;
req->GetImage(getter_AddRefs(image));
- nsIntSize imageIntSize;
- image->GetWidth(&imageIntSize.width);
- image->GetHeight(&imageIntSize.height);
-
nsSize imageSize;
- imageSize.width = nsPresContext::CSSPixelsToAppUnits(imageIntSize.width);
- imageSize.height = nsPresContext::CSSPixelsToAppUnits(imageIntSize.height);
+ image->GetWidth(&imageSize.width);
+ image->GetHeight(&imageSize.height);
+
+ imageSize.width = nsPresContext::CSSPixelsToAppUnits(imageSize.width);
+ imageSize.height = nsPresContext::CSSPixelsToAppUnits(imageSize.height);
req = nsnull;
nsRect bgOriginArea;
nsIAtom* frameType = aForFrame->GetType();
if (frameType == nsGkAtoms::inlineFrame ||
frameType == nsGkAtoms::positionedInlineFrame) {
@@ -1655,20 +1654,20 @@ nsCSSRendering::PaintBackgroundWithSC(ns
// If the image is completely opaque, we do not need to paint the
// background color
nsCOMPtr<gfxIImageFrame> gfxImgFrame;
image->GetCurrentFrame(getter_AddRefs(gfxImgFrame));
if (gfxImgFrame) {
gfxImgFrame->GetNeedsBackground(&needBackgroundColor);
/* check for tiling of a image where frame smaller than container */
- nsIntSize iSize;
+ nsSize iSize;
image->GetWidth(&iSize.width);
image->GetHeight(&iSize.height);
- nsIntRect iframeRect;
+ nsRect iframeRect;
gfxImgFrame->GetRect(iframeRect);
if (iSize.width != iframeRect.width ||
iSize.height != iframeRect.height) {
needBackgroundColor = PR_TRUE;
}
}
}
break;
@@ -1964,19 +1963,19 @@ nsCSSRendering::PaintBackgroundWithSC(ns
"We shouldn't need to tile here");
// The entire drawRect is contained inside a single tile; just
// draw the corresponding part of the image once.
nsLayoutUtils::DrawImage(&aRenderingContext, image,
destRect, drawRect, &subimageRect);
} else {
// Note that the subimage is in tile space so it may cover
// multiple tiles of the image.
- nsIntRect subimagePxRect(nsRect::ToOutsidePixels(subimageRect, nsIDeviceContext::AppUnitsPerCSSPixel()));
+ subimageRect.ScaleRoundOutInverse(nsIDeviceContext::AppUnitsPerCSSPixel());
aRenderingContext.DrawTile(image, absTileRect.x, absTileRect.y,
- &drawRect, &subimagePxRect);
+ &drawRect, &subimageRect);
}
}
ctx->Restore();
}
static void
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -363,17 +363,17 @@ private:
*/
nsresult CreateDeviceContext(nsIWidget* aWidget);
/**
* Make sure to set up mDeviceContext as needed before calling this
*/
nsresult InitInternal(nsIWidget* aParentWidget,
nsISupports *aState,
- const nsIntRect& aBounds,
+ const nsRect& aBounds,
PRBool aDoCreation,
PRBool aInPrintPreview,
PRBool aNeedMakeCX = PR_TRUE);
/**
* @param aDoInitialReflow set to true if you want to kick off the initial
* reflow
* @param aReenableRefresh set to true if you want this to reenable refresh
* before returning; otherwise this will return with refresh disabled
@@ -661,17 +661,17 @@ DocumentViewerImpl::GetContainer(nsISupp
*aResult = nsnull;
nsCOMPtr<nsISupports> container = do_QueryReferent(mContainer);
container.swap(*aResult);
return NS_OK;
}
NS_IMETHODIMP
DocumentViewerImpl::Init(nsIWidget* aParentWidget,
- const nsIntRect& aBounds)
+ const nsRect& aBounds)
{
nsresult rv = CreateDeviceContext(aParentWidget);
NS_ENSURE_SUCCESS(rv, rv);
return InitInternal(aParentWidget, nsnull, aBounds, PR_TRUE, PR_FALSE);
}
nsresult
@@ -704,17 +704,17 @@ DocumentViewerImpl::InitPresentationStuf
// to avoid bogus notifications.
mDocument->FlushPendingNotifications(Flush_ContentAndNotify);
}
mPresShell->BeginObservingDocument();
// Initialize our view manager
- nsIntRect bounds;
+ nsRect bounds;
mWindow->GetBounds(bounds);
nscoord width = mPresContext->DeviceContext()->UnscaledAppUnitsPerDevPixel() * bounds.width;
nscoord height = mPresContext->DeviceContext()->UnscaledAppUnitsPerDevPixel() * bounds.height;
mViewManager->DisableRefresh();
mViewManager->SetWindowDimensions(width, height);
mPresContext->SetTextZoom(mTextZoom);
@@ -800,17 +800,17 @@ DocumentViewerImpl::InitPresentationStuf
//-----------------------------------------------
// This method can be used to initial the "presentation"
// The aDoCreation indicates whether it should create
// all the new objects or just initialize the existing ones
nsresult
DocumentViewerImpl::InitInternal(nsIWidget* aParentWidget,
nsISupports *aState,
- const nsIntRect& aBounds,
+ const nsRect& aBounds,
PRBool aDoCreation,
PRBool aInPrintPreview,
PRBool aNeedMakeCX /*= PR_TRUE*/)
{
mParentWidget = aParentWidget; // not ref counted
nsresult rv = NS_OK;
NS_ENSURE_TRUE(mDocument, NS_ERROR_NULL_POINTER);
@@ -1242,17 +1242,17 @@ DocumentViewerImpl::Open(nsISupports *aS
NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_INITIALIZED);
// Our container might have gone away while we were closed.
// If this is the case, we must fail to open so we don't crash.
nsCOMPtr<nsISupports> container = do_QueryReferent(mContainer);
if (!container)
return NS_ERROR_NOT_AVAILABLE;
- nsIntRect bounds;
+ nsRect bounds;
mWindow->GetBounds(bounds);
nsresult rv = InitInternal(mParentWidget, aState, bounds, PR_FALSE, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
if (mDocument)
mDocument->SetContainer(nsCOMPtr<nsISupports>(do_QueryReferent(mContainer)));
@@ -1733,17 +1733,17 @@ NS_IMETHODIMP
DocumentViewerImpl::GetPresContext(nsPresContext** aResult)
{
nsPresContext* pc = GetPresContext();
NS_IF_ADDREF(*aResult = pc);
return NS_OK;
}
NS_IMETHODIMP
-DocumentViewerImpl::GetBounds(nsIntRect& aResult)
+DocumentViewerImpl::GetBounds(nsRect& aResult)
{
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
NS_PRECONDITION(mWindow, "null window");
if (mWindow) {
mWindow->GetBounds(aResult);
}
else {
aResult.SetRect(0, 0, 0, 0);
@@ -1788,17 +1788,17 @@ DocumentViewerImpl::SetPreviousViewer(ns
}
}
mPreviousViewer = aViewer;
return NS_OK;
}
NS_IMETHODIMP
-DocumentViewerImpl::SetBounds(const nsIntRect& aBounds)
+DocumentViewerImpl::SetBounds(const nsRect& aBounds)
{
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
if (mWindow) {
// Don't have the widget repaint. Layout will generate repaint requests
// during reflow
mWindow->Resize(aBounds.x, aBounds.y, aBounds.width, aBounds.height,
PR_FALSE);
@@ -1895,17 +1895,17 @@ DocumentViewerImpl::Show(void)
NS_ENSURE_TRUE(mPresContext, NS_ERROR_OUT_OF_MEMORY);
rv = mPresContext->Init(mDeviceContext);
if (NS_FAILED(rv)) {
mPresContext = nsnull;
return rv;
}
- nsIntRect tbounds;
+ nsRect tbounds;
mParentWidget->GetBounds(tbounds);
rv = MakeWindow(nsSize(mPresContext->DevPixelsToAppUnits(tbounds.width),
mPresContext->DevPixelsToAppUnits(tbounds.height)));
if (NS_FAILED(rv))
return rv;
if (mPresContext && base_win) {
@@ -4083,17 +4083,17 @@ DocumentViewerImpl::OnDonePrinting()
}
NS_IMETHODIMP DocumentViewerImpl::SetPageMode(PRBool aPageMode, nsIPrintSettings* aPrintSettings)
{
// XXX Page mode is only partially working; it's currently used for
// reftests that require a paginated context
mIsPageMode = aPageMode;
// Get the current size of what is being viewed
- nsIntRect bounds;
+ nsRect bounds;
mWindow->GetBounds(bounds);
if (mPresShell) {
// Break circular reference (or something)
mPresShell->EndObservingDocument();
nsCOMPtr<nsISelection> selection;
nsresult rv = GetDocumentSelection(getter_AddRefs(selection));
nsCOMPtr<nsISelectionPrivate> selPrivate(do_QueryInterface(selection));
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -97,20 +97,21 @@ template<class E> class nsCOMArray;
class nsWeakFrame;
class nsIScrollableFrame;
class gfxASurface;
class gfxContext;
typedef short SelectionType;
typedef PRUint32 nsFrameState;
-// b86c23c5-602d-4ca6-a968-379b244fed9e
+
+// 134e504f-4fd1-4590-9f5d-899afee63d0f
#define NS_IPRESSHELL_IID \
-{ 0xb86c23c5, 0x602d, 0x4ca6, \
- { 0xa9, 0x68, 0x37, 0x9b, 0x24, 0x4f, 0xed, 0x9e } }
+{ 0x134e504f, 0x4fd1, 0x4590, \
+ { 0x9f, 0x5d, 0x89, 0x9a, 0xfe, 0xe6, 0x3d, 0x0f } }
// Constants for ScrollContentIntoView() function
#define NS_PRESSHELL_SCROLL_TOP 0
#define NS_PRESSHELL_SCROLL_BOTTOM 100
#define NS_PRESSHELL_SCROLL_LEFT 0
#define NS_PRESSHELL_SCROLL_RIGHT 100
#define NS_PRESSHELL_SCROLL_CENTER 50
#define NS_PRESSHELL_SCROLL_ANYWHERE -1
@@ -733,18 +734,18 @@ public:
/**
* Renders a node aNode to a surface and returns it. The aRegion may be used
* to clip the rendering. This region is measured in device pixels from the
* edge of the presshell area. The aPoint, aScreenRect and aSurface
* arguments function in a similar manner as RenderSelection.
*/
virtual already_AddRefed<gfxASurface> RenderNode(nsIDOMNode* aNode,
nsIRegion* aRegion,
- nsIntPoint& aPoint,
- nsIntRect* aScreenRect) = 0;
+ nsPoint& aPoint,
+ nsRect* aScreenRect) = 0;
/*
* Renders a selection to a surface and returns it. This method is primarily
* intended to create the drag feedback when dragging a selection.
*
* aScreenRect will be filled in with the bounding rectangle of the
* selection area on screen.
*
@@ -752,18 +753,18 @@ public:
* The argument aPoint is used in this case as a reference point when
* determining the new screen rectangle after scaling. Typically, this
* will be the mouse position, so that the screen rectangle is positioned
* such that the mouse is over the same point in the scaled image as in
* the original. When scaling does not occur, the mouse point isn't used
* as the position can be determined from the displayed frames.
*/
virtual already_AddRefed<gfxASurface> RenderSelection(nsISelection* aSelection,
- nsIntPoint& aPoint,
- nsIntRect* aScreenRect) = 0;
+ nsPoint& aPoint,
+ nsRect* aScreenRect) = 0;
void AddWeakFrame(nsWeakFrame* aWeakFrame);
void RemoveWeakFrame(nsWeakFrame* aWeakFrame);
#ifdef NS_DEBUG
nsIFrame* GetDrawEventTargetFrame() { return mDrawEventTargetFrame; }
#endif
--- a/layout/base/nsImageLoader.cpp
+++ b/layout/base/nsImageLoader.cpp
@@ -179,27 +179,32 @@ NS_IMETHODIMP nsImageLoader::OnStopFrame
// Draw the background image
RedrawDirtyFrame(nsnull);
return NS_OK;
}
NS_IMETHODIMP nsImageLoader::FrameChanged(imgIContainer *aContainer,
gfxIImageFrame *newframe,
- nsIntRect *dirtyRect)
+ nsRect * dirtyRect)
{
if (!mFrame)
return NS_ERROR_FAILURE;
if (!mRequest) {
// We're in the middle of a paint anyway
return NS_OK;
}
- nsRect r(nsIntRect::ToAppUnits(*dirtyRect, nsPresContext::AppUnitsPerCSSPixel()));
+ nsRect r(*dirtyRect);
+
+ r.x = nsPresContext::CSSPixelsToAppUnits(r.x);
+ r.y = nsPresContext::CSSPixelsToAppUnits(r.y);
+ r.width = nsPresContext::CSSPixelsToAppUnits(r.width);
+ r.height = nsPresContext::CSSPixelsToAppUnits(r.height);
RedrawDirtyFrame(&r);
return NS_OK;
}
void
--- a/layout/base/nsImageLoader.h
+++ b/layout/base/nsImageLoader.h
@@ -62,17 +62,17 @@ public:
// Do not override OnDataAvailable since background images are not
// displayed incrementally; they are displayed after the entire image
// has been loaded.
// Note: Images referenced by the <img> element are displayed
// incrementally in nsImageFrame.cpp.
// imgIContainerObserver (override nsStubImageDecoderObserver)
NS_IMETHOD FrameChanged(imgIContainer *aContainer, gfxIImageFrame *newframe,
- nsIntRect *dirtyRect);
+ nsRect * dirtyRect);
void Init(nsIFrame *aFrame, nsPresContext *aPresContext,
PRBool aReflowOnLoad);
nsresult Load(imgIRequest *aImage);
void Destroy();
nsIFrame *GetFrame() { return mFrame; }
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -811,21 +811,21 @@ nsLayoutUtils::GetEventCoordinatesForNea
aFrame->GetOffsetFromView(viewToFrame, &frameView);
if (aView)
*aView = frameView;
return TranslateWidgetToView(aFrame->PresContext(), GUIEvent->widget,
GUIEvent->refPoint, frameView);
}
-static nsIntPoint GetWidgetOffset(nsIWidget* aWidget, nsIWidget*& aRootWidget) {
- nsIntPoint offset(0, 0);
+static nsPoint GetWidgetOffset(nsIWidget* aWidget, nsIWidget*& aRootWidget) {
+ nsPoint offset(0, 0);
nsIWidget* parent = aWidget->GetParent();
while (parent) {
- nsIntRect bounds;
+ nsRect bounds;
aWidget->GetBounds(bounds);
offset += bounds.TopLeft();
aWidget = parent;
parent = aWidget->GetParent();
}
aRootWidget = aWidget;
return offset;
}
@@ -834,19 +834,19 @@ nsPoint
nsLayoutUtils::TranslateWidgetToView(nsPresContext* aPresContext,
nsIWidget* aWidget, nsIntPoint aPt,
nsIView* aView)
{
nsPoint viewOffset;
nsIWidget* viewWidget = aView->GetNearestWidget(&viewOffset);
nsIWidget* fromRoot;
- nsIntPoint fromOffset(GetWidgetOffset(aWidget, fromRoot));
+ nsPoint fromOffset = GetWidgetOffset(aWidget, fromRoot);
nsIWidget* toRoot;
- nsIntPoint toOffset(GetWidgetOffset(viewWidget, toRoot));
+ nsPoint toOffset = GetWidgetOffset(viewWidget, toRoot);
nsIntPoint widgetPoint;
if (fromRoot == toRoot) {
widgetPoint = aPt + fromOffset - toOffset;
} else {
nsIntRect widgetRect(0, 0, 0, 0);
nsIntRect screenRect;
aWidget->WidgetToScreen(widgetRect, screenRect);
@@ -1981,17 +1981,17 @@ nsLayoutUtils::IntrinsicForContainer(nsI
}
min = AddPercents(aType, min, pctTotal);
if (result < min)
result = min;
const nsStyleDisplay *disp = aFrame->GetStyleDisplay();
if (aFrame->IsThemed(disp)) {
- nsIntSize size(0, 0);
+ nsSize size(0, 0);
PRBool canOverride = PR_TRUE;
nsPresContext *presContext = aFrame->PresContext();
presContext->GetTheme()->
GetMinimumWidgetSize(aRenderingContext, aFrame, disp->mAppearance,
&size, &canOverride);
nscoord themeWidth = presContext->DevPixelsToAppUnits(size.width);
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -560,17 +560,17 @@ public:
AppUnitsToGfxUnits(aAppRect.width),
AppUnitsToGfxUnits(aAppRect.height)); }
nscoord TwipsToAppUnits(PRInt32 aTwips) const
{ return NSToCoordRound(NS_TWIPS_TO_INCHES(aTwips) *
mDeviceContext->AppUnitsPerInch()); }
// Margin-specific version, since they often need TwipsToAppUnits
- nsMargin TwipsToAppUnits(const nsIntMargin &marginInTwips) const
+ nsMargin TwipsToAppUnits(const nsMargin &marginInTwips) const
{ return nsMargin(TwipsToAppUnits(marginInTwips.left),
TwipsToAppUnits(marginInTwips.top),
TwipsToAppUnits(marginInTwips.right),
TwipsToAppUnits(marginInTwips.bottom)); }
PRInt32 AppUnitsToTwips(nscoord aTwips) const
{ return NS_INCHES_TO_TWIPS((float)aTwips /
mDeviceContext->AppUnitsPerInch()); }
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -882,22 +882,22 @@ public:
NS_IMETHOD RenderDocument(const nsRect& aRect, PRBool aUntrusted,
PRBool aIgnoreViewportScrolling,
nscolor aBackgroundColor,
gfxContext* aThebesContext);
virtual already_AddRefed<gfxASurface> RenderNode(nsIDOMNode* aNode,
nsIRegion* aRegion,
- nsIntPoint& aPoint,
- nsIntRect* aScreenRect);
+ nsPoint& aPoint,
+ nsRect* aScreenRect);
virtual already_AddRefed<gfxASurface> RenderSelection(nsISelection* aSelection,
- nsIntPoint& aPoint,
- nsIntRect* aScreenRect);
+ nsPoint& aPoint,
+ nsRect* aScreenRect);
//nsIViewObserver interface
NS_IMETHOD Paint(nsIView *aView,
nsIRenderingContext* aRenderingContext,
const nsRegion& aDirtyRegion);
NS_IMETHOD ComputeRepaintRegionForCopy(nsIView* aRootView,
nsIView* aMovingView,
@@ -1092,18 +1092,18 @@ protected:
* aScreenRect - [out] set to the area of the screen the painted area should
* be displayed at
*/
already_AddRefed<gfxASurface>
PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
nsISelection* aSelection,
nsIRegion* aRegion,
nsRect aArea,
- nsIntPoint& aPoint,
- nsIntRect* aScreenRect);
+ nsPoint& aPoint,
+ nsRect* aScreenRect);
/**
* Methods to handle changes to user and UA sheet lists that we get
* notified about.
*/
void AddUserSheet(nsISupports* aSheet);
void AddAgentSheet(nsISupports* aSheet);
void RemoveSheet(nsStyleSet::sheetType aType, nsISupports* aSheet);
@@ -5153,27 +5153,28 @@ PresShell::CreateRangePaintInfo(nsIDOMRa
return info;
}
already_AddRefed<gfxASurface>
PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
nsISelection* aSelection,
nsIRegion* aRegion,
nsRect aArea,
- nsIntPoint& aPoint,
- nsIntRect* aScreenRect)
+ nsPoint& aPoint,
+ nsRect* aScreenRect)
{
nsPresContext* pc = GetPresContext();
if (!pc || aArea.width == 0 || aArea.height == 0)
return nsnull;
nsIDeviceContext* deviceContext = pc->DeviceContext();
// use the rectangle to create the surface
- nsIntRect pixelArea(nsRect::ToOutsidePixels(aArea, pc->AppUnitsPerDevPixel()));
+ nsRect pixelArea = aArea;
+ pixelArea.ScaleRoundOut(1.0 / pc->AppUnitsPerDevPixel());
// if the area of the image is larger than the maximum area, scale it down
float scale = 0.0;
nsIntRect rootScreenRect = GetRootFrame()->GetScreenRect();
// if the image is larger in one or both directions than half the size of
// the available screen area, scale the image down to that size.
nsRect maxSize;
@@ -5267,18 +5268,18 @@ PresShell::PaintRangePaintInfo(nsTArray<
NS_ADDREF(surface);
return surface;
}
already_AddRefed<gfxASurface>
PresShell::RenderNode(nsIDOMNode* aNode,
nsIRegion* aRegion,
- nsIntPoint& aPoint,
- nsIntRect* aScreenRect)
+ nsPoint& aPoint,
+ nsRect* aScreenRect)
{
// area will hold the size of the surface needed to draw the node, measured
// from the root frame.
nsRect area;
nsTArray<nsAutoPtr<RangePaintInfo> > rangeItems;
// nothing to draw if the node isn't in a document
nsCOMPtr<nsINode> node = do_QueryInterface(aNode);
@@ -5292,21 +5293,22 @@ PresShell::RenderNode(nsIDOMNode* aNode,
RangePaintInfo* info = CreateRangePaintInfo(range, area);
if (info && !rangeItems.AppendElement(info)) {
delete info;
return nsnull;
}
if (aRegion) {
// combine the area with the supplied region
- nsIntRect rrectPixels;
+ nsRect rrectPixels;
aRegion->GetBoundingBox(&rrectPixels.x, &rrectPixels.y,
&rrectPixels.width, &rrectPixels.height);
- nsRect rrect(nsIntRect::ToAppUnits(rrectPixels, nsPresContext::AppUnitsPerCSSPixel()));
+ nsRect rrect = rrectPixels;
+ rrect.ScaleRoundOut(nsPresContext::AppUnitsPerCSSPixel());
area.IntersectRect(area, rrect);
nsPresContext* pc = GetPresContext();
if (!pc)
return nsnull;
// move the region so that it is offset from the topleft corner of the surface
aRegion->Offset(-rrectPixels.x + (rrectPixels.x - pc->AppUnitsToDevPixels(area.x)),
@@ -5314,18 +5316,18 @@ PresShell::RenderNode(nsIDOMNode* aNode,
}
return PaintRangePaintInfo(&rangeItems, nsnull, aRegion, area, aPoint,
aScreenRect);
}
already_AddRefed<gfxASurface>
PresShell::RenderSelection(nsISelection* aSelection,
- nsIntPoint& aPoint,
- nsIntRect* aScreenRect)
+ nsPoint& aPoint,
+ nsRect* aScreenRect)
{
// area will hold the size of the surface needed to draw the selection,
// measured from the root frame.
nsRect area;
nsTArray<nsAutoPtr<RangePaintInfo> > rangeItems;
// iterate over each range and collect them into the rangeItems array.
// This is done so that the size of selection can be determined so as
@@ -6702,47 +6704,16 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame*
fputs(NS_LossyConvertUTF16toASCII(name).get(), stdout);
fprintf(stdout, " %p ", (void*)k2);
}
printf("{%d, %d, %d, %d}\n", r2.x, r2.y, r2.width, r2.height);
printf(" %s\n", aMsg);
}
-static void
-LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg,
- const nsIntRect& r1, const nsIntRect& r2)
-{
- printf("VerifyReflow Error:\n");
- nsAutoString name;
- nsIFrameDebug* frameDebug;
-
- if (NS_SUCCEEDED(k1->QueryInterface(NS_GET_IID(nsIFrameDebug),
- (void**)&frameDebug))) {
- fprintf(stdout, " ");
- frameDebug->GetFrameName(name);
- fputs(NS_LossyConvertUTF16toASCII(name).get(), stdout);
- fprintf(stdout, " %p ", (void*)k1);
- }
- printf("{%d, %d, %d, %d}", r1.x, r1.y, r1.width, r1.height);
-
- printf(" != \n");
-
- if (NS_SUCCEEDED(k2->QueryInterface(NS_GET_IID(nsIFrameDebug),
- (void**)&frameDebug))) {
- fprintf(stdout, " ");
- frameDebug->GetFrameName(name);
- fputs(NS_LossyConvertUTF16toASCII(name).get(), stdout);
- fprintf(stdout, " %p ", (void*)k2);
- }
- printf("{%d, %d, %d, %d}\n", r2.x, r2.y, r2.width, r2.height);
-
- printf(" %s\n", aMsg);
-}
-
static PRBool
CompareTrees(nsPresContext* aFirstPresContext, nsIFrame* aFirstFrame,
nsPresContext* aSecondPresContext, nsIFrame* aSecondFrame)
{
if (!aFirstPresContext || !aFirstFrame || !aSecondPresContext || !aSecondFrame)
return PR_TRUE;
// XXX Evil hack to reduce false positives; I can't seem to figure
// out how to flush scrollbar changes correctly
@@ -6760,17 +6731,17 @@ CompareTrees(nsPresContext* aFirstPresCo
ok = PR_FALSE;
LogVerifyMessage(k1, k2, "child counts don't match: ");
printf("%d != %d\n", l1, l2);
if (0 == (VERIFY_REFLOW_ALL & gVerifyReflowFlags)) {
break;
}
}
- nsIntRect r1, r2;
+ nsRect r1, r2;
nsIView* v1, *v2;
for (;;) {
if (((nsnull == k1) && (nsnull != k2)) ||
((nsnull != k1) && (nsnull == k2))) {
ok = PR_FALSE;
LogVerifyMessage(k1, k2, "child lists are different\n");
break;
}
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -67,22 +67,22 @@ class nsBulletListener : public nsStubIm
public:
nsBulletListener();
virtual ~nsBulletListener();
NS_DECL_ISUPPORTS
// imgIDecoderObserver (override nsStubImageDecoderObserver)
NS_IMETHOD OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage);
NS_IMETHOD OnDataAvailable(imgIRequest *aRequest, gfxIImageFrame *aFrame,
- const nsIntRect *aRect);
+ const nsRect *aRect);
NS_IMETHOD OnStopDecode(imgIRequest *aRequest, nsresult status,
const PRUnichar *statusArg);
// imgIContainerObserver (override nsStubImageDecoderObserver)
NS_IMETHOD FrameChanged(imgIContainer *aContainer, gfxIImageFrame *newframe,
- nsIntRect *dirtyRect);
+ nsRect * dirtyRect);
void SetFrame(nsBulletFrame *frame) { mFrame = frame; }
private:
nsBulletFrame *mFrame;
};
@@ -1457,17 +1457,17 @@ NS_IMETHODIMP nsBulletFrame::OnStartCont
aImage->StartAnimation();
return NS_OK;
}
NS_IMETHODIMP nsBulletFrame::OnDataAvailable(imgIRequest *aRequest,
gfxIImageFrame *aFrame,
- const nsIntRect *aRect)
+ const nsRect *aRect)
{
// The image has changed.
// Invalidate the entire content area. Maybe it's not optimal but it's simple and
// always correct, and I'll be a stunned mullet if it ever matters for performance
Invalidate(nsRect(0, 0, mRect.width, mRect.height));
return NS_OK;
}
@@ -1488,17 +1488,17 @@ NS_IMETHODIMP nsBulletFrame::OnStopDecod
}
#endif
return NS_OK;
}
NS_IMETHODIMP nsBulletFrame::FrameChanged(imgIContainer *aContainer,
gfxIImageFrame *aNewFrame,
- nsIntRect *aDirtyRect)
+ nsRect *aDirtyRect)
{
// Invalidate the entire content area. Maybe it's not optimal but it's simple and
// always correct.
Invalidate(nsRect(0, 0, mRect.width, mRect.height));
return NS_OK;
}
@@ -1546,17 +1546,17 @@ NS_IMETHODIMP nsBulletListener::OnStartC
if (!mFrame)
return NS_ERROR_FAILURE;
return mFrame->OnStartContainer(aRequest, aImage);
}
NS_IMETHODIMP nsBulletListener::OnDataAvailable(imgIRequest *aRequest,
gfxIImageFrame *aFrame,
- const nsIntRect *aRect)
+ const nsRect *aRect)
{
if (!mFrame)
return NS_ERROR_FAILURE;
return mFrame->OnDataAvailable(aRequest, aFrame, aRect);
}
NS_IMETHODIMP nsBulletListener::OnStopDecode(imgIRequest *aRequest,
@@ -1566,15 +1566,15 @@ NS_IMETHODIMP nsBulletListener::OnStopDe
if (!mFrame)
return NS_ERROR_FAILURE;
return mFrame->OnStopDecode(aRequest, status, statusArg);
}
NS_IMETHODIMP nsBulletListener::FrameChanged(imgIContainer *aContainer,
gfxIImageFrame *newframe,
- nsIntRect *dirtyRect)
+ nsRect * dirtyRect)
{
if (!mFrame)
return NS_ERROR_FAILURE;
return mFrame->FrameChanged(aContainer, newframe, dirtyRect);
}
--- a/layout/generic/nsBulletFrame.h
+++ b/layout/generic/nsBulletFrame.h
@@ -77,23 +77,23 @@ public:
// nsBulletFrame
PRInt32 SetListItemOrdinal(PRInt32 aNextOrdinal, PRBool* aChanged);
NS_IMETHOD OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage);
NS_IMETHOD OnDataAvailable(imgIRequest *aRequest,
gfxIImageFrame *aFrame,
- const nsIntRect *aRect);
+ const nsRect * rect);
NS_IMETHOD OnStopDecode(imgIRequest *aRequest,
nsresult aStatus,
const PRUnichar *aStatusArg);
NS_IMETHOD FrameChanged(imgIContainer *aContainer,
gfxIImageFrame *aNewframe,
- nsIntRect *aDirtyRect);
+ nsRect *aDirtyRect);
/* get list item text, without '.' */
static PRBool AppendCounterText(PRInt32 aListStyleType,
PRInt32 aOrdinal,
nsString& aResult);
/* get list item text, with '.' */
PRBool GetListItemText(const nsStyleList& aStyleList,
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -579,25 +579,26 @@ nsIFrame::GetUsedBorder() const
"cannot call GetUsedBorder on a dirty frame not currently "
"being reflowed");
// Theme methods don't use const-ness.
nsIFrame *mutable_this = const_cast<nsIFrame*>(this);
const nsStyleDisplay *disp = GetStyleDisplay();
if (mutable_this->IsThemed(disp)) {
- nsIntMargin result;
+ nsMargin result;
nsPresContext *presContext = PresContext();
presContext->GetTheme()->GetWidgetBorder(presContext->DeviceContext(),
mutable_this, disp->mAppearance,
&result);
- return nsMargin(presContext->DevPixelsToAppUnits(result.top),
- presContext->DevPixelsToAppUnits(result.right),
- presContext->DevPixelsToAppUnits(result.bottom),
- presContext->DevPixelsToAppUnits(result.left));
+ result.top = presContext->DevPixelsToAppUnits(result.top);
+ result.right = presContext->DevPixelsToAppUnits(result.right);
+ result.bottom = presContext->DevPixelsToAppUnits(result.bottom);
+ result.left = presContext->DevPixelsToAppUnits(result.left);
+ return result;
}
return GetStyleBorder()->GetActualBorder();
}
/* virtual */ nsMargin
nsIFrame::GetUsedPadding() const
{
@@ -610,25 +611,24 @@ nsIFrame::GetUsedPadding() const
nsMargin padding(0, 0, 0, 0);
// Theme methods don't use const-ness.
nsIFrame *mutable_this = const_cast<nsIFrame*>(this);
const nsStyleDisplay *disp = GetStyleDisplay();
if (mutable_this->IsThemed(disp)) {
nsPresContext *presContext = PresContext();
- nsIntMargin widget;
if (presContext->GetTheme()->GetWidgetPadding(presContext->DeviceContext(),
mutable_this,
disp->mAppearance,
- &widget)) {
- padding.top = presContext->DevPixelsToAppUnits(widget.top);
- padding.right = presContext->DevPixelsToAppUnits(widget.right);
- padding.bottom = presContext->DevPixelsToAppUnits(widget.bottom);
- padding.left = presContext->DevPixelsToAppUnits(widget.left);
+ &padding)) {
+ padding.top = presContext->DevPixelsToAppUnits(padding.top);
+ padding.right = presContext->DevPixelsToAppUnits(padding.right);
+ padding.bottom = presContext->DevPixelsToAppUnits(padding.bottom);
+ padding.left = presContext->DevPixelsToAppUnits(padding.left);
return padding;
}
}
if (!GetStylePadding()->GetPadding(padding)) {
nsMargin *p = static_cast<nsMargin*>
(GetProperty(nsGkAtoms::usedPaddingProperty));
NS_ASSERTION(p, "used padding property missing (out of memory?)");
if (p) {
@@ -811,19 +811,19 @@ void nsDisplaySelectionOverlay::Paint(ns
gfxRGBA c(color);
c.a = .5;
gfxContext *ctx = aCtx->ThebesContext();
ctx->SetColor(c);
nsRect rect(aBuilder->ToReferenceFrame(mFrame), mFrame->GetSize());
rect.IntersectRect(rect, aDirtyRect);
- nsIntRect pxRect(nsRect::ToOutsidePixels(rect, mFrame->PresContext()->AppUnitsPerDevPixel()));
+ rect.ScaleRoundOut(1.0f / mFrame->PresContext()->AppUnitsPerDevPixel());
ctx->NewPath();
- ctx->Rectangle(gfxRect(pxRect.x, pxRect.y, pxRect.width, pxRect.height), PR_TRUE);
+ ctx->Rectangle(gfxRect(rect.x, rect.y, rect.width, rect.height), PR_TRUE);
ctx->Fill();
}
/********************************************************
* Refreshes each content's frame
*********************************************************/
nsresult
@@ -3062,23 +3062,23 @@ nsFrame::IntrinsicWidthOffsets(nsIRender
const nsStyleBorder *styleBorder = GetStyleBorder();
result.hBorder += styleBorder->GetActualBorderWidth(NS_SIDE_LEFT);
result.hBorder += styleBorder->GetActualBorderWidth(NS_SIDE_RIGHT);
const nsStyleDisplay *disp = GetStyleDisplay();
if (IsThemed(disp)) {
nsPresContext *presContext = PresContext();
- nsIntMargin border;
+ nsMargin border;
presContext->GetTheme()->GetWidgetBorder(presContext->DeviceContext(),
this, disp->mAppearance,
&border);
result.hBorder = presContext->DevPixelsToAppUnits(border.LeftRight());
- nsIntMargin padding;
+ nsMargin padding;
if (presContext->GetTheme()->GetWidgetPadding(presContext->DeviceContext(),
this, disp->mAppearance,
&padding)) {
result.hPadding = presContext->DevPixelsToAppUnits(padding.LeftRight());
result.hPctPadding = 0;
}
}
@@ -3179,26 +3179,25 @@ nsFrame::ComputeSize(nsIRenderingContext
boxSizingAdjust.height;
if (minHeight > result.height)
result.height = minHeight;
}
}
const nsStyleDisplay *disp = GetStyleDisplay();
if (IsThemed(disp)) {
- nsIntSize widget(0, 0);
+ nsSize size(0, 0);
PRBool canOverride = PR_TRUE;
nsPresContext *presContext = PresContext();
presContext->GetTheme()->
GetMinimumWidgetSize(aRenderingContext, this, disp->mAppearance,
- &widget, &canOverride);
-
- nsSize size;
- size.width = presContext->DevPixelsToAppUnits(widget.width);
- size.height = presContext->DevPixelsToAppUnits(widget.height);
+ &size, &canOverride);
+
+ size.width = presContext->DevPixelsToAppUnits(size.width);
+ size.height = presContext->DevPixelsToAppUnits(size.height);
// GMWS() returns border-box; we need content-box
size.width -= aBorder.width + aPadding.width;
size.height -= aBorder.height + aPadding.height;
if (size.height > result.height || !canOverride)
result.height = size.height;
if (size.width > result.width || !canOverride)
@@ -3545,17 +3544,19 @@ nsPoint nsIFrame::GetOffsetTo(const nsIF
// virtual
nsIntRect nsIFrame::GetScreenRectExternal() const
{
return GetScreenRect();
}
nsIntRect nsIFrame::GetScreenRect() const
{
- return nsRect::ToOutsidePixels(GetScreenRectInAppUnits(), PresContext()->AppUnitsPerDevPixel());
+ nsRect r = GetScreenRectInAppUnits().ScaleRoundOutInverse(PresContext()->AppUnitsPerDevPixel());
+ // nsRect and nsIntRect are not necessarily the same
+ return nsIntRect(r.x, r.y, r.width, r.height);
}
// virtual
nsRect nsIFrame::GetScreenRectInAppUnitsExternal() const
{
return GetScreenRectInAppUnits();
}
@@ -3565,16 +3566,17 @@ nsRect nsIFrame::GetScreenRectInAppUnits
nsPoint toViewOffset(0,0);
nsIView* view = GetClosestView(&toViewOffset);
if (view) {
nsPoint toWidgetOffset(0,0);
nsIWidget* widget = view->GetNearestWidget(&toWidgetOffset);
if (widget) {
+ // WidgetToScreen really should take nsIntRect, not nsRect
nsIntRect localRect(0,0,0,0), screenRect;
widget->WidgetToScreen(localRect, screenRect);
retval = mRect;
retval.MoveTo(toViewOffset + toWidgetOffset);
retval.x += PresContext()->DevPixelsToAppUnits(screenRect.x);
retval.y += PresContext()->DevPixelsToAppUnits(screenRect.y);
}
--- a/layout/generic/nsFrameFrame.cpp
+++ b/layout/generic/nsFrameFrame.cpp
@@ -186,17 +186,17 @@ public:
NS_IMETHOD VerifyTree() const;
// nsIReflowCallback
virtual PRBool ReflowFinished();
virtual void ReflowCallbackCanceled();
protected:
- nsIntSize GetMargin();
+ nsSize GetMargin();
PRBool IsInline() { return mIsInline; }
nsresult ShowDocShell();
nsresult CreateViewAndWidget(nsContentType aContentType);
virtual nscoord GetIntrinsicWidth();
virtual nscoord GetIntrinsicHeight();
virtual PRIntn GetSkipSides() const;
@@ -798,19 +798,19 @@ nsSubDocumentFrame::HideViewer()
baseWin->SetVisibility(PR_FALSE);
// Clear out the parentWidget, since it might be about to die with us
baseWin->SetParentWidget(nsnull);
}
}
}
-nsIntSize nsSubDocumentFrame::GetMargin()
+nsSize nsSubDocumentFrame::GetMargin()
{
- nsIntSize result(-1, -1);
+ nsSize result(-1, -1);
nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(mContent);
if (content) {
const nsAttrValue* attr = content->GetParsedAttr(nsGkAtoms::marginwidth);
if (attr && attr->Type() == nsAttrValue::eInteger)
result.width = attr->GetIntegerValue();
attr = content->GetParsedAttr(nsGkAtoms::marginheight);
if (attr && attr->Type() == nsAttrValue::eInteger)
result.height = attr->GetIntegerValue();
@@ -914,17 +914,17 @@ nsSubDocumentFrame::ShowDocShell()
if (presShell) {
// The docshell is already showing, nothing left to do...
NS_ASSERTION(mInnerView, "What's going on?");
return NS_OK;
}
// pass along marginwidth, marginheight, scrolling so sub document
// can use it
- nsIntSize margin(GetMargin());
+ nsSize margin = GetMargin();
docShell->SetMarginWidth(margin.width);
docShell->SetMarginHeight(margin.height);
// Current and initial scrolling is set so that all succeeding docs
// will use the scrolling value set here, regardless if scrolling is
// set by viewing a particular document (e.g. XUL turns off scrolling)
nsCOMPtr<nsIScrollable> sc(do_QueryInterface(docShell));
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -739,42 +739,41 @@ nsHTMLFramesetFrame* nsHTMLFramesetFrame
}
return parent;
}
// only valid for non border children
void nsHTMLFramesetFrame::GetSizeOfChildAt(PRInt32 aIndexInParent,
nsSize& aSize,
- nsIntPoint& aCellIndex)
+ nsPoint& aCellIndex)
{
PRInt32 row = aIndexInParent / mNumCols;
PRInt32 col = aIndexInParent - (row * mNumCols); // remainder from dividing index by mNumCols
if ((row < mNumRows) && (col < mNumCols)) {
aSize.width = mColSizes[col];
aSize.height = mRowSizes[row];
aCellIndex.x = col;
aCellIndex.y = row;
} else {
- aSize.width = aSize.height = 0;
- aCellIndex.x = aCellIndex.y = 0;
+ aSize.width = aSize.height = aCellIndex.x = aCellIndex.y = 0;
}
}
// only valid for non border children
void nsHTMLFramesetFrame::GetSizeOfChild(nsIFrame* aChild,
nsSize& aSize)
{
// Reflow only creates children frames for <frameset> and <frame> content.
// this assumption is used here
int i = 0;
for (nsIFrame* child = mFrames.FirstChild(); child;
child = child->GetNextSibling()) {
if (aChild == child) {
- nsIntPoint ignore;
+ nsPoint ignore;
GetSizeOfChildAt(i, aSize, ignore);
return;
}
i++;
}
aSize.width = 0;
aSize.height = 0;
}
@@ -859,17 +858,17 @@ nsHTMLFramesetFrame::BuildDisplayList(ns
}
void
nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild,
nsPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsPoint& aOffset,
nsSize& aSize,
- nsIntPoint* aCellIndex)
+ nsPoint* aCellIndex)
{
// reflow the child
nsHTMLReflowState reflowState(aPresContext, aReflowState, aChild, aSize);
nsHTMLReflowMetrics metrics;
metrics.width = aSize.width;
metrics.height= aSize.height;
nsReflowStatus status;
@@ -1064,17 +1063,17 @@ nsHTMLFramesetFrame::Reflow(nsPresContex
PRInt32 borderChildX = mNonBorderChildCount; // index of border children
nsHTMLFramesetBorderFrame* borderFrame = nsnull;
nsPoint offset(0,0);
nsSize size, lastSize;
nsIFrame* child = mFrames.FirstChild();
nsIFrame* lastChild = mFrames.LastChild();
for (PRInt32 childX = 0; childX < mNonBorderChildCount; childX++) {
- nsIntPoint cellIndex;
+ nsPoint cellIndex;
GetSizeOfChildAt(childX, size, cellIndex);
if (lastRow != cellIndex.y) { // changed to next row
offset.x = 0;
offset.y += lastSize.height;
if (firstTime) { // create horizontal border
nsRefPtr<nsStyleContext> pseudoStyleContext;
--- a/layout/generic/nsFrameSetFrame.h
+++ b/layout/generic/nsFrameSetFrame.h
@@ -122,17 +122,17 @@ public:
nsIFrame* aPrevInFlow);
static PRBool gDragInProgress;
void GetSizeOfChild(nsIFrame* aChild, nsSize& aSize);
void GetSizeOfChildAt(PRInt32 aIndexInParent,
nsSize& aSize,
- nsIntPoint& aCellIndex);
+ nsPoint& aCellIndex);
static nsHTMLFramesetFrame* GetFramesetParent(nsIFrame* aChild);
NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
nsGUIEvent* aEvent,
nsEventStatus* aEventStatus);
NS_IMETHOD GetCursor(const nsPoint& aPoint,
@@ -220,17 +220,17 @@ protected:
virtual PRIntn GetSkipSides() const;
void ReflowPlaceChild(nsIFrame* aChild,
nsPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsPoint& aOffset,
nsSize& aSize,
- nsIntPoint* aCellIndex = 0);
+ nsPoint* aCellIndex = 0);
PRBool CanResize(PRBool aVertical,
PRBool aLeft);
PRBool CanChildResize(PRBool aVertical,
PRBool aLeft,
PRInt32 aChildX,
PRBool aFrameset);
@@ -251,17 +251,17 @@ protected:
PRInt32 mEdgeVisibility;
nsBorderColor mEdgeColors;
nsFrameborder mParentFrameborder;
nscolor mParentBorderColor;
PRInt32 mParentBorderWidth;
nsHTMLFramesetBorderFrame* mDragger;
nsFramesetDrag mDrag;
- nsIntPoint mFirstDragPoint;
+ nsPoint mFirstDragPoint;
PRInt32 mPrevNeighborOrigSize; // used during resize
PRInt32 mNextNeighborOrigSize;
PRInt32 mMinDrag;
PRInt32 mChildCount;
nsHTMLFramesetFrame* mTopLevelFrameset;
nsHTMLFramesetBorderFrame** mVerBorders; // vertical borders
nsHTMLFramesetBorderFrame** mHorBorders; // horizontal borders
--- a/layout/generic/nsHTMLCanvasFrame.cpp
+++ b/layout/generic/nsHTMLCanvasFrame.cpp
@@ -54,34 +54,34 @@ NS_NewHTMLCanvasFrame(nsIPresShell* aPre
{
return new (aPresShell) nsHTMLCanvasFrame(aContext);
}
nsHTMLCanvasFrame::~nsHTMLCanvasFrame()
{
}
-nsIntSize
+nsSize
nsHTMLCanvasFrame::GetCanvasSize()
{
PRUint32 w, h;
nsresult rv;
nsCOMPtr<nsICanvasElement> canvas(do_QueryInterface(GetContent()));
if (canvas) {
rv = canvas->GetSize(&w, &h);
} else {
rv = NS_ERROR_NULL_POINTER;
}
if (NS_FAILED(rv)) {
NS_NOTREACHED("couldn't get canvas size");
h = w = 1;
}
- return nsIntSize(w, h);
+ return nsSize(w, h);
}
/* virtual */ nscoord
nsHTMLCanvasFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
{
// XXX The caller doesn't account for constraints of the height,
// min-height, and max-height properties.
nscoord result = nsPresContext::CSSPixelsToAppUnits(GetCanvasSize().width);
@@ -97,34 +97,32 @@ nsHTMLCanvasFrame::GetPrefWidth(nsIRende
nscoord result = nsPresContext::CSSPixelsToAppUnits(GetCanvasSize().width);
DISPLAY_PREF_WIDTH(this, result);
return result;
}
/* virtual */ nsSize
nsHTMLCanvasFrame::GetIntrinsicRatio()
{
- nsIntSize size(GetCanvasSize());
- return nsSize(nsPresContext::CSSPixelsToAppUnits(size.width),
- nsPresContext::CSSPixelsToAppUnits(size.height));
+ return GetCanvasSize();
}
/* virtual */ nsSize
nsHTMLCanvasFrame::ComputeSize(nsIRenderingContext *aRenderingContext,
nsSize aCBSize, nscoord aAvailableWidth,
nsSize aMargin, nsSize aBorder, nsSize aPadding,
PRBool aShrinkWrap)
{
- nsIntSize size(GetCanvasSize());
+ nsSize size = GetCanvasSize();
IntrinsicSize intrinsicSize;
intrinsicSize.width.SetCoordValue(nsPresContext::CSSPixelsToAppUnits(size.width));
intrinsicSize.height.SetCoordValue(nsPresContext::CSSPixelsToAppUnits(size.height));
- nsSize intrinsicRatio(size.width, size.height); // won't actually be used
+ nsSize& intrinsicRatio = size; // won't actually be used
return nsLayoutUtils::ComputeSizeWithIntrinsicDimensions(
aRenderingContext, this,
intrinsicSize, intrinsicRatio, aCBSize,
aMargin, aBorder, aPadding);
}
NS_IMETHODIMP
@@ -194,17 +192,17 @@ nsHTMLCanvasFrame::PaintCanvas(nsIRender
nsCOMPtr<nsICanvasElement> canvas(do_QueryInterface(GetContent()));
if (!canvas)
return;
// anything to do?
if (inner.width == 0 || inner.height == 0)
return;
- nsIntSize canvasSize(GetCanvasSize());
+ nsSize canvasSize = GetCanvasSize();
nsSize sizeAppUnits(PresContext()->DevPixelsToAppUnits(canvasSize.width),
PresContext()->DevPixelsToAppUnits(canvasSize.height));
// XXXvlad clip to aDirtyRect!
if (inner.Size() != sizeAppUnits)
{
float sx = inner.width / (float) sizeAppUnits.width;
--- a/layout/generic/nsHTMLCanvasFrame.h
+++ b/layout/generic/nsHTMLCanvasFrame.h
@@ -56,17 +56,17 @@ public:
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists);
void PaintCanvas(nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect, nsPoint aPt);
/* get the size of the canvas's image */
- nsIntSize GetCanvasSize();
+ nsSize GetCanvasSize();
virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
virtual nsSize GetIntrinsicRatio();
virtual nsSize ComputeSize(nsIRenderingContext *aRenderingContext,
nsSize aCBSize, nscoord aAvailableWidth,
nsSize aMargin, nsSize aBorder, nsSize aPadding,
--- a/layout/generic/nsHTMLReflowState.cpp
+++ b/layout/generic/nsHTMLReflowState.cpp
@@ -1824,49 +1824,47 @@ nsCSSOffsetState::InitOffsets(nscoord aC
// XXX fix to provide 0,0 for the top&bottom margins for
// inline-non-replaced elements
ComputeMargin(aContainingBlockWidth);
const nsStyleDisplay *disp = frame->GetStyleDisplay();
PRBool isThemed = frame->IsThemed(disp);
nsPresContext *presContext = frame->PresContext();
- nsIntMargin widget;
if (isThemed &&
presContext->GetTheme()->GetWidgetPadding(presContext->DeviceContext(),
frame, disp->mAppearance,
- &widget)) {
- mComputedPadding.top = presContext->DevPixelsToAppUnits(widget.top);
- mComputedPadding.right = presContext->DevPixelsToAppUnits(widget.right);
- mComputedPadding.bottom = presContext->DevPixelsToAppUnits(widget.bottom);
- mComputedPadding.left = presContext->DevPixelsToAppUnits(widget.left);
+ &mComputedPadding)) {
+ mComputedPadding.top = presContext->DevPixelsToAppUnits(mComputedPadding.top);
+ mComputedPadding.right = presContext->DevPixelsToAppUnits(mComputedPadding.right);
+ mComputedPadding.bottom = presContext->DevPixelsToAppUnits(mComputedPadding.bottom);
+ mComputedPadding.left = presContext->DevPixelsToAppUnits(mComputedPadding.left);
}
else if (aPadding) { // padding is an input arg
mComputedPadding.top = aPadding->top;
mComputedPadding.right = aPadding->right;
mComputedPadding.bottom = aPadding->bottom;
mComputedPadding.left = aPadding->left;
}
else {
ComputePadding(aContainingBlockWidth);
}
if (isThemed) {
- nsIntMargin widget;
presContext->GetTheme()->GetWidgetBorder(presContext->DeviceContext(),
frame, disp->mAppearance,
- &widget);
+ &mComputedBorderPadding);
mComputedBorderPadding.top =
- presContext->DevPixelsToAppUnits(widget.top);
+ presContext->DevPixelsToAppUnits(mComputedBorderPadding.top);
mComputedBorderPadding.right =
- presContext->DevPixelsToAppUnits(widget.right);
+ presContext->DevPixelsToAppUnits(mComputedBorderPadding.right);
mComputedBorderPadding.bottom =
- presContext->DevPixelsToAppUnits(widget.bottom);
+ presContext->DevPixelsToAppUnits(mComputedBorderPadding.bottom);
mComputedBorderPadding.left =
- presContext->DevPixelsToAppUnits(widget.left);
+ presContext->DevPixelsToAppUnits(mComputedBorderPadding.left);
}
else if (aBorder) { // border is an input arg
mComputedBorderPadding = *aBorder;
}
else {
mComputedBorderPadding = frame->GetStyleBorder()->GetActualBorder();
}
mComputedBorderPadding += mComputedPadding;
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -298,17 +298,17 @@ nsImageFrame::Init(nsIContent* aCon
PRBool
nsImageFrame::UpdateIntrinsicSize(imgIContainer* aImage)
{
NS_PRECONDITION(aImage, "null image");
PRBool intrinsicSizeChanged = PR_FALSE;
if (aImage) {
- nsIntSize imageSizeInPx;
+ nsSize imageSizeInPx;
aImage->GetWidth(&imageSizeInPx.width);
aImage->GetHeight(&imageSizeInPx.height);
nsSize newSize(nsPresContext::CSSPixelsToAppUnits(imageSizeInPx.width),
nsPresContext::CSSPixelsToAppUnits(imageSizeInPx.height));
if (mIntrinsicSize != newSize) {
intrinsicSizeChanged = PR_TRUE;
mIntrinsicSize = newSize;
}
@@ -382,17 +382,17 @@ nsImageFrame::IsPendingLoad(imgIContaine
nsCOMPtr<imgIContainer> currentContainer;
currentRequest->GetImage(getter_AddRefs(currentContainer));
return currentContainer != aContainer;
}
nsRect
-nsImageFrame::SourceRectToDest(const nsIntRect& aRect)
+nsImageFrame::SourceRectToDest(const nsRect& aRect)
{
// When scaling the image, row N of the source image may (depending on
// the scaling function) be used to draw any row in the destination image
// between floor(F * (N-1)) and ceil(F * (N+1)), where F is the
// floating-point scaling factor. The same holds true for columns.
// So, we start by computing that bound without the floor and ceiling.
nsRect r(nsPresContext::CSSPixelsToAppUnits(aRect.x - 1),
@@ -527,17 +527,17 @@ nsImageFrame::OnStartContainer(imgIReque
}
return NS_OK;
}
nsresult
nsImageFrame::OnDataAvailable(imgIRequest *aRequest,
gfxIImageFrame *aFrame,
- const nsIntRect *aRect)
+ const nsRect *aRect)
{
// XXX do we need to make sure that the reflow from the
// OnStartContainer has been processed before we start calling
// invalidate?
NS_ENSURE_ARG_POINTER(aRect);
if (!(mState & IMAGE_GOTINITIALREFLOW)) {
@@ -639,17 +639,17 @@ nsImageFrame::OnStopDecode(imgIRequest *
}
return NS_OK;
}
nsresult
nsImageFrame::FrameChanged(imgIContainer *aContainer,
gfxIImageFrame *aNewFrame,
- nsIntRect *aDirtyRect)
+ nsRect *aDirtyRect)
{
if (!GetStyleVisibility()->IsVisible()) {
return NS_OK;
}
if (IsPendingLoad(aContainer)) {
// We don't care about it
return NS_OK;
@@ -1833,17 +1833,17 @@ NS_IMETHODIMP nsImageListener::OnStartCo
if (!mFrame)
return NS_ERROR_FAILURE;
return mFrame->OnStartContainer(aRequest, aImage);
}
NS_IMETHODIMP nsImageListener::OnDataAvailable(imgIRequest *aRequest,
gfxIImageFrame *aFrame,
- const nsIntRect *aRect)
+ const nsRect *aRect)
{
if (!mFrame)
return NS_ERROR_FAILURE;
return mFrame->OnDataAvailable(aRequest, aFrame, aRect);
}
NS_IMETHODIMP nsImageListener::OnStopDecode(imgIRequest *aRequest,
@@ -1853,17 +1853,17 @@ NS_IMETHODIMP nsImageListener::OnStopDec
if (!mFrame)
return NS_ERROR_FAILURE;
return mFrame->OnStopDecode(aRequest, status, statusArg);
}
NS_IMETHODIMP nsImageListener::FrameChanged(imgIContainer *aContainer,
gfxIImageFrame *newframe,
- nsIntRect * dirtyRect)
+ nsRect * dirtyRect)
{
if (!mFrame)
return NS_ERROR_FAILURE;
return mFrame->FrameChanged(aContainer, newframe, dirtyRect);
}
static PRBool
--- a/layout/generic/nsImageFrame.h
+++ b/layout/generic/nsImageFrame.h
@@ -69,22 +69,22 @@ class nsImageListener : public nsStubIma
public:
nsImageListener(nsImageFrame *aFrame);
virtual ~nsImageListener();
NS_DECL_ISUPPORTS
// imgIDecoderObserver (override nsStubImageDecoderObserver)
NS_IMETHOD OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage);
NS_IMETHOD OnDataAvailable(imgIRequest *aRequest, gfxIImageFrame *aFrame,
- const nsIntRect *aRect);
+ const nsRect *aRect);
NS_IMETHOD OnStopDecode(imgIRequest *aRequest, nsresult status,
const PRUnichar *statusArg);
// imgIContainerObserver (override nsStubImageDecoderObserver)
NS_IMETHOD FrameChanged(imgIContainer *aContainer, gfxIImageFrame *newframe,
- nsIntRect * dirtyRect);
+ nsRect * dirtyRect);
void SetFrame(nsImageFrame *frame) { mFrame = frame; }
private:
nsImageFrame *mFrame;
};
#define IMAGE_SIZECONSTRAINED 0x00100000
@@ -220,23 +220,23 @@ protected:
void PaintImage(nsIRenderingContext& aRenderingContext, nsPoint aPt,
const nsRect& aDirtyRect, imgIContainer* aImage);
protected:
friend class nsImageListener;
nsresult OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage);
nsresult OnDataAvailable(imgIRequest *aRequest,
gfxIImageFrame *aFrame,
- const nsIntRect *rect);
+ const nsRect * rect);
nsresult OnStopDecode(imgIRequest *aRequest,
nsresult aStatus,
const PRUnichar *aStatusArg);
nsresult FrameChanged(imgIContainer *aContainer,
gfxIImageFrame *aNewframe,
- nsIntRect *aDirtyRect);
+ nsRect *aDirtyRect);
private:
// random helpers
inline void SpecToURI(const nsAString& aSpec, nsIIOService *aIOService,
nsIURI **aURI);
inline void GetLoadGroup(nsPresContext *aPresContext,
nsILoadGroup **aLoadGroup);
@@ -263,17 +263,17 @@ private:
*/
PRBool IsPendingLoad(imgIRequest* aRequest) const;
PRBool IsPendingLoad(imgIContainer* aContainer) const;
/**
* Function to convert a dirty rect in the source image to a dirty
* rect for the image frame.
*/
- nsRect SourceRectToDest(const nsIntRect & aRect);
+ nsRect SourceRectToDest(const nsRect & aRect);
nsImageMap* mImageMap;
nsCOMPtr<imgIDecoderObserver> mListener;
nsSize mComputedSize;
nsSize mIntrinsicSize;
nsTransform2D mTransform;
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -518,16 +518,20 @@ private:
nsIPluginInstance* mInstance;
const nsIntSize& mPluginSize;
const nsIntRect& mDirtyRect;
};
#endif
};
+#if defined(XP_WIN) || (defined(DO_DIRTY_INTERSECT) && defined(XP_MACOSX)) || defined(XP_OS2)
+static void ConvertAppUnitsToPixels(const nsPresContext& aPresContext, const nsRect& aTwipsRect, nsIntRect& aPixelRect);
+#endif
+
// Mac specific code to fix up port position and clip during paint
#ifdef XP_MACOSX
#ifdef DO_DIRTY_INTERSECT
// convert relative coordinates to absolute
static void ConvertRelativeToWindowAbsolute(nsIFrame* aFrame, nsPoint& aRel, nsPoint& aAbs, nsIWidget *&aContainerWidget);
#endif
@@ -907,17 +911,17 @@ nsObjectFrame::FixupWindow(const nsSize&
NS_ENSURE_TRUE(window, /**/);
#ifdef XP_MACOSX
mInstanceOwner->FixUpPluginWindow(ePluginPaintDisable);
#endif
PRBool windowless = (window->type == nsPluginWindowType_Drawable);
- nsIntPoint origin = GetWindowOriginInPixels(windowless);
+ nsPoint origin = GetWindowOriginInPixels(windowless);
window->x = origin.x;
window->y = origin.y;
window->width = presContext->AppUnitsToDevPixels(aSize.width);
window->height = presContext->AppUnitsToDevPixels(aSize.height);
// on the Mac we need to set the clipRect to { 0, 0, 0, 0 } for now. This will keep
@@ -954,17 +958,17 @@ nsObjectFrame::CallSetWindow()
mInstanceOwner->FixUpPluginWindow(ePluginPaintDisable);
#endif
if (IsHidden())
return;
PRBool windowless = (window->type == nsPluginWindowType_Drawable);
- nsIntPoint origin = GetWindowOriginInPixels(windowless);
+ nsPoint origin = GetWindowOriginInPixels(windowless);
window->x = origin.x;
window->y = origin.y;
// refresh the plugin port as well
window->window = mInstanceOwner->GetPluginPort();
// this will call pi->SetWindow and take care of window subclassing
@@ -1007,17 +1011,17 @@ nsObjectFrame::IsHidden(PRBool aCheckVis
!hidden.LowerCaseEqualsLiteral("off")))) {
return PR_TRUE;
}
}
return PR_FALSE;
}
-nsIntPoint nsObjectFrame::GetWindowOriginInPixels(PRBool aWindowless)
+nsPoint nsObjectFrame::GetWindowOriginInPixels(PRBool aWindowless)
{
nsIView * parentWithView;
nsPoint origin(0,0);
GetOffsetFromView(origin, &parentWithView);
// if it's windowless, let's make sure we have our origin set right
// it may need to be corrected, like after scrolling
@@ -1036,18 +1040,20 @@ nsIntPoint nsObjectFrame::GetWindowOrigi
if (theView->GetViewManager() != parentVM)
break;
origin += theView->GetPosition();
theView = theView->GetParent();
}
}
- return nsIntPoint(PresContext()->AppUnitsToDevPixels(origin.x),
- PresContext()->AppUnitsToDevPixels(origin.y));
+ origin.x = PresContext()->AppUnitsToDevPixels(origin.x);
+ origin.y = PresContext()->AppUnitsToDevPixels(origin.y);
+
+ return origin;
}
NS_IMETHODIMP
nsObjectFrame::DidReflow(nsPresContext* aPresContext,
const nsHTMLReflowState* aReflowState,
nsDidReflowStatus aStatus)
{
// Do this check before calling the superclass, as that clears
@@ -1416,17 +1422,17 @@ nsObjectFrame::PaintPlugin(nsIRenderingC
if (window->type == nsPluginWindowType_Drawable) {
// FIXME - Bug 385435: Doesn't aDirtyRect need translating too?
nsIRenderingContext::AutoPushTranslation
translate(&aRenderingContext, aFramePt.x, aFramePt.y);
// check if we need to call SetWindow with updated parameters
PRBool doupdatewindow = PR_FALSE;
// the offset of the DC
- nsIntPoint origin;
+ nsPoint origin;
/*
* Layout now has an optimized way of painting. Now we always get
* a new drawing surface, sized to be just what's needed. Windowless
* plugins need a transform applied to their origin so they paint
* in the right place. Since |SetWindow| is no longer being used
* to tell the plugin where it is, we dispatch a NPWindow through
* |HandleEvent| to tell the plugin when its window moved
@@ -1510,17 +1516,17 @@ nsObjectFrame::PaintPlugin(nsIRenderingC
// must be clipped in some way to prevent the plugin attempting to paint over areas it shouldn't;
//
// since the two uses of the rectangle are mutually exclusive in some cases,
// and since I don't see any incorrect painting (at least with Flash and ViewPoint - the originator of 135737),
// it seems that windowless plugins are not relying on information here for clipping their drawing,
// and we can safely use this message to tell the plugin exactly where it is in all cases.
origin = GetWindowOriginInPixels(PR_TRUE);
- nsIntRect winlessRect(origin, nsIntSize(window->width, window->height));
+ nsRect winlessRect = nsRect(origin, nsSize(window->width, window->height));
// XXX I don't think we can be certain that the location wrt to
// the window only changes when the location wrt to the drawable
// changes, but the hdc probably changes on every paint so
// doupdatewindow is rarely false, and there is not likely to be
// a problem.
if (mWindowlessRect != winlessRect) {
mWindowlessRect = winlessRect;
@@ -3699,18 +3705,18 @@ nsEventStatus nsPluginInstanceOwner::Pro
const nsPresContext* presContext = mOwner->PresContext();
nsPoint appPoint =
nsLayoutUtils::GetEventCoordinatesRelativeTo(&anEvent, mOwner);
nsIntPoint pluginPoint(presContext->AppUnitsToDevPixels(appPoint.x),
presContext->AppUnitsToDevPixels(appPoint.y));
const nsMouseEvent& mouseEvent =
static_cast<const nsMouseEvent&>(anEvent);
// Get reference point relative to screen:
- nsIntRect windowRect(anEvent.refPoint, nsIntSize(1, 1));
- nsIntRect rootPoint(-1,-1,1,1);
+ nsRect windowRect(anEvent.refPoint, nsSize(1, 1));
+ nsRect rootPoint(-1,-1,1,1);
if (widget)
widget->WidgetToScreen(windowRect, rootPoint);
#ifdef MOZ_WIDGET_GTK2
Window root = GDK_ROOT_WINDOW();
#else
Window root = None; // Could XQueryTree, but this is not important.
#endif
@@ -3973,18 +3979,22 @@ void nsPluginInstanceOwner::Paint(const
#ifdef DO_DIRTY_INTERSECT // aDirtyRect isn't always correct, see bug 56128
nsPoint rel(aDirtyRect.x, aDirtyRect.y);
nsPoint abs(0,0);
nsCOMPtr<nsIWidget> containerWidget;
// Convert dirty rect relative coordinates to absolute and also get the containerWidget
ConvertRelativeToWindowAbsolute(mOwner, rel, abs, *getter_AddRefs(containerWidget));
+ nsRect absDirtyRect = nsRect(abs.x, abs.y, aDirtyRect.width, aDirtyRect.height);
+
// Convert to absolute pixel values for the dirty rect
- nsIntRect absDirtyRect(nsRect::ToOutsidePixels(nsRect(abs, aDirtyRect), *mOwner->GetPresContext()->AppUnitsPerDevPixel()));
+ nsIntRect absDirtyRectInPixels;
+ ConvertAppUnitsToPixels(*mOwner->GetPresContext(), absDirtyRect,
+ absDirtyRectInPixels);
#endif
nsCOMPtr<nsIPluginWidget> pluginWidget = do_QueryInterface(mWidget);
if (pluginWidget && NS_SUCCEEDED(pluginWidget->StartDrawPlugin())) {
WindowRef window = FixUpPluginWindow(ePluginPaintEnable);
if (window) {
EventRecord updateEvent;
InitializeEventRecord(&updateEvent);
@@ -4003,25 +4013,28 @@ void nsPluginInstanceOwner::Paint(const
#ifdef XP_WIN
void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect, HDC ndc)
{
if (!mInstance || !mOwner)
return;
nsPluginWindow * window;
GetWindow(window);
- nsIntRect relDirtyRect(nsRect::ToOutsidePixels(aDirtyRect, mOwner->PresContext()->AppUnitsPerDevPixel()));
+ nsRect relDirtyRect = nsRect(aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height);
+ nsIntRect relDirtyRectInPixels;
+ ConvertAppUnitsToPixels(*mOwner->PresContext(), relDirtyRect,
+ relDirtyRectInPixels);
// we got dirty rectangle in relative window coordinates, but we
// need it in absolute units and in the (left, top, right, bottom) form
RECT drc;
- drc.left = relDirtyRect.x + window->x;
- drc.top = relDirtyRect.y + window->y;
- drc.right = drc.left + relDirtyRect.width;
- drc.bottom = drc.top + relDirtyRect.height;
+ drc.left = relDirtyRectInPixels.x + window->x;
+ drc.top = relDirtyRectInPixels.y + window->y;
+ drc.right = drc.left + relDirtyRectInPixels.width;
+ drc.bottom = drc.top + relDirtyRectInPixels.height;
nsPluginEvent pluginEvent;
pluginEvent.event = WM_PAINT;
pluginEvent.wParam = (uint32)ndc;
pluginEvent.lParam = (uint32)&drc;
PRBool eventHandled = PR_FALSE;
mInstance->HandleEvent(&pluginEvent, &eventHandled);
}
@@ -4030,25 +4043,28 @@ void nsPluginInstanceOwner::Paint(const
#ifdef XP_OS2
void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect, HPS aHPS)
{
if (!mInstance || !mOwner)
return;
nsPluginWindow * window;
GetWindow(window);
- nsIntRect relDirtyRect(nsRect::ToOutsidePixels(aDirtyRect, mOwner->PresContext()->AppUnitsPerDevicePixel()));
+ nsRect relDirtyRect = nsRect(aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height);
+ nsIntRect relDirtyRectInPixels;
+ ConvertAppUnitsToPixels(*mOwner->PresContext(), relDirtyRect,
+ relDirtyRectInPixels);
// we got dirty rectangle in relative window coordinates, but we
// need it in absolute units and in the (left, top, right, bottom) form
RECTL rectl;
- rectl.xLeft = relDirtyRect.x + window->x;
- rectl.yBottom = relDirtyRect.y + window->y;
- rectl.xRight = rectl.xLeft + relDirtyRect.width;
- rectl.yTop = rectl.yBottom + relDirtyRect.height;
+ rectl.xLeft = relDirtyRectInPixels.x + window->x;
+ rectl.yBottom = relDirtyRectInPixels.y + window->y;
+ rectl.xRight = rectl.xLeft + relDirtyRectInPixels.width;
+ rectl.yTop = rectl.yBottom + relDirtyRectInPixels.height;
nsPluginEvent pluginEvent;
pluginEvent.event = WM_PAINT;
pluginEvent.wParam = (uint32)aHPS;
pluginEvent.lParam = (uint32)&rectl;
PRBool eventHandled = PR_FALSE;
mInstance->HandleEvent(&pluginEvent, &eventHandled);
}
@@ -4523,16 +4539,27 @@ NS_IMETHODIMP nsPluginInstanceOwner::Cre
return rv;
}
void nsPluginInstanceOwner::SetPluginHost(nsIPluginHost* aHost)
{
mPluginHost = aHost;
}
+#if defined(XP_WIN) || (defined(DO_DIRTY_INTERSECT) && defined(XP_MACOSX)) || defined(XP_OS2)
+// convert frame coordinates from twips to pixels
+static void ConvertAppUnitsToPixels(const nsPresContext& aPresContext, const nsRect& aTwipsRect, nsIntRect& aPixelRect)
+{
+ aPixelRect.x = aPresContext.AppUnitsToDevPixels(aTwipsRect.x);
+ aPixelRect.y = aPresContext.AppUnitsToDevPixels(aTwipsRect.y);
+ aPixelRect.width = aPresContext.AppUnitsToDevPixels(aTwipsRect.width);
+ aPixelRect.height = aPresContext.AppUnitsToDevPixels(aTwipsRect.height);
+}
+#endif
+
// Mac specific code to fix up the port location and clipping region
#ifdef XP_MACOSX
#ifdef DO_DIRTY_INTERSECT
// Convert from a frame relative coordinate to a coordinate relative to its
// containing window
static void ConvertRelativeToWindowAbsolute(nsIFrame* aFrame,
nsPoint& aRel,
@@ -4603,23 +4630,23 @@ WindowRef nsPluginInstanceOwner::FixUpPl
else if (drawingModel == NPDrawingModelCoreGraphics)
#endif
{
// This would be a lot easier if we could use obj-c here,
// but we can't. Since we have only nsIWidget and we can't
// use its native widget (an obj-c object) we have to go
// from the widget's screen coordinates to its window coords
// instead of straight to window coords.
- nsIntRect geckoBounds;
+ nsRect geckoBounds;
mWidget->GetBounds(geckoBounds);
// we need a rect that is the entire *internal* rect, so the
// x and y coords are 0, width is the same.
geckoBounds.x = 0;
geckoBounds.y = 0;
- nsIntRect geckoScreenCoords;
+ nsRect geckoScreenCoords;
mWidget->WidgetToScreen(geckoBounds, geckoScreenCoords);
Rect windowRect;
WindowRef window = (WindowRef)pluginPort->cgPort.window;
::GetWindowBounds(window, kWindowStructureRgn, &windowRect);
mPluginWindow->x = geckoScreenCoords.x - windowRect.left;
mPluginWindow->y = geckoScreenCoords.y - windowRect.top;
--- a/layout/generic/nsObjectFrame.h
+++ b/layout/generic/nsObjectFrame.h
@@ -170,17 +170,17 @@ protected:
PRBool IsFocusable(PRInt32 *aTabIndex = nsnull, PRBool aWithMouse = PR_FALSE);
// check attributes and optionally CSS to see if we should display anything
PRBool IsHidden(PRBool aCheckVisibilityStyle = PR_TRUE) const;
void NotifyContentObjectWrapper();
- nsIntPoint GetWindowOriginInPixels(PRBool aWindowless);
+ nsPoint GetWindowOriginInPixels(PRBool aWindowless);
static void PaintPrintPlugin(nsIFrame* aFrame,
nsIRenderingContext* aRenderingContext,
const nsRect& aDirtyRect, nsPoint aPt);
static void PaintPlugin(nsIFrame* aFrame,
nsIRenderingContext* aRenderingContext,
const nsRect& aDirtyRect, nsPoint aPt);
void PrintPlugin(nsIRenderingContext& aRenderingContext,
@@ -192,17 +192,17 @@ protected:
* Makes sure that mInstanceOwner is valid and without a current plugin
* instance. Essentially, this prepares the frame to receive a new plugin.
*/
NS_HIDDEN_(nsresult) PrepareInstanceOwner();
friend class nsPluginInstanceOwner;
private:
nsRefPtr<nsPluginInstanceOwner> mInstanceOwner;
- nsIntRect mWindowlessRect;
+ nsRect mWindowlessRect;
// For assertions that make it easier to determine if a crash is due
// to the underlying problem described in bug 136927, and to prevent
// reentry into instantiation.
PRBool mPreventInstantiation;
};
--- a/layout/generic/nsPageFrame.cpp
+++ b/layout/generic/nsPageFrame.cpp
@@ -540,18 +540,19 @@ nsPageFrame::PaintPageContent(nsIRenderi
nsIFrame* pageContentFrame = mFrames.FirstChild();
nsRect rect = aDirtyRect;
float scale = PresContext()->GetPageScale();
aRenderingContext.PushState();
nsPoint framePos = aPt + pageContentFrame->GetOffsetTo(this);
aRenderingContext.Translate(framePos.x, framePos.y);
// aPt translates to coords relative to this, then margins translate to
// pageContentFrame's coords
+ rect -= framePos;
aRenderingContext.Scale(scale, scale);
- rect = (rect - framePos).ScaleRoundOutInverse(scale);
+ rect.ScaleRoundOut(1.0f / scale);
// Make sure we don't draw where we aren't supposed to draw, especially
// when printing selection
nsRect clipRect(nsPoint(0, 0), pageContentFrame->GetSize());
// Note: this computation matches how we compute maxSize.height
// in nsPageFrame::Reflow
nscoord expectedPageContentHeight =
NSToCoordCeil((GetSize().height - mPD->mReflowMargin.TopBottom()) / scale);
if (clipRect.height > expectedPageContentHeight) {
--- a/layout/generic/nsSimplePageSequence.cpp
+++ b/layout/generic/nsSimplePageSequence.cpp
@@ -194,35 +194,35 @@ nsSimplePageSequenceFrame::Reflow(nsPres
// See if we can get a Print Settings from the Context
if (!mPageData->mPrintSettings &&
aPresContext->Medium() == nsGkAtoms::print) {
mPageData->mPrintSettings = aPresContext->GetPrintSettings();
}
// now get out margins & edges
if (mPageData->mPrintSettings) {
- nsIntMargin unwriteableTwips;
+ nsMargin unwriteableTwips;
mPageData->mPrintSettings->GetUnwriteableMarginInTwips(unwriteableTwips);
NS_ASSERTION(unwriteableTwips.left >= 0 && unwriteableTwips.top >= 0 &&
unwriteableTwips.right >= 0 && unwriteableTwips.bottom >= 0,
"Unwriteable twips should be non-negative");
- nsIntMargin marginTwips;
+ nsMargin marginTwips;
mPageData->mPrintSettings->GetMarginInTwips(marginTwips);
mMargin = aPresContext->TwipsToAppUnits(marginTwips + unwriteableTwips);
PRInt16 printType;
mPageData->mPrintSettings->GetPrintRange(&printType);
mPrintRangeType = printType;
- nsIntMargin edgeTwips;
+ nsMargin edgeTwips;
mPageData->mPrintSettings->GetEdgeInTwips(edgeTwips);
// sanity check the values. three inches are sometimes needed
- PRInt32 inchInTwips = NS_INCHES_TO_TWIPS(3.0);
+ nscoord inchInTwips = NS_INCHES_TO_TWIPS(3.0);
edgeTwips.top = PR_MIN(PR_MAX(edgeTwips.top, 0), inchInTwips);
edgeTwips.bottom = PR_MIN(PR_MAX(edgeTwips.bottom, 0), inchInTwips);
edgeTwips.left = PR_MIN(PR_MAX(edgeTwips.left, 0), inchInTwips);
edgeTwips.right = PR_MIN(PR_MAX(edgeTwips.right, 0), inchInTwips);
mPageData->mEdgePaperMargin =
aPresContext->TwipsToAppUnits(edgeTwips + unwriteableTwips);
}
@@ -695,18 +695,19 @@ void
nsSimplePageSequenceFrame::PaintPageSequence(nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
nsPoint aPt) {
nsRect rect = aDirtyRect;
float scale = PresContext()->GetPrintPreviewScale();
aRenderingContext.PushState();
nsPoint framePos = aPt;
aRenderingContext.Translate(framePos.x, framePos.y);
+ rect -= framePos;
aRenderingContext.Scale(scale, scale);
- rect = (rect - framePos).ScaleRoundOutInverse(scale);
+ rect.ScaleRoundOut(1.0f / scale);
// Now the rect and the rendering coordinates are are relative to this frame.
// Loop over the pages and paint them.
nsIFrame* child = GetFirstChild(nsnull);
while (child) {
nsPoint pt = child->GetPosition();
// The rendering context has to be translated before each call to PaintFrame
aRenderingContext.PushState();
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -2197,18 +2197,18 @@ nsPrintEngine::DoPrint(nsPrintObject * a
selectionPS = poPresShell->GetCurrentSelection(nsISelectionController::SELECTION_NORMAL);
rv = GetPageRangeForSelection(poPresShell, poPresContext, *rc, selectionPS, pageSequence,
&startFrame, startPageNum, startRect,
&endFrame, endPageNum, endRect);
if (NS_SUCCEEDED(rv)) {
mPrt->mPrintSettings->SetStartPageRange(startPageNum);
mPrt->mPrintSettings->SetEndPageRange(endPageNum);
- nsIntMargin marginTwips(0,0,0,0);
- nsIntMargin unwrtMarginTwips(0,0,0,0);
+ nsMargin marginTwips(0,0,0,0);
+ nsMargin unwrtMarginTwips(0,0,0,0);
mPrt->mPrintSettings->GetMarginInTwips(marginTwips);
mPrt->mPrintSettings->GetUnwriteableMarginInTwips(unwrtMarginTwips);
nsMargin totalMargin = poPresContext->TwipsToAppUnits(marginTwips +
unwrtMarginTwips);
if (startPageNum == endPageNum) {
{
startRect.y -= totalMargin.top;
endRect.y -= totalMargin.top;
--- a/layout/svg/base/src/nsSVGEffects.cpp
+++ b/layout/svg/base/src/nsSVGEffects.cpp
@@ -122,17 +122,18 @@ nsSVGFilterProperty::nsSVGFilterProperty
UpdateRect();
}
void
nsSVGFilterProperty::UpdateRect()
{
nsSVGFilterFrame *filter = GetFilterFrame(nsnull);
if (filter) {
- mFilterRect = nsIntRect::ToAppUnits(filter->GetFilterBBox(mFrame, nsnull), filter->PresContext()->AppUnitsPerDevPixel());
+ mFilterRect = filter->GetFilterBBox(mFrame, nsnull);
+ mFilterRect.ScaleRoundOut(filter->PresContext()->AppUnitsPerDevPixel());
} else {
mFilterRect = nsRect();
}
}
void
nsSVGFilterProperty::DoUpdate()
{
--- a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp
+++ b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp
@@ -695,17 +695,18 @@ void
nsSVGForeignObjectFrame::InvalidateDirtyRect(nsSVGOuterSVGFrame* aOuter,
const nsRect& aRect, PRUint32 aFlags)
{
if (aRect.IsEmpty())
return;
nsPresContext* presContext = PresContext();
nsCOMPtr<nsIDOMSVGMatrix> tm = GetTMIncludingOffset();
- nsIntRect r(nsRect::ToOutsidePixels(aRect, presContext->AppUnitsPerDevPixel()));
+ nsIntRect r = aRect;
+ r.ScaleRoundOut(1.0f / presContext->AppUnitsPerDevPixel());
float x = r.x, y = r.y, w = r.width, h = r.height;
nsRect rect = GetTransformedRegion(x, y, w, h, tm, presContext);
// XXX invalidate the entire covered region
// See bug 418063
rect.UnionRect(rect, mRect);
rect = nsSVGUtils::FindFilterInvalidation(this, rect);
--- a/layout/svg/base/src/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/base/src/nsSVGIntegrationUtils.cpp
@@ -118,19 +118,19 @@ nsSVGIntegrationUtils::ComputeFrameEffec
// XXX this isn't really right. We can't compute the correct filter
// bbox until all aFrame's continuations have been reflowed.
// but then it's too late to set the overflow areas for the earlier frames.
nsRect userSpaceRect = GetNonSVGUserSpace(firstFrame);
nsRect r = GetSVGBBox(firstFrame, aFrame, aOverflowRect, userSpaceRect);
// r is relative to user space
PRUint32 appUnitsPerDevPixel = aFrame->PresContext()->AppUnitsPerDevPixel();
- nsIntRect p(nsRect::ToOutsidePixels(r, appUnitsPerDevPixel));
- p = filterFrame->GetFilterBBox(firstFrame, &p);
- r = nsIntRect::ToAppUnits(p, appUnitsPerDevPixel);
+ r.ScaleRoundOutInverse(appUnitsPerDevPixel);
+ r = filterFrame->GetFilterBBox(firstFrame, &r);
+ r.ScaleRoundOut(appUnitsPerDevPixel);
// Make it relative to aFrame again
return r + userSpaceRect.TopLeft() - aFrame->GetOffsetTo(firstFrame);
}
nsRect
nsSVGIntegrationUtils::GetInvalidAreaForChangedSource(nsIFrame* aFrame,
const nsRect& aInvalidRect)
{
@@ -141,19 +141,19 @@ nsSVGIntegrationUtils::GetInvalidAreaFor
nsSVGFilterFrame* filterFrame = nsSVGEffects::GetFilterFrame(firstFrame);
if (!filterFrame)
return aInvalidRect;
PRInt32 appUnitsPerDevPixel = aFrame->PresContext()->AppUnitsPerDevPixel();
nsRect userSpaceRect = GetNonSVGUserSpace(firstFrame);
nsPoint offset = aFrame->GetOffsetTo(firstFrame) - userSpaceRect.TopLeft();
nsRect r = aInvalidRect + offset;
- nsIntRect p(nsRect::ToOutsidePixels(r, appUnitsPerDevPixel));
- p = filterFrame->GetInvalidationBBox(firstFrame, p);
- r = nsIntRect::ToAppUnits(p, appUnitsPerDevPixel);
+ r.ScaleRoundOutInverse(appUnitsPerDevPixel);
+ r = filterFrame->GetInvalidationBBox(firstFrame, r);
+ r.ScaleRoundOut(appUnitsPerDevPixel);
return r - offset;
}
nsRect
nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(nsIFrame* aFrame,
const nsRect& aDamageRect)
{
// Don't bother calling GetEffectProperties; the filter property should
@@ -164,19 +164,19 @@ nsSVGIntegrationUtils::GetRequiredSource
nsSVGEffects::GetFilterFrame(firstFrame);
if (!filterFrame)
return aDamageRect;
PRInt32 appUnitsPerDevPixel = aFrame->PresContext()->AppUnitsPerDevPixel();
nsRect userSpaceRect = GetNonSVGUserSpace(firstFrame);
nsPoint offset = aFrame->GetOffsetTo(firstFrame) - userSpaceRect.TopLeft();
nsRect r = aDamageRect + offset;
- nsIntRect p(nsRect::ToOutsidePixels(r, appUnitsPerDevPixel));
- p = filterFrame->GetSourceForInvalidArea(firstFrame, p);
- r = nsIntRect::ToAppUnits(p, appUnitsPerDevPixel);
+ r.ScaleRoundOutInverse(appUnitsPerDevPixel);
+ r = filterFrame->GetSourceForInvalidArea(firstFrame, r);
+ r.ScaleRoundOut(appUnitsPerDevPixel);
return r - offset;
}
PRBool
nsSVGIntegrationUtils::HitTestFrameForEffects(nsIFrame* aFrame, const nsPoint& aPt)
{
nsIFrame* firstFrame =
nsLayoutUtils::GetFirstContinuationOrSpecialSibling(aFrame);
@@ -211,17 +211,18 @@ public:
// adjust.
gfxFloat scale =
nsPresContext::AppUnitsToFloatCSSPixels(aTarget->PresContext()->AppUnitsPerDevPixel());
gfxCtx->Scale(scale, scale);
nsIRenderingContext::AutoPushTranslation push(ctx, -mOffset.x, -mOffset.y);
nsRect dirty;
if (aDirtyRect) {
- dirty = nsIntRect::ToAppUnits(*aDirtyRect, nsIDeviceContext::AppUnitsPerCSSPixel());
+ dirty = *aDirtyRect;
+ dirty.ScaleRoundOut(nsIDeviceContext::AppUnitsPerCSSPixel());
dirty += mOffset;
} else {
dirty = mInnerList->GetBounds(mBuilder);
}
mInnerList->Paint(mBuilder, ctx, dirty);
}
private:
@@ -284,17 +285,18 @@ nsSVGIntegrationUtils::PaintFramesWithEf
}
gfxContext* gfx = aCtx->ThebesContext();
gfxMatrix savedCTM = gfx->CurrentMatrix();
nsSVGRenderState svgContext(aCtx);
nsRect userSpaceRect = GetNonSVGUserSpace(firstFrame) + aBuilder->ToReferenceFrame(firstFrame);
PRInt32 appUnitsPerDevPixel = aEffectsFrame->PresContext()->AppUnitsPerDevPixel();
- userSpaceRect = nsIntRect::ToAppUnits(nsRect::ToNearestPixels(userSpaceRect, appUnitsPerDevPixel), appUnitsPerDevPixel);
+ userSpaceRect.ScaleRoundPreservingCentersInverse(appUnitsPerDevPixel);
+ userSpaceRect.ScaleRoundOut(appUnitsPerDevPixel);
aCtx->Translate(userSpaceRect.x, userSpaceRect.y);
nsCOMPtr<nsIDOMSVGMatrix> matrix = GetInitialMatrix(aEffectsFrame);
PRBool complexEffects = PR_FALSE;
/* Check if we need to do additional operations on this child's
* rendering, which necessitates rendering into another surface. */
if (opacity != 1.0f || maskFrame || (clipPathFrame && !isTrivialClip)) {
@@ -309,17 +311,18 @@ nsSVGIntegrationUtils::PaintFramesWithEf
if (clipPathFrame && isTrivialClip) {
gfx->Save();
clipPathFrame->ClipPaint(&svgContext, aEffectsFrame, matrix);
}
/* Paint the child */
if (filterFrame) {
RegularFramePaintCallback paint(aBuilder, aInnerList, userSpaceRect.TopLeft());
- nsIntRect r(nsRect::ToOutsidePixels(aDirtyRect - userSpaceRect.TopLeft(), appUnitsPerDevPixel));
+ nsRect r = aDirtyRect - userSpaceRect.TopLeft();
+ r.ScaleRoundOutInverse(appUnitsPerDevPixel);
filterFrame->FilterPaint(&svgContext, aEffectsFrame, &paint, &r);
} else {
gfx->SetMatrix(savedCTM);
aInnerList->Paint(aBuilder, aCtx, aDirtyRect);
aCtx->Translate(userSpaceRect.x, userSpaceRect.y);
}
if (clipPathFrame && isTrivialClip) {
--- a/layout/svg/base/src/nsSVGOuterSVGFrame.cpp
+++ b/layout/svg/base/src/nsSVGOuterSVGFrame.cpp
@@ -555,32 +555,32 @@ nsSVGOuterSVGFrame::Paint(nsIRenderingCo
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
aRenderingContext.Translate(viewportRect.x, viewportRect.y);
nsRect dirtyRect = clipRect - viewportOffset;
#if defined(DEBUG) && defined(SVG_DEBUG_PAINT_TIMING)
PRTime start = PR_Now();
#endif
- nsIntRect dirtyPxRect(nsRect::ToOutsidePixels(dirtyRect, PresContext()->AppUnitsPerDevPixel()));
+ dirtyRect.ScaleRoundOut(1.0f / PresContext()->AppUnitsPerDevPixel());
nsSVGRenderState ctx(&aRenderingContext);
#ifdef XP_MACOSX
if (mEnableBitmapFallback) {
// nquartz fallback paths, which svg tends to trigger, need
// a non-window context target
ctx.GetGfxContext()->PushGroup(gfxASurface::CONTENT_COLOR_ALPHA);
}
#endif
// paint children:
for (nsIFrame* kid = mFrames.FirstChild(); kid;
kid = kid->GetNextSibling()) {
- nsSVGUtils::PaintChildWithEffects(&ctx, &dirtyPxRect, kid);
+ nsSVGUtils::PaintChildWithEffects(&ctx, &dirtyRect, kid);
}
#ifdef XP_MACOSX
if (mEnableBitmapFallback) {
// show the surface we pushed earlier for fallbacks
ctx.GetGfxContext()->PopGroupToSource();
ctx.GetGfxContext()->Paint();
}
--- a/layout/svg/base/src/nsSVGUtils.cpp
+++ b/layout/svg/base/src/nsSVGUtils.cpp
@@ -580,33 +580,35 @@ nsSVGUtils::GetBBox(nsFrameList *aFrames
return NS_ERROR_FAILURE;
}
nsRect
nsSVGUtils::FindFilterInvalidation(nsIFrame *aFrame, const nsRect& aRect)
{
PRInt32 appUnitsPerDevPixel = aFrame->PresContext()->AppUnitsPerDevPixel();
- nsIntRect rect(nsRect::ToOutsidePixels(aRect, appUnitsPerDevPixel));
+ nsRect rect = aRect;
+ rect.ScaleRoundOutInverse(appUnitsPerDevPixel);
while (aFrame) {
if (aFrame->GetStateBits() & NS_STATE_IS_OUTER_SVG)
break;
nsSVGFilterProperty *property = nsSVGEffects::GetFilterProperty(aFrame);
if (property) {
nsSVGFilterFrame *filter = property->GetFilterFrame(nsnull);
if (filter) {
rect = filter->GetInvalidationBBox(aFrame, rect);
}
}
aFrame = aFrame->GetParent();
}
- return nsIntRect::ToAppUnits(rect, appUnitsPerDevPixel);
+ rect.ScaleRoundOut(appUnitsPerDevPixel);
+ return rect;
}
void
nsSVGUtils::UpdateFilterRegion(nsIFrame *aFrame)
{
nsSVGEffects::EffectProperties props =
nsSVGEffects::GetEffectProperties(aFrame);
if (props.mFilter) {
@@ -990,17 +992,18 @@ nsSVGUtils::PaintChildWithEffects(nsSVGR
* true for path geometry and glyphs, so basically we're traversing
* all containers and we can only skip leaves here.
*/
if (aDirtyRect && svgChildFrame->HasValidCoveredRect()) {
if (filterFrame) {
if (!aDirtyRect->Intersects(filterFrame->GetFilterBBox(aFrame, nsnull)))
return;
} else {
- nsRect rect(nsIntRect::ToAppUnits(*aDirtyRect, aFrame->PresContext()->AppUnitsPerDevPixel()));
+ nsRect rect = *aDirtyRect;
+ rect.ScaleRoundOut(aFrame->PresContext()->AppUnitsPerDevPixel());
if (!rect.Intersects(aFrame->GetRect()))
return;
}
}
/* SVG defines the following rendering model:
*
* 1. Render geometry
--- a/layout/xul/base/public/nsXULPopupManager.h
+++ b/layout/xul/base/public/nsXULPopupManager.h
@@ -719,17 +719,17 @@ protected:
nsCOMPtr<nsIDOMEventTarget> mKeyListener;
// widget that is currently listening to rollup events
nsCOMPtr<nsIWidget> mWidget;
// range parent and offset set in SetTriggerEvent
nsCOMPtr<nsIDOMNode> mRangeParent;
PRInt32 mRangeOffset;
- nsIntPoint mCachedMousePoint;
+ nsPoint mCachedMousePoint;
// set to the currently active menu bar, if any
nsMenuBarFrame* mActiveMenuBar;
// linked list of dismissable menus.
nsMenuChainItem* mCurrentMenu;
// linked list of panels
--- a/layout/xul/base/src/nsBox.cpp
+++ b/layout/xul/base/src/nsBox.cpp
@@ -339,17 +339,17 @@ nsBox::GetBorder(nsMargin& aMargin)
{
aMargin.SizeTo(0,0,0,0);
const nsStyleDisplay* disp = GetStyleDisplay();
if (disp->mAppearance && gTheme) {
// Go to the theme for the border.
nsPresContext *context = PresContext();
if (gTheme->ThemeSupportsWidget(context, this, disp->mAppearance)) {
- nsIntMargin margin(0, 0, 0, 0);
+ nsMargin margin(0, 0, 0, 0);
gTheme->GetWidgetBorder(context->DeviceContext(), this,
disp->mAppearance, &margin);
aMargin.top = context->DevPixelsToAppUnits(margin.top);
aMargin.right = context->DevPixelsToAppUnits(margin.right);
aMargin.bottom = context->DevPixelsToAppUnits(margin.bottom);
aMargin.left = context->DevPixelsToAppUnits(margin.left);
return NS_OK;
}
@@ -363,17 +363,17 @@ nsBox::GetBorder(nsMargin& aMargin)
NS_IMETHODIMP
nsBox::GetPadding(nsMargin& aMargin)
{
const nsStyleDisplay *disp = GetStyleDisplay();
if (disp->mAppearance && gTheme) {
// Go to the theme for the padding.
nsPresContext *context = PresContext();
if (gTheme->ThemeSupportsWidget(context, this, disp->mAppearance)) {
- nsIntMargin margin(0, 0, 0, 0);
+ nsMargin margin(0, 0, 0, 0);
PRBool useThemePadding;
useThemePadding = gTheme->GetWidgetPadding(context->DeviceContext(),
this, disp->mAppearance,
&margin);
if (useThemePadding) {
aMargin.top = context->DevPixelsToAppUnits(margin.top);
aMargin.right = context->DevPixelsToAppUnits(margin.right);
@@ -723,17 +723,17 @@ nsIBox::AddCSSMinSize(nsBoxLayoutState&
PRBool heightSet = PR_FALSE;
PRBool canOverride = PR_TRUE;
// See if a native theme wants to supply a minimum size.
const nsStyleDisplay* display = aBox->GetStyleDisplay();
if (display->mAppearance) {
nsITheme *theme = aState.PresContext()->GetTheme();
if (theme && theme->ThemeSupportsWidget(aState.PresContext(), aBox, display->mAppearance)) {
- nsIntSize size;
+ nsSize size;
nsIRenderingContext* rendContext = aState.GetRenderingContext();
if (rendContext) {
theme->GetMinimumWidgetSize(rendContext, aBox,
display->mAppearance, &size, &canOverride);
if (size.width) {
aSize.width = aState.PresContext()->DevPixelsToAppUnits(size.width);
widthSet = PR_TRUE;
}
--- a/layout/xul/base/src/nsBoxObject.cpp
+++ b/layout/xul/base/src/nsBoxObject.cpp
@@ -154,19 +154,20 @@ nsBoxObject::GetPresShell(PRBool aFlushL
if (aFlushLayout) {
doc->FlushPendingNotifications(Flush_Layout);
}
return doc->GetPrimaryShell();
}
nsresult
-nsBoxObject::GetOffsetRect(nsIntRect& aRect)
+nsBoxObject::GetOffsetRect(nsRect& aRect)
{
- aRect.SetRect(0, 0, 0, 0);
+ aRect.x = aRect.y = 0;
+ aRect.Empty();
if (!mContent)
return NS_ERROR_NOT_INITIALIZED;
// Get the Frame for our content
nsIFrame* frame = GetFrame(PR_TRUE);
if (frame) {
// Get its origin
@@ -235,44 +236,44 @@ nsBoxObject::GetScreenPosition(nsIntPoin
}
return NS_OK;
}
NS_IMETHODIMP
nsBoxObject::GetX(PRInt32* aResult)
{
- nsIntRect rect;
+ nsRect rect;
GetOffsetRect(rect);
*aResult = rect.x;
return NS_OK;
}
NS_IMETHODIMP
nsBoxObject::GetY(PRInt32* aResult)
{
- nsIntRect rect;
+ nsRect rect;
GetOffsetRect(rect);
*aResult = rect.y;
return NS_OK;
}
NS_IMETHODIMP
nsBoxObject::GetWidth(PRInt32* aResult)
{
- nsIntRect rect;
+ nsRect rect;
GetOffsetRect(rect);
*aResult = rect.width;
return NS_OK;
}
NS_IMETHODIMP
nsBoxObject::GetHeight(PRInt32* aResult)
{
- nsIntRect rect;
+ nsRect rect;
GetOffsetRect(rect);
*aResult = rect.height;
return NS_OK;
}
NS_IMETHODIMP
nsBoxObject::GetScreenX(PRInt32 *_retval)
{
--- a/layout/xul/base/src/nsBoxObject.h
+++ b/layout/xul/base/src/nsBoxObject.h
@@ -43,17 +43,17 @@
#include "nsPIBoxObject.h"
#include "nsPoint.h"
#include "nsAutoPtr.h"
#include "nsHashKeys.h"
#include "nsInterfaceHashtable.h"
class nsIFrame;
class nsIDocShell;
-struct nsIntRect;
+struct nsRect;
class nsBoxObject : public nsPIBoxObject
{
NS_DECL_ISUPPORTS
NS_DECL_NSIBOXOBJECT
public:
nsBoxObject();
@@ -61,17 +61,17 @@ public:
// nsPIBoxObject
virtual nsresult Init(nsIContent* aContent);
virtual void Clear();
virtual void ClearCachedValues();
nsIFrame* GetFrame(PRBool aFlushLayout);
nsIPresShell* GetPresShell(PRBool aFlushLayout);
- nsresult GetOffsetRect(nsIntRect& aRect);
+ nsresult GetOffsetRect(nsRect& aRect);
nsresult GetScreenPosition(nsIntPoint& aPoint);
// Given a parent frame and a child frame, find the frame whose
// next sibling is the given child frame and return its element
static nsresult GetPreviousSibling(nsIFrame* aParentFrame, nsIFrame* aFrame,
nsIDOMElement** aResult);
protected:
--- a/layout/xul/base/src/nsImageBoxFrame.cpp
+++ b/layout/xul/base/src/nsImageBoxFrame.cpp
@@ -537,17 +537,17 @@ NS_IMETHODIMP nsImageBoxFrame::OnStopDec
FireImageDOMEvent(mContent, NS_LOAD_ERROR);
}
return NS_OK;
}
NS_IMETHODIMP nsImageBoxFrame::FrameChanged(imgIContainer *container,
gfxIImageFrame *newframe,
- nsIntRect *dirtyRect)
+ nsRect * dirtyRect)
{
nsBoxLayoutState state(PresContext());
this->Redraw(state);
return NS_OK;
}
NS_IMPL_ISUPPORTS2(nsImageBoxListener, imgIDecoderObserver, imgIContainerObserver)
@@ -585,16 +585,16 @@ NS_IMETHODIMP nsImageBoxListener::OnStop
if (!mFrame)
return NS_ERROR_FAILURE;
return mFrame->OnStopDecode(request, status, statusArg);
}
NS_IMETHODIMP nsImageBoxListener::FrameChanged(imgIContainer *container,
gfxIImageFrame *newframe,
- nsIntRect *dirtyRect)
+ nsRect * dirtyRect)
{
if (!mFrame)
return NS_ERROR_FAILURE;
return mFrame->FrameChanged(container, newframe, dirtyRect);
}
--- a/layout/xul/base/src/nsImageBoxFrame.h
+++ b/layout/xul/base/src/nsImageBoxFrame.h
@@ -55,17 +55,17 @@ public:
NS_DECL_ISUPPORTS
// imgIDecoderObserver (override nsStubImageDecoderObserver)
NS_IMETHOD OnStartContainer(imgIRequest *request, imgIContainer *image);
NS_IMETHOD OnStopContainer(imgIRequest *request, imgIContainer *image);
NS_IMETHOD OnStopDecode(imgIRequest *request, nsresult status,
const PRUnichar *statusArg);
// imgIContainerObserver (override nsStubImageDecoderObserver)
NS_IMETHOD FrameChanged(imgIContainer *container, gfxIImageFrame *newframe,
- nsIntRect *dirtyRect);
+ nsRect * dirtyRect);
void SetFrame(nsImageBoxFrame *frame) { mFrame = frame; }
private:
nsImageBoxFrame *mFrame;
};
class nsImageBoxFrame : public nsLeafBoxFrame
@@ -118,17 +118,17 @@ public:
NS_IMETHOD OnStartContainer(imgIRequest *request, imgIContainer *image);
NS_IMETHOD OnStopContainer(imgIRequest *request, imgIContainer *image);
NS_IMETHOD OnStopDecode(imgIRequest *request,
nsresult status,
const PRUnichar *statusArg);
NS_IMETHOD FrameChanged(imgIContainer *container,
gfxIImageFrame *newframe,
- nsIntRect *dirtyRect);
+ nsRect * dirtyRect);
virtual ~nsImageBoxFrame();
void PaintImage(nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
nsPoint aPt);
protected:
--- a/layout/xul/base/src/nsMenuPopupFrame.cpp
+++ b/layout/xul/base/src/nsMenuPopupFrame.cpp
@@ -995,18 +995,17 @@ nsMenuPopupFrame::SetPopupPosition(nsIFr
// if we are anchored to our parent, there are certain things we don't want to do
// when repositioning the view to fit on the screen, such as end up positioned over
// the parent. When doing this reposition, we want to move the popup to the side with
// the most room. The combination of anchor and alignment dictate if we readjust
// above/below or to the left/right.
if (mAnchorContent) {
anchorScreenRect = aAnchorFrame->GetScreenRectInAppUnits();
// adjust for differences in the anchor frame's scaling
- anchorScreenRect = nsIntRect::ToAppUnits(nsRect::ToOutsidePixels(anchorScreenRect,
- aAnchorFrame->PresContext()->AppUnitsPerDevPixel()), presContext->AppUnitsPerDevPixel());
+ anchorScreenRect.ScaleRoundOut(adj);
xpos = anchorScreenRect.x - rootScreenRect.x;
ypos = anchorScreenRect.y - rootScreenRect.y;
// move the popup according to the anchor and alignment. This will also tell us
// which axis the popup is flush against in case we have to move it around later.
AdjustPositionForAnchorAlign(&xpos, &ypos, parentSize, &readjustAboveBelow);
}
else {
--- a/layout/xul/base/src/nsResizerFrame.h
+++ b/layout/xul/base/src/nsResizerFrame.h
@@ -60,12 +60,12 @@ public:
virtual void MouseClicked(nsPresContext* aPresContext, nsGUIEvent *aEvent);
protected:
Direction GetDirection();
static void AdjustDimensions(PRInt32* aPos, PRInt32* aSize,
PRInt32 aMovement, PRInt8 aResizerDirection);
protected:
- nsIntRect mWidgetRect;
+ nsRect mWidgetRect;
}; // class nsResizerFrame
#endif /* nsResizerFrame_h___ */
--- a/layout/xul/base/src/nsScrollBoxObject.cpp
+++ b/layout/xul/base/src/nsScrollBoxObject.cpp
@@ -285,19 +285,19 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollT
rect.y = nsPresContext::CSSPixelsToAppUnits(y);
// TODO: make sure the child is inside the box
// get our current info
nsPoint cp;
scrollableView->GetScrollPosition(cp.x,cp.y);
- nsIntRect prect;
- GetOffsetRect(prect);
- crect = nsIntRect::ToAppUnits(prect, nsPresContext::AppUnitsPerCSSPixel());
+ GetOffsetRect(crect);
+ crect.x = nsPresContext::CSSPixelsToAppUnits(crect.x);
+ crect.y = nsPresContext::CSSPixelsToAppUnits(crect.y);
nscoord newx=cp.x, newy=cp.y;
// we only scroll in the direction of the scrollbox orientation
// always scroll to left or top edge of child element
if (scrolledBox->IsHorizontal()) {
newx = rect.x - crect.x;
} else {
newy = rect.y - crect.y;
@@ -385,19 +385,21 @@ NS_IMETHODIMP nsScrollBoxObject::EnsureE
rect.width = nsPresContext::CSSPixelsToAppUnits(width);
rect.height = nsPresContext::CSSPixelsToAppUnits(height);
// TODO: make sure the child is inside the box
// get our current info
nsPoint cp;
scrollableView->GetScrollPosition(cp.x,cp.y);
- nsIntRect prect;
- GetOffsetRect(prect);
- crect = nsIntRect::ToAppUnits(prect, nsPresContext::AppUnitsPerCSSPixel());
+ GetOffsetRect(crect);
+ crect.x = nsPresContext::CSSPixelsToAppUnits(crect.x);
+ crect.y = nsPresContext::CSSPixelsToAppUnits(crect.y);
+ crect.width = nsPresContext::CSSPixelsToAppUnits(crect.width);
+ crect.height = nsPresContext::CSSPixelsToAppUnits(crect.height);
nscoord newx=cp.x, newy=cp.y;
// we only scroll in the direction of the scrollbox orientation
if (scrolledBox->IsHorizontal()) {
if ((rect.x - crect.x) + rect.width > cp.x + crect.width) {
newx = cp.x + (((rect.x - crect.x) + rect.width)-(cp.x + crect.width));
} else if (rect.x - crect.x < cp.x) {
--- a/layout/xul/base/src/nsTitleBarFrame.cpp
+++ b/layout/xul/base/src/nsTitleBarFrame.cpp
@@ -154,29 +154,29 @@ nsTitleBarFrame::HandleEvent(nsPresConte
doDefault = PR_FALSE;
}
}
break;
case NS_MOUSE_MOVE: {
if(mTrackingMouseMove)
{
- nsIntPoint nsMoveBy(aEvent->refPoint - mLastPoint);
+ nsPoint nsMoveBy = aEvent->refPoint - mLastPoint;
nsIFrame* parent = GetParent();
while (parent && parent->GetType() != nsGkAtoms::menuPopupFrame)
parent = parent->GetParent();
// if the titlebar is in a popup, move the popup's widget, otherwise
// move the widget associated with the window
if (parent) {
nsCOMPtr<nsIWidget> widget;
(static_cast<nsMenuPopupFrame*>(parent))->
GetWidget(getter_AddRefs(widget));
- nsIntRect bounds;
+ nsRect bounds;
widget->GetScreenBounds(bounds);
widget->Move(bounds.x + nsMoveBy.x, bounds.y + nsMoveBy.y);
}
else {
nsIPresShell* presShell = aPresContext->PresShell();
nsPIDOMWindow *window = presShell->GetDocument()->GetWindow();
window->MoveBy(nsMoveBy.x, nsMoveBy.y);
}
--- a/layout/xul/base/src/nsTitleBarFrame.h
+++ b/layout/xul/base/src/nsTitleBarFrame.h
@@ -65,14 +65,14 @@ public:
virtual void MouseClicked(nsPresContext* aPresContext, nsGUIEvent* aEvent);
protected:
NS_IMETHOD CaptureMouseEvents(nsPresContext* aPresContext,PRBool aGrabMouseEvents);
protected:
PRBool mTrackingMouseMove;
- nsIntPoint mLastPoint;
+ nsPoint mLastPoint;
}; // class nsTitleBarFrame
#endif /* nsTitleBarFrame_h___ */
--- a/layout/xul/base/src/nsXULPopupManager.cpp
+++ b/layout/xul/base/src/nsXULPopupManager.cpp
@@ -303,17 +303,17 @@ nsXULPopupManager::GetMouseLocation(nsID
*aNode = mRangeParent;
NS_IF_ADDREF(*aNode);
*aOffset = mRangeOffset;
}
void
nsXULPopupManager::SetTriggerEvent(nsIDOMEvent* aEvent, nsIContent* aPopup)
{
- mCachedMousePoint = nsIntPoint(0, 0);
+ mCachedMousePoint = nsPoint(0, 0);
nsCOMPtr<nsIDOMNSUIEvent> uiEvent = do_QueryInterface(aEvent);
if (uiEvent) {
uiEvent->GetRangeParent(getter_AddRefs(mRangeParent));
uiEvent->GetRangeOffset(&mRangeOffset);
// get the event coordinates relative to the root frame of the document
// containing the popup.
@@ -333,24 +333,25 @@ nsXULPopupManager::SetTriggerEvent(nsIDO
event->eventStructType == NS_MOUSE_SCROLL_EVENT) &&
!(static_cast<nsGUIEvent *>(event))->widget) {
// no widget, so just use the client point if available
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);
mouseEvent->GetClientX(&mCachedMousePoint.x);
mouseEvent->GetClientY(&mCachedMousePoint.y);
// convert to device pixels
- mCachedMousePoint.x = presContext->AppUnitsToDevPixels(nsPresContext::CSSPixelsToAppUnits(mCachedMousePoint.x));
- mCachedMousePoint.y = presContext->AppUnitsToDevPixels(nsPresContext::CSSPixelsToAppUnits(mCachedMousePoint.y));
+ PRInt32 adj = presContext->DeviceContext()->AppUnitsPerDevPixel();
+ mCachedMousePoint.x = nsPresContext::CSSPixelsToAppUnits(mCachedMousePoint.x) / adj;
+ mCachedMousePoint.y = nsPresContext::CSSPixelsToAppUnits(mCachedMousePoint.y) / adj;
}
else if (rootFrame) {
nsPoint pnt =
nsLayoutUtils::GetEventCoordinatesRelativeTo(event, rootFrame);
- mCachedMousePoint = nsIntPoint(presContext->AppUnitsToDevPixels(pnt.x),
- presContext->AppUnitsToDevPixels(pnt.y));
+ mCachedMousePoint = nsPoint(presContext->AppUnitsToDevPixels(pnt.x),
+ presContext->AppUnitsToDevPixels(pnt.y));
}
}
}
}
}
}
else {
mRangeParent = nsnull;
@@ -993,17 +994,17 @@ nsXULPopupManager::FirePopupShowingEvent
// all the globals people keep adding to nsIDOMXULDocument.
nsEventStatus status = nsEventStatus_eIgnore;
nsMouseEvent event(PR_TRUE, NS_XUL_POPUP_SHOWING, nsnull, nsMouseEvent::eReal);
nsPoint pnt;
event.widget = presShell->GetRootFrame()->
GetClosestView()->GetNearestWidget(&pnt);
event.refPoint = mCachedMousePoint;
nsEventDispatcher::Dispatch(aPopup, aPresContext, &event, nsnull, &status);
- mCachedMousePoint = nsIntPoint(0, 0);
+ mCachedMousePoint = nsPoint(0, 0);
// if a panel, blur whatever has focus so that the panel can take the focus.
// This is done after the popupshowing event in case that event is cancelled.
// Using noautofocus="true" will disable this behaviour, which is needed for
// the autocomplete widget as it manages focus itself.
if (aPopupType == ePopupTypePanel &&
!aPopup->AttrValueIs(kNameSpaceID_None, nsGkAtoms::noautofocus,
nsGkAtoms::_true, eCaseMatters)) {
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -653,17 +653,18 @@ nsTreeBodyFrame::GetSelectionRegion(nsIS
mView->GetSelection(getter_AddRefs(selection));
NS_ENSURE_TRUE(selection, NS_OK);
nsCOMPtr<nsIScriptableRegion> region = do_CreateInstance("@mozilla.org/gfx/region;1");
NS_ENSURE_TRUE(region, NS_ERROR_FAILURE);
region->Init();
nsRefPtr<nsPresContext> presContext = PresContext();
- nsIntRect rect(nsRect::ToOutsidePixels(mRect, presContext->AppUnitsPerCSSPixel()));
+ nsRect rect = mRect;
+ rect.ScaleRoundOut(1.0 / presContext->AppUnitsPerCSSPixel());
nsIFrame* rootFrame = presContext->PresShell()->GetRootFrame();
nsPoint origin = GetOffsetTo(rootFrame);
// iterate through the visible rows and add the selected ones to the
// drag region
PRInt32 x = nsPresContext::AppUnitsToIntCSSPixels(origin.x);
PRInt32 y = nsPresContext::AppUnitsToIntCSSPixels(origin.y);
@@ -2121,25 +2122,24 @@ nsTreeBodyFrame::GetTwistyRect(PRInt32 a
const nsStyleDisplay* twistyDisplayData = aTwistyContext->GetStyleDisplay();
if (twistyDisplayData->mAppearance) {
theme = aPresContext->GetTheme();
if (theme && theme->ThemeSupportsWidget(aPresContext, nsnull, twistyDisplayData->mAppearance))
useTheme = PR_TRUE;
}
if (useTheme) {
- nsIntSize minTwistySizePx(0,0);
+ nsSize minTwistySize(0,0);
PRBool canOverride = PR_TRUE;
theme->GetMinimumWidgetSize(&aRenderingContext, this, twistyDisplayData->mAppearance,
- &minTwistySizePx, &canOverride);
-
- // GMWS() returns size in pixels, we need to convert it back to app units
- nsSize minTwistySize;
- minTwistySize.width = aPresContext->DevPixelsToAppUnits(minTwistySizePx.width);
- minTwistySize.height = aPresContext->DevPixelsToAppUnits(minTwistySizePx.height);
+ &minTwistySize, &canOverride);
+
+ // GMWS() returns size in pixels, we need to convert it back to twips
+ minTwistySize.width = aPresContext->DevPixelsToAppUnits(minTwistySize.width);
+ minTwistySize.height = aPresContext->DevPixelsToAppUnits(minTwistySize.height);
if (aTwistyRect.width < minTwistySize.width || !canOverride)
aTwistyRect.width = minTwistySize.width;
}
return useTheme ? theme : nsnull;
}
--- a/layout/xul/base/src/tree/src/nsTreeImageListener.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeImageListener.cpp
@@ -60,25 +60,25 @@ NS_IMETHODIMP nsTreeImageListener::OnSta
{
// Ensure the animation (if any) is started
aImage->StartAnimation();
return NS_OK;
}
NS_IMETHODIMP nsTreeImageListener::OnDataAvailable(imgIRequest *aRequest,
gfxIImageFrame *aFrame,
- const nsIntRect *aRect)
+ const nsRect *aRect)
{
Invalidate();
return NS_OK;
}
NS_IMETHODIMP nsTreeImageListener::FrameChanged(imgIContainer *aContainer,
gfxIImageFrame *newframe,
- nsIntRect *dirtyRect)
+ nsRect * dirtyRect)
{
Invalidate();
return NS_OK;
}
NS_IMETHODIMP
nsTreeImageListener::AddCell(PRInt32 aIndex, nsITreeColumn* aCol)
--- a/layout/xul/base/src/tree/src/nsTreeImageListener.h
+++ b/layout/xul/base/src/tree/src/nsTreeImageListener.h
@@ -68,20 +68,20 @@ class nsTreeImageListener : public nsStu
public:
nsTreeImageListener(nsITreeBoxObject* aTree);
~nsTreeImageListener();
NS_DECL_ISUPPORTS
// imgIDecoderObserver (override nsStubImageDecoderObserver)
NS_IMETHOD OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage);
NS_IMETHOD OnDataAvailable(imgIRequest *aRequest, gfxIImageFrame *aFrame,
- const nsIntRect *aRect);
+ const nsRect *aRect);
// imgIContainerObserver (override nsStubImageDecoderObserver)
NS_IMETHOD FrameChanged(imgIContainer *aContainer, gfxIImageFrame *newframe,
- nsIntRect *dirtyRect);
+ nsRect * dirtyRect);
NS_IMETHOD AddCell(PRInt32 aIndex, nsITreeColumn* aCol);
friend class nsTreeBodyFrame;
protected:
void UnsuppressInvalidation() { mInvalidationSuppressed = PR_FALSE; }
void Invalidate();
--- a/view/public/nsIViewManager.h
+++ b/view/public/nsIViewManager.h
@@ -55,20 +55,20 @@ enum nsRectVisibility {
nsRectVisibility_kVisible,
nsRectVisibility_kAboveViewport,
nsRectVisibility_kBelowViewport,
nsRectVisibility_kLeftOfViewport,
nsRectVisibility_kRightOfViewport,
nsRectVisibility_kZeroAreaRect
};
-// de2a2d24-9753-4488-9fdc-dd0accb484f7
+// 7eae119d-9fc8-482d-92ec-145eef228a4a
#define NS_IVIEWMANAGER_IID \
-{ 0xde2a2d24, 0x9753, 0x4488, \
- { 0x9f, 0xdc, 0xdd, 0x0a, 0xcc, 0xb4, 0x84, 0xf7 } }
+{ 0x7eae119d, 0x9fc8, 0x482d, \
+ { 0x92, 0xec, 0x14, 0x5e, 0xef, 0x22, 0x8a, 0x4a } }
class nsIViewManager : public nsISupports
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IVIEWMANAGER_IID)
/**
* Initialize the ViewManager
@@ -472,17 +472,17 @@ public:
* @param aView view that aRect coordinates are specified relative to
* @param aRect rectangle in twips to test for visibility
* @param aMinTwips is the min. pixel rows or cols at edge of screen
* needed for object to be counted visible
* @param aRectVisibility returns eVisible if the rect is visible,
* otherwise it returns an enum indicating why not
*/
NS_IMETHOD GetRectVisibility(nsIView *aView, const nsRect &aRect,
- nscoord aMinTwips,
+ PRUint16 aMinTwips,
nsRectVisibility *aRectVisibility)=0;
/**
* Dispatch a mouse move event based on the most recent mouse
* position. This is used when the contents of the page moved
* (aFromScroll is false) or scrolled (aFromScroll is true).
*/
NS_IMETHOD SynthesizeMouseMove(PRBool aFromScroll)=0;
--- a/view/src/nsScrollPortView.cpp
+++ b/view/src/nsScrollPortView.cpp
@@ -510,17 +510,17 @@ NS_IMETHODIMP nsScrollPortView::CanScrol
}
// Can scroll to Bottom or to Right?
aResult = (offset < max) ? PR_TRUE : PR_FALSE;
return NS_OK;
}
-void nsScrollPortView::Scroll(nsView *aScrolledView, nsPoint aTwipsDelta, nsIntPoint aPixDelta,
+void nsScrollPortView::Scroll(nsView *aScrolledView, nsPoint aTwipsDelta, nsPoint aPixDelta,
PRInt32 aP2A)
{
if (aTwipsDelta.x != 0 || aTwipsDelta.y != 0)
{
/* If we should invalidate our wrapped view, we should do so at this
* point.
*/
if (aScrolledView->NeedsInvalidateFrameOnScroll())
@@ -560,35 +560,37 @@ void nsScrollPortView::Scroll(nsView *aS
nsRect bounds(GetBounds());
nsPoint topLeft(bounds.x, bounds.y);
AdjustChildWidgets(aScrolledView,
GetPosition() - topLeft, aP2A, PR_FALSE);
// We should call this after fixing up the widget positions to be
// consistent with the view hierarchy.
mViewManager->UpdateView(this, NS_VMREFRESH_DEFERRED);
} else { // if we can blit and have a scrollwidget then scroll.
- nsIntRect* toScrollPtr = nsnull;
+ nsRect* toScrollPtr = nsnull;
#ifdef XP_WIN
- nsIntRect toScroll;
+ nsRect toScroll;
if (!updateRegion.IsEmpty()) {
nsRegion regionToScroll;
regionToScroll.Sub(nsRect(nsPoint(0,0), GetBounds().Size()),
updateRegion);
nsRegionRectIterator iter(regionToScroll);
nsRect biggestRect(0,0,0,0);
const nsRect* r;
for (r = iter.Next(); r; r = iter.Next()) {
- if (PRInt64(r->width)*PRInt64(r->height) > PRInt64(biggestRect.width)*PRInt64(biggestRect.height)) {
+ if (r->width*r->height > biggestRect.width*biggestRect.height) {
biggestRect = *r;
}
}
toScrollPtr = &toScroll;
- toScroll = nsRect::ToInsidePixels(biggestRect, aP2A);
- regionToScroll.Sub(regionToScroll, nsIntRect::ToAppUnits(toScroll, aP2A));
+ biggestRect.ScaleRoundIn(1.0/aP2A);
+ toScroll = biggestRect;
+ biggestRect *= aP2A;
+ regionToScroll.Sub(regionToScroll, biggestRect);
updateRegion.Or(updateRegion, regionToScroll);
}
#endif
// Scroll the contents of the widget by the specified amount, and scroll
// the child widgets
scrollWidget->Scroll(aPixDelta.x, aPixDelta.y, toScrollPtr);
mViewManager->UpdateViewAfterScroll(this, updateRegion);
@@ -664,17 +666,17 @@ NS_IMETHODIMP nsScrollPortView::ScrollTo
}
nsPoint twipsDelta(aX - mOffsetX, aY - mOffsetY);
// store the new position
mOffsetX = aX;
mOffsetY = aY;
- Scroll(scrolledView, twipsDelta, nsIntPoint(dxPx, dyPx), p2a);
+ Scroll(scrolledView, twipsDelta, nsPoint(dxPx, dyPx), p2a);
mViewManager->SynthesizeMouseMove(PR_TRUE);
// notify the listeners.
if (nsnull != mListeners) {
if (NS_SUCCEEDED(mListeners->Count(&listenerCount))) {
for (PRUint32 i = 0; i < listenerCount; i++) {
if (NS_SUCCEEDED(mListeners->QueryElementAt(i, kScrollPositionListenerIID, (void**)&listener))) {
--- a/view/src/nsScrollPortView.h
+++ b/view/src/nsScrollPortView.h
@@ -97,17 +97,17 @@ private:
void IncrementalScroll();
PRBool IsSmoothScrollingEnabled();
static void SmoothScrollAnimationCallback(nsITimer *aTimer, void* aESM);
protected:
virtual ~nsScrollPortView();
//private
- void Scroll(nsView *aScrolledView, nsPoint aTwipsDelta, nsIntPoint aPixDelta, nscoord aP2A);
+ void Scroll(nsView *aScrolledView, nsPoint aTwipsDelta, nsPoint aPixDelta, PRInt32 p2a);
PRBool CannotBitBlt(nsView* aScrolledView);
nscoord mOffsetX, mOffsetY;
PRUint32 mScrollProperties;
nscoord mLineHeight;
nsISupportsArray *mListeners;
};
--- a/view/src/nsView.cpp
+++ b/view/src/nsView.cpp
@@ -351,74 +351,75 @@ void nsView::ResetWidgetBounds(PRBool aR
} else if (aRecurse) {
// reposition any widgets under this view
for (nsView* v = GetFirstChild(); v; v = v->GetNextSibling()) {
v->ResetWidgetBounds(PR_TRUE, aMoveOnly, aInvalidateChangedSize);
}
}
}
-nsIntRect nsView::CalcWidgetBounds(nsWindowType aType)
+nsRect nsView::CalcWidgetBounds(nsWindowType aType)
{
nsCOMPtr<nsIDeviceContext> dx;
mViewManager->GetDeviceContext(*getter_AddRefs(dx));
NS_ASSERTION(dx, "View manager can't be created without a device context");
PRInt32 p2a = dx->AppUnitsPerDevPixel();
nsRect viewBounds(mDimBounds);
if (GetParent()) {
// put offset into screen coordinates
nsPoint offset;
nsIWidget* parentWidget = GetParent()->GetNearestWidget(&offset);
viewBounds += offset;
if (parentWidget && aType == eWindowType_popup &&
mVis == nsViewVisibility_kShow) {
- nsIntRect screenRect(0,0,1,1);
+ nsRect screenRect(0,0,1,1);
parentWidget->WidgetToScreen(screenRect, screenRect);
viewBounds += nsPoint(NSIntPixelsToAppUnits(screenRect.x, p2a),
NSIntPixelsToAppUnits(screenRect.y, p2a));
}
}
- nsIntRect newBounds(nsRect::ToNearestPixels(viewBounds, p2a));
+ nsRect newBounds(viewBounds);
+ newBounds.ScaleRoundPreservingCentersInverse(p2a);
nsPoint roundedOffset(NSIntPixelsToAppUnits(newBounds.x, p2a),
NSIntPixelsToAppUnits(newBounds.y, p2a));
mViewToWidgetOffset = viewBounds.TopLeft() - roundedOffset;
return newBounds;
}
void nsView::DoResetWidgetBounds(PRBool aMoveOnly,
PRBool aInvalidateChangedSize) {
// The geometry of a root view's widget is controlled externally,
// NOT by sizing or positioning the view
if (mViewManager->GetRootView() == this) {
return;
}
- nsIntRect curBounds;
+ nsRect curBounds;
mWindow->GetBounds(curBounds);
nsWindowType type;
mWindow->GetWindowType(type);
if (curBounds.IsEmpty() && mDimBounds.IsEmpty() && type == eWindowType_popup) {
// Don't manipulate empty popup widgets. For example there's no point
// moving hidden comboboxes around, or doing X server roundtrips
// to compute their true screen position. This could mean that WidgetToScreen
// operations on these widgets don't return up-to-date values, but popup
// positions aren't reliable anyway because of correction to be on or off-screen.
return;
}
NS_PRECONDITION(mWindow, "Why was this called??");
- nsIntRect newBounds = CalcWidgetBounds(type);
+ nsRect newBounds = CalcWidgetBounds(type);
PRBool changedPos = curBounds.TopLeft() != newBounds.TopLeft();
PRBool changedSize = curBounds.Size() != newBounds.Size();
if (changedPos) {
if (changedSize && !aMoveOnly) {
mWindow->Resize(newBounds.x, newBounds.y, newBounds.width, newBounds.height,
aInvalidateChangedSize);
@@ -630,19 +631,19 @@ nsresult nsIView::CreateWidget(const nsI
NS_IF_RELEASE(wrapper);
mWindow->SetClientData(nsnull);
mWindow->Destroy();
NS_RELEASE(mWindow);
}
nsView* v = static_cast<nsView*>(this);
- nsIntRect trect = v->CalcWidgetBounds(aWidgetInitData
- ? aWidgetInitData->mWindowType
- : eWindowType_child);
+ nsRect trect = v->CalcWidgetBounds(aWidgetInitData
+ ? aWidgetInitData->mWindowType
+ : eWindowType_child);
if (NS_OK == v->LoadWidget(aWindowIID))
{
PRBool usewidgets;
nsCOMPtr<nsIDeviceContext> dx;
mViewManager->GetDeviceContext(*getter_AddRefs(dx));
dx->SupportsNativeWidgets(usewidgets);
@@ -749,25 +750,27 @@ nsresult nsView::LoadWidget(const nsCID
#ifdef DEBUG
void nsIView::List(FILE* out, PRInt32 aIndent) const
{
PRInt32 i;
for (i = aIndent; --i >= 0; ) fputs(" ", out);
fprintf(out, "%p ", (void*)this);
if (nsnull != mWindow) {
+ nsRect windowBounds;
+ nsRect nonclientBounds;
+ float p2t;
nsIDeviceContext *dx;
mViewManager->GetDeviceContext(dx);
- nscoord p2a = dx->AppUnitsPerDevPixel();
+ p2t = (float) dx->AppUnitsPerDevPixel();
NS_RELEASE(dx);
- nsIntRect rect;
- mWindow->GetClientBounds(rect);
- nsRect windowBounds(nsIntRect::ToAppUnits(rect, p2a));
- mWindow->GetBounds(rect);
- nsRect nonclientBounds(nsIntRect::ToAppUnits(rect, p2a));
+ mWindow->GetClientBounds(windowBounds);
+ windowBounds *= p2t;
+ mWindow->GetBounds(nonclientBounds);
+ nonclientBounds *= p2t;
nsrefcnt widgetRefCnt = mWindow->AddRef() - 1;
mWindow->Release();
PRInt32 Z;
mWindow->GetZIndex(&Z);
fprintf(out, "(widget=%p[%d] z=%d pos={%d,%d,%d,%d}) ",
(void*)mWindow, widgetRefCnt, Z,
nonclientBounds.x, nonclientBounds.y,
windowBounds.width, windowBounds.height);
--- a/view/src/nsView.h
+++ b/view/src/nsView.h
@@ -187,17 +187,17 @@ public:
// widget top-left is always positioned at that inner view's widget's
// top-left, so its ViewToWidgetOffset is actually the same as
// its parent's.
return mParent->ViewToWidgetOffset();
}
return mViewToWidgetOffset;
}
- nsIntRect CalcWidgetBounds(nsWindowType aType);
+ nsRect CalcWidgetBounds(nsWindowType aType);
protected:
// Do the actual work of ResetWidgetBounds, unconditionally. Don't
// call this method if we have no widget.
void DoResetWidgetBounds(PRBool aMoveOnly, PRBool aInvalidateChangedSize);
nsRegion* mDirtyRegion;
nsPoint mViewToWidgetOffset;
--- a/view/src/nsViewManager.cpp
+++ b/view/src/nsViewManager.cpp
@@ -863,17 +863,18 @@ nsViewManager::UpdateWidgetArea(nsView *
nsRegion leftOver;
leftOver.Sub(intersection, children);
if (!leftOver.IsEmpty()) {
NS_ASSERTION(IsRefreshEnabled(), "Can only get here with refresh enabled, I hope");
const nsRect* r;
for (nsRegionRectIterator iter(leftOver); (r = iter.Next());) {
- nsIntRect bounds(ViewToWidget(aWidgetView, aWidgetView, *r));
+ nsRect bounds = *r;
+ ViewToWidget(aWidgetView, aWidgetView, bounds);
widget->Invalidate(bounds, PR_FALSE);
}
}
}
NS_IMETHODIMP nsViewManager::UpdateView(nsIView *aView, const nsRect &aRect, PRUint32 aUpdateFlags)
{
NS_PRECONDITION(nsnull != aView, "null view");
@@ -1003,16 +1004,24 @@ void nsViewManager::SuppressFocusEvents(
#endif
nsGUIEvent event(PR_TRUE, NS_GOTFOCUS, widget);
widget->DispatchEvent(&event, status);
}
}
}
+static void ConvertRectAppUnitsToIntPixels(nsRect& aRect, PRInt32 p2a)
+{
+ aRect.x = NSAppUnitsToIntPixels(aRect.x, p2a);
+ aRect.y = NSAppUnitsToIntPixels(aRect.y, p2a);
+ aRect.width = NSAppUnitsToIntPixels(aRect.width, p2a);
+ aRect.height = NSAppUnitsToIntPixels(aRect.height, p2a);
+}
+
NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aStatus)
{
*aStatus = nsEventStatus_eIgnore;
switch(aEvent->message)
{
case NS_SIZE:
{
@@ -1052,17 +1061,17 @@ NS_IMETHODIMP nsViewManager::DispatchEve
// The rect is in device units, and it's in the coordinate space of its
// associated window.
nsCOMPtr<nsIRegion> region = event->region;
if (!region) {
if (NS_FAILED(CreateRegion(getter_AddRefs(region))))
break;
- const nsIntRect& damrect = *event->rect;
+ const nsRect& damrect = *event->rect;
region->SetTo(damrect.x, damrect.y, damrect.width, damrect.height);
}
if (region->IsEmpty())
break;
// Refresh the view
if (IsRefreshEnabled()) {
@@ -1134,19 +1143,20 @@ NS_IMETHODIMP nsViewManager::DispatchEve
if (view) {
Refresh(view, event->renderingContext, region,
NS_VMREFRESH_DOUBLE_BUFFER);
}
}
} else {
// since we got an NS_PAINT event, we need to
// draw something so we don't get blank areas.
- nsIntRect damIntRect;
- region->GetBoundingBox(&damIntRect.x, &damIntRect.y, &damIntRect.width, &damIntRect.height);
- nsRect damRect(nsIntRect::ToAppUnits(damIntRect, mContext->AppUnitsPerDevPixel()));
+ nsRect damRect;
+ region->GetBoundingBox(&damRect.x, &damRect.y, &damRect.width, &damRect.height);
+ PRInt32 p2a = mContext->AppUnitsPerDevPixel();
+ damRect.ScaleRoundOut(float(p2a));
DefaultRefresh(view, event->renderingContext, &damRect);
// Clients like the editor can trigger multiple
// reflows during what the user perceives as a single
// edit operation, so it disables view manager
// refreshing until the edit operation is complete
// so that users don't see the intermediate steps.
//
@@ -1275,18 +1285,18 @@ NS_IMETHODIMP nsViewManager::DispatchEve
static_cast<nsMouseEvent*>(aEvent)->reason ==
nsMouseEvent::eReal) ||
aEvent->message == NS_MOUSE_ENTER) {
// aEvent->point is relative to the widget, i.e. the view top-left,
// so we need to add the offset to the view origin
nsPoint rootOffset = baseView->GetDimensions().TopLeft();
rootOffset += baseView->GetOffsetTo(RootViewManager()->mRootView);
RootViewManager()->mMouseLocation = aEvent->refPoint +
- nsIntPoint(NSAppUnitsToIntPixels(rootOffset.x, p2a),
- NSAppUnitsToIntPixels(rootOffset.y, p2a));
+ nsPoint(NSAppUnitsToIntPixels(rootOffset.x, p2a),
+ NSAppUnitsToIntPixels(rootOffset.y, p2a));
#ifdef DEBUG_MOUSE_LOCATION
if (aEvent->message == NS_MOUSE_ENTER)
printf("[vm=%p]got mouse enter for %p\n",
this, aEvent->widget);
printf("[vm=%p]setting mouse location to (%d,%d)\n",
this, mMouseLocation.x, mMouseLocation.y);
#endif
if (aEvent->message == NS_MOUSE_ENTER)
@@ -1294,17 +1304,17 @@ NS_IMETHODIMP nsViewManager::DispatchEve
} else if (aEvent->message == NS_MOUSE_EXIT) {
// Although we only care about the mouse moving into an area
// for which this view manager doesn't receive mouse move
// events, we don't check which view the mouse exit was for
// since this seems to vary by platform. Hopefully this
// won't matter at all since we'll get the mouse move or
// enter after the mouse exit when the mouse moves from one
// of our widgets into another.
- RootViewManager()->mMouseLocation = nsIntPoint(NSCOORD_NONE, NSCOORD_NONE);
+ RootViewManager()->mMouseLocation = nsPoint(NSCOORD_NONE, NSCOORD_NONE);
#ifdef DEBUG_MOUSE_LOCATION
printf("[vm=%p]got mouse exit for %p\n",
this, aEvent->widget);
printf("[vm=%p]clearing mouse location\n",
this);
#endif
}
@@ -1331,16 +1341,36 @@ NS_IMETHODIMP nsViewManager::DispatchEve
nsPoint pt;
pt.x = baseViewDimensions.x +
NSFloatPixelsToAppUnits(float(aEvent->refPoint.x) + 0.5f, p2a);
pt.y = baseViewDimensions.y +
NSFloatPixelsToAppUnits(float(aEvent->refPoint.y) + 0.5f, p2a);
pt += offset;
*aStatus = HandleEvent(view, pt, aEvent, capturedEvent);
+
+ //
+ // need to map the reply back into platform coordinates
+ //
+ switch (aEvent->message) {
+ case NS_TEXT_TEXT:
+ ConvertRectAppUnitsToIntPixels(
+ ((nsTextEvent*)aEvent)->theReply.mCursorPosition, p2a);
+ break;
+ case NS_COMPOSITION_START:
+ case NS_COMPOSITION_QUERY:
+ ConvertRectAppUnitsToIntPixels(
+ ((nsCompositionEvent*)aEvent)->theReply.mCursorPosition, p2a);
+ break;
+ case NS_QUERY_CHARACTER_RECT:
+ case NS_QUERY_CARET_RECT:
+ ConvertRectAppUnitsToIntPixels(
+ ((nsQueryContentEvent*)aEvent)->mReply.mRect, p2a);
+ break;
+ }
}
break;
}
}
return NS_OK;
}
@@ -2015,36 +2045,35 @@ nsPoint nsViewManager::ComputeViewOffset
aView = aView->GetParent();
}
NS_ASSERTION(rootView ==
origView->GetViewManager()->RootViewManager()->GetRootView(),
"Unexpected root view");
return origin;
}
-nsIntRect nsViewManager::ViewToWidget(nsView *aView, nsView* aWidgetView, const nsRect &aRect) const
+void nsViewManager::ViewToWidget(nsView *aView, nsView* aWidgetView, nsRect &aRect) const
{
- nsRect rect = aRect;
while (aView != aWidgetView) {
- aView->ConvertToParentCoords(&rect.x, &rect.y);
+ aView->ConvertToParentCoords(&aRect.x, &aRect.y);
aView = aView->GetParent();
}
// intersect aRect with bounds of aWidgetView, to prevent generating any illegal rectangles.
nsRect bounds;
aWidgetView->GetDimensions(bounds);
- rect.IntersectRect(rect, bounds);
+ aRect.IntersectRect(aRect, bounds);
// account for the view's origin not lining up with the widget's
- rect.x -= bounds.x;
- rect.y -= bounds.y;
-
- rect += aView->ViewToWidgetOffset();
+ aRect.x -= bounds.x;
+ aRect.y -= bounds.y;
+
+ aRect += aView->ViewToWidgetOffset();
// finally, convert to device coordinates.
- return nsRect::ToOutsidePixels(rect, mContext->AppUnitsPerDevPixel());
+ aRect.ScaleRoundOut(1.0f / mContext->AppUnitsPerDevPixel());
}
nsresult nsViewManager::GetVisibleRect(nsRect& aVisibleRect)
{
nsresult rv = NS_OK;
// Get the viewport scroller
nsIScrollableView* scrollingView;
@@ -2092,17 +2121,17 @@ nsresult nsViewManager::GetAbsoluteRect(
}
return NS_OK;
}
NS_IMETHODIMP nsViewManager::GetRectVisibility(nsIView *aView,
const nsRect &aRect,
- nscoord aMinTwips,
+ PRUint16 aMinTwips,
nsRectVisibility *aRectVisibility)
{
nsView* view = static_cast<nsView*>(aView);
// The parameter aMinTwips determines how many rows/cols of pixels must be visible on each side of the element,
// in order to be counted as visible
*aRectVisibility = nsRectVisibility_kZeroAreaRect;
@@ -2283,17 +2312,17 @@ private:
};
NS_IMETHODIMP
nsViewManager::SynthesizeMouseMove(PRBool aFromScroll)
{
if (!IsRootVM())
return RootViewManager()->SynthesizeMouseMove(aFromScroll);
- if (mMouseLocation == nsIntPoint(NSCOORD_NONE, NSCOORD_NONE))
+ if (mMouseLocation == nsPoint(NSCOORD_NONE, NSCOORD_NONE))
return NS_OK;
if (!mSynthMouseMoveEvent.IsPending()) {
nsRefPtr<nsViewManagerEvent> ev =
new nsSynthMouseMoveEvent(this, aFromScroll);
if (NS_FAILED(NS_DispatchToCurrentThread(ev))) {
NS_WARNING("failed to dispatch nsSynthMouseMoveEvent");
@@ -2338,44 +2367,44 @@ nsViewManager::ProcessSynthMouseMoveEven
{
// allow new event to be posted while handling this one only if the
// source of the event is a scroll (to prevent infinite reflow loops)
if (aFromScroll)
mSynthMouseMoveEvent.Forget();
NS_ASSERTION(IsRootVM(), "Only the root view manager should be here");
- if (mMouseLocation == nsIntPoint(NSCOORD_NONE, NSCOORD_NONE) || !mRootView) {
+ if (mMouseLocation == nsPoint(NSCOORD_NONE, NSCOORD_NONE) || !mRootView) {
mSynthMouseMoveEvent.Forget();
return;
}
// Hold a ref to ourselves so DispatchEvent won't destroy us (since
// we need to access members after we call DispatchEvent).
nsCOMPtr<nsIViewManager> kungFuDeathGrip(this);
#ifdef DEBUG_MOUSE_LOCATION
printf("[vm=%p]synthesizing mouse move to (%d,%d)\n",
this, mMouseLocation.x, mMouseLocation.y);
#endif
- nsPoint pt;
+ nsPoint pt = mMouseLocation;
PRInt32 p2a = mContext->AppUnitsPerDevPixel();
pt.x = NSIntPixelsToAppUnits(mMouseLocation.x, p2a);
pt.y = NSIntPixelsToAppUnits(mMouseLocation.y, p2a);
// This could be a bit slow (traverses entire view hierarchy)
// but it's OK to do it once per synthetic mouse event
nsView* view = FindFloatingViewContaining(mRootView, pt);
- nsIntPoint offset(0, 0);
+ nsPoint offset(0, 0);
if (!view) {
view = mRootView;
} else {
- nsPoint viewoffset(view->GetOffsetTo(mRootView));
- offset.x = NSAppUnitsToIntPixels(viewoffset.x, p2a);
- offset.y = NSAppUnitsToIntPixels(viewoffset.y, p2a);
+ offset = view->GetOffsetTo(mRootView);
+ offset.x = NSAppUnitsToIntPixels(offset.x, p2a);
+ offset.y = NSAppUnitsToIntPixels(offset.y, p2a);
}
nsMouseEvent event(PR_TRUE, NS_MOUSE_MOVE, view->GetWidget(),
nsMouseEvent::eSynthesized);
event.refPoint = mMouseLocation - offset;
event.time = PR_IntervalNow();
// XXX set event.isShift, event.isControl, event.isAlt, event.isMeta ?
nsEventStatus status;
--- a/view/src/nsViewManager.h
+++ b/view/src/nsViewManager.h
@@ -188,17 +188,17 @@ public:
* @param aView view that aRect coordinates are specified relative to
* @param aRect rectangle in twips to test for visibility
* @param aMinTwips is the min. pixel rows or cols at edge of screen
* needed for object to be counted visible
* @param aRectVisibility returns eVisible if the rect is visible,
* otherwise it returns an enum indicating why not
*/
NS_IMETHOD GetRectVisibility(nsIView *aView, const nsRect &aRect,
- nscoord aMinTwips,
+ PRUint16 aMinTwips,
nsRectVisibility *aRectVisibility);
NS_IMETHOD SynthesizeMouseMove(PRBool aFromScroll);
void ProcessSynthMouseMoveEvent(PRBool aFromScroll);
/* Update the cached RootViewManager pointer on this view manager. */
void InvalidateHierarchy();
@@ -286,17 +286,17 @@ private:
*/
void UpdateWidgetsForView(nsView* aView);
/**
* Transforms a rectangle from aView's coordinate system to the coordinate
* system of the widget attached to aWidgetView, which should be an ancestor
* of aView.
*/
- nsIntRect ViewToWidget(nsView *aView, nsView* aWidgetView, const nsRect &aRect) const;
+ void ViewToWidget(nsView *aView, nsView* aWidgetView, nsRect &aRect) const;
/**
* Transforms a rectangle from specified view's coordinate system to
* an absolute coordinate rectangle which can be compared against the
* rectangle returned by GetVisibleRect to determine visibility.
* @param aView view that aRect coordinates are specified relative to
* @param aRect rectangle in twips to convert to absolute coordinates
* @param aAbsRect rectangle in absolute coorindates.
@@ -428,17 +428,17 @@ public: // NOT in nsIViewManager, so pri
// Call this when you need to let the viewmanager know that it now has
// pending updates.
void PostPendingUpdate() { RootViewManager()->mHasPendingUpdates = PR_TRUE; }
private:
nsIDeviceContext *mContext;
nsIViewObserver *mObserver;
nsIScrollableView *mRootScrollable;
nscolor mDefaultBackgroundColor;
- nsIntPoint mMouseLocation; // device units, relative to mRootView
+ nsPoint mMouseLocation; // device units, relative to mRootView
// The size for a resize that we delayed until the root view becomes
// visible again.
nsSize mDelayedResize;
nsCOMPtr<nsIFactory> mRegionFactory;
nsView *mRootView;
// mRootViewManager is a strong ref unless it equals |this|. It's
--- a/widget/public/nsGUIEvent.h
+++ b/widget/public/nsGUIEvent.h
@@ -440,17 +440,17 @@ public:
MOZ_COUNT_DTOR(nsEvent);
}
// See event struct types
PRUint8 eventStructType;
// See GUI MESSAGES,
PRUint32 message;
// In widget relative coordinates, not modified by layout code.
- nsIntPoint refPoint;
+ nsPoint refPoint;
// Elapsed time, in milliseconds, from a platform-specific zero time
// to the time the message was created
PRUint32 time;
// Flags to hold event flow stage and capture/bubble cancellation
// status. This is used also to indicate whether the event is trusted.
PRUint32 flags;
// Additional type info for user defined events
nsCOMPtr<nsIAtom> userType;
@@ -526,17 +526,17 @@ class nsSizeEvent : public nsGUIEvent
public:
nsSizeEvent(PRBool isTrusted, PRUint32 msg, nsIWidget *w)
: nsGUIEvent(isTrusted, msg, w, NS_SIZE_EVENT),
windowSize(nsnull), mWinWidth(0), mWinHeight(0)
{
}
/// x,y width, height in pixels (client area)
- nsIntRect *windowSize;
+ nsRect *windowSize;
/// width of entire window (in pixels)
PRInt32 mWinWidth;
/// height of entire window (in pixels)
PRInt32 mWinHeight;
};
/**
* Window size mode event
@@ -588,17 +588,17 @@ public:
{
}
/// Context to paint in.
nsIRenderingContext *renderingContext;
/// area to paint (should be used instead of rect)
nsIRegion *region;
/// x,y, width, height in pixels of area to paint
- nsIntRect *rect;
+ nsRect *rect;
};
/**
* Scrollbar event
*/
class nsScrollbarEvent : public nsGUIEvent
{
@@ -817,17 +817,17 @@ typedef nsTextRange* nsTextRangeArray;
struct nsTextEventReply
{
nsTextEventReply()
: mCursorIsCollapsed(PR_FALSE), mReferenceWidget(nsnull)
{
}
- nsIntRect mCursorPosition;
+ nsRect mCursorPosition;
PRBool mCursorIsCollapsed;
nsIWidget* mReferenceWidget;
};
typedef struct nsTextEventReply nsTextEventReply;
class nsTextEvent : public nsInputEvent
{
@@ -956,17 +956,17 @@ public:
struct {
PRUint32 mOffset;
PRUint32 mLength;
} mInput;
struct {
void* mContentsRoot;
PRUint32 mOffset;
nsString mString;
- nsIntRect mRect; // Finally, the coordinates is system coordinates.
+ nsRect mRect; // Finally, the coordinates is system coordinates.
// The return widget has the caret. This is set at all query events.
nsIWidget* mFocusedWidget;
} mReply;
};
/**
* MenuItem event
*
--- a/widget/public/nsIPrintSettings.idl
+++ b/widget/public/nsIPrintSettings.idl
@@ -44,26 +44,26 @@
%{ C++
#include "nsMargin.h"
%}
/**
* Native types
*/
- [ref] native nsNativeIntMarginRef(nsIntMargin);
+ [ref] native nsNativeMarginRef(nsMargin);
interface nsIPrintSession;
/**
* Simplified graphics interface for JS rendering.
*
* @status UNDER_REVIEW
*/
-[scriptable, uuid(343700dd-078b-42b6-a809-b9c1d7e951d0)]
+[scriptable, uuid(5af07661-6477-4235-8814-4a45215855b8)]
interface nsIPrintSettings : nsISupports
{
/**
* PrintSettings to be Saved Navigation Constants
*/
const unsigned long kInitSaveOddEvenPages = 0x00000001;
const unsigned long kInitSaveHeaderLeft = 0x00000002;
@@ -299,21 +299,21 @@ interface nsIPrintSettings : nsISupports
* This attribute tracks whether the PS has been initialized
* from prefs. If a different name is set into the "printerName"
* attribute than the one it was initialized with the PS
* will then get intialized from prefs again.
*/
attribute boolean isInitializedFromPrefs;
/* C++ Helper Functions */
- [noscript] void SetMarginInTwips(in nsNativeIntMarginRef aMargin);
- [noscript] void SetEdgeInTwips(in nsNativeIntMarginRef aEdge);
+ [noscript] void SetMarginInTwips(in nsNativeMarginRef aMargin);
+ [noscript] void SetEdgeInTwips(in nsNativeMarginRef aEdge);
/* Purposely made this an "in" arg */
- [noscript] void GetMarginInTwips(in nsNativeIntMarginRef aMargin);
- [noscript] void GetEdgeInTwips(in nsNativeIntMarginRef aEdge);
+ [noscript] void GetMarginInTwips(in nsNativeMarginRef aMargin);
+ [noscript] void GetEdgeInTwips(in nsNativeMarginRef aEdge);
/**
* We call this function so that anything that requires a run of the event loop
* can do so safely. The print dialog runs the event loop but in silent printing
* that doesn't happen.
*
* Either this or ShowPrintDialog (but not both) MUST be called by the print engine
* before printing, otherwise printing can fail on some platforms.
@@ -324,11 +324,11 @@ interface nsIPrintSettings : nsISupports
* Sets/Gets the "unwriteable margin" for the page format. This defines
* the boundary from which we'll measure the EdgeInTwips and MarginInTwips
* attributes, to place the headers and content, respectively.
*
* Note: Implementations of SetUnwriteableMarginInTwips should handle
* negative margin values by falling back on the system default for
* that margin.
*/
- [noscript] void SetUnwriteableMarginInTwips(in nsNativeIntMarginRef aEdge);
- [noscript] void GetUnwriteableMarginInTwips(in nsNativeIntMarginRef aEdge);
+ [noscript] void SetUnwriteableMarginInTwips(in nsNativeMarginRef aEdge);
+ [noscript] void GetUnwriteableMarginInTwips(in nsNativeMarginRef aEdge);
};
--- a/widget/public/nsIScreenManager.idl
+++ b/widget/public/nsIScreenManager.idl
@@ -41,17 +41,17 @@
[scriptable, uuid(e224bd44-252b-4b66-b869-99738250904a)]
interface nsIScreenManager : nsISupports
{
//
// Returns the screen that contains the rectangle. If the rect overlaps
// multiple screens, it picks the screen with the greatest area of intersection.
//
- // The coordinates are in pixels (not app units) and in screen coordinates.
+ // The coordinates are in pixels (not twips) and in screen coordinates.
//
nsIScreen screenForRect ( in long left, in long top, in long width, in long height ) ;
// The screen with the menubar/taskbar. This shouldn't be needed very
// often.
readonly attribute nsIScreen primaryScreen;
// Holds the number of screens that are available
--- a/widget/public/nsIWidget.h
+++ b/widget/public/nsIWidget.h
@@ -88,20 +88,20 @@ typedef nsEventStatus (*PR_CALLBACK EVEN
#define NS_NATIVE_PLUGIN_PORT 8
#define NS_NATIVE_SCREEN 9
#define NS_NATIVE_SHELLWIDGET 10 // Get the shell GtkWidget
#ifdef XP_MACOSX
#define NS_NATIVE_PLUGIN_PORT_QD 100
#define NS_NATIVE_PLUGIN_PORT_CG 101
#endif
-// a85944af-7fce-4e45-bf04-ac12c823394b
+// 0e64821f-00a2-4adc-ac3b-3439d61f4491
#define NS_IWIDGET_IID \
-{ 0xa85944af, 0x7fce, 0x4e45, \
- { 0xbf, 0x04, 0xac, 0x12, 0xc8, 0x23, 0x39, 0x4b } }
+{ 0x0e64821f, 0x00a2, 0x4adc, \
+ { 0xac, 0x3b, 0x34, 0x39, 0xd6, 0x1f, 0x44, 0x91 } }
// Hide the native window systems real window type so as to avoid
// including native window system types and APIs. This is necessary
// to ensure cross-platform code.
typedef void* nsNativeWidget;
/**
* Border styles
@@ -307,17 +307,17 @@ class nsIWidget : public nsISupports {
* @param aContext
* @param aAppShell the parent application shell. If nsnull,
* the parent window's application shell will be used.
* @param aToolkit
* @param aInitData data that is used for widget initialization
*
*/
NS_IMETHOD Create(nsIWidget *aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell = nsnull,
nsIToolkit *aToolkit = nsnull,
nsWidgetInitData *aInitData = nsnull) = 0;
/**
* Create and initialize a widget with a native window parent
@@ -334,17 +334,17 @@ class nsIWidget : public nsISupports {
* to the os. The assumption is that if the event handler returns
* false the widget does not see the event.
*
* @param aParent native window.
* @param aRect the widget dimension
* @param aHandleEventFunction the event handler callback function
*/
NS_IMETHOD Create(nsNativeWidget aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell = nsnull,
nsIToolkit *aToolkit = nsnull,
nsWidgetInitData *aInitData = nsnull) = 0;
/**
@@ -578,40 +578,40 @@ class nsIWidget : public nsISupports {
NS_IMETHOD SetFocus(PRBool aRaise = PR_FALSE) = 0;
/**
* Get this widget's outside dimensions relative to its parent widget
*
* @param aRect on return it holds the x, y, width and height of this widget
*
*/
- NS_IMETHOD GetBounds(nsIntRect &aRect) = 0;
+ NS_IMETHOD GetBounds(nsRect &aRect) = 0;
/**
* Get this widget's outside dimensions in global coordinates. (One might think this
* could be accomplished by stringing together other methods in this interface, but
* then one would bloody one's nose on different coordinate system handling by different
* platforms.) This includes any title bar on the window.
*
*
* @param aRect on return it holds the x, y, width and height of this widget
*
*/
- NS_IMETHOD GetScreenBounds(nsIntRect &aRect) = 0;
+ NS_IMETHOD GetScreenBounds(nsRect &aRect) = 0;
/**
* Get this widget's client area dimensions, if the window has a 3D border appearance
* this returns the area inside the border, The x and y are always zero
*
* @param aRect on return it holds the x. y, width and height of the client area of this widget
*
*/
- NS_IMETHOD GetClientBounds(nsIntRect &aRect) = 0;
+ NS_IMETHOD GetClientBounds(nsRect &aRect) = 0;
/**
* Gets the width and height of the borders
* @param aWidth the width of the border
* @param aHeight the height of the border
*
*/
NS_IMETHOD GetBorderSize(PRInt32 &aWidth, PRInt32 &aHeight) = 0;
@@ -740,17 +740,17 @@ class nsIWidget : public nsISupports {
/**
* Invalidate a specified rect for a widget and repaints it.
*
* @param aIsSynchronouse PR_TRUE then repaint synchronously. If PR_FALSE repaint later.
* @see #Update()
*/
- NS_IMETHOD Invalidate(const nsIntRect & aRect, PRBool aIsSynchronous) = 0;
+ NS_IMETHOD Invalidate(const nsRect & aRect, PRBool aIsSynchronous) = 0;
/**
* Invalidate a specified region for a widget and repaints it.
*
* @param aIsSynchronouse PR_TRUE then repaint synchronously. If PR_FALSE repaint later.
* @see #Update()
*/
@@ -797,17 +797,17 @@ class nsIWidget : public nsISupports {
* Scroll this widget.
*
* @param aDx amount to scroll along the x-axis
* @param aDy amount to scroll along the y-axis.
* @param aClipRect clipping rectangle to limit the scroll to.
*
*/
- NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsIntRect *aClipRect) = 0;
+ NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect) = 0;
/**
* Scroll the contents of the widget.
* All child widgets are also scrolled by offsetting their coordinates.
* A NS_PAINT message is synchronously dispatched for the newly exposed rectangle.
*
* @param aDx amount to scroll along the x-axis in pixels
* @param aDy amount to scroll along the y-axis in pixels
@@ -821,17 +821,17 @@ class nsIWidget : public nsISupports {
* A NS_PAINT message is synchronously dispatched for the newly exposed rectangle.
*
* @param aRect source rectangle to scroll in the widget in pixels
* @param aDx x offset from the source in pixels
* @param aDy y offset from the source in pixels
*
*/
- NS_IMETHOD ScrollRect(nsIntRect &aSrcRect, PRInt32 aDx, PRInt32 aDy) = 0;
+ NS_IMETHOD ScrollRect(nsRect &aSrcRect, PRInt32 aDx, PRInt32 aDy) = 0;
/**
* Internal methods
*/
//@{
virtual void AddChild(nsIWidget* aChild) = 0;
virtual void RemoveChild(nsIWidget* aChild) = 0;
@@ -891,26 +891,26 @@ class nsIWidget : public nsISupports {
/**
* Convert from this widget coordinates to screen coordinates.
*
* @param aOldRect widget coordinates stored in the x,y members
* @param aNewRect screen coordinates stored in the x,y members
*/
- NS_IMETHOD WidgetToScreen(const nsIntRect& aOldRect, nsIntRect& aNewRect) = 0;
+ NS_IMETHOD WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect) = 0;
/**
* Convert from screen coordinates to this widget's coordinates.
*
* @param aOldRect screen coordinates stored in the x,y members
* @param aNewRect widget's coordinates stored in the x,y members
*/
- NS_IMETHOD ScreenToWidget(const nsIntRect& aOldRect, nsIntRect& aNewRect) = 0;
+ NS_IMETHOD ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect) = 0;
/**
* When adjustments are to made to a whole set of child widgets, call this
* before resizing/positioning the child windows to minimize repaints. Must
* be followed by EndResizingChildren() after child windows have been
* adjusted.
*
*/
--- a/widget/src/cocoa/nsChildView.h
+++ b/widget/src/cocoa/nsChildView.h
@@ -254,35 +254,35 @@ private:
public:
nsChildView();
virtual ~nsChildView();
NS_DECL_ISUPPORTS_INHERITED
// nsIWidget interface
NS_IMETHOD Create(nsIWidget *aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell = nsnull,
nsIToolkit *aToolkit = nsnull,
nsWidgetInitData *aInitData = nsnull);
NS_IMETHOD Create(nsNativeWidget aNativeParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell = nsnull,
nsIToolkit *aToolkit = nsnull,
nsWidgetInitData *aInitData = nsnull);
// Utility method for implementing both Create(nsIWidget ...) and
// Create(nsNativeWidget...)
virtual nsresult StandardCreate(nsIWidget *aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData,
nsNativeWidget aNativeParent = nsnull);
NS_IMETHOD Destroy();
@@ -299,43 +299,43 @@ public:
PRInt32 *aX, PRInt32 *aY);
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
NS_IMETHOD Resize(PRInt32 aWidth,PRInt32 aHeight, PRBool aRepaint);
NS_IMETHOD Resize(PRInt32 aX, PRInt32 aY,PRInt32 aWidth,PRInt32 aHeight, PRBool aRepaint);
NS_IMETHOD Enable(PRBool aState);
NS_IMETHOD IsEnabled(PRBool *aState);
NS_IMETHOD SetFocus(PRBool aRaise);
- NS_IMETHOD SetBounds(const nsIntRect &aRect);
- NS_IMETHOD GetBounds(nsIntRect &aRect);
+ NS_IMETHOD SetBounds(const nsRect &aRect);
+ NS_IMETHOD GetBounds(nsRect &aRect);
NS_IMETHOD Invalidate(PRBool aIsSynchronous);
- NS_IMETHOD Invalidate(const nsIntRect &aRect, PRBool aIsSynchronous);
+ NS_IMETHOD Invalidate(const nsRect &aRect,PRBool aIsSynchronous);
NS_IMETHOD InvalidateRegion(const nsIRegion *aRegion, PRBool aIsSynchronous);
NS_IMETHOD Validate();
virtual void* GetNativeData(PRUint32 aDataType);
NS_IMETHOD SetColorMap(nsColorMap *aColorMap);
- NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsIntRect *aClipRect);
- NS_IMETHOD WidgetToScreen(const nsIntRect& aOldRect, nsIntRect& aNewRect);
- NS_IMETHOD ScreenToWidget(const nsIntRect& aOldRect, nsIntRect& aNewRect);
+ NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect);
+ NS_IMETHOD WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect);
+ NS_IMETHOD ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect);
NS_IMETHOD BeginResizingChildren(void);
NS_IMETHOD EndResizingChildren(void);
virtual PRBool ShowsResizeIndicator(nsIntRect* aResizerRect);
static PRBool ConvertStatus(nsEventStatus aStatus)
{ return aStatus == nsEventStatus_eConsumeNoDefault; }
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
NS_IMETHOD Update();
virtual void ConvertToDeviceCoordinates(nscoord &aX, nscoord &aY);
- void LocalToWindowCoordinate(nsIntPoint& aPoint) { ConvertToDeviceCoordinates(aPoint.x, aPoint.y); }
+ void LocalToWindowCoordinate(nsPoint& aPoint) { ConvertToDeviceCoordinates(aPoint.x, aPoint.y); }
void LocalToWindowCoordinate(nscoord& aX, nscoord& aY) { ConvertToDeviceCoordinates(aX, aY); }
- void LocalToWindowCoordinate(nsIntRect& aRect) { ConvertToDeviceCoordinates(aRect.x, aRect.y); }
+ void LocalToWindowCoordinate(nsRect& aRect) { ConvertToDeviceCoordinates(aRect.x, aRect.y); }
NS_IMETHOD SetMenuBar(void* aMenuBar);
NS_IMETHOD ShowMenuBar(PRBool aShow);
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight);
NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight);
NS_IMETHOD SetCursor(nsCursor aCursor);
--- a/widget/src/cocoa/nsChildView.mm
+++ b/widget/src/cocoa/nsChildView.mm
@@ -134,17 +134,17 @@ nsIWidget * gRollupWidget = ns
@interface ChildView(Private)
// sets up our view, attaching it to its owning gecko view
- (id)initWithFrame:(NSRect)inFrame geckoChild:(nsChildView*)inChild;
// sends gecko an ime composition event
-- (nsIntRect) sendCompositionEvent:(PRInt32)aEventType;
+- (nsRect) sendCompositionEvent:(PRInt32)aEventType;
// sends gecko an ime text event
- (void) sendTextEvent:(PRUnichar*) aBuffer
attributedString:(NSAttributedString*) aString
selectedRange:(NSRange)selRange
markedRange:(NSRange)markRange
doCommit:(BOOL)doCommit;
@@ -203,31 +203,31 @@ nsIWidget * gRollupWidget = ns
* (0,0) in the bottom-left of the screen. Both nsRect and NSRect
* contain width/height info, with no difference in their use.
* If a Cocoa rect is from a flipped view, there is no need to
* convert coordinate systems.
*/
static inline void
-GeckoRectToNSRect(const nsIntRect & inGeckoRect, NSRect & outCocoaRect)
+GeckoRectToNSRect(const nsRect & inGeckoRect, NSRect & outCocoaRect)
{
outCocoaRect.origin.x = inGeckoRect.x;
outCocoaRect.origin.y = inGeckoRect.y;
outCocoaRect.size.width = inGeckoRect.width;
outCocoaRect.size.height = inGeckoRect.height;
}
static inline void
-NSRectToGeckoRect(const NSRect & inCocoaRect, nsIntRect & outGeckoRect)
-{
- outGeckoRect.x = NSToIntFloor(inCocoaRect.origin.x);
- outGeckoRect.y = NSToIntFloor(inCocoaRect.origin.y);
- outGeckoRect.width = NSToIntCeil(inCocoaRect.size.width);
- outGeckoRect.height = NSToIntCeil(inCocoaRect.size.height);
+NSRectToGeckoRect(const NSRect & inCocoaRect, nsRect & outGeckoRect)
+{
+ outGeckoRect.x = static_cast<nscoord>(inCocoaRect.origin.x);
+ outGeckoRect.y = static_cast<nscoord>(inCocoaRect.origin.y);
+ outGeckoRect.width = static_cast<nscoord>(inCocoaRect.size.width);
+ outGeckoRect.height = static_cast<nscoord>(inCocoaRect.size.height);
}
static inline void
ConvertGeckoRectToMacRect(const nsRect& aRect, Rect& outMacRect)
{
outMacRect.left = aRect.x;
outMacRect.top = aRect.y;
@@ -447,17 +447,17 @@ nsChildView::~nsChildView()
NS_IMPL_ISUPPORTS_INHERITED1(nsChildView, nsBaseWidget, nsIPluginWidget)
// Utility method for implementing both Create(nsIWidget ...)
// and Create(nsNativeWidget...)
nsresult nsChildView::StandardCreate(nsIWidget *aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData,
nsNativeWidget aNativeParent)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@@ -577,31 +577,31 @@ void nsChildView::TearDownView()
mView = nil;
NS_OBJC_END_TRY_ABORT_BLOCK;
}
// create a nsChildView
NS_IMETHODIMP nsChildView::Create(nsIWidget *aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData)
{
return(StandardCreate(aParent, aRect, aHandleEventFunction, aContext,
aAppShell, aToolkit, aInitData, nsnull));
}
// Creates a main nsChildView using a native widget (an NSView)
NS_IMETHODIMP nsChildView::Create(nsNativeWidget aNativeParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData)
{
// what we're passed in |aNativeParent| is an NSView.
return(StandardCreate(nsnull, aRect, aHandleEventFunction, aContext,
@@ -985,24 +985,24 @@ NS_IMETHODIMP nsChildView::SetCursor(img
return nsBaseWidget::SetCursor(aCursor, aHotspotX, aHotspotY);
}
#pragma mark -
// Get this component dimension
-NS_IMETHODIMP nsChildView::GetBounds(nsIntRect &aRect)
+NS_IMETHODIMP nsChildView::GetBounds(nsRect &aRect)
{
aRect = mBounds;
return NS_OK;
}
-NS_IMETHODIMP nsChildView::SetBounds(const nsIntRect &aRect)
+NS_IMETHODIMP nsChildView::SetBounds(const nsRect &aRect)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
nsresult rv = Inherited::SetBounds(aRect);
if (NS_SUCCEEDED(rv)) {
NSRect r;
GeckoRectToNSRect(aRect, r);
[mView setFrame:r];
@@ -1521,17 +1521,17 @@ NS_IMETHODIMP nsChildView::Invalidate(PR
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
// Invalidate this component's visible area
-NS_IMETHODIMP nsChildView::Invalidate(const nsIntRect &aRect, PRBool aIsSynchronous)
+NS_IMETHODIMP nsChildView::Invalidate(const nsRect &aRect, PRBool aIsSynchronous)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
if (!mView || !mVisible)
return NS_OK;
NSRect r;
GeckoRectToNSRect(aRect, r);
@@ -1571,17 +1571,17 @@ NS_IMETHODIMP nsChildView::InvalidateReg
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
if (!mView || !mVisible)
return NS_OK;
// FIXME rewrite to use a Cocoa region when nsIRegion isn't a QD Region
NSRect r;
- nsIntRect bounds;
+ nsRect bounds;
nsIRegion* region = const_cast<nsIRegion*>(aRegion); // ugh. this method should be const
region->GetBoundingBox(&bounds.x, &bounds.y, &bounds.width, &bounds.height);
GeckoRectToNSRect(bounds, r);
if (aIsSynchronous)
[mView displayRect:r];
else
[mView setNeedsDisplayInRect:r];
@@ -1621,17 +1621,17 @@ NS_IMETHODIMP nsChildView::Update()
}
#pragma mark -
// Scroll the bits of a view and its children
// FIXME: I'm sure the invalidating can be optimized, just no time now.
-NS_IMETHODIMP nsChildView::Scroll(PRInt32 aDx, PRInt32 aDy, nsIntRect *aClipRect)
+NS_IMETHODIMP nsChildView::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
NS_ASSERTION(mParentView, "Attempting to scroll a view that does not have a parent");
if (!mParentView)
return NS_ERROR_NOT_AVAILABLE;
BOOL viewWasDirty = NO;
@@ -1643,17 +1643,17 @@ NS_IMETHODIMP nsChildView::Scroll(PRInt3
}
// Scroll the children (even if the widget is not visible)
for (nsIWidget* kid = mFirstChild; kid; kid = kid->GetNextSibling()) {
// We use resize rather than move since it gives us control
// over repainting. We can scroll like a bat out of hell
// by not wasting time invalidating the widgets, since it's
// completely unnecessary to do so.
- nsIntRect bounds;
+ nsRect bounds;
kid->GetBounds(bounds);
kid->Resize(bounds.x + aDx, bounds.y + aDy, bounds.width, bounds.height, PR_FALSE);
}
if (mOnDestroyCalled)
return NS_OK;
if (mVisible) {
@@ -1862,37 +1862,37 @@ NS_IMETHODIMP nsChildView::CalcOffset(PR
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
// Find if a point in local coordinates is inside this object
PRBool nsChildView::PointInWidget(Point aThePoint)
{
// get the origin in local coordinates
- nsIntPoint widgetOrigin(0, 0);
+ nsPoint widgetOrigin(0, 0);
LocalToWindowCoordinate(widgetOrigin);
// get rectangle relatively to the parent
- nsIntRect widgetRect;
+ nsRect widgetRect;
GetBounds(widgetRect);
// convert the topLeft corner to local coordinates
widgetRect.MoveBy(widgetOrigin.x, widgetOrigin.y);
// finally tell whether it's a hit
return widgetRect.Contains(aThePoint.h, aThePoint.v);
}
#pragma mark -
// Convert the given rect to global coordinates.
// @param aLocalRect -- rect in local coordinates of this widget
// @param aGlobalRect -- |aLocalRect| in global coordinates
-NS_IMETHODIMP nsChildView::WidgetToScreen(const nsIntRect& aLocalRect, nsIntRect& aGlobalRect)
+NS_IMETHODIMP nsChildView::WidgetToScreen(const nsRect& aLocalRect, nsRect& aGlobalRect)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
NSRect temp;
GeckoRectToNSRect(aLocalRect, temp);
// 1. First translate this rect into window coords. The returned rect is always in
// bottom-left coordinates.
@@ -1922,17 +1922,17 @@ NS_IMETHODIMP nsChildView::WidgetToScree
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
// Convert the given rect to local coordinates.
// @param aGlobalRect -- rect in screen coordinates
// @param aLocalRect -- |aGlobalRect| in coordinates of this widget
-NS_IMETHODIMP nsChildView::ScreenToWidget(const nsIntRect& aGlobalRect, nsIntRect& aLocalRect)
+NS_IMETHODIMP nsChildView::ScreenToWidget(const nsRect& aGlobalRect, nsRect& aLocalRect)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
NSRect temp;
GeckoRectToNSRect(aGlobalRect, temp);
FlipCocoaScreenCoordinate(temp.origin);
temp.origin = [[mView nativeWindow] convertScreenToBase:temp.origin]; // convert to screen coords
@@ -2738,17 +2738,17 @@ NSEvent* gLastDragEvent = nil;
PRBool isVisible;
if (!mGeckoChild || NS_FAILED(mGeckoChild->IsVisible(isVisible)) ||
!isVisible || [self isPaintingSuppressed])
return;
CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
- nsIntRect geckoBounds;
+ nsRect geckoBounds;
mGeckoChild->GetBounds(geckoBounds);
NSRect bounds = [self bounds];
nsRefPtr<gfxQuartzSurface> targetSurface =
new gfxQuartzSurface(cgContext, gfxSize(bounds.size.width, bounds.size.height));
#ifdef DEBUG_UPDATE
fprintf (stderr, "---- Update[%p][%p] [%f %f %f %f] cgc: %p\n gecko bounds: [%d %d %d %d]\n",
@@ -2782,17 +2782,17 @@ NSEvent* gLastDragEvent = nil;
rgn->Union((PRInt32)r.origin.x, (PRInt32)r.origin.y, (PRInt32)r.size.width, (PRInt32)r.size.height);
// to the context for clipping
targetContext->Rectangle(gfxRect(r.origin.x, r.origin.y, r.size.width, r.size.height));
}
targetContext->Clip();
// bounding box of the dirty area
- nsIntRect fullRect;
+ nsRect fullRect;
NSRectToGeckoRect(aRect, fullRect);
nsPaintEvent paintEvent(PR_TRUE, NS_PAINT, mGeckoChild);
paintEvent.renderingContext = rc;
paintEvent.rect = &fullRect;
paintEvent.region = rgn;
nsAutoRetainCocoaObject kungFuDeathGrip(self);
@@ -4691,24 +4691,24 @@ GetUSLayoutCharFromKeyTranslate(UInt32 a
}
::ReleaseEvent(cloneEvent);
NS_OBJC_END_TRY_ABORT_BLOCK;
}
-- (nsIntRect)sendCompositionEvent:(PRInt32) aEventType
+- (nsRect)sendCompositionEvent:(PRInt32) aEventType
{
#ifdef DEBUG_IME
NSLog(@"****in sendCompositionEvent; type = %d", aEventType);
#endif
if (!mGeckoChild)
- return nsIntRect(0, 0, 0, 0);
+ return nsRect(0, 0, 0, 0);
// static void init_composition_event( *aEvent, int aType)
nsCompositionEvent event(PR_TRUE, aEventType, mGeckoChild);
event.time = PR_IntervalNow();
mGeckoChild->DispatchWindowEvent(event);
return event.theReply.mCursorPosition;
}
@@ -5063,17 +5063,17 @@ GetUSLayoutCharFromKeyTranslate(UInt32 a
// XXX this returns first character rect or caret rect, it is limitation of
// now. We need more work for returns first line rect. But current
// implementation is enough for IMEs.
NSRect rect;
if (!mGeckoChild || theRange.location == NSNotFound)
return rect;
- nsIntRect r;
+ nsRect r;
PRBool useCaretRect = theRange.length == 0;
if (!useCaretRect) {
nsQueryContentEvent charRect(PR_TRUE, NS_QUERY_CHARACTER_RECT, mGeckoChild);
charRect.InitForQueryCharacterRect(theRange.location);
mGeckoChild->DispatchWindowEvent(charRect);
if (charRect.mSucceeded)
r = charRect.mReply.mRect;
else
--- a/widget/src/cocoa/nsCocoaUtils.h
+++ b/widget/src/cocoa/nsCocoaUtils.h
@@ -110,20 +110,20 @@ class nsCocoaUtils
// flipped from Gecko to Cocoa or Cocoa to Gecko.
static float FlippedScreenY(float y);
// Gecko rects (nsRect) contain an origin (x,y) in a coordinate
// system with (0,0) in the top-left of the primary screen. Cocoa rects
// (NSRect) contain an origin (x,y) in a coordinate system with (0,0)
// in the bottom-left of the primary screen. Both nsRect and NSRect
// contain width/height info, with no difference in their use.
- static NSRect GeckoRectToCocoaRect(const nsIntRect &geckoRect);
+ static NSRect GeckoRectToCocoaRect(const nsRect &geckoRect);
// See explanation for geckoRectToCocoaRect, guess what this does...
- static nsIntRect CocoaRectToGeckoRect(const NSRect &cocoaRect);
+ static nsRect CocoaRectToGeckoRect(const NSRect &cocoaRect);
// Gives the location for the event in screen coordinates. Do not call this
// unless the window the event was originally targeted at is still alive!
static NSPoint ScreenLocationForEvent(NSEvent* anEvent);
// Determines if an event happened over a window, whether or not the event
// is for the window. Does not take window z-order into account.
static BOOL IsEventOverWindow(NSEvent* anEvent, NSWindow* aWindow);
--- a/widget/src/cocoa/nsCocoaUtils.mm
+++ b/widget/src/cocoa/nsCocoaUtils.mm
@@ -65,42 +65,40 @@ float nsCocoaUtils::MenuBarScreenHeight(
float nsCocoaUtils::FlippedScreenY(float y)
{
return MenuBarScreenHeight() - y;
}
-NSRect nsCocoaUtils::GeckoRectToCocoaRect(const nsIntRect &geckoRect)
+NSRect nsCocoaUtils::GeckoRectToCocoaRect(const nsRect &geckoRect)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
// We only need to change the Y coordinate by starting with the primary screen
// height, subtracting the gecko Y coordinate, and subtracting the height.
return NSMakeRect(geckoRect.x,
MenuBarScreenHeight() - (geckoRect.y + geckoRect.height),
geckoRect.width,
geckoRect.height);
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NSMakeRect(0.0, 0.0, 0.0, 0.0));
}
-nsIntRect nsCocoaUtils::CocoaRectToGeckoRect(const NSRect &cocoaRect)
+nsRect nsCocoaUtils::CocoaRectToGeckoRect(const NSRect &cocoaRect)
{
// We only need to change the Y coordinate by starting with the primary screen
// height and subtracting both the cocoa y origin and the height of the
// cocoa rect.
- nsIntRect rect;
- rect.x = NSToIntFloor(cocoaRect.origin.x);
- rect.y = NSToIntFloor(MenuBarScreenHeight() - (cocoaRect.origin.y + cocoaRect.size.height));
- rect.width = NSToIntCeil(cocoaRect.origin.x + cocoaRect.size.width) - rect.x;
- rect.height = NSToIntCeil(MenuBarScreenHeight() - cocoaRect.origin.y) - rect.y;
- return rect;
+ return nsRect((nscoord)cocoaRect.origin.x,
+ (nscoord)(MenuBarScreenHeight() - (cocoaRect.origin.y + cocoaRect.size.height)),
+ (nscoord)cocoaRect.size.width,
+ (nscoord)cocoaRect.size.height);
}
NSPoint nsCocoaUtils::ScreenLocationForEvent(NSEvent* anEvent)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
return [[anEvent window] convertBaseToScreen:[anEvent locationInWindow]];
--- a/widget/src/cocoa/nsCocoaWindow.h
+++ b/widget/src/cocoa/nsCocoaWindow.h
@@ -198,37 +198,37 @@ public:
nsCocoaWindow();
virtual ~nsCocoaWindow();
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSPIWIDGETCOCOA
NS_IMETHOD Create(nsNativeWidget aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell = nsnull,
nsIToolkit *aToolkit = nsnull,
nsWidgetInitData *aInitData = nsnull);
NS_IMETHOD Create(nsIWidget* aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell = nsnull,
nsIToolkit *aToolkit = nsnull,
nsWidgetInitData *aInitData = nsnull);
NS_IMETHOD Destroy();
// Utility method for implementing both Create(nsIWidget ...) and
// Create(nsNativeWidget...)
virtual nsresult StandardCreate(nsIWidget *aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData,
nsNativeWidget aNativeWindow = nsnull);
NS_IMETHOD Show(PRBool aState);
@@ -237,40 +237,40 @@ public:
NS_IMETHOD Enable(PRBool aState);
NS_IMETHOD IsEnabled(PRBool *aState);
NS_IMETHOD SetModal(PRBool aState);
NS_IMETHOD IsVisible(PRBool & aState);
NS_IMETHOD SetFocus(PRBool aState=PR_FALSE);
NS_IMETHOD SetMenuBar(void* aMenuBar);
virtual nsMenuBarX* GetMenuBar();
NS_IMETHOD ShowMenuBar(PRBool aShow);
- NS_IMETHOD WidgetToScreen(const nsIntRect& aOldRect, nsIntRect& aNewRect);
- NS_IMETHOD ScreenToWidget(const nsIntRect& aOldRect, nsIntRect& aNewRect);
+ NS_IMETHOD WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect);
+ NS_IMETHOD ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect);
virtual void* GetNativeData(PRUint32 aDataType) ;
NS_IMETHOD ConstrainPosition(PRBool aAllowSlop,
PRInt32 *aX, PRInt32 *aY);
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
nsIWidget *aWidget, PRBool aActivate);
NS_IMETHOD SetSizeMode(PRInt32 aMode);
NS_IMETHOD Resize(PRInt32 aWidth,PRInt32 aHeight, PRBool aRepaint);
NS_IMETHOD Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);
- NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
+ NS_IMETHOD GetScreenBounds(nsRect &aRect);
virtual PRBool OnPaint(nsPaintEvent &event);
void ReportSizeEvent(NSRect *overrideRect = nsnull);
NS_IMETHOD SetTitle(const nsAString& aTitle);
- NS_IMETHOD Invalidate(const nsIntRect &aRect, PRBool aIsSynchronous);
+ NS_IMETHOD Invalidate(const nsRect & aRect, PRBool aIsSynchronous);
NS_IMETHOD Invalidate(PRBool aIsSynchronous);
NS_IMETHOD Update();
- NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsIntRect *alCipRect) { return NS_OK; }
+ NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *alCipRect) { return NS_OK; }
NS_IMETHOD SetColorMap(nsColorMap *aColorMap) { return NS_OK; }
NS_IMETHOD BeginResizingChildren(void) { return NS_OK; }
NS_IMETHOD EndResizingChildren(void) { return NS_OK; }
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight) { return NS_OK; }
NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight) { return NS_OK; }
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus) ;
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent);
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
--- a/widget/src/cocoa/nsCocoaWindow.mm
+++ b/widget/src/cocoa/nsCocoaWindow.mm
@@ -175,17 +175,17 @@ static bool WindowSizeAllowed(PRInt32 aW
}
return true;
}
// Utility method for implementing both Create(nsIWidget ...) and
// Create(nsNativeWidget...)
nsresult nsCocoaWindow::StandardCreate(nsIWidget *aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData,
nsNativeWidget aNativeWindow)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@@ -401,30 +401,30 @@ nsresult nsCocoaWindow::StandardCreate(n
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
// Create a nsCocoaWindow using a native window provided by the application
NS_IMETHODIMP nsCocoaWindow::Create(nsNativeWidget aNativeWindow,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData)
{
return(StandardCreate(nsnull, aRect, aHandleEventFunction, aContext,
aAppShell, aToolkit, aInitData, aNativeWindow));
}
NS_IMETHODIMP nsCocoaWindow::Create(nsIWidget* aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData)
{
return(StandardCreate(aParent, aRect, aHandleEventFunction, aContext,
aAppShell, aToolkit, aInitData, nsnull));
@@ -933,24 +933,24 @@ NS_METHOD nsCocoaWindow::SetSizeMode(PRI
NS_IMETHODIMP nsCocoaWindow::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
if (!WindowSizeAllowed(aWidth, aHeight))
return NS_ERROR_FAILURE;
- nsIntRect windowBounds(nsCocoaUtils::CocoaRectToGeckoRect([mWindow frame]));
+ nsRect windowBounds(nsCocoaUtils::CocoaRectToGeckoRect([mWindow frame]));
BOOL isMoving = (windowBounds.x != aX || windowBounds.y != aY);
BOOL isResizing = (windowBounds.width != aWidth || windowBounds.height != aHeight);
if (IsResizing() || !mWindow || (!isMoving && !isResizing))
return NS_OK;
- nsIntRect geckoRect(aX, aY, aWidth, aHeight);
+ nsRect geckoRect(aX, aY, aWidth, aHeight);
NSRect newFrame = nsCocoaUtils::GeckoRectToCocoaRect(geckoRect);
// We have to report the size event -first-, to make sure that content
// repositions itself. Cocoa views are anchored at the bottom left,
// so if we don't do this our child view will end up being stuck in the
// wrong place during a resize.
if (isResizing)
ReportSizeEvent(&newFrame);
@@ -980,28 +980,32 @@ NS_IMETHODIMP nsCocoaWindow::Resize(PRIn
NS_IMETHODIMP nsCocoaWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
if (!WindowSizeAllowed(aWidth, aHeight))
return NS_ERROR_FAILURE;
- nsIntRect windowBounds(nsCocoaUtils::CocoaRectToGeckoRect([mWindow frame]));
+ nsRect windowBounds(nsCocoaUtils::CocoaRectToGeckoRect([mWindow frame]));
return Resize(windowBounds.x, windowBounds.y, aWidth, aHeight, aRepaint);
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
-NS_IMETHODIMP nsCocoaWindow::GetScreenBounds(nsIntRect &aRect)
+NS_IMETHODIMP nsCocoaWindow::GetScreenBounds(nsRect &aRect)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
- aRect = nsCocoaUtils::CocoaRectToGeckoRect([mWindow frame]);
+ nsRect windowFrame = nsCocoaUtils::CocoaRectToGeckoRect([mWindow frame]);
+ aRect.x = windowFrame.x;
+ aRect.y = windowFrame.y;
+ aRect.width = windowFrame.width;
+ aRect.height = windowFrame.height;
// printf("GetScreenBounds: output: %d,%d,%d,%d\n", aRect.x, aRect.y, aRect.width, aRect.height);
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
PRBool nsCocoaWindow::OnPaint(nsPaintEvent &event)
@@ -1019,17 +1023,17 @@ NS_IMETHODIMP nsCocoaWindow::SetTitle(co
[mWindow setTitle:title];
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
-NS_IMETHODIMP nsCocoaWindow::Invalidate(const nsIntRect & aRect, PRBool aIsSynchronous)
+NS_IMETHODIMP nsCocoaWindow::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
{
if (mPopupContentView)
return mPopupContentView->Invalidate(aRect, aIsSynchronous);
return NS_OK;
}
@@ -1217,38 +1221,38 @@ NS_IMETHODIMP nsCocoaWindow::SetFocus(PR
NS_IMETHODIMP nsCocoaWindow::ShowMenuBar(PRBool aShow)
{
return NS_ERROR_FAILURE;
}
-NS_IMETHODIMP nsCocoaWindow::WidgetToScreen(const nsIntRect& aOldRect, nsIntRect& aNewRect)
+NS_IMETHODIMP nsCocoaWindow::WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
- nsIntRect r(nsCocoaUtils::CocoaRectToGeckoRect([mWindow contentRectForFrameRect:[mWindow frame]]));
+ nsRect r = nsCocoaUtils::CocoaRectToGeckoRect([mWindow contentRectForFrameRect:[mWindow frame]]);
aNewRect.x = r.x + aOldRect.x;
aNewRect.y = r.y + aOldRect.y;
aNewRect.width = aOldRect.width;
aNewRect.height = aOldRect.height;
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
-NS_IMETHODIMP nsCocoaWindow::ScreenToWidget(const nsIntRect& aOldRect, nsIntRect& aNewRect)
+NS_IMETHODIMP nsCocoaWindow::ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
- nsIntRect r(nsCocoaUtils::CocoaRectToGeckoRect([mWindow contentRectForFrameRect:[mWindow frame]]));
+ nsRect r = nsCocoaUtils::CocoaRectToGeckoRect([mWindow contentRectForFrameRect:[mWindow frame]]);
aNewRect.x = aOldRect.x - r.x;
aNewRect.y = aOldRect.y - r.y;
aNewRect.width = aOldRect.width;
aNewRect.height = aOldRect.height;
return NS_OK;
@@ -1537,17 +1541,17 @@ NS_IMETHODIMP nsCocoaWindow::EndSecureKe
RollUpPopups();
}
- (void)windowDidMove:(NSNotification *)aNotification
{
// Dispatch the move event to Gecko
nsGUIEvent guiEvent(PR_TRUE, NS_MOVE, mGeckoWindow);
- nsIntRect rect;
+ nsRect rect;
mGeckoWindow->GetScreenBounds(rect);
guiEvent.refPoint.x = rect.x;
guiEvent.refPoint.y = rect.y;
guiEvent.time = PR_IntervalNow();
nsEventStatus status = nsEventStatus_eIgnore;
mGeckoWindow->DispatchEvent(&guiEvent, status);
}
--- a/widget/src/cocoa/nsDragService.h
+++ b/widget/src/cocoa/nsDragService.h
@@ -62,17 +62,17 @@ public:
// nsIDragSession
NS_IMETHOD GetData(nsITransferable * aTransferable, PRUint32 aItemIndex);
NS_IMETHOD IsDataFlavorSupported(const char *aDataFlavor, PRBool *_retval);
NS_IMETHOD GetNumDropItems(PRUint32 * aNumItems);
private:
NSImage* ConstructDragImage(nsIDOMNode* aDOMNode,
- nsIntRect* aDragRect,
+ nsRect* aDragRect,
nsIScriptableRegion* aRegion);
nsCOMPtr<nsISupportsArray> mDataItems; // only valid for a drag started within gecko
NSView* mNativeDragView;
NSEvent* mNativeDragEvent;
};
#endif // nsDragService_h_
--- a/widget/src/cocoa/nsDragService.mm
+++ b/widget/src/cocoa/nsDragService.mm
@@ -155,17 +155,17 @@ static nsresult SetUpDragClipboard(nsISu
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
NSImage*
nsDragService::ConstructDragImage(nsIDOMNode* aDOMNode,
- nsIntRect* aDragRect,
+ nsRect* aDragRect,
nsIScriptableRegion* aRegion)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
NSPoint screenPoint = [[gLastDragView window] convertBaseToScreen:[gLastDragEvent locationInWindow]];
// Y coordinates are bottom to top, so reverse this
if ([[NSScreen screens] count] > 0)
screenPoint.y = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - screenPoint.y;
@@ -259,17 +259,17 @@ nsDragService::InvokeDragSession(nsIDOMN
NS_ENSURE_SUCCESS(rv, rv);
mDataItems = aTransferableArray;
// put data on the clipboard
if (NS_FAILED(SetUpDragClipboard(aTransferableArray)))
return NS_ERROR_FAILURE;
- nsIntRect dragRect(0, 0, 20, 20);
+ nsRect dragRect(0, 0, 20, 20);
NSImage* image = ConstructDragImage(aDOMNode, &dragRect, aDragRgn);
if (!image) {
// if no image was returned, just draw a rectangle
NSSize size;
size.width = dragRect.width;
size.height = dragRect.height;
image = [[NSImage alloc] initWithSize:size];
[image lockFocus];
--- a/widget/src/cocoa/nsNativeThemeCocoa.h
+++ b/widget/src/cocoa/nsNativeThemeCocoa.h
@@ -63,29 +63,29 @@ public:
NS_IMETHOD DrawWidgetBackground(nsIRenderingContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
const nsRect& aRect,
const nsRect& aDirtyRect);
NS_IMETHOD GetWidgetBorder(nsIDeviceContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntMargin* aResult);
+ nsMargin* aResult);
virtual PRBool GetWidgetPadding(nsIDeviceContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntMargin* aResult);
+ nsMargin* aResult);
virtual PRBool GetWidgetOverflow(nsIDeviceContext* aContext, nsIFrame* aFrame,
PRUint8 aWidgetType, nsRect* aOverflowRect);
NS_IMETHOD GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntSize* aResult, PRBool* aIsOverridable);
+ nsSize* aResult, PRBool* aIsOverridable);
NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
nsIAtom* aAttribute, PRBool* aShouldRepaint);
NS_IMETHOD ThemeChanged();
PRBool ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType);
PRBool WidgetIsContainer(PRUint8 aWidgetType);
PRBool ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType);
PRBool ThemeNeedsComboboxDropmarker();
--- a/widget/src/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/src/cocoa/nsNativeThemeCocoa.mm
@@ -1493,17 +1493,17 @@ nsNativeThemeCocoa::DrawWidgetBackground
static const int kAquaDropdownLeftBorder = 5;
static const int kAquaDropdownRightBorder = 22;
NS_IMETHODIMP
nsNativeThemeCocoa::GetWidgetBorder(nsIDeviceContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntMargin* aResult)
+ nsMargin* aResult)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
aResult->SizeTo(0, 0, 0, 0);
switch (aWidgetType) {
case NS_THEME_BUTTON:
{
@@ -1581,17 +1581,17 @@ nsNativeThemeCocoa::GetWidgetBorder(nsID
// Return PR_FALSE here to indicate that CSS padding values should be used. There is
// no reason to make a distinction between padding and border values, just specify
// whatever values you want in GetWidgetBorder and only use this to return PR_TRUE
// if you want to override CSS padding values.
PRBool
nsNativeThemeCocoa::GetWidgetPadding(nsIDeviceContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntMargin* aResult)
+ nsMargin* aResult)
{
// We don't want CSS padding being used for certain widgets.
// See bug 381639 for an example of why.
switch (aWidgetType) {
case NS_THEME_BUTTON:
// Radios and checkboxes return a fixed size in GetMinimumWidgetSize
// and have a meaningful baseline, so they can't have
// author-specified padding.
@@ -1638,17 +1638,17 @@ nsNativeThemeCocoa::GetWidgetOverflow(ns
return PR_FALSE;
}
NS_IMETHODIMP
nsNativeThemeCocoa::GetMinimumWidgetSize(nsIRenderingContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntSize* aResult,
+ nsSize* aResult,
PRBool* aIsOverridable)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
aResult->SizeTo(0,0);
*aIsOverridable = PR_TRUE;
switch (aWidgetType) {
--- a/widget/src/cocoa/nsScreenCocoa.mm
+++ b/widget/src/cocoa/nsScreenCocoa.mm
@@ -58,30 +58,30 @@ nsScreenCocoa::~nsScreenCocoa ()
[mScreen release];
NS_OBJC_END_TRY_ABORT_BLOCK;
}
NS_IMETHODIMP
nsScreenCocoa::GetRect(PRInt32 *outX, PRInt32 *outY, PRInt32 *outWidth, PRInt32 *outHeight)
{
- nsIntRect r(nsCocoaUtils::CocoaRectToGeckoRect([mScreen frame]));
+ nsRect r = nsCocoaUtils::CocoaRectToGeckoRect([mScreen frame]);
*outX = r.x;
*outY = r.y;
*outWidth = r.width;
*outHeight = r.height;
return NS_OK;
}
NS_IMETHODIMP
nsScreenCocoa::GetAvailRect(PRInt32 *outX, PRInt32 *outY, PRInt32 *outWidth, PRInt32 *outHeight)
{
- nsIntRect r(nsCocoaUtils::CocoaRectToGeckoRect([mScreen visibleFrame]));
+ nsRect r = nsCocoaUtils::CocoaRectToGeckoRect([mScreen visibleFrame]);
*outX = r.x;
*outY = r.y;
*outWidth = r.width;
*outHeight = r.height;
return NS_OK;
}
--- a/widget/src/cocoa/nsScreenManagerCocoa.mm
+++ b/widget/src/cocoa/nsScreenManagerCocoa.mm
@@ -71,17 +71,17 @@ nsScreenManagerCocoa::ScreenForCocoaScre
NS_IMETHODIMP
nsScreenManagerCocoa::ScreenForRect (PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight,
nsIScreen **outScreen)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
NSEnumerator *screenEnum = [[NSScreen screens] objectEnumerator];
- NSRect inRect(nsCocoaUtils::GeckoRectToCocoaRect(nsIntRect(aX, aY, aWidth, aHeight)));
+ NSRect inRect = nsCocoaUtils::GeckoRectToCocoaRect(nsRect(aX, aY, aWidth, aHeight));
NSScreen *screenWindowIsOn = [NSScreen mainScreen];
float greatestArea = 0;
while (NSScreen *screen = [screenEnum nextObject]) {
NSDictionary *desc = [screen deviceDescription];
if ([desc objectForKey:NSDeviceIsScreen] == nil)
continue;
--- a/widget/src/gtk2/nsCommonWidget.cpp
+++ b/widget/src/gtk2/nsCommonWidget.cpp
@@ -123,17 +123,17 @@ void
nsCommonWidget::DispatchDeactivateEvent(void)
{
nsGUIEvent event(PR_TRUE, NS_DEACTIVATE, this);
nsEventStatus status;
DispatchEvent(&event, status);
}
void
-nsCommonWidget::DispatchResizeEvent(nsIntRect &aRect, nsEventStatus &aStatus)
+nsCommonWidget::DispatchResizeEvent(nsRect &aRect, nsEventStatus &aStatus)
{
nsSizeEvent event(PR_TRUE, NS_SIZE, this);
event.windowSize = &aRect;
event.refPoint.x = aRect.x;
event.refPoint.y = aRect.y;
event.mWinWidth = aRect.width;
event.mWinHeight = aRect.height;
@@ -199,17 +199,17 @@ nsCommonWidget::Show(PRBool aState)
NativeShow(aState);
return NS_OK;
}
NS_IMETHODIMP
nsCommonWidget::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
{
- mBounds.SizeTo(GetSafeWindowSize(nsIntSize(aWidth, aHeight)));
+ mBounds.SizeTo(GetSafeWindowSize(nsSize(aWidth, aHeight)));
if (!mCreated)
return NS_OK;
// There are several cases here that we need to handle, based on a
// matrix of the visibility of the widget, the sanity of this resize
// and whether or not the widget was previously sane.
@@ -258,31 +258,31 @@ nsCommonWidget::Resize(PRInt32 aWidth, P
}
else {
mNeedsResize = PR_TRUE;
}
}
// synthesize a resize event if this isn't a toplevel
if (mIsTopLevel || mListenForResizes) {
- nsIntRect rect(mBounds.x, mBounds.y, aWidth, aHeight);
+ nsRect rect(mBounds.x, mBounds.y, aWidth, aHeight);
nsEventStatus status;
DispatchResizeEvent(rect, status);
}
return NS_OK;
}
NS_IMETHODIMP
nsCommonWidget::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight,
PRBool aRepaint)
{
mBounds.x = aX;
mBounds.y = aY;
- mBounds.SizeTo(GetSafeWindowSize(nsIntSize(aWidth, aHeight)));
+ mBounds.SizeTo(GetSafeWindowSize(nsSize(aWidth, aHeight)));
mPlaced = PR_TRUE;
if (!mCreated)
return NS_OK;
// There are several cases here that we need to handle, based on a
// matrix of the visibility of the widget, the sanity of this resize
@@ -323,17 +323,17 @@ nsCommonWidget::Resize(PRInt32 aX, PRInt
else {
mNeedsResize = PR_TRUE;
mNeedsMove = PR_TRUE;
}
}
if (mIsTopLevel || mListenForResizes) {
// synthesize a resize event
- nsIntRect rect(aX, aY, aWidth, aHeight);
+ nsRect rect(aX, aY, aWidth, aHeight);
nsEventStatus status;
DispatchResizeEvent(rect, status);
}
return NS_OK;
}
NS_IMETHODIMP
--- a/widget/src/gtk2/nsCommonWidget.h
+++ b/widget/src/gtk2/nsCommonWidget.h
@@ -80,34 +80,34 @@ public:
// event handling code
void InitKeyEvent(nsKeyEvent &aEvent, GdkEventKey *aGdkEvent);
void DispatchGotFocusEvent(void);
void DispatchLostFocusEvent(void);
void DispatchActivateEvent(void);
void DispatchDeactivateEvent(void);
- void DispatchResizeEvent(nsIntRect &aRect, nsEventStatus &aStatus);
+ void DispatchResizeEvent(nsRect &aRect, nsEventStatus &aStatus);
NS_IMETHOD DispatchEvent(nsGUIEvent *aEvent, nsEventStatus &aStatus);
// virtual interfaces for some nsIWidget methods
virtual void NativeResize(PRInt32 aWidth,
PRInt32 aHeight,
PRBool aRepaint) = 0;
virtual void NativeResize(PRInt32 aX,
PRInt32 aY,
PRInt32 aWidth,
PRInt32 aHeight,
PRBool aRepaint) = 0;
virtual void NativeShow (PRBool aAction) = 0;
- virtual nsIntSize GetSafeWindowSize(const nsIntSize &aSize) = 0;
+ virtual nsSize GetSafeWindowSize(nsSize aSize) = 0;
// Some of the nsIWidget methods
NS_IMETHOD Show (PRBool aState);
NS_IMETHOD Resize (PRInt32 aWidth,
PRInt32 aHeight,
PRBool aRepaint);
NS_IMETHOD Resize (PRInt32 aX,
PRInt32 aY,
--- a/widget/src/gtk2/nsDragService.cpp
+++ b/widget/src/gtk2/nsDragService.cpp
@@ -203,30 +203,30 @@ nsDragService::InvokeDragSession(nsIDOMN
// start our drag.
GdkDragContext *context = gtk_drag_begin(mHiddenWidget,
sourceList,
action,
1,
&event);
PRBool needsFallbackIcon = PR_FALSE;
- nsIntRect dragRect;
+ nsRect dragRect;
nsPresContext* pc;
nsRefPtr<gfxASurface> surface;
if (mHasImage || mSelection) {
DrawDrag(aDOMNode, aRegion, mScreenX, mScreenY,
&dragRect, getter_AddRefs(surface), &pc);
}
if (surface) {
PRInt32 sx = mScreenX, sy = mScreenY;
ConvertToUnscaledDevPixels(pc, &sx, &sy);
- PRInt32 offsetX = sx - dragRect.x;
- PRInt32 offsetY = sy - dragRect.y;
+ PRInt32 offsetX = sx - NSToIntRound(dragRect.x);
+ PRInt32 offsetY = sy - NSToIntRound(dragRect.y);
if (!SetAlphaPixmap(surface, context, offsetX, offsetY, dragRect)) {
GdkPixbuf* dragPixbuf =
nsImageToPixbuf::SurfaceToPixbuf(surface, dragRect.width, dragRect.height);
if (dragPixbuf)
gtk_drag_set_icon_pixbuf(context, dragPixbuf, offsetX, offsetY);
else
needsFallbackIcon = PR_TRUE;
}
@@ -243,17 +243,17 @@ nsDragService::InvokeDragSession(nsIDOMN
return NS_OK;
}
PRBool
nsDragService::SetAlphaPixmap(gfxASurface *aSurface,
GdkDragContext *aContext,
PRInt32 aXOffset,
PRInt32 aYOffset,
- const nsIntRect& dragRect)
+ const nsRect& dragRect)
{
GdkScreen* screen = gtk_widget_get_screen(mHiddenWidget);
// Transparent drag icons need, like a lot of transparency-related things,
// a compositing X window manager
if (!gdk_screen_is_composited(screen))
return PR_FALSE;
--- a/widget/src/gtk2/nsDragService.h
+++ b/widget/src/gtk2/nsDragService.h
@@ -139,18 +139,18 @@ private:
GtkWidget *mHiddenWidget;
// our source data items
nsCOMPtr<nsISupportsArray> mSourceDataItems;
// get a list of the sources in gtk's format
GtkTargetList *GetSourceList(void);
// attempts to create a semi-transparent drag image. Returns TRUE if
// successful, FALSE if not
- PRBool SetAlphaPixmap(gfxASurface *aPixbuf,
- GdkDragContext *aContext,
- PRInt32 aXOffset,
- PRInt32 aYOffset,
- const nsIntRect &dragRect);
+ PRBool SetAlphaPixmap(gfxASurface *aPixbuf,
+ GdkDragContext *aContext,
+ PRInt32 aXOffset,
+ PRInt32 aYOffset,
+ const nsRect& dragRect);
};
#endif // nsDragService_h__
--- a/widget/src/gtk2/nsNativeThemeGTK.cpp
+++ b/widget/src/gtk2/nsNativeThemeGTK.cpp
@@ -809,17 +809,17 @@ nsNativeThemeGTK::DrawWidgetBackground(n
}
}
return NS_OK;
}
NS_IMETHODIMP
nsNativeThemeGTK::GetWidgetBorder(nsIDeviceContext* aContext, nsIFrame* aFrame,
- PRUint8 aWidgetType, nsIntMargin* aResult)
+ PRUint8 aWidgetType, nsMargin* aResult)
{
GtkTextDirection direction = GetTextDirection(aFrame);
aResult->top = aResult->left = aResult->right = aResult->bottom = 0;
switch (aWidgetType) {
case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
{
MozGtkScrollbarMetrics metrics;
@@ -862,17 +862,17 @@ nsNativeThemeGTK::GetWidgetBorder(nsIDev
}
}
return NS_OK;
}
PRBool
nsNativeThemeGTK::GetWidgetPadding(nsIDeviceContext* aContext,
nsIFrame* aFrame, PRUint8 aWidgetType,
- nsIntMargin* aResult)
+ nsMargin* aResult)
{
switch (aWidgetType) {
case NS_THEME_BUTTON_FOCUS:
case NS_THEME_TOOLBAR_BUTTON:
case NS_THEME_TOOLBAR_DUAL_BUTTON:
case NS_THEME_TAB_SCROLLARROW_BACK:
case NS_THEME_TAB_SCROLLARROW_FORWARD:
case NS_THEME_DROPDOWN_BUTTON:
@@ -926,17 +926,17 @@ nsNativeThemeGTK::GetWidgetOverflow(nsID
aOverflowRect->Inflate(m);
return PR_TRUE;
}
NS_IMETHODIMP
nsNativeThemeGTK::GetMinimumWidgetSize(nsIRenderingContext* aContext,
nsIFrame* aFrame, PRUint8 aWidgetType,
- nsIntSize* aResult, PRBool* aIsOverridable)
+ nsSize* aResult, PRBool* aIsOverridable)
{
aResult->width = aResult->height = 0;
*aIsOverridable = PR_TRUE;
switch (aWidgetType) {
case NS_THEME_SCROLLBAR_BUTTON_UP:
case NS_THEME_SCROLLBAR_BUTTON_DOWN:
{
@@ -1082,17 +1082,17 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n
case NS_THEME_TOOLBAR_BUTTON:
case NS_THEME_TREEVIEW_HEADER_CELL:
{
// Just include our border, and let the box code augment the size.
nsCOMPtr<nsIDeviceContext> dc;
aContext->GetDeviceContext(*getter_AddRefs(dc));
- nsIntMargin border;
+ nsMargin border;
nsNativeThemeGTK::GetWidgetBorder(dc, aFrame, aWidgetType, &border);
aResult->width = border.left + border.right;
aResult->height = border.top + border.bottom;
}
break;
case NS_THEME_TOOLBAR_SEPARATOR:
{
gint separator_width;
--- a/widget/src/gtk2/nsNativeThemeGTK.h
+++ b/widget/src/gtk2/nsNativeThemeGTK.h
@@ -55,31 +55,31 @@ public:
// The nsITheme interface.
NS_IMETHOD DrawWidgetBackground(nsIRenderingContext* aContext,
nsIFrame* aFrame, PRUint8 aWidgetType,
const nsRect& aRect,
const nsRect& aDirtyRect);
NS_IMETHOD GetWidgetBorder(nsIDeviceContext* aContext, nsIFrame* aFrame,
- PRUint8 aWidgetType, nsIntMargin* aResult);
+ PRUint8 aWidgetType, nsMargin* aResult);
virtual NS_HIDDEN_(PRBool) GetWidgetPadding(nsIDeviceContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntMargin* aResult);
+ nsMargin* aResult);
virtual NS_HIDDEN_(PRBool) GetWidgetOverflow(nsIDeviceContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
nsRect* aOverflowRect);
NS_IMETHOD GetMinimumWidgetSize(nsIRenderingContext* aContext,
nsIFrame* aFrame, PRUint8 aWidgetType,
- nsIntSize* aResult, PRBool* aIsOverridable);
+ nsSize* aResult, PRBool* aIsOverridable);
NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
nsIAtom* aAttribute, PRBool* aShouldRepaint);
NS_IMETHOD ThemeChanged();
NS_IMETHOD_(PRBool) ThemeSupportsWidget(nsPresContext* aPresContext,
nsIFrame* aFrame,
--- a/widget/src/gtk2/nsPrintSettingsGTK.cpp
+++ b/widget/src/gtk2/nsPrintSettingsGTK.cpp
@@ -606,17 +606,17 @@ nsPrintSettingsGTK::InitUnwriteableMargi
*
* It's important that the following functions pass
* mUnwriteableMargin values rather than aUnwriteableMargin values
* to gtk_page_setup_set_[blank]_margin, because the two may not be
* the same. (Specifically, negative values of aUnwriteableMargin
* are ignored by the nsPrintSettings::SetUnwriteableMargin functions.)
*/
NS_IMETHODIMP
-nsPrintSettingsGTK::SetUnwriteableMarginInTwips(nsIntMargin& aUnwriteableMargin)
+nsPrintSettingsGTK::SetUnwriteableMarginInTwips(nsMargin& aUnwriteableMargin)
{
nsPrintSettings::SetUnwriteableMarginInTwips(aUnwriteableMargin);
gtk_page_setup_set_top_margin(mPageSetup,
NS_TWIPS_TO_INCHES(mUnwriteableMargin.top), GTK_UNIT_INCH);
gtk_page_setup_set_left_margin(mPageSetup,
NS_TWIPS_TO_INCHES(mUnwriteableMargin.left), GTK_UNIT_INCH);
gtk_page_setup_set_bottom_margin(mPageSetup,
NS_TWIPS_TO_INCHES(mUnwriteableMargin.bottom), GTK_UNIT_INCH);
--- a/widget/src/gtk2/nsPrintSettingsGTK.h
+++ b/widget/src/gtk2/nsPrintSettingsGTK.h
@@ -116,17 +116,17 @@ public:
NS_IMETHOD GetScaling(double *aScaling);
NS_IMETHOD SetScaling(double aScaling);
// A name recognised by GTK is strongly advised here, as this is used to create a GtkPaperSize.
NS_IMETHOD GetPaperName(PRUnichar * *aPaperName);
NS_IMETHOD SetPaperName(const PRUnichar * aPaperName);
- NS_IMETHOD SetUnwriteableMarginInTwips(nsIntMargin& aUnwriteableMargin);
+ NS_IMETHOD SetUnwriteableMarginInTwips(nsMargin& aUnwriteableMargin);
NS_IMETHOD SetUnwriteableMarginTop(double aUnwriteableMarginTop);
NS_IMETHOD SetUnwriteableMarginLeft(double aUnwriteableMarginLeft);
NS_IMETHOD SetUnwriteableMarginBottom(double aUnwriteableMarginBottom);
NS_IMETHOD SetUnwriteableMarginRight(double aUnwriteableMarginRight);
NS_IMETHOD GetPaperWidth(double *aPaperWidth);
NS_IMETHOD SetPaperWidth(double aPaperWidth);
--- a/widget/src/gtk2/nsScreenGtk.cpp
+++ b/widget/src/gtk2/nsScreenGtk.cpp
@@ -109,17 +109,17 @@ nsScreenGtk :: GetColorDepth(PRInt32 *aC
void
nsScreenGtk :: Init (GdkWindow *aRootWindow)
{
// We listen for configure events on the root window to pick up
// changes to this rect. We could listen for "size_changed" signals
// on the default screen to do this, except that doesn't work with
// versions of GDK predating the GdkScreen object. See bug 256646.
- mAvailRect = mRect = nsIntRect(0, 0, gdk_screen_width(), gdk_screen_height());
+ mAvailRect = mRect = nsRect(0, 0, gdk_screen_width(), gdk_screen_height());
#ifdef MOZ_X11
// We need to account for the taskbar, etc in the available rect.
// See http://freedesktop.org/Standards/wm-spec/index.html#id2767771
// XXX do we care about _NET_WM_STRUT_PARTIAL? That will
// add much more complexity to the code here (our screen
// could have a non-rectangular shape), but should
@@ -157,18 +157,18 @@ nsScreenGtk :: Init (GdkWindow *aRootWin
if (!gdk_error_trap_pop() &&
type_returned == cardinal_atom &&
length_returned && (length_returned % 4) == 0 &&
format_returned == 32) {
int num_items = length_returned / sizeof(long);
for (int i = 0; i < num_items; i += 4) {
- nsIntRect workarea(workareas[i], workareas[i + 1],
- workareas[i + 2], workareas[i + 3]);
+ nsRect workarea(workareas[i], workareas[i + 1],
+ workareas[i + 2], workareas[i + 3]);
if (!mRect.Contains(workarea)) {
// Note that we hit this when processing screen size changes,
// since we'll get the configure event before the toolbars have
// been moved. We'll end up cleaning this up when we get the
// change notification to the _NET_WORKAREA property. However,
// we still want to listen to both, so we'll handle changes
// properly for desktop environments that don't set the
// _NET_WORKAREA property.
@@ -182,16 +182,16 @@ nsScreenGtk :: Init (GdkWindow *aRootWin
g_free (workareas);
#endif
}
#ifdef MOZ_X11
void
nsScreenGtk :: Init (XineramaScreenInfo *aScreenInfo)
{
- nsIntRect xineRect(aScreenInfo->x_org, aScreenInfo->y_org,
- aScreenInfo->width, aScreenInfo->height);
+ nsRect xineRect(aScreenInfo->x_org, aScreenInfo->y_org,
+ aScreenInfo->width, aScreenInfo->height);
mScreenNum = aScreenInfo->screen_number;
mAvailRect = mRect = xineRect;
}
#endif
--- a/widget/src/gtk2/nsScreenGtk.h
+++ b/widget/src/gtk2/nsScreenGtk.h
@@ -67,13 +67,13 @@ public:
void Init(GdkWindow *aRootWindow);
#ifdef MOZ_X11
void Init(XineramaScreenInfo *aScreenInfo);
#endif /* MOZ_X11 */
private:
PRUint32 mScreenNum;
- nsIntRect mRect;
- nsIntRect mAvailRect;
+ nsRect mRect; // in pixels, not twips
+ nsRect mAvailRect; // in pixels, not twips
};
#endif // nsScreenGtk_h___
--- a/widget/src/gtk2/nsScreenManagerGtk.cpp
+++ b/widget/src/gtk2/nsScreenManagerGtk.cpp
@@ -252,17 +252,17 @@ nsScreenManagerGtk :: Init()
//
// ScreenForRect
//
// Returns the screen that contains the rectangle. If the rect overlaps
// multiple screens, it picks the screen with the greatest area of intersection.
//
-// The coordinates are in pixels (not app units) and in screen coordinates.
+// The coordinates are in pixels (not twips) and in screen coordinates.
//
NS_IMETHODIMP
nsScreenManagerGtk :: ScreenForRect ( PRInt32 aX, PRInt32 aY,
PRInt32 aWidth, PRInt32 aHeight,
nsIScreen **aOutScreen )
{
nsresult rv;
rv = EnsureInit();
@@ -274,23 +274,23 @@ nsScreenManagerGtk :: ScreenForRect ( PR
PRUint32 which = 0;
// Optimize for the common case. If the number of screens is only
// one then this will fall through with which == 0 and will get the
// primary screen.
if (mCachedScreenArray.Count() > 1) {
// walk the list of screens and find the one that has the most
// surface area.
PRUint32 area = 0;
- nsIntRect windowRect(aX, aY, aWidth, aHeight);
+ nsRect windowRect(aX, aY, aWidth, aHeight);
for (PRInt32 i = 0, i_end = mCachedScreenArray.Count(); i < i_end; ++i) {
PRInt32 x, y, width, height;
x = y = width = height = 0;
mCachedScreenArray[i]->GetRect(&x, &y, &width, &height);
// calculate the surface area
- nsIntRect screenRect(x, y, width, height);
+ nsRect screenRect(x, y, width, height);
screenRect.IntersectRect(screenRect, windowRect);
PRUint32 tempArea = screenRect.width * screenRect.height;
if (tempArea >= area) {
which = i;
area = tempArea;
}
}
}
--- a/widget/src/gtk2/nsWindow.cpp
+++ b/widget/src/gtk2/nsWindow.cpp
@@ -460,31 +460,31 @@ nsWindow::ReleaseGlobals()
}
}
NS_IMPL_ISUPPORTS_INHERITED1(nsWindow, nsCommonWidget,
nsISupportsWeakReference)
NS_IMETHODIMP
nsWindow::Create(nsIWidget *aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData)
{
nsresult rv = NativeCreate(aParent, nsnull, aRect, aHandleEventFunction,
aContext, aAppShell, aToolkit, aInitData);
return rv;
}
NS_IMETHODIMP
nsWindow::Create(nsNativeWidget aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData)
{
nsresult rv = NativeCreate(nsnull, aParent, aRect, aHandleEventFunction,
aContext, aAppShell, aToolkit, aInitData);
@@ -989,19 +989,19 @@ nsWindow::SetFocus(PRBool aRaise)
LOGFOCUS((" done dispatching events in SetFocus() [%p]\n",
(void *)this));
return NS_OK;
}
NS_IMETHODIMP
-nsWindow::GetScreenBounds(nsIntRect &aRect)
-{
- nsIntRect origin(0, 0, mBounds.width, mBounds.height);
+nsWindow::GetScreenBounds(nsRect &aRect)
+{
+ nsRect origin(0, 0, mBounds.width, mBounds.height);
WidgetToScreen(origin, aRect);
LOG(("GetScreenBounds %d %d | %d %d | %d %d\n",
aRect.x, aRect.y,
mBounds.width, mBounds.height,
aRect.width, aRect.height));
return NS_OK;
}
@@ -1259,18 +1259,18 @@ nsWindow::Invalidate(PRBool aIsSynchrono
&rect, FALSE);
if (aIsSynchronous)
gdk_window_process_updates(mDrawingarea->inner_window, FALSE);
return NS_OK;
}
NS_IMETHODIMP
-nsWindow::Invalidate(const nsIntRect &aRect,
- PRBool aIsSynchronous)
+nsWindow::Invalidate(const nsRect &aRect,
+ PRBool aIsSynchronous)
{
GdkRectangle rect;
rect.x = aRect.x;
rect.y = aRect.y;
rect.width = aRect.width;
rect.height = aRect.height;
@@ -1326,35 +1326,35 @@ nsWindow::Update()
NS_IMETHODIMP
nsWindow::SetColorMap(nsColorMap *aColorMap)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
-nsWindow::Scroll(PRInt32 aDx,
- PRInt32 aDy,
- nsIntRect *aClipRect)
+nsWindow::Scroll(PRInt32 aDx,
+ PRInt32 aDy,
+ nsRect *aClipRect)
{
if (!mDrawingarea)
return NS_OK;
D_DEBUG_AT( ns_Window, "%s( %4d,%4d )\n", __FUNCTION__, aDx, aDy );
if (aClipRect) {
D_DEBUG_AT( ns_Window, " -> aClipRect: %4d,%4d-%4dx%4d\n",
aClipRect->x, aClipRect->y, aClipRect->width, aClipRect->height );
}
moz_drawingarea_scroll(mDrawingarea, aDx, aDy);
// Update bounds on our child windows
for (nsIWidget* kid = mFirstChild; kid; kid = kid->GetNextSibling()) {
- nsIntRect bounds;
+ nsRect bounds;
kid->GetBounds(bounds);
bounds.x += aDx;
bounds.y += aDy;
static_cast<nsBaseWidget*>(kid)->SetBounds(bounds);
}
// Process all updates so that everything is drawn.
gdk_window_process_all_updates();
@@ -1368,19 +1368,19 @@ nsWindow::ScrollWidgets(PRInt32 aDx,
if (!mDrawingarea)
return NS_OK;
moz_drawingarea_scroll(mDrawingarea, aDx, aDy);
return NS_OK;
}
NS_IMETHODIMP
-nsWindow::ScrollRect(nsIntRect &aSrcRect,
- PRInt32 aDx,
- PRInt32 aDy)
+nsWindow::ScrollRect(nsRect &aSrcRect,
+ PRInt32 aDx,
+ PRInt32 aDy)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
void*
nsWindow::GetNativeData(PRUint32 aDataType)
{
switch (aDataType) {
@@ -1495,17 +1495,17 @@ nsWindow::SetMenuBar(void * aMenuBar)
NS_IMETHODIMP
nsWindow::ShowMenuBar(PRBool aShow)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
-nsWindow::WidgetToScreen(const nsIntRect& aOldRect, nsIntRect& aNewRect)
+nsWindow::WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect)
{
gint x = 0, y = 0;
if (mContainer) {
gdk_window_get_root_origin(GTK_WIDGET(mContainer)->window,
&x, &y);
LOG(("WidgetToScreen (container) %d %d\n", x, y));
}
@@ -1518,17 +1518,17 @@ nsWindow::WidgetToScreen(const nsIntRect
aNewRect.y = y + aOldRect.y;
aNewRect.width = aOldRect.width;
aNewRect.height = aOldRect.height;
return NS_OK;
}
NS_IMETHODIMP
-nsWindow::ScreenToWidget(const nsIntRect& aOldRect, nsIntRect& aNewRect)
+nsWindow::ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect)
{
gint x = 0, y = 0;
if (mContainer) {
gdk_window_get_root_origin(GTK_WIDGET(mContainer)->window,
&x, &y);
}
else if (mDrawingarea) {
@@ -1890,17 +1890,17 @@ nsWindow::OnExposeEvent(GtkWidget *aWidg
} else {
// global's big enough, just use it
bufferPixmap = gBufferPixmap;
bufferPixmapSize = gBufferPixmapSize;
}
if (bufferPixmap) {
bufferPixmapSurface = GetSurfaceForGdkDrawable(GDK_DRAWABLE(bufferPixmap),
- nsIntSize(bufferPixmapSize.width, bufferPixmapSize.height));
+ nsSize(bufferPixmapSize.width, bufferPixmapSize.height));
if (bufferPixmapSurface && bufferPixmapSurface->CairoStatus()) {
bufferPixmapSurface = nsnull;
}
if (bufferPixmapSurface) {
gfxPlatformGtk::GetPlatform()->SetGdkDrawable(
static_cast<gfxASurface *>(bufferPixmapSurface),
GDK_DRAWABLE(bufferPixmap));
@@ -1964,18 +1964,18 @@ nsWindow::OnExposeEvent(GtkWidget *aWidg
nsRefPtr<gfxContext> imgCtx = new gfxContext(img);
if (imgCtx) {
imgCtx->SetPattern(pattern);
imgCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
imgCtx->Paint();
}
- UpdateTranslucentWindowAlphaInternal(nsIntRect(boundsRect.x, boundsRect.y,
- boundsRect.width, boundsRect.height),
+ UpdateTranslucentWindowAlphaInternal(nsRect(boundsRect.x, boundsRect.y,
+ boundsRect.width, boundsRect.height),
img->Data(), img->Stride());
}
} else {
if (bufferPixmapSurface) {
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
ctx->SetSource(bufferPixmapSurface);
ctx->Paint();
}
@@ -2016,17 +2016,17 @@ nsWindow::OnConfigureEvent(GtkWidget *aW
return FALSE;
// Toplevel windows need to have their bounds set so that we can
// keep track of our location. It's not often that the x,y is set
// by the layout engine. Width and height are set elsewhere.
if (mIsTopLevel) {
mPlaced = PR_TRUE;
// Need to translate this into the right coordinates
- nsIntRect oldrect, newrect;
+ nsRect oldrect, newrect;
WidgetToScreen(oldrect, newrect);
mBounds.x = newrect.x;
mBounds.y = newrect.y;
}
nsGUIEvent event(PR_TRUE, NS_MOVE, this);
event.refPoint.x = aEvent->x;
@@ -2042,18 +2042,18 @@ nsWindow::OnConfigureEvent(GtkWidget *aW
void
nsWindow::OnSizeAllocate(GtkWidget *aWidget, GtkAllocation *aAllocation)
{
LOG(("size_allocate [%p] %d %d %d %d\n",
(void *)this, aAllocation->x, aAllocation->y,
aAllocation->width, aAllocation->height));
- nsIntRect rect(aAllocation->x, aAllocation->y,
- aAllocation->width, aAllocation->height);
+ nsRect rect(aAllocation->x, aAllocation->y,
+ aAllocation->width, aAllocation->height);
ResizeTransparencyBitmap(rect.width, rect.height);
mBounds.width = rect.width;
mBounds.height = rect.height;
if (!mDrawingarea)
return;
@@ -2251,18 +2251,18 @@ nsWindow::OnMotionNotifyEvent(GtkWidget
#endif /* MOZ_X11 */
}
else {
// XXX see OnScrollEvent()
if (aEvent->window == mDrawingarea->inner_window) {
event.refPoint.x = nscoord(aEvent->x);
event.refPoint.y = nscoord(aEvent->y);
} else {
- nsIntRect windowRect;
- ScreenToWidget(nsIntRect(NSToIntFloor(aEvent->x_root), NSToIntFloor(aEvent->y_root), 1, 1), windowRect);
+ nsRect windowRect;
+ ScreenToWidget(nsRect(nscoord(aEvent->x_root), nscoord(aEvent->y_root), 1, 1), windowRect);
event.refPoint.x = windowRect.x;
event.refPoint.y = windowRect.y;
}
event.isShift = (aEvent->state & GDK_SHIFT_MASK)
? PR_TRUE : PR_FALSE;
event.isControl = (aEvent->state & GDK_CONTROL_MASK)
@@ -2282,18 +2282,18 @@ void
nsWindow::InitButtonEvent(nsMouseEvent &aEvent,
GdkEventButton *aGdkEvent)
{
// XXX see OnScrollEvent()
if (aGdkEvent->window == mDrawingarea->inner_window) {
aEvent.refPoint.x = nscoord(aGdkEvent->x);
aEvent.refPoint.y = nscoord(aGdkEvent->y);
} else {
- nsIntRect windowRect;
- ScreenToWidget(nsIntRect(NSToIntFloor(aGdkEvent->x_root), NSToIntFloor(aGdkEvent->y_root), 1, 1), windowRect);
+ nsRect windowRect;
+ ScreenToWidget(nsRect(nscoord(aGdkEvent->x_root), nscoord(aGdkEvent->y_root), 1, 1), windowRect);
aEvent.refPoint.x = windowRect.x;
aEvent.refPoint.y = windowRect.y;
}
aEvent.isShift = (aGdkEvent->state & GDK_SHIFT_MASK) != 0;
aEvent.isControl = (aGdkEvent->state & GDK_CONTROL_MASK) != 0;
aEvent.isAlt = (aGdkEvent->state & GDK_MOD1_MASK) != 0;
@@ -2833,18 +2833,18 @@ nsWindow::OnScrollEvent(GtkWidget *aWidg
if (aEvent->window == mDrawingarea->inner_window) {
// we are the window that the event happened on so no need for expensive ScreenToWidget
event.refPoint.x = nscoord(aEvent->x);
event.refPoint.y = nscoord(aEvent->y);
} else {
// XXX we're never quite sure which GdkWindow the event came from due to our custom bubbling
// in scroll_event_cb(), so use ScreenToWidget to translate the screen root coordinates into
// coordinates relative to this widget.
- nsIntRect windowRect;
- ScreenToWidget(nsIntRect(NSToIntFloor(aEvent->x_root), NSToIntFloor(aEvent->y_root), 1, 1), windowRect);
+ nsRect windowRect;
+ ScreenToWidget(nsRect(nscoord(aEvent->x_root), nscoord(aEvent->y_root), 1, 1), windowRect);
event.refPoint.x = windowRect.x;
event.refPoint.y = windowRect.y;
}
event.isShift = (aEvent->state & GDK_SHIFT_MASK) != 0;
event.isControl = (aEvent->state & GDK_CONTROL_MASK) != 0;
event.isAlt = (aEvent->state & GDK_MOD1_MASK) != 0;
@@ -3271,17 +3271,17 @@ GetBrandName(nsXPIDLString& brandName)
if (brandName.IsEmpty())
brandName.Assign(NS_LITERAL_STRING("Mozilla"));
}
nsresult
nsWindow::NativeCreate(nsIWidget *aParent,
nsNativeWidget aNativeParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData)
{
// only set the base parent if we're going to be a dialog or a
// toplevel
@@ -3892,20 +3892,20 @@ nsWindow::NativeShow (PRBool aAction)
moz_drawingarea_set_visibility(mDrawingarea, FALSE);
}
if (mDrawingarea) {
moz_drawingarea_set_visibility(mDrawingarea, FALSE);
}
}
}
-nsIntSize
-nsWindow::GetSafeWindowSize(const nsIntSize &aSize)
-{
- nsIntSize result = aSize;
+nsSize
+nsWindow::GetSafeWindowSize(nsSize aSize)
+{
+ nsSize result = aSize;
const PRInt32 kInt16Max = 32767;
if (result.width > kInt16Max) {
NS_WARNING("Clamping huge window width");
result.width = kInt16Max;
}
if (result.height > kInt16Max) {
NS_WARNING("Clamping huge window height");
result.height = kInt16Max;
@@ -4021,17 +4021,17 @@ nsWindow::ResizeTransparencyBitmap(PRInt
delete[] mTransparencyBitmap;
mTransparencyBitmap = newBits;
mTransparencyBitmapWidth = aNewWidth;
mTransparencyBitmapHeight = aNewHeight;
}
static PRBool
ChangedMaskBits(gchar* aMaskBits, PRInt32 aMaskWidth, PRInt32 aMaskHeight,
- const nsIntRect& aRect, PRUint8* aAlphas, PRInt32 aStride)
+ const nsRect& aRect, PRUint8* aAlphas, PRInt32 aStride)
{
PRInt32 x, y, xMax = aRect.XMost(), yMax = aRect.YMost();
PRInt32 maskBytesPerRow = (aMaskWidth + 7)/8;
for (y = aRect.y; y < yMax; y++) {
gchar* maskBytes = aMaskBits + y*maskBytesPerRow;
PRUint8* alphas = aAlphas;
for (x = aRect.x; x < xMax; x++) {
PRBool newBit = *alphas > 0;
@@ -4047,17 +4047,17 @@ ChangedMaskBits(gchar* aMaskBits, PRInt3
aAlphas += aStride;
}
return PR_FALSE;
}
static
void UpdateMaskBits(gchar* aMaskBits, PRInt32 aMaskWidth, PRInt32 aMaskHeight,
- const nsIntRect& aRect, PRUint8* aAlphas, PRInt32 aStride)
+ const nsRect& aRect, PRUint8* aAlphas, PRInt32 aStride)
{
PRInt32 x, y, xMax = aRect.XMost(), yMax = aRect.YMost();
PRInt32 maskBytesPerRow = (aMaskWidth + 7)/8;
for (y = aRect.y; y < yMax; y++) {
gchar* maskBytes = aMaskBits + y*maskBytesPerRow;
PRUint8* alphas = aAlphas;
for (x = aRect.x; x < xMax; x++) {
PRBool newBit = *alphas > 0;
@@ -4082,17 +4082,17 @@ nsWindow::ApplyTransparencyBitmap()
if (!maskBitmap)
return;
gtk_widget_shape_combine_mask(mShell, maskBitmap, 0, 0);
gdk_bitmap_unref(maskBitmap);
}
nsresult
-nsWindow::UpdateTranslucentWindowAlphaInternal(const nsIntRect& aRect,
+nsWindow::UpdateTranslucentWindowAlphaInternal(const nsRect& aRect,
PRUint8* aAlphas, PRInt32 aStride)
{
if (!mShell) {
// Pass the request to the toplevel window
GtkWidget *topWidget = nsnull;
GetToplevelWidget(&topWidget);
if (!topWidget)
return NS_ERROR_FAILURE;
@@ -5502,17 +5502,17 @@ is_context_menu_key(const nsKeyEvent& aK
(aKeyEvent.keyCode == NS_VK_CONTEXT_MENU && !aKeyEvent.isShift &&
!aKeyEvent.isControl && !aKeyEvent.isMeta && !aKeyEvent.isAlt));
}
void
key_event_to_context_menu_event(nsMouseEvent &aEvent,
GdkEventKey *aGdkEvent)
{
- aEvent.refPoint = nsIntPoint(0, 0);
+ aEvent.refPoint = nsPoint(0, 0);
aEvent.isShift = PR_FALSE;
aEvent.isControl = PR_FALSE;
aEvent.isAlt = PR_FALSE;
aEvent.isMeta = PR_FALSE;
aEvent.time = aGdkEvent->time;
aEvent.clickCount = 1;
}
@@ -6571,17 +6571,17 @@ IM_get_input_context(nsWindow *aWindow)
return data->mDummyContext;
}
#endif
#ifdef MOZ_X11
/* static */ already_AddRefed<gfxASurface>
nsWindow::GetSurfaceForGdkDrawable(GdkDrawable* aDrawable,
- const nsIntSize& aSize)
+ const nsSize& aSize)
{
GdkVisual* visual = gdk_drawable_get_visual(aDrawable);
Display* xDisplay = gdk_x11_drawable_get_xdisplay(aDrawable);
Drawable xDrawable = gdk_x11_drawable_get_xid(aDrawable);
gfxASurface* result = nsnull;
if (visual) {
--- a/widget/src/gtk2/nsWindow.h
+++ b/widget/src/gtk2/nsWindow.h
@@ -82,24 +82,24 @@ public:
virtual ~nsWindow();
static void ReleaseGlobals();
NS_DECL_ISUPPORTS_INHERITED
// nsIWidget
NS_IMETHOD Create(nsIWidget *aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData);
NS_IMETHOD Create(nsNativeWidget aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData);
NS_IMETHOD Destroy(void);
NS_IMETHOD SetParent(nsIWidget* aNewParent);
NS_IMETHOD SetModal(PRBool aModal);
@@ -111,49 +111,49 @@ public:
PRInt32 aY);
NS_IMETHOD PlaceBehind(nsTopLevelWidgetZPlacement aPlacement,
nsIWidget *aWidget,
PRBool aActivate);
NS_IMETHOD SetZIndex(PRInt32 aZIndex);
NS_IMETHOD SetSizeMode(PRInt32 aMode);
NS_IMETHOD Enable(PRBool aState);
NS_IMETHOD SetFocus(PRBool aRaise = PR_FALSE);
- NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
+ NS_IMETHOD GetScreenBounds(nsRect &aRect);
NS_IMETHOD SetForegroundColor(const nscolor &aColor);
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
NS_IMETHOD SetCursor(nsCursor aCursor);
NS_IMETHOD SetCursor(imgIContainer* aCursor,
PRUint32 aHotspotX, PRUint32 aHotspotY);
NS_IMETHOD Validate();
NS_IMETHOD Invalidate(PRBool aIsSynchronous);
- NS_IMETHOD Invalidate(const nsIntRect &aRect,
- PRBool aIsSynchronous);
+ NS_IMETHOD Invalidate(const nsRect &aRect,
+ PRBool aIsSynchronous);
NS_IMETHOD InvalidateRegion(const nsIRegion *aRegion,
PRBool aIsSynchronous);
NS_IMETHOD Update();
NS_IMETHOD SetColorMap(nsColorMap *aColorMap);
- NS_IMETHOD Scroll(PRInt32 aDx,
- PRInt32 aDy,
- nsIntRect *aClipRect);
+ NS_IMETHOD Scroll(PRInt32 aDx,
+ PRInt32 aDy,
+ nsRect *aClipRect);
NS_IMETHOD ScrollWidgets(PRInt32 aDx,
PRInt32 aDy);
- NS_IMETHOD ScrollRect(nsIntRect &aSrcRect,
- PRInt32 aDx,
- PRInt32 aDy);
+ NS_IMETHOD ScrollRect(nsRect &aSrcRect,
+ PRInt32 aDx,
+ PRInt32 aDy);
virtual void* GetNativeData(PRUint32 aDataType);
NS_IMETHOD SetBorderStyle(nsBorderStyle aBorderStyle);
NS_IMETHOD SetTitle(const nsAString& aTitle);
NS_IMETHOD SetIcon(const nsAString& aIconSpec);
NS_IMETHOD SetWindowClass(const nsAString& xulWinType);
NS_IMETHOD SetMenuBar(void * aMenuBar);
NS_IMETHOD ShowMenuBar(PRBool aShow);
- NS_IMETHOD WidgetToScreen(const nsIntRect& aOldRect,
- nsIntRect& aNewRect);
- NS_IMETHOD ScreenToWidget(const nsIntRect& aOldRect,
- nsIntRect& aNewRect);
+ NS_IMETHOD WidgetToScreen(const nsRect& aOldRect,
+ nsRect& aNewRect);
+ NS_IMETHOD ScreenToWidget(const nsRect& aOldRect,
+ nsRect& aNewRect);
NS_IMETHOD BeginResizingChildren(void);
NS_IMETHOD EndResizingChildren(void);
NS_IMETHOD EnableDragDrop(PRBool aEnable);
virtual void ConvertToDeviceCoordinates(nscoord &aX,
nscoord &aY);
NS_IMETHOD PreCreateWidget(nsWidgetInitData *aWidgetInitData);
NS_IMETHOD CaptureMouse(PRBool aCapture);
NS_IMETHOD CaptureRollupEvents(nsIRollupListener *aListener,
@@ -225,17 +225,17 @@ public:
guint aTime,
gpointer aData);
void OnDragLeave(void);
void OnDragEnter(nscoord aX, nscoord aY);
nsresult NativeCreate(nsIWidget *aParent,
nsNativeWidget aNativeParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData);
void NativeResize(PRInt32 aWidth,
PRInt32 aHeight,
@@ -243,17 +243,17 @@ public:
void NativeResize(PRInt32 aX,
PRInt32 aY,
PRInt32 aWidth,
PRInt32 aHeight,
PRBool aRepaint);
void NativeShow (PRBool aAction);
- virtual nsIntSize GetSafeWindowSize(const nsIntSize &aSize);
+ virtual nsSize GetSafeWindowSize(nsSize aSize);
void EnsureGrabs (void);
void GrabPointer (void);
void GrabKeyboard (void);
void ReleaseGrabs (void);
enum PluginType {
PluginType_NONE = 0, /* do not have any plugin */
@@ -363,23 +363,23 @@ public:
NS_IMETHOD GetToggledKeyState(PRUint32 aKeyCode, PRBool* aLEDState);
#endif
void ResizeTransparencyBitmap(PRInt32 aNewWidth, PRInt32 aNewHeight);
void ApplyTransparencyBitmap();
virtual void SetTransparencyMode(nsTransparencyMode aMode);
virtual nsTransparencyMode GetTransparencyMode();
- nsresult UpdateTranslucentWindowAlphaInternal(const nsIntRect& aRect,
+ nsresult UpdateTranslucentWindowAlphaInternal(const nsRect& aRect,
PRUint8* aAlphas, PRInt32 aStride);
gfxASurface *GetThebesSurface();
static already_AddRefed<gfxASurface> GetSurfaceForGdkDrawable(GdkDrawable* aDrawable,
- const nsIntSize& aSize);
+ const nsSize& aSize);
#ifdef ACCESSIBILITY
static PRBool sAccessibilityEnabled;
#endif
private:
void GetToplevelWidget(GtkWidget **aWidget);
GtkWidget *GetMozContainerWidget();
--- a/widget/src/windows/nsDragService.cpp
+++ b/widget/src/windows/nsDragService.cpp
@@ -104,17 +104,17 @@ nsDragService::CreateDragImage(nsIDOMNod
if (!psdi)
return PR_FALSE;
memset(psdi, 0, sizeof(SHDRAGIMAGE));
if (!aDOMNode)
return PR_FALSE;
// Prepare the drag image
- nsIntRect dragRect;
+ nsRect dragRect;
nsRefPtr<gfxASurface> surface;
nsPresContext* pc;
DrawDrag(aDOMNode, aRegion,
mScreenX, mScreenY,
&dragRect, getter_AddRefs(surface), &pc);
if (!surface)
return PR_FALSE;
--- a/widget/src/windows/nsNativeThemeWin.cpp
+++ b/widget/src/windows/nsNativeThemeWin.cpp
@@ -93,17 +93,17 @@ nsNativeThemeWin::nsNativeThemeWin() {
// static widget style variables (e.g. sButtonBorderSize) should be
// reinitialized here.
}
nsNativeThemeWin::~nsNativeThemeWin() {
nsUXThemeData::Invalidate();
}
-static void GetNativeRect(const nsIntRect& aSrc, RECT& aDst)
+static void GetNativeRect(const nsRect& aSrc, RECT& aDst)
{
aDst.top = aSrc.y;
aDst.bottom = aSrc.y + aSrc.height;
aDst.left = aSrc.x;
aDst.right = aSrc.x + aSrc.width;
}
static PRBool IsTopLevelMenu(nsIFrame *aFrame)
@@ -1181,17 +1181,17 @@ RENDER_AGAIN:
return NS_OK;
}
NS_IMETHODIMP
nsNativeThemeWin::GetWidgetBorder(nsIDeviceContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntMargin* aResult)
+ nsMargin* aResult)
{
HANDLE theme = GetTheme(aWidgetType);
if (!theme)
return ClassicGetWidgetBorder(aContext, aFrame, aWidgetType, aResult);
(*aResult).top = (*aResult).bottom = (*aResult).left = (*aResult).right = 0;
if (!WidgetIsContainer(aWidgetType) ||
@@ -1230,17 +1230,17 @@ nsNativeThemeWin::GetWidgetBorder(nsIDev
outerRect.right = outerRect.bottom = 200;
RECT contentRect(outerRect);
HRESULT res = nsUXThemeData::getThemeContentRect(theme, NULL, part, state, &outerRect, &contentRect);
if (FAILED(res))
return NS_ERROR_FAILURE;
// Now compute the delta in each direction and place it in our
- // nsIntMargin struct.
+ // nsMargin struct.
aResult->top = contentRect.top - outerRect.top;
aResult->bottom = outerRect.bottom - contentRect.bottom;
aResult->left = contentRect.left - outerRect.left;
aResult->right = outerRect.right - contentRect.right;
// Remove the edges for tabs that are before or after the selected tab,
if (aWidgetType == NS_THEME_TAB_LEFT_EDGE)
// Remove the right edge, since we won't be drawing it.
@@ -1263,17 +1263,17 @@ nsNativeThemeWin::GetWidgetBorder(nsIDev
return NS_OK;
}
PRBool
nsNativeThemeWin::GetWidgetPadding(nsIDeviceContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntMargin* aResult)
+ nsMargin* aResult)
{
switch (aWidgetType) {
// Radios and checkboxes return a fixed size in GetMinimumWidgetSize
// and have a meaningful baseline, so they can't have
// author-specified padding.
case NS_THEME_CHECKBOX:
case NS_THEME_CHECKBOX_SMALL:
case NS_THEME_RADIO:
@@ -1409,17 +1409,17 @@ nsNativeThemeWin::GetWidgetOverflow(nsID
#endif
return PR_FALSE;
}
NS_IMETHODIMP
nsNativeThemeWin::GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntSize* aResult, PRBool* aIsOverridable)
+ nsSize* aResult, PRBool* aIsOverridable)
{
(*aResult).width = (*aResult).height = 0;
*aIsOverridable = PR_TRUE;
HANDLE theme = GetTheme(aWidgetType);
if (!theme)
return ClassicGetMinimumWidgetSize(aContext, aFrame, aWidgetType, aResult, aIsOverridable);
@@ -1738,17 +1738,17 @@ nsNativeThemeWin::ClassicThemeSupportsWi
}
return PR_FALSE;
}
nsresult
nsNativeThemeWin::ClassicGetWidgetBorder(nsIDeviceContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntMargin* aResult)
+ nsMargin* aResult)
{
switch (aWidgetType) {
case NS_THEME_BUTTON:
(*aResult).top = (*aResult).left = (*aResult).bottom = (*aResult).right = 2;
break;
case NS_THEME_STATUSBAR:
(*aResult).bottom = (*aResult).left = (*aResult).right = 0;
(*aResult).top = 2;
@@ -1817,17 +1817,17 @@ nsNativeThemeWin::ClassicGetWidgetBorder
break;
}
return NS_OK;
}
nsresult
nsNativeThemeWin::ClassicGetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntSize* aResult, PRBool* aIsOverridable)
+ nsSize* aResult, PRBool* aIsOverridable)
{
(*aResult).width = (*aResult).height = 0;
*aIsOverridable = PR_TRUE;
switch (aWidgetType) {
case NS_THEME_RADIO:
case NS_THEME_RADIO_SMALL:
case NS_THEME_CHECKBOX:
case NS_THEME_CHECKBOX_SMALL:
--- a/widget/src/windows/nsNativeThemeWin.h
+++ b/widget/src/windows/nsNativeThemeWin.h
@@ -38,49 +38,46 @@
* ***** END LICENSE BLOCK ***** */
#include "nsITheme.h"
#include "nsCOMPtr.h"
#include "nsIAtom.h"
#include "nsNativeTheme.h"
#include <windows.h>
-struct nsIntRect;
-struct nsIntSize;
-
class nsNativeThemeWin : private nsNativeTheme,
public nsITheme {
public:
NS_DECL_ISUPPORTS
// The nsITheme interface.
NS_IMETHOD DrawWidgetBackground(nsIRenderingContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
const nsRect& aRect,
const nsRect& aDirtyRect);
NS_IMETHOD GetWidgetBorder(nsIDeviceContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntMargin* aResult);
+ nsMargin* aResult);
virtual PRBool GetWidgetPadding(nsIDeviceContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntMargin* aResult);
+ nsMargin* aResult);
virtual PRBool GetWidgetOverflow(nsIDeviceContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
nsRect* aOverflowRect);
NS_IMETHOD GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntSize* aResult,
+ nsSize* aResult,
PRBool* aIsOverridable);
NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
nsIAtom* aAttribute, PRBool* aShouldRepaint);
NS_IMETHOD ThemeChanged();
PRBool ThemeSupportsWidget(nsPresContext* aPresContext,
@@ -105,21 +102,21 @@ protected:
nsresult ClassicDrawWidgetBackground(nsIRenderingContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
const nsRect& aRect,
const nsRect& aClipRect);
nsresult ClassicGetWidgetBorder(nsIDeviceContext* aContext,
nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntMargin* aResult);
+ nsMargin* aResult);
nsresult ClassicGetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame* aFrame,
PRUint8 aWidgetType,
- nsIntSize* aResult,
+ nsSize* aResult,
PRBool* aIsOverridable);
PRBool ClassicThemeSupportsWidget(nsPresContext* aPresContext,
nsIFrame* aFrame,
PRUint8 aWidgetType);
void DrawCheckedRect(HDC hdc, const RECT& rc, PRInt32 fore, PRInt32 back,
HBRUSH defaultBack);
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -815,30 +815,30 @@ NS_METHOD nsWindow::EndResizingChildren(
{
if (NULL != mDeferredPositioner) {
::EndDeferWindowPos(mDeferredPositioner);
mDeferredPositioner = NULL;
}
return NS_OK;
}
-NS_METHOD nsWindow::WidgetToScreen(const nsIntRect& aOldRect, nsIntRect& aNewRect)
+NS_METHOD nsWindow::WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect)
{
POINT point;
point.x = aOldRect.x;
point.y = aOldRect.y;
::ClientToScreen(mWnd, &point);
aNewRect.x = point.x;
aNewRect.y = point.y;
aNewRect.width = aOldRect.width;
aNewRect.height = aOldRect.height;
return NS_OK;
}
-NS_METHOD nsWindow::ScreenToWidget(const nsIntRect& aOldRect, nsIntRect& aNewRect)
+NS_METHOD nsWindow::ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect)
{
POINT point;
point.x = aOldRect.x;
point.y = aOldRect.y;
::ScreenToClient(mWnd, &point);
aNewRect.x = point.x;
aNewRect.y = point.y;
aNewRect.width = aOldRect.width;
@@ -864,20 +864,20 @@ LPARAM nsWindow::lParamToClient(LPARAM l
return MAKELPARAM(pt.x, pt.y);
}
//-------------------------------------------------------------------------
//
// Initialize an event to dispatch
//
//-------------------------------------------------------------------------
-void nsWindow::InitEvent(nsGUIEvent& event, nsIntPoint* aPoint)
+void nsWindow::InitEvent(nsGUIEvent& event, nsPoint* aPoint)
{
if (nsnull == aPoint) { // use the point from the event
- // get the message position in client coordinates
+ // get the message position in client coordinates and in twips
if (mWnd != NULL) {
DWORD pos = ::GetMessagePos();
POINT cpos;
cpos.x = GET_X_LPARAM(pos);
cpos.y = GET_Y_LPARAM(pos);
@@ -1194,17 +1194,17 @@ LRESULT CALLBACK nsWindow::DefaultWindow
//-------------------------------------------------------------------------
//
// Utility method for implementing both Create(nsIWidget ...) and
// Create(nsNativeWidget...)
//-------------------------------------------------------------------------
nsresult
nsWindow::StandardWindowCreate(nsIWidget *aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData,
nsNativeWidget aNativeParent)
{
nsIWidget *baseParent = aInitData &&
@@ -1358,17 +1358,17 @@ nsWindow::StandardWindowCreate(nsIWidget
}
//-------------------------------------------------------------------------
//
// Create the proper widget
//
//-------------------------------------------------------------------------
NS_METHOD nsWindow::Create(nsIWidget *aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData)
{
if (aInitData)
mUnicodeWidget = aInitData->mUnicode;
@@ -1380,17 +1380,17 @@ NS_METHOD nsWindow::Create(nsIWidget *aP
//-------------------------------------------------------------------------
//
// create with a native parent
//
//-------------------------------------------------------------------------
NS_METHOD nsWindow::Create(nsNativeWidget aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData)
{
if (aInitData)
mUnicodeWidget = aInitData->mUnicode;
@@ -2126,17 +2126,17 @@ NS_METHOD nsWindow::SetFocus(PRBool aRai
}
//-------------------------------------------------------------------------
//
// Get this component dimension
//
//-------------------------------------------------------------------------
-NS_METHOD nsWindow::GetBounds(nsIntRect &aRect)
+NS_METHOD nsWindow::GetBounds(nsRect &aRect)
{
if (mWnd) {
RECT r;
VERIFY(::GetWindowRect(mWnd, &r));
// assign size
aRect.width = r.right - r.left;
aRect.height = r.bottom - r.top;
@@ -2158,17 +2158,17 @@ NS_METHOD nsWindow::GetBounds(nsIntRect
return NS_OK;
}
//-------------------------------------------------------------------------
//
// Get this component dimension
//
//-------------------------------------------------------------------------
-NS_METHOD nsWindow::GetClientBounds(nsIntRect &aRect)
+NS_METHOD nsWindow::GetClientBounds(nsRect &aRect)
{
if (mWnd) {
RECT r;
VERIFY(::GetClientRect(mWnd, &r));
// assign size
aRect.x = 0;
aRect.y = 0;
@@ -2178,17 +2178,17 @@ NS_METHOD nsWindow::GetClientBounds(nsIn
} else {
aRect.SetRect(0,0,0,0);
}
return NS_OK;
}
//get the bounds, but don't take into account the client size
-void nsWindow::GetNonClientBounds(nsIntRect &aRect)
+void nsWindow::GetNonClientBounds(nsRect &aRect)
{
if (mWnd) {
RECT r;
VERIFY(::GetWindowRect(mWnd, &r));
// assign size
aRect.width = r.right - r.left;
aRect.height = r.bottom - r.top;
@@ -2204,17 +2204,17 @@ void nsWindow::GetNonClientBounds(nsIntR
aRect.x = r.left;
aRect.y = r.top;
} else {
aRect.SetRect(0,0,0,0);
}
}
// like GetBounds, but don't offset by the parent
-NS_METHOD nsWindow::GetScreenBounds(nsIntRect &aRect)
+NS_METHOD nsWindow::GetScreenBounds(nsRect &aRect)
{
if (mWnd) {
RECT r;
VERIFY(::GetWindowRect(mWnd, &r));
aRect.width = r.right - r.left;
aRect.height = r.bottom - r.top;
aRect.x = r.left;
@@ -2677,17 +2677,17 @@ NS_METHOD nsWindow::Invalidate(PRBool aI
return NS_OK;
}
//-------------------------------------------------------------------------
//
// Invalidate this component visible area
//
//-------------------------------------------------------------------------
-NS_METHOD nsWindow::Invalidate(const nsIntRect & aRect, PRBool aIsSynchronous)
+NS_METHOD nsWindow::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
{
if (mWnd)
{
#ifdef NS_DEBUG
debug_DumpInvalidate(stdout,
this,
&aRect,
aIsSynchronous,
@@ -2855,17 +2855,17 @@ BOOL CALLBACK nsWindow::InvalidateForeig
//-------------------------------------------------------------------------
//
// Scroll the bits of a window
//
//-------------------------------------------------------------------------
//XXX Scroll is obsolete and should go away soon
-NS_METHOD nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsIntRect *aClipRect)
+NS_METHOD nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
{
RECT trect;
if (nsnull != aClipRect)
{
trect.left = aClipRect->x;
trect.top = aClipRect->y;
trect.right = aClipRect->XMost();
@@ -2886,17 +2886,17 @@ NS_IMETHODIMP nsWindow::ScrollWidgets(PR
{
// Scroll the entire contents of the window + change the offset of any child windows
::ScrollWindowEx(mWnd, aDx, aDy, NULL, NULL, NULL,
NULL, SW_INVALIDATE | SW_SCROLLCHILDREN);
::UpdateWindow(mWnd); // Force synchronous generation of NS_PAINT
return NS_OK;
}
-NS_IMETHODIMP nsWindow::ScrollRect(nsIntRect &aRect, PRInt32 aDx, PRInt32 aDy)
+NS_IMETHODIMP nsWindow::ScrollRect(nsRect &aRect, PRInt32 aDx, PRInt32 aDy)
{
RECT trect;
trect.left = aRect.x;
trect.top = aRect.y;
trect.right = aRect.XMost();
trect.bottom = aRect.YMost();
@@ -2918,28 +2918,28 @@ NS_IMETHODIMP nsWindow::ScrollRect(nsInt
BOOL nsWindow::CallMethod(MethodInfo *info)
{
BOOL bRet = TRUE;
switch (info->methodId) {
case nsWindow::CREATE:
NS_ASSERTION(info->nArgs == 7, "Wrong number of arguments to CallMethod");
Create((nsIWidget*)(info->args[0]),
- (nsIntRect&)*(nsIntRect*)(info->args[1]),
+ (nsRect&)*(nsRect*)(info->args[1]),
(EVENT_CALLBACK)(info->args[2]),
(nsIDeviceContext*)(info->args[3]),
(nsIAppShell *)(info->args[4]),
(nsIToolkit*)(info->args[5]),
(nsWidgetInitData*)(info->args[6]));
break;
case nsWindow::CREATE_NATIVE:
NS_ASSERTION(info->nArgs == 7, "Wrong number of arguments to CallMethod");
Create((nsNativeWidget)(info->args[0]),
- (nsIntRect&)*(nsIntRect*)(info->args[1]),
+ (nsRect&)*(nsRect*)(info->args[1]),
(EVENT_CALLBACK)(info->args[2]),
(nsIDeviceContext*)(info->args[3]),
(nsIAppShell *)(info->args[4]),
(nsIToolkit*)(info->args[5]),
(nsWidgetInitData*)(info->args[6]));
return TRUE;
case nsWindow::DESTROY:
@@ -3016,17 +3016,17 @@ UINT nsWindow::MapFromNativeToDOM(UINT a
// OnKey
//
//-------------------------------------------------------------------------
PRBool nsWindow::DispatchKeyEvent(PRUint32 aEventType, WORD aCharCode,
const nsTArray<nsAlternativeCharCode>* aAlternativeCharCodes,
UINT aVirtualCharCode, LPARAM aKeyData, PRUint32 aFlags)
{
nsKeyEvent event(PR_TRUE, aEventType, this);
- nsIntPoint point(0, 0);
+ nsPoint point(0, 0);
InitEvent(event, &point); // this add ref's event.widget
event.flags |= aFlags;
event.charCode = aCharCode;
if (aAlternativeCharCodes)
event.alternativeCharCodes.AppendElements(*aAlternativeCharCodes);
event.keyCode = aVirtualCharCode;
@@ -4129,17 +4129,17 @@ PRBool nsWindow::ProcessMessage(UINT msg
//PrintEvent(msg, PR_FALSE, PR_FALSE);
switch (msg) {
case WM_COMMAND:
{
WORD wNotifyCode = HIWORD(wParam); // notification code
if ((CBN_SELENDOK == wNotifyCode) || (CBN_SELENDCANCEL == wNotifyCode)) { // Combo box change
nsGUIEvent event(PR_TRUE, NS_CONTROL_CHANGE, this);
- nsIntPoint point(0,0);
+ nsPoint point(0,0);
InitEvent(event, &point); // this add ref's event.widget
result = DispatchWindowEvent(&event);
} else if (wNotifyCode == 0) { // Menu selection
nsMenuEvent event(PR_TRUE, NS_MENU_SELECTED, this);
event.mCommand = LOWORD(wParam);
InitEvent(event);
result = DispatchWindowEvent(&event);
}
@@ -4850,17 +4850,17 @@ PRBool nsWindow::ProcessMessage(UINT msg
// XXX Why are we using the client size area? If the size notification
// is for the client area then the origin should be (0,0) and not
// the window origin in screen coordinates...
RECT r;
::GetWindowRect(mWnd, &r);
PRInt32 newWidth, newHeight;
newWidth = PRInt32(r.right - r.left);
newHeight = PRInt32(r.bottom - r.top);
- nsIntRect rect(wp->x, wp->y, newWidth, newHeight);
+ nsRect rect(wp->x, wp->y, newWidth, newHeight);
#ifdef MOZ_XUL
if (eTransparencyTransparent == mTransparencyMode)
ResizeTranslucentWindow(newWidth, newHeight);
#endif
if (newWidth > mLastSize.width)
@@ -5759,16 +5759,17 @@ ConvertHRGNToRegion(HRGN aRgn)
//-------------------------------------------------------------------------
//
// Paint
//
//-------------------------------------------------------------------------
PRBool nsWindow::OnPaint(HDC aDC)
{
+ nsRect bounds;
PRBool result = PR_TRUE;
PAINTSTRUCT ps;
nsEventStatus eventStatus = nsEventStatus_eIgnore;
#ifdef MOZ_XUL
if (!aDC && (eTransparencyTransparent == mTransparencyMode))
{
// For layered translucent windows all drawing should go to memory DC and no
@@ -5942,17 +5943,17 @@ PRBool nsWindow::OnPaint(HDC aDC)
}
//-------------------------------------------------------------------------
//
// Send a resize message to the listener
//
//-------------------------------------------------------------------------
-PRBool nsWindow::OnResize(nsIntRect &aWindowRect)
+PRBool nsWindow::OnResize(nsRect &aWindowRect)
{
// call the event callback
if (mEventCallback) {
nsSizeEvent event(PR_TRUE, NS_SIZE, this);
InitEvent(event);
event.windowSize = &aWindowRect;
RECT r;
if (::GetWindowRect(mWnd, &r)) {
@@ -5996,39 +5997,39 @@ PRBool nsWindow::DispatchMouseEvent(PRUi
PRInt16 aButton)
{
PRBool result = PR_FALSE;
if (!mEventCallback) {
return result;
}
- nsIntPoint eventPoint;
+ nsPoint eventPoint;
eventPoint.x = GET_X_LPARAM(lParam);
eventPoint.y = GET_Y_LPARAM(lParam);
nsMouseEvent event(PR_TRUE, aEventType, this, nsMouseEvent::eReal,
aIsContextMenuKey
? nsMouseEvent::eContextMenuKey
: nsMouseEvent::eNormal);
if (aEventType == NS_CONTEXTMENU && aIsContextMenuKey) {
- nsIntPoint zero(0, 0);
+ nsPoint zero(0, 0);
InitEvent(event, &zero);
} else {
InitEvent(event, &eventPoint);
}
event.isShift = IS_VK_DOWN(NS_VK_SHIFT);
event.isControl = IS_VK_DOWN(NS_VK_CONTROL);
event.isMeta = PR_FALSE;
event.isAlt = IS_VK_DOWN(NS_VK_ALT);
event.button = aButton;
- nsIntRect mpWidget;
- nsIntRect mpScreen;
+ nsRect mpWidget;
+ nsRect mpScreen;
mpWidget.x = eventPoint.x;
mpWidget.y = eventPoint.y;
WidgetToScreen(mpWidget, mpScreen);
// Suppress mouse moves caused by widget creation
if (aEventType == NS_MOUSE_MOVE)
{
if ((gLastMouseMovePoint.x == mpScreen.x) && (gLastMouseMovePoint.y == mpScreen.y))
@@ -6165,17 +6166,17 @@ PRBool nsWindow::DispatchMouseEvent(PRUi
// call the event callback
if (nsnull != mEventCallback) {
if (nsToolkit::gMouseTrailer)
nsToolkit::gMouseTrailer->Disable();
if (aEventType == NS_MOUSE_MOVE) {
if (nsToolkit::gMouseTrailer && !mIsInMouseCapture) {
nsToolkit::gMouseTrailer->SetMouseTrailerWindow(mWnd);
}
- nsIntRect rect;
+ nsRect rect;
GetBounds(rect);
rect.x = 0;
rect.y = 0;
if (rect.Contains(event.refPoint)) {
if (gCurrentWindow == NULL || gCurrentWindow != this) {
if ((nsnull != gCurrentWindow) && (!gCurrentWindow->mIsDestroying)) {
LPARAM pos = gCurrentWindow->lParamToClient(lParamToScreen(lParam));
@@ -6209,17 +6210,17 @@ PRBool nsWindow::DispatchMouseEvent(PRUi
}
//-------------------------------------------------------------------------
//
// Deal with accessibile event
//
//-------------------------------------------------------------------------
#ifdef ACCESSIBILITY
-PRBool nsWindow::DispatchAccessibleEvent(PRUint32 aEventType, nsIAccessible** aAcc, nsIntPoint* aPoint)
+PRBool nsWindow::DispatchAccessibleEvent(PRUint32 aEventType, nsIAccessible** aAcc, nsPoint* aPoint)
{
PRBool result = PR_FALSE;
if (nsnull == mEventCallback) {
return result;
}
*aAcc = nsnull;
@@ -6453,17 +6454,17 @@ nsWindow::HandleTextEvent(HIMC hIMEConte
{
NS_ASSERTION(sIMECompUnicode, "sIMECompUnicode is null");
NS_ASSERTION(sIMEIsComposing, "conflict state");
if (!sIMECompUnicode)
return;
nsTextEvent event(PR_TRUE, NS_TEXT_TEXT, this);
- nsIntPoint point(0, 0);
+ nsPoint point(0, 0);
InitEvent(event, &point);
if (aCheckAttr) {
GetTextRangeList(&(event.rangeCount),&(event.rangeArray));
} else {
event.rangeCount = 0;
event.rangeArray = nsnull;
@@ -6480,17 +6481,17 @@ nsWindow::HandleTextEvent(HIMC hIMEConte
if (event.rangeArray)
delete [] event.rangeArray;
//
// Post process event
//
if (event.theReply.mCursorPosition.width || event.theReply.mCursorPosition.height)
{
- nsIntRect cursorPosition;
+ nsRect cursorPosition;
ResolveIMECaretPos(event.theReply.mReferenceWidget,
event.theReply.mCursorPosition,
this, cursorPosition);
CANDIDATEFORM candForm;
candForm.dwIndex = 0;
candForm.dwStyle = CFS_EXCLUDE;
candForm.ptCurrentPos.x = cursorPosition.x;
candForm.ptCurrentPos.y = cursorPosition.y;
@@ -6546,28 +6547,28 @@ nsWindow::HandleStartComposition(HIMC hI
// 1. WM_IME_COMPOSITION
// 2. WM_IME_STARTCOMPOSITION
// We call this function at both step #1 and #2.
// However, the composition start event should occur only once.
if (sIMEIsComposing)
return PR_TRUE;
nsCompositionEvent event(PR_TRUE, NS_COMPOSITION_START, this);
- nsIntPoint point(0, 0);
+ nsPoint point(0, 0);
CANDIDATEFORM candForm;
InitEvent(event, &point);
DispatchWindowEvent(&event);
//
// Post process event
//
if (event.theReply.mCursorPosition.width || event.theReply.mCursorPosition.height)
{
- nsIntRect cursorPosition;
+ nsRect cursorPosition;
ResolveIMECaretPos(event.theReply.mReferenceWidget,
event.theReply.mCursorPosition,
this, cursorPosition);
candForm.dwIndex = 0;
candForm.dwStyle = CFS_CANDIDATEPOS;
candForm.ptCurrentPos.x = cursorPosition.x + IME_X_OFFSET;
candForm.ptCurrentPos.y = cursorPosition.y + IME_Y_OFFSET +
cursorPosition.height;
@@ -6609,17 +6610,17 @@ nsWindow::HandleStartComposition(HIMC hI
void
nsWindow::HandleEndComposition(void)
{
if (!sIMEIsComposing)
return;
nsCompositionEvent event(PR_TRUE, NS_COMPOSITION_END, this);
- nsIntPoint point(0, 0);
+ nsPoint point(0, 0);
if (gPinYinIMECaretCreated)
{
DestroyCaret();
gPinYinIMECaretCreated = PR_FALSE;
}
InitEvent(event,&point);
@@ -7084,17 +7085,17 @@ PRBool nsWindow::OnIMEReconvert(LPARAM a
#ifdef DEBUG_IME
printf("OnIMEReconvert\n");
#endif
*oResult = 0;
RECONVERTSTRING* pReconv = (RECONVERTSTRING*) aData;
nsQueryContentEvent selection(PR_TRUE, NS_QUERY_SELECTED_TEXT, this);
- nsIntPoint point(0, 0);
+ nsPoint point(0, 0);
InitEvent(selection, &point);
DispatchWindowEvent(&selection);
if (!selection.mSucceeded)
return PR_FALSE;
if (!pReconv) {
// Return need size to reconvert.
if (selection.mReply.mString.IsEmpty())
@@ -7140,28 +7141,28 @@ PRBool nsWindow::OnIMEQueryCharPosition(
*oResult = FALSE;
IMECHARPOSITION* pCharPosition = (IMECHARPOSITION*)aData;
if (!pCharPosition ||
pCharPosition->dwSize < sizeof(IMECHARPOSITION) ||
::GetFocus() != mWnd ||
pCharPosition->dwCharPos > len)
return PR_FALSE;
- nsIntPoint point(0, 0);
+ nsPoint point(0, 0);
nsQueryContentEvent selection(PR_TRUE, NS_QUERY_SELECTED_TEXT, this);
InitEvent(selection, &point);
DispatchWindowEvent(&selection);
if (!selection.mSucceeded)
return PR_FALSE;
PRUint32 offset = selection.mReply.mOffset + pCharPosition->dwCharPos;
PRBool useCaretRect = selection.mReply.mString.IsEmpty();
- nsIntRect r;
+ nsRect r;
if (!useCaretRect) {
nsQueryContentEvent charRect(PR_TRUE, NS_QUERY_CHARACTER_RECT, this);
charRect.InitForQueryCharacterRect(offset);
InitEvent(charRect, &point);
DispatchWindowEvent(&charRect);
if (charRect.mSucceeded)
r = charRect.mReply.mRect;
else
@@ -7173,17 +7174,17 @@ PRBool nsWindow::OnIMEQueryCharPosition(
caretRect.InitForQueryCaretRect(offset);
InitEvent(caretRect, &point);
DispatchWindowEvent(&caretRect);
if (!caretRect.mSucceeded)
return PR_FALSE;
r = caretRect.mReply.mRect;
}
- nsIntRect screenRect;
+ nsRect screenRect;
// We always need top level window that is owner window of the popup window
// even if the content of the popup window has focus.
ResolveIMECaretPos(GetTopLevelWindow(PR_FALSE), r, nsnull, screenRect);
pCharPosition->pt.x = screenRect.x;
pCharPosition->pt.y = screenRect.y;
pCharPosition->cLineHeight = r.height;
@@ -7192,19 +7193,19 @@ PRBool nsWindow::OnIMEQueryCharPosition(
*oResult = TRUE;
return PR_TRUE;
}
//==========================================================================
void
nsWindow::ResolveIMECaretPos(nsIWidget* aReferenceWidget,
- nsIntRect& aCursorRect,
+ nsRect& aCursorRect,
nsIWidget* aNewOriginWidget,
- nsIntRect& aOutRect)
+ nsRect& aOutRect)
{
aOutRect = aCursorRect;
if (aReferenceWidget == aNewOriginWidget)
return;
if (aReferenceWidget)
aReferenceWidget->WidgetToScreen(aOutRect, aOutRect);
--- a/widget/src/windows/nsWindow.h
+++ b/widget/src/windows/nsWindow.h
@@ -124,35 +124,35 @@ class nsWindow : public nsSwitchToUIThre
public:
nsWindow();
virtual ~nsWindow();
NS_DECL_ISUPPORTS_INHERITED
// nsIWidget interface
NS_IMETHOD Create(nsIWidget *aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell = nsnull,
nsIToolkit *aToolkit = nsnull,
nsWidgetInitData *aInitData = nsnull);
NS_IMETHOD Create(nsNativeWidget aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell = nsnull,
nsIToolkit *aToolkit = nsnull,
nsWidgetInitData *aInitData = nsnull);
// Utility method for implementing both Create(nsIWidget ...) and
// Create(nsNativeWidget...)
virtual nsresult StandardWindowCreate(nsIWidget *aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData,
nsNativeWidget aNativeParent = nsnull);
NS_IMETHOD Destroy();
@@ -166,42 +166,42 @@ public:
NS_IMETHOD CaptureMouse(PRBool aCapture);
NS_IMETHOD ConstrainPosition(PRBool aAllowSlop, PRInt32 *aX, PRInt32 *aY);
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY);
NS_IMETHOD Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);
NS_IMETHOD Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint);
NS_IMETHOD Enable(PRBool aState);
NS_IMETHOD IsEnabled(PRBool *aState);
NS_IMETHOD SetFocus(PRBool aRaise);
- NS_IMETHOD GetBounds(nsIntRect &aRect);
- NS_IMETHOD GetClientBounds(nsIntRect &aRect);
- NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
+ NS_IMETHOD GetBounds(nsRect &aRect);
+ NS_IMETHOD GetClientBounds(nsRect &aRect);
+ NS_IMETHOD GetScreenBounds(nsRect &aRect);
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
NS_IMETHOD SetCursor(nsCursor aCursor);
NS_IMETHOD SetCursor(imgIContainer* aCursor,
PRUint32 aHotspotX, PRUint32 aHotspotY);
NS_IMETHOD HideWindowChrome(PRBool aShouldHide);
NS_IMETHOD Validate();
NS_IMETHOD Invalidate(PRBool aIsSynchronous);
- NS_IMETHOD Invalidate(const nsIntRect & aRect, PRBool aIsSynchronous);
+ NS_IMETHOD Invalidate(const nsRect & aRect, PRBool aIsSynchronous);
NS_IMETHOD InvalidateRegion(const nsIRegion *aRegion, PRBool aIsSynchronous);
NS_IMETHOD Update();
virtual void* GetNativeData(PRUint32 aDataType);
virtual void FreeNativeData(void * data, PRUint32 aDataType);//~~~
NS_IMETHOD SetColorMap(nsColorMap *aColorMap);
//XXX-Scroll is obsolete it is going away soon
- NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsIntRect *aClipRect);
+ NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect);
NS_IMETHOD ScrollWidgets(PRInt32 aDx, PRInt32 aDy);
- NS_IMETHOD ScrollRect(nsIntRect &aRect, PRInt32 aDx, PRInt32 aDy);
+ NS_IMETHOD ScrollRect(nsRect &aRect, PRInt32 aDx, PRInt32 aDy);
NS_IMETHOD SetTitle(const nsAString& aTitle);
NS_IMETHOD SetIcon(const nsAString& aIconSpec);
NS_IMETHOD SetMenuBar(void * aMenuBar) { return NS_ERROR_FAILURE; }
NS_IMETHOD ShowMenuBar(PRBool aShow) { return NS_ERROR_FAILURE; }
- NS_IMETHOD WidgetToScreen(const nsIntRect& aOldRect, nsIntRect& aNewRect);
- NS_IMETHOD ScreenToWidget(const nsIntRect& aOldRect, nsIntRect& aNewRect);
+ NS_IMETHOD WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect);
+ NS_IMETHOD ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect);
NS_IMETHOD BeginResizingChildren(void);
NS_IMETHOD EndResizingChildren(void);
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight);
NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight);
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus);
NS_IMETHOD EnableDragDrop(PRBool aEnable);
virtual void SetUpForPaint(HDC aHDC);
@@ -251,25 +251,25 @@ public:
HWND GetWindowHandle() { return mWnd; }
WNDPROC GetPrevWindowProc() { return mPrevWndProc; }
virtual PRBool DispatchMouseEvent(PRUint32 aEventType, WPARAM wParam,
LPARAM lParam,
PRBool aIsContextMenuKey = PR_FALSE,
PRInt16 aButton = nsMouseEvent::eLeftButton);
#ifdef ACCESSIBILITY
- virtual PRBool DispatchAccessibleEvent(PRUint32 aEventType, nsIAccessible** aAccessible, nsIntPoint* aPoint = nsnull);
+ virtual PRBool DispatchAccessibleEvent(PRUint32 aEventType, nsIAccessible** aAccessible, nsPoint* aPoint = nsnull);
already_AddRefed<nsIAccessible> GetRootAccessible();
#endif
virtual PRBool AutoErase();
- nsIntPoint* GetLastPoint() { return &mLastPoint; }
+ nsPoint* GetLastPoint() { return &mLastPoint; }
PRInt32 GetNewCmdMenuId() { mMenuCmdId++; return mMenuCmdId; }
- void InitEvent(nsGUIEvent& event, nsIntPoint* aPoint = nsnull);
+ void InitEvent(nsGUIEvent& event, nsPoint* aPoint = nsnull);
void SuppressBlurEvents(PRBool aSuppress);
PRBool BlurEventsSuppressed();
protected:
#ifndef WINCE
@@ -309,17 +309,17 @@ protected:
virtual DWORD WindowStyle();
virtual DWORD WindowExStyle();
virtual void SubclassWindow(BOOL bState);
virtual void OnDestroy();
virtual PRBool OnMove(PRInt32 aX, PRInt32 aY);
virtual PRBool OnPaint(HDC aDC = nsnull);
- virtual PRBool OnResize(nsIntRect &aWindowRect);
+ virtual PRBool OnResize(nsRect &aWindowRect);
void SetupModKeyState();
BOOL OnChar(UINT charCode, UINT aScanCode, PRUint32 aFlags = 0);
BOOL OnKeyDown( UINT aVirtualKeyCode, LPARAM aKeyCode,
nsFakeCharMessage* aFakeCharMessage);
BOOL OnKeyUp( UINT aVirtualKeyCode, LPARAM aKeyCode);
UINT MapFromNativeToDOM(UINT aNativeKeyCode);
@@ -350,19 +350,19 @@ protected:
* coordinates, set nsnull.
* @param aCursorRect The cursor rect.
* @param aNewOriginWidget aOutRect will be in this widget's coordinates. If
* this is nsnull, aOutRect will be in screen
* coordinates.
* @param aOutRect The converted cursor rect.
*/
void ResolveIMECaretPos(nsIWidget* aReferenceWidget,
- nsIntRect& aCursorRect,
+ nsRect& aCursorRect,
nsIWidget* aNewOriginWidget,
- nsIntRect& aOutRect);
+ nsRect& aOutRect);
virtual PRBool DispatchKeyEvent(PRUint32 aEventType, WORD aCharCode,
const nsTArray<nsAlternativeCharCode>* aAlternativeChars,
UINT aVirtualCharCode, LPARAM aKeyCode,
PRUint32 aFlags = 0);
virtual PRBool DispatchFocus(PRUint32 aEventType, PRBool isMozWindowTakingFocus);
virtual PRBool OnScroll(UINT scrollCode, int cPos);
@@ -374,17 +374,17 @@ protected:
// Convert nsEventStatus value to a windows boolean
static PRBool ConvertStatus(nsEventStatus aStatus)
{ return aStatus == nsEventStatus_eConsumeNoDefault; }
PRBool DispatchStandardEvent(PRUint32 aMsg);
PRBool DispatchCommandEvent(PRUint32 aEventCommand);
void RelayMouseEvent(UINT aMsg, WPARAM wParam, LPARAM lParam);
- void GetNonClientBounds(nsIntRect &aRect);
+ void GetNonClientBounds(nsRect &aRect);
void HandleTextEvent(HIMC hIMEContext, PRBool aCheckAttr=PR_TRUE);
BOOL HandleStartComposition(HIMC hIMEContext);
void HandleEndComposition(void);
void GetTextRangeList(PRUint32* textRangeListLengthResult, nsTextRangeArray* textRangeListResult);
void ConstrainZLevel(HWND *aAfter);
LPARAM lParamToScreen(LPARAM lParam);
@@ -424,19 +424,19 @@ protected:
static PRInt32 sIMECompClauseArraySize;
static long sIMECursorPosition;
// For describing composing frame
static RECT* sIMECompCharPos;
static TriStateBool sCanQuit;
- nsIntSize mLastSize;
+ nsSize mLastSize;
static nsWindow* gCurrentWindow;
- nsIntPoint mLastPoint;
+ nsPoint mLastPoint;
HWND mWnd;
HDC mPaintDC; // only set during painting
#if 0
HPALETTE mPalette;
#endif
WNDPROC mPrevWndProc;
HBRUSH mBrush;
--- a/widget/src/xpwidgets/nsBaseDragService.cpp
+++ b/widget/src/xpwidgets/nsBaseDragService.cpp
@@ -396,17 +396,17 @@ GetPresShellForContent(nsIDOMNode* aDOMN
return nsnull;
}
nsresult
nsBaseDragService::DrawDrag(nsIDOMNode* aDOMNode,
nsIScriptableRegion* aRegion,
PRInt32 aScreenX, PRInt32 aScreenY,
- nsIntRect* aScreenDragRect,
+ nsRect* aScreenDragRect,
gfxASurface** aSurface,
nsPresContext** aPresContext)
{
*aSurface = nsnull;
*aPresContext = nsnull;
// use a default size, in case of an error.
aScreenDragRect->x = aScreenX - mImageX;
@@ -436,21 +436,20 @@ nsBaseDragService::DrawDrag(nsIDOMNode*
// didn't want an image, so just set the screen rectangle to the frame size
if (!enableDragImages || !mHasImage) {
// if a region was specified, set the screen rectangle to the area that
// the region occupies
if (aRegion) {
// the region's coordinates are relative to the root frame
nsIFrame* rootFrame = presShell->GetRootFrame();
if (rootFrame && *aPresContext) {
- nsIntRect dragRect;
+ nsRect dragRect;
aRegion->GetBoundingBox(&dragRect.x, &dragRect.y, &dragRect.width, &dragRect.height);
- dragRect = nsRect::ToOutsidePixels(nsIntRect::ToAppUnits(dragRect,
- nsPresContext::AppUnitsPerCSSPixel()),
- (*aPresContext)->AppUnitsPerDevPixel());
+ dragRect.ScaleRoundOut(nsPresContext::AppUnitsPerCSSPixel());
+ dragRect.ScaleRoundOut(1.0 / (*aPresContext)->AppUnitsPerDevPixel());
nsIntRect screenRect = rootFrame->GetScreenRectExternal();
aScreenDragRect->SetRect(screenRect.x + dragRect.x, screenRect.y + dragRect.y,
dragRect.width, dragRect.height);
}
}
else {
// otherwise, there was no region so just set the rectangle to
@@ -464,17 +463,17 @@ nsBaseDragService::DrawDrag(nsIDOMNode*
}
}
return NS_OK;
}
// draw the image for selections
if (mSelection) {
- nsIntPoint pnt(aScreenDragRect->x, aScreenDragRect->y);
+ nsPoint pnt(aScreenDragRect->x, aScreenDragRect->y);
nsRefPtr<gfxASurface> surface = presShell->RenderSelection(mSelection, pnt, aScreenDragRect);
*aSurface = surface;
NS_IF_ADDREF(*aSurface);
return NS_OK;
}
// if an custom image was specified, check if it is an image node and draw
// using the source rather than the displayed image. But if mImage isn't
@@ -494,17 +493,17 @@ nsBaseDragService::DrawDrag(nsIDOMNode*
}
}
// otherwise, just draw the node
nsCOMPtr<nsIRegion> clipRegion;
if (aRegion)
aRegion->GetRegion(getter_AddRefs(clipRegion));
- nsIntPoint pnt(aScreenDragRect->x, aScreenDragRect->y);
+ nsPoint pnt(aScreenDragRect->x, aScreenDragRect->y);
nsRefPtr<gfxASurface> surface = presShell->RenderNode(dragNode, clipRegion,
pnt, aScreenDragRect);
// if an image was specified, reposition the drag rectangle to
// the supplied offset in mImageX and mImageY.
if (mImage) {
aScreenDragRect->x = aScreenX - mImageX;
aScreenDragRect->y = aScreenY - mImageY;
@@ -516,17 +515,17 @@ nsBaseDragService::DrawDrag(nsIDOMNode*
return NS_OK;
}
nsresult
nsBaseDragService::DrawDragForImage(nsPresContext* aPresContext,
nsIImageLoadingContent* aImageLoader,
nsICanvasElement* aCanvas,
PRInt32 aScreenX, PRInt32 aScreenY,
- nsIntRect* aScreenDragRect,
+ nsRect* aScreenDragRect,
gfxASurface** aSurface)
{
nsCOMPtr<nsIImage> img;
if (aImageLoader) {
nsCOMPtr<imgIRequest> imgRequest;
nsresult rv = aImageLoader->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,
getter_AddRefs(imgRequest));
NS_ENSURE_SUCCESS(rv, rv);
@@ -555,19 +554,19 @@ nsBaseDragService::DrawDragForImage(nsPr
else {
NS_ASSERTION(aCanvas, "both image and canvas are null");
PRUint32 width, height;
aCanvas->GetSize(&width, &height);
aScreenDragRect->width = width;
aScreenDragRect->height = height;
}
- nsIntRect srcRect = *aScreenDragRect;
+ nsRect srcRect = *aScreenDragRect;
srcRect.MoveTo(0, 0);
- nsIntRect destRect = srcRect;
+ nsRect destRect = srcRect;
if (destRect.width == 0 || destRect.height == 0)
return NS_ERROR_FAILURE;
// if the image is larger than half the screen size, scale it down. This
// scaling algorithm is the same as is used in nsPresShell::PaintRangePaintInfo
nsIDeviceContext* deviceContext = aPresContext->DeviceContext();
nsRect maxSize;
--- a/widget/src/xpwidgets/nsBaseDragService.h
+++ b/widget/src/xpwidgets/nsBaseDragService.h
@@ -98,29 +98,29 @@ protected:
* aScreenDragRect will still be set to the drag area.
*
* aPresContext will be set to the nsPresContext used determined from
* whichever of mImage or aDOMNode is used.
*/
nsresult DrawDrag(nsIDOMNode* aDOMNode,
nsIScriptableRegion* aRegion,
PRInt32 aScreenX, PRInt32 aScreenY,
- nsIntRect* aScreenDragRect,
+ nsRect* aScreenDragRect,
gfxASurface** aSurface,
nsPresContext **aPresContext);
/**
* Draw a drag image for an image node specified by aImageLoader or aCanvas.
* This is called by DrawDrag.
*/
nsresult DrawDragForImage(nsPresContext* aPresContext,
nsIImageLoadingContent* aImageLoader,
nsICanvasElement* aCanvas,
PRInt32 aScreenX, PRInt32 aScreenY,
- nsIntRect* aScreenDragRect,
+ nsRect* aScreenDragRect,
gfxASurface** aSurface);
/**
* Convert aScreenX and aScreenY from CSS pixels into unscaled device pixels.
*/
void
ConvertToUnscaledDevPixels(nsPresContext* aPresContext,
PRInt32* aScreenX, PRInt32* aScreenY);
--- a/widget/src/xpwidgets/nsBaseWidget.cpp
+++ b/widget/src/xpwidgets/nsBaseWidget.cpp
@@ -140,17 +140,17 @@ nsBaseWidget::~nsBaseWidget()
//-------------------------------------------------------------------------
//
// Basic create.
//
//-------------------------------------------------------------------------
void nsBaseWidget::BaseCreate(nsIWidget *aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData)
{
if (nsnull == mToolkit) {
if (nsnull != aToolkit) {
@@ -586,17 +586,17 @@ NS_IMETHODIMP nsBaseWidget::HideWindowCh
NS_IMETHODIMP nsBaseWidget::MakeFullScreen(PRBool aFullScreen)
{
HideWindowChrome(aFullScreen);
nsCOMPtr<nsIFullScreen> fullScreen = do_GetService("@mozilla.org/browser/fullscreen;1");
if (aFullScreen) {
if (!mOriginalBounds)
- mOriginalBounds = new nsIntRect();
+ mOriginalBounds = new nsRect();
GetScreenBounds(*mOriginalBounds);
// Move to top-left corner of screen and size to the screen dimensions
nsCOMPtr<nsIScreenManager> screenManager;
screenManager = do_GetService("@mozilla.org/gfx/screenmanager;1");
NS_ASSERTION(screenManager, "Unable to grab screenManager.");
if (screenManager) {
nsCOMPtr<nsIScreen> screen;
@@ -734,77 +734,77 @@ NS_METHOD nsBaseWidget::AddEventListener
mEventListener = aListener;
return NS_OK;
}
/**
* If the implementation of nsWindow supports borders this method MUST be overridden
*
**/
-NS_METHOD nsBaseWidget::GetClientBounds(nsIntRect &aRect)
+NS_METHOD nsBaseWidget::GetClientBounds(nsRect &aRect)
{
return GetBounds(aRect);
}
/**
* If the implementation of nsWindow supports borders this method MUST be overridden
*
**/
-NS_METHOD nsBaseWidget::GetBounds(nsIntRect &aRect)
+NS_METHOD nsBaseWidget::GetBounds(nsRect &aRect)
{
aRect = mBounds;
return NS_OK;
}
/**
* If the implementation of nsWindow uses a local coordinate system within the window,
* this method must be overridden
*
**/
-NS_METHOD nsBaseWidget::GetScreenBounds(nsIntRect &aRect)
+NS_METHOD nsBaseWidget::GetScreenBounds(nsRect &aRect)
{
return GetBounds(aRect);
}
/**
*
*
**/
-NS_METHOD nsBaseWidget::SetBounds(const nsIntRect &aRect)
+NS_METHOD nsBaseWidget::SetBounds(const nsRect &aRect)
{
mBounds = aRect;
return NS_OK;
}
/**
* Calculates the border width and height
*
**/
NS_METHOD nsBaseWidget::GetBorderSize(PRInt32 &aWidth, PRInt32 &aHeight)
{
- nsIntRect rectWin;
- nsIntRect rect;
+ nsRect rectWin;
+ nsRect rect;
GetBounds(rectWin);
GetClientBounds(rect);
aWidth = (rectWin.width - rect.width) / 2;
aHeight = (rectWin.height - rect.height) / 2;
return NS_OK;
}
NS_IMETHODIMP nsBaseWidget::ScrollWidgets(PRInt32 aDx, PRInt32 aDy)
{
return NS_ERROR_FAILURE;
}
-NS_IMETHODIMP nsBaseWidget::ScrollRect(nsIntRect &aRect, PRInt32 aDx, PRInt32 aDy)
+NS_IMETHODIMP nsBaseWidget::ScrollRect(nsRect &aRect, PRInt32 aDx, PRInt32 aDy)
{
return NS_ERROR_FAILURE;
}
NS_METHOD nsBaseWidget::EnableDragDrop(PRBool aEnable)
{
return NS_OK;
}
@@ -1245,17 +1245,17 @@ nsBaseWidget::debug_DumpPaintEvent(FILE
}
fprintf(aFileOut,"\n");
}
//////////////////////////////////////////////////////////////
/* static */ void
nsBaseWidget::debug_DumpInvalidate(FILE * aFileOut,
nsIWidget * aWidget,
- const nsIntRect * aRect,
+ const nsRect * aRect,
PRBool aIsSynchronous,
const nsCAutoString & aWidgetName,
PRInt32 aWindowID)
{
if (!debug_GetCachedBoolPref("nglayout.debug.invalidate_dumping"))
return;
NS_ASSERTION(nsnull != aFileOut,"cmon, null output FILE");
--- a/widget/src/xpwidgets/nsBaseWidget.h
+++ b/widget/src/xpwidgets/nsBaseWidget.h
@@ -113,22 +113,22 @@ public:
virtual nsIToolkit* GetToolkit();
virtual gfxASurface* GetThebesSurface();
NS_IMETHOD SetModal(PRBool aModal);
NS_IMETHOD ModalEventFilter(PRBool aRealEvent, void *aEvent,
PRBool *aForWindow);
NS_IMETHOD SetWindowClass(const nsAString& xulWinType);
NS_IMETHOD SetBorderStyle(nsBorderStyle aBorderStyle);
NS_IMETHOD AddEventListener(nsIEventListener * aListener);
- NS_IMETHOD SetBounds(const nsIntRect &aRect);
- NS_IMETHOD GetBounds(nsIntRect &aRect);
- NS_IMETHOD GetClientBounds(nsIntRect &aRect);
- NS_IMETHOD GetScreenBounds(nsIntRect &aRect);
+ NS_IMETHOD SetBounds(const nsRect &aRect);
+ NS_IMETHOD GetBounds(nsRect &aRect);
+ NS_IMETHOD GetClientBounds(nsRect &aRect);
+ NS_IMETHOD GetScreenBounds(nsRect &aRect);
NS_IMETHOD GetBorderSize(PRInt32 &aWidth, PRInt32 &aHeight);
- NS_IMETHOD ScrollRect(nsIntRect &aRect, PRInt32 aDx, PRInt32 aDy);
+ NS_IMETHOD ScrollRect(nsRect &aRect, PRInt32 aDx, PRInt32 aDy);
NS_IMETHOD ScrollWidgets(PRInt32 aDx, PRInt32 aDy);
NS_IMETHOD EnableDragDrop(PRBool aEnable);
NS_IMETHOD GetAttention(PRInt32 aCycleCount);
NS_IMETHOD GetLastInputEventTime(PRUint32& aTime);
NS_IMETHOD SetIcon(const nsAString &anIconSpec);
NS_IMETHOD BeginSecureKeyboardInput();
NS_IMETHOD EndSecureKeyboardInput();
NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, PRBool aActive);
@@ -148,17 +148,17 @@ public:
protected:
virtual void ResolveIconName(const nsAString &aIconName,
const nsAString &aIconSuffix,
nsILocalFile **aResult);
virtual void OnDestroy();
virtual void BaseCreate(nsIWidget *aParent,
- const nsIntRect &aRect,
+ const nsRect &aRect,
EVENT_CALLBACK aHandleEventFunction,
nsIDeviceContext *aContext,
nsIAppShell *aAppShell,
nsIToolkit *aToolkit,
nsWidgetInitData *aInitData);
virtual nsIContent* GetLastRollup()
{
@@ -183,18 +183,18 @@ protected:
nsCursor mCursor;
nsWindowType mWindowType;
nsBorderStyle mBorderStyle;
PRPackedBool mIsShiftDown;
PRPackedBool mIsControlDown;
PRPackedBool mIsAltDown;
PRPackedBool mIsDestroying;
PRPackedBool mOnDestroyCalled;
- nsIntRect mBounds;
- nsIntRect* mOriginalBounds;
+ nsRect mBounds;
+ nsRect* mOriginalBounds;
PRInt32 mZIndex;
nsSizeMode mSizeMode;
// the last rolled up popup. Only set this when an nsAutoRollup is in scope,
// so it can be cleared automatically.
static nsIContent* mLastRollup;
// Enumeration of the methods which are accessible on the "main GUI thread"
@@ -211,17 +211,17 @@ protected:
#ifdef DEBUG
protected:
static nsAutoString debug_GuiEventToString(nsGUIEvent * aGuiEvent);
static PRBool debug_WantPaintFlashing();
static void debug_DumpInvalidate(FILE * aFileOut,
nsIWidget * aWidget,
- const nsIntRect * aRect,
+ const nsRect * aRect,
PRBool aIsSynchronous,
const nsCAutoString & aWidgetName,
PRInt32 aWindowID);
static void debug_DumpEvent(FILE * aFileOut,
nsIWidget * aWidget,
nsGUIEvent * aGuiEvent,
const nsCAutoString & aWidgetName,
--- a/widget/src/xpwidgets/nsPrintOptionsImpl.cpp
+++ b/widget/src/xpwidgets/nsPrintOptionsImpl.cpp
@@ -33,16 +33,17 @@
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsPrintOptionsImpl.h"
+#include "nsCoord.h"
#include "nsReadableUtils.h"
#include "nsPrintSettingsImpl.h"
#include "nsIDOMWindow.h"
#include "nsIServiceManager.h"
#include "nsIDialogParamBlock.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
@@ -246,52 +247,55 @@ GetPrefName((_a2), aPrefName), (_a3));
nsresult
nsPrintOptions::ReadPrefs(nsIPrintSettings* aPS, const nsAString& aPrinterName,
PRUint32 aFlags)
{
NS_ENSURE_STATE(mPrefBranch);
NS_ENSURE_ARG_POINTER(aPS);
if (aFlags & nsIPrintSettings::kInitSaveMargins) {
- PRInt32 halfInch = NS_INCHES_TO_TWIPS(0.5);
- nsIntMargin margin(halfInch, halfInch, halfInch, halfInch);
+ nscoord halfInch = NS_INCHES_TO_TWIPS(0.5);
+ nsMargin margin;
+ margin.SizeTo(halfInch, halfInch, halfInch, halfInch);
ReadInchesToTwipsPref(GetPrefName(kMarginTop, aPrinterName), margin.top,
kMarginTop);
DUMP_INT(kReadStr, kMarginTop, margin.top);
ReadInchesToTwipsPref(GetPrefName(kMarginLeft, aPrinterName), margin.left,
kMarginLeft);
DUMP_INT(kReadStr, kMarginLeft, margin.left);
ReadInchesToTwipsPref(GetPrefName(kMarginBottom, aPrinterName),
margin.bottom, kMarginBottom);
DUMP_INT(kReadStr, kMarginBottom, margin.bottom);
ReadInchesToTwipsPref(GetPrefName(kMarginRight, aPrinterName), margin.right,
kMarginRight);
DUMP_INT(kReadStr, kMarginRight, margin.right);
aPS->SetMarginInTwips(margin);
}
if (aFlags & nsIPrintSettings::kInitSaveEdges) {
- nsIntMargin margin(0,0,0,0);
+ nsMargin margin;
+ margin.SizeTo(0,0,0,0);
ReadInchesIntToTwipsPref(GetPrefName(kEdgeTop, aPrinterName), margin.top,
kEdgeTop);
DUMP_INT(kReadStr, kEdgeTop, margin.top);
ReadInchesIntToTwipsPref(GetPrefName(kEdgeLeft, aPrinterName), margin.left,
kEdgeLeft);
DUMP_INT(kReadStr, kEdgeLeft, margin.left);
ReadInchesIntToTwipsPref(GetPrefName(kEdgeBottom, aPrinterName),
margin.bottom, kEdgeBottom);
DUMP_INT(kReadStr, kEdgeBottom, margin.bottom);
ReadInchesIntToTwipsPref(GetPrefName(kEdgeRight, aPrinterName), margin.right,
kEdgeRight);
DUMP_INT(kReadStr, kEdgeRight, margin.right);
aPS->SetEdgeInTwips(margin);
}
if (aFlags & nsIPrintSettings::kInitSaveUnwriteableMargins) {
- nsIntMargin margin;
+ nsMargin margin;
+ margin.SizeTo(0,0,0,0);
ReadInchesIntToTwipsPref(GetPrefName(kUnwriteableMarginTop, aPrinterName), margin.top,
kUnwriteableMarginTop);
DUMP_INT(kReadStr, kUnwriteableMarginTop, margin.top);
ReadInchesIntToTwipsPref(GetPrefName(kUnwriteableMarginLeft, aPrinterName), margin.left,
kUnwriteableMarginLeft);
DUMP_INT(kReadStr, kUnwriteableMarginLeft, margin.left);
ReadInchesIntToTwipsPref(GetPrefName(kUnwriteableMarginBottom, aPrinterName),
margin.bottom, kUnwriteableMarginBottom);
@@ -549,17 +553,17 @@ nsPrintOptions::ReadPrefs(nsIPrintSettin
*/
nsresult
nsPrintOptions::WritePrefs(nsIPrintSettings *aPS, const nsAString& aPrinterName,
PRUint32 aFlags)
{
NS_ENSURE_ARG_POINTER(aPS);
NS_ENSURE_STATE(mPrefBranch);
- nsIntMargin margin;
+ nsMargin margin;
if (aFlags & nsIPrintSettings::kInitSaveMargins) {
if (NS_SUCCEEDED(aPS->GetMarginInTwips(margin))) {
WriteInchesFromTwipsPref(GetPrefName(kMarginTop, aPrinterName),
margin.top);
DUMP_INT(kWriteStr, kMarginTop, margin.top);
WriteInchesFromTwipsPref(GetPrefName(kMarginLeft, aPrinterName),
margin.left);
DUMP_INT(kWriteStr, kMarginLeft, margin.top);
@@ -567,17 +571,17 @@ nsPrintOptions::WritePrefs(nsIPrintSetti
margin.bottom);
DUMP_INT(kWriteStr, kMarginBottom, margin.top);
WriteInchesFromTwipsPref(GetPrefName(kMarginRight, aPrinterName),
margin.right);
DUMP_INT(kWriteStr, kMarginRight, margin.top);
}
}
- nsIntMargin edge;
+ nsMargin edge;
if (aFlags & nsIPrintSettings::kInitSaveEdges) {
if (NS_SUCCEEDED(aPS->GetEdgeInTwips(edge))) {
WriteInchesIntFromTwipsPref(GetPrefName(kEdgeTop, aPrinterName),
edge.top);
DUMP_INT(kWriteStr, kEdgeTop, edge.top);
WriteInchesIntFromTwipsPref(GetPrefName(kEdgeLeft, aPrinterName),
edge.left);
DUMP_INT(kWriteStr, kEdgeLeft, edge.top);
@@ -585,17 +589,17 @@ nsPrintOptions::WritePrefs(nsIPrintSetti
edge.bottom);
DUMP_INT(kWriteStr, kEdgeBottom, edge.top);
WriteInchesIntFromTwipsPref(GetPrefName(kEdgeRight, aPrinterName),
edge.right);
DUMP_INT(kWriteStr, kEdgeRight, edge.top);
}
}
- nsIntMargin unwriteableMargin;
+ nsMargin unwriteableMargin;
if (aFlags & nsIPrintSettings::kInitSaveUnwriteableMargins) {
if (NS_SUCCEEDED(aPS->GetUnwriteableMarginInTwips(unwriteableMargin))) {
WriteInchesIntFromTwipsPref(GetPrefName(kUnwriteableMarginTop, aPrinterName),
unwriteableMargin.top);
DUMP_INT(kWriteStr, kUnwriteableMarginTop, unwriteableMargin.top);
WriteInchesIntFromTwipsPref(GetPrefName(kUnwriteableMarginLeft, aPrinterName),
unwriteableMargin.left);
DUMP_INT(kWriteStr, kUnwriteableMarginLeft, unwriteableMargin.top);
@@ -1161,17 +1165,17 @@ nsPrintOptions::WritePrefDouble(const ch
char str[16]; // max 9 chars in below snprintf(), 16 will do nicely
int ret = PR_snprintf(str, sizeof(str), "%6.2f", aVal);
NS_ENSURE_TRUE(ret >= 0, NS_ERROR_FAILURE);
return mPrefBranch->SetCharPref(aPrefId, str);
}
void
-nsPrintOptions::ReadInchesToTwipsPref(const char * aPrefId, PRInt32& aTwips,
+nsPrintOptions::ReadInchesToTwipsPref(const char * aPrefId, nscoord& aTwips,
const char * aMarginPref)
{
if (!mPrefBranch) {
return;
}
char * str = nsnull;
nsresult rv = mPrefBranch->GetCharPref(aPrefId, &str);
@@ -1187,31 +1191,31 @@ nsPrintOptions::ReadInchesToTwipsPref(co
} else {
aTwips = 0;
}
nsMemory::Free(str);
}
}
void
-nsPrintOptions::WriteInchesFromTwipsPref(const char * aPrefId, PRInt32 aTwips)
+nsPrintOptions::WriteInchesFromTwipsPref(const char * aPrefId, nscoord aTwips)
{
if (!mPrefBranch) {
return;
}
double inches = NS_TWIPS_TO_INCHES(aTwips);
nsCAutoString inchesStr;
inchesStr.AppendFloat(inches);
mPrefBranch->SetCharPref(aPrefId, inchesStr.get());
}
void
-nsPrintOptions::ReadInchesIntToTwipsPref(const char * aPrefId, PRInt32& aTwips,
+nsPrintOptions::ReadInchesIntToTwipsPref(const char * aPrefId, nscoord& aTwips,
const char * aMarginPref)
{
if (!mPrefBranch) {
return;
}
PRInt32 value;
nsresult rv = mPrefBranch->GetIntPref(aPrefId, &value);
@@ -1221,17 +1225,17 @@ nsPrintOptions::ReadInchesIntToTwipsPref
if (NS_SUCCEEDED(rv)) {
aTwips = NS_INCHES_TO_TWIPS(float(value)/100.0f);
} else {
aTwips = 0;
}
}
void
-nsPrintOptions::WriteInchesIntFromTwipsPref(const char * aPrefId, PRInt32 aTwips)
+nsPrintOptions::WriteInchesIntFromTwipsPref(const char * aPrefId, nscoord aTwips)
{
if (!mPrefBranch) {
return;
}
mPrefBranch->SetIntPref(aPrefId, PRInt32(NS_TWIPS_TO_INCHES(aTwips)*100.0f + 0.5f));
}
--- a/widget/src/xpwidgets/nsPrintOptionsImpl.h
+++ b/widget/src/xpwidgets/nsPrintOptionsImpl.h
@@ -71,22 +71,22 @@ public:
virtual ~nsPrintOptions();
protected:
void ReadBitFieldPref(const char * aPrefId, PRInt32 anOption);
void WriteBitFieldPref(const char * aPrefId, PRInt32 anOption);
void ReadJustification(const char * aPrefId, PRInt16& aJust,
PRInt16 aInitValue);
void WriteJustification(const char * aPrefId, PRInt16 aJust);
- void ReadInchesToTwipsPref(const char * aPrefId, PRInt32& aTwips,
+ void ReadInchesToTwipsPref(const char * aPrefId, nscoord& aTwips,
const char * aMarginPref);
- void WriteInchesFromTwipsPref(const char * aPrefId, PRInt32 aTwips);
- void ReadInchesIntToTwipsPref(const char * aPrefId, PRInt32& aTwips,
+ void WriteInchesFromTwipsPref(const char * aPrefId, nscoord aTwips);
+ void ReadInchesIntToTwipsPref(const char * aPrefId, nscoord& aTwips,
const char * aMarginPref);
- void WriteInchesIntFromTwipsPref(const char * aPrefId, PRInt32 aTwips);
+ void WriteInchesIntFromTwipsPref(const char * aPrefId, nscoord aTwips);
nsresult ReadPrefString(const char * aPrefId, nsAString& aString);
/**
* method WritePrefString
* Writes PRUnichar* to Prefs and deletes the contents of aString
*/
nsresult WritePrefString(const char * aPrefId, const nsAString& aString);
nsresult WritePrefString(PRUnichar*& aStr, const char* aPrefId);
--- a/widget/src/xpwidgets/nsPrintSettingsImpl.cpp
+++ b/widget/src/xpwidgets/nsPrintSettingsImpl.cpp
@@ -31,16 +31,17 @@
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsPrintSettingsImpl.h"
+#include "nsCoord.h"
#include "nsReadableUtils.h"
#include "nsIPrintSession.h"
#define DEFAULT_MARGIN_WIDTH 0.5
NS_IMPL_ISUPPORTS1(nsPrintSettings, nsIPrintSettings)
/** ---------------------------------------------------
@@ -76,17 +77,17 @@ nsPrintSettings::nsPrintSettings() :
mNumCopies(1),
mPrintToFile(PR_FALSE),