mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 00:08:39 +09:00
Issue #2135 - Bug 1430303: Implement ShadowRoot.pointerLockElement
This commit is contained in:
parent
c920f32df3
commit
3dfffeaeca
9 changed files with 138 additions and 29 deletions
|
|
@ -11331,7 +11331,7 @@ GetPointerLockError(Element* aElement, Element* aCurrentLock,
|
|||
return "PointerLockDeniedInUse";
|
||||
}
|
||||
|
||||
if (!aElement->IsInUncomposedDoc()) {
|
||||
if (!aElement->IsInComposedDoc()) {
|
||||
return "PointerLockDeniedNotInDocument";
|
||||
}
|
||||
|
||||
|
|
@ -11382,11 +11382,11 @@ ChangePointerLockedElement(Element* aElement, nsIDocument* aDocument,
|
|||
MOZ_ASSERT(aDocument);
|
||||
MOZ_ASSERT(aElement != aPointerLockedElement);
|
||||
if (aPointerLockedElement) {
|
||||
MOZ_ASSERT(aPointerLockedElement->GetUncomposedDoc() == aDocument);
|
||||
MOZ_ASSERT(aPointerLockedElement->GetComposedDoc() == aDocument);
|
||||
aPointerLockedElement->ClearPointerLock();
|
||||
}
|
||||
if (aElement) {
|
||||
MOZ_ASSERT(aElement->GetUncomposedDoc() == aDocument);
|
||||
MOZ_ASSERT(aElement->GetComposedDoc() == aDocument);
|
||||
aElement->SetPointerLock();
|
||||
EventStateManager::sPointerLockedElement = do_GetWeakReference(aElement);
|
||||
EventStateManager::sPointerLockedDoc = do_GetWeakReference(aDocument);
|
||||
|
|
@ -11410,9 +11410,9 @@ PointerLockRequest::Run()
|
|||
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocument);
|
||||
nsDocument* d = static_cast<nsDocument*>(doc.get());
|
||||
const char* error = nullptr;
|
||||
if (!e || !d || !e->GetUncomposedDoc()) {
|
||||
if (!e || !d || !e->GetComposedDoc()) {
|
||||
error = "PointerLockDeniedNotInDocument";
|
||||
} else if (e->GetUncomposedDoc() != d) {
|
||||
} else if (e->GetComposedDoc() != d) {
|
||||
error = "PointerLockDeniedMovedDocument";
|
||||
}
|
||||
if (!error) {
|
||||
|
|
@ -11578,25 +11578,6 @@ nsDocument::GetMozPointerLockElement(nsIDOMElement** aPointerLockedElement)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
Element*
|
||||
nsIDocument::GetPointerLockElement()
|
||||
{
|
||||
nsCOMPtr<Element> pointerLockedElement =
|
||||
do_QueryReferent(EventStateManager::sPointerLockedElement);
|
||||
if (!pointerLockedElement) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Make sure pointer locked element is in the same document.
|
||||
nsCOMPtr<nsIDocument> pointerLockedDoc =
|
||||
do_QueryReferent(EventStateManager::sPointerLockedDoc);
|
||||
if (pointerLockedDoc != this) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return pointerLockedElement;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDocument::Observe(nsISupports *aSubject,
|
||||
const char *aTopic,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue