mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 12:35:58 +00:00
Bug 563878. Part 15. Fix GetOffsetTo callsites. r=mats
This commit is contained in:
parent
8672c57994
commit
20d255fcc2
@ -163,16 +163,12 @@ nsCoreUtils::DispatchMouseEvent(PRUint32 aEventType,
|
||||
if (!frame)
|
||||
return PR_FALSE;
|
||||
|
||||
nsIFrame* rootFrame = aPresShell->GetRootFrame();
|
||||
if (!rootFrame)
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIWidget> rootWidget = rootFrame->GetNearestWidget();
|
||||
if (!rootWidget)
|
||||
return PR_FALSE;
|
||||
|
||||
// Compute x and y coordinates.
|
||||
nsPoint point = frame->GetOffsetToExternal(rootFrame);
|
||||
nsPoint point;
|
||||
nsCOMPtr<nsIWidget> widget = frame->GetNearestWidget(point);
|
||||
if (!widget)
|
||||
return PR_FALSE;
|
||||
|
||||
nsSize size = frame->GetSize();
|
||||
|
||||
nsPresContext* presContext = aPresShell->GetPresContext();
|
||||
@ -181,7 +177,7 @@ nsCoreUtils::DispatchMouseEvent(PRUint32 aEventType,
|
||||
PRInt32 y = presContext->AppUnitsToDevPixels(point.y + size.height / 2);
|
||||
|
||||
// Fire mouse event.
|
||||
DispatchMouseEvent(aEventType, x, y, aContent, frame, aPresShell, rootWidget);
|
||||
DispatchMouseEvent(aEventType, x, y, aContent, frame, aPresShell, widget);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -797,7 +797,11 @@ nsContentEventHandler::OnQueryCharacterAtPoint(nsQueryContentEvent* aEvent)
|
||||
aEvent->mSucceeded = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
nsPoint ptInTarget = ptInRoot - targetFrame->GetOffsetTo(rootFrame);
|
||||
nsPoint ptInTarget = ptInRoot + rootFrame->GetOffsetToCrossDoc(targetFrame);
|
||||
PRInt32 rootAPD = rootFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
PRInt32 targetAPD = targetFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
ptInTarget = ptInTarget.ConvertAppUnits(rootAPD, targetAPD);
|
||||
|
||||
nsTextFrame* textframe = static_cast<nsTextFrame*>(targetFrame);
|
||||
nsIFrame::ContentOffsets offsets =
|
||||
textframe->GetCharacterOffsetAtFramePoint(ptInTarget);
|
||||
|
@ -266,7 +266,11 @@ nsDOMWindowUtils::SendMouseEvent(const nsAString& aType,
|
||||
event.time = PR_IntervalNow();
|
||||
event.flags |= NS_EVENT_FLAG_SYNTHETIC_TEST_EVENT;
|
||||
|
||||
float appPerDev = float(widget->GetDeviceContext()->AppUnitsPerDevPixel());
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
if (!presContext)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 appPerDev = presContext->AppUnitsPerDevPixel();
|
||||
event.refPoint.x =
|
||||
NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aX) + offset.x,
|
||||
appPerDev);
|
||||
@ -318,7 +322,11 @@ nsDOMWindowUtils::SendMouseScrollEvent(const nsAString& aType,
|
||||
|
||||
event.time = PR_IntervalNow();
|
||||
|
||||
float appPerDev = float(widget->GetDeviceContext()->AppUnitsPerDevPixel());
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
if (!presContext)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 appPerDev = presContext->AppUnitsPerDevPixel();
|
||||
event.refPoint.x =
|
||||
NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aX) + offset.x,
|
||||
appPerDev);
|
||||
@ -596,7 +604,11 @@ nsDOMWindowUtils::SendSimpleGestureEvent(const nsAString& aType,
|
||||
event.isMeta = (aModifiers & nsIDOMNSEvent::META_MASK) ? PR_TRUE : PR_FALSE;
|
||||
event.time = PR_IntervalNow();
|
||||
|
||||
float appPerDev = float(widget->GetDeviceContext()->AppUnitsPerDevPixel());
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
if (!presContext)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRInt32 appPerDev = presContext->AppUnitsPerDevPixel();
|
||||
event.refPoint.x =
|
||||
NSAppUnitsToIntPixels(nsPresContext::CSSPixelsToAppUnits(aX) + offset.x,
|
||||
appPerDev);
|
||||
|
@ -54,8 +54,10 @@ public:
|
||||
protected:
|
||||
nsRefPtr<nsGlobalWindow> mWindow;
|
||||
|
||||
// If aOffset is non-null, it gets filled in with an offset, in app
|
||||
// units, that should be added to any event offset we're given.
|
||||
// If aOffset is non-null, it gets filled in with the offset of the root
|
||||
// frame of our window to the nearest widget in the app units of our window.
|
||||
// Add this offset to any event offset we're given to make it relative to the
|
||||
// widget returned by GetWidget.
|
||||
nsIWidget* GetWidget(nsPoint* aOffset = nsnull);
|
||||
nsIWidget* GetWidgetForElement(nsIDOMElement* aElement);
|
||||
|
||||
|
@ -800,6 +800,12 @@ nsLayoutUtils::GetEventCoordinatesRelativeTo(const nsEvent* aEvent, nsIFrame* aF
|
||||
if (widgetToView == nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE))
|
||||
return nsPoint(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
|
||||
|
||||
// Convert from root document app units to app units of the document aFrame
|
||||
// is in.
|
||||
PRInt32 rootAPD = rootFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
PRInt32 localAPD = aFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
widgetToView = widgetToView.ConvertAppUnits(rootAPD, localAPD);
|
||||
|
||||
/* If we encountered a transform, we can't do simple arithmetic to figure
|
||||
* out how to convert back to aFrame's coordinates and must use the CTM.
|
||||
*/
|
||||
@ -809,7 +815,7 @@ nsLayoutUtils::GetEventCoordinatesRelativeTo(const nsEvent* aEvent, nsIFrame* aF
|
||||
/* Otherwise, all coordinate systems are translations of one another,
|
||||
* so we can just subtract out the different.
|
||||
*/
|
||||
return widgetToView - aFrame->GetOffsetTo(rootFrame);
|
||||
return widgetToView - aFrame->GetOffsetToCrossDoc(rootFrame);
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
|
@ -2386,6 +2386,7 @@ nsRootPresContext::UnregisterPluginForGeometryUpdates(nsObjectFrame* aPlugin)
|
||||
|
||||
struct PluginGeometryClosure {
|
||||
nsIFrame* mRootFrame;
|
||||
PRInt32 mRootAPD;
|
||||
nsIFrame* mChangedSubtree;
|
||||
nsRect mChangedRect;
|
||||
nsTHashtable<nsPtrHashKey<nsObjectFrame> > mAffectedPlugins;
|
||||
@ -2398,7 +2399,9 @@ PluginBoundsEnumerator(nsPtrHashKey<nsObjectFrame>* aEntry, void* userArg)
|
||||
PluginGeometryClosure* closure = static_cast<PluginGeometryClosure*>(userArg);
|
||||
nsObjectFrame* f = aEntry->GetKey();
|
||||
nsRect fBounds = f->GetContentRect() +
|
||||
f->GetParent()->GetOffsetTo(closure->mRootFrame);
|
||||
f->GetParent()->GetOffsetToCrossDoc(closure->mRootFrame);
|
||||
PRInt32 APD = f->PresContext()->AppUnitsPerDevPixel();
|
||||
fBounds = fBounds.ConvertAppUnitsRoundOut(APD, closure->mRootAPD);
|
||||
// We're identifying the plugins that may have been affected by changes
|
||||
// to the frame subtree rooted at aChangedRoot. Any plugin that overlaps
|
||||
// the overflow area of aChangedRoot could have its clip region affected
|
||||
@ -2474,9 +2477,13 @@ nsRootPresContext::GetPluginGeometryUpdates(nsIFrame* aChangedSubtree,
|
||||
|
||||
PluginGeometryClosure closure;
|
||||
closure.mRootFrame = mShell->FrameManager()->GetRootFrame();
|
||||
closure.mRootAPD = closure.mRootFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
closure.mChangedSubtree = aChangedSubtree;
|
||||
closure.mChangedRect = aChangedSubtree->GetOverflowRect() +
|
||||
aChangedSubtree->GetOffsetTo(closure.mRootFrame);
|
||||
aChangedSubtree->GetOffsetToCrossDoc(closure.mRootFrame);
|
||||
PRInt32 subtreeAPD = aChangedSubtree->PresContext()->AppUnitsPerDevPixel();
|
||||
closure.mChangedRect =
|
||||
closure.mChangedRect.ConvertAppUnitsRoundOut(subtreeAPD, closure.mRootAPD);
|
||||
closure.mAffectedPlugins.Init();
|
||||
closure.mOutputConfigurations = aConfigurations;
|
||||
// Fill in closure.mAffectedPlugins and closure.mAffectedPluginBounds
|
||||
|
@ -1293,7 +1293,8 @@ private:
|
||||
// document's root view for element, first ensuring the element is onscreen
|
||||
void GetCurrentItemAndPositionForElement(nsIDOMElement *aCurrentEl,
|
||||
nsIContent **aTargetToUse,
|
||||
nsIntPoint& aTargetPt);
|
||||
nsIntPoint& aTargetPt,
|
||||
nsIWidget *aRootWidget);
|
||||
|
||||
void FireResizeEvent();
|
||||
static void AsyncResizeEventCallback(nsITimer* aTimer, void* aPresShell);
|
||||
@ -4289,9 +4290,18 @@ PresShell::ScrollFrameRectIntoView(nsIFrame* aFrame,
|
||||
rect.IntersectRect(rect, sf->GetScrollPortRect());
|
||||
}
|
||||
rect += container->GetPosition();
|
||||
nsPoint extraOffset(0,0);
|
||||
container = nsLayoutUtils::GetCrossDocParentFrame(container, &extraOffset);
|
||||
rect += extraOffset;
|
||||
nsIFrame* parent = container->GetParent();
|
||||
if (!parent) {
|
||||
nsPoint extraOffset(0,0);
|
||||
parent = nsLayoutUtils::GetCrossDocParentFrame(container, &extraOffset);
|
||||
if (parent) {
|
||||
PRInt32 APD = container->PresContext()->AppUnitsPerDevPixel();
|
||||
PRInt32 parentAPD = parent->PresContext()->AppUnitsPerDevPixel();
|
||||
rect = rect.ConvertAppUnitsRoundOut(APD, parentAPD);
|
||||
rect += extraOffset;
|
||||
}
|
||||
}
|
||||
container = parent;
|
||||
} while (container);
|
||||
|
||||
return didScroll;
|
||||
@ -4302,6 +4312,8 @@ PresShell::GetRectVisibility(nsIFrame* aFrame,
|
||||
const nsRect &aRect,
|
||||
nscoord aMinTwips) const
|
||||
{
|
||||
NS_ASSERTION(aFrame->PresContext() == GetPresContext(),
|
||||
"prescontext mismatch?");
|
||||
nsIFrame* rootFrame = FrameManager()->GetRootFrame();
|
||||
NS_ASSERTION(rootFrame,
|
||||
"How can someone have a frame for this presshell when there's no root?");
|
||||
@ -6824,7 +6836,8 @@ PresShell::AdjustContextMenuKeyEvent(nsMouseEvent* aEvent)
|
||||
nsCOMPtr<nsIContent> currentPointElement;
|
||||
GetCurrentItemAndPositionForElement(currentFocus,
|
||||
getter_AddRefs(currentPointElement),
|
||||
aEvent->refPoint);
|
||||
aEvent->refPoint,
|
||||
aEvent->widget);
|
||||
if (currentPointElement) {
|
||||
mCurrentEventContent = currentPointElement;
|
||||
mCurrentEventFrame = nsnull;
|
||||
@ -6835,7 +6848,7 @@ PresShell::AdjustContextMenuKeyEvent(nsMouseEvent* aEvent)
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// nsEventListenerManager::PrepareToUseCaretPosition
|
||||
// PresShell::PrepareToUseCaretPosition
|
||||
//
|
||||
// This checks to see if we should use the caret position for popup context
|
||||
// menus. Returns true if the caret position should be used, and the
|
||||
@ -6918,31 +6931,28 @@ PresShell::PrepareToUseCaretPosition(nsIWidget* aEventWidget, nsIntPoint& aTarge
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
}
|
||||
|
||||
// get caret position relative to some view (normally the same as the
|
||||
// event widget view, but this is not guaranteed)
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
|
||||
// get caret position relative to the closest view
|
||||
nsRect caretCoords;
|
||||
nsIFrame* caretFrame = caret->GetGeometry(domSelection, &caretCoords);
|
||||
if (!caretFrame)
|
||||
return PR_FALSE;
|
||||
nsPoint widgetOffset;
|
||||
nsIWidget* widget = caretFrame->GetNearestWidget(widgetOffset);
|
||||
if (!widget)
|
||||
nsPoint viewOffset;
|
||||
nsIView* view = caretFrame->GetClosestView(&viewOffset);
|
||||
if (!view)
|
||||
return PR_FALSE;
|
||||
caretCoords.MoveBy(widgetOffset);
|
||||
nsIView* caretView = nsIView::GetViewFor(widget);
|
||||
|
||||
// in case the view used for caret coordinates was something else, we need
|
||||
// to bring those coordinates into the space of the widget view
|
||||
nsIView* widgetView = nsIView::GetViewFor(aEventWidget);
|
||||
NS_ENSURE_TRUE(widgetView, PR_FALSE);
|
||||
nsPoint viewToWidget;
|
||||
widgetView->GetNearestWidget(&viewToWidget);
|
||||
nsPoint viewDelta = caretView->GetOffsetTo(widgetView) + viewToWidget;
|
||||
// and then get the caret coords relative to the event widget
|
||||
if (aEventWidget) {
|
||||
viewOffset += view->GetOffsetToWidget(aEventWidget);
|
||||
}
|
||||
caretCoords.MoveBy(viewOffset);
|
||||
|
||||
// caret coordinates are in app units, convert to pixels
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
aTargetPt.x = presContext->AppUnitsToDevPixels(viewDelta.x + caretCoords.x + caretCoords.width);
|
||||
aTargetPt.y = presContext->AppUnitsToDevPixels(viewDelta.y + caretCoords.y + caretCoords.height);
|
||||
aTargetPt.x =
|
||||
presContext->AppUnitsToDevPixels(caretCoords.x + caretCoords.width);
|
||||
aTargetPt.y =
|
||||
presContext->AppUnitsToDevPixels(caretCoords.y + caretCoords.height);
|
||||
|
||||
// make sure rounding doesn't return a pixel which is outside the caret
|
||||
// (e.g. one line lower)
|
||||
@ -6954,14 +6964,17 @@ PresShell::PrepareToUseCaretPosition(nsIWidget* aEventWidget, nsIntPoint& aTarge
|
||||
void
|
||||
PresShell::GetCurrentItemAndPositionForElement(nsIDOMElement *aCurrentEl,
|
||||
nsIContent** aTargetToUse,
|
||||
nsIntPoint& aTargetPt)
|
||||
nsIntPoint& aTargetPt,
|
||||
nsIWidget *aRootWidget)
|
||||
{
|
||||
nsCOMPtr<nsIContent> focusedContent(do_QueryInterface(aCurrentEl));
|
||||
ScrollContentIntoView(focusedContent, NS_PRESSHELL_SCROLL_ANYWHERE,
|
||||
NS_PRESSHELL_SCROLL_ANYWHERE);
|
||||
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
|
||||
PRBool istree = PR_FALSE, checkLineHeight = PR_TRUE;
|
||||
PRInt32 extraPixelsY = 0, extraTreeY = 0;
|
||||
nscoord extraTreeY = 0;
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
// Set the position to just underneath the current item for multi-select
|
||||
@ -6993,7 +7006,8 @@ PresShell::GetCurrentItemAndPositionForElement(nsIDOMElement *aCurrentEl,
|
||||
treeBox->GetFirstVisibleRow(&firstVisibleRow);
|
||||
treeBox->GetRowHeight(&rowHeight);
|
||||
|
||||
extraPixelsY = (currentIndex - firstVisibleRow + 1) * rowHeight;
|
||||
extraTreeY += presContext->CSSPixelsToAppUnits(
|
||||
(currentIndex - firstVisibleRow + 1) * rowHeight);
|
||||
istree = PR_TRUE;
|
||||
|
||||
nsCOMPtr<nsITreeColumns> cols;
|
||||
@ -7008,7 +7022,7 @@ PresShell::GetCurrentItemAndPositionForElement(nsIDOMElement *aCurrentEl,
|
||||
if (colContent) {
|
||||
nsIFrame* frame = colContent->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
extraTreeY = frame->GetSize().height;
|
||||
extraTreeY += frame->GetSize().height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7039,14 +7053,19 @@ PresShell::GetCurrentItemAndPositionForElement(nsIDOMElement *aCurrentEl,
|
||||
|
||||
nsIFrame *frame = focusedContent->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
NS_ASSERTION(frame->PresContext() == GetPresContext(),
|
||||
"handling event for focused content that is not in our document?");
|
||||
|
||||
nsPoint frameOrigin(0, 0);
|
||||
|
||||
// Get the frame's origin within its view
|
||||
nsIView *view = frame->GetClosestView(&frameOrigin);
|
||||
NS_ASSERTION(view, "No view for frame");
|
||||
|
||||
// View's origin within the view manager tree
|
||||
frameOrigin += view->GetOffsetTo(nsnull);
|
||||
// View's origin relative the widget
|
||||
if (aRootWidget) {
|
||||
frameOrigin += view->GetOffsetToWidget(aRootWidget);
|
||||
}
|
||||
|
||||
// Start context menu down and to the right from top left of frame
|
||||
// use the lineheight. This is a good distance to move the context
|
||||
@ -7063,19 +7082,21 @@ PresShell::GetCurrentItemAndPositionForElement(nsIDOMElement *aCurrentEl,
|
||||
nsIScrollableFrame *scrollFrame =
|
||||
nsLayoutUtils::GetNearestScrollableFrame(frame);
|
||||
if (scrollFrame) {
|
||||
nscoord scrollFrameLineHeight =
|
||||
scrollFrame->GetLineScrollAmount().height;
|
||||
if (extra > scrollFrameLineHeight) {
|
||||
extra = scrollFrameLineHeight;
|
||||
nsSize scrollAmount = scrollFrame->GetLineScrollAmount();
|
||||
nsIFrame* f = do_QueryFrame(scrollFrame);
|
||||
PRInt32 APD = presContext->AppUnitsPerDevPixel();
|
||||
PRInt32 scrollAPD = f->PresContext()->AppUnitsPerDevPixel();
|
||||
scrollAmount = scrollAmount.ConvertAppUnits(scrollAPD, APD);
|
||||
if (extra > scrollAmount.height) {
|
||||
extra = scrollAmount.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsPresContext* presContext = GetPresContext();
|
||||
aTargetPt.x = presContext->AppUnitsToDevPixels(frameOrigin.x);
|
||||
aTargetPt.y = presContext->AppUnitsToDevPixels(
|
||||
frameOrigin.y + extra + extraTreeY) + extraPixelsY;
|
||||
frameOrigin.y + extra + extraTreeY);
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(*aTargetToUse = focusedContent);
|
||||
|
@ -3540,8 +3540,8 @@ nsPoint nsIFrame::GetOffsetTo(const nsIFrame* aOther) const
|
||||
NS_PRECONDITION(aOther,
|
||||
"Must have frame for destination coordinate system!");
|
||||
|
||||
//NS_ASSERTION(PresContext() == aOther->PresContext(),
|
||||
// "GetOffsetTo called on frames in different documents");
|
||||
NS_ASSERTION(PresContext() == aOther->PresContext(),
|
||||
"GetOffsetTo called on frames in different documents");
|
||||
|
||||
//XXX sometime in the near future once we are confident that all GetOffsetTo
|
||||
// callers pass frames that are really in the same doc we can get rid of this
|
||||
@ -3941,7 +3941,7 @@ nsIFrame::GetTransformMatrix(nsIFrame **aOutAncestor)
|
||||
{
|
||||
NS_PRECONDITION(aOutAncestor, "Need a place to put the ancestor!");
|
||||
|
||||
/* Whether or not we're transformed, the matrix will be relative to our
|
||||
/* If we're transformed, the matrix will be relative to our
|
||||
* cross-doc parent frame.
|
||||
*/
|
||||
*aOutAncestor = nsLayoutUtils::GetCrossDocParentFrame(this);
|
||||
@ -3955,7 +3955,7 @@ nsIFrame::GetTransformMatrix(nsIFrame **aOutAncestor)
|
||||
* coordinates to our parent.
|
||||
*/
|
||||
NS_ASSERTION(*aOutAncestor, "Cannot transform the viewport frame!");
|
||||
nsPoint delta = GetOffsetTo(*aOutAncestor);
|
||||
nsPoint delta = GetOffsetToCrossDoc(*aOutAncestor);
|
||||
PRInt32 scaleFactor = PresContext()->AppUnitsPerDevPixel();
|
||||
|
||||
gfxMatrix result =
|
||||
@ -3994,7 +3994,7 @@ nsIFrame::GetTransformMatrix(nsIFrame **aOutAncestor)
|
||||
/* Translate from this frame to our ancestor, if it exists. That's the
|
||||
* entire transform, so we're done.
|
||||
*/
|
||||
nsPoint delta = GetOffsetTo(*aOutAncestor);
|
||||
nsPoint delta = GetOffsetToCrossDoc(*aOutAncestor);
|
||||
PRInt32 scaleFactor = PresContext()->AppUnitsPerDevPixel();
|
||||
return gfxMatrix().Translate
|
||||
(gfxPoint(NSAppUnitsToFloatPixels(delta.x, scaleFactor),
|
||||
|
@ -1235,7 +1235,7 @@ nsObjectFrame::ComputeWidgetGeometry(const nsRegion& aRegion,
|
||||
|
||||
PRInt32 appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
|
||||
nsIFrame* rootFrame = rootPC->PresShell()->FrameManager()->GetRootFrame();
|
||||
nsRect bounds = GetContentRect() + GetParent()->GetOffsetTo(rootFrame);
|
||||
nsRect bounds = GetContentRect() + GetParent()->GetOffsetToCrossDoc(rootFrame);
|
||||
configuration->mBounds = bounds.ToNearestPixels(appUnitsPerDevPixel);
|
||||
|
||||
// This should produce basically the same rectangle (but not relative
|
||||
|
@ -462,6 +462,7 @@ public:
|
||||
if (!frame.IsAlive())
|
||||
return NS_OK;
|
||||
|
||||
NS_ASSERTION(frame->PresContext() == mPresContext, "document mismatch?");
|
||||
nsPoint pt = mPoint -
|
||||
frame->GetOffsetTo(mPresContext->PresShell()->FrameManager()->GetRootFrame());
|
||||
mSelection->DoAutoScroll(frame, pt);
|
||||
@ -4663,7 +4664,9 @@ nsTypedSelection::DoAutoScroll(nsIFrame *aFrame, nsPoint& aPoint)
|
||||
if (!rootPC)
|
||||
return NS_OK;
|
||||
nsIFrame* rootmostFrame = rootPC->PresShell()->FrameManager()->GetRootFrame();
|
||||
nsPoint globalPoint = aPoint + aFrame->GetOffsetTo(rootmostFrame);
|
||||
// Get the point relative to the root most frame because the scroll we are
|
||||
// about to do will change the coordinates of aFrame.
|
||||
nsPoint globalPoint = aPoint + aFrame->GetOffsetToCrossDoc(rootmostFrame);
|
||||
|
||||
PRBool didScroll = presContext->PresShell()->
|
||||
ScrollFrameRectIntoView(aFrame, nsRect(aPoint, nsSize(1,1)),
|
||||
@ -4677,7 +4680,7 @@ nsTypedSelection::DoAutoScroll(nsIFrame *aFrame, nsPoint& aPoint)
|
||||
if (didScroll && mAutoScrollTimer)
|
||||
{
|
||||
nsPoint presContextPoint = globalPoint -
|
||||
presContext->PresShell()->FrameManager()->GetRootFrame()->GetOffsetTo(rootmostFrame);
|
||||
presContext->PresShell()->FrameManager()->GetRootFrame()->GetOffsetToCrossDoc(rootmostFrame);
|
||||
mAutoScrollTimer->Start(presContext, presContextPoint);
|
||||
}
|
||||
|
||||
|
@ -357,7 +357,10 @@ ViewportFrame::InvalidateInternal(const nsRect& aDamageRect,
|
||||
|
||||
nsIFrame* parent = nsLayoutUtils::GetCrossDocParentFrame(this);
|
||||
if (parent) {
|
||||
nsPoint pt = GetOffsetTo(parent);
|
||||
nsPoint pt = -parent->GetOffsetToCrossDoc(this);
|
||||
PRInt32 ourAPD = PresContext()->AppUnitsPerDevPixel();
|
||||
PRInt32 parentAPD = parent->PresContext()->AppUnitsPerDevPixel();
|
||||
r = r.ConvertAppUnitsRoundOut(ourAPD, parentAPD);
|
||||
parent->InvalidateInternal(r, pt.x, pt.y, this,
|
||||
aFlags | INVALIDATE_CROSS_DOC);
|
||||
return;
|
||||
|
@ -1898,6 +1898,9 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//XXX If printing supported printing document hierarchies with non-constant
|
||||
// zoom this would be wrong as we use the same mPrt->mPrintDC for all
|
||||
// subdocuments.
|
||||
adjSize = frame->GetContentRect().Size();
|
||||
documentIsTopLevel = PR_FALSE;
|
||||
// presshell exists because parent is printable
|
||||
|
@ -729,7 +729,7 @@ protected:
|
||||
nsCOMPtr<nsIDOMNode> mRangeParent;
|
||||
PRInt32 mRangeOffset;
|
||||
// Device pixels relative to the showing popup's presshell's
|
||||
// GetViewManager()->GetRootWidget().
|
||||
// root prescontext's root frame.
|
||||
nsIntPoint mCachedMousePoint;
|
||||
|
||||
// set to the currently active menu bar, if any
|
||||
|
@ -345,9 +345,10 @@ nsXULPopupManager::SetTriggerEvent(nsIDOMEvent* aEvent, nsIContent* aPopup)
|
||||
nsIDocument* doc = aPopup->GetCurrentDoc();
|
||||
if (doc) {
|
||||
nsIPresShell* presShell = doc->GetShell();
|
||||
if (presShell && presShell->GetPresContext()) {
|
||||
nsPresContext* presContext;
|
||||
if (presShell && (presContext = presShell->GetPresContext())) {
|
||||
nsPresContext* rootDocPresContext =
|
||||
presShell->GetPresContext()->GetRootPresContext();
|
||||
presContext->GetRootPresContext();
|
||||
if (!rootDocPresContext)
|
||||
return;
|
||||
nsIFrame* rootDocumentRootFrame = rootDocPresContext->
|
||||
@ -362,12 +363,12 @@ nsXULPopupManager::SetTriggerEvent(nsIDOMEvent* aEvent, nsIContent* aPopup)
|
||||
mouseEvent->GetClientY(&clientPt.y);
|
||||
|
||||
// XXX this doesn't handle IFRAMEs in transforms
|
||||
nsPoint thisDocToRootDocOffset =
|
||||
presShell->FrameManager()->GetRootFrame()->GetOffsetTo(rootDocumentRootFrame);
|
||||
nsPoint thisDocToRootDocOffset = presShell->FrameManager()->
|
||||
GetRootFrame()->GetOffsetToCrossDoc(rootDocumentRootFrame);
|
||||
// convert to device pixels
|
||||
mCachedMousePoint.x = rootDocPresContext->AppUnitsToDevPixels(
|
||||
mCachedMousePoint.x = presContext->AppUnitsToDevPixels(
|
||||
nsPresContext::CSSPixelsToAppUnits(clientPt.x) + thisDocToRootDocOffset.x);
|
||||
mCachedMousePoint.y = rootDocPresContext->AppUnitsToDevPixels(
|
||||
mCachedMousePoint.y = presContext->AppUnitsToDevPixels(
|
||||
nsPresContext::CSSPixelsToAppUnits(clientPt.y) + thisDocToRootDocOffset.y);
|
||||
}
|
||||
else if (rootDocumentRootFrame) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user