~rpadovani/oxide/type-info

« back to all changes in this revision

Viewing changes to qt/core/browser/oxide_qt_web_context_menu.cc

  • Committer: Riccardo Padovani
  • Date: 2015-10-19 07:56:29 UTC
  • mfrom: (1088.1.131 oxide)
  • Revision ID: riccardo@rpadovani.com-20151019075629-z0mlhwlb9xflkovw
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include "base/strings/utf_string_conversions.h"
25
25
 
26
26
#include "qt/core/glue/oxide_qt_web_context_menu_proxy.h"
 
27
#include "shared/browser/oxide_web_view.h"
27
28
 
28
29
namespace oxide {
29
30
namespace qt {
59
60
}
60
61
 
61
62
QPoint WebContextMenu::position() const {
62
 
  return QPoint(params_.x, params_.y);
 
63
  // The position is expressed in device-independent pixels (DIP), it needs to
 
64
  // be multiplied by the device pixel ratio (DPR) to obtain physical pixels.
 
65
  oxide::WebView* webview = oxide::WebView::FromWebContents(web_contents());
 
66
  const float dpr = webview->GetScreenInfo().deviceScaleFactor;
 
67
  return QPoint(params_.x * dpr, params_.y * dpr);
63
68
}
64
69
 
65
70
QUrl WebContextMenu::linkUrl() const {