Revert to changeset 4c45dbd81a32 to fix mochitest-chrome orange.
authorMs2ger <ms2ger@gmail.com>
Fri, 05 Apr 2013 09:40:13 +0200
changeset 138709 bbad31208ebdd7e4f74012355b1c61c1617bbe3b
parent 138708 8fc33d047ed60ff108695ea3bf613c536e14a7a9
child 138710 72e02f2e3521afdc9372bad99d4031c0557b9f2e
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Revert to changeset 4c45dbd81a32 to fix mochitest-chrome orange.
content/base/src/nsDocument.cpp
dom/ipc/TabParent.cpp
gfx/layers/ipc/AsyncPanZoomController.cpp
gfx/layers/ipc/AsyncPanZoomController.h
layout/ipc/RenderFrameParent.cpp
layout/ipc/RenderFrameParent.h
toolkit/components/search/nsSearchSuggestions.js
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -3733,17 +3733,17 @@ nsDocument::RemoveStyleSheetFromStyleSet
 
 void
 nsDocument::RemoveStyleSheet(nsIStyleSheet* aSheet)
 {
   NS_PRECONDITION(aSheet, "null arg");
   nsCOMPtr<nsIStyleSheet> sheet = aSheet; // hold ref so it won't die too soon
 
   if (!mStyleSheets.RemoveObject(aSheet)) {
-    NS_ASSERTION(mInUnlinkOrDeletion, "stylesheet not found");
+    NS_NOTREACHED("stylesheet not found");
     return;
   }
 
   if (!mIsGoingAway) {
     if (aSheet->IsApplicable()) {
       RemoveStyleSheetFromStyleSets(aSheet);
     }
 
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -641,16 +641,20 @@ TabParent::GetEventCapturer()
   return sEventCapturer;
 }
 
 bool
 TabParent::TryCapture(const nsGUIEvent& aEvent)
 {
   MOZ_ASSERT(sEventCapturer == this && mEventCaptureDepth > 0);
 
+  if (mIsDestroyed) {
+    return false;
+  }
+
   if (aEvent.eventStructType != NS_TOUCH_EVENT) {
     // Only capture of touch events is implemented, for now.
     return false;
   }
 
   nsTouchEvent event(static_cast<const nsTouchEvent&>(aEvent));
 
   bool isTouchPointUp = (event.message == NS_TOUCH_END ||
@@ -661,29 +665,39 @@ TabParent::TryCapture(const nsGUIEvent& 
     if (isTouchPointUp && 0 == --mEventCaptureDepth) {
       // All event series are un-captured, don't try to catch any
       // more.
       sEventCapturer = nullptr;
     }
     return false;
   }
 
-  // Adjust the widget coordinates to be relative to our frame.
-  nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
+  if (RenderFrameParent* rfp = GetRenderFrame()) {
+    // We need to process screen relative events co-ordinates for gestures to
+    // avoid phantom movement when the frame moves.
+    rfp->NotifyInputEvent(event);
+
+    // Adjust the widget coordinates to be relative to our frame.
+    nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
 
-  if (!frameLoader) {
-    // No frame anymore?
-    sEventCapturer = nullptr;
-    return false;
+    if (!frameLoader) {
+      // No frame anymore?
+      sEventCapturer = nullptr;
+      return false;
+    }
+
+    // Remove the frame offset and compensate for zoom.
+    nsEventStateManager::MapEventCoordinatesForChildProcess(frameLoader,
+                                                            &event);
+    rfp->ApplyZoomCompensationToEvent(&event);
   }
 
-  nsEventStateManager::MapEventCoordinatesForChildProcess(frameLoader, &event);
-
-  SendRealTouchEvent(event);
-  return true;
+  return (event.message == NS_TOUCH_MOVE) ?
+    PBrowserParent::SendRealTouchMoveEvent(event) :
+    PBrowserParent::SendRealTouchEvent(event);
 }
 
 bool
 TabParent::RecvSyncMessage(const nsString& aMessage,
                            const ClonedMessageData& aData,
                            InfallibleTArray<nsString>* aJSONRetVal)
 {
   StructuredCloneData cloneData = ipc::UnpackClonedMessageDataForParent(aData);
@@ -1385,17 +1399,18 @@ TabParent::UseAsyncPanZoom()
           GetScrollingBehavior() == ASYNC_PAN_ZOOM);
 }
 
 void
 TabParent::MaybeForwardEventToRenderFrame(const nsInputEvent& aEvent,
                                           nsInputEvent* aOutEvent)
 {
   if (RenderFrameParent* rfp = GetRenderFrame()) {
-    rfp->NotifyInputEvent(aEvent, aOutEvent);
+    rfp->NotifyInputEvent(aEvent);
+    rfp->ApplyZoomCompensationToEvent(aOutEvent);
   }
 }
 
 bool
 TabParent::RecvBrowserFrameOpenWindow(PBrowserParent* aOpener,
                                       const nsString& aURL,
                                       const nsString& aName,
                                       const nsString& aFeatures,
--- a/gfx/layers/ipc/AsyncPanZoomController.cpp
+++ b/gfx/layers/ipc/AsyncPanZoomController.cpp
@@ -220,30 +220,18 @@ WidgetSpaceToCompensatedViewportSpace(co
   // know what content CSS pixel is at widget point 0,0 based on information
   // available here.  So we use this hacky implementation for now, which works
   // in quiescent states.
 
   return pt;
 }
 
 nsEventStatus
-AsyncPanZoomController::ReceiveInputEvent(const nsInputEvent& aEvent,
-                                          nsInputEvent* aOutEvent)
+AsyncPanZoomController::ReceiveMainThreadInputEvent(const nsInputEvent& aEvent)
 {
-  gfxFloat currentResolution;
-  gfx::Point currentScrollOffset, lastScrollOffset;
-  {
-    MonitorAutoLock monitor(mMonitor);
-    currentResolution = CalculateResolution(mFrameMetrics).width;
-    currentScrollOffset = gfx::Point(mFrameMetrics.mScrollOffset.x,
-                                     mFrameMetrics.mScrollOffset.y);
-    lastScrollOffset = gfx::Point(mLastContentPaintMetrics.mScrollOffset.x,
-                                  mLastContentPaintMetrics.mScrollOffset.y);
-  }
-
   nsEventStatus status;
   switch (aEvent.eventStructType) {
   case NS_TOUCH_EVENT: {
     MultiTouchInput event(static_cast<const nsTouchEvent&>(aEvent));
     status = ReceiveInputEvent(event);
     break;
   }
   case NS_MOUSE_EVENT: {
@@ -251,41 +239,51 @@ AsyncPanZoomController::ReceiveInputEven
     status = ReceiveInputEvent(event);
     break;
   }
   default:
     status = nsEventStatus_eIgnore;
     break;
   }
 
-  switch (aEvent.eventStructType) {
+  return status;
+}
+
+void
+AsyncPanZoomController::ApplyZoomCompensationToEvent(nsInputEvent* aEvent)
+{
+  gfxFloat currentResolution;
+  {
+    MonitorAutoLock monitor(mMonitor);
+    currentResolution = CalculateResolution(mFrameMetrics).width;
+  }
+
+  switch (aEvent->eventStructType) {
   case NS_TOUCH_EVENT: {
-    nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aOutEvent);
+    nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
     const nsTArray<nsCOMPtr<nsIDOMTouch> >& touches = touchEvent->touches;
     for (uint32_t i = 0; i < touches.Length(); ++i) {
       nsIDOMTouch* touch = touches[i];
       if (touch) {
         gfx::Point refPoint = WidgetSpaceToCompensatedViewportSpace(
           gfx::Point(touch->mRefPoint.x, touch->mRefPoint.y),
           currentResolution);
         touch->mRefPoint = nsIntPoint(refPoint.x, refPoint.y);
       }
     }
     break;
   }
   default: {
     gfx::Point refPoint = WidgetSpaceToCompensatedViewportSpace(
-      gfx::Point(aOutEvent->refPoint.x, aOutEvent->refPoint.y),
+      gfx::Point(aEvent->refPoint.x, aEvent->refPoint.y),
       currentResolution);
-    aOutEvent->refPoint = nsIntPoint(refPoint.x, refPoint.y);
+    aEvent->refPoint = nsIntPoint(refPoint.x, refPoint.y);
     break;
   }
   }
-
-  return status;
 }
 
 nsEventStatus AsyncPanZoomController::ReceiveInputEvent(const InputData& aEvent) {
   // If we may have touch listeners, we enable the machinery that allows touch
   // listeners to preventDefault any touch inputs. This should not happen unless
   // there are actually touch listeners as it introduces potentially unbounded
   // lag because it causes a round-trip through content.  Usually, if content is
   // responding in a timely fashion, this only introduces a nearly constant few
--- a/gfx/layers/ipc/AsyncPanZoomController.h
+++ b/gfx/layers/ipc/AsyncPanZoomController.h
@@ -87,27 +87,32 @@ public:
    * General handler for incoming input events. Manipulates the frame metrics
    * basde on what type of input it is. For example, a PinchGestureEvent will
    * cause scaling. This should only be called externally to this class.
    * HandleInputEvent() should be used internally.
    */
   nsEventStatus ReceiveInputEvent(const InputData& aEvent);
 
   /**
-   * Special handler for nsInputEvents. Also sets |aOutEvent| (which is assumed
-   * to be an already-existing instance of an nsInputEvent which may be an
-   * nsTouchEvent) to have its touch points in DOM space. This is so that the
-   * touches can be passed through the DOM and content can handle them.
+   * Special handler for nsInputEvents. |aEvent| is in screen relative
+   * co-ordinates.
    *
-   * NOTE: Be careful of invoking the nsInputEvent variant. This can only be
-   * called on the main thread. See widget/InputData.h for more information on
-   * why we have InputData and nsInputEvent separated.
+   * NOTE: This can only be called on the main thread. See widget/InputData.h
+   * for more information on why we have InputData and nsInputEvent separated.
    */
-  nsEventStatus ReceiveInputEvent(const nsInputEvent& aEvent,
-                                  nsInputEvent* aOutEvent);
+  nsEventStatus ReceiveMainThreadInputEvent(const nsInputEvent& aEvent);
+
+  /**
+   * Transform from frame relative co-ordinates to DOM relative co-ordinates.
+   * This method updates |aEvent| (which is assumed to be an already-existing
+   * instance of an nsInputEvent which may be an nsTouchEvent) to have its touch
+   * points in DOM space. This is so that the touches can be passed through the
+   * DOM and content can handle them.
+   */
+  void ApplyZoomCompensationToEvent(nsInputEvent* aEvent);
 
   /**
    * Updates the composition bounds, i.e. the dimensions of the final size of
    * the frame this is tied to during composition onto, in device pixels. In
    * general, this will just be:
    * { x = 0, y = 0, width = surface.width, height = surface.height }, however
    * there is no hard requirement for this.
    */
--- a/layout/ipc/RenderFrameParent.cpp
+++ b/layout/ipc/RenderFrameParent.cpp
@@ -776,21 +776,28 @@ void
 RenderFrameParent::OwnerContentChanged(nsIContent* aContent)
 {
   NS_ABORT_IF_FALSE(mFrameLoader->GetOwnerContent() == aContent,
                     "Don't build new map if owner is same!");
   BuildViewMap();
 }
 
 void
-RenderFrameParent::NotifyInputEvent(const nsInputEvent& aEvent,
-                                    nsInputEvent* aOutEvent)
+RenderFrameParent::NotifyInputEvent(const nsInputEvent& aEvent)
 {
   if (mPanZoomController) {
-    mPanZoomController->ReceiveInputEvent(aEvent, aOutEvent);
+    mPanZoomController->ReceiveMainThreadInputEvent(aEvent);
+  }
+}
+
+void
+RenderFrameParent::ApplyZoomCompensationToEvent(nsInputEvent* aEvent)
+{
+  if (mPanZoomController) {
+    mPanZoomController->ApplyZoomCompensationToEvent(aEvent);
   }
 }
 
 void
 RenderFrameParent::NotifyDimensionsChanged(int width, int height)
 {
   if (mPanZoomController) {
     mPanZoomController->UpdateCompositionBounds(
--- a/layout/ipc/RenderFrameParent.h
+++ b/layout/ipc/RenderFrameParent.h
@@ -87,18 +87,19 @@ public:
                                      const nsIntRect& aVisibleRect,
                                      nsDisplayItem* aItem,
                                      const ContainerParameters& aContainerParameters);
 
   void OwnerContentChanged(nsIContent* aContent);
 
   void SetBackgroundColor(nscolor aColor) { mBackgroundColor = gfxRGBA(aColor); };
 
-  void NotifyInputEvent(const nsInputEvent& aEvent,
-                        nsInputEvent* aOutEvent);
+  void NotifyInputEvent(const nsInputEvent& aEvent);
+
+  void ApplyZoomCompensationToEvent(nsInputEvent* aEvent);
 
   void NotifyDimensionsChanged(int width, int height);
 
   void ZoomToRect(const gfxRect& aRect);
 
   void ContentReceivedTouch(bool aPreventDefault);
 
   void UpdateZoomConstraints(bool aAllowZoom, float aMinZoom, float aMaxZoom);
--- a/toolkit/components/search/nsSearchSuggestions.js
+++ b/toolkit/components/search/nsSearchSuggestions.js
@@ -459,17 +459,16 @@ SuggestAutoComplete.prototype = {
     // Actually do the search
     this._request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].
                     createInstance(Ci.nsIXMLHttpRequest);
     var submission = engine.getSubmission(searchString,
                                           SEARCH_RESPONSE_SUGGESTION_JSON);
     this._suggestURI = submission.uri;
     var method = (submission.postData ? "POST" : "GET");
     this._request.open(method, this._suggestURI.spec, true);
-    this._request.channel.notificationCallbacks = new AuthPromptOverride();
     if (this._request.channel instanceof Ci.nsIPrivateBrowsingChannel) {
       this._request.channel.setPrivate(privacyMode);
     }
 
     var self = this;
     function onReadyStateChange() {
       self.onReadyStateChange();
     }
@@ -519,41 +518,16 @@ SuggestAutoComplete.prototype = {
     Services.obs.removeObserver(this, XPCOM_SHUTDOWN_TOPIC);
   },
 
   // nsISupports
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompleteSearch,
                                          Ci.nsIAutoCompleteObserver])
 };
 
-function AuthPromptOverride() {
-}
-AuthPromptOverride.prototype = {
-  // nsIAuthPromptProvider
-  getAuthPrompt: function (reason, iid) {
-    // Return a no-op nsIAuthPrompt2 implementation.
-    return {
-      promptAuth: function () {
-        throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-      },
-      asyncPromptAuth: function () {
-        throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-      }
-    };
-  },
-
-  // nsIInterfaceRequestor
-  getInterface: function SSLL_getInterface(iid) {
-    return this.QueryInterface(iid);
-  },
-
-  // nsISupports
-  QueryInterface: XPCOMUtils.generateQI([Ci.nsIAuthPromptProvider,
-                                         Ci.nsIInterfaceRequestor])
-};
 /**
  * SearchSuggestAutoComplete is a service implementation that handles suggest
  * results specific to web searches.
  * @constructor
  */
 function SearchSuggestAutoComplete() {
   // This calls _init() in the parent class (SuggestAutoComplete) via the
   // prototype, below.