mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-01 11:27:55 +00:00
Bug 1173617. Don't cache titlebar caption sizes unless the widget has a titlebar. r=jimm
This commit is contained in:
parent
a50e7d609c
commit
d9bbdbb005
@ -30,7 +30,8 @@ nsUXThemeData::sFlatMenus = false;
|
||||
|
||||
bool nsUXThemeData::sTitlebarInfoPopulatedAero = false;
|
||||
bool nsUXThemeData::sTitlebarInfoPopulatedThemed = false;
|
||||
SIZE nsUXThemeData::sCommandButtons[4];
|
||||
const int NUM_COMMAND_BUTTONS = 4;
|
||||
SIZE nsUXThemeData::sCommandButtons[NUM_COMMAND_BUTTONS];
|
||||
|
||||
void
|
||||
nsUXThemeData::Teardown() {
|
||||
@ -221,6 +222,15 @@ nsUXThemeData::UpdateTitlebarInfo(HWND aWnd)
|
||||
sCommandButtons[2].cx = info.rgrect[5].right - info.rgrect[5].left;
|
||||
sCommandButtons[2].cy = info.rgrect[5].bottom - info.rgrect[5].top;
|
||||
|
||||
#ifdef DEBUG
|
||||
// Verify that all values for the command buttons are positive values
|
||||
// otherwise we have cached bad values for the caption buttons
|
||||
for (int i = 0; i < NUM_COMMAND_BUTTONS; i++) {
|
||||
MOZ_ASSERT(sCommandButtons[i].cx > 0);
|
||||
MOZ_ASSERT(sCommandButtons[i].cy > 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
sTitlebarInfoPopulatedThemed = true;
|
||||
}
|
||||
|
||||
|
@ -458,6 +458,16 @@ int32_t nsWindow::GetHeight(int32_t aProposedHeight)
|
||||
return aProposedHeight;
|
||||
}
|
||||
|
||||
static bool
|
||||
ShouldCacheTitleBarInfo(nsWindowType aWindowType, nsBorderStyle aBorderStyle)
|
||||
{
|
||||
return (aWindowType == eWindowType_toplevel) &&
|
||||
(aBorderStyle == eBorderStyle_default ||
|
||||
aBorderStyle == eBorderStyle_all) &&
|
||||
(!nsUXThemeData::sTitlebarInfoPopulatedThemed ||
|
||||
!nsUXThemeData::sTitlebarInfoPopulatedAero);
|
||||
}
|
||||
|
||||
// Create the proper widget
|
||||
nsresult
|
||||
nsWindow::Create(nsIWidget *aParent,
|
||||
@ -645,10 +655,8 @@ nsWindow::Create(nsIWidget *aParent,
|
||||
}
|
||||
|
||||
// Query for command button metric data for rendering the titlebar. We
|
||||
// only do this once on the first window.
|
||||
if (mWindowType == eWindowType_toplevel &&
|
||||
(!nsUXThemeData::sTitlebarInfoPopulatedThemed ||
|
||||
!nsUXThemeData::sTitlebarInfoPopulatedAero)) {
|
||||
// only do this once on the first window that has an actual titlebar
|
||||
if (ShouldCacheTitleBarInfo(mWindowType, mBorderStyle)) {
|
||||
nsUXThemeData::UpdateTitlebarInfo(mWnd);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user