Backing out bug 448830
This commit is contained in:
Родитель
2b6ed5e11b
Коммит
2bb50f56af
|
@ -1367,7 +1367,7 @@ NS_IMETHODIMP nsAccessible::GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PR
|
|||
|
||||
// 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;
|
||||
|
||||
|
|
|
@ -344,10 +344,10 @@ nsCaretAccessible::SpellcheckSelectionChanged(nsIDOMDocument *aDoc,
|
|||
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);
|
||||
|
@ -375,27 +375,28 @@ nsCaretAccessible::GetCaretRect(nsIWidget **aOutWidget)
|
|||
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);
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ public:
|
|||
*/
|
||||
nsresult RemoveDocSelectionListener(nsIPresShell *aShell);
|
||||
|
||||
nsIntRect GetCaretRect(nsIWidget **aOutWidget);
|
||||
nsRect GetCaretRect(nsIWidget **aOutWidget);
|
||||
|
||||
protected:
|
||||
nsresult NormalSelectionChanged(nsIDOMDocument *aDoc, nsISelection *aSel);
|
||||
|
|
|
@ -149,8 +149,7 @@ nsHTMLAreaAccessible::GetBounds(PRInt32 *x, PRInt32 *y,
|
|||
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);
|
||||
|
||||
|
|
|
@ -301,13 +301,13 @@ nsIntRect nsHyperTextAccessible::GetBoundsForString(nsIFrame *aFrame, PRUint32 a
|
|||
// 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);
|
||||
|
@ -1346,12 +1346,12 @@ nsHyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY,
|
|||
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
|
||||
|
|
|
@ -1922,7 +1922,7 @@ void nsAccessibleWrap::UpdateSystemCaret()
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -115,7 +115,7 @@ STDMETHODIMP nsTextAccessibleWrap::get_clippedSubstringBounds(
|
|||
{
|
||||
__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;
|
||||
|
@ -127,9 +127,9 @@ __try {
|
|||
|
||||
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);
|
||||
|
||||
|
@ -221,11 +221,11 @@ nsresult nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aStartOffset, PRInt32
|
|||
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;
|
||||
|
|
|
@ -158,7 +158,7 @@ nsImageLoadingContent::~nsImageLoadingContent()
|
|||
NS_IMETHODIMP
|
||||
nsImageLoadingContent::FrameChanged(imgIContainer* aContainer,
|
||||
gfxIImageFrame* aFrame,
|
||||
nsIntRect* aDirtyRect)
|
||||
nsRect* aDirtyRect)
|
||||
{
|
||||
LOOP_OVER_OBSERVERS(FrameChanged(aContainer, aFrame, aDirtyRect));
|
||||
return NS_OK;
|
||||
|
@ -204,7 +204,7 @@ nsImageLoadingContent::OnStartFrame(imgIRequest* aRequest,
|
|||
NS_IMETHODIMP
|
||||
nsImageLoadingContent::OnDataAvailable(imgIRequest* aRequest,
|
||||
gfxIImageFrame* aFrame,
|
||||
const nsIntRect* aRect)
|
||||
const nsRect* aRect)
|
||||
{
|
||||
LOOP_OVER_OBSERVERS(OnDataAvailable(aRequest, aFrame, aRect));
|
||||
return NS_OK;
|
||||
|
|
|
@ -121,32 +121,28 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMUIEvent)
|
|||
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 &&
|
||||
|
@ -160,14 +156,14 @@ nsDOMUIEvent::GetClientPoint()
|
|||
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
|
||||
|
@ -198,14 +194,14 @@ nsDOMUIEvent::InitUIEvent(const nsAString & typeArg, PRBool canBubbleArg, PRBool
|
|||
}
|
||||
|
||||
// ---- 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()) {
|
||||
|
@ -213,8 +209,8 @@ nsDOMUIEvent::GetPagePoint()
|
|||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -310,9 +306,7 @@ nsDOMUIEvent::SetCancelBubble(PRBool aCancelBubble)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIntPoint
|
||||
nsDOMUIEvent::GetLayerPoint()
|
||||
{
|
||||
nsPoint nsDOMUIEvent::GetLayerPoint() {
|
||||
if (!mEvent ||
|
||||
(mEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
mEvent->eventStructType != NS_POPUP_EVENT &&
|
||||
|
@ -329,8 +323,9 @@ nsDOMUIEvent::GetLayerPoint()
|
|||
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
|
||||
|
@ -394,7 +389,7 @@ nsDOMUIEvent::DuplicatePrivateData()
|
|||
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;
|
||||
|
|
|
@ -74,18 +74,18 @@ public:
|
|||
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 \
|
||||
|
|
|
@ -1380,7 +1380,7 @@ nsEventListenerManager::FixContextMenuEvent(nsPresContext* aPresContext,
|
|||
|
||||
// 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,
|
||||
|
@ -1413,7 +1413,7 @@ nsEventListenerManager::FixContextMenuEvent(nsPresContext* aPresContext,
|
|||
|
||||
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;
|
||||
|
@ -1441,7 +1441,7 @@ nsEventListenerManager::FixContextMenuEvent(nsPresContext* aPresContext,
|
|||
PRBool
|
||||
nsEventListenerManager::PrepareToUseCaretPosition(nsIWidget* aEventWidget,
|
||||
nsIPresShell* aShell,
|
||||
nsIntPoint& aTargetPt)
|
||||
nsPoint& aTargetPt)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -1534,7 +1534,7 @@ nsEventListenerManager::PrepareToUseCaretPosition(nsIWidget* aEventWidget,
|
|||
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);
|
||||
|
@ -1548,7 +1548,7 @@ void
|
|||
nsEventListenerManager::GetCoordinatesFor(nsIDOMElement *aCurrentEl,
|
||||
nsPresContext *aPresContext,
|
||||
nsIPresShell *aPresShell,
|
||||
nsIntPoint& aTargetPt)
|
||||
nsPoint& aTargetPt)
|
||||
{
|
||||
nsCOMPtr<nsIContent> focusedContent(do_QueryInterface(aCurrentEl));
|
||||
aPresShell->ScrollContentIntoView(focusedContent,
|
||||
|
|
|
@ -181,9 +181,9 @@ protected:
|
|||
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);
|
||||
|
||||
|
|
|
@ -313,7 +313,7 @@ public:
|
|||
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();
|
||||
|
||||
|
@ -385,7 +385,7 @@ nsMouseWheelTransaction::OnEvent(nsEvent* aEvent)
|
|||
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();
|
||||
|
@ -416,13 +416,13 @@ nsMouseWheelTransaction::OnEvent(nsEvent* aEvent)
|
|||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
@ -1885,8 +1885,8 @@ nsEventStateManager::BeginTrackingDragGesture(nsPresContext* aPresContext,
|
|||
{
|
||||
// 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();
|
||||
|
||||
|
@ -1929,7 +1929,7 @@ nsEventStateManager::FillInEventFromGestureDown(nsMouseEvent* aEvent)
|
|||
// 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;
|
||||
|
@ -1990,10 +1990,10 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
// 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
|
||||
|
|
|
@ -385,7 +385,7 @@ protected:
|
|||
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
|
||||
|
|
|
@ -437,25 +437,25 @@ nsQueryContentEventHandler::QueryRectFor(nsQueryContentEvent* aEvent,
|
|||
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;
|
||||
}
|
||||
|
@ -504,11 +504,9 @@ nsQueryContentEventHandler::OnQueryCaretRect(nsQueryContentEvent* aEvent)
|
|||
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;
|
||||
|
|
|
@ -5495,7 +5495,7 @@ nsDocShell::CaptureState()
|
|||
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);
|
||||
}
|
||||
|
@ -5820,7 +5820,7 @@ nsDocShell::RestoreFromHistory()
|
|||
// 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));
|
||||
|
@ -5876,7 +5876,7 @@ nsDocShell::RestoreFromHistory()
|
|||
}
|
||||
|
||||
// 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
|
||||
|
@ -6450,7 +6450,7 @@ nsDocShell::SetupNewViewer(nsIContentViewer * 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;
|
||||
|
|
|
@ -620,7 +620,7 @@ protected:
|
|||
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;
|
||||
|
@ -633,7 +633,7 @@ protected:
|
|||
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;
|
||||
|
|
|
@ -7,18 +7,18 @@ 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;
|
||||
|
||||
|
@ -55,8 +55,8 @@ interface nsIContentViewer : nsISupports
|
|||
|
||||
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
|
||||
|
|
|
@ -51,14 +51,14 @@ 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 */
|
||||
|
@ -81,8 +81,8 @@ interface nsISHEntry : nsIHistoryEntry
|
|||
* 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
|
||||
|
|
|
@ -536,14 +536,14 @@ nsSHEntry::GetWindowState(nsISupports **aState)
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -110,7 +110,7 @@ private:
|
|||
nsCOMPtr<nsISupports> mCacheKey;
|
||||
nsISHEntry * mParent; // weak reference
|
||||
nsCOMPtr<nsISupports> mWindowState;
|
||||
nsIntRect mViewerBounds;
|
||||
nsRect mViewerBounds;
|
||||
nsCOMArray<nsIDocShellTreeItem> mChildShells;
|
||||
nsCOMPtr<nsISupportsArray> mRefreshURIList;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
|
|
|
@ -76,12 +76,12 @@ function testElement(element)
|
|||
checkClientState(element, borderLeft, borderTop, clientWidth, clientHeight, element.id);
|
||||
|
||||
var boundingrect = element.getBoundingClientRect();
|
||||
is(Math.round(boundingrect.width), borderLeft + paddingLeft + width + paddingRight + borderRight,
|
||||
is(Math.round(boundingrect.width), borderLeft + paddingLeft + width + paddingRight + borderLeft,
|
||||
element.id + " bounding rect width");
|
||||
is(Math.round(boundingrect.height), borderTop + paddingTop + height + paddingBottom + borderBottom,
|
||||
element.id + " bounding rect height");
|
||||
is(Math.round(boundingrect.right - boundingrect.left),
|
||||
borderLeft + paddingLeft + width + paddingRight + borderRight,
|
||||
borderLeft + paddingLeft + width + paddingRight + borderLeft,
|
||||
element.id + " bounding rect right");
|
||||
is(Math.round(boundingrect.bottom - boundingrect.top),
|
||||
borderTop + paddingTop + height + paddingBottom + borderBottom,
|
||||
|
|
|
@ -1983,23 +1983,18 @@ nsEditor::QueryComposition(nsTextEventReply* aReply)
|
|||
// 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)
|
||||
{
|
||||
|
|
|
@ -1737,15 +1737,11 @@ nsPlaintextEditor::SetCompositionString(const nsAString& aCompositionString, nsI
|
|||
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();
|
||||
|
|
|
@ -94,7 +94,7 @@ EmbedContextMenuInfo::EmbedContextMenuInfo(EmbedPrivate *aOwner) : mCtxFrameNum(
|
|||
mNSHHTMLElementSc = nsnull;
|
||||
mCtxEvent = nsnull;
|
||||
mEventNode = nsnull;
|
||||
mFormRect = nsIntRect(0,0,0,0);
|
||||
mFormRect = nsRect(0,0,0,0);
|
||||
}
|
||||
|
||||
EmbedContextMenuInfo::~EmbedContextMenuInfo(void)
|
||||
|
|
|
@ -84,7 +84,7 @@ public:
|
|||
nsCOMPtr<nsIDOMNode> mEventNode;
|
||||
nsCOMPtr<nsIDOMEventTarget> mEventTarget;
|
||||
nsCOMPtr<nsIDOMDocument>mCtxDocument;
|
||||
nsIntRect mFormRect;
|
||||
nsRect mFormRect;
|
||||
nsCOMPtr<nsIDOMWindow> mCtxDomWindow;
|
||||
nsCOMPtr<nsIDOMEvent> mCtxEvent;
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> mNSHHTMLElement;
|
||||
|
|
|
@ -1482,8 +1482,8 @@ ChromeTooltipListener::sTooltipCallback(nsITimer *aTimer,
|
|||
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,
|
||||
|
|
|
@ -1129,7 +1129,7 @@ NS_IMETHODIMP nsWebBrowser::Create()
|
|||
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,
|
||||
|
@ -1317,7 +1317,7 @@ NS_IMETHODIMP nsWebBrowser::GetPositionAndSize(PRInt32* aX, PRInt32* aY,
|
|||
{
|
||||
if(mInternalWidget)
|
||||
{
|
||||
nsIntRect bounds;
|
||||
nsRect bounds;
|
||||
NS_ENSURE_SUCCESS(mInternalWidget->GetBounds(bounds), NS_ERROR_FAILURE);
|
||||
|
||||
if(aX)
|
||||
|
|
|
@ -513,7 +513,7 @@ static HWND CreateControl(LPCTSTR aType,
|
|||
HWND aHdlg,
|
||||
int aId,
|
||||
const nsAString& aStr,
|
||||
const nsIntRect& aRect)
|
||||
const nsRect& aRect)
|
||||
{
|
||||
nsCAutoString str;
|
||||
if (NS_FAILED(NS_CopyUnicodeToNative(aStr, str)))
|
||||
|
@ -541,7 +541,7 @@ static HWND CreateRadioBtn(HINSTANCE aHInst,
|
|||
HWND aHdlg,
|
||||
int aId,
|
||||
const char* aStr,
|
||||
const nsIntRect& aRect)
|
||||
const nsRect& aRect)
|
||||
{
|
||||
nsString cStr;
|
||||
cStr.AssignWithConversion(aStr);
|
||||
|
@ -554,7 +554,7 @@ 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);
|
||||
}
|
||||
|
@ -665,7 +665,7 @@ static UINT CALLBACK PrintHookProc(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM
|
|||
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
|
||||
//
|
||||
|
|
|
@ -46,9 +46,9 @@
|
|||
#include "nsColor.h"
|
||||
|
||||
struct nsRect;
|
||||
struct nsIntSize;
|
||||
struct nsSize;
|
||||
struct nsFont;
|
||||
struct nsIntMargin;
|
||||
struct nsMargin;
|
||||
class nsPresContext;
|
||||
class nsIRenderingContext;
|
||||
class nsIDeviceContext;
|
||||
|
@ -57,9 +57,9 @@ 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 \
|
||||
|
@ -91,7 +91,7 @@ public:
|
|||
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
|
||||
|
@ -105,7 +105,7 @@ public:
|
|||
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
|
||||
|
@ -130,7 +130,7 @@ public:
|
|||
NS_IMETHOD GetMinimumWidgetSize(nsIRenderingContext* aContext,
|
||||
nsIFrame* aFrame,
|
||||
PRUint8 aWidgetType,
|
||||
nsIntSize* aResult,
|
||||
nsSize* aResult,
|
||||
PRBool* aIsOverridable)=0;
|
||||
|
||||
NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
|
||||
|
|
|
@ -105,6 +105,7 @@ struct nsMargin {
|
|||
return *this;}
|
||||
};
|
||||
|
||||
#ifdef NS_COORD_IS_FLOAT
|
||||
struct nsIntMargin {
|
||||
PRInt32 top, right, bottom, left;
|
||||
|
||||
|
@ -114,25 +115,9 @@ struct nsIntMargin {
|
|||
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 */
|
||||
|
|
|
@ -81,6 +81,7 @@ struct nsPoint {
|
|||
}
|
||||
};
|
||||
|
||||
#ifdef NS_COORD_IS_FLOAT
|
||||
struct nsIntPoint {
|
||||
PRInt32 x, y;
|
||||
|
||||
|
@ -89,29 +90,50 @@ struct 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 */
|
||||
|
|
|
@ -47,8 +47,6 @@
|
|||
#include "gfxCore.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
|
||||
struct nsIntRect;
|
||||
|
||||
struct NS_GFX nsRect {
|
||||
nscoord x, y;
|
||||
nscoord width, height;
|
||||
|
@ -170,6 +168,26 @@ struct NS_GFX nsRect {
|
|||
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); }
|
||||
|
@ -181,14 +199,9 @@ struct NS_GFX nsRect {
|
|||
// 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;
|
||||
|
@ -196,10 +209,6 @@ struct NS_GFX nsIntRect {
|
|||
// 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;
|
||||
}
|
||||
|
@ -209,74 +218,11 @@ struct NS_GFX nsIntRect {
|
|||
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.
|
||||
|
@ -291,86 +237,13 @@ struct NS_GFX nsIntRect {
|
|||
// '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
|
||||
|
|
|
@ -71,6 +71,7 @@ struct nsSize {
|
|||
return *this;}
|
||||
};
|
||||
|
||||
#ifdef NS_COORD_IS_FLOAT
|
||||
struct nsIntSize {
|
||||
PRInt32 width, height;
|
||||
|
||||
|
@ -78,16 +79,10 @@ struct 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 */
|
||||
|
|
|
@ -173,6 +173,52 @@ void nsRect::Deflate(const nsMargin &aMargin)
|
|||
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
|
||||
|
||||
|
@ -198,8 +244,7 @@ FILE* operator<<(FILE* out, const nsRect& rect)
|
|||
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)
|
||||
|
@ -269,4 +314,6 @@ PRBool nsIntRect::UnionRect(const nsIntRect &aRect1, const nsIntRect &aRect2)
|
|||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // DEBUG
|
||||
|
|
|
@ -220,7 +220,7 @@ nsThebesImage::GetAlphaLineStride()
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -245,7 +245,7 @@ PRBool
|
|||
nsThebesImage::GetIsImageComplete()
|
||||
{
|
||||
if (!mImageComplete)
|
||||
mImageComplete = (mDecoded == nsIntRect(0, 0, mWidth, mHeight));
|
||||
mImageComplete = (mDecoded == nsRect(0, 0, mWidth, mHeight));
|
||||
return mImageComplete;
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
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();
|
||||
|
||||
|
@ -159,7 +159,7 @@ protected:
|
|||
PRInt32 mWidth;
|
||||
PRInt32 mHeight;
|
||||
PRInt32 mStride;
|
||||
nsIntRect mDecoded;
|
||||
nsRect mDecoded;
|
||||
PRPackedBool mImageComplete;
|
||||
PRPackedBool mSinglePixel;
|
||||
PRPackedBool mFormatChanged;
|
||||
|
|
|
@ -780,7 +780,7 @@ nsThebesRenderingContext::DrawTile(imgIContainer *aImage,
|
|||
aImage->GetCurrentFrame(getter_AddRefs(imgFrame));
|
||||
if (!imgFrame) return NS_ERROR_FAILURE;
|
||||
|
||||
nsIntRect imgFrameRect;
|
||||
nsRect imgFrameRect;
|
||||
imgFrame->GetRect(imgFrameRect);
|
||||
|
||||
nsCOMPtr<nsIImage> img(do_GetInterface(imgFrame));
|
||||
|
|
|
@ -1525,13 +1525,12 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
|||
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;
|
||||
|
||||
|
@ -1603,10 +1602,10 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
|||
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) {
|
||||
|
@ -1912,9 +1911,9 @@ nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
|
|||
} 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -368,7 +368,7 @@ private:
|
|||
*/
|
||||
nsresult InitInternal(nsIWidget* aParentWidget,
|
||||
nsISupports *aState,
|
||||
const nsIntRect& aBounds,
|
||||
const nsRect& aBounds,
|
||||
PRBool aDoCreation,
|
||||
PRBool aInPrintPreview,
|
||||
PRBool aNeedMakeCX = PR_TRUE);
|
||||
|
@ -666,7 +666,7 @@ DocumentViewerImpl::GetContainer(nsISupports** aResult)
|
|||
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::Init(nsIWidget* aParentWidget,
|
||||
const nsIntRect& aBounds)
|
||||
const nsRect& aBounds)
|
||||
{
|
||||
nsresult rv = CreateDeviceContext(aParentWidget);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -709,7 +709,7 @@ DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow, PRBool aReena
|
|||
mPresShell->BeginObservingDocument();
|
||||
|
||||
// Initialize our view manager
|
||||
nsIntRect bounds;
|
||||
nsRect bounds;
|
||||
mWindow->GetBounds(bounds);
|
||||
|
||||
nscoord width = mPresContext->DeviceContext()->UnscaledAppUnitsPerDevPixel() * bounds.width;
|
||||
|
@ -805,7 +805,7 @@ DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow, PRBool aReena
|
|||
nsresult
|
||||
DocumentViewerImpl::InitInternal(nsIWidget* aParentWidget,
|
||||
nsISupports *aState,
|
||||
const nsIntRect& aBounds,
|
||||
const nsRect& aBounds,
|
||||
PRBool aDoCreation,
|
||||
PRBool aInPrintPreview,
|
||||
PRBool aNeedMakeCX /*= PR_TRUE*/)
|
||||
|
@ -1247,7 +1247,7 @@ DocumentViewerImpl::Open(nsISupports *aState, nsISHEntry *aSHEntry)
|
|||
if (!container)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
nsIntRect bounds;
|
||||
nsRect bounds;
|
||||
mWindow->GetBounds(bounds);
|
||||
|
||||
nsresult rv = InitInternal(mParentWidget, aState, bounds, PR_FALSE, PR_FALSE);
|
||||
|
@ -1736,7 +1736,7 @@ DocumentViewerImpl::GetPresContext(nsPresContext** aResult)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::GetBounds(nsIntRect& aResult)
|
||||
DocumentViewerImpl::GetBounds(nsRect& aResult)
|
||||
{
|
||||
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
|
||||
NS_PRECONDITION(mWindow, "null window");
|
||||
|
@ -1791,7 +1791,7 @@ DocumentViewerImpl::SetPreviousViewer(nsIContentViewer* aViewer)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::SetBounds(const nsIntRect& aBounds)
|
||||
DocumentViewerImpl::SetBounds(const nsRect& aBounds)
|
||||
{
|
||||
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
|
@ -1898,7 +1898,7 @@ DocumentViewerImpl::Show(void)
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsIntRect tbounds;
|
||||
nsRect tbounds;
|
||||
mParentWidget->GetBounds(tbounds);
|
||||
|
||||
rv = MakeWindow(nsSize(mPresContext->DevPixelsToAppUnits(tbounds.width),
|
||||
|
@ -4085,7 +4085,7 @@ NS_IMETHODIMP DocumentViewerImpl::SetPageMode(PRBool aPageMode, nsIPrintSettings
|
|||
// 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) {
|
||||
|
|
|
@ -102,10 +102,11 @@ 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
|
||||
|
@ -738,8 +739,8 @@ public:
|
|||
*/
|
||||
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
|
||||
|
@ -757,8 +758,8 @@ public:
|
|||
* 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);
|
||||
|
|
|
@ -184,7 +184,7 @@ NS_IMETHODIMP nsImageLoader::OnStopFrame(imgIRequest *aRequest,
|
|||
|
||||
NS_IMETHODIMP nsImageLoader::FrameChanged(imgIContainer *aContainer,
|
||||
gfxIImageFrame *newframe,
|
||||
nsIntRect *dirtyRect)
|
||||
nsRect * dirtyRect)
|
||||
{
|
||||
if (!mFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -194,7 +194,12 @@ NS_IMETHODIMP nsImageLoader::FrameChanged(imgIContainer *aContainer,
|
|||
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);
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
|
||||
// imgIContainerObserver (override nsStubImageDecoderObserver)
|
||||
NS_IMETHOD FrameChanged(imgIContainer *aContainer, gfxIImageFrame *newframe,
|
||||
nsIntRect *dirtyRect);
|
||||
nsRect * dirtyRect);
|
||||
|
||||
void Init(nsIFrame *aFrame, nsPresContext *aPresContext,
|
||||
PRBool aReflowOnLoad);
|
||||
|
|
|
@ -816,11 +816,11 @@ nsLayoutUtils::GetEventCoordinatesForNearestView(nsEvent* aEvent,
|
|||
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;
|
||||
|
@ -839,9 +839,9 @@ nsLayoutUtils::TranslateWidgetToView(nsPresContext* aPresContext,
|
|||
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) {
|
||||
|
@ -1986,7 +1986,7 @@ nsLayoutUtils::IntrinsicForContainer(nsIRenderingContext *aRenderingContext,
|
|||
|
||||
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()->
|
||||
|
|
|
@ -565,7 +565,7 @@ public:
|
|||
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),
|
||||
|
|
|
@ -887,12 +887,12 @@ public:
|
|||
|
||||
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
|
||||
|
||||
|
@ -1097,8 +1097,8 @@ protected:
|
|||
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
|
||||
|
@ -5158,8 +5158,8 @@ 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)
|
||||
|
@ -5168,7 +5168,8 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
|
|||
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;
|
||||
|
@ -5272,8 +5273,8 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
|
|||
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.
|
||||
|
@ -5297,11 +5298,12 @@ PresShell::RenderNode(nsIDOMNode* aNode,
|
|||
|
||||
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();
|
||||
|
@ -5319,8 +5321,8 @@ PresShell::RenderNode(nsIDOMNode* aNode,
|
|||
|
||||
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.
|
||||
|
@ -6707,37 +6709,6 @@ LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg,
|
|||
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)
|
||||
|
@ -6765,7 +6736,7 @@ CompareTrees(nsPresContext* aFirstPresContext, nsIFrame* aFirstFrame,
|
|||
}
|
||||
}
|
||||
|
||||
nsIntRect r1, r2;
|
||||
nsRect r1, r2;
|
||||
nsIView* v1, *v2;
|
||||
for (;;) {
|
||||
if (((nsnull == k1) && (nsnull != k2)) ||
|
||||
|
|
|
@ -72,12 +72,12 @@ public:
|
|||
// 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; }
|
||||
|
||||
|
@ -1462,7 +1462,7 @@ NS_IMETHODIMP nsBulletFrame::OnStartContainer(imgIRequest *aRequest,
|
|||
|
||||
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
|
||||
|
@ -1493,7 +1493,7 @@ NS_IMETHODIMP nsBulletFrame::OnStopDecode(imgIRequest *aRequest,
|
|||
|
||||
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.
|
||||
|
@ -1551,7 +1551,7 @@ NS_IMETHODIMP nsBulletListener::OnStartContainer(imgIRequest *aRequest,
|
|||
|
||||
NS_IMETHODIMP nsBulletListener::OnDataAvailable(imgIRequest *aRequest,
|
||||
gfxIImageFrame *aFrame,
|
||||
const nsIntRect *aRect)
|
||||
const nsRect *aRect)
|
||||
{
|
||||
if (!mFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -1571,7 +1571,7 @@ NS_IMETHODIMP nsBulletListener::OnStopDecode(imgIRequest *aRequest,
|
|||
|
||||
NS_IMETHODIMP nsBulletListener::FrameChanged(imgIContainer *aContainer,
|
||||
gfxIImageFrame *newframe,
|
||||
nsIntRect *dirtyRect)
|
||||
nsRect * dirtyRect)
|
||||
{
|
||||
if (!mFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -82,13 +82,13 @@ public:
|
|||
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,
|
||||
|
|
|
@ -584,15 +584,16 @@ nsIFrame::GetUsedBorder() const
|
|||
|
||||
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();
|
||||
|
@ -615,15 +616,14 @@ nsIFrame::GetUsedPadding() const
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
@ -816,9 +816,9 @@ void nsDisplaySelectionOverlay::Paint(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -3067,13 +3067,13 @@ nsFrame::IntrinsicWidthOffsets(nsIRenderingContext* aRenderingContext)
|
|||
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)) {
|
||||
|
@ -3184,16 +3184,15 @@ nsFrame::ComputeSize(nsIRenderingContext *aRenderingContext,
|
|||
|
||||
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);
|
||||
&size, &canOverride);
|
||||
|
||||
nsSize size;
|
||||
size.width = presContext->DevPixelsToAppUnits(widget.width);
|
||||
size.height = presContext->DevPixelsToAppUnits(widget.height);
|
||||
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;
|
||||
|
@ -3550,7 +3549,9 @@ nsIntRect nsIFrame::GetScreenRectExternal() const
|
|||
|
||||
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
|
||||
|
@ -3570,6 +3571,7 @@ nsRect nsIFrame::GetScreenRectInAppUnits() const
|
|||
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);
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ public:
|
|||
virtual void ReflowCallbackCanceled();
|
||||
|
||||
protected:
|
||||
nsIntSize GetMargin();
|
||||
nsSize GetMargin();
|
||||
PRBool IsInline() { return mIsInline; }
|
||||
nsresult ShowDocShell();
|
||||
nsresult CreateViewAndWidget(nsContentType aContentType);
|
||||
|
@ -803,9 +803,9 @@ nsSubDocumentFrame::HideViewer()
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
@ -919,7 +919,7 @@ nsSubDocumentFrame::ShowDocShell()
|
|||
|
||||
// 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);
|
||||
|
||||
|
|
|
@ -744,7 +744,7 @@ nsHTMLFramesetFrame* nsHTMLFramesetFrame::GetFramesetParent(nsIFrame* aChild)
|
|||
// 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
|
||||
|
@ -754,8 +754,7 @@ void nsHTMLFramesetFrame::GetSizeOfChildAt(PRInt32 aIndexInParent,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -769,7 +768,7 @@ void nsHTMLFramesetFrame::GetSizeOfChild(nsIFrame* aChild,
|
|||
for (nsIFrame* child = mFrames.FirstChild(); child;
|
||||
child = child->GetNextSibling()) {
|
||||
if (aChild == child) {
|
||||
nsIntPoint ignore;
|
||||
nsPoint ignore;
|
||||
GetSizeOfChildAt(i, aSize, ignore);
|
||||
return;
|
||||
}
|
||||
|
@ -864,7 +863,7 @@ nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild,
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsPoint& aOffset,
|
||||
nsSize& aSize,
|
||||
nsIntPoint* aCellIndex)
|
||||
nsPoint* aCellIndex)
|
||||
{
|
||||
// reflow the child
|
||||
nsHTMLReflowState reflowState(aPresContext, aReflowState, aChild, aSize);
|
||||
|
@ -1069,7 +1068,7 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
|
|||
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
|
||||
|
|
|
@ -127,7 +127,7 @@ public:
|
|||
|
||||
void GetSizeOfChildAt(PRInt32 aIndexInParent,
|
||||
nsSize& aSize,
|
||||
nsIntPoint& aCellIndex);
|
||||
nsPoint& aCellIndex);
|
||||
|
||||
static nsHTMLFramesetFrame* GetFramesetParent(nsIFrame* aChild);
|
||||
|
||||
|
@ -225,7 +225,7 @@ protected:
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsPoint& aOffset,
|
||||
nsSize& aSize,
|
||||
nsIntPoint* aCellIndex = 0);
|
||||
nsPoint* aCellIndex = 0);
|
||||
|
||||
PRBool CanResize(PRBool aVertical,
|
||||
PRBool aLeft);
|
||||
|
@ -256,7 +256,7 @@ protected:
|
|||
|
||||
nsHTMLFramesetBorderFrame* mDragger;
|
||||
nsFramesetDrag mDrag;
|
||||
nsIntPoint mFirstDragPoint;
|
||||
nsPoint mFirstDragPoint;
|
||||
PRInt32 mPrevNeighborOrigSize; // used during resize
|
||||
PRInt32 mNextNeighborOrigSize;
|
||||
PRInt32 mMinDrag;
|
||||
|
|
|
@ -59,7 +59,7 @@ nsHTMLCanvasFrame::~nsHTMLCanvasFrame()
|
|||
{
|
||||
}
|
||||
|
||||
nsIntSize
|
||||
nsSize
|
||||
nsHTMLCanvasFrame::GetCanvasSize()
|
||||
{
|
||||
PRUint32 w, h;
|
||||
|
@ -76,7 +76,7 @@ nsHTMLCanvasFrame::GetCanvasSize()
|
|||
h = w = 1;
|
||||
}
|
||||
|
||||
return nsIntSize(w, h);
|
||||
return nsSize(w, h);
|
||||
}
|
||||
|
||||
/* virtual */ nscoord
|
||||
|
@ -102,9 +102,7 @@ nsHTMLCanvasFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
|
|||
/* virtual */ nsSize
|
||||
nsHTMLCanvasFrame::GetIntrinsicRatio()
|
||||
{
|
||||
nsIntSize size(GetCanvasSize());
|
||||
return nsSize(nsPresContext::CSSPixelsToAppUnits(size.width),
|
||||
nsPresContext::CSSPixelsToAppUnits(size.height));
|
||||
return GetCanvasSize();
|
||||
}
|
||||
|
||||
/* virtual */ nsSize
|
||||
|
@ -113,13 +111,13 @@ nsHTMLCanvasFrame::ComputeSize(nsIRenderingContext *aRenderingContext,
|
|||
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,
|
||||
|
@ -199,7 +197,7 @@ nsHTMLCanvasFrame::PaintCanvas(nsIRenderingContext& aRenderingContext,
|
|||
if (inner.width == 0 || inner.height == 0)
|
||||
return;
|
||||
|
||||
nsIntSize canvasSize(GetCanvasSize());
|
||||
nsSize canvasSize = GetCanvasSize();
|
||||
nsSize sizeAppUnits(PresContext()->DevPixelsToAppUnits(canvasSize.width),
|
||||
PresContext()->DevPixelsToAppUnits(canvasSize.height));
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ public:
|
|||
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);
|
||||
|
|
|
@ -1829,15 +1829,14 @@ nsCSSOffsetState::InitOffsets(nscoord aContainingBlockWidth,
|
|||
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;
|
||||
|
@ -1850,18 +1849,17 @@ nsCSSOffsetState::InitOffsets(nscoord 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;
|
||||
|
|
|
@ -303,7 +303,7 @@ nsImageFrame::UpdateIntrinsicSize(imgIContainer* aImage)
|
|||
PRBool intrinsicSizeChanged = PR_FALSE;
|
||||
|
||||
if (aImage) {
|
||||
nsIntSize imageSizeInPx;
|
||||
nsSize imageSizeInPx;
|
||||
aImage->GetWidth(&imageSizeInPx.width);
|
||||
aImage->GetHeight(&imageSizeInPx.height);
|
||||
nsSize newSize(nsPresContext::CSSPixelsToAppUnits(imageSizeInPx.width),
|
||||
|
@ -387,7 +387,7 @@ nsImageFrame::IsPendingLoad(imgIContainer* aContainer) const
|
|||
}
|
||||
|
||||
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
|
||||
|
@ -532,7 +532,7 @@ nsImageFrame::OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage)
|
|||
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
|
||||
|
@ -644,7 +644,7 @@ nsImageFrame::OnStopDecode(imgIRequest *aRequest,
|
|||
nsresult
|
||||
nsImageFrame::FrameChanged(imgIContainer *aContainer,
|
||||
gfxIImageFrame *aNewFrame,
|
||||
nsIntRect *aDirtyRect)
|
||||
nsRect *aDirtyRect)
|
||||
{
|
||||
if (!GetStyleVisibility()->IsVisible()) {
|
||||
return NS_OK;
|
||||
|
@ -1838,7 +1838,7 @@ NS_IMETHODIMP nsImageListener::OnStartContainer(imgIRequest *aRequest,
|
|||
|
||||
NS_IMETHODIMP nsImageListener::OnDataAvailable(imgIRequest *aRequest,
|
||||
gfxIImageFrame *aFrame,
|
||||
const nsIntRect *aRect)
|
||||
const nsRect *aRect)
|
||||
{
|
||||
if (!mFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -1858,7 +1858,7 @@ NS_IMETHODIMP nsImageListener::OnStopDecode(imgIRequest *aRequest,
|
|||
|
||||
NS_IMETHODIMP nsImageListener::FrameChanged(imgIContainer *aContainer,
|
||||
gfxIImageFrame *newframe,
|
||||
nsIntRect * dirtyRect)
|
||||
nsRect * dirtyRect)
|
||||
{
|
||||
if (!mFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -74,12 +74,12 @@ public:
|
|||
// 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; }
|
||||
|
||||
|
@ -225,13 +225,13 @@ protected:
|
|||
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
|
||||
|
@ -268,7 +268,7 @@ private:
|
|||
* 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;
|
||||
|
||||
|
|
|
@ -523,6 +523,10 @@ private:
|
|||
|
||||
};
|
||||
|
||||
#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
|
||||
|
||||
|
@ -912,7 +916,7 @@ nsObjectFrame::FixupWindow(const nsSize& aSize)
|
|||
|
||||
PRBool windowless = (window->type == nsPluginWindowType_Drawable);
|
||||
|
||||
nsIntPoint origin = GetWindowOriginInPixels(windowless);
|
||||
nsPoint origin = GetWindowOriginInPixels(windowless);
|
||||
|
||||
window->x = origin.x;
|
||||
window->y = origin.y;
|
||||
|
@ -959,7 +963,7 @@ nsObjectFrame::CallSetWindow()
|
|||
|
||||
PRBool windowless = (window->type == nsPluginWindowType_Drawable);
|
||||
|
||||
nsIntPoint origin = GetWindowOriginInPixels(windowless);
|
||||
nsPoint origin = GetWindowOriginInPixels(windowless);
|
||||
|
||||
window->x = origin.x;
|
||||
window->y = origin.y;
|
||||
|
@ -1012,7 +1016,7 @@ nsObjectFrame::IsHidden(PRBool aCheckVisibilityStyle) const
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
nsIntPoint nsObjectFrame::GetWindowOriginInPixels(PRBool aWindowless)
|
||||
nsPoint nsObjectFrame::GetWindowOriginInPixels(PRBool aWindowless)
|
||||
{
|
||||
nsIView * parentWithView;
|
||||
nsPoint origin(0,0);
|
||||
|
@ -1041,8 +1045,10 @@ nsIntPoint nsObjectFrame::GetWindowOriginInPixels(PRBool aWindowless)
|
|||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -1421,7 +1427,7 @@ nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext,
|
|||
// 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
|
||||
|
@ -1515,7 +1521,7 @@ nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext,
|
|||
// 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
|
||||
|
@ -3704,8 +3710,8 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
|
|||
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
|
||||
|
@ -3978,8 +3984,12 @@ void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect)
|
|||
// 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);
|
||||
|
@ -4008,15 +4018,18 @@ void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect, HDC ndc)
|
|||
|
||||
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;
|
||||
|
@ -4035,15 +4048,18 @@ void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect, HPS aHPS)
|
|||
|
||||
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;
|
||||
|
@ -4528,6 +4544,17 @@ 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
|
||||
|
||||
|
@ -4608,13 +4635,13 @@ WindowRef nsPluginInstanceOwner::FixUpPluginWindow(PRInt32 inPaintState)
|
|||
// 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;
|
||||
|
|
|
@ -175,7 +175,7 @@ protected:
|
|||
|
||||
void NotifyContentObjectWrapper();
|
||||
|
||||
nsIntPoint GetWindowOriginInPixels(PRBool aWindowless);
|
||||
nsPoint GetWindowOriginInPixels(PRBool aWindowless);
|
||||
|
||||
static void PaintPrintPlugin(nsIFrame* aFrame,
|
||||
nsIRenderingContext* aRenderingContext,
|
||||
|
@ -197,7 +197,7 @@ protected:
|
|||
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
|
||||
|
|
|
@ -545,8 +545,9 @@ nsPageFrame::PaintPageContent(nsIRenderingContext& aRenderingContext,
|
|||
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());
|
||||
|
|
|
@ -199,13 +199,13 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
// 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);
|
||||
|
||||
|
@ -213,11 +213,11 @@ nsSimplePageSequenceFrame::Reflow(nsPresContext* aPresContext,
|
|||
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);
|
||||
|
@ -700,8 +700,9 @@ nsSimplePageSequenceFrame::PaintPageSequence(nsIRenderingContext& aRenderingCont
|
|||
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.
|
||||
|
|
|
@ -2201,8 +2201,8 @@ nsPrintEngine::DoPrint(nsPrintObject * aPO)
|
|||
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 +
|
||||
|
|
|
@ -127,7 +127,8 @@ 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();
|
||||
}
|
||||
|
|
|
@ -700,7 +700,8 @@ nsSVGForeignObjectFrame::InvalidateDirtyRect(nsSVGOuterSVGFrame* aOuter,
|
|||
|
||||
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);
|
||||
|
||||
|
|
|
@ -123,9 +123,9 @@ nsSVGIntegrationUtils::ComputeFrameEffectsRect(nsIFrame* aFrame,
|
|||
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);
|
||||
}
|
||||
|
@ -146,9 +146,9 @@ nsSVGIntegrationUtils::GetInvalidAreaForChangedSource(nsIFrame* aFrame,
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -169,9 +169,9 @@ nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(nsIFrame* aFrame,
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,8 @@ public:
|
|||
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);
|
||||
|
@ -289,7 +290,8 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(nsIRenderingContext* 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);
|
||||
|
@ -314,7 +316,8 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(nsIRenderingContext* aCtx,
|
|||
/* 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);
|
||||
|
|
|
@ -560,7 +560,7 @@ nsSVGOuterSVGFrame::Paint(nsIRenderingContext& aRenderingContext,
|
|||
PRTime start = PR_Now();
|
||||
#endif
|
||||
|
||||
nsIntRect dirtyPxRect(nsRect::ToOutsidePixels(dirtyRect, PresContext()->AppUnitsPerDevPixel()));
|
||||
dirtyRect.ScaleRoundOut(1.0f / PresContext()->AppUnitsPerDevPixel());
|
||||
|
||||
nsSVGRenderState ctx(&aRenderingContext);
|
||||
|
||||
|
@ -575,7 +575,7 @@ nsSVGOuterSVGFrame::Paint(nsIRenderingContext& aRenderingContext,
|
|||
// paint children:
|
||||
for (nsIFrame* kid = mFrames.FirstChild(); kid;
|
||||
kid = kid->GetNextSibling()) {
|
||||
nsSVGUtils::PaintChildWithEffects(&ctx, &dirtyPxRect, kid);
|
||||
nsSVGUtils::PaintChildWithEffects(&ctx, &dirtyRect, kid);
|
||||
}
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
|
|
|
@ -585,7 +585,8 @@ 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)
|
||||
|
@ -601,7 +602,8 @@ nsSVGUtils::FindFilterInvalidation(nsIFrame *aFrame, const nsRect& aRect)
|
|||
aFrame = aFrame->GetParent();
|
||||
}
|
||||
|
||||
return nsIntRect::ToAppUnits(rect, appUnitsPerDevPixel);
|
||||
rect.ScaleRoundOut(appUnitsPerDevPixel);
|
||||
return rect;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -995,7 +997,8 @@ nsSVGUtils::PaintChildWithEffects(nsSVGRenderState *aContext,
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -724,7 +724,7 @@ protected:
|
|||
// 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;
|
||||
|
|
|
@ -344,7 +344,7 @@ nsBox::GetBorder(nsMargin& aMargin)
|
|||
// 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);
|
||||
|
@ -368,7 +368,7 @@ nsBox::GetPadding(nsMargin& aMargin)
|
|||
// 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(),
|
||||
|
@ -728,7 +728,7 @@ nsIBox::AddCSSMinSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize)
|
|||
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,
|
||||
|
|
|
@ -159,9 +159,10 @@ nsBoxObject::GetPresShell(PRBool aFlushLayout)
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -240,7 +241,7 @@ nsBoxObject::GetScreenPosition(nsIntPoint& aPoint)
|
|||
NS_IMETHODIMP
|
||||
nsBoxObject::GetX(PRInt32* aResult)
|
||||
{
|
||||
nsIntRect rect;
|
||||
nsRect rect;
|
||||
GetOffsetRect(rect);
|
||||
*aResult = rect.x;
|
||||
return NS_OK;
|
||||
|
@ -249,7 +250,7 @@ nsBoxObject::GetX(PRInt32* aResult)
|
|||
NS_IMETHODIMP
|
||||
nsBoxObject::GetY(PRInt32* aResult)
|
||||
{
|
||||
nsIntRect rect;
|
||||
nsRect rect;
|
||||
GetOffsetRect(rect);
|
||||
*aResult = rect.y;
|
||||
return NS_OK;
|
||||
|
@ -258,7 +259,7 @@ nsBoxObject::GetY(PRInt32* aResult)
|
|||
NS_IMETHODIMP
|
||||
nsBoxObject::GetWidth(PRInt32* aResult)
|
||||
{
|
||||
nsIntRect rect;
|
||||
nsRect rect;
|
||||
GetOffsetRect(rect);
|
||||
*aResult = rect.width;
|
||||
return NS_OK;
|
||||
|
@ -267,7 +268,7 @@ nsBoxObject::GetWidth(PRInt32* aResult)
|
|||
NS_IMETHODIMP
|
||||
nsBoxObject::GetHeight(PRInt32* aResult)
|
||||
{
|
||||
nsIntRect rect;
|
||||
nsRect rect;
|
||||
GetOffsetRect(rect);
|
||||
*aResult = rect.height;
|
||||
return NS_OK;
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
|
||||
class nsIFrame;
|
||||
class nsIDocShell;
|
||||
struct nsIntRect;
|
||||
struct nsRect;
|
||||
|
||||
class nsBoxObject : public nsPIBoxObject
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ public:
|
|||
|
||||
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
|
||||
|
|
|
@ -542,7 +542,7 @@ NS_IMETHODIMP nsImageBoxFrame::OnStopDecode(imgIRequest *request,
|
|||
|
||||
NS_IMETHODIMP nsImageBoxFrame::FrameChanged(imgIContainer *container,
|
||||
gfxIImageFrame *newframe,
|
||||
nsIntRect *dirtyRect)
|
||||
nsRect * dirtyRect)
|
||||
{
|
||||
nsBoxLayoutState state(PresContext());
|
||||
this->Redraw(state);
|
||||
|
@ -590,7 +590,7 @@ NS_IMETHODIMP nsImageBoxListener::OnStopDecode(imgIRequest *request,
|
|||
|
||||
NS_IMETHODIMP nsImageBoxListener::FrameChanged(imgIContainer *container,
|
||||
gfxIImageFrame *newframe,
|
||||
nsIntRect *dirtyRect)
|
||||
nsRect * dirtyRect)
|
||||
{
|
||||
if (!mFrame)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
const PRUnichar *statusArg);
|
||||
// imgIContainerObserver (override nsStubImageDecoderObserver)
|
||||
NS_IMETHOD FrameChanged(imgIContainer *container, gfxIImageFrame *newframe,
|
||||
nsIntRect *dirtyRect);
|
||||
nsRect * dirtyRect);
|
||||
|
||||
void SetFrame(nsImageBoxFrame *frame) { mFrame = frame; }
|
||||
|
||||
|
@ -123,7 +123,7 @@ public:
|
|||
const PRUnichar *statusArg);
|
||||
NS_IMETHOD FrameChanged(imgIContainer *container,
|
||||
gfxIImageFrame *newframe,
|
||||
nsIntRect *dirtyRect);
|
||||
nsRect * dirtyRect);
|
||||
|
||||
virtual ~nsImageBoxFrame();
|
||||
|
||||
|
|
|
@ -1000,8 +1000,7 @@ nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame)
|
|||
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;
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ protected:
|
|||
PRInt32 aMovement, PRInt8 aResizerDirection);
|
||||
|
||||
protected:
|
||||
nsIntRect mWidgetRect;
|
||||
nsRect mWidgetRect;
|
||||
}; // class nsResizerFrame
|
||||
|
||||
#endif /* nsResizerFrame_h___ */
|
||||
|
|
|
@ -290,9 +290,9 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollToElement(nsIDOMElement *child)
|
|||
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
|
||||
|
@ -390,9 +390,11 @@ NS_IMETHODIMP nsScrollBoxObject::EnsureElementIsVisible(nsIDOMElement *child)
|
|||
// 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;
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ nsTitleBarFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
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)
|
||||
|
@ -171,7 +171,7 @@ nsTitleBarFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ protected:
|
|||
|
||||
protected:
|
||||
PRBool mTrackingMouseMove;
|
||||
nsIntPoint mLastPoint;
|
||||
nsPoint mLastPoint;
|
||||
|
||||
|
||||
}; // class nsTitleBarFrame
|
||||
|
|
|
@ -308,7 +308,7 @@ nsXULPopupManager::GetMouseLocation(nsIDOMNode** aNode, PRInt32* aOffset)
|
|||
void
|
||||
nsXULPopupManager::SetTriggerEvent(nsIDOMEvent* aEvent, nsIContent* aPopup)
|
||||
{
|
||||
mCachedMousePoint = nsIntPoint(0, 0);
|
||||
mCachedMousePoint = nsPoint(0, 0);
|
||||
|
||||
nsCOMPtr<nsIDOMNSUIEvent> uiEvent = do_QueryInterface(aEvent);
|
||||
if (uiEvent) {
|
||||
|
@ -338,14 +338,15 @@ nsXULPopupManager::SetTriggerEvent(nsIDOMEvent* aEvent, nsIContent* aPopup)
|
|||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -998,7 +999,7 @@ nsXULPopupManager::FirePopupShowingEvent(nsIContent* aPopup,
|
|||
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.
|
||||
|
|
|
@ -658,7 +658,8 @@ nsTreeBodyFrame::GetSelectionRegion(nsIScriptableRegion **aRegion)
|
|||
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);
|
||||
|
@ -2126,15 +2127,14 @@ nsTreeBodyFrame::GetTwistyRect(PRInt32 aRowIndex,
|
|||
}
|
||||
|
||||
if (useTheme) {
|
||||
nsIntSize minTwistySizePx(0,0);
|
||||
nsSize minTwistySize(0,0);
|
||||
PRBool canOverride = PR_TRUE;
|
||||
theme->GetMinimumWidgetSize(&aRenderingContext, this, twistyDisplayData->mAppearance,
|
||||
&minTwistySizePx, &canOverride);
|
||||
&minTwistySize, &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);
|
||||
// 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;
|
||||
|
|
|
@ -65,7 +65,7 @@ NS_IMETHODIMP nsTreeImageListener::OnStartContainer(imgIRequest *aRequest,
|
|||
|
||||
NS_IMETHODIMP nsTreeImageListener::OnDataAvailable(imgIRequest *aRequest,
|
||||
gfxIImageFrame *aFrame,
|
||||
const nsIntRect *aRect)
|
||||
const nsRect *aRect)
|
||||
{
|
||||
Invalidate();
|
||||
return NS_OK;
|
||||
|
@ -73,7 +73,7 @@ NS_IMETHODIMP nsTreeImageListener::OnDataAvailable(imgIRequest *aRequest,
|
|||
|
||||
NS_IMETHODIMP nsTreeImageListener::FrameChanged(imgIContainer *aContainer,
|
||||
gfxIImageFrame *newframe,
|
||||
nsIntRect *dirtyRect)
|
||||
nsRect * dirtyRect)
|
||||
{
|
||||
Invalidate();
|
||||
return NS_OK;
|
||||
|
|
|
@ -73,10 +73,10 @@ public:
|
|||
// 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);
|
||||
|
||||
|
|
|
@ -60,10 +60,10 @@ enum nsRectVisibility {
|
|||
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
|
||||
{
|
||||
|
@ -477,7 +477,7 @@ public:
|
|||
* otherwise it returns an enum indicating why not
|
||||
*/
|
||||
NS_IMETHOD GetRectVisibility(nsIView *aView, const nsRect &aRect,
|
||||
nscoord aMinTwips,
|
||||
PRUint16 aMinTwips,
|
||||
nsRectVisibility *aRectVisibility)=0;
|
||||
|
||||
/**
|
||||
|
|
|
@ -515,7 +515,7 @@ NS_IMETHODIMP nsScrollPortView::CanScroll(PRBool aHorizontal,
|
|||
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)
|
||||
|
@ -565,10 +565,10 @@ void nsScrollPortView::Scroll(nsView *aScrolledView, nsPoint aTwipsDelta, nsIntP
|
|||
// 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()),
|
||||
|
@ -577,13 +577,15 @@ void nsScrollPortView::Scroll(nsView *aScrolledView, nsPoint aTwipsDelta, nsIntP
|
|||
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
|
||||
|
@ -669,7 +671,7 @@ NS_IMETHODIMP nsScrollPortView::ScrollToImpl(nscoord aX, nscoord aY, PRUint32 aU
|
|||
mOffsetX = aX;
|
||||
mOffsetY = aY;
|
||||
|
||||
Scroll(scrolledView, twipsDelta, nsIntPoint(dxPx, dyPx), p2a);
|
||||
Scroll(scrolledView, twipsDelta, nsPoint(dxPx, dyPx), p2a);
|
||||
|
||||
mViewManager->SynthesizeMouseMove(PR_TRUE);
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ 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;
|
||||
|
|
|
@ -356,7 +356,7 @@ void nsView::ResetWidgetBounds(PRBool aRecurse, PRBool aMoveOnly,
|
|||
}
|
||||
}
|
||||
|
||||
nsIntRect nsView::CalcWidgetBounds(nsWindowType aType)
|
||||
nsRect nsView::CalcWidgetBounds(nsWindowType aType)
|
||||
{
|
||||
nsCOMPtr<nsIDeviceContext> dx;
|
||||
mViewManager->GetDeviceContext(*getter_AddRefs(dx));
|
||||
|
@ -373,14 +373,15 @@ nsIntRect nsView::CalcWidgetBounds(nsWindowType aType)
|
|||
|
||||
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));
|
||||
|
@ -397,7 +398,7 @@ void nsView::DoResetWidgetBounds(PRBool aMoveOnly,
|
|||
return;
|
||||
}
|
||||
|
||||
nsIntRect curBounds;
|
||||
nsRect curBounds;
|
||||
mWindow->GetBounds(curBounds);
|
||||
nsWindowType type;
|
||||
mWindow->GetWindowType(type);
|
||||
|
@ -413,7 +414,7 @@ void nsView::DoResetWidgetBounds(PRBool aMoveOnly,
|
|||
|
||||
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();
|
||||
|
@ -635,9 +636,9 @@ nsresult nsIView::CreateWidget(const nsIID &aWindowIID,
|
|||
|
||||
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))
|
||||
{
|
||||
|
@ -754,15 +755,17 @@ void nsIView::List(FILE* out, PRInt32 aIndent) const
|
|||
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;
|
||||
|
|
|
@ -192,7 +192,7 @@ public:
|
|||
return mViewToWidgetOffset;
|
||||
}
|
||||
|
||||
nsIntRect CalcWidgetBounds(nsWindowType aType);
|
||||
nsRect CalcWidgetBounds(nsWindowType aType);
|
||||
|
||||
protected:
|
||||
// Do the actual work of ResetWidgetBounds, unconditionally. Don't
|
||||
|
|
|
@ -868,7 +868,8 @@ nsViewManager::UpdateWidgetArea(nsView *aWidgetView, const nsRegion &aDamagedReg
|
|||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -1008,6 +1009,14 @@ void nsViewManager::SuppressFocusEvents(PRBool aSuppress)
|
|||
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -1057,7 +1066,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -1139,9 +1148,10 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
|
|||
} 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
|
||||
|
@ -1280,8 +1290,8 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
|
|||
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",
|
||||
|
@ -1299,7 +1309,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
|
|||
// 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);
|
||||
|
@ -1336,6 +1346,26 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
|
|||
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;
|
||||
|
@ -2020,26 +2050,25 @@ nsPoint nsViewManager::ComputeViewOffset(const nsView *aView)
|
|||
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)
|
||||
|
@ -2097,7 +2126,7 @@ nsresult nsViewManager::GetAbsoluteRect(nsView *aView, const nsRect &aRect,
|
|||
|
||||
NS_IMETHODIMP nsViewManager::GetRectVisibility(nsIView *aView,
|
||||
const nsRect &aRect,
|
||||
nscoord aMinTwips,
|
||||
PRUint16 aMinTwips,
|
||||
nsRectVisibility *aRectVisibility)
|
||||
{
|
||||
nsView* view = static_cast<nsView*>(aView);
|
||||
|
@ -2288,7 +2317,7 @@ 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()) {
|
||||
|
@ -2343,7 +2372,7 @@ nsViewManager::ProcessSynthMouseMoveEvent(PRBool aFromScroll)
|
|||
|
||||
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;
|
||||
}
|
||||
|
@ -2357,20 +2386,20 @@ nsViewManager::ProcessSynthMouseMoveEvent(PRBool aFromScroll)
|
|||
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);
|
||||
|
|
|
@ -193,7 +193,7 @@ public:
|
|||
* 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);
|
||||
|
@ -291,7 +291,7 @@ private:
|
|||
* 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
|
||||
|
@ -433,7 +433,7 @@ private:
|
|||
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.
|
||||
|
|
|
@ -445,7 +445,7 @@ public:
|
|||
// 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;
|
||||
|
@ -531,7 +531,7 @@ public:
|
|||
}
|
||||
|
||||
/// 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)
|
||||
|
@ -593,7 +593,7 @@ public:
|
|||
/// 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;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -822,7 +822,7 @@ struct nsTextEventReply
|
|||
{
|
||||
}
|
||||
|
||||
nsIntRect mCursorPosition;
|
||||
nsRect mCursorPosition;
|
||||
PRBool mCursorIsCollapsed;
|
||||
nsIWidget* mReferenceWidget;
|
||||
};
|
||||
|
@ -961,7 +961,7 @@ public:
|
|||
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;
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
/**
|
||||
* Native types
|
||||
*/
|
||||
[ref] native nsNativeIntMarginRef(nsIntMargin);
|
||||
[ref] native nsNativeMarginRef(nsMargin);
|
||||
|
||||
interface nsIPrintSession;
|
||||
|
||||
|
@ -58,7 +58,7 @@ interface nsIPrintSession;
|
|||
*
|
||||
* @status UNDER_REVIEW
|
||||
*/
|
||||
[scriptable, uuid(343700dd-078b-42b6-a809-b9c1d7e951d0)]
|
||||
[scriptable, uuid(5af07661-6477-4235-8814-4a45215855b8)]
|
||||
|
||||
interface nsIPrintSettings : nsISupports
|
||||
{
|
||||
|
@ -304,11 +304,11 @@ interface nsIPrintSettings : nsISupports
|
|||
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
|
||||
|
@ -329,6 +329,6 @@ interface nsIPrintSettings : nsISupports
|
|||
* 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);
|
||||
};
|
||||
|
|
|
@ -46,7 +46,7 @@ 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 ) ;
|
||||
|
||||
|
|
|
@ -93,10 +93,10 @@ typedef nsEventStatus (*PR_CALLBACK EVENT_CALLBACK)(nsGUIEvent *event);
|
|||
#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
|
||||
|
@ -312,7 +312,7 @@ class nsIWidget : public nsISupports {
|
|||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
const nsIntRect &aRect,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
|
@ -339,7 +339,7 @@ class nsIWidget : public nsISupports {
|
|||
* @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,
|
||||
|
@ -583,7 +583,7 @@ class nsIWidget : public nsISupports {
|
|||
* @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;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -596,7 +596,7 @@ class nsIWidget : public nsISupports {
|
|||
* @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;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -606,7 +606,7 @@ class nsIWidget : public nsISupports {
|
|||
* @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
|
||||
|
@ -745,7 +745,7 @@ class nsIWidget : public nsISupports {
|
|||
* @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.
|
||||
|
@ -802,7 +802,7 @@ class nsIWidget : public nsISupports {
|
|||
*
|
||||
*/
|
||||
|
||||
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.
|
||||
|
@ -826,7 +826,7 @@ class nsIWidget : public nsISupports {
|
|||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD ScrollRect(nsIntRect &aSrcRect, PRInt32 aDx, PRInt32 aDy) = 0;
|
||||
NS_IMETHOD ScrollRect(nsRect &aSrcRect, PRInt32 aDx, PRInt32 aDy) = 0;
|
||||
|
||||
/**
|
||||
* Internal methods
|
||||
|
@ -896,7 +896,7 @@ class nsIWidget : public nsISupports {
|
|||
* @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.
|
||||
|
@ -905,7 +905,7 @@ class nsIWidget : public nsISupports {
|
|||
* @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
|
||||
|
|
|
@ -259,14 +259,14 @@ public:
|
|||
|
||||
// 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,
|
||||
|
@ -277,7 +277,7 @@ public:
|
|||
// Create(nsNativeWidget...)
|
||||
|
||||
virtual nsresult StandardCreate(nsIWidget *aParent,
|
||||
const nsIntRect &aRect,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
|
@ -304,19 +304,19 @@ public:
|
|||
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);
|
||||
|
@ -328,9 +328,9 @@ public:
|
|||
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);
|
||||
|
|
|
@ -139,7 +139,7 @@ nsIWidget * gRollupWidget = nsnull;
|
|||
- (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
|
||||
|
@ -208,7 +208,7 @@ nsIWidget * gRollupWidget = nsnull;
|
|||
|
||||
|
||||
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;
|
||||
|
@ -217,12 +217,12 @@ GeckoRectToNSRect(const nsIntRect & inGeckoRect, NSRect & outCocoaRect)
|
|||
}
|
||||
|
||||
static inline void
|
||||
NSRectToGeckoRect(const NSRect & inCocoaRect, nsIntRect & outGeckoRect)
|
||||
NSRectToGeckoRect(const NSRect & inCocoaRect, nsRect & 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);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -452,7 +452,7 @@ 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,
|
||||
|
@ -582,7 +582,7 @@ void nsChildView::TearDownView()
|
|||
|
||||
// create a nsChildView
|
||||
NS_IMETHODIMP nsChildView::Create(nsIWidget *aParent,
|
||||
const nsIntRect &aRect,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
|
@ -596,7 +596,7 @@ NS_IMETHODIMP nsChildView::Create(nsIWidget *aParent,
|
|||
|
||||
// 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,
|
||||
|
@ -990,14 +990,14 @@ NS_IMETHODIMP nsChildView::SetCursor(imgIContainer* aCursor,
|
|||
|
||||
|
||||
// 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;
|
||||
|
||||
|
@ -1526,7 +1526,7 @@ NS_IMETHODIMP nsChildView::Invalidate(PRBool aIsSynchronous)
|
|||
|
||||
|
||||
// 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;
|
||||
|
||||
|
@ -1576,7 +1576,7 @@ NS_IMETHODIMP nsChildView::InvalidateRegion(const nsIRegion *aRegion, PRBool aIs
|
|||
|
||||
// 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);
|
||||
|
@ -1626,7 +1626,7 @@ NS_IMETHODIMP nsChildView::Update()
|
|||
|
||||
// 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;
|
||||
|
||||
|
@ -1648,7 +1648,7 @@ NS_IMETHODIMP nsChildView::Scroll(PRInt32 aDx, PRInt32 aDy, nsIntRect *aClipRect
|
|||
// 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);
|
||||
}
|
||||
|
@ -1867,11 +1867,11 @@ NS_IMETHODIMP nsChildView::CalcOffset(PRInt32 &aX,PRInt32 &aY)
|
|||
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
|
||||
|
@ -1887,7 +1887,7 @@ PRBool nsChildView::PointInWidget(Point aThePoint)
|
|||
// 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;
|
||||
|
||||
|
@ -1927,7 +1927,7 @@ NS_IMETHODIMP nsChildView::WidgetToScreen(const nsIntRect& aLocalRect, nsIntRect
|
|||
// 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;
|
||||
|
||||
|
@ -2743,7 +2743,7 @@ NSEvent* gLastDragEvent = nil;
|
|||
|
||||
CGContextRef cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
|
||||
|
||||
nsIntRect geckoBounds;
|
||||
nsRect geckoBounds;
|
||||
mGeckoChild->GetBounds(geckoBounds);
|
||||
|
||||
NSRect bounds = [self bounds];
|
||||
|
@ -2787,7 +2787,7 @@ NSEvent* gLastDragEvent = nil;
|
|||
targetContext->Clip();
|
||||
|
||||
// bounding box of the dirty area
|
||||
nsIntRect fullRect;
|
||||
nsRect fullRect;
|
||||
NSRectToGeckoRect(aRect, fullRect);
|
||||
|
||||
nsPaintEvent paintEvent(PR_TRUE, NS_PAINT, mGeckoChild);
|
||||
|
@ -4696,14 +4696,14 @@ GetUSLayoutCharFromKeyTranslate(UInt32 aKeyCode, UInt32 aModifiers)
|
|||
}
|
||||
|
||||
|
||||
- (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);
|
||||
|
@ -5068,7 +5068,7 @@ GetUSLayoutCharFromKeyTranslate(UInt32 aKeyCode, UInt32 aModifiers)
|
|||
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);
|
||||
|
|
|
@ -115,10 +115,10 @@ class nsCocoaUtils
|
|||
// (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!
|
||||
|
|
|
@ -70,7 +70,7 @@ float nsCocoaUtils::FlippedScreenY(float y)
|
|||
}
|
||||
|
||||
|
||||
NSRect nsCocoaUtils::GeckoRectToCocoaRect(const nsIntRect &geckoRect)
|
||||
NSRect nsCocoaUtils::GeckoRectToCocoaRect(const nsRect &geckoRect)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
|
||||
|
@ -85,17 +85,15 @@ NSRect nsCocoaUtils::GeckoRectToCocoaRect(const nsIntRect &geckoRect)
|
|||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ public:
|
|||
NS_DECL_NSPIWIDGETCOCOA
|
||||
|
||||
NS_IMETHOD Create(nsNativeWidget aParent,
|
||||
const nsIntRect &aRect,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
|
@ -211,7 +211,7 @@ public:
|
|||
nsWidgetInitData *aInitData = nsnull);
|
||||
|
||||
NS_IMETHOD Create(nsIWidget* aParent,
|
||||
const nsIntRect &aRect,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
|
@ -223,7 +223,7 @@ public:
|
|||
// Create(nsNativeWidget...)
|
||||
|
||||
virtual nsresult StandardCreate(nsIWidget *aParent,
|
||||
const nsIntRect &aRect,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
|
@ -242,8 +242,8 @@ public:
|
|||
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) ;
|
||||
|
||||
|
@ -256,16 +256,16 @@ public:
|
|||
|
||||
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; }
|
||||
|
|
|
@ -180,7 +180,7 @@ static bool WindowSizeAllowed(PRInt32 aWidth, PRInt32 aHeight)
|
|||
// 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,
|
||||
|
@ -406,7 +406,7 @@ nsresult nsCocoaWindow::StandardCreate(nsIWidget *aParent,
|
|||
|
||||
// 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,
|
||||
|
@ -419,7 +419,7 @@ NS_IMETHODIMP nsCocoaWindow::Create(nsNativeWidget aNativeWindow,
|
|||
|
||||
|
||||
NS_IMETHODIMP nsCocoaWindow::Create(nsIWidget* aParent,
|
||||
const nsIntRect &aRect,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell,
|
||||
|
@ -938,14 +938,14 @@ NS_IMETHODIMP nsCocoaWindow::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRIn
|
|||
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
|
||||
|
@ -985,18 +985,22 @@ NS_IMETHODIMP nsCocoaWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRep
|
|||
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;
|
||||
|
||||
|
@ -1024,7 +1028,7 @@ NS_IMETHODIMP nsCocoaWindow::SetTitle(const nsAString& aTitle)
|
|||
}
|
||||
|
||||
|
||||
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);
|
||||
|
@ -1222,11 +1226,11 @@ NS_IMETHODIMP nsCocoaWindow::ShowMenuBar(PRBool aShow)
|
|||
}
|
||||
|
||||
|
||||
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;
|
||||
|
@ -1239,11 +1243,11 @@ NS_IMETHODIMP nsCocoaWindow::WidgetToScreen(const nsIntRect& aOldRect, nsIntRect
|
|||
}
|
||||
|
||||
|
||||
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;
|
||||
|
@ -1542,7 +1546,7 @@ NS_IMETHODIMP nsCocoaWindow::EndSecureKeyboardInput()
|
|||
{
|
||||
// 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;
|
||||
|
|
|
@ -67,7 +67,7 @@ public:
|
|||
private:
|
||||
|
||||
NSImage* ConstructDragImage(nsIDOMNode* aDOMNode,
|
||||
nsIntRect* aDragRect,
|
||||
nsRect* aDragRect,
|
||||
nsIScriptableRegion* aRegion);
|
||||
|
||||
nsCOMPtr<nsISupportsArray> mDataItems; // only valid for a drag started within gecko
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче