mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1155691 - Expose WindowRoot to chrome from window in webidl. r=smaug
This commit is contained in:
parent
e4e891cb0c
commit
dbfb883711
@ -13676,6 +13676,14 @@ nsGlobalWindow::BeginWindowMove(Event& aMouseDownEvent, Element* aPanel,
|
||||
aError = widget->BeginMoveDrag(mouseEvent);
|
||||
}
|
||||
|
||||
already_AddRefed<nsWindowRoot>
|
||||
nsGlobalWindow::GetWindowRoot(mozilla::ErrorResult& aError)
|
||||
{
|
||||
FORWARD_TO_OUTER_OR_THROW(GetWindowRoot, (aError), aError, nullptr);
|
||||
nsCOMPtr<nsPIWindowRoot> root = GetTopWindowRoot();
|
||||
return root.forget().downcast<nsWindowRoot>();
|
||||
}
|
||||
|
||||
//Note: This call will lock the cursor, it will not change as it moves.
|
||||
//To unlock, the cursor must be set back to CURSOR_AUTO.
|
||||
NS_IMETHODIMP
|
||||
|
@ -1098,6 +1098,8 @@ public:
|
||||
JS::MutableHandle<JS::Value> aRetval,
|
||||
mozilla::ErrorResult& aError);
|
||||
|
||||
already_AddRefed<nsWindowRoot> GetWindowRoot(mozilla::ErrorResult& aError);
|
||||
|
||||
protected:
|
||||
// Web IDL helpers
|
||||
|
||||
|
@ -70,3 +70,4 @@ skip-if = buildapp == 'mulet'
|
||||
[test_fileconstructor_tempfile.xul]
|
||||
[test_nsITextInputProcessor.xul]
|
||||
[test_title.xul]
|
||||
[test_windowroot.xul]
|
||||
|
19
dom/base/test/chrome/test_windowroot.xul
Normal file
19
dom/base/test/chrome/test_windowroot.xul
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
<window title="Test window.windowRoot"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<!-- test results are displayed in the html:body -->
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
</body>
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript"><![CDATA[
|
||||
var root = window.windowRoot;
|
||||
ok(root instanceof WindowRoot, "windowRoot should be a WindowRoot");
|
||||
]]></script>
|
||||
</window>
|
@ -401,6 +401,12 @@ partial interface Window {
|
||||
[ChromeOnly, Throws] readonly attribute object? __content;
|
||||
|
||||
[Throws, ChromeOnly] any getInterface(IID iid);
|
||||
|
||||
/**
|
||||
* Same as nsIDOMWindow.windowRoot, useful for event listener targeting.
|
||||
*/
|
||||
[ChromeOnly, Throws]
|
||||
readonly attribute WindowRoot? windowRoot;
|
||||
};
|
||||
|
||||
Window implements TouchEventHandlers;
|
||||
|
Loading…
Reference in New Issue
Block a user