mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 968835 - Cleanup nsHTMLDocument::GetSelection; r=smaug
This commit is contained in:
parent
243daf581d
commit
d6b1a972d6
@ -9,6 +9,7 @@
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/dom/HTMLAllCollection.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
@ -2154,28 +2155,24 @@ NS_IMETHODIMP
|
||||
nsHTMLDocument::GetSelection(nsISelection** aReturn)
|
||||
{
|
||||
ErrorResult rv;
|
||||
*aReturn = GetSelection(rv).take();
|
||||
NS_IF_ADDREF(*aReturn = GetSelection(rv));
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
already_AddRefed<Selection>
|
||||
nsHTMLDocument::GetSelection(ErrorResult& rv)
|
||||
Selection*
|
||||
nsHTMLDocument::GetSelection(ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(GetScopeObject());
|
||||
nsCOMPtr<nsPIDOMWindow> pwin = do_QueryInterface(window);
|
||||
if (!pwin) {
|
||||
return nullptr;
|
||||
}
|
||||
NS_ASSERTION(pwin->IsInnerWindow(), "Should have inner window here!");
|
||||
if (!pwin->GetOuterWindow() ||
|
||||
pwin->GetOuterWindow()->GetCurrentInnerWindow() != pwin) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(GetScopeObject());
|
||||
if (!window) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISelection> sel;
|
||||
rv = window->GetSelection(getter_AddRefs(sel));
|
||||
nsRefPtr<Selection> selection = static_cast<Selection*>(sel.get());
|
||||
return selection.forget();
|
||||
NS_ASSERTION(window->IsInnerWindow(), "Should have inner window here!");
|
||||
if (!window->IsCurrentInnerWindow()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return static_cast<nsGlobalWindow*>(window.get())->GetSelection(aRv);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -233,7 +233,7 @@ public:
|
||||
{
|
||||
// Deprecated
|
||||
}
|
||||
already_AddRefed<mozilla::Selection> GetSelection(mozilla::ErrorResult& rv);
|
||||
mozilla::Selection* GetSelection(mozilla::ErrorResult& aRv);
|
||||
// The XPCOM CaptureEvents works fine for us.
|
||||
// The XPCOM ReleaseEvents works fine for us.
|
||||
// We're picking up GetLocation from Document
|
||||
|
Loading…
Reference in New Issue
Block a user