Revert to changeset 4c45dbd81a32 to fix mochitest-chrome orange.

This commit is contained in:
Ms2ger 2013-04-05 09:40:13 +02:00
parent 4ba6ac78f7
commit d73b4fb2c0
7 changed files with 71 additions and 71 deletions

View File

@ -3738,7 +3738,7 @@ nsDocument::RemoveStyleSheet(nsIStyleSheet* aSheet)
nsCOMPtr<nsIStyleSheet> sheet = aSheet; // hold ref so it won't die too soon nsCOMPtr<nsIStyleSheet> sheet = aSheet; // hold ref so it won't die too soon
if (!mStyleSheets.RemoveObject(aSheet)) { if (!mStyleSheets.RemoveObject(aSheet)) {
NS_ASSERTION(mInUnlinkOrDeletion, "stylesheet not found"); NS_NOTREACHED("stylesheet not found");
return; return;
} }

View File

@ -646,6 +646,10 @@ TabParent::TryCapture(const nsGUIEvent& aEvent)
{ {
MOZ_ASSERT(sEventCapturer == this && mEventCaptureDepth > 0); MOZ_ASSERT(sEventCapturer == this && mEventCaptureDepth > 0);
if (mIsDestroyed) {
return false;
}
if (aEvent.eventStructType != NS_TOUCH_EVENT) { if (aEvent.eventStructType != NS_TOUCH_EVENT) {
// Only capture of touch events is implemented, for now. // Only capture of touch events is implemented, for now.
return false; return false;
@ -666,19 +670,29 @@ TabParent::TryCapture(const nsGUIEvent& aEvent)
return false; return false;
} }
// Adjust the widget coordinates to be relative to our frame. if (RenderFrameParent* rfp = GetRenderFrame()) {
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader(); // We need to process screen relative events co-ordinates for gestures to
// avoid phantom movement when the frame moves.
rfp->NotifyInputEvent(event);
if (!frameLoader) { // Adjust the widget coordinates to be relative to our frame.
// No frame anymore? nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
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); return (event.message == NS_TOUCH_MOVE) ?
PBrowserParent::SendRealTouchMoveEvent(event) :
SendRealTouchEvent(event); PBrowserParent::SendRealTouchEvent(event);
return true;
} }
bool bool
@ -1390,7 +1404,8 @@ TabParent::MaybeForwardEventToRenderFrame(const nsInputEvent& aEvent,
nsInputEvent* aOutEvent) nsInputEvent* aOutEvent)
{ {
if (RenderFrameParent* rfp = GetRenderFrame()) { if (RenderFrameParent* rfp = GetRenderFrame()) {
rfp->NotifyInputEvent(aEvent, aOutEvent); rfp->NotifyInputEvent(aEvent);
rfp->ApplyZoomCompensationToEvent(aOutEvent);
} }
} }

View File

@ -225,20 +225,8 @@ WidgetSpaceToCompensatedViewportSpace(const gfx::Point& aPoint,
} }
nsEventStatus nsEventStatus
AsyncPanZoomController::ReceiveInputEvent(const nsInputEvent& aEvent, AsyncPanZoomController::ReceiveMainThreadInputEvent(const nsInputEvent& aEvent)
nsInputEvent* aOutEvent)
{ {
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; nsEventStatus status;
switch (aEvent.eventStructType) { switch (aEvent.eventStructType) {
case NS_TOUCH_EVENT: { case NS_TOUCH_EVENT: {
@ -256,9 +244,21 @@ AsyncPanZoomController::ReceiveInputEvent(const nsInputEvent& aEvent,
break; 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: { case NS_TOUCH_EVENT: {
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aOutEvent); nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
const nsTArray<nsCOMPtr<nsIDOMTouch> >& touches = touchEvent->touches; const nsTArray<nsCOMPtr<nsIDOMTouch> >& touches = touchEvent->touches;
for (uint32_t i = 0; i < touches.Length(); ++i) { for (uint32_t i = 0; i < touches.Length(); ++i) {
nsIDOMTouch* touch = touches[i]; nsIDOMTouch* touch = touches[i];
@ -273,14 +273,12 @@ AsyncPanZoomController::ReceiveInputEvent(const nsInputEvent& aEvent,
} }
default: { default: {
gfx::Point refPoint = WidgetSpaceToCompensatedViewportSpace( gfx::Point refPoint = WidgetSpaceToCompensatedViewportSpace(
gfx::Point(aOutEvent->refPoint.x, aOutEvent->refPoint.y), gfx::Point(aEvent->refPoint.x, aEvent->refPoint.y),
currentResolution); currentResolution);
aOutEvent->refPoint = nsIntPoint(refPoint.x, refPoint.y); aEvent->refPoint = nsIntPoint(refPoint.x, refPoint.y);
break; break;
} }
} }
return status;
} }
nsEventStatus AsyncPanZoomController::ReceiveInputEvent(const InputData& aEvent) { nsEventStatus AsyncPanZoomController::ReceiveInputEvent(const InputData& aEvent) {

View File

@ -92,17 +92,22 @@ public:
nsEventStatus ReceiveInputEvent(const InputData& aEvent); nsEventStatus ReceiveInputEvent(const InputData& aEvent);
/** /**
* Special handler for nsInputEvents. Also sets |aOutEvent| (which is assumed * Special handler for nsInputEvents. |aEvent| is in screen relative
* to be an already-existing instance of an nsInputEvent which may be an * co-ordinates.
* 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.
* *
* NOTE: Be careful of invoking the nsInputEvent variant. This can only be * NOTE: This can only be called on the main thread. See widget/InputData.h
* called on the main thread. See widget/InputData.h for more information on * for more information on why we have InputData and nsInputEvent separated.
* why we have InputData and nsInputEvent separated.
*/ */
nsEventStatus ReceiveInputEvent(const nsInputEvent& aEvent, nsEventStatus ReceiveMainThreadInputEvent(const nsInputEvent& aEvent);
nsInputEvent* aOutEvent);
/**
* 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 * Updates the composition bounds, i.e. the dimensions of the final size of

View File

@ -781,11 +781,18 @@ RenderFrameParent::OwnerContentChanged(nsIContent* aContent)
} }
void void
RenderFrameParent::NotifyInputEvent(const nsInputEvent& aEvent, RenderFrameParent::NotifyInputEvent(const nsInputEvent& aEvent)
nsInputEvent* aOutEvent)
{ {
if (mPanZoomController) { if (mPanZoomController) {
mPanZoomController->ReceiveInputEvent(aEvent, aOutEvent); mPanZoomController->ReceiveMainThreadInputEvent(aEvent);
}
}
void
RenderFrameParent::ApplyZoomCompensationToEvent(nsInputEvent* aEvent)
{
if (mPanZoomController) {
mPanZoomController->ApplyZoomCompensationToEvent(aEvent);
} }
} }

View File

@ -92,8 +92,9 @@ public:
void SetBackgroundColor(nscolor aColor) { mBackgroundColor = gfxRGBA(aColor); }; void SetBackgroundColor(nscolor aColor) { mBackgroundColor = gfxRGBA(aColor); };
void NotifyInputEvent(const nsInputEvent& aEvent, void NotifyInputEvent(const nsInputEvent& aEvent);
nsInputEvent* aOutEvent);
void ApplyZoomCompensationToEvent(nsInputEvent* aEvent);
void NotifyDimensionsChanged(int width, int height); void NotifyDimensionsChanged(int width, int height);

View File

@ -464,7 +464,6 @@ SuggestAutoComplete.prototype = {
this._suggestURI = submission.uri; this._suggestURI = submission.uri;
var method = (submission.postData ? "POST" : "GET"); var method = (submission.postData ? "POST" : "GET");
this._request.open(method, this._suggestURI.spec, true); this._request.open(method, this._suggestURI.spec, true);
this._request.channel.notificationCallbacks = new AuthPromptOverride();
if (this._request.channel instanceof Ci.nsIPrivateBrowsingChannel) { if (this._request.channel instanceof Ci.nsIPrivateBrowsingChannel) {
this._request.channel.setPrivate(privacyMode); this._request.channel.setPrivate(privacyMode);
} }
@ -524,31 +523,6 @@ SuggestAutoComplete.prototype = {
Ci.nsIAutoCompleteObserver]) 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 * SearchSuggestAutoComplete is a service implementation that handles suggest
* results specific to web searches. * results specific to web searches.