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
if (!mStyleSheets.RemoveObject(aSheet)) {
NS_ASSERTION(mInUnlinkOrDeletion, "stylesheet not found");
NS_NOTREACHED("stylesheet not found");
return;
}

View File

@ -646,6 +646,10 @@ 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;
@ -666,19 +670,29 @@ TabParent::TryCapture(const nsGUIEvent& aEvent)
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);
if (!frameLoader) {
// No frame anymore?
sEventCapturer = nullptr;
return false;
// Adjust the widget coordinates to be relative to our frame.
nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
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
@ -1390,7 +1404,8 @@ TabParent::MaybeForwardEventToRenderFrame(const nsInputEvent& aEvent,
nsInputEvent* aOutEvent)
{
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
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: {
@ -256,9 +244,21 @@ AsyncPanZoomController::ReceiveInputEvent(const nsInputEvent& aEvent,
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];
@ -273,14 +273,12 @@ AsyncPanZoomController::ReceiveInputEvent(const nsInputEvent& aEvent,
}
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) {

View File

@ -92,17 +92,22 @@ public:
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

View File

@ -781,11 +781,18 @@ RenderFrameParent::OwnerContentChanged(nsIContent* aContent)
}
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);
}
}

View File

@ -92,8 +92,9 @@ public:
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);

View File

@ -464,7 +464,6 @@ SuggestAutoComplete.prototype = {
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);
}
@ -524,31 +523,6 @@ SuggestAutoComplete.prototype = {
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.