diff --git a/content/base/public/nsIDocument.h b/content/base/public/nsIDocument.h index 11193e68171..a2e08e8be21 100644 --- a/content/base/public/nsIDocument.h +++ b/content/base/public/nsIDocument.h @@ -780,12 +780,6 @@ public: */ static void ExitFullScreen(bool aRunAsync); - - virtual void RequestPointerLock(Element* aElement) = 0; - - static void UnlockPointer(); - - //---------------------------------------------------------------------- // Document notification API's diff --git a/content/base/public/nsINode.h b/content/base/public/nsINode.h index bd8f8582e0d..02799107220 100644 --- a/content/base/public/nsINode.h +++ b/content/base/public/nsINode.h @@ -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); } diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 4780ce7dc8b..189ac311d64 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -8658,13 +8658,6 @@ nsDocument::ExitFullScreen() // dispatch to so that we dispatch in the specified order. nsAutoTArray changed; - // We may also need to unlock the pointer, if it's locked. - nsCOMPtr 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(&changed)); @@ -8695,20 +8688,12 @@ nsDocument::RestorePreviousFullScreenState() return; } - // If fullscreen mode is updated the pointer should be unlocked - nsCOMPtr pointerLockedElement = - do_QueryReferent(nsEventStateManager::sPointerLockedElement); - if (pointerLockedElement) { - UnlockPointer(); - } - // Clear full-screen stacks in all descendant documents, bottom up. nsCOMPtr fullScreenDoc(do_QueryReferent(sFullScreenDoc)); nsIDocument* doc = fullScreenDoc; while (doc != this) { NS_ASSERTION(doc->IsFullScreenDoc(), "Should be full-screen doc"); static_cast(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(doc)->FullScreenStackPop(); - UnlockPointer(); DispatchFullScreenChange(doc); if (static_cast(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 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 e = - new nsAsyncDOMEvent(aTarget, - NS_LITERAL_STRING("mozpointerlockchange"), - true, - false); - e->PostDOMEvent(); -} - -static void -DispatchPointerLockError(nsIDocument* aTarget) -{ - nsRefPtr 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 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(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 ownerDoc = aElement->OwnerDoc(); - if (!ownerDoc) { - return false; - } - if (!nsCOMPtr(ownerDoc->GetContainer())) { - return false; - } - nsCOMPtr ownerWindow = ownerDoc->GetWindow(); - if (!ownerWindow) { - return false; - } - nsCOMPtr 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 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 presContext; - docShell->GetPresContext(getter_AddRefs(presContext)); - if (!presContext) { - NS_WARNING("SetPointerLock(): Unable to get presContext in \ - domWindow->GetDocShell()->GetPresContext()"); - return false; - } - - nsCOMPtr 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 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 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 pointerLockedDoc = - do_QueryReferent(nsEventStateManager::sPointerLockedDoc); - if (!pointerLockedDoc) { - return; - } - nsDocument* doc = static_cast(pointerLockedDoc.get()); - if (!doc->SetPointerLock(nsnull, NS_STYLE_CURSOR_AUTO)) { - return; - } - - nsCOMPtr 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 pointerLockedElement = - do_QueryReferent(nsEventStateManager::sPointerLockedElement); - if (!pointerLockedElement) { - return NS_OK; - } - - // Make sure pointer locked element is in the same document and domain. - nsCOMPtr pointerLockedDoc = - do_QueryReferent(nsEventStateManager::sPointerLockedDoc); - nsDocument* doc = static_cast(pointerLockedDoc.get()); - if (doc != this) { - return NS_OK; - } - nsCOMPtr 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); \ diff --git a/content/base/src/nsDocument.h b/content/base/src/nsDocument.h index bd1453dd186..7357c5c10d5 100644 --- a/content/base/src/nsDocument.h +++ b/content/base/src/nsDocument.h @@ -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(); diff --git a/content/base/src/nsGenericElement.cpp b/content/base/src/nsGenericElement.cpp index 408e9837765..3f02e43e366 100644 --- a/content/base/src/nsGenericElement.cpp +++ b/content/base/src/nsGenericElement.cpp @@ -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). diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index 06d474f8696..cc7576d706c 100644 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -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") diff --git a/content/events/public/nsEventNameList.h b/content/events/public/nsEventNameList.h index 505ec7c99f4..cc486f77e3c 100644 --- a/content/events/public/nsEventNameList.h +++ b/content/events/public/nsEventNameList.h @@ -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, diff --git a/content/events/src/nsDOMEvent.cpp b/content/events/src/nsDOMEvent.cpp index a54e87ecc35..a80cd3159f6 100644 --- a/content/events/src/nsDOMEvent.cpp +++ b/content/events/src/nsDOMEvent.cpp @@ -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 && diff --git a/content/events/src/nsDOMEvent.h b/content/events/src/nsDOMEvent.h index 4fe206588c2..e2c2017cd58 100644 --- a/content/events/src/nsDOMEvent.h +++ b/content/events/src/nsDOMEvent.h @@ -183,8 +183,6 @@ public: eDOMEvents_beforeresize, eDOMEvents_mozfullscreenchange, eDOMEvents_mozfullscreenerror, - eDOMEvents_mozpointerlockchange, - eDOMEvents_mozpointerlockerror, eDOMEvents_MozSwipeGesture, eDOMEvents_MozMagnifyGestureStart, eDOMEvents_MozMagnifyGestureUpdate, diff --git a/content/events/src/nsDOMMouseEvent.cpp b/content/events/src/nsDOMMouseEvent.cpp index 5250862c51e..25f2bb966ce 100644 --- a/content/events/src/nsDOMMouseEvent.cpp +++ b/content/events/src/nsDOMMouseEvent.cpp @@ -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); diff --git a/content/events/src/nsDOMUIEvent.cpp b/content/events/src/nsDOMUIEvent.cpp index 9aaa031cd0a..70537dfff32 100644 --- a/content/events/src/nsDOMUIEvent.cpp +++ b/content/events/src/nsDOMUIEvent.cpp @@ -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(aEvent) : static_cast(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,9 +124,9 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMUIEvent) NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent) nsIntPoint -nsDOMUIEvent::GetMovementPoint() +nsDOMUIEvent::GetScreenPoint() { - if (!mEvent || + if (!mEvent || (mEvent->eventStructType != NS_MOUSE_EVENT && mEvent->eventStructType != NS_POPUP_EVENT && mEvent->eventStructType != NS_MOUSE_SCROLL_EVENT && @@ -138,41 +136,43 @@ nsDOMUIEvent::GetMovementPoint() return nsIntPoint(0, 0); } - if (!((nsGUIEvent*)mEvent)->widget) { - return mEvent->lastRefPoint; + if (!((nsGUIEvent*)mEvent)->widget ) { + 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), - nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor)); - - return currentPoint - lastPoint; -} - -nsIntPoint -nsDOMUIEvent::GetScreenPoint() -{ - if (mIsPointerLocked) { - return mLastScreenPoint; - } - - return CalculateScreenPoint(mPresContext, mEvent); + return nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor), + nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor)); } 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 diff --git a/content/events/src/nsDOMUIEvent.h b/content/events/src/nsDOMUIEvent.h index a4c1ebd7b94..69626f4f9da 100644 --- a/content/events/src/nsDOMUIEvent.h +++ b/content/events/src/nsDOMUIEvent.h @@ -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 \ diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index cb00f597d59..3a477fe39fe 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -136,8 +136,6 @@ #include "mozilla/LookAndFeel.h" #include "sampler.h" -#include "nsIDOMClientRect.h" - #ifdef XP_MACOSX #import #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 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 pointerLockedElement = - do_QueryReferent(nsEventStateManager::sPointerLockedElement); - if (!pointerLockedElement) { - NS_WARNING("Should have pointer locked element, but didn't."); - return nsnull; - } - nsCOMPtr 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 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 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 pointerLockedDoc = - do_QueryReferent(nsEventStateManager::sPointerLockedDoc); - if (!pointerLockedDoc) { - NS_WARNING("GetMouseCoords(): No Document"); - return nsIntPoint(0, 0); - } - - nsCOMPtr 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) diff --git a/content/events/src/nsEventStateManager.h b/content/events/src/nsEventStateManager.h index 22328f2ef59..aec9036d0da 100644 --- a/content/events/src/nsEventStateManager.h +++ b/content/events/src/nsEventStateManager.h @@ -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 mCurrentTargetContent; nsWeakFrame mLastMouseOverFrame; nsCOMPtr 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 ) ; }; diff --git a/dom/interfaces/core/nsIDOMDocument.idl b/dom/interfaces/core/nsIDOMDocument.idl index 49852d92ea0..a6c79b0cd25 100644 --- a/dom/interfaces/core/nsIDOMDocument.idl +++ b/dom/interfaces/core/nsIDOMDocument.idl @@ -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 - */ - readonly attribute nsIDOMElement mozPointerLockElement; - - /** - * Exit pointer is lock if locked, as per the DOM pointer lock api. - * - * @see - */ - void mozExitPointerLock(); - /** * Inline event handler for readystatechange events. */ diff --git a/dom/interfaces/core/nsIDOMElement.idl b/dom/interfaces/core/nsIDOMElement.idl index 097902bc066..1469259a109 100644 --- a/dom/interfaces/core/nsIDOMElement.idl +++ b/dom/interfaces/core/nsIDOMElement.idl @@ -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 */ void mozRequestFullScreen(); - - /** - * Requests that this element be made the pointer-locked element, as per the DOM - * pointer lock api. - * - * @see - */ - void mozRequestPointerLock(); }; diff --git a/dom/interfaces/core/nsIInlineEventHandlers.idl b/dom/interfaces/core/nsIInlineEventHandlers.idl index 55b279734a4..0ef12e8e36f 100644 --- a/dom/interfaces/core/nsIInlineEventHandlers.idl +++ b/dom/interfaces/core/nsIInlineEventHandlers.idl @@ -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; diff --git a/dom/interfaces/events/nsIDOMMouseEvent.idl b/dom/interfaces/events/nsIDOMMouseEvent.idl index 8621c1140f8..11f1f142aa3 100644 --- a/dom/interfaces/events/nsIDOMMouseEvent.idl +++ b/dom/interfaces/events/nsIDOMMouseEvent.idl @@ -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; diff --git a/dom/tests/mochitest/Makefile.in b/dom/tests/mochitest/Makefile.in index 1a522098851..8dfae2fc583 100644 --- a/dom/tests/mochitest/Makefile.in +++ b/dom/tests/mochitest/Makefile.in @@ -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 diff --git a/dom/tests/mochitest/pointerlock/Makefile.in b/dom/tests/mochitest/pointerlock/Makefile.in deleted file mode 100644 index c4e4c179eef..00000000000 --- a/dom/tests/mochitest/pointerlock/Makefile.in +++ /dev/null @@ -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) diff --git a/dom/tests/mochitest/pointerlock/file_childIframe.html b/dom/tests/mochitest/pointerlock/file_childIframe.html deleted file mode 100644 index 6f3dd6afa58..00000000000 --- a/dom/tests/mochitest/pointerlock/file_childIframe.html +++ /dev/null @@ -1,143 +0,0 @@ - - - - - Bug 633602 - file_childIframe.html - - - - - - - - - Mozilla Bug 633602 - - -
- - - - - -
- - -
-
-
-
- -
-    
-  
- - diff --git a/dom/tests/mochitest/pointerlock/file_doubleLock.html b/dom/tests/mochitest/pointerlock/file_doubleLock.html deleted file mode 100644 index c505de9aba6..00000000000 --- a/dom/tests/mochitest/pointerlock/file_doubleLock.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - Bug 633602 - file_doubleLockCallBack.html - - - - - - - - - Mozilla Bug 633602 -
-
-    
-  
- - diff --git a/dom/tests/mochitest/pointerlock/file_escapeKey.html b/dom/tests/mochitest/pointerlock/file_escapeKey.html deleted file mode 100644 index 78dba1c70a8..00000000000 --- a/dom/tests/mochitest/pointerlock/file_escapeKey.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - Bug 633602 - - - - - - - - Mozilla Bug 633602 - -
-
-    
-  
- - diff --git a/dom/tests/mochitest/pointerlock/file_infiniteMovement.html b/dom/tests/mochitest/pointerlock/file_infiniteMovement.html deleted file mode 100644 index e0b01f319f9..00000000000 --- a/dom/tests/mochitest/pointerlock/file_infiniteMovement.html +++ /dev/null @@ -1,100 +0,0 @@ - - - - - Bug 633602 - file_movementXY.html - - - - - - - - Mozilla Bug 633602 - -
-
-      
-    
- - diff --git a/dom/tests/mochitest/pointerlock/file_locksvgelement.html b/dom/tests/mochitest/pointerlock/file_locksvgelement.html deleted file mode 100644 index 8e19ea43e2a..00000000000 --- a/dom/tests/mochitest/pointerlock/file_locksvgelement.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - Bug 633602 - - - - - - - - Mozilla Bug 633602 -

- - - - - -
-      
-    
- - diff --git a/dom/tests/mochitest/pointerlock/file_loseFocusWindow.html b/dom/tests/mochitest/pointerlock/file_loseFocusWindow.html deleted file mode 100644 index df85bba731c..00000000000 --- a/dom/tests/mochitest/pointerlock/file_loseFocusWindow.html +++ /dev/null @@ -1,71 +0,0 @@ - - - - - Bug 633602 - file_exitMouseLockOnLoseFocus.html - - - - - - - - Mozilla Bug 633602 - -
-
-    
-  
- - diff --git a/dom/tests/mochitest/pointerlock/file_movementXY.html b/dom/tests/mochitest/pointerlock/file_movementXY.html deleted file mode 100644 index 9ce3e8428ac..00000000000 --- a/dom/tests/mochitest/pointerlock/file_movementXY.html +++ /dev/null @@ -1,105 +0,0 @@ - - - - - Bug 633602 - file_movementXY.html - - - - - - - - Mozilla Bug 633602 - -
-
-      
-    
- - diff --git a/dom/tests/mochitest/pointerlock/file_nestedFullScreen.html b/dom/tests/mochitest/pointerlock/file_nestedFullScreen.html deleted file mode 100644 index f8ff5da2536..00000000000 --- a/dom/tests/mochitest/pointerlock/file_nestedFullScreen.html +++ /dev/null @@ -1,81 +0,0 @@ - - - - - Bug 633602 - file_nestedFullScreen.html - - - - - - - - Mozilla Bug 633602 - - -
-
-
- - - - diff --git a/dom/tests/mochitest/pointerlock/file_pointerLockPref.html b/dom/tests/mochitest/pointerlock/file_pointerLockPref.html deleted file mode 100644 index 57cb5dda20f..00000000000 --- a/dom/tests/mochitest/pointerlock/file_pointerLockPref.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - Bug 633602 - - - - - - - - Mozilla Bug 633602 -

-
-
-      
-    
- - diff --git a/dom/tests/mochitest/pointerlock/file_pointerlock-api.html b/dom/tests/mochitest/pointerlock/file_pointerlock-api.html deleted file mode 100644 index fd04cedb96b..00000000000 --- a/dom/tests/mochitest/pointerlock/file_pointerlock-api.html +++ /dev/null @@ -1,92 +0,0 @@ - - - - - Bug 633602 - - - - - - - - Mozilla Bug 633602 - -
-
-    
-  
- - diff --git a/dom/tests/mochitest/pointerlock/file_pointerlockerror.html b/dom/tests/mochitest/pointerlock/file_pointerlockerror.html deleted file mode 100644 index 4c3317743bf..00000000000 --- a/dom/tests/mochitest/pointerlock/file_pointerlockerror.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - Bug 633602 - - - - - - - - Mozilla Bug 633602 - - -
-    
-  
- - diff --git a/dom/tests/mochitest/pointerlock/file_removedFromDOM.html b/dom/tests/mochitest/pointerlock/file_removedFromDOM.html deleted file mode 100644 index 2b06ef0c9ec..00000000000 --- a/dom/tests/mochitest/pointerlock/file_removedFromDOM.html +++ /dev/null @@ -1,70 +0,0 @@ - - - - - Bug 633602 - file_DOMtree.html - - - - - - - - - Mozilla Bug 633602 - -
-
-      
-    
- - diff --git a/dom/tests/mochitest/pointerlock/file_retargetMouseEvents.html b/dom/tests/mochitest/pointerlock/file_retargetMouseEvents.html deleted file mode 100644 index eac57516625..00000000000 --- a/dom/tests/mochitest/pointerlock/file_retargetMouseEvents.html +++ /dev/null @@ -1,164 +0,0 @@ - - - - - Bug 633602 - file_retargetMouseEvents.html - - - - - - - - Mozilla Bug 633602 - - -
-
-
-
- -
-    
-  
- - diff --git a/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html b/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html deleted file mode 100644 index ac417dea156..00000000000 --- a/dom/tests/mochitest/pointerlock/file_screenClientXYConst.html +++ /dev/null @@ -1,106 +0,0 @@ - - - - - Bug 633602 - constantXY.html - - - - - - - - Mozilla Bug 633602 - -
- - - diff --git a/dom/tests/mochitest/pointerlock/file_suppressSomeMouseEvents.html b/dom/tests/mochitest/pointerlock/file_suppressSomeMouseEvents.html deleted file mode 100644 index 6cdeb4c71ce..00000000000 --- a/dom/tests/mochitest/pointerlock/file_suppressSomeMouseEvents.html +++ /dev/null @@ -1,163 +0,0 @@ - - - - - Bug 633602 - file_cursorPosEvents.html - - - - - - - - - Mozilla Bug 633602 - -
-
-
- - - - diff --git a/dom/tests/mochitest/pointerlock/file_targetOutOfFocus.html b/dom/tests/mochitest/pointerlock/file_targetOutOfFocus.html deleted file mode 100644 index f899d5dcd01..00000000000 --- a/dom/tests/mochitest/pointerlock/file_targetOutOfFocus.html +++ /dev/null @@ -1,73 +0,0 @@ - - - - - Bug 633602 - file_targetOutOfFocus.html - - - - - - - - Mozilla Bug 633602 - -

-
-
-
- -
-      
-    
- - diff --git a/dom/tests/mochitest/pointerlock/file_withoutDOM.html b/dom/tests/mochitest/pointerlock/file_withoutDOM.html deleted file mode 100644 index 86f2aa3e4ef..00000000000 --- a/dom/tests/mochitest/pointerlock/file_withoutDOM.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - Bug 633602 - file_DOMtree.html - - - - - - - - - Mozilla Bug 633602 - -
-      
-    
- - diff --git a/dom/tests/mochitest/pointerlock/iframe_differentDOM.html b/dom/tests/mochitest/pointerlock/iframe_differentDOM.html deleted file mode 100644 index 3b500552a46..00000000000 --- a/dom/tests/mochitest/pointerlock/iframe_differentDOM.html +++ /dev/null @@ -1,7 +0,0 @@ - - - - -
- - diff --git a/dom/tests/mochitest/pointerlock/pointerlock_utils.js b/dom/tests/mochitest/pointerlock/pointerlock_utils.js deleted file mode 100644 index 687c67b7dff..00000000000 --- a/dom/tests/mochitest/pointerlock/pointerlock_utils.js +++ /dev/null @@ -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() {}; diff --git a/dom/tests/mochitest/pointerlock/test_pointerlock-api.html b/dom/tests/mochitest/pointerlock/test_pointerlock-api.html deleted file mode 100644 index 26176d8d1ff..00000000000 --- a/dom/tests/mochitest/pointerlock/test_pointerlock-api.html +++ /dev/null @@ -1,85 +0,0 @@ - - - - - Test for Bug 633602 - - - - - - - Mozilla Bug 633602 - -
-
-
-      
-    
- - diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index 2e4b4119cbf..281c6b4c5b6 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -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); diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index e2667b76392..8b4e8db6f78 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -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 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 retargetEventDoc; if (!aDontRetargetEvents) { diff --git a/layout/mathml/nsMathMLmactionFrame.cpp b/layout/mathml/nsMathMLmactionFrame.cpp index 0b895387869..94e3de74506 100644 --- a/layout/mathml/nsMathMLmactionFrame.cpp +++ b/layout/mathml/nsMathMLmactionFrame.cpp @@ -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); } } } diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index 7aef2f2ba1b..660615e8295 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -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. diff --git a/toolkit/components/alerts/resources/content/alert.js b/toolkit/components/alerts/resources/content/alert.js index 610568c6d12..8e4dcf36906 100644 --- a/toolkit/components/alerts/resources/content/alert.js +++ b/toolkit/components/alerts/resources/content/alert.js @@ -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,11 +93,14 @@ 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 // like "unfolding". The default packing of "start" only works for diff --git a/toolkit/components/viewconfig/content/config.js b/toolkit/components/viewconfig/content/config.js index 04880ba7b30..d6c644fc1ed 100644 --- a/toolkit/components/viewconfig/content/config.js +++ b/toolkit/components/viewconfig/content/config.js @@ -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); diff --git a/toolkit/components/viewsource/content/viewPartialSource.js b/toolkit/components/viewsource/content/viewPartialSource.js index 58c95ed6e2c..b5af2adc922 100644 --- a/toolkit/components/viewsource/content/viewPartialSource.js +++ b/toolkit/components/viewsource/content/viewPartialSource.js @@ -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]); diff --git a/toolkit/components/viewsource/content/viewSource.js b/toolkit/components/viewsource/content/viewSource.js index 82eefc5be9f..537cebc3125 100644 --- a/toolkit/components/viewsource/content/viewSource.js +++ b/toolkit/components/viewsource/content/viewSource.js @@ -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"); - - document.getElementById("menu_highlightSyntax").setAttribute("checked", - Services.prefs.getBoolPref("view_source.syntax_highlight")); + if (wraplonglinesPrefValue) + document.getElementById("menu_wrapLongLines").setAttribute("checked", "true"); + } catch (ex) { + } + try { + document.getElementById("menu_highlightSyntax").setAttribute("checked", + 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); @@ -272,13 +286,16 @@ 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 // use the right strings/links var isMalware = /e=malwareBlocked/.test(errorDoc.documentURI); - + if (target == errorDoc.getElementById('getMeOutButton')) { // Instead of loading some safe page, just close the window window.close(); @@ -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,9 +441,9 @@ function ViewSourceGoToLine() var line = parseInt(input.value, 10); if (!(line > 0)) { - Services.prompt.alert(window, - gViewSourceBundle.getString("invalidInputTitle"), - gViewSourceBundle.getString("invalidInputText")); + promptService.alert(window, + gViewSourceBundle.getString("invalidInputTitle"), + gViewSourceBundle.getString("invalidInputText")); continue; } @@ -433,9 +453,9 @@ function ViewSourceGoToLine() if (found) break; - Services.prompt.alert(window, - gViewSourceBundle.getString("outOfRangeTitle"), - gViewSourceBundle.getString("outOfRangeText")); + 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); } diff --git a/toolkit/content/InlineSpellChecker.jsm b/toolkit/content/InlineSpellChecker.jsm index 48ee9b52871..2fc3f8dc642 100644 --- a/toolkit/content/InlineSpellChecker.jsm +++ b/toolkit/content/InlineSpellChecker.jsm @@ -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() @@ -318,7 +290,7 @@ InlineSpellChecker.prototype = { // Prevent the undo stack from growing over the max depth if (this.mAddedWordStack.length == MAX_UNDO_STACK_DEPTH) this.mAddedWordStack.shift(); - + this.mAddedWordStack.push(this.mMisspelling); this.mInlineSpellChecker.addWordToDictionary(this.mMisspelling); }, diff --git a/toolkit/content/tests/browser/Makefile.in b/toolkit/content/tests/browser/Makefile.in index 2f359b1f68c..b2e977544f1 100644 --- a/toolkit/content/tests/browser/Makefile.in +++ b/toolkit/content/tests/browser/Makefile.in @@ -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 \ diff --git a/toolkit/content/tests/browser/browser_InlineSpellChecker.js b/toolkit/content/tests/browser/browser_InlineSpellChecker.js deleted file mode 100644 index 4d11a5de285..00000000000 --- a/toolkit/content/tests/browser/browser_InlineSpellChecker.js +++ /dev/null @@ -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)'"); - }, -}; diff --git a/widget/cocoa/nsChildView.h b/widget/cocoa/nsChildView.h index 1837eca90f9..64d007fcadb 100644 --- a/widget/cocoa/nsChildView.h +++ b/widget/cocoa/nsChildView.h @@ -488,10 +488,7 @@ public: virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint, PRUint32 aNativeMessage, PRUint32 aModifierFlags); - - virtual nsresult SynthesizeNativeMouseMove(nsIntPoint aPoint) - { return SynthesizeNativeMouseEvent(aPoint, NSMouseMoved, 0); } - + // Mac specific methods virtual bool DispatchWindowEvent(nsGUIEvent& event); diff --git a/widget/gtk2/nsWindow.cpp b/widget/gtk2/nsWindow.cpp index 3e32263455b..9d8617276c7 100644 --- a/widget/gtk2/nsWindow.cpp +++ b/widget/gtk2/nsWindow.cpp @@ -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; -} diff --git a/widget/gtk2/nsWindow.h b/widget/gtk2/nsWindow.h index 3681a5b678d..53bfc73a043 100644 --- a/widget/gtk2/nsWindow.h +++ b/widget/gtk2/nsWindow.h @@ -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, diff --git a/widget/nsGUIEvent.h b/widget/nsGUIEvent.h index 6460378ad66..688c2cbad06 100644 --- a/widget/nsGUIEvent.h +++ b/widget/nsGUIEvent.h @@ -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; diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index e2788127e6b..5b986d6b9e4 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -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. diff --git a/widget/windows/nsWindow.h b/widget/windows/nsWindow.h index 9953772360f..aab98bfc5cc 100644 --- a/widget/windows/nsWindow.h +++ b/widget/windows/nsWindow.h @@ -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, diff --git a/widget/xpwidgets/nsBaseWidget.h b/widget/xpwidgets/nsBaseWidget.h index b7ace6c1e79..9bba28a9b4f 100644 --- a/widget/xpwidgets/nsBaseWidget.h +++ b/widget/xpwidgets/nsBaseWidget.h @@ -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,