зеркало из https://github.com/mozilla/gecko-dev.git
bug 832524 pt 1 - account for resolution-dependent size of menuitem icons in GetGutterSize. r=jimm
This commit is contained in:
Родитель
a874c054da
Коммит
0a50f9f6b5
|
@ -201,8 +201,22 @@ GetGutterSize(HANDLE theme, HDC hdc)
|
|||
SIZE itemSize;
|
||||
GetThemePartSize(theme, hdc, MENU_POPUPITEM, MPI_NORMAL, NULL, TS_TRUE, &itemSize);
|
||||
|
||||
int width = std::max(itemSize.cx, checkboxBGSize.cx + gutterSize.cx);
|
||||
int height = std::max(itemSize.cy, checkboxBGSize.cy);
|
||||
// Figure out how big the menuitem's icon will be (if present) at current DPI
|
||||
FLOAT scaleFactor = GetDeviceCaps(gfxWindowsPlatform::GetPlatform()->GetScreenDC(), LOGPIXELSY) / 96.0;
|
||||
int iconDevicePixels = NSToIntRound(16 * scaleFactor);
|
||||
SIZE iconSize = {
|
||||
iconDevicePixels, iconDevicePixels
|
||||
};
|
||||
// Not really sure what margins should be used here, but this seems to work in practice...
|
||||
MARGINS margins = {0};
|
||||
GetThemeMargins(theme, hdc, MENU_POPUPCHECKBACKGROUND, MCB_NORMAL,
|
||||
TMT_CONTENTMARGINS, NULL, &margins);
|
||||
iconSize.cx += margins.cxLeftWidth + margins.cxRightWidth;
|
||||
iconSize.cy += margins.cyTopHeight + margins.cyBottomHeight;
|
||||
|
||||
int width = std::max(itemSize.cx, std::max(iconSize.cx, checkboxBGSize.cx) + gutterSize.cx);
|
||||
int height = std::max(itemSize.cy, std::max(iconSize.cy, checkboxBGSize.cy));
|
||||
|
||||
SIZE ret;
|
||||
ret.cx = width;
|
||||
ret.cy = height;
|
||||
|
|
Загрузка…
Ссылка в новой задаче