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
parent f71d34f608
commit df21c24cb2
3 changed files with 35 additions and 1 deletions

View File

@ -3888,6 +3888,28 @@ nsDOMWindowUtils::SetAudioVolume(float aVolume)
return window->SetAudioVolume(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 NS_IMETHODIMP
nsDOMWindowUtils::XpconnectArgument(nsIDOMWindowUtils* aThis) nsDOMWindowUtils::XpconnectArgument(nsIDOMWindowUtils* aThis)
{ {

View File

@ -50,7 +50,7 @@ interface nsITranslationNodeList;
interface nsIJSRAIIHelper; interface nsIJSRAIIHelper;
interface nsIContentPermissionRequest; interface nsIContentPermissionRequest;
[scriptable, uuid(5ed850de-2b57-4555-ac48-93292e852eab)] [scriptable, uuid(c8b21a1e-a69c-11e4-801f-0f8dde75d4c2)]
interface nsIDOMWindowUtils : nsISupports { interface nsIDOMWindowUtils : nsISupports {
/** /**
@ -1737,6 +1737,16 @@ interface nsIDOMWindowUtils : nsISupports {
* May throw NS_ERROR_NOT_AVAILABLE. * May throw NS_ERROR_NOT_AVAILABLE.
*/ */
readonly attribute unsigned long long framesReflowed; 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)] [scriptable, uuid(c694e359-7227-4392-a138-33c0cc1f15a6)]

View File

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