presContext->GetTwipsToPixels(&scale);
scale = presContext->TwipsToPixels();
GetScreenOrigin(nsIDOMElement* aElement){  nsRect* rect = new nsRect(0,0,0,0);  nsSize size;   nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);  nsCOMPtr<nsIDocument> doc = content->GetDocument();  if (doc) {    // Get Presentation shell 0    nsIPresShell* presShell = doc->GetShellAt(0);        if (presShell) {      nsCOMPtr<nsIPresContext> presContext;      presShell->GetPresContext(getter_AddRefs(presContext));      if (presContext) {        // Get the scale from that Presentation Context        float scale;        presContext->GetTwipsToPixels(&scale);        nsIFrame* frame;        nsresult rv = presShell->GetPrimaryFrameFor(content, &frame);        nsIView* view;        nsPoint offset;        frame->GetOffsetFromView(presContext, offset, &view);        if (view) {          nsPoint widgetOffset(0, 0);          nsIWidget* widget = view->GetNearestWidget(&widgetOffset);          if (widget) {            nsRect oldBox(0,0,0,0);            widget->WidgetToScreen(oldBox, *rect);          }                    rect->x += NSTwipsToIntPixels(offset.x+widgetOffset.x, scale);          rect->y += NSTwipsToIntPixels(offset.y+widgetOffset.y, scale);        }                size = frame->GetSize();        rect->width = NSTwipsToIntPixels(size.width, scale);        rect->height = NSTwipsToIntPixels(size.height, scale);      }    }  }    return *rect;}