mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Back out 0cb85ff0f764 (bug 738568), 9949bb092303 (bug 730209), 095fd525afa7 (bug 729924), dcf8929a8115 (bug 633602) because of widely scattered and unclear bustage on a CLOSED TREE
This commit is contained in:
parent
d986e69874
commit
b4da60b42d
@ -780,12 +780,6 @@ public:
|
||||
*/
|
||||
static void ExitFullScreen(bool aRunAsync);
|
||||
|
||||
|
||||
virtual void RequestPointerLock(Element* aElement) = 0;
|
||||
|
||||
static void UnlockPointer();
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
// Document notification API's
|
||||
|
@ -1330,8 +1330,6 @@ private:
|
||||
NodeHasExplicitBaseURI,
|
||||
// Set if the element has some style states locked
|
||||
ElementHasLockedStyleStates,
|
||||
// Set if element has pointer locked
|
||||
ElementHasPointerLock,
|
||||
// Guard value
|
||||
BooleanFlagCount
|
||||
};
|
||||
@ -1390,9 +1388,6 @@ public:
|
||||
bool IsPurpleRoot() const { return GetBoolFlag(NodeIsPurpleRoot); }
|
||||
|
||||
bool HasListenerManager() { return HasFlag(NODE_HAS_LISTENERMANAGER); }
|
||||
bool HasPointerLock() const { return GetBoolFlag(ElementHasPointerLock); }
|
||||
void SetPointerLock() { SetBoolFlag(ElementHasPointerLock); }
|
||||
void ClearPointerLock() { ClearBoolFlag(ElementHasPointerLock); }
|
||||
protected:
|
||||
void SetParentIsContent(bool aValue) { SetBoolFlag(ParentIsContent, aValue); }
|
||||
void SetInDocument() { SetBoolFlag(IsInDocument); }
|
||||
|
@ -8658,13 +8658,6 @@ nsDocument::ExitFullScreen()
|
||||
// dispatch to so that we dispatch in the specified order.
|
||||
nsAutoTArray<nsIDocument*, 8> changed;
|
||||
|
||||
// We may also need to unlock the pointer, if it's locked.
|
||||
nsCOMPtr<Element> pointerLockedElement =
|
||||
do_QueryReferent(nsEventStateManager::sPointerLockedElement);
|
||||
if (pointerLockedElement) {
|
||||
UnlockPointer();
|
||||
}
|
||||
|
||||
// Walk the tree of full-screen documents, and reset their full-screen state.
|
||||
ResetFullScreen(root, static_cast<void*>(&changed));
|
||||
|
||||
@ -8695,20 +8688,12 @@ nsDocument::RestorePreviousFullScreenState()
|
||||
return;
|
||||
}
|
||||
|
||||
// If fullscreen mode is updated the pointer should be unlocked
|
||||
nsCOMPtr<Element> pointerLockedElement =
|
||||
do_QueryReferent(nsEventStateManager::sPointerLockedElement);
|
||||
if (pointerLockedElement) {
|
||||
UnlockPointer();
|
||||
}
|
||||
|
||||
// Clear full-screen stacks in all descendant documents, bottom up.
|
||||
nsCOMPtr<nsIDocument> fullScreenDoc(do_QueryReferent(sFullScreenDoc));
|
||||
nsIDocument* doc = fullScreenDoc;
|
||||
while (doc != this) {
|
||||
NS_ASSERTION(doc->IsFullScreenDoc(), "Should be full-screen doc");
|
||||
static_cast<nsDocument*>(doc)->ClearFullScreenStack();
|
||||
UnlockPointer();
|
||||
DispatchFullScreenChange(doc);
|
||||
doc = doc->GetParentDocument();
|
||||
}
|
||||
@ -8717,7 +8702,6 @@ nsDocument::RestorePreviousFullScreenState()
|
||||
NS_ASSERTION(doc == this, "Must have reached this doc.");
|
||||
while (doc != nsnull) {
|
||||
static_cast<nsDocument*>(doc)->FullScreenStackPop();
|
||||
UnlockPointer();
|
||||
DispatchFullScreenChange(doc);
|
||||
if (static_cast<nsDocument*>(doc)->mFullScreenStack.IsEmpty()) {
|
||||
// Full-screen stack in document is empty. Go back up to the parent
|
||||
@ -8993,22 +8977,7 @@ nsDocument::RequestFullScreen(Element* aElement, bool aWasCallerChrome)
|
||||
|
||||
// Remember the root document, so that if a full-screen document is hidden
|
||||
// we can reset full-screen state in the remaining visible full-screen documents.
|
||||
nsIDocument* fullScreenDoc = nsContentUtils::GetRootDocument(this);
|
||||
sFullScreenRootDoc = do_GetWeakReference(fullScreenDoc);
|
||||
|
||||
// If a document is already in fullscreen, then unlock the mouse pointer
|
||||
// before setting a new document to fullscreen
|
||||
if (fullScreenDoc) {
|
||||
UnlockPointer();
|
||||
}
|
||||
|
||||
// If a document is already in fullscreen, then unlock the mouse pointer
|
||||
// before setting a new document to fullscreen
|
||||
nsCOMPtr<Element> pointerLockedElement =
|
||||
do_QueryReferent(nsEventStateManager::sPointerLockedElement);
|
||||
if (pointerLockedElement) {
|
||||
UnlockPointer();
|
||||
}
|
||||
sFullScreenRootDoc = do_GetWeakReference(nsContentUtils::GetRootDocument(this));
|
||||
|
||||
// Set the full-screen element. This sets the full-screen style on the
|
||||
// element, and the full-screen-ancestor styles on ancestors of the element
|
||||
@ -9172,223 +9141,6 @@ nsDocument::IsFullScreenEnabled(bool aCallerIsChrome, bool aLogFailure)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
DispatchPointerLockChange(nsIDocument* aTarget)
|
||||
{
|
||||
nsRefPtr<nsAsyncDOMEvent> e =
|
||||
new nsAsyncDOMEvent(aTarget,
|
||||
NS_LITERAL_STRING("mozpointerlockchange"),
|
||||
true,
|
||||
false);
|
||||
e->PostDOMEvent();
|
||||
}
|
||||
|
||||
static void
|
||||
DispatchPointerLockError(nsIDocument* aTarget)
|
||||
{
|
||||
nsRefPtr<nsAsyncDOMEvent> e =
|
||||
new nsAsyncDOMEvent(aTarget,
|
||||
NS_LITERAL_STRING("mozpointerlockerror"),
|
||||
true,
|
||||
false);
|
||||
e->PostDOMEvent();
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::RequestPointerLock(Element* aElement)
|
||||
{
|
||||
NS_ASSERTION(aElement,
|
||||
"Must pass non-null element to nsDocument::RequestPointerLock");
|
||||
|
||||
nsCOMPtr<Element> pointerLockedElement =
|
||||
do_QueryReferent(nsEventStateManager::sPointerLockedElement);
|
||||
if (aElement == pointerLockedElement) {
|
||||
DispatchPointerLockChange(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ShouldLockPointer(aElement) ||
|
||||
!SetPointerLock(aElement, NS_STYLE_CURSOR_NONE)) {
|
||||
DispatchPointerLockError(this);
|
||||
return;
|
||||
}
|
||||
|
||||
aElement->SetPointerLock();
|
||||
nsEventStateManager::sPointerLockedElement = do_GetWeakReference(aElement);
|
||||
nsEventStateManager::sPointerLockedDoc =
|
||||
do_GetWeakReference(static_cast<nsIDocument*>(this));
|
||||
DispatchPointerLockChange(this);
|
||||
}
|
||||
|
||||
bool
|
||||
nsDocument::ShouldLockPointer(Element* aElement)
|
||||
{
|
||||
// Check if pointer lock pref is enabled
|
||||
if (!Preferences::GetBool("full-screen-api.pointer-lock.enabled")) {
|
||||
NS_WARNING("ShouldLockPointer(): Pointer Lock pref not enabled");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aElement != GetFullScreenElement()) {
|
||||
NS_WARNING("ShouldLockPointer(): Element not in fullscreen");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!aElement->IsInDoc()) {
|
||||
NS_WARNING("ShouldLockPointer(): Element without Document");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the element is in a document with a docshell.
|
||||
nsCOMPtr<nsIDocument> ownerDoc = aElement->OwnerDoc();
|
||||
if (!ownerDoc) {
|
||||
return false;
|
||||
}
|
||||
if (!nsCOMPtr<nsISupports>(ownerDoc->GetContainer())) {
|
||||
return false;
|
||||
}
|
||||
nsCOMPtr<nsPIDOMWindow> ownerWindow = ownerDoc->GetWindow();
|
||||
if (!ownerWindow) {
|
||||
return false;
|
||||
}
|
||||
nsCOMPtr<nsPIDOMWindow> ownerInnerWindow = ownerDoc->GetInnerWindow();
|
||||
if (!ownerInnerWindow) {
|
||||
return false;
|
||||
}
|
||||
if (ownerWindow->GetCurrentInnerWindow() != ownerInnerWindow) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDocument::SetPointerLock(Element* aElement, int aCursorStyle)
|
||||
{
|
||||
// NOTE: aElement will be nsnull when unlocking.
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetWindow();
|
||||
if (!window) {
|
||||
NS_WARNING("SetPointerLock(): No Window");
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIDocShell *docShell = window->GetDocShell();
|
||||
if (!docShell) {
|
||||
NS_WARNING("SetPointerLock(): No DocShell (window already closed?)");
|
||||
return false;
|
||||
}
|
||||
|
||||
nsRefPtr<nsPresContext> presContext;
|
||||
docShell->GetPresContext(getter_AddRefs(presContext));
|
||||
if (!presContext) {
|
||||
NS_WARNING("SetPointerLock(): Unable to get presContext in \
|
||||
domWindow->GetDocShell()->GetPresContext()");
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell = presContext->PresShell();
|
||||
if (!shell) {
|
||||
NS_WARNING("SetPointerLock(): Unable to find presContext->PresShell()");
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIFrame* rootFrame = shell->GetRootFrame();
|
||||
if (!rootFrame) {
|
||||
NS_WARNING("SetPointerLock(): Unable to get root frame");
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWidget> widget = rootFrame->GetNearestWidget();
|
||||
if (!widget) {
|
||||
NS_WARNING("SetPointerLock(): Unable to find widget in \
|
||||
shell->GetRootFrame()->GetNearestWidget();");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aElement && (aElement->OwnerDoc() != this)) {
|
||||
NS_WARNING("SetPointerLock(): Element not in this document.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Hide the cursor and set pointer lock for future mouse events
|
||||
nsRefPtr<nsEventStateManager> esm = presContext->EventStateManager();
|
||||
esm->SetCursor(aCursorStyle, nsnull, false,
|
||||
0.0f, 0.0f, widget, true);
|
||||
esm->SetPointerLock(widget, aElement);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::UnlockPointer()
|
||||
{
|
||||
if (!nsEventStateManager::sIsPointerLocked) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> pointerLockedDoc =
|
||||
do_QueryReferent(nsEventStateManager::sPointerLockedDoc);
|
||||
if (!pointerLockedDoc) {
|
||||
return;
|
||||
}
|
||||
nsDocument* doc = static_cast<nsDocument*>(pointerLockedDoc.get());
|
||||
if (!doc->SetPointerLock(nsnull, NS_STYLE_CURSOR_AUTO)) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<Element> pointerLockedElement =
|
||||
do_QueryReferent(nsEventStateManager::sPointerLockedElement);
|
||||
if (!pointerLockedElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsEventStateManager::sPointerLockedElement = nsnull;
|
||||
nsEventStateManager::sPointerLockedDoc = nsnull;
|
||||
pointerLockedElement->ClearPointerLock();
|
||||
DispatchPointerLockChange(pointerLockedDoc);
|
||||
}
|
||||
|
||||
void
|
||||
nsIDocument::UnlockPointer()
|
||||
{
|
||||
nsDocument::UnlockPointer();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::MozExitPointerLock()
|
||||
{
|
||||
UnlockPointer();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetMozPointerLockElement(nsIDOMElement** aPointerLockedElement)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPointerLockedElement);
|
||||
*aPointerLockedElement = nsnull;
|
||||
nsCOMPtr<Element> pointerLockedElement =
|
||||
do_QueryReferent(nsEventStateManager::sPointerLockedElement);
|
||||
if (!pointerLockedElement) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Make sure pointer locked element is in the same document and domain.
|
||||
nsCOMPtr<nsIDocument> pointerLockedDoc =
|
||||
do_QueryReferent(nsEventStateManager::sPointerLockedDoc);
|
||||
nsDocument* doc = static_cast<nsDocument*>(pointerLockedDoc.get());
|
||||
if (doc != this) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> pointerLockedNode =
|
||||
do_QueryInterface(pointerLockedElement);
|
||||
nsresult rv = nsContentUtils::CheckSameOrigin(this, pointerLockedNode.get());
|
||||
if (NS_FAILED(rv)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return CallQueryInterface(pointerLockedElement, aPointerLockedElement);
|
||||
}
|
||||
|
||||
#define EVENT(name_, id_, type_, struct_) \
|
||||
NS_IMETHODIMP nsDocument::GetOn##name_(JSContext *cx, jsval *vp) { \
|
||||
return nsINode::GetOn##name_(cx, vp); \
|
||||
|
@ -987,11 +987,6 @@ public:
|
||||
// Returns the top element from the full-screen stack.
|
||||
Element* FullScreenStackTop();
|
||||
|
||||
void RequestPointerLock(Element* aElement);
|
||||
bool ShouldLockPointer(Element* aElement);
|
||||
bool SetPointerLock(Element* aElement, int aCursorStyle);
|
||||
static void UnlockPointer();
|
||||
|
||||
// This method may fire a DOM event; if it does so it will happen
|
||||
// synchronously.
|
||||
void UpdateVisibilityState();
|
||||
|
@ -3274,9 +3274,6 @@ nsGenericElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
||||
// Fully exit full-screen.
|
||||
nsIDocument::ExitFullScreen(false);
|
||||
}
|
||||
if (HasPointerLock()) {
|
||||
nsIDocument::UnlockPointer();
|
||||
}
|
||||
if (GetParent()) {
|
||||
NS_RELEASE(mParent);
|
||||
} else {
|
||||
@ -6419,15 +6416,7 @@ nsINode::Contains(nsIDOMNode* aOther, bool* aReturn)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericElement::MozRequestPointerLock()
|
||||
{
|
||||
OwnerDoc()->RequestPointerLock(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGenericElement::MozRequestFullScreen()
|
||||
nsresult nsGenericElement::MozRequestFullScreen()
|
||||
{
|
||||
// Only grant full-screen requests if this is called from inside a trusted
|
||||
// event handler (i.e. inside an event handler for a user initiated event).
|
||||
|
@ -592,8 +592,6 @@ GK_ATOM(mousethrough, "mousethrough")
|
||||
GK_ATOM(mouseup, "mouseup")
|
||||
GK_ATOM(mozfullscreenchange, "mozfullscreenchange")
|
||||
GK_ATOM(mozfullscreenerror, "mozfullscreenerror")
|
||||
GK_ATOM(mozpointerlockchange, "mozpointerlockchange")
|
||||
GK_ATOM(mozpointerlockerror, "mozpointerlockerror")
|
||||
GK_ATOM(moz_opaque, "moz-opaque")
|
||||
GK_ATOM(moz_action_hint, "mozactionhint")
|
||||
GK_ATOM(x_moz_errormessage, "x-moz-errormessage")
|
||||
@ -715,8 +713,6 @@ GK_ATOM(onmouseup, "onmouseup")
|
||||
GK_ATOM(onMozAfterPaint, "onMozAfterPaint")
|
||||
GK_ATOM(onmozfullscreenchange, "onmozfullscreenchange")
|
||||
GK_ATOM(onmozfullscreenerror, "onmozfullscreenerror")
|
||||
GK_ATOM(onmozpointerlockchange, "onmozpointerlockchange")
|
||||
GK_ATOM(onmozpointerlockerror, "onmozpointerlockerror")
|
||||
GK_ATOM(onMozMousePixelScroll, "onMozMousePixelScroll")
|
||||
GK_ATOM(onMozScrolledAreaChanged, "onMozScrolledAreaChanged")
|
||||
GK_ATOM(ononline, "ononline")
|
||||
|
@ -275,14 +275,6 @@ EVENT(mozfullscreenerror,
|
||||
NS_FULLSCREENERROR,
|
||||
EventNameType_HTML,
|
||||
NS_EVENT_NULL)
|
||||
EVENT(mozpointerlockchange,
|
||||
NS_POINTERLOCKCHANGE,
|
||||
EventNameType_HTML,
|
||||
NS_EVENT_NULL)
|
||||
EVENT(mozpointerlockerror,
|
||||
NS_POINTERLOCKERROR,
|
||||
EventNameType_HTML,
|
||||
NS_EVENT_NULL)
|
||||
// Not supported yet; probably never because "wheel" is a better idea.
|
||||
// EVENT(mousewheel)
|
||||
EVENT(pause,
|
||||
|
@ -100,8 +100,6 @@ static const char* const sEventNames[] = {
|
||||
"MozBeforeResize",
|
||||
"mozfullscreenchange",
|
||||
"mozfullscreenerror",
|
||||
"mozpointerlockchange",
|
||||
"mozpointerlockerror",
|
||||
"MozSwipeGesture",
|
||||
"MozMagnifyGestureStart",
|
||||
"MozMagnifyGestureUpdate",
|
||||
@ -1171,10 +1169,6 @@ nsDOMEvent::GetScreenCoords(nsPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIntPoint aPoint)
|
||||
{
|
||||
if (nsEventStateManager::sIsPointerLocked) {
|
||||
return nsEventStateManager::sLastScreenPoint;
|
||||
}
|
||||
|
||||
if (!aEvent ||
|
||||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
aEvent->eventStructType != NS_POPUP_EVENT &&
|
||||
@ -1230,10 +1224,6 @@ nsDOMEvent::GetClientCoords(nsPresContext* aPresContext,
|
||||
nsIntPoint aPoint,
|
||||
nsIntPoint aDefaultPoint)
|
||||
{
|
||||
if (nsEventStateManager::sIsPointerLocked) {
|
||||
return nsEventStateManager::sLastClientPoint;
|
||||
}
|
||||
|
||||
if (!aEvent ||
|
||||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
aEvent->eventStructType != NS_POPUP_EVENT &&
|
||||
|
@ -183,8 +183,6 @@ public:
|
||||
eDOMEvents_beforeresize,
|
||||
eDOMEvents_mozfullscreenchange,
|
||||
eDOMEvents_mozfullscreenerror,
|
||||
eDOMEvents_mozpointerlockchange,
|
||||
eDOMEvents_mozpointerlockerror,
|
||||
eDOMEvents_MozSwipeGesture,
|
||||
eDOMEvents_MozMagnifyGestureStart,
|
||||
eDOMEvents_MozMagnifyGestureUpdate,
|
||||
|
@ -233,24 +233,6 @@ nsDOMMouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMMouseEvent::GetMozMovementX(PRInt32* aMovementX)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aMovementX);
|
||||
*aMovementX = GetMovementPoint().x;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMMouseEvent::GetMozMovementY(PRInt32* aMovementY)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aMovementY);
|
||||
*aMovementY = GetMovementPoint().y;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsDOMMouseEvent::GetScreenX(PRInt32* aScreenX)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aScreenX);
|
||||
|
@ -49,6 +49,7 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "DictionaryHelpers.h"
|
||||
|
||||
@ -57,9 +58,6 @@ nsDOMUIEvent::nsDOMUIEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent)
|
||||
static_cast<nsEvent *>(aEvent) :
|
||||
static_cast<nsEvent *>(new nsUIEvent(false, 0, 0)))
|
||||
, mClientPoint(0, 0), mLayerPoint(0, 0), mPagePoint(0, 0)
|
||||
, mIsPointerLocked(nsEventStateManager::sIsPointerLocked)
|
||||
, mLastScreenPoint(nsEventStateManager::sLastScreenPoint)
|
||||
, mLastClientPoint(nsEventStateManager::sLastClientPoint)
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
@ -126,7 +124,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMUIEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
nsIntPoint
|
||||
nsDOMUIEvent::GetMovementPoint()
|
||||
nsDOMUIEvent::GetScreenPoint()
|
||||
{
|
||||
if (!mEvent ||
|
||||
(mEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
@ -139,40 +137,42 @@ nsDOMUIEvent::GetMovementPoint()
|
||||
}
|
||||
|
||||
if (!((nsGUIEvent*)mEvent)->widget ) {
|
||||
return mEvent->lastRefPoint;
|
||||
return mEvent->refPoint;
|
||||
}
|
||||
|
||||
// Calculate the delta between the previous screen point and the current one.
|
||||
nsIntPoint currentPoint = CalculateScreenPoint(mPresContext, mEvent);
|
||||
|
||||
// Adjust previous event's refPoint so it compares to current screenX, screenY
|
||||
nsIntPoint offset = mEvent->lastRefPoint +
|
||||
nsIntPoint offset = mEvent->refPoint +
|
||||
((nsGUIEvent*)mEvent)->widget->WidgetToScreenOffset();
|
||||
nscoord factor = mPresContext->DeviceContext()->UnscaledAppUnitsPerDevPixel();
|
||||
nsIntPoint lastPoint = nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor),
|
||||
return nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor),
|
||||
nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor));
|
||||
|
||||
return currentPoint - lastPoint;
|
||||
}
|
||||
|
||||
nsIntPoint
|
||||
nsDOMUIEvent::GetScreenPoint()
|
||||
{
|
||||
if (mIsPointerLocked) {
|
||||
return mLastScreenPoint;
|
||||
}
|
||||
|
||||
return CalculateScreenPoint(mPresContext, mEvent);
|
||||
}
|
||||
|
||||
nsIntPoint
|
||||
nsDOMUIEvent::GetClientPoint()
|
||||
{
|
||||
if (mIsPointerLocked) {
|
||||
return mLastClientPoint;
|
||||
if (!mEvent ||
|
||||
(mEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
mEvent->eventStructType != NS_POPUP_EVENT &&
|
||||
mEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
|
||||
mEvent->eventStructType != NS_MOZTOUCH_EVENT &&
|
||||
mEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
mEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT) ||
|
||||
!mPresContext ||
|
||||
!((nsGUIEvent*)mEvent)->widget) {
|
||||
return mClientPoint;
|
||||
}
|
||||
|
||||
return CalculateClientPoint(mPresContext, mEvent, &mClientPoint);
|
||||
nsPoint pt(0, 0);
|
||||
nsIPresShell* shell = mPresContext->GetPresShell();
|
||||
if (!shell) {
|
||||
return nsIntPoint(0, 0);
|
||||
}
|
||||
nsIFrame* rootFrame = shell->GetRootFrame();
|
||||
if (rootFrame)
|
||||
pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(mEvent, rootFrame);
|
||||
|
||||
return nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(pt.x),
|
||||
nsPresContext::AppUnitsToIntCSSPixels(pt.y));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -41,7 +41,6 @@
|
||||
|
||||
#include "nsIDOMUIEvent.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
class nsDOMUIEvent : public nsDOMEvent,
|
||||
public nsIDOMUIEvent
|
||||
@ -67,67 +66,10 @@ public:
|
||||
|
||||
virtual nsresult InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx, jsval* aVal);
|
||||
|
||||
static nsIntPoint CalculateScreenPoint(nsPresContext* aPresContext,
|
||||
nsEvent* aEvent)
|
||||
{
|
||||
if (!aEvent ||
|
||||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
aEvent->eventStructType != NS_POPUP_EVENT &&
|
||||
aEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
|
||||
aEvent->eventStructType != NS_MOZTOUCH_EVENT &&
|
||||
aEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
aEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT)) {
|
||||
return nsIntPoint(0, 0);
|
||||
}
|
||||
|
||||
if (!((nsGUIEvent*)aEvent)->widget ) {
|
||||
return aEvent->refPoint;
|
||||
}
|
||||
|
||||
nsIntPoint offset = aEvent->refPoint +
|
||||
((nsGUIEvent*)aEvent)->widget->WidgetToScreenOffset();
|
||||
nscoord factor = aPresContext->DeviceContext()->UnscaledAppUnitsPerDevPixel();
|
||||
return nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor),
|
||||
nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor));
|
||||
}
|
||||
|
||||
static nsIntPoint CalculateClientPoint(nsPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIntPoint* aDefaultClientPoint)
|
||||
{
|
||||
if (!aEvent ||
|
||||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
aEvent->eventStructType != NS_POPUP_EVENT &&
|
||||
aEvent->eventStructType != NS_MOUSE_SCROLL_EVENT &&
|
||||
aEvent->eventStructType != NS_MOZTOUCH_EVENT &&
|
||||
aEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
aEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT) ||
|
||||
!aPresContext ||
|
||||
!((nsGUIEvent*)aEvent)->widget) {
|
||||
return (nsnull == aDefaultClientPoint ? nsIntPoint(0, 0) :
|
||||
nsIntPoint(aDefaultClientPoint->x, aDefaultClientPoint->y));
|
||||
}
|
||||
|
||||
nsPoint pt(0, 0);
|
||||
nsIPresShell* shell = aPresContext->GetPresShell();
|
||||
if (!shell) {
|
||||
return nsIntPoint(0, 0);
|
||||
}
|
||||
nsIFrame* rootFrame = shell->GetRootFrame();
|
||||
if (rootFrame) {
|
||||
pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(aEvent, rootFrame);
|
||||
}
|
||||
|
||||
return nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(pt.x),
|
||||
nsPresContext::AppUnitsToIntCSSPixels(pt.y));
|
||||
}
|
||||
|
||||
protected:
|
||||
// Internal helper functions
|
||||
nsIntPoint GetScreenPoint();
|
||||
nsIntPoint GetClientPoint();
|
||||
nsIntPoint GetMovementPoint();
|
||||
nsIntPoint GetLayerPoint();
|
||||
nsIntPoint GetPagePoint();
|
||||
|
||||
@ -146,10 +88,6 @@ protected:
|
||||
// Screenpoint is mEvent->refPoint.
|
||||
nsIntPoint mLayerPoint;
|
||||
nsIntPoint mPagePoint;
|
||||
nsIntPoint mMovement;
|
||||
bool mIsPointerLocked;
|
||||
nsIntPoint mLastScreenPoint;
|
||||
nsIntPoint mLastClientPoint;
|
||||
};
|
||||
|
||||
#define NS_FORWARD_TO_NSDOMUIEVENT \
|
||||
|
@ -136,8 +136,6 @@
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "sampler.h"
|
||||
|
||||
#include "nsIDOMClientRect.h"
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#import <ApplicationServices/ApplicationServices.h>
|
||||
#endif
|
||||
@ -160,15 +158,6 @@ bool nsEventStateManager::sNormalLMouseEventInProcess = false;
|
||||
nsEventStateManager* nsEventStateManager::sActiveESM = nsnull;
|
||||
nsIDocument* nsEventStateManager::sMouseOverDocument = nsnull;
|
||||
nsWeakFrame nsEventStateManager::sLastDragOverFrame = nsnull;
|
||||
nsIntPoint nsEventStateManager::sLastRefPoint = nsIntPoint(0,0);
|
||||
nsIntPoint nsEventStateManager::sLastScreenOffset = nsIntPoint(0,0);
|
||||
nsIntPoint nsEventStateManager::sLastScreenPoint = nsIntPoint(0,0);
|
||||
nsIntPoint nsEventStateManager::sLastClientPoint = nsIntPoint(0,0);
|
||||
bool nsEventStateManager::sIsPointerLocked = false;
|
||||
// Reference to the pointer locked element.
|
||||
nsWeakPtr nsEventStateManager::sPointerLockedElement;
|
||||
// Reference to the document which requested pointer lock.
|
||||
nsWeakPtr nsEventStateManager::sPointerLockedDoc;
|
||||
nsCOMPtr<nsIContent> nsEventStateManager::sDragOverContent = nsnull;
|
||||
|
||||
static PRUint32 gMouseOrKeyboardEventCounter = 0;
|
||||
@ -782,7 +771,6 @@ nsMouseWheelTransaction::LimitToOnePageScroll(PRInt32 aScrollLines,
|
||||
|
||||
nsEventStateManager::nsEventStateManager()
|
||||
: mLockCursor(0),
|
||||
mPreLockPoint(0,0),
|
||||
mCurrentTarget(nsnull),
|
||||
mLastMouseOverFrame(nsnull),
|
||||
// init d&d gesture state machine variables
|
||||
@ -1057,23 +1045,6 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
NS_ASSERTION(mCurrentTarget, "mCurrentTarget is null. this should not happen. see bug #13007");
|
||||
if (!mCurrentTarget) return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (NS_IS_DRAG_EVENT(aEvent) && sIsPointerLocked) {
|
||||
NS_ASSERTION(sIsPointerLocked,
|
||||
"sIsPointerLocked is true. Drag events should be suppressed when the pointer is locked.");
|
||||
}
|
||||
#endif
|
||||
// Store last known screenPoint and clientPoint so pointer lock
|
||||
// can use these values as constants.
|
||||
if (NS_IS_TRUSTED_EVENT(aEvent) &&
|
||||
(NS_IS_MOUSE_EVENT_STRUCT(aEvent) &&
|
||||
IsMouseEventReal(aEvent)) ||
|
||||
aEvent->eventStructType == NS_MOUSE_SCROLL_EVENT) {
|
||||
if (!sIsPointerLocked) {
|
||||
sLastScreenPoint = nsDOMUIEvent::CalculateScreenPoint(aPresContext, aEvent);
|
||||
sLastClientPoint = nsDOMUIEvent::CalculateClientPoint(aPresContext, aEvent, nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
// Do not take account NS_MOUSE_ENTER/EXIT so that loading a page
|
||||
// when user is not active doesn't change the state to active.
|
||||
@ -3807,25 +3778,6 @@ nsEventStateManager::DispatchMouseEvent(nsGUIEvent* aEvent, PRUint32 aMessage,
|
||||
nsIContent* aTargetContent,
|
||||
nsIContent* aRelatedContent)
|
||||
{
|
||||
// http://dvcs.w3.org/hg/webevents/raw-file/default/mouse-lock.html#methods
|
||||
// "[When the mouse is locked on an element...e]vents that require the concept
|
||||
// of a mouse cursor must not be dispatched (for example: mouseover, mouseout).
|
||||
if (sIsPointerLocked &&
|
||||
(aMessage == NS_MOUSELEAVE ||
|
||||
aMessage == NS_MOUSEENTER ||
|
||||
aMessage == NS_MOUSE_ENTER_SYNTH ||
|
||||
aMessage == NS_MOUSE_EXIT_SYNTH)) {
|
||||
mCurrentTargetContent = nsnull;
|
||||
nsCOMPtr<Element> pointerLockedElement =
|
||||
do_QueryReferent(nsEventStateManager::sPointerLockedElement);
|
||||
if (!pointerLockedElement) {
|
||||
NS_WARNING("Should have pointer locked element, but didn't.");
|
||||
return nsnull;
|
||||
}
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(pointerLockedElement);
|
||||
return mPresContext->GetPrimaryFrameFor(content);
|
||||
}
|
||||
|
||||
SAMPLE_LABEL("Input", "DispatchMouseEvent");
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsMouseEvent event(NS_IS_TRUSTED_EVENT(aEvent), aMessage, aEvent->widget,
|
||||
@ -4036,26 +3988,6 @@ nsEventStateManager::GenerateMouseEnterExit(nsGUIEvent* aEvent)
|
||||
switch(aEvent->message) {
|
||||
case NS_MOUSE_MOVE:
|
||||
{
|
||||
if (sIsPointerLocked && aEvent->widget) {
|
||||
// Perform mouse lock by recentering the mouse directly, then remembering the deltas.
|
||||
nsIntRect bounds;
|
||||
aEvent->widget->GetScreenBounds(bounds);
|
||||
aEvent->lastRefPoint = GetMouseCoords(bounds);
|
||||
|
||||
// refPoint should not be the centre on mousemove
|
||||
if (aEvent->refPoint.x == aEvent->lastRefPoint.x &&
|
||||
aEvent->refPoint.y == aEvent->lastRefPoint.y) {
|
||||
aEvent->refPoint = sLastRefPoint;
|
||||
} else {
|
||||
aEvent->widget->SynthesizeNativeMouseMove(aEvent->lastRefPoint);
|
||||
}
|
||||
} else {
|
||||
aEvent->lastRefPoint = nsIntPoint(sLastRefPoint.x, sLastRefPoint.y);
|
||||
}
|
||||
|
||||
// Update the last known refPoint with the current refPoint.
|
||||
sLastRefPoint = nsIntPoint(aEvent->refPoint.x, aEvent->refPoint.y);
|
||||
|
||||
// Get the target content target (mousemove target == mouseover target)
|
||||
nsCOMPtr<nsIContent> targetElement = GetEventTargetContent(aEvent);
|
||||
if (!targetElement) {
|
||||
@ -4091,79 +4023,6 @@ nsEventStateManager::GenerateMouseEnterExit(nsGUIEvent* aEvent)
|
||||
mCurrentTargetContent = targetBeforeEvent;
|
||||
}
|
||||
|
||||
void
|
||||
nsEventStateManager::SetPointerLock(nsIWidget* aWidget,
|
||||
nsIContent* aElement)
|
||||
{
|
||||
// NOTE: aElement will be nsnull when unlocking.
|
||||
sIsPointerLocked = !!aElement;
|
||||
|
||||
if (!aWidget) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset mouse wheel transaction
|
||||
nsMouseWheelTransaction::EndTransaction();
|
||||
|
||||
// Deal with DnD events
|
||||
nsCOMPtr<nsIDragService> dragService =
|
||||
do_GetService("@mozilla.org/widget/dragservice;1");
|
||||
|
||||
if (sIsPointerLocked) {
|
||||
// Store the last known ref point so we can reposition the pointer after unlock.
|
||||
mPreLockPoint = sLastRefPoint + sLastScreenOffset;
|
||||
|
||||
nsIntRect bounds;
|
||||
aWidget->GetScreenBounds(bounds);
|
||||
sLastRefPoint = GetMouseCoords(bounds);
|
||||
aWidget->SynthesizeNativeMouseMove(sLastRefPoint);
|
||||
|
||||
// Retarget all events to this element via capture.
|
||||
nsIPresShell::SetCapturingContent(aElement, CAPTURE_POINTERLOCK);
|
||||
|
||||
// Suppress DnD
|
||||
if (dragService) {
|
||||
dragService->Suppress();
|
||||
}
|
||||
} else {
|
||||
// Unlocking, so return pointer to the original position
|
||||
aWidget->SynthesizeNativeMouseMove(sLastScreenPoint);
|
||||
|
||||
// Don't retarget events to this element any more.
|
||||
nsIPresShell::SetCapturingContent(nsnull, CAPTURE_POINTERLOCK);
|
||||
|
||||
// Unsuppress DnD
|
||||
if (dragService) {
|
||||
dragService->Unsuppress();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsIntPoint
|
||||
nsEventStateManager::GetMouseCoords(nsIntRect aBounds)
|
||||
{
|
||||
NS_ASSERTION(sIsPointerLocked, "GetMouseCoords when not pointer locked!");
|
||||
|
||||
nsCOMPtr<nsIDocument> pointerLockedDoc =
|
||||
do_QueryReferent(nsEventStateManager::sPointerLockedDoc);
|
||||
if (!pointerLockedDoc) {
|
||||
NS_WARNING("GetMouseCoords(): No Document");
|
||||
return nsIntPoint(0, 0);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> domWin = pointerLockedDoc->GetInnerWindow();
|
||||
if (!domWin) {
|
||||
NS_WARNING("GetMouseCoords(): No Window");
|
||||
return nsIntPoint(0, 0);
|
||||
}
|
||||
|
||||
int innerHeight;
|
||||
domWin->GetInnerHeight(&innerHeight);
|
||||
|
||||
return nsIntPoint((aBounds.width / 2) + aBounds.x,
|
||||
(innerHeight / 2) + (aBounds.y + (aBounds.height - innerHeight)));
|
||||
}
|
||||
|
||||
void
|
||||
nsEventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
||||
nsGUIEvent* aEvent)
|
||||
|
@ -228,12 +228,6 @@ public:
|
||||
|
||||
static bool IsRemoteTarget(nsIContent* aTarget);
|
||||
|
||||
static nsIntPoint sLastScreenPoint;
|
||||
static nsIntPoint sLastClientPoint;
|
||||
static bool sIsPointerLocked;
|
||||
static nsWeakPtr sPointerLockedElement;
|
||||
static nsWeakPtr sPointerLockedDoc;
|
||||
|
||||
protected:
|
||||
friend class MouseEnterLeaveDispatcher;
|
||||
|
||||
@ -486,16 +480,11 @@ private:
|
||||
|
||||
PRInt32 mLockCursor;
|
||||
|
||||
// Point when mouse was locked, used to reposition after unlocking.
|
||||
nsIntPoint mPreLockPoint;
|
||||
|
||||
nsWeakFrame mCurrentTarget;
|
||||
nsCOMPtr<nsIContent> mCurrentTargetContent;
|
||||
nsWeakFrame mLastMouseOverFrame;
|
||||
nsCOMPtr<nsIContent> mLastMouseOverElement;
|
||||
static nsWeakFrame sLastDragOverFrame;
|
||||
static nsIntPoint sLastRefPoint;
|
||||
static nsIntPoint sLastScreenOffset;
|
||||
|
||||
// member variables for the d&d gesture state machine
|
||||
nsIntPoint mGestureDownPoint; // screen coordinates
|
||||
@ -567,9 +556,6 @@ public:
|
||||
nsGUIEvent* inMouseDownEvent ) ;
|
||||
void KillClickHoldTimer ( ) ;
|
||||
void FireContextClick ( ) ;
|
||||
|
||||
void SetPointerLock(nsIWidget* aWidget, nsIContent* aElement) ;
|
||||
nsIntPoint GetMouseCoords(nsIntRect aBounds);
|
||||
static void sClickHoldCallback ( nsITimer* aTimer, void* aESM ) ;
|
||||
};
|
||||
|
||||
|
@ -66,7 +66,7 @@ interface nsIDOMLocation;
|
||||
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
|
||||
*/
|
||||
|
||||
[scriptable, uuid(e8d73d0a-cbf6-4037-a565-32c8d64cc294)]
|
||||
[scriptable, uuid(ac4942fe-1679-4000-aaa7-41dee590a120)]
|
||||
interface nsIDOMDocument : nsIDOMNode
|
||||
{
|
||||
readonly attribute nsIDOMDocumentType doctype;
|
||||
@ -396,21 +396,6 @@ interface nsIDOMDocument : nsIDOMNode
|
||||
*/
|
||||
readonly attribute boolean mozFullScreenEnabled;
|
||||
|
||||
/**
|
||||
* The element to which the mouse pointer is locked, if any, as per the
|
||||
* DOM pointer lock api.
|
||||
*
|
||||
* @see <http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html>
|
||||
*/
|
||||
readonly attribute nsIDOMElement mozPointerLockElement;
|
||||
|
||||
/**
|
||||
* Exit pointer is lock if locked, as per the DOM pointer lock api.
|
||||
*
|
||||
* @see <http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html>
|
||||
*/
|
||||
void mozExitPointerLock();
|
||||
|
||||
/**
|
||||
* Inline event handler for readystatechange events.
|
||||
*/
|
||||
|
@ -49,7 +49,7 @@
|
||||
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-element
|
||||
*/
|
||||
|
||||
[scriptable, uuid(432a86dd-c0b8-4d21-8ac6-5ae57d28ea6b)]
|
||||
[scriptable, uuid(295e05d9-9174-48ae-bc59-d7e6a8757726)]
|
||||
interface nsIDOMElement : nsIDOMNode
|
||||
{
|
||||
readonly attribute DOMString tagName;
|
||||
@ -228,12 +228,4 @@ interface nsIDOMElement : nsIDOMNode
|
||||
* @see <https://wiki.mozilla.org/index.php?title=Gecko:FullScreenAPI>
|
||||
*/
|
||||
void mozRequestFullScreen();
|
||||
|
||||
/**
|
||||
* Requests that this element be made the pointer-locked element, as per the DOM
|
||||
* pointer lock api.
|
||||
*
|
||||
* @see <http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html>
|
||||
*/
|
||||
void mozRequestPointerLock();
|
||||
};
|
||||
|
@ -82,8 +82,6 @@ interface nsIInlineEventHandlers : nsISupports
|
||||
// [implicit_jscontext] attribute jsval onmousewheel;
|
||||
[implicit_jscontext] attribute jsval onmozfullscreenchange;
|
||||
[implicit_jscontext] attribute jsval onmozfullscreenerror;
|
||||
[implicit_jscontext] attribute jsval onmozpointerlockchange;
|
||||
[implicit_jscontext] attribute jsval onmozpointerlockerror;
|
||||
[implicit_jscontext] attribute jsval onpause;
|
||||
[implicit_jscontext] attribute jsval onplay;
|
||||
[implicit_jscontext] attribute jsval onplaying;
|
||||
|
@ -48,15 +48,12 @@
|
||||
* http://www.w3.org/TR/DOM-Level-2-Events/
|
||||
*/
|
||||
|
||||
[scriptable, uuid(53E29996-F851-4032-B896-8AAFBD0BDF25)]
|
||||
[scriptable, uuid(7f57aa45-6792-4d8b-ba5b-201533cf0b2f)]
|
||||
interface nsIDOMMouseEvent : nsIDOMUIEvent
|
||||
{
|
||||
readonly attribute long screenX;
|
||||
readonly attribute long screenY;
|
||||
|
||||
readonly attribute long mozMovementX;
|
||||
readonly attribute long mozMovementY;
|
||||
|
||||
readonly attribute long clientX;
|
||||
readonly attribute long clientY;
|
||||
|
||||
|
@ -48,7 +48,6 @@ DIRS += \
|
||||
dom-level2-core \
|
||||
dom-level2-html \
|
||||
ajax \
|
||||
browser-frame \
|
||||
bugs \
|
||||
chrome \
|
||||
general \
|
||||
@ -56,9 +55,9 @@ DIRS += \
|
||||
geolocation \
|
||||
localstorage \
|
||||
orientation \
|
||||
pointerlock \
|
||||
sessionstorage \
|
||||
storageevent \
|
||||
browser-frame \
|
||||
$(NULL)
|
||||
|
||||
#needs IPC support, also tests do not run successfully in Firefox for now
|
||||
|
@ -1,39 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = dom/tests/mochitest/pointerlock
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_TEST_FILES = \
|
||||
test_pointerlock-api.html \
|
||||
pointerlock_utils.js \
|
||||
file_pointerlock-api.html \
|
||||
file_pointerlockerror.html \
|
||||
file_escapeKey.html \
|
||||
file_withoutDOM.html \
|
||||
file_removedFromDOM.html \
|
||||
file_pointerLockPref.html \
|
||||
file_nestedFullScreen.html \
|
||||
file_doubleLock.html \
|
||||
file_loseFocusWindow.html \
|
||||
file_childIframe.html \
|
||||
file_movementXY.html \
|
||||
file_infiniteMovement.html \
|
||||
file_retargetMouseEvents.html \
|
||||
file_targetOutOfFocus.html \
|
||||
file_screenClientXYConst.html \
|
||||
file_suppressSomeMouseEvents.html \
|
||||
file_locksvgelement.html \
|
||||
iframe_differentDOM.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
@ -1,143 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
||||
-->
|
||||
<head>
|
||||
<title>Bug 633602 - file_childIframe.html</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script type="application/javascript" src="pointerlock_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<style>
|
||||
#parent, #childDiv, #iframe, #table, #table td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: none;
|
||||
}
|
||||
#iframe, #table {
|
||||
background-color: red;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
#childDiv, #table td {
|
||||
background-color: blue;
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
||||
Mozilla Bug 633602
|
||||
</a>
|
||||
|
||||
<div id="parent">
|
||||
<table id="childTable">
|
||||
<tr>
|
||||
<td>
|
||||
<iframe id="iframe" src="iframe_differentDOM.html" onload="start();">
|
||||
</iframe>
|
||||
</td>
|
||||
<td>
|
||||
<div id="childDiv">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
/*
|
||||
* Test for Bug 633602
|
||||
* Check if pointer is locked when over a child iframe of
|
||||
* the locked element
|
||||
* Check if pointer is being repositioned back to center of
|
||||
* the locked element even when pointer goes over a child ifame
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var parent = document.getElementById("parent")
|
||||
, childDiv = document.getElementById("childDiv")
|
||||
, iframe = document.getElementById("iframe");
|
||||
|
||||
function MozMovementStats() {
|
||||
this.mozMovementX = false;
|
||||
this.mozMovementY = false;
|
||||
}
|
||||
|
||||
var firstMove = new MozMovementStats()
|
||||
, secondMove = new MozMovementStats()
|
||||
, hoverIframe = false;
|
||||
|
||||
function runTests () {
|
||||
ok(hoverIframe, "Pointer should be locked even when pointer " +
|
||||
"hovers over a child iframe");
|
||||
is(firstMove.mozMovementX, secondMove.mozMovementX, "MovementX of first " +
|
||||
"move to childDiv should be equal to movementX of second move " +
|
||||
"to child div");
|
||||
is(firstMove.mozMovementY, secondMove.mozMovementY, "MovementY of first " +
|
||||
"move to childDiv should be equal to movementY of second move " +
|
||||
"to child div");
|
||||
}
|
||||
|
||||
var firstMoveChild = function (e) {
|
||||
firstMove.mozMovementX = e.mozMovementX;
|
||||
firstMove.mozMovementY = e.mozMovementY;
|
||||
|
||||
parent.removeEventListener("mousemove", firstMoveChild);
|
||||
parent.addEventListener("mousemove", moveIframe);
|
||||
|
||||
synthesizeMouseAtCenter(iframe, {type: "mousemove"}, window);
|
||||
};
|
||||
|
||||
var moveIframe = function (e) {
|
||||
hoverIframe = !!document.mozPointerLockElement;
|
||||
|
||||
parent.removeEventListener("mousemove", moveIframe);
|
||||
parent.addEventListener("mousemove", secondMoveChild);
|
||||
|
||||
synthesizeMouseAtCenter(childDiv, {type: "mousemove"}, window);
|
||||
};
|
||||
|
||||
var secondMoveChild = function (e) {
|
||||
secondMove.mozMovementX = e.mozMovementX;
|
||||
secondMove.mozMovementY = e.mozMovementY;
|
||||
parent.removeEventListener("mousemove", secondMoveChild);
|
||||
|
||||
document.mozCancelFullScreen();
|
||||
};
|
||||
|
||||
document.addEventListener("mozpointerlockchange", function () {
|
||||
if (document.mozPointerLockElement === parent) {
|
||||
parent.addEventListener("mousemove", firstMoveChild);
|
||||
synthesizeMouseAtCenter(childDiv, {type: "mousemove"}, window);
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("mozpointerlockerror", function () {
|
||||
document.mozCancelFullScreen();
|
||||
}, false);
|
||||
|
||||
document.addEventListener("mozfullscreenchange", function (e) {
|
||||
if (document.mozFullScreenElement === parent) {
|
||||
parent.mozRequestPointerLock();
|
||||
}
|
||||
else {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
parent.mozRequestFullScreen();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,70 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
||||
-->
|
||||
<head>
|
||||
<title>Bug 633602 - file_doubleLockCallBack.html</title>
|
||||
<script type="text/javascript"
|
||||
src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script type="application/javascript" src="pointerlock_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<style type="text/css">
|
||||
#test-element { background-color: #94E01B; width:100px; height:100px; }
|
||||
</style>
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
||||
Mozilla Bug 633602</a>
|
||||
<div id="div"></div>
|
||||
<pre id="test">
|
||||
<script type="text/javascript">
|
||||
/*
|
||||
* Test for Bug 633602
|
||||
* If element requests pointerlock on itself while in pointerlock state
|
||||
* mozpointerlockchange event should be dispatched
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var div = document.getElementById("div")
|
||||
, numberOfLocks = 0;
|
||||
|
||||
function runTests () {
|
||||
is(numberOfLocks, 2, "Requesting pointer lock on a locked element " +
|
||||
"should dispatch mozpointerlockchange event");
|
||||
}
|
||||
|
||||
document.addEventListener("mozpointerlockchange", function (e) {
|
||||
if (document.mozPointerLockElement === div) {
|
||||
if (numberOfLocks === 2) {
|
||||
document.mozCancelFullScreen();
|
||||
}
|
||||
else {
|
||||
numberOfLocks++;
|
||||
div.mozRequestPointerLock();
|
||||
}
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("mozfullscreenchange", function (e) {
|
||||
if (document.mozFullScreenElement === div) {
|
||||
div.mozRequestPointerLock();
|
||||
}
|
||||
else {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
div.mozRequestFullScreen();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,63 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--https://bugzilla.mozilla.org/show_bug.cgi?id=633602-->
|
||||
<head>
|
||||
<title>Bug 633602</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="pointerlock_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
||||
Mozilla Bug 633602
|
||||
</a>
|
||||
<div id="div"></div>
|
||||
<pre id="test">
|
||||
<script type="text/javascript">
|
||||
/*
|
||||
* Test for Bug 633602
|
||||
* Escape key should unlock the pointer
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var div = document.getElementById("div")
|
||||
, pointerUnLocked = false;
|
||||
|
||||
function runTests () {
|
||||
ok(pointerUnLocked, "Pressing Escape key should unlock the pointer");
|
||||
}
|
||||
|
||||
document.addEventListener("mozpointerlockchange", function (e) {
|
||||
if (document.mozPointerLockElement === div) {
|
||||
synthesizeKey("VK_ESCAPE", {});
|
||||
}
|
||||
else {
|
||||
pointerUnLocked = true;
|
||||
document.mozCancelFullScreen();
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("mozfullscreenchange", function(e) {
|
||||
if (document.mozFullScreenElement === div) {
|
||||
div.mozRequestPointerLock();
|
||||
}
|
||||
else {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
div.mozRequestFullScreen();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,100 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
||||
-->
|
||||
<head>
|
||||
<title>Bug 633602 - file_movementXY.html</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="pointerlock_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
||||
Mozilla Bug 633602
|
||||
</a>
|
||||
<div id="div"></div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
/*
|
||||
* Test for Bug 633602
|
||||
* This test checks if mozMovementX and mozMovementY
|
||||
* are present in a mouse event object.
|
||||
* It also checks the values for mozMovementXY.
|
||||
* They should be equal to the current screenXY minus
|
||||
* the last screenXY
|
||||
* This test will also test that the incremental movement is
|
||||
* not constrained to the width of the screen.
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var div = document.getElementById("div")
|
||||
, divCenterWidth = 0
|
||||
, divCenterHeight = 0
|
||||
, totalMovementX = 0
|
||||
, totalMovementY = 0;
|
||||
|
||||
function runTests () {
|
||||
ok(totalMovementX > div.getBoundingClientRect().width,
|
||||
"Should have moved more than one screen's worth in width." +
|
||||
"TotalX: " + totalMovementX + " Screensize X: " + div.getBoundingClientRect().width);
|
||||
ok(totalMovementY > div.getBoundingClientRect().height,
|
||||
"Should have moved more than one screen's worth in height." +
|
||||
"TotalY: " + totalMovementY + " Screensize Y: " + div.getBoundingClientRect().height);
|
||||
}
|
||||
|
||||
var firstMoveListener = function (e) {
|
||||
div.removeEventListener("mousemove", firstMoveListener, false);
|
||||
div.addEventListener("mousemove", secondMoveListener, false);
|
||||
|
||||
synthesizeMouse(div,(divCenterWidth/2) * 3,
|
||||
(divCenterHeight/2) * 3, {
|
||||
type: "mousemove"
|
||||
}, window);
|
||||
}
|
||||
|
||||
var secondMoveListener = function (e) {
|
||||
totalMovementX = divCenterWidth + ((divCenterWidth / 2) * 3);
|
||||
totalMovementY = divCenterHeight + ((divCenterHeight / 2) * 3);
|
||||
|
||||
div.removeEventListener("mousemove", secondMoveListener, false);
|
||||
document.mozCancelFullScreen();
|
||||
}
|
||||
|
||||
document.addEventListener("mozpointerlockchange", function (e) {
|
||||
if (document.mozPointerLockElement === div) {
|
||||
div.addEventListener("mousemove", firstMoveListener, false);
|
||||
|
||||
divCenterWidth = Math.round(div.getBoundingClientRect().width / 2);
|
||||
divCenterHeight = Math.round(div.getBoundingClientRect().height / 2);
|
||||
|
||||
synthesizeMouse(div, divCenterWidth, divCenterHeight, {
|
||||
type: "mousemove"
|
||||
}, window);
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("mozfullscreenchange", function() {
|
||||
if (document.mozFullScreenElement === div) {
|
||||
div.mozRequestPointerLock();
|
||||
}
|
||||
else {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
div.mozRequestFullScreen();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,67 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
||||
-->
|
||||
<head>
|
||||
<title>Bug 633602</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="pointerlock_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
||||
Mozilla Bug 633602</a>
|
||||
<p id="display"></p>
|
||||
|
||||
<svg width="100" height="100" viewbox="0 0 100 100">
|
||||
<rect id="svg-elem" x="10" y="10" width="50" height="50"
|
||||
fill="black" stroke="blue" stroke-width="2"/>
|
||||
</svg>
|
||||
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
/*
|
||||
* Test for Bug 633602
|
||||
* Test locking non-html element.
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish(1);
|
||||
|
||||
var elem,
|
||||
elemWasLocked = false;
|
||||
|
||||
document.addEventListener("mozpointerlockchange", function (e) {
|
||||
if (document.mozFullScreen &&
|
||||
document.mozPointerLockElement === elem) {
|
||||
elemWasLocked = true;
|
||||
document.mozExitPointerLock();
|
||||
} else {
|
||||
document.mozCancelFullScreen();
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("mozfullscreenchange", function (e) {
|
||||
if (document.mozFullScreenElement === elem) {
|
||||
elem.mozRequestPointerLock();
|
||||
} else {
|
||||
ok(elemWasLocked, "Expected SVG elem to become locked.");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
elem = document.getElementById("svg-elem");
|
||||
|
||||
SimpleTest.waitForFocus(function() {
|
||||
elem.mozRequestFullScreen();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,71 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
||||
-->
|
||||
<head>
|
||||
<title>Bug 633602 - file_exitMouseLockOnLoseFocus.html</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="pointerlock_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
||||
Mozilla Bug 633602
|
||||
</a>
|
||||
<div id="div"></div>
|
||||
<pre id="test">
|
||||
<script type="text/javascript">
|
||||
/*
|
||||
* Test for Bug 633602
|
||||
* If element has the pointer locked and window loses focus
|
||||
* pointer should be unlocked
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var div = document.getElementById("div")
|
||||
, newWindow = null
|
||||
, looseFocusUnlock = false
|
||||
, pointerLockLost = false;
|
||||
|
||||
function runTests () {
|
||||
ok(looseFocusUnlock, "Pointer should be unlocked if window " +
|
||||
"loses focus");
|
||||
}
|
||||
|
||||
document.addEventListener("mozpointerlockchange", function (e) {
|
||||
if (document.mozPointerLockElement === div) {
|
||||
divPointerLocked = true;
|
||||
newWindow = window.open(); // Open new window to blur current one
|
||||
}
|
||||
else {
|
||||
looseFocusUnlock = true;
|
||||
newWindow && newWindow.close();
|
||||
document.mozCancelFullScreen();
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("mozfullscreenchange", function() {
|
||||
if (document.mozFullScreenElement === div) {
|
||||
div.mozRequestPointerLock();
|
||||
}
|
||||
else {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
div.mozRequestFullScreen();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,105 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
||||
-->
|
||||
<head>
|
||||
<title>Bug 633602 - file_movementXY.html</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="pointerlock_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
||||
Mozilla Bug 633602
|
||||
</a>
|
||||
<div id="div"></div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
/*
|
||||
* Test for Bug 633602
|
||||
* Checks if mozMovementX and mozMovementY are present
|
||||
* in the mouse event object.
|
||||
* It also checks the values for mozMovementXY.
|
||||
* They should be equal to the current screenXY minus
|
||||
* the last screenXY
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function MouseMovementStats() {
|
||||
this.screenX = false;
|
||||
this.screenY = false;
|
||||
this.mozMovementX = false;
|
||||
this.mozMovementY = false;
|
||||
}
|
||||
|
||||
var div = document.getElementById("div")
|
||||
, divCenterWidth = 0
|
||||
, divCenterHeight = 0
|
||||
, mozMovementX = false
|
||||
, mozMovementY = false
|
||||
, firstMove = new MouseMovementStats()
|
||||
, secondMove = new MouseMovementStats();
|
||||
|
||||
function runTests () {
|
||||
ok(mozMovementX && mozMovementY, "mozMovementX and " +
|
||||
"mozMovementY should exist in mouse events objects.");
|
||||
is(secondMove.mozMovementX, secondMove.screenX - firstMove.screenX,
|
||||
"mozMovementX should be equal to eNow.screenX-ePrevious.screenX");
|
||||
is(secondMove.mozMovementY, secondMove.screenY - firstMove.screenY,
|
||||
"mozMovementY should be equal to eNow.screenY-ePrevious.screenY");
|
||||
}
|
||||
|
||||
var moveMouse = function(e) {
|
||||
mozMovementX = ("mozMovementX" in e);
|
||||
mozMovementY = ("mozMovementY" in e);
|
||||
|
||||
div.removeEventListener("mousemove", moveMouse, false);
|
||||
div.addEventListener("mousemove", moveMouseAgain, false);
|
||||
|
||||
firstMove.screenX = e.screenX;
|
||||
firstMove.screenY = e.screenY;
|
||||
|
||||
divCenterWidth = Math.round(div.getBoundingClientRect().width / 2);
|
||||
divCenterHeight = Math.round(div.getBoundingClientRect().height / 2);
|
||||
|
||||
synthesizeMouse(div, (divCenterWidth + 10), (divCenterHeight + 10), {
|
||||
type: "mousemove"
|
||||
}, window);
|
||||
};
|
||||
|
||||
var moveMouseAgain = function(e) {
|
||||
secondMove.screenX = e.screenX;
|
||||
secondMove.screenY = e.screenY;
|
||||
secondMove.mozMovementX = e.mozMovementX;
|
||||
secondMove.mozMovementY = e.mozMovementY;
|
||||
|
||||
div.removeEventListener("mousemove", moveMouseAgain, false);
|
||||
document.mozCancelFullScreen();
|
||||
};
|
||||
|
||||
document.addEventListener("mozfullscreenchange", function() {
|
||||
if (document.mozFullScreenElement === div) {
|
||||
div.addEventListener("mousemove", moveMouse, false);
|
||||
synthesizeMouseAtCenter(div, {type: "mousemove"}, window);
|
||||
}
|
||||
else {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
div.mozRequestFullScreen();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,81 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
||||
-->
|
||||
<head>
|
||||
<title>Bug 633602 - file_nestedFullScreen.html</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="pointerlock_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
||||
Mozilla Bug 633602
|
||||
</a>
|
||||
|
||||
<div id="parentDiv">
|
||||
<div id="childDiv"></div>
|
||||
</div>
|
||||
|
||||
<script type="application/javascript">
|
||||
/*
|
||||
* Test for Bug 633602
|
||||
* Requesting fullscreen on a child element of the element with
|
||||
* the pointer locked should unlock the pointer
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var parentDiv = document.getElementById("parentDiv")
|
||||
, childDiv = document.getElementById("childDiv")
|
||||
, parentDivLocked = false
|
||||
, parentDivFullScreen = false
|
||||
, pointerLocked = false;
|
||||
|
||||
function runTests () {
|
||||
ok(parentDivLocked, "After requesting pointerlock on parentDiv " +
|
||||
"document.mozPointerLockElement should be equal to " +
|
||||
" parentDiv element");
|
||||
isnot(pointerLocked, true, "Requesting fullscreen on " +
|
||||
"childDiv while parentDiv still in fullscreen should " +
|
||||
"unlock the pointer");
|
||||
}
|
||||
|
||||
document.addEventListener("mozpointerlockchange", function (e) {
|
||||
if (document.mozPointerLockElement === parentDiv) {
|
||||
parentDivLocked = true;
|
||||
childDiv.mozRequestFullScreen();
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("mozfullscreenchange", function() {
|
||||
if (document.mozFullScreenElement === parentDiv) {
|
||||
if (parentDivFullScreen === true) {
|
||||
document.mozCancelFullScreen();
|
||||
}
|
||||
parentDivFullScreen = true;
|
||||
parentDiv.mozRequestPointerLock();
|
||||
}
|
||||
else if (document.mozFullScreenElement === childDiv) {
|
||||
pointerLocked = !!document.mozPointerLockElement;
|
||||
document.mozCancelFullScreen();
|
||||
}
|
||||
else {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
parentDiv.mozRequestFullScreen();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,80 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
||||
-->
|
||||
<head>
|
||||
<title>Bug 633602</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="pointerlock_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
||||
Mozilla Bug 633602</a>
|
||||
<p id="display"></p>
|
||||
<div id="div"></div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
/*
|
||||
* Test for Bug 633602
|
||||
* Tests full-screen-api.pointer-lock pref
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var div = document.getElementById("div")
|
||||
, prefEnabled = false
|
||||
, prefDisabled = false;
|
||||
|
||||
function runTests () {
|
||||
ok(prefEnabled, "Element should be able to lock the pointer " +
|
||||
"if pointer-lock pref is set to TRUE");
|
||||
ok(prefDisabled, "Element should NOT be able to lock the pointer " +
|
||||
"if pointer-lock pref is set to FALSE");
|
||||
}
|
||||
|
||||
document.addEventListener("mozpointerlockchange", function (e) {
|
||||
if (document.mozPointerLockElement === div) {
|
||||
prefEnabled = true;
|
||||
document.mozExitPointerLock();
|
||||
}
|
||||
else {
|
||||
SpecialPowers.setBoolPref("full-screen-api.pointer-lock.enabled",
|
||||
false );
|
||||
div.mozRequestPointerLock();
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("mozpointerlockerror", function (e) {
|
||||
prefDisabled = true;
|
||||
document.mozCancelFullScreen();
|
||||
}, false);
|
||||
|
||||
document.addEventListener("mozfullscreenchange", function (e) {
|
||||
if (document.mozFullScreenElement === div) {
|
||||
SpecialPowers.setBoolPref("full-screen-api.pointer-lock.enabled",
|
||||
true );
|
||||
div.mozRequestPointerLock();
|
||||
}
|
||||
else {
|
||||
SpecialPowers.setBoolPref("full-screen-api.pointer-lock.enabled",
|
||||
true );
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
div.mozRequestFullScreen();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,92 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--https://bugzilla.mozilla.org/show_bug.cgi?id=633602-->
|
||||
<head>
|
||||
<title>Bug 633602</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="pointerlock_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
||||
Mozilla Bug 633602
|
||||
</a>
|
||||
<div id="div"></div>
|
||||
<pre id="test">
|
||||
<script type="text/javascript">
|
||||
/*
|
||||
* Test for Bug 633602
|
||||
* Make sure DOM API is correct.
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var div,
|
||||
hasRequestPointerLock = false,
|
||||
pointerLockChangeEventFired = false,
|
||||
pointerUnlocked = false,
|
||||
pointerLocked = false,
|
||||
hasExitPointerLock = false,
|
||||
pointerLockElement = false,
|
||||
hasMovementX = false,
|
||||
hasMovementY = false;
|
||||
|
||||
function runTests () {
|
||||
ok(hasRequestPointerLock, "Element should have mozRequestPointerLock.");
|
||||
ok(pointerLockChangeEventFired, "pointerlockchange event should fire.");
|
||||
ok(pointerUnlocked, "Should be able to unlock pointer locked element.");
|
||||
ok(pointerLocked, "Requested element should be able to lock.");
|
||||
ok(hasExitPointerLock, "Document should have mozExitPointerLock");
|
||||
ok(pointerLockElement, "Document should keep track of correct pointer locked element");
|
||||
ok(hasMovementX, "Mouse Event should have mozMovementX.");
|
||||
ok(hasMovementY, "Mouse Event should have mozMovementY.");
|
||||
}
|
||||
|
||||
function mouseMoveHandler(e) {
|
||||
document.removeEventListener("mousemove", mouseMoveHandler, false);
|
||||
|
||||
hasMovementX = "mozMovementX" in e;
|
||||
hasMovementY = "mozMovementY" in e;
|
||||
|
||||
hasExitPointerLock = "mozExitPointerLock" in document;
|
||||
document.mozExitPointerLock();
|
||||
}
|
||||
|
||||
document.addEventListener("mozpointerlockchange", function (e) {
|
||||
pointerLockChangeEventFired = true;
|
||||
|
||||
if (document.mozPointerLockElement) {
|
||||
pointerLocked = true;
|
||||
pointerLockElement = document.mozPointerLockElement === div;
|
||||
document.addEventListener("mousemove", mouseMoveHandler, false);
|
||||
synthesizeMouseAtCenter(div, {type: "mousemove"}, window);
|
||||
} else {
|
||||
pointerUnlocked = true;
|
||||
document.mozCancelFullScreen();
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("mozfullscreenchange", function(e) {
|
||||
if (document.mozFullScreenElement === div) {
|
||||
hasRequestPointerLock = "mozRequestPointerLock" in div;
|
||||
div.mozRequestPointerLock();
|
||||
} else {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
div = document.getElementById("div");
|
||||
div.mozRequestFullScreen();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,43 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--https://bugzilla.mozilla.org/show_bug.cgi?id=633602-->
|
||||
<head>
|
||||
<title>Bug 633602</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="pointerlock_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
||||
Mozilla Bug 633602
|
||||
</a>
|
||||
|
||||
<pre id="test">
|
||||
<script type="text/javascript">
|
||||
/*
|
||||
* Test for Bug 633602
|
||||
* Make sure pointerlockerror event fires.
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
document.addEventListener("mozpointerlockerror", function (e) {
|
||||
ok(true, "pointerlockerror event should fire.");
|
||||
SimpleTest.finish();
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
// element not in the DOM, not fullscreen, should fail to lock
|
||||
div = document.createElement("div");
|
||||
div.mozRequestPointerLock();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,70 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
||||
|
||||
Test DOM tree in full screen
|
||||
-->
|
||||
<head>
|
||||
<title>Bug 633602 - file_DOMtree.html</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="pointerlock_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<style>
|
||||
</style>
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
||||
Mozilla Bug 633602
|
||||
</a>
|
||||
<div id="div"></div>
|
||||
<pre id="test">
|
||||
<script type="text/javascript">
|
||||
/*
|
||||
* Test for Bug 633602
|
||||
* Checks if pointer is unlocked when element is removed from
|
||||
* the DOM Tree
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var div = document.getElementById("div")
|
||||
, removedDOM = false;
|
||||
|
||||
function runTests() {
|
||||
ok(removedDOM, "Pointer should be unlocked when " +
|
||||
"an element is removed the DOM Tree");
|
||||
}
|
||||
|
||||
document.addEventListener("mozpointerlockchange", function (e) {
|
||||
if (document.mozPointerLockElement === div) {
|
||||
document.body.removeChild(div);
|
||||
removedDOM = !document.mozPointerLockElement;
|
||||
document.mozCancelFullScreen();
|
||||
}
|
||||
|
||||
}, false);
|
||||
|
||||
document.addEventListener("mozfullscreenchange", function (e) {
|
||||
if (document.mozFullScreenElement === div) {
|
||||
div.mozRequestPointerLock();
|
||||
}
|
||||
else {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
div.mozRequestFullScreen();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,164 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
||||
-->
|
||||
<head>
|
||||
<title>Bug 633602 - file_retargetMouseEvents.html</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script type="application/javascript" src="pointerlock_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
||||
Mozilla Bug 633602
|
||||
</a>
|
||||
|
||||
<div id="parent">
|
||||
<div id="child" style="width: 100%; height: 100%;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
/*
|
||||
* Test for Bug 633602
|
||||
* Retarget mouse events to the locked element
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function MouseEventStats() {
|
||||
this.mouseMove = false;
|
||||
this.mouseDown = false;
|
||||
this.mouseUp = false;
|
||||
this.mouseClick = false;
|
||||
this.mouseScroll = false;
|
||||
}
|
||||
|
||||
var parent = document.getElementById("parent")
|
||||
, child = document.getElementById("child")
|
||||
, parentStats = new MouseEventStats()
|
||||
, childStats = new MouseEventStats();
|
||||
|
||||
function runTests () {
|
||||
is(childStats.mouseMove, false, "Child shound not receive mousemove event.");
|
||||
is(childStats.mouseDown, false, "Child should not receive mousedown event.");
|
||||
is(childStats.mouseUp, false, "Child should not receive mouseup event.");
|
||||
is(childStats.mouseClick, false, "Child should not receive click event.");
|
||||
is(childStats.mouseScroll, false, "Child should not receive DOMMouseScroll event.");
|
||||
|
||||
ok(parentStats.mouseMove, "Parent should receive mousemove event.");
|
||||
ok(parentStats.mouseDown, "Parent should receive mousedown event.");
|
||||
ok(parentStats.mouseUp, "Parent should receive mouseup event.");
|
||||
ok(parentStats.mouseClick, "Parent should receive click event.");
|
||||
ok(parentStats.mouseScroll, "Parent should receive DOMMouseScroll event.");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The event listeners for the child element shouldn't be fired
|
||||
* Mouse events will only happen when the pointer is locked
|
||||
* and if the pointer is locked all the mouse events should be
|
||||
* retargetted to the locked element
|
||||
**/
|
||||
var childMoveTest = function() {
|
||||
childStats.mouseMove = true;
|
||||
}
|
||||
|
||||
var childDownTest = function() {
|
||||
childStats.mouseDown = true;
|
||||
};
|
||||
|
||||
var childUpTest = function() {
|
||||
childStats.mouseUp = true;
|
||||
};
|
||||
|
||||
var childClickTest = function() {
|
||||
childStats.mouseClick = true;
|
||||
};
|
||||
|
||||
var childScrollTest = function() {
|
||||
childStats.mouseScroll = true;
|
||||
};
|
||||
|
||||
// Event listeners for the parent element
|
||||
var startMouseTests = function() {
|
||||
parent.removeEventListener("mousemove", startMouseTests);
|
||||
parent.addEventListener("DOMMouseScroll", parentScrollTest);
|
||||
child.addEventListener("DOMMouseScroll", childScrollTest);
|
||||
synthesizeMouseScroll(child, 5, 5, {'delta': 10, 'type': "DOMMouseScroll"});
|
||||
};
|
||||
|
||||
var parentScrollTest = function (e) {
|
||||
parentStats.mouseScroll = true;
|
||||
parent.removeEventListener("DOMMouseScroll", parentScrollTest);
|
||||
child.removeEventListener("DOMMouseScroll", childScrollTest);
|
||||
parent.addEventListener("mousedown", parentDownTest);
|
||||
child.addEventListener("mousedown", childDownTest);
|
||||
synthesizeMouseAtCenter(child, {type: "mousedown"}, window);
|
||||
};
|
||||
|
||||
var parentDownTest = function (e) {
|
||||
parentStats.mouseDown = true;
|
||||
parent.removeEventListener("mousedown", parentDownTest);
|
||||
child.removeEventListener("mousedown", childDownTest);
|
||||
parent.addEventListener("mouseup", parentUpTest);
|
||||
child.addEventListener("mouseup", childUpTest);
|
||||
synthesizeMouseAtCenter(child, {type: "mouseup"}, window);
|
||||
};
|
||||
|
||||
var parentUpTest = function (e) {
|
||||
parentStats.mouseUp = true;
|
||||
parent.removeEventListener("mouseup", parentUpTest);
|
||||
child.removeEventListener("mouseup", childUpTest);
|
||||
parent.addEventListener("click", parentClickTest);
|
||||
child.addEventListener("click", childClickTest);
|
||||
synthesizeMouseAtCenter(child, {type: "click"}, window);
|
||||
};
|
||||
|
||||
var parentClickTest = function (e) {
|
||||
parentStats.mouseClick = true;
|
||||
parent.removeEventListener("click", parentClickTest);
|
||||
child.removeEventListener("click", childClickTest);
|
||||
parent.addEventListener("mousemove", parentMoveTest);
|
||||
child.addEventListener("mousemove", childMoveTest);
|
||||
synthesizeMouseAtCenter(child, {type: "mousemove"}, window);
|
||||
};
|
||||
|
||||
var parentMoveTest = function (e) {
|
||||
parentStats.mouseMove = true;
|
||||
parent.removeEventListener("mousemove", parentMoveTest);
|
||||
child.removeEventListener("mousemove", childMoveTest);
|
||||
document.mozCancelFullScreen();
|
||||
}
|
||||
|
||||
document.addEventListener("mozpointerlockchange", function (e) {
|
||||
if (document.mozPointerLockElement === parent) {
|
||||
parent.addEventListener("mousemove", startMouseTests);
|
||||
child.addEventListener("mousemove", childMoveTest);
|
||||
synthesizeMouseAtCenter(parent, {type: "mousemove"}, window);
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("mozfullscreenchange", function (e) {
|
||||
if (document.mozFullScreenElement === parent) {
|
||||
parent.mozRequestPointerLock();
|
||||
}
|
||||
else {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
parent.mozRequestFullScreen();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,106 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
||||
-->
|
||||
<head>
|
||||
<title>Bug 633602 - constantXY.html</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script type="application/javascript" src="pointerlock_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
||||
Mozilla Bug 633602
|
||||
</a>
|
||||
<div id="div"></div>
|
||||
<script type="application/javascript">
|
||||
/*
|
||||
* Test for Bug 633602
|
||||
* Confirm that screenX/Y and clientX/Y are constants when the pointer
|
||||
* is locked.
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var div
|
||||
, divRect
|
||||
, unLockedCoords
|
||||
, lockedCoords
|
||||
, isUnlocked = false
|
||||
, isLocked = false;
|
||||
|
||||
function runTests () {
|
||||
ok(isUnlocked, "Pointer should be unlocked");
|
||||
ok(isLocked, "Pointer should be locked");
|
||||
|
||||
// Confirm that pointer coords are constant while locked
|
||||
is(unLockedCoords.clientX, lockedCoords.clientX,
|
||||
"clientX should be equal to where the mouse was originaly locked");
|
||||
is(unLockedCoords.clientY, lockedCoords.clientY,
|
||||
"clientY should be equal to where the mouse was originaly locked");
|
||||
is(unLockedCoords.screenX, lockedCoords.screenX,
|
||||
"screenX should be equal to where the mouse was originaly locked");
|
||||
is(unLockedCoords.screenY, lockedCoords.screenY,
|
||||
"screenY should be equal to where the mouse was originaly locked");
|
||||
}
|
||||
|
||||
function moveUnlocked(e) {
|
||||
div.removeEventListener("mousemove", moveUnlocked, false);
|
||||
|
||||
isUnlocked = !document.mozPointerLockElement;
|
||||
unLockedCoords = {
|
||||
screenX: e.screenX,
|
||||
screenY: e.screenY,
|
||||
clientX: e.clientX,
|
||||
clientY: e.clientY
|
||||
};
|
||||
|
||||
div.mozRequestPointerLock();
|
||||
}
|
||||
|
||||
function moveLocked(e) {
|
||||
div.removeEventListener("mousemove", moveLocked, false);
|
||||
|
||||
isLocked = !!document.mozPointerLockElement;
|
||||
lockedCoords = {
|
||||
screenX: e.screenX,
|
||||
screenY: e.screenY,
|
||||
clientX: e.clientX,
|
||||
clientY: e.clientY
|
||||
};
|
||||
|
||||
document.mozCancelFullScreen();
|
||||
}
|
||||
|
||||
document.addEventListener("mozpointerlockchange", function (e) {
|
||||
if (document.mozPointerLockElement === div) {
|
||||
div.addEventListener("mousemove", moveLocked, false);
|
||||
divRect = div.getBoundingClientRect();
|
||||
synthesizeMouse(div, (divRect.width / 4) * 3, (divRect.height / 4) * 3, {
|
||||
type: "mousemove"
|
||||
}, window);
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("mozfullscreenchange", function() {
|
||||
if (document.mozFullScreenElement === div) {
|
||||
div.addEventListener("mousemove", moveUnlocked, false);
|
||||
synthesizeMouseAtCenter(div, { type: "mousemove" }, window);
|
||||
} else {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
div = document.getElementById("div");
|
||||
div.mozRequestFullScreen();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,163 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
||||
-->
|
||||
<head>
|
||||
<title>Bug 633602 - file_cursorPosEvents.html</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script type="application/javascript" src="pointerlock_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<style type="text/css">
|
||||
#child {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background-color:Green;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
||||
Mozilla Bug 633602</a>
|
||||
|
||||
<div id="parent">
|
||||
<div id="child"></div>
|
||||
</div>
|
||||
|
||||
<script type="application/javascript">
|
||||
/*
|
||||
* Test for Bug 633602
|
||||
* Test will check to make sure that the following mouse events are no
|
||||
* longer executed in pointer lock.
|
||||
* - mouseover, mouseout, mouseenter, mouseleave
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function PointerEventStats() {
|
||||
this.mouseEnter = false;
|
||||
this.mouseLeave = false;
|
||||
this.mouseOver = false;
|
||||
this.mouseOut = false;
|
||||
}
|
||||
|
||||
var parent
|
||||
, child
|
||||
, parentStats = new PointerEventStats()
|
||||
, childStats = new PointerEventStats()
|
||||
, isPointerLocked = false;
|
||||
|
||||
function runTests () {
|
||||
ok(isPointerLocked, "expected mouse to be locked, but wasn't.");
|
||||
|
||||
is(childStats.mouseEnter, false,
|
||||
"child's mouseenter should not be firing in Full Screen and Pointer Lock.");
|
||||
is(childStats.mouseOver, false,
|
||||
"child's mouseover should not be firing in Full Screen and Pointer Lock.");
|
||||
is(childStats.mouseLeave, false,
|
||||
"child's mouseleave should not be firing in Full Screen and Pointer Lock.");
|
||||
is(childStats.mouseOut, false,
|
||||
"child's mouseout should not be firing in Full Screen and Pointer Lock.");
|
||||
|
||||
is(parentStats.mouseEnter, false,
|
||||
"parent's mouseenter should not be firing in Full Screen and Pointer Lock.");
|
||||
is(parentStats.mouseOver, false,
|
||||
"parent's mouseover should not be firing in Full Screen and Pointer Lock.");
|
||||
is(parentStats.mouseLeave, false,
|
||||
"parent's mouseleave should not be firing in Full Screen and Pointer Lock.");
|
||||
is(parentStats.mouseOut, false,
|
||||
"parent's mouseout should not be firing in Full Screen and Pointer Lock.");
|
||||
}
|
||||
|
||||
var parentMoveListener = function () {
|
||||
isPointerLocked = !!document.mozPointerLockElement;
|
||||
removeEventListeners();
|
||||
document.mozExitPointerLock();
|
||||
};
|
||||
|
||||
var parentOutListener = function (e) {
|
||||
parentStats.mouseOut = true;
|
||||
};
|
||||
var parentLeaveListener = function (e) {
|
||||
parentStats.mouseLeave = true;
|
||||
};
|
||||
var parentOverListener = function (e) {
|
||||
parentStats.mouseOver = true;
|
||||
};
|
||||
var parentEnterListener = function (e) {
|
||||
parentStats.mouseEnter = true;
|
||||
};
|
||||
|
||||
var childOutListener = function (e) {
|
||||
childStats.mouseOut = true;
|
||||
};
|
||||
var childLeaveListener = function (e) {
|
||||
childStats.mouseLeave = true;
|
||||
};
|
||||
var childOverListener = function (e) {
|
||||
childStats.mouseOver = true;
|
||||
};
|
||||
var childEnterListener = function (e) {
|
||||
childStats.mouseEnter = true;
|
||||
};
|
||||
|
||||
function addEventListeners() {
|
||||
parent.addEventListener("mousemove", parentMoveListener, false);
|
||||
|
||||
parent.addEventListener("mouseout", parentOutListener, false);
|
||||
parent.addEventListener("mouseleave", parentLeaveListener, false);
|
||||
parent.addEventListener("mouseover", parentOverListener, false);
|
||||
parent.addEventListener("mouseenter", parentEnterListener, false);
|
||||
|
||||
child.addEventListener("mouseout", childOutListener, false);
|
||||
child.addEventListener("mouseleave", childLeaveListener, false);
|
||||
child.addEventListener("mouseover", childOverListener, false);
|
||||
child.addEventListener("mouseenter", childEnterListener, false);
|
||||
}
|
||||
|
||||
function removeEventListeners() {
|
||||
parent.removeEventListener("mousemove", parentMoveListener, false);
|
||||
|
||||
parent.removeEventListener("mouseout", parentOutListener, false);
|
||||
parent.removeEventListener("mouseleave", parentLeaveListener, false);
|
||||
parent.removeEventListener("mouseover", parentOverListener, false);
|
||||
parent.removeEventListener("mouseenter", parentEnterListener, false);
|
||||
|
||||
child.removeEventListener("mouseout", childOutListener, false);
|
||||
child.removeEventListener("mouseleave", childLeaveListener, false);
|
||||
child.removeEventListener("mouseover" , childOverListener, false);
|
||||
child.removeEventListener("mouseenter", childEnterListener, false);
|
||||
}
|
||||
|
||||
document.addEventListener("mozpointerlockchange", function (e) {
|
||||
if (document.mozPointerLockElement === parent) {
|
||||
addEventListeners();
|
||||
synthesizeMouseAtCenter(child, { type: "mousemove" }, window);
|
||||
}
|
||||
else {
|
||||
document.mozCancelFullScreen();
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("mozfullscreenchange", function() {
|
||||
if (document.mozFullScreenElement === parent) {
|
||||
parent.mozRequestPointerLock();
|
||||
}
|
||||
else {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
parent = document.getElementById("parent");
|
||||
child = document.getElementById("child");
|
||||
parent.mozRequestFullScreen();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,73 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
||||
-->
|
||||
<head>
|
||||
<title>Bug 633602 - file_targetOutOfFocus.html</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="pointerlock_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
||||
Mozilla Bug 633602
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
</div>
|
||||
<div id="div"></div>
|
||||
<input id="input" type="text" />
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
/*
|
||||
* Test for Bug 633602
|
||||
* Element doesn't need to have focus to request
|
||||
* pointer lock
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var div = document.getElementById("div")
|
||||
, input = document.getElementById("input")
|
||||
, divPointerLock = false;
|
||||
|
||||
function runTests () {
|
||||
ok(divPointerLock, "Pointer should be locked even if " +
|
||||
"the element being locked is not focused");
|
||||
}
|
||||
|
||||
input.addEventListener("focus", function() {
|
||||
div.mozRequestPointerLock();
|
||||
}, false);
|
||||
|
||||
document.addEventListener("mozpointerlockchange", function (e) {
|
||||
if (document.mozPointerLockElement === div) {
|
||||
divPointerLock = true;
|
||||
document.mozCancelFullScreen();
|
||||
}
|
||||
}, false);
|
||||
|
||||
document.addEventListener("mozfullscreenchange", function() {
|
||||
if (document.mozFullScreenElement === div) {
|
||||
input.focus();
|
||||
}
|
||||
else {
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
div.mozRequestFullScreen();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,56 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
||||
|
||||
Test DOM tree in full screen
|
||||
-->
|
||||
<head>
|
||||
<title>Bug 633602 - file_DOMtree.html</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
|
||||
</script>
|
||||
<script type="application/javascript" src="pointerlock_utils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<style>
|
||||
</style>
|
||||
</head>
|
||||
<body onload="start();">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
||||
Mozilla Bug 633602
|
||||
</a>
|
||||
<pre id="test">
|
||||
<script type="text/javascript">
|
||||
/*
|
||||
* Test for Bug 633602
|
||||
* Checks if element is attached to the DOM Tree before locking
|
||||
* the pointer
|
||||
*/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var div = document.createElement("div")
|
||||
, withouthDOM = false;
|
||||
|
||||
function runTests () {
|
||||
ok(withouthDOM, "If an element is NOT in the " +
|
||||
"DOM Tree pointer should NOT be locked");
|
||||
}
|
||||
|
||||
document.addEventListener("mozpointerlockerror", function (e) {
|
||||
withouthDOM = true;
|
||||
runTests();
|
||||
SimpleTest.finish();
|
||||
}, false);
|
||||
|
||||
function start() {
|
||||
SimpleTest.waitForFocus(function() {
|
||||
div.mozRequestPointerLock();
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,7 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<div id="div"></div>
|
||||
</body>
|
||||
</html>
|
@ -1,34 +0,0 @@
|
||||
// Get test filename for page being run in popup so errors are more useful
|
||||
var testName = location.pathname.split('/').pop();
|
||||
|
||||
// Wrap test functions and pass to parent window
|
||||
function ok(a, msg) {
|
||||
opener.ok(a, testName + ": " + msg);
|
||||
}
|
||||
|
||||
function is(a, b, msg) {
|
||||
opener.is(a, b, testName + ": " + msg);
|
||||
}
|
||||
|
||||
function isnot(a, b, msg) {
|
||||
opener.isnot(a, b, testName + ": " + msg);
|
||||
}
|
||||
|
||||
function todo(a, msg) {
|
||||
opener.todo(a, testName + ": " + msg);
|
||||
}
|
||||
|
||||
function todo_is(a, b, msg) {
|
||||
opener.todo_is(a, b, testName + ": " + msg);
|
||||
}
|
||||
|
||||
function todo_isnot(a, b, msg) {
|
||||
opener.todo_isnot(a, b, testName + ": " + msg);
|
||||
}
|
||||
|
||||
// Override SimpleTest so test files work stand-alone
|
||||
SimpleTest.finish = function () {
|
||||
opener.nextTest();
|
||||
};
|
||||
|
||||
SimpleTest.waitForExplicitFinish = function() {};
|
@ -1,85 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=633602
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 633602</title>
|
||||
<script type="application/javascript"
|
||||
src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=633602">
|
||||
Mozilla Bug 633602
|
||||
</a>
|
||||
<div id="content">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
// Ensure the full-screen api is enabled,
|
||||
// and will be disabled on test exit.
|
||||
var prevEnabled = SpecialPowers.getBoolPref("full-screen-api.enabled");
|
||||
SpecialPowers.setBoolPref("full-screen-api.enabled", true);
|
||||
|
||||
// Disable the requirement for trusted contexts only,
|
||||
// so the tests are easier to write.
|
||||
var prevTrusted = SpecialPowers.getBoolPref(
|
||||
"full-screen-api.allow-trusted-requests-only");
|
||||
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only",
|
||||
false);
|
||||
|
||||
// Run the tests which go full-screen in new window, as Mochitests
|
||||
// normally run in an iframe, which by default will not have the
|
||||
// mozallowfullscreen attribute set, so full-screen won't work.
|
||||
var gTestFiles = [
|
||||
"file_childIframe.html",
|
||||
"file_doubleLock.html",
|
||||
"file_escapeKey.html",
|
||||
"file_infiniteMovement.html",
|
||||
"file_locksvgelement.html",
|
||||
"file_loseFocusWindow.html",
|
||||
"file_movementXY.html",
|
||||
"file_nestedFullScreen.html",
|
||||
"file_pointerlock-api.html",
|
||||
"file_pointerlockerror.html",
|
||||
"file_pointerLockPref.html",
|
||||
"file_removedFromDOM.html",
|
||||
"file_retargetMouseEvents.html",
|
||||
"file_screenClientXYConst.html",
|
||||
"file_suppressSomeMouseEvents.html",
|
||||
"file_targetOutOfFocus.html",
|
||||
"file_withoutDOM.html"
|
||||
];
|
||||
|
||||
var testWindow = null;
|
||||
var gTestIndex = 0;
|
||||
|
||||
function nextTest() {
|
||||
if (testWindow) {
|
||||
testWindow.close();
|
||||
}
|
||||
if (gTestIndex < gTestFiles.length) {
|
||||
testWindow = window.open(gTestFiles[gTestIndex],
|
||||
"",
|
||||
"width=500,height=500");
|
||||
gTestIndex++;
|
||||
} else {
|
||||
SpecialPowers.setBoolPref("full-screen-api.enabled",
|
||||
prevEnabled);
|
||||
SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only",
|
||||
prevTrusted);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
addLoadEvent(nextTest);
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -134,13 +134,10 @@ class LayerManager;
|
||||
#define CAPTURE_RETARGETTOELEMENT 2
|
||||
// true if the current capture wants drags to be prevented
|
||||
#define CAPTURE_PREVENTDRAG 4
|
||||
// true when the mouse is pointer locked, and events are sent to locked elemnt
|
||||
#define CAPTURE_POINTERLOCK 8
|
||||
|
||||
typedef struct CapturingContentInfo {
|
||||
// capture should only be allowed during a mousedown event
|
||||
bool mAllowed;
|
||||
bool mPointerLock;
|
||||
bool mRetargetToElement;
|
||||
bool mPreventDrag;
|
||||
nsIContent* mContent;
|
||||
@ -1106,11 +1103,6 @@ public:
|
||||
*
|
||||
* If CAPTURE_PREVENTDRAG is set then drags are prevented from starting while
|
||||
* this capture is active.
|
||||
*
|
||||
* If CAPTURE_POINTERLOCK is set, similar to CAPTURE_RETARGETTOELEMENT, then
|
||||
* events are targeted at aContent, but capturing is held more strongly (i.e.,
|
||||
* calls to SetCapturingContent won't unlock unless CAPTURE_POINTERLOCK is
|
||||
* set again).
|
||||
*/
|
||||
static void SetCapturingContent(nsIContent* aContent, PRUint8 aFlags);
|
||||
|
||||
|
@ -228,7 +228,7 @@ using namespace mozilla::dom;
|
||||
using namespace mozilla::layers;
|
||||
|
||||
CapturingContentInfo nsIPresShell::gCaptureInfo =
|
||||
{ false /* mAllowed */, false /* mPointerLock */, false /* mRetargetToElement */,
|
||||
{ false /* mAllowed */, false /* mRetargetToElement */,
|
||||
false /* mPreventDrag */, nsnull /* mContent */ };
|
||||
nsIContent* nsIPresShell::gKeyDownTarget;
|
||||
nsInterfaceHashtable<nsUint32HashKey, nsIDOMTouch> nsIPresShell::gCaptureTouchList;
|
||||
@ -5447,27 +5447,16 @@ PresShell::Paint(nsIView* aViewToPaint,
|
||||
void
|
||||
nsIPresShell::SetCapturingContent(nsIContent* aContent, PRUint8 aFlags)
|
||||
{
|
||||
// If capture was set for pointer lock, don't unlock unless we are coming
|
||||
// out of pointer lock explicitly.
|
||||
if (!aContent && gCaptureInfo.mPointerLock &&
|
||||
!(aFlags & CAPTURE_POINTERLOCK)) {
|
||||
return;
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(gCaptureInfo.mContent);
|
||||
|
||||
// only set capturing content if allowed or the CAPTURE_IGNOREALLOWED or
|
||||
// CAPTURE_POINTERLOCK flags are used.
|
||||
if ((aFlags & CAPTURE_IGNOREALLOWED) || gCaptureInfo.mAllowed ||
|
||||
(aFlags & CAPTURE_POINTERLOCK)) {
|
||||
// only set capturing content if allowed or the CAPTURE_IGNOREALLOWED flag
|
||||
// is used
|
||||
if ((aFlags & CAPTURE_IGNOREALLOWED) || gCaptureInfo.mAllowed) {
|
||||
if (aContent) {
|
||||
NS_ADDREF(gCaptureInfo.mContent = aContent);
|
||||
}
|
||||
// CAPTURE_POINTERLOCK is the same as CAPTURE_RETARGETTOELEMENT & CAPTURE_IGNOREALLOWED
|
||||
gCaptureInfo.mRetargetToElement = ((aFlags & CAPTURE_RETARGETTOELEMENT) != 0) ||
|
||||
((aFlags & CAPTURE_POINTERLOCK) != 0);
|
||||
gCaptureInfo.mRetargetToElement = (aFlags & CAPTURE_RETARGETTOELEMENT) != 0;
|
||||
gCaptureInfo.mPreventDrag = (aFlags & CAPTURE_PREVENTDRAG) != 0;
|
||||
gCaptureInfo.mPointerLock = (aFlags & CAPTURE_POINTERLOCK) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5761,8 +5750,7 @@ PresShell::HandleEvent(nsIFrame *aFrame,
|
||||
NS_TIME_FUNCTION_MIN(1.0);
|
||||
|
||||
nsIContent* capturingContent =
|
||||
NS_IS_MOUSE_EVENT(aEvent) || aEvent->eventStructType == NS_MOUSE_SCROLL_EVENT ?
|
||||
GetCapturingContent() : nsnull;
|
||||
NS_IS_MOUSE_EVENT(aEvent) ? GetCapturingContent() : nsnull;
|
||||
|
||||
nsCOMPtr<nsIDocument> retargetEventDoc;
|
||||
if (!aDontRetargetEvents) {
|
||||
|
@ -122,9 +122,11 @@ nsMathMLmactionFrame::Init(nsIContent* aContent,
|
||||
}
|
||||
|
||||
if (NS_MATHML_ACTION_TYPE_NONE == mActionType) {
|
||||
if (value.EqualsLiteral("statusline"))
|
||||
// expected statusline prefix (11ch)...
|
||||
if (11 < value.Length() && 0 == value.Find("statusline#"))
|
||||
mActionType = NS_MATHML_ACTION_TYPE_STATUSLINE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Let the base class do the rest
|
||||
@ -366,28 +368,12 @@ nsMathMLmactionFrame::MouseOver()
|
||||
{
|
||||
// see if we should display a status message
|
||||
if (NS_MATHML_ACTION_TYPE_STATUSLINE == mActionType) {
|
||||
// retrieve content from a second child if it exists
|
||||
nsIFrame* childFrame = mFrames.FrameAt(1);
|
||||
if (!childFrame) return;
|
||||
|
||||
nsIContent* content = childFrame->GetContent();
|
||||
if (!content) return;
|
||||
|
||||
// check whether the content is mtext or not
|
||||
if (content->GetNameSpaceID() == kNameSpaceID_MathML &&
|
||||
content->Tag() == nsGkAtoms::mtext_) {
|
||||
// get the text to be displayed
|
||||
content = content->GetFirstChild();
|
||||
if (!content) return;
|
||||
|
||||
const nsTextFragment* textFrg = content->GetText();
|
||||
if (!textFrg) return;
|
||||
|
||||
nsAutoString text;
|
||||
textFrg->AppendTo(text);
|
||||
// collapse whitespaces as listed in REC, section 3.2.6.1
|
||||
text.CompressWhitespace();
|
||||
ShowStatus(PresContext(), text);
|
||||
nsAutoString value;
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::actiontype_, value);
|
||||
// expected statusline prefix (11ch)...
|
||||
if (11 < value.Length() && 0 == value.Find("statusline#")) {
|
||||
value.Cut(0, 11);
|
||||
ShowStatus(PresContext(), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3486,7 +3486,6 @@ pref("full-screen-api.allow-trusted-requests-only", true);
|
||||
pref("full-screen-api.key-input-restricted", true);
|
||||
pref("full-screen-api.warning.enabled", true);
|
||||
pref("full-screen-api.exit-on-deactivate", true);
|
||||
pref("full-screen-api.pointer-lock.enabled", true);
|
||||
|
||||
// Time limit, in milliseconds, for nsEventStateManager::IsHandlingUserInput().
|
||||
// Used to detect long running handlers of user-generated events.
|
||||
|
@ -36,8 +36,6 @@
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
// Copied from nsILookAndFeel.h, see comments on eMetric_AlertNotificationOrigin
|
||||
const NS_ALERT_HORIZONTAL = 1;
|
||||
const NS_ALERT_LEFT = 2;
|
||||
@ -95,10 +93,13 @@ function prefillAlertInfo()
|
||||
|
||||
function onAlertLoad()
|
||||
{
|
||||
gSlideIncrement = Services.prefs.getIntPref("alerts.slideIncrement");
|
||||
gSlideTime = Services.prefs.getIntPref("alerts.slideIncrementTime");
|
||||
gOpenTime = Services.prefs.getIntPref("alerts.totalOpenTime");
|
||||
gDisableSlideEffect = Services.prefs.getBoolPref("alerts.disableSlidingEffect");
|
||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService();
|
||||
prefService = prefService.QueryInterface(Components.interfaces.nsIPrefService);
|
||||
var prefBranch = prefService.getBranch(null);
|
||||
gSlideIncrement = prefBranch.getIntPref("alerts.slideIncrement");
|
||||
gSlideTime = prefBranch.getIntPref("alerts.slideIncrementTime");
|
||||
gOpenTime = prefBranch.getIntPref("alerts.totalOpenTime");
|
||||
gDisableSlideEffect = prefBranch.getBoolPref("alerts.disableSlidingEffect");
|
||||
|
||||
// Make sure that the contents are fixed at the window edge facing the
|
||||
// screen's center so that the window looks like "sliding in" and not
|
||||
|
@ -52,7 +52,7 @@ const nsPrefService_CONTRACTID = "@mozilla.org/preferences-service;1";
|
||||
const nsClipboardHelper_CONTRACTID = "@mozilla.org/widget/clipboardhelper;1";
|
||||
const nsAtomService_CONTRACTID = "@mozilla.org/atom-service;1";
|
||||
|
||||
const gPrefBranch = Services.prefs;
|
||||
const gPrefBranch = Services.prefs.getBranch(null);
|
||||
const gClipboardHelper = Components.classes[nsClipboardHelper_CONTRACTID].getService(nsIClipboardHelper);
|
||||
const gAtomService = Components.classes[nsAtomService_CONTRACTID].getService(nsIAtomService);
|
||||
|
||||
|
@ -38,8 +38,6 @@
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var gDebug = 0;
|
||||
var gLineCount = 0;
|
||||
var gStartTargetLine = 0;
|
||||
@ -61,13 +59,22 @@ const MARK_SELECTION_END = '\u200B\u200B\u200B\u200B\u200B';
|
||||
|
||||
function onLoadViewPartialSource()
|
||||
{
|
||||
// check the view_source.wrap_long_lines pref
|
||||
// and set the menuitem's checked attribute accordingly
|
||||
gWrapLongLines = Services.prefs.getBoolPref("view_source.wrap_long_lines");
|
||||
document.getElementById("menu_wrapLongLines").setAttribute("checked", gWrapLongLines);
|
||||
document.getElementById("menu_highlightSyntax")
|
||||
.setAttribute("checked",
|
||||
Services.prefs.getBoolPref("view_source.syntax_highlight"));
|
||||
// check the view_source.wrap_long_lines pref and set the menuitem's checked attribute accordingly
|
||||
if (gPrefs) {
|
||||
try {
|
||||
var wraplonglinesPrefValue = gPrefs.getBoolPref('view_source.wrap_long_lines');
|
||||
if (wraplonglinesPrefValue) {
|
||||
document.getElementById('menu_wrapLongLines').setAttribute('checked', 'true');
|
||||
gWrapLongLines = true;
|
||||
}
|
||||
} catch (e) { }
|
||||
try {
|
||||
document.getElementById("menu_highlightSyntax").setAttribute("checked", gPrefs.getBoolPref("view_source.syntax_highlight"));
|
||||
} catch (e) {
|
||||
}
|
||||
} else {
|
||||
document.getElementById("menu_highlightSyntax").setAttribute("hidden", "true");
|
||||
}
|
||||
|
||||
if (window.arguments[3] == 'selection')
|
||||
viewPartialSourceForSelection(window.arguments[2]);
|
||||
|
@ -38,10 +38,9 @@
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
var gPrefs = null;
|
||||
|
||||
var gLastLineFound = '';
|
||||
var gGoToLine = 0;
|
||||
@ -73,6 +72,13 @@ __defineGetter__("gPageLoader", function () {
|
||||
return this.gPageLoader = webnav.QueryInterface(Ci.nsIWebPageDescriptor);
|
||||
});
|
||||
|
||||
try {
|
||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
gPrefs = prefService.getBranch(null);
|
||||
} catch (ex) {
|
||||
}
|
||||
|
||||
var gSelectionListener = {
|
||||
timeout: 0,
|
||||
attached: false,
|
||||
@ -213,14 +219,22 @@ function viewSource(url)
|
||||
|
||||
// Check the view_source.wrap_long_lines pref and set the menuitem's checked
|
||||
// attribute accordingly.
|
||||
var wraplonglinesPrefValue = Services.prefs
|
||||
.getBoolPref("view_source.wrap_long_lines");
|
||||
if (gPrefs) {
|
||||
try {
|
||||
var wraplonglinesPrefValue = gPrefs.getBoolPref("view_source.wrap_long_lines");
|
||||
|
||||
if (wraplonglinesPrefValue)
|
||||
document.getElementById("menu_wrapLongLines").setAttribute("checked", "true");
|
||||
|
||||
} catch (ex) {
|
||||
}
|
||||
try {
|
||||
document.getElementById("menu_highlightSyntax").setAttribute("checked",
|
||||
Services.prefs.getBoolPref("view_source.syntax_highlight"));
|
||||
gPrefs.getBoolPref("view_source.syntax_highlight"));
|
||||
} catch (ex) {
|
||||
}
|
||||
} else {
|
||||
document.getElementById("menu_highlightSyntax").setAttribute("hidden", "true");
|
||||
}
|
||||
|
||||
window.addEventListener("AppCommand", HandleAppCommandEvent, true);
|
||||
window.addEventListener("MozSwipeGesture", HandleSwipeGesture, true);
|
||||
@ -273,6 +287,9 @@ function onClickContent(event) {
|
||||
var target = event.originalTarget;
|
||||
var errorDoc = target.ownerDocument;
|
||||
|
||||
var formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"]
|
||||
.getService(Ci.nsIURLFormatter);
|
||||
|
||||
if (/^about:blocked/.test(errorDoc.documentURI)) {
|
||||
// The event came from a button on a malware/phishing block page
|
||||
// First check whether it's malware or phishing, so that we can
|
||||
@ -291,7 +308,7 @@ function onClickContent(event) {
|
||||
// Get the stop badware "why is this blocked" report url,
|
||||
// append the current url, and go there.
|
||||
try {
|
||||
let reportURL = Services.urlFormatter.formatURLPref("browser.safebrowsing.malware.reportURL", true);
|
||||
let reportURL = formatter.formatURLPref("browser.safebrowsing.malware.reportURL", true);
|
||||
reportURL += errorDoc.location.href.slice(12);
|
||||
openURL(reportURL);
|
||||
} catch (e) {
|
||||
@ -299,7 +316,7 @@ function onClickContent(event) {
|
||||
}
|
||||
} else { // It's a phishing site, not malware
|
||||
try {
|
||||
var infoURL = Services.urlFormatter.formatURLPref("browser.safebrowsing.warning.infoURL", true);
|
||||
var infoURL = formatter.formatURLPref("browser.safebrowsing.warning.infoURL", true);
|
||||
openURL(infoURL);
|
||||
} catch (e) {
|
||||
Components.utils.reportError("Couldn't get phishing info URL: " + e);
|
||||
@ -405,9 +422,12 @@ function getWebNavigation()
|
||||
|
||||
function ViewSourceGoToLine()
|
||||
{
|
||||
var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
.getService(Ci.nsIPromptService);
|
||||
|
||||
var input = {value:gLastLineFound};
|
||||
for (;;) {
|
||||
var ok = Services.prompt.prompt(
|
||||
var ok = promptService.prompt(
|
||||
window,
|
||||
gViewSourceBundle.getString("goToLineTitle"),
|
||||
gViewSourceBundle.getString("goToLineText"),
|
||||
@ -421,7 +441,7 @@ function ViewSourceGoToLine()
|
||||
var line = parseInt(input.value, 10);
|
||||
|
||||
if (!(line > 0)) {
|
||||
Services.prompt.alert(window,
|
||||
promptService.alert(window,
|
||||
gViewSourceBundle.getString("invalidInputTitle"),
|
||||
gViewSourceBundle.getString("invalidInputText"));
|
||||
|
||||
@ -433,7 +453,7 @@ function ViewSourceGoToLine()
|
||||
if (found)
|
||||
break;
|
||||
|
||||
Services.prompt.alert(window,
|
||||
promptService.alert(window,
|
||||
gViewSourceBundle.getString("outOfRangeTitle"),
|
||||
gViewSourceBundle.getString("outOfRangeText"));
|
||||
}
|
||||
@ -663,13 +683,22 @@ function wrapLongLines()
|
||||
|
||||
if (myWrap.className == '')
|
||||
myWrap.className = 'wrap';
|
||||
else
|
||||
myWrap.className = '';
|
||||
else myWrap.className = '';
|
||||
|
||||
// Since multiple viewsource windows are possible, another window could have
|
||||
// affected the pref, so instead of determining the new pref value via the current
|
||||
// pref value, we use myWrap.className.
|
||||
Services.prefs.setBoolPref("view_source.wrap_long_lines", myWrap.className != '');
|
||||
if (gPrefs) {
|
||||
try {
|
||||
if (myWrap.className == '') {
|
||||
gPrefs.setBoolPref("view_source.wrap_long_lines", false);
|
||||
}
|
||||
else {
|
||||
gPrefs.setBoolPref("view_source.wrap_long_lines", true);
|
||||
}
|
||||
} catch (ex) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Toggles syntax highlighting and sets the view_source.syntax_highlight
|
||||
@ -678,7 +707,7 @@ function highlightSyntax()
|
||||
{
|
||||
var highlightSyntaxMenu = document.getElementById("menu_highlightSyntax");
|
||||
var highlightSyntax = (highlightSyntaxMenu.getAttribute("checked") == "true");
|
||||
Services.prefs.setBoolPref("view_source.syntax_highlight", highlightSyntax);
|
||||
gPrefs.setBoolPref("view_source.syntax_highlight", highlightSyntax);
|
||||
|
||||
gPageLoader.loadPage(gPageLoader.currentDescriptor, gPageLoader.DISPLAY_NORMAL);
|
||||
}
|
||||
|
@ -183,6 +183,16 @@ InlineSpellChecker.prototype = {
|
||||
this.mDictionaryNames = [];
|
||||
this.mDictionaryItems = [];
|
||||
|
||||
if (! gLanguageBundle) {
|
||||
// create the bundles for language and region
|
||||
var bundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Components.interfaces.nsIStringBundleService);
|
||||
gLanguageBundle = bundleService.createBundle(
|
||||
"chrome://global/locale/languageNames.properties");
|
||||
gRegionBundle = bundleService.createBundle(
|
||||
"chrome://global/locale/regionNames.properties");
|
||||
}
|
||||
|
||||
if (! this.mInlineSpellChecker || ! this.enabled)
|
||||
return 0;
|
||||
var spellchecker = this.mInlineSpellChecker.spellChecker;
|
||||
@ -194,12 +204,33 @@ InlineSpellChecker.prototype = {
|
||||
try {
|
||||
curlang = spellchecker.GetCurrentDictionary();
|
||||
} catch(e) {}
|
||||
var isoStrArray;
|
||||
|
||||
for (var i = 0; i < list.length; i ++) {
|
||||
// get the display name for this dictionary
|
||||
isoStrArray = list[i].split(/[-_]/);
|
||||
var displayName = "";
|
||||
if (gLanguageBundle && isoStrArray[0]) {
|
||||
try {
|
||||
displayName = gLanguageBundle.GetStringFromName(isoStrArray[0].toLowerCase());
|
||||
} catch(e) {} // ignore language bundle errors
|
||||
if (gRegionBundle && isoStrArray[1]) {
|
||||
try {
|
||||
displayName += " / " + gRegionBundle.GetStringFromName(isoStrArray[1].toLowerCase());
|
||||
} catch(e) {} // ignore region bundle errors
|
||||
if (isoStrArray[2])
|
||||
displayName += " (" + isoStrArray[2] + ")";
|
||||
}
|
||||
}
|
||||
|
||||
// if we didn't get a name, just use the raw dictionary name
|
||||
if (displayName.length == 0)
|
||||
displayName = list[i];
|
||||
|
||||
this.mDictionaryNames.push(list[i]);
|
||||
var item = menu.ownerDocument.createElement("menuitem");
|
||||
item.setAttribute("id", "spell-check-dictionary-" + list[i]);
|
||||
item.setAttribute("label", this.getDictionaryDisplayName(list[i]));
|
||||
item.setAttribute("label", displayName);
|
||||
item.setAttribute("type", "radio");
|
||||
this.mDictionaryItems.push(item);
|
||||
if (curlang == list[i]) {
|
||||
@ -216,65 +247,6 @@ InlineSpellChecker.prototype = {
|
||||
return list.length;
|
||||
},
|
||||
|
||||
// Formats a valid BCP 47 language tag based on available localized names.
|
||||
getDictionaryDisplayName: function(dictionaryName) {
|
||||
try {
|
||||
// Get the display name for this dictionary.
|
||||
let languageTagMatch = /^([a-z]{2,3}|[a-z]{4}|[a-z]{5,8})(?:[-_]([a-z]{4}))?(?:[-_]([A-Z]{2}|[0-9]{3}))?((?:[-_](?:[a-z0-9]{5,8}|[0-9][a-z0-9]{3}))*)$/i;
|
||||
var [languageTag, languageSubtag, scriptSubtag, regionSubtag, variantSubtags] = dictionaryName.match(languageTagMatch);
|
||||
} catch(e) {
|
||||
// If we weren't given a valid language tag, just use the raw dictionary name.
|
||||
return dictionaryName;
|
||||
}
|
||||
|
||||
if (!gLanguageBundle) {
|
||||
// Create the bundles for language and region names.
|
||||
var bundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
|
||||
.getService(Components.interfaces.nsIStringBundleService);
|
||||
gLanguageBundle = bundleService.createBundle(
|
||||
"chrome://global/locale/languageNames.properties");
|
||||
gRegionBundle = bundleService.createBundle(
|
||||
"chrome://global/locale/regionNames.properties");
|
||||
}
|
||||
|
||||
var displayName = "";
|
||||
|
||||
// Language subtag will normally be 2 or 3 letters, but could be up to 8.
|
||||
try {
|
||||
displayName += gLanguageBundle.GetStringFromName(languageSubtag.toLowerCase());
|
||||
} catch(e) {
|
||||
displayName += languageSubtag.toLowerCase(); // Fall back to raw language subtag.
|
||||
}
|
||||
|
||||
// Region subtag will be 2 letters or 3 digits.
|
||||
if (regionSubtag) {
|
||||
displayName += " (";
|
||||
|
||||
try {
|
||||
displayName += gRegionBundle.GetStringFromName(regionSubtag.toLowerCase());
|
||||
} catch(e) {
|
||||
displayName += regionSubtag.toUpperCase(); // Fall back to raw region subtag.
|
||||
}
|
||||
|
||||
displayName += ")";
|
||||
}
|
||||
|
||||
// Script subtag will be 4 letters.
|
||||
if (scriptSubtag) {
|
||||
displayName += " / ";
|
||||
|
||||
// XXX: See bug 666662 and bug 666731 for full implementation.
|
||||
displayName += scriptSubtag; // Fall back to raw script subtag.
|
||||
}
|
||||
|
||||
// Each variant subtag will be 4 to 8 chars.
|
||||
if (variantSubtags)
|
||||
// XXX: See bug 666662 and bug 666731 for full implementation.
|
||||
displayName += " (" + variantSubtags.substr(1).split(/[-_]/).join(" / ") + ")"; // Collapse multiple variants.
|
||||
|
||||
return displayName;
|
||||
},
|
||||
|
||||
// undoes the work of addDictionaryListToMenu for the menu
|
||||
// (call on popup hiding)
|
||||
clearDictionaryListFromMenu: function()
|
||||
|
@ -55,7 +55,6 @@ _BROWSER_TEST_FILES = \
|
||||
browser_bug295977_autoscroll_overflow.js \
|
||||
browser_bug594509.js \
|
||||
browser_Geometry.js \
|
||||
browser_InlineSpellChecker.js \
|
||||
browser_save_resend_postdata.js \
|
||||
browser_browserDrop.js \
|
||||
browser_Services.js \
|
||||
|
@ -1,59 +0,0 @@
|
||||
function test() {
|
||||
let tempScope = {};
|
||||
Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm", tempScope);
|
||||
let InlineSpellChecker = tempScope.InlineSpellChecker;
|
||||
|
||||
ok(InlineSpellChecker, "InlineSpellChecker class exists");
|
||||
for (var fname in tests) {
|
||||
tests[fname]();
|
||||
}
|
||||
}
|
||||
|
||||
let tests = {
|
||||
// Test various possible dictionary name to ensure they display as expected.
|
||||
// XXX: This only works for the 'en-US' locale, as the testing involves localized output.
|
||||
testDictionaryDisplayNames: function() {
|
||||
let isc = new InlineSpellChecker();
|
||||
|
||||
// Check for valid language tag.
|
||||
is(isc.getDictionaryDisplayName("-invalid-"), "-invalid-", "'-invalid-' should display as '-invalid-'");
|
||||
|
||||
// Check if display name is available for language subtag.
|
||||
is(isc.getDictionaryDisplayName("en"), "English", "'en' should display as 'English'");
|
||||
is(isc.getDictionaryDisplayName("qaz"), "qaz", "'qaz' should display as 'qaz'"); // Private use subtag
|
||||
|
||||
// Check if display name is available for region subtag.
|
||||
is(isc.getDictionaryDisplayName("en-US"), "English (United States)", "'en-US' should display as 'English (United States)'");
|
||||
is(isc.getDictionaryDisplayName("en-QZ"), "English (QZ)", "'en-QZ' should display as 'English (QZ)'"); // Private use subtag
|
||||
todo_is(isc.getDictionaryDisplayName("es-419"), "Spanish (Latin America and the Caribbean)", "'es-419' should display as 'Spanish (Latin America and the Caribbean)'");
|
||||
|
||||
// Check if display name is available for script subtag.
|
||||
todo_is(isc.getDictionaryDisplayName("en-Cyrl"), "English / Cyrillic", "'en-Cyrl' should display as 'English / Cyrillic'");
|
||||
todo_is(isc.getDictionaryDisplayName("en-Cyrl-US"), "English (United States) / Cyrillic", "'en-Cyrl-US' should display as 'English (United States) / Cyrillic'");
|
||||
todo_is(isc.getDictionaryDisplayName("en-Cyrl-QZ"), "English (QZ) / Cyrillic", "'en-Cyrl-QZ' should display as 'English (QZ) / Cyrillic'"); // Private use subtag
|
||||
todo_is(isc.getDictionaryDisplayName("qaz-Cyrl"), "qaz / Cyrillic", "'qaz-Cyrl' should display as 'qaz / Cyrillic'"); // Private use subtag
|
||||
todo_is(isc.getDictionaryDisplayName("qaz-Cyrl-US"), "qaz (United States) / Cyrillic", "'qaz-Cyrl-US' should display as 'qaz (United States) / Cyrillic'"); // Private use subtag
|
||||
todo_is(isc.getDictionaryDisplayName("qaz-Cyrl-QZ"), "qaz (QZ) / Cyrillic", "'qaz-Cyrl-QZ' should display as 'qaz (QZ) / Cyrillic'"); // Private use subtags
|
||||
is(isc.getDictionaryDisplayName("en-Qaaz"), "English / Qaaz", "'en-Qaaz' should display as 'English / Qaaz'"); // Private use subtag
|
||||
is(isc.getDictionaryDisplayName("en-Qaaz-US"), "English (United States) / Qaaz", "'en-Qaaz-US' should display as 'English (United States) / Qaaz'"); // Private use subtag
|
||||
is(isc.getDictionaryDisplayName("en-Qaaz-QZ"), "English (QZ) / Qaaz", "'en-Qaaz-QZ' should display as 'English (QZ) / Qaaz'"); // Private use subtags
|
||||
is(isc.getDictionaryDisplayName("qaz-Qaaz"), "qaz / Qaaz", "'qaz-Qaaz' should display as 'qaz / Qaaz'"); // Private use subtags
|
||||
is(isc.getDictionaryDisplayName("qaz-Qaaz-US"), "qaz (United States) / Qaaz", "'qaz-Qaaz-US' should display as 'qaz (United States) / Qaaz'"); // Private use subtags
|
||||
is(isc.getDictionaryDisplayName("qaz-Qaaz-QZ"), "qaz (QZ) / Qaaz", "'qaz-Qaaz-QZ' should display as 'qaz (QZ) / Qaaz'"); // Private use subtags
|
||||
|
||||
// Check if display name is available for variant subtag.
|
||||
// XXX: It isn't clear how we'd ideally want to display variant subtags.
|
||||
is(isc.getDictionaryDisplayName("de-1996"), "German (1996)", "'de-1996' should display as 'German (1996)'");
|
||||
is(isc.getDictionaryDisplayName("de-CH-1996"), "German (Switzerland) (1996)", "'de-CH-1996' should display as 'German (Switzerland) (1996)'");
|
||||
|
||||
// Complex cases.
|
||||
// XXX: It isn't clear how we'd ideally want to display variant subtags.
|
||||
todo_is(isc.getDictionaryDisplayName("en-Cyrl-US-fonipa"), "English (United States) / Cyrillic (fonipa)", "'en-Cyrl-US-fonipa' should display as 'English (United States) / Cyrillic (fonipa)'");
|
||||
todo_is(isc.getDictionaryDisplayName("en-Cyrl-US-fonipa-fonxsamp"), "English (United States) / Cyrillic (fonipa / fonxsamp)", "'en-Cyrl-US-fonipa-fonxsamp' should display as 'English (United States) / Cyrillic (fonipa / fonxsamp)'");
|
||||
is(isc.getDictionaryDisplayName("qaz-Qaaz-QZ-fonipa"), "qaz (QZ) / Qaaz (fonipa)", "'qaz-Qaaz-QZ-fonipa' should display as 'qaz (QZ) / Qaaz (fonipa)'"); // Private use subtags
|
||||
is(isc.getDictionaryDisplayName("qaz-Qaaz-QZ-fonipa-fonxsamp"), "qaz (QZ) / Qaaz (fonipa / fonxsamp)", "'qaz-Qaaz-QZ-fonipa-fonxsamp' should display as 'qaz (QZ) / Qaaz (fonipa / fonxsamp)'"); // Private use subtags
|
||||
|
||||
// Check if display name is available for grandfathered tags.
|
||||
todo_is(isc.getDictionaryDisplayName("en-GB-oed"), "English (United Kingdom) (OED)", "'en-GB-oed' should display as 'English (United Kingdom) (OED)'");
|
||||
},
|
||||
};
|
@ -489,9 +489,6 @@ public:
|
||||
PRUint32 aNativeMessage,
|
||||
PRUint32 aModifierFlags);
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint)
|
||||
{ return SynthesizeNativeMouseEvent(aPoint, NSMouseMoved, 0); }
|
||||
|
||||
// Mac specific methods
|
||||
|
||||
virtual bool DispatchWindowEvent(nsGUIEvent& event);
|
||||
|
@ -6493,19 +6493,3 @@ nsWindow::ClearCachedResources()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsWindow::SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
||||
PRUint32 aNativeMessage,
|
||||
PRUint32 aModifierFlags)
|
||||
{
|
||||
if (!mGdkWindow) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
GdkDisplay* display = gdk_window_get_display(mGdkWindow);
|
||||
GdkScreen* screen = gdk_window_get_screen(mGdkWindow);
|
||||
gdk_display_warp_pointer(display, screen, aPoint.x, aPoint.y);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -347,13 +347,6 @@ public:
|
||||
#endif
|
||||
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
||||
PRUint32 aNativeMessage,
|
||||
PRUint32 aModifierFlags);
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint)
|
||||
{ return SynthesizeNativeMouseEvent(aPoint, GDK_MOTION_NOTIFY, 0); }
|
||||
|
||||
protected:
|
||||
// Helper for SetParent and ReparentNativeWidget.
|
||||
void ReparentNativeWidgetInternal(nsIWidget* aNewParent,
|
||||
|
@ -558,11 +558,6 @@ class nsHashKey;
|
||||
#define NS_TOUCH_LEAVE (NS_TOUCH_EVENT_START+4)
|
||||
#define NS_TOUCH_CANCEL (NS_TOUCH_EVENT_START+5)
|
||||
|
||||
// Pointerlock DOM API
|
||||
#define NS_POINTERLOCK_START 5300
|
||||
#define NS_POINTERLOCKCHANGE (NS_POINTERLOCK_START)
|
||||
#define NS_POINTERLOCKERROR (NS_POINTERLOCK_START + 1)
|
||||
|
||||
/**
|
||||
* Return status for event processors, nsEventStatus, is defined in
|
||||
* nsEvent.h.
|
||||
@ -588,7 +583,6 @@ protected:
|
||||
: eventStructType(structType),
|
||||
message(msg),
|
||||
refPoint(0, 0),
|
||||
lastRefPoint(0, 0),
|
||||
time(0),
|
||||
flags(isTrusted ? NS_EVENT_FLAG_TRUSTED : NS_EVENT_FLAG_NONE),
|
||||
userType(0)
|
||||
@ -605,7 +599,6 @@ public:
|
||||
: eventStructType(NS_EVENT),
|
||||
message(msg),
|
||||
refPoint(0, 0),
|
||||
lastRefPoint(0, 0),
|
||||
time(0),
|
||||
flags(isTrusted ? NS_EVENT_FLAG_TRUSTED : NS_EVENT_FLAG_NONE),
|
||||
userType(0)
|
||||
@ -625,8 +618,6 @@ public:
|
||||
// Relative to the widget of the event, or if there is no widget then it is
|
||||
// in screen coordinates. Not modified by layout code.
|
||||
nsIntPoint refPoint;
|
||||
// The previous refPoint, if known, used to calculate mouse movement deltas.
|
||||
nsIntPoint lastRefPoint;
|
||||
// Elapsed time, in milliseconds, from a platform-specific zero time
|
||||
// to the time the message was created
|
||||
PRUint64 time;
|
||||
|
@ -118,8 +118,8 @@ typedef nsEventStatus (* EVENT_CALLBACK)(nsGUIEvent *event);
|
||||
#endif
|
||||
|
||||
#define NS_IWIDGET_IID \
|
||||
{ 0xb5bb55c7, 0x9a50, 0x4fa8, \
|
||||
{ 0xa7, 0x6e, 0xbd, 0x31, 0x6f, 0x3e, 0x9c, 0x13 } }
|
||||
{ 0xe7af49c1, 0xd11b, 0x4070, \
|
||||
{ 0x99, 0x7a, 0x2d, 0x2b, 0x7, 0x4b, 0xea, 0xf4 } }
|
||||
|
||||
/*
|
||||
* Window shadow styles
|
||||
@ -1376,11 +1376,6 @@ class nsIWidget : public nsISupports {
|
||||
PRUint32 aNativeMessage,
|
||||
PRUint32 aModifierFlags) = 0;
|
||||
|
||||
/**
|
||||
* A shortcut to SynthesizeNativeMouseEvent, abstracting away the native message.
|
||||
*/
|
||||
virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint) = 0;
|
||||
|
||||
/**
|
||||
* Utility method intended for testing. Dispatching native mouse scroll
|
||||
* events may move the mouse cursor.
|
||||
|
@ -177,10 +177,6 @@ public:
|
||||
virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
||||
PRUint32 aNativeMessage,
|
||||
PRUint32 aModifierFlags);
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint)
|
||||
{ return SynthesizeNativeMouseEvent(aPoint, MOUSEEVENTF_MOVE, 0); }
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(nsIntPoint aPoint,
|
||||
PRUint32 aNativeMessage,
|
||||
double aDeltaX,
|
||||
|
@ -270,9 +270,6 @@ protected:
|
||||
PRUint32 aModifierFlags)
|
||||
{ return NS_ERROR_UNEXPECTED; }
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint)
|
||||
{ return NS_ERROR_UNEXPECTED; }
|
||||
|
||||
virtual nsresult SynthesizeNativeMouseScrollEvent(nsIntPoint aPoint,
|
||||
PRUint32 aNativeMessage,
|
||||
double aDeltaX,
|
||||
|
Loading…
Reference in New Issue
Block a user