Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1118134 - expose a method to set chromemargin. r=mstange r=bz
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Rouget committed Feb 2, 2015
1 parent 5fffa38 commit a29b166
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
22 changes: 22 additions & 0 deletions dom/base/nsDOMWindowUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
12 changes: 11 additions & 1 deletion dom/interfaces/base/nsIDOMWindowUtils.idl
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

/**
Expand Down Expand Up @@ -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)]
Expand Down
2 changes: 2 additions & 0 deletions widget/cocoa/nsCocoaWindow.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2016,6 +2016,8 @@ nsIntRect newBounds(NSToIntRound(aX), NSToIntRound(aY),

SetDrawsInTitlebar(margins.top == 0);

return NS_OK;

NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}

Expand Down

0 comments on commit a29b166

Please sign in to comment.