Bug 1118134 - expose a method to set chromemargin. r=mstange r=bz

This commit is contained in:
Paul Rouget 2015-02-02 13:14:00 +01:00
Родитель 8d30181595
Коммит 14d9d356fb
3 изменённых файлов: 35 добавлений и 1 удалений

Просмотреть файл

@ -3888,6 +3888,28 @@ nsDOMWindowUtils::SetAudioVolume(float aVolume)
return window->SetAudioVolume(aVolume);
}
NS_IMETHODIMP
nsDOMWindowUtils::SetChromeMargin(int32_t aTop,
int32_t aRight,
int32_t aBottom,
int32_t aLeft)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
if (window) {
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(window->GetDocShell());
if (baseWindow) {
nsCOMPtr<nsIWidget> widget;
baseWindow->GetMainWidget(getter_AddRefs(widget));
if (widget) {
nsIntMargin margins(aTop, aRight, aBottom, aLeft);
return widget->SetNonClientMargins(margins);
}
}
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::XpconnectArgument(nsIDOMWindowUtils* aThis)
{

Просмотреть файл

@ -50,7 +50,7 @@ interface nsITranslationNodeList;
interface nsIJSRAIIHelper;
interface nsIContentPermissionRequest;
[scriptable, uuid(5ed850de-2b57-4555-ac48-93292e852eab)]
[scriptable, uuid(c8b21a1e-a69c-11e4-801f-0f8dde75d4c2)]
interface nsIDOMWindowUtils : nsISupports {
/**
@ -1737,6 +1737,16 @@ interface nsIDOMWindowUtils : nsISupports {
* May throw NS_ERROR_NOT_AVAILABLE.
*/
readonly attribute unsigned long long framesReflowed;
/**
* Controls the amount of chrome that should be visible on each side of
* the window. Works like the chromemargin xul:window attribute.
* This should only be used with non-XUL windows.
*/
void setChromeMargin(in int32_t aTop,
in int32_t aRight,
in int32_t aBottom,
in int32_t aLeft);
};
[scriptable, uuid(c694e359-7227-4392-a138-33c0cc1f15a6)]

Просмотреть файл

@ -2016,6 +2016,8 @@ NS_IMETHODIMP nsCocoaWindow::SetNonClientMargins(nsIntMargin &margins)
SetDrawsInTitlebar(margins.top == 0);
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}