mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-09 00:11:44 +00:00
Yeah, baby, yeah, baby, YEAH.
This commit is contained in:
parent
088c1e97d9
commit
151640cafb
@ -1000,6 +1000,53 @@ nsWebShellWindow::CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupCont
|
|||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIPresShell> presShell;
|
||||||
|
if (NS_FAILED(rv = presContext->GetShell(getter_AddRefs(presShell)))) {
|
||||||
|
NS_ERROR("Unable to retrieve the pres shell.");
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
||||||
|
if (anAnchorAlignment != "none") {
|
||||||
|
// We need to compute our screen coordinates.
|
||||||
|
nsIFrame* primaryFrame;
|
||||||
|
presShell->GetPrimaryFrameFor(content, &primaryFrame);
|
||||||
|
if (primaryFrame) {
|
||||||
|
// Get the coordinates within the view.
|
||||||
|
nsRect rect;
|
||||||
|
nsIView * view;
|
||||||
|
nsPoint pnt;
|
||||||
|
primaryFrame->GetOffsetFromView(pnt, &view);
|
||||||
|
primaryFrame->GetRect(rect);
|
||||||
|
rect.x = pnt.x;
|
||||||
|
rect.y = pnt.y;
|
||||||
|
|
||||||
|
float t2p;
|
||||||
|
presContext->GetTwipsToPixels(&t2p);
|
||||||
|
rect.x = NSToCoordRound((float)(rect.x)*t2p);
|
||||||
|
rect.y = NSToCoordRound((float)(rect.y)*t2p);
|
||||||
|
rect.width = NSToCoordRound((float)(rect.width)*t2p);
|
||||||
|
rect.height = NSToCoordRound((float)(rect.height)*t2p);
|
||||||
|
|
||||||
|
if (anAnchorAlignment == "topleft") {
|
||||||
|
aXPos = rect.x + aXPos;
|
||||||
|
aYPos = rect.y + aYPos;
|
||||||
|
}
|
||||||
|
else if (anAnchorAlignment == "topright") {
|
||||||
|
aXPos = rect.x + rect.width + aXPos;
|
||||||
|
aYPos = rect.y + aYPos;
|
||||||
|
}
|
||||||
|
else if (anAnchorAlignment == "bottomleft") {
|
||||||
|
aXPos = rect.x + aXPos;
|
||||||
|
aYPos = rect.y + rect.height + aXPos;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
aXPos = rect.x + rect.width + aXPos;
|
||||||
|
aYPos = rect.y + rect.height + aYPos;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> popupContent = do_QueryInterface(aPopupContent);
|
nsCOMPtr<nsIContent> popupContent = do_QueryInterface(aPopupContent);
|
||||||
|
|
||||||
// Fire the CONSTRUCT DOM event to give JS/C++ a chance to build the popup
|
// Fire the CONSTRUCT DOM event to give JS/C++ a chance to build the popup
|
||||||
@ -1074,7 +1121,6 @@ nsWebShellWindow::CreatePopup(nsIDOMElement* aElement, nsIDOMElement* aPopupCont
|
|||||||
// content. This new document must use the different root and a different global script
|
// content. This new document must use the different root and a different global script
|
||||||
// context (window object) but everything else about it is the same (namespaces, URLs,
|
// context (window object) but everything else about it is the same (namespaces, URLs,
|
||||||
// stylesheets).
|
// stylesheets).
|
||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
|
|
||||||
nsCOMPtr<nsIDocument> document;
|
nsCOMPtr<nsIDocument> document;
|
||||||
content->GetDocument(*getter_AddRefs(document));
|
content->GetDocument(*getter_AddRefs(document));
|
||||||
if (document == nsnull)
|
if (document == nsnull)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user