Merge m-c to inbound. a=merge

This commit is contained in:
Ryan VanderMeulen 2015-08-30 15:44:58 -04:00
commit a4a5b28112
268 changed files with 6208 additions and 3333 deletions

View File

@ -22,6 +22,6 @@ You can download nightly development builds from the Mozilla FTP server.
Keep in mind that nightly builds, which are used by Mozilla developers for
testing, may be buggy. Firefox nightlies, for example, can be found at:
ftp://ftp.mozilla.org/pub/firefox/nightly/latest-trunk/
https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/
- or -
http://nightly.mozilla.org/

View File

@ -110,10 +110,10 @@ nsCoreUtils::DispatchClickEvent(nsITreeBoxObject *aTreeBoxObj,
presContext->AppUnitsToDevPixels(offset.y);
// XUL is just desktop, so there is no real reason for senfing touch events.
DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, cnvdX, cnvdY,
DispatchMouseEvent(eMouseDown, cnvdX, cnvdY,
tcContent, tcFrame, presShell, rootWidget);
DispatchMouseEvent(NS_MOUSE_BUTTON_UP, cnvdX, cnvdY,
DispatchMouseEvent(eMouseUp, cnvdX, cnvdY,
tcContent, tcFrame, presShell, rootWidget);
}

View File

@ -537,7 +537,7 @@ Accessible::ChildAtPoint(int32_t aX, int32_t aY,
nsIntRect rootRect;
rootWidget->GetScreenBounds(rootRect);
WidgetMouseEvent dummyEvent(true, NS_MOUSE_MOVE, rootWidget,
WidgetMouseEvent dummyEvent(true, eMouseMove, rootWidget,
WidgetMouseEvent::eSynthesized);
dummyEvent.refPoint = LayoutDeviceIntPoint(aX - rootRect.x, aY - rootRect.y);
@ -1835,9 +1835,11 @@ Accessible::DispatchClickEvent(nsIContent *aContent, uint32_t aActionIndex)
// Simulate a touch interaction by dispatching touch events with mouse events.
nsCoreUtils::DispatchTouchEvent(NS_TOUCH_START, x, y, aContent, frame, presShell, widget);
nsCoreUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, x, y, aContent, frame, presShell, widget);
nsCoreUtils::DispatchMouseEvent(eMouseDown, x, y, aContent, frame,
presShell, widget);
nsCoreUtils::DispatchTouchEvent(NS_TOUCH_END, x, y, aContent, frame, presShell, widget);
nsCoreUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_UP, x, y, aContent, frame, presShell, widget);
nsCoreUtils::DispatchMouseEvent(eMouseUp, x, y, aContent, frame,
presShell, widget);
}
void

View File

@ -15,4 +15,3 @@ if CONFIG['GAIADIR']:
DIRS += ['gaia']
DIRS += ['app']

View File

@ -25,7 +25,7 @@ let gGestureSupport = {
* True to add/init listeners and false to remove/uninit
*/
init: function GS_init(aAddListener) {
const gestureEvents = ["SwipeGestureStart",
const gestureEvents = ["SwipeGestureMayStart", "SwipeGestureStart",
"SwipeGestureUpdate", "SwipeGestureEnd", "SwipeGesture",
"MagnifyGestureStart", "MagnifyGestureUpdate", "MagnifyGesture",
"RotateGestureStart", "RotateGestureUpdate", "RotateGesture",
@ -58,11 +58,15 @@ let gGestureSupport = {
({ threshold: aThreshold, latched: !!aLatched });
switch (aEvent.type) {
case "MozSwipeGestureStart":
if (this._setupSwipeGesture(aEvent)) {
case "MozSwipeGestureMayStart":
if (this._shouldDoSwipeGesture(aEvent)) {
aEvent.preventDefault();
}
break;
case "MozSwipeGestureStart":
aEvent.preventDefault();
this._setupSwipeGesture();
break;
case "MozSwipeGestureUpdate":
aEvent.preventDefault();
this._doUpdate(aEvent);
@ -173,15 +177,15 @@ let gGestureSupport = {
},
/**
* Sets up swipe gestures. This includes setting up swipe animations for the
* gesture, if enabled.
* Checks whether we want to start a swipe for aEvent and sets
* aEvent.allowedDirections to the right values.
*
* @param aEvent
* The swipe gesture start event.
* @return true if swipe gestures could successfully be set up, false
* othwerwise.
* The swipe gesture "MayStart" event.
* @return true if we're willing to start a swipe for this event, false
* otherwise.
*/
_setupSwipeGesture: function GS__setupSwipeGesture(aEvent) {
_shouldDoSwipeGesture: function GS__shouldDoSwipeGesture(aEvent) {
if (!this._swipeNavigatesHistory(aEvent)) {
return false;
}
@ -217,7 +221,20 @@ let gGestureSupport = {
aEvent.DIRECTION_LEFT;
}
gHistorySwipeAnimation.startAnimation(isVerticalSwipe);
return true;
},
/**
* Sets up swipe gestures. This includes setting up swipe animations for the
* gesture, if enabled.
*
* @param aEvent
* The swipe gesture start event.
* @return true if swipe gestures could successfully be set up, false
* othwerwise.
*/
_setupSwipeGesture: function GS__setupSwipeGesture() {
gHistorySwipeAnimation.startAnimation(false);
this._doUpdate = function GS__doUpdate(aEvent) {
gHistorySwipeAnimation.updateAnimation(aEvent.delta);
@ -229,8 +246,6 @@ let gGestureSupport = {
this._doUpdate = function (aEvent) {};
this._doEnd = function (aEvent) {};
}
return true;
},
/**

View File

@ -4881,7 +4881,9 @@ nsBrowserAccess.prototype = {
if (aOpener && aOpener.document) {
referrerPolicy = aOpener.document.referrerPolicy;
}
let isPrivate = PrivateBrowsingUtils.isWindowPrivate(aOpener || window);
let isPrivate = aOpener
? PrivateBrowsingUtils.isContentWindowPrivate(aOpener)
: PrivateBrowsingUtils.isWindowPrivate(window);
switch (aWhere) {
case Ci.nsIBrowserDOMWindow.OPEN_NEWWINDOW :

View File

@ -9989,11 +9989,12 @@ nsDocShell::InternalLoad(nsIURI* aURI,
/* restore previous position of scroller(s), if we're moving
* back in history (bug 59774)
*/
nscoord bx, by;
bool needsScrollPosUpdate = false;
if (mOSHE && (aLoadType == LOAD_HISTORY ||
aLoadType == LOAD_RELOAD_NORMAL)) {
nscoord bx, by;
needsScrollPosUpdate = true;
mOSHE->GetScrollPosition(&bx, &by);
SetCurScrollPosEx(bx, by);
}
// Dispatch the popstate and hashchange events, as appropriate.
@ -10009,6 +10010,10 @@ nsDocShell::InternalLoad(nsIURI* aURI,
win->DispatchSyncPopState();
}
if (needsScrollPosUpdate && win->HasActiveDocument()) {
SetCurScrollPosEx(bx, by);
}
if (doHashchange) {
// Note that currentURI hasn't changed because it's on the
// stack, so we can just use it directly as the old URI.

View File

@ -99,6 +99,7 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop spec
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
[test_bug797909.html]
[test_bug1045096.html]
[test_bug1186774.html]
[test_framedhistoryframes.html]
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') || toolkit == 'android' #Bug 931116, b2g desktop specific, initial triage, and also bug 784321
support-files = file_framedhistoryframes.html

View File

@ -0,0 +1,51 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1186774
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1186774</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 1186774 **/
var child;
function runTest() {
child = window.open("data:text/html,<div style='height: 9000px;'></div>", "", "width=100,height=100");
child.onload = function() {
setTimeout(function() {
child.scrollTo(0, 0);
child.history.pushState({}, "initial");
child.scrollTo(0, 3000);
child.history.pushState({}, "scrolled");
child.scrollTo(0, 6000);
child.history.back();
});
}
child.onpopstate = function() {
is(child.scrollY, 6000, "Shouldn't have scrolled before popstate");
child.close();
SimpleTest.finish();
}
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(runTest);
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1186774">Mozilla Bug 1186774</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@ -15,6 +15,13 @@
class nsIPrincipal;
namespace mozilla {
namespace ipc {
class PrincipalInfo;
} // namespace ipc
namespace dom {
namespace quota {
@ -137,7 +144,7 @@ CreateClient();
PAsmJSCacheEntryParent*
AllocEntryParent(OpenMode aOpenMode, WriteParams aWriteParams,
nsIPrincipal* aPrincipal);
const mozilla::ipc::PrincipalInfo& aPrincipalInfo);
void
DeallocEntryParent(PAsmJSCacheEntryParent* aActor);

View File

@ -2,7 +2,7 @@
* 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/. */
include protocol PContent;
include protocol PBackground;
using mozilla::dom::asmjscache::Metadata from "mozilla/dom/asmjscache/AsmJSCache.h";
using JS::AsmJSCacheResult from "mozilla/dom/asmjscache/AsmJSCache.h";
@ -13,7 +13,7 @@ namespace asmjscache {
protocol PAsmJSCacheEntry
{
manager PContent;
manager PBackground;
// When the cache is opened to read, the parent process sends over the
// origin's Metadata so the child process can select the cache entry to open

View File

@ -2054,7 +2054,7 @@ Element::DispatchClickEvent(nsPresContext* aPresContext,
NS_PRECONDITION(aSourceEvent, "Must have source event");
NS_PRECONDITION(aStatus, "Null out param?");
WidgetMouseEvent event(aSourceEvent->mFlags.mIsTrusted, NS_MOUSE_CLICK,
WidgetMouseEvent event(aSourceEvent->mFlags.mIsTrusted, eMouseClick,
aSourceEvent->widget, WidgetMouseEvent::eReal);
event.refPoint = aSourceEvent->refPoint;
uint32_t clickCount = 1;
@ -2850,8 +2850,8 @@ Element::CheckHandleEventForLinksPrecondition(EventChainVisitor& aVisitor,
{
if (aVisitor.mEventStatus == nsEventStatus_eConsumeNoDefault ||
(!aVisitor.mEvent->mFlags.mIsTrusted &&
(aVisitor.mEvent->mMessage != NS_MOUSE_CLICK) &&
(aVisitor.mEvent->mMessage != NS_KEY_PRESS) &&
(aVisitor.mEvent->mMessage != eMouseClick) &&
(aVisitor.mEvent->mMessage != eKeyPress) &&
(aVisitor.mEvent->mMessage != NS_UI_ACTIVATE)) ||
!aVisitor.mPresContext ||
aVisitor.mEvent->mFlags.mMultipleActionsPrevented) {
@ -2868,9 +2868,9 @@ Element::PreHandleEventForLinks(EventChainPreVisitor& aVisitor)
// Optimisation: return early if this event doesn't interest us.
// IMPORTANT: this switch and the switch below it must be kept in sync!
switch (aVisitor.mEvent->mMessage) {
case NS_MOUSE_OVER:
case eMouseOver:
case NS_FOCUS_CONTENT:
case NS_MOUSE_OUT:
case eMouseOut:
case NS_BLUR_CONTENT:
break;
default:
@ -2889,7 +2889,7 @@ Element::PreHandleEventForLinks(EventChainPreVisitor& aVisitor)
// updated even if the event is consumed before we have a chance to set it.
switch (aVisitor.mEvent->mMessage) {
// Set the status bar similarly for mouseover and focus
case NS_MOUSE_OVER:
case eMouseOver:
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
// FALL THROUGH
case NS_FOCUS_CONTENT: {
@ -2904,7 +2904,7 @@ Element::PreHandleEventForLinks(EventChainPreVisitor& aVisitor)
}
break;
}
case NS_MOUSE_OUT:
case eMouseOut:
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
// FALL THROUGH
case NS_BLUR_CONTENT:
@ -2929,10 +2929,10 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
// Optimisation: return early if this event doesn't interest us.
// IMPORTANT: this switch and the switch below it must be kept in sync!
switch (aVisitor.mEvent->mMessage) {
case NS_MOUSE_BUTTON_DOWN:
case NS_MOUSE_CLICK:
case eMouseDown:
case eMouseClick:
case NS_UI_ACTIVATE:
case NS_KEY_PRESS:
case eKeyPress:
break;
default:
return NS_OK;
@ -2947,7 +2947,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
nsresult rv = NS_OK;
switch (aVisitor.mEvent->mMessage) {
case NS_MOUSE_BUTTON_DOWN:
case eMouseDown:
{
if (aVisitor.mEvent->AsMouseEvent()->button ==
WidgetMouseEvent::eLeftButton) {
@ -2970,7 +2970,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
}
break;
case NS_MOUSE_CLICK: {
case eMouseClick: {
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
if (mouseEvent->IsLeftClickEvent()) {
if (mouseEvent->IsControl() || mouseEvent->IsMeta() ||
@ -3010,7 +3010,7 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
}
break;
case NS_KEY_PRESS:
case eKeyPress:
{
WidgetKeyboardEvent* keyEvent = aVisitor.mEvent->AsKeyboardEvent();
if (keyEvent && keyEvent->keyCode == NS_VK_RETURN) {

View File

@ -677,8 +677,8 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
// Don't propagate mouseover and mouseout events when mouse is moving
// inside chrome access only content.
bool isAnonForEvents = IsRootOfChromeAccessOnlySubtree();
if ((aVisitor.mEvent->mMessage == NS_MOUSE_OVER ||
aVisitor.mEvent->mMessage == NS_MOUSE_OUT ||
if ((aVisitor.mEvent->mMessage == eMouseOver ||
aVisitor.mEvent->mMessage == eMouseOut ||
aVisitor.mEvent->mMessage == NS_POINTER_OVER ||
aVisitor.mEvent->mMessage == NS_POINTER_OUT) &&
// Check if we should stop event propagation when event has just been
@ -739,7 +739,7 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
printf("Stopping %s propagation:"
"\n\toriginalTarget=%s \n\tcurrentTarget=%s %s"
"\n\trelatedTarget=%s %s \n%s",
(aVisitor.mEvent->mMessage == NS_MOUSE_OVER)
(aVisitor.mEvent->mMessage == eMouseOver)
? "mouseover" : "mouseout",
NS_ConvertUTF16toUTF8(ot).get(),
NS_ConvertUTF16toUTF8(ct).get(),
@ -812,8 +812,8 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
case NS_FORM_CHANGE:
case NS_LOAD:
case NS_FORM_RESET:
case NS_RESIZE_EVENT:
case NS_SCROLL_EVENT:
case eResize:
case eScroll:
stopEvent = true;
break;
case NS_USER_DEFINED_EVENT:

View File

@ -277,6 +277,7 @@ StructuredCloneHelper::Read(nsISupports* aParent,
// If we are tranferring something, we cannot call 'Read()' more than once.
if (mSupportsTransferring) {
mBlobImplArray.Clear();
mClonedImages.Clear();
Shutdown();
}
}
@ -433,7 +434,7 @@ ReadBlob(JSContext* aCx,
{
MOZ_ASSERT(aHelper);
MOZ_ASSERT(aIndex < aHelper->BlobImpls().Length());
nsRefPtr<BlobImpl> blobImpl = aHelper->BlobImpls()[aIndex];
nsRefPtr<BlobImpl> blobImpl = aHelper->BlobImpls()[aIndex];
blobImpl = EnsureBlobForBackgroundManager(blobImpl);
MOZ_ASSERT(blobImpl);
@ -507,6 +508,9 @@ ReadFileList(JSContext* aCx,
nsRefPtr<BlobImpl> blobImpl = aHelper->BlobImpls()[index];
MOZ_ASSERT(blobImpl->IsFile());
blobImpl = EnsureBlobForBackgroundManager(blobImpl);
MOZ_ASSERT(blobImpl);
nsRefPtr<File> file = File::Create(aHelper->ParentDuringRead(), blobImpl);
if (!fileList->Append(file)) {
return nullptr;
@ -544,7 +548,11 @@ WriteFileList(JSStructuredCloneWriter* aWriter,
}
for (uint32_t i = 0; i < aFileList->Length(); ++i) {
aHelper->BlobImpls().AppendElement(aFileList->Item(i)->Impl());
nsRefPtr<BlobImpl> blobImpl =
EnsureBlobForBackgroundManager(aFileList->Item(i)->Impl());
MOZ_ASSERT(blobImpl);
aHelper->BlobImpls().AppendElement(blobImpl);
}
return true;

View File

@ -249,7 +249,7 @@ TextInputProcessor::IsValidEventTypeForComposition(
const WidgetKeyboardEvent& aKeyboardEvent) const
{
// The key event type of composition methods must be "" or "keydown".
if (aKeyboardEvent.mMessage == NS_KEY_DOWN) {
if (aKeyboardEvent.mMessage == eKeyDown) {
return true;
}
if (aKeyboardEvent.mMessage == NS_USER_DEFINED_EVENT &&
@ -310,9 +310,9 @@ TextInputProcessor::MaybeDispatchKeyupForComposition(
return result;
}
// If the mMessage is NS_KEY_DOWN, the caller doesn't want TIP to dispatch
// If the mMessage is eKeyDown, the caller doesn't want TIP to dispatch
// keyup event.
if (aKeyboardEvent->mMessage == NS_KEY_DOWN) {
if (aKeyboardEvent->mMessage == eKeyDown) {
return result;
}
@ -838,7 +838,7 @@ TextInputProcessor::KeydownInternal(const WidgetKeyboardEvent& aKeyboardEvent,
nsEventStatus status = aConsumedFlags ? nsEventStatus_eConsumeNoDefault :
nsEventStatus_eIgnore;
if (!mDispatcher->DispatchKeyboardEvent(NS_KEY_DOWN, keyEvent, status,
if (!mDispatcher->DispatchKeyboardEvent(eKeyDown, keyEvent, status,
GetDispatchTo())) {
// If keydown event isn't dispatched, we don't need to dispatch keypress
// events.
@ -920,8 +920,7 @@ TextInputProcessor::KeyupInternal(const WidgetKeyboardEvent& aKeyboardEvent,
nsEventStatus status = aDoDefault ? nsEventStatus_eIgnore :
nsEventStatus_eConsumeNoDefault;
mDispatcher->DispatchKeyboardEvent(NS_KEY_UP, keyEvent, status,
GetDispatchTo());
mDispatcher->DispatchKeyboardEvent(eKeyUp, keyEvent, status, GetDispatchTo());
aDoDefault = (status != nsEventStatus_eConsumeNoDefault);
return NS_OK;
}

View File

@ -7724,18 +7724,18 @@ nsContentUtils::SendKeyEvent(nsIWidget* aWidget,
EventMessage msg;
if (aType.EqualsLiteral("keydown"))
msg = NS_KEY_DOWN;
msg = eKeyDown;
else if (aType.EqualsLiteral("keyup"))
msg = NS_KEY_UP;
msg = eKeyUp;
else if (aType.EqualsLiteral("keypress"))
msg = NS_KEY_PRESS;
msg = eKeyPress;
else
return NS_ERROR_FAILURE;
WidgetKeyboardEvent event(true, msg, aWidget);
event.modifiers = GetWidgetModifiers(aModifiers);
if (msg == NS_KEY_PRESS) {
if (msg == eKeyPress) {
event.keyCode = aCharCode ? 0 : aKeyCode;
event.charCode = aCharCode;
} else {
@ -7838,20 +7838,20 @@ nsContentUtils::SendMouseEvent(nsCOMPtr<nsIPresShell> aPresShell,
EventMessage msg;
bool contextMenuKey = false;
if (aType.EqualsLiteral("mousedown"))
msg = NS_MOUSE_BUTTON_DOWN;
msg = eMouseDown;
else if (aType.EqualsLiteral("mouseup"))
msg = NS_MOUSE_BUTTON_UP;
msg = eMouseUp;
else if (aType.EqualsLiteral("mousemove"))
msg = NS_MOUSE_MOVE;
msg = eMouseMove;
else if (aType.EqualsLiteral("mouseover"))
msg = NS_MOUSE_ENTER_WIDGET;
msg = eMouseEnterIntoWidget;
else if (aType.EqualsLiteral("mouseout"))
msg = NS_MOUSE_EXIT_WIDGET;
msg = eMouseExitFromWidget;
else if (aType.EqualsLiteral("contextmenu")) {
msg = NS_CONTEXTMENU;
contextMenuKey = (aButton == 0);
} else if (aType.EqualsLiteral("MozMouseHittest"))
msg = NS_MOUSE_MOZHITTEST;
msg = eMouseHitTest;
else
return NS_ERROR_FAILURE;

View File

@ -1315,7 +1315,9 @@ nsDOMWindowUtils::SendSimpleGestureEvent(const nsAString& aType,
return NS_ERROR_FAILURE;
EventMessage msg;
if (aType.EqualsLiteral("MozSwipeGestureStart"))
if (aType.EqualsLiteral("MozSwipeGestureMayStart"))
msg = NS_SIMPLE_GESTURE_SWIPE_MAY_START;
else if (aType.EqualsLiteral("MozSwipeGestureStart"))
msg = NS_SIMPLE_GESTURE_SWIPE_START;
else if (aType.EqualsLiteral("MozSwipeGestureUpdate"))
msg = NS_SIMPLE_GESTURE_SWIPE_UPDATE;
@ -3577,7 +3579,7 @@ nsDOMWindowUtils::IsNodeDisabledForEvents(nsIDOMNode* aNode, bool* aRetVal)
while (node) {
if (node->IsNodeOfType(nsINode::eHTML_FORM_CONTROL)) {
nsCOMPtr<nsIFormControl> fc = do_QueryInterface(node);
if (fc && fc->IsDisabledForEvents(NS_EVENT_NULL)) {
if (fc && fc->IsDisabledForEvents(eVoidEvent)) {
*aRetVal = true;
break;
}

View File

@ -11386,20 +11386,21 @@ LogFullScreenDenied(bool aLogFailure, const char* aMessage, nsIDocument* aDoc)
void
nsDocument::CleanupFullscreenState()
{
if (!mFullScreenStack.IsEmpty()) {
// The top element in the full-screen stack will have full-screen
// style bits set on it and its ancestors. Remove the style bits.
// Note the non-top elements won't have the style bits set.
Element* top = FullScreenStackTop();
NS_ASSERTION(top, "Should have a top when full-screen stack isn't empty");
if (top) {
// Iterate the fullscreen stack and clear the fullscreen states.
// Since we also need to clear the fullscreen-ancestor state, and
// currently fullscreen elements can only be placed in hierarchy
// order in the stack, reversely iterating the stack could be more
// efficient. NOTE that fullscreen-ancestor state would be removed
// in bug 1199529, and the elements may not in hierarchy order
// after bug 1195213.
for (nsWeakPtr& weakPtr : Reversed(mFullScreenStack)) {
if (nsCOMPtr<Element> element = do_QueryReferent(weakPtr)) {
// Remove any VR state properties
top->DeleteProperty(nsGkAtoms::vr_state);
EventStateManager::SetFullScreenState(top, false);
element->DeleteProperty(nsGkAtoms::vr_state);
EventStateManager::SetFullScreenState(element, false);
}
mFullScreenStack.Clear();
}
mFullScreenStack.Clear();
mFullscreenRoot = nullptr;
}
@ -11411,12 +11412,6 @@ nsDocument::FullScreenStackPush(Element* aElement)
if (top == aElement || !aElement) {
return false;
}
if (top) {
// We're pushing a new element onto the full-screen stack, so we must
// remove the ancestor and full-screen styles from the former top of the
// stack.
EventStateManager::SetFullScreenState(top, false);
}
EventStateManager::SetFullScreenState(aElement, true);
mFullScreenStack.AppendElement(do_GetWeakReference(aElement));
NS_ASSERTION(GetFullScreenElement() == aElement, "Should match");
@ -11455,9 +11450,7 @@ nsDocument::FullScreenStackPop()
uint32_t last = mFullScreenStack.Length() - 1;
mFullScreenStack.RemoveElementAt(last);
} else {
// The top element of the stack is now an in-doc element. Apply the
// full-screen styles and return.
EventStateManager::SetFullScreenState(element, true);
// The top element of the stack is now an in-doc element. Return here.
break;
}
}

View File

@ -1863,6 +1863,7 @@ GK_ATOM(seconds, "seconds")
GK_ATOM(secondsFromDateTime, "seconds-from-dateTime")
// Simple gestures support
GK_ATOM(onMozSwipeGestureMayStart, "onMozSwipeGestureMayStart")
GK_ATOM(onMozSwipeGestureStart, "onMozSwipeGestureStart")
GK_ATOM(onMozSwipeGestureUpdate, "onMozSwipeGestureUpdate")
GK_ATOM(onMozSwipeGestureEnd, "onMozSwipeGestureEnd")

View File

@ -3061,7 +3061,7 @@ nsGlobalWindow::PreHandleEvent(EventChainPreVisitor& aVisitor)
aVisitor.mCanHandle = true;
aVisitor.mForceContentDispatch = true; //FIXME! Bug 329119
if ((msg == NS_MOUSE_MOVE) && gEntropyCollector) {
if (msg == eMouseMove && gEntropyCollector) {
//Chances are this counter will overflow during the life of the
//process, but that's OK for our case. Means we get a little
//more entropy.
@ -3076,7 +3076,7 @@ nsGlobalWindow::PreHandleEvent(EventChainPreVisitor& aVisitor)
gEntropyCollector->RandomUpdate((void*)&(aVisitor.mEvent->time),
sizeof(uint32_t));
}
} else if (msg == NS_RESIZE_EVENT && aVisitor.mEvent->mFlags.mIsTrusted) {
} else if (msg == eResize && aVisitor.mEvent->mFlags.mIsTrusted) {
// QIing to window so that we can keep the old behavior also in case
// a child window is handling resize.
nsCOMPtr<nsPIDOMWindow> window =
@ -3084,11 +3084,9 @@ nsGlobalWindow::PreHandleEvent(EventChainPreVisitor& aVisitor)
if (window) {
mIsHandlingResizeEvent = true;
}
} else if (msg == NS_MOUSE_BUTTON_DOWN &&
aVisitor.mEvent->mFlags.mIsTrusted) {
} else if (msg == eMouseDown && aVisitor.mEvent->mFlags.mIsTrusted) {
gMouseDown = true;
} else if ((msg == NS_MOUSE_BUTTON_UP ||
msg == NS_DRAGDROP_END) &&
} else if ((msg == eMouseUp || msg == NS_DRAGDROP_END) &&
aVisitor.mEvent->mFlags.mIsTrusted) {
gMouseDown = false;
if (gDragServiceDisabled) {
@ -3266,7 +3264,7 @@ nsGlobalWindow::PostHandleEvent(EventChainPostVisitor& aVisitor)
// Return early if there is nothing to do.
switch (aVisitor.mEvent->mMessage) {
case NS_RESIZE_EVENT:
case eResize:
case NS_PAGE_UNLOAD:
case NS_LOAD:
break;
@ -3280,7 +3278,7 @@ nsGlobalWindow::PostHandleEvent(EventChainPostVisitor& aVisitor)
nsCOMPtr<nsIDOMEventTarget> kungFuDeathGrip1(mChromeEventHandler);
nsCOMPtr<nsIScriptContext> kungFuDeathGrip2(GetContextInternal());
if (aVisitor.mEvent->mMessage == NS_RESIZE_EVENT) {
if (aVisitor.mEvent->mMessage == eResize) {
mIsHandlingResizeEvent = false;
} else if (aVisitor.mEvent->mMessage == NS_PAGE_UNLOAD &&
aVisitor.mEvent->mFlags.mIsTrusted) {
@ -6227,7 +6225,7 @@ nsGlobalWindow::GetMainWidget()
}
nsIWidget*
nsGlobalWindow::GetNearestWidget()
nsGlobalWindow::GetNearestWidget() const
{
nsIDocShell* docShell = GetDocShell();
NS_ENSURE_TRUE(docShell, nullptr);
@ -6668,8 +6666,16 @@ nsGlobalWindow::FullScreen() const
nsCOMPtr<nsIDocShellTreeItem> rootItem;
mDocShell->GetRootTreeItem(getter_AddRefs(rootItem));
if (rootItem == mDocShell) {
// We are the root window. Return our internal value.
return mFullScreen;
if (!XRE_IsContentProcess()) {
// We are the root window. Return our internal value.
return mFullScreen;
}
if (nsCOMPtr<nsIWidget> widget = GetNearestWidget()) {
// We are in content process, figure out the value from
// the sizemode of the puppet widget.
return widget->SizeMode() == nsSizeMode_Fullscreen;
}
return false;
}
nsCOMPtr<nsIDOMWindow> window = rootItem->GetWindow();

View File

@ -1509,7 +1509,7 @@ public:
bool WindowExists(const nsAString& aName, bool aLookForCallerOnJSStack);
already_AddRefed<nsIWidget> GetMainWidget();
nsIWidget* GetNearestWidget();
nsIWidget* GetNearestWidget() const;
void Freeze()
{

View File

@ -368,7 +368,7 @@ public:
/**
* Get the docshell in this window.
*/
nsIDocShell *GetDocShell()
nsIDocShell *GetDocShell() const
{
if (mOuterWindow) {
return mOuterWindow->mDocShell;

View File

@ -88,14 +88,6 @@ BroadcastChannelParent::CheckAndDeliver(const ClonedMessageData& aData,
if (aOrigin == mOrigin &&
aChannel == mChannel &&
aPrivateBrowsing == mPrivateBrowsing) {
// We need to duplicate data only if we have blobs or if the manager of
// them is different than the manager of this parent actor.
if (aData.blobsParent().IsEmpty() ||
static_cast<BlobParent*>(aData.blobsParent()[0])->GetBackgroundManager() == Manager()) {
unused << SendNotify(aData);
return;
}
// Duplicate the data for this parent.
ClonedMessageData newData(aData);

View File

@ -15,7 +15,7 @@ AnimationEvent::AnimationEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalAnimationEvent* aEvent)
: Event(aOwner, aPresContext,
aEvent ? aEvent : new InternalAnimationEvent(false, NS_EVENT_NULL))
aEvent ? aEvent : new InternalAnimationEvent(false, eVoidEvent))
{
if (aEvent) {
mEventIsInternal = false;

View File

@ -18,7 +18,7 @@ BeforeAfterKeyboardEvent::BeforeAfterKeyboardEvent(
: KeyboardEvent(aOwner, aPresContext,
aEvent ? aEvent :
new InternalBeforeAfterKeyboardEvent(false,
NS_EVENT_NULL,
eVoidEvent,
nullptr))
{
MOZ_ASSERT(mEvent->mClass == eBeforeAfterKeyboardEventClass,

View File

@ -16,7 +16,7 @@ ClipboardEvent::ClipboardEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalClipboardEvent* aEvent)
: Event(aOwner, aPresContext,
aEvent ? aEvent : new InternalClipboardEvent(false, NS_EVENT_NULL))
aEvent ? aEvent : new InternalClipboardEvent(false, eVoidEvent))
{
if (aEvent) {
mEventIsInternal = false;

View File

@ -16,7 +16,7 @@ CompositionEvent::CompositionEvent(EventTarget* aOwner,
WidgetCompositionEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetCompositionEvent(false, NS_EVENT_NULL, nullptr))
new WidgetCompositionEvent(false, eVoidEvent, nullptr))
{
NS_ASSERTION(mEvent->mClass == eCompositionEventClass,
"event type mismatch");

View File

@ -17,7 +17,7 @@ DragEvent::DragEvent(EventTarget* aOwner,
WidgetDragEvent* aEvent)
: MouseEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetDragEvent(false, NS_EVENT_NULL, nullptr))
new WidgetDragEvent(false, eVoidEvent, nullptr))
{
if (aEvent) {
mEventIsInternal = false;

View File

@ -106,7 +106,7 @@ Event::ConstructorInit(EventTarget* aOwner,
...
}
*/
mEvent = new WidgetEvent(false, NS_EVENT_NULL);
mEvent = new WidgetEvent(false, eVoidEvent);
mEvent->time = PR_Now();
}
@ -770,23 +770,23 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
if (aEvent->mFlags.mIsTrusted) {
uint32_t key = aEvent->AsKeyboardEvent()->keyCode;
switch(aEvent->mMessage) {
case NS_KEY_PRESS :
// return key on focused button. see note at NS_MOUSE_CLICK.
case eKeyPress:
// return key on focused button. see note at eMouseClick.
if (key == nsIDOMKeyEvent::DOM_VK_RETURN) {
abuse = openAllowed;
} else if (PopupAllowedForEvent("keypress")) {
abuse = openControlled;
}
break;
case NS_KEY_UP :
// space key on focused button. see note at NS_MOUSE_CLICK.
case eKeyUp:
// space key on focused button. see note at eMouseClick.
if (key == nsIDOMKeyEvent::DOM_VK_SPACE) {
abuse = openAllowed;
} else if (PopupAllowedForEvent("keyup")) {
abuse = openControlled;
}
break;
case NS_KEY_DOWN :
case eKeyDown:
if (PopupAllowedForEvent("keydown")) {
abuse = openControlled;
}
@ -818,17 +818,17 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
if (aEvent->mFlags.mIsTrusted &&
aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton) {
switch(aEvent->mMessage) {
case NS_MOUSE_BUTTON_UP :
case eMouseUp:
if (PopupAllowedForEvent("mouseup")) {
abuse = openControlled;
}
break;
case NS_MOUSE_BUTTON_DOWN :
case eMouseDown:
if (PopupAllowedForEvent("mousedown")) {
abuse = openControlled;
}
break;
case NS_MOUSE_CLICK :
case eMouseClick:
/* Click events get special treatment because of their
historical status as a more legitimate event handler. If
click popups are enabled in the prefs, clear the popup
@ -837,7 +837,7 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
abuse = openAllowed;
}
break;
case NS_MOUSE_DOUBLECLICK :
case eMouseDoubleClick:
if (PopupAllowedForEvent("dblclick")) {
abuse = openControlled;
}

View File

@ -493,7 +493,7 @@ EventDispatcher::Dispatch(nsISupports* aTarget,
}
#ifdef DEBUG
if (aEvent->mMessage != NS_EVENT_NULL &&
if (aEvent->mMessage != eVoidEvent &&
!nsContentUtils::IsSafeToRunScript()) {
nsresult rv = NS_ERROR_FAILURE;
if (target->GetContextForEventHandlers(&rv) ||

View File

@ -247,7 +247,7 @@ public:
*
* If aTargets is non-null, event target chain will be created, but
* event won't be handled. In this case aEvent->mMessage should be
* NS_EVENT_NULL.
* eVoidEvent.
* @note Use this method when dispatching a WidgetEvent.
*/
static nsresult Dispatch(nsISupports* aTarget,

View File

@ -95,7 +95,7 @@ MutationBitForEventType(EventMessage aEventType)
uint32_t EventListenerManager::sMainThreadCreatedCount = 0;
EventListenerManagerBase::EventListenerManagerBase()
: mNoListenerForEvent(NS_EVENT_NULL)
: mNoListenerForEvent(eVoidEvent)
, mMayHavePaintEventListener(false)
, mMayHaveMutationListeners(false)
, mMayHaveCapturingListeners(false)
@ -257,7 +257,7 @@ EventListenerManager::AddEventListenerInternal(
}
}
mNoListenerForEvent = NS_EVENT_NULL;
mNoListenerForEvent = eVoidEvent;
mNoListenerForEventAtom = nullptr;
listener = aAllEvents ? mListeners.InsertElementAt(0) :
@ -524,7 +524,7 @@ EventListenerManager::RemoveEventListenerInternal(
nsRefPtr<EventListenerManager> kungFuDeathGrip(this);
mListeners.RemoveElementAt(i);
--count;
mNoListenerForEvent = NS_EVENT_NULL;
mNoListenerForEvent = eVoidEvent;
mNoListenerForEventAtom = nullptr;
if (mTarget && aUserType) {
mTarget->EventListenerRemoved(aUserType);
@ -791,7 +791,7 @@ EventListenerManager::RemoveEventHandler(nsIAtom* aName,
if (listener) {
mListeners.RemoveElementAt(uint32_t(listener - &mListeners.ElementAt(0)));
mNoListenerForEvent = NS_EVENT_NULL;
mNoListenerForEvent = eVoidEvent;
mNoListenerForEventAtom = nullptr;
if (mTarget && aName) {
mTarget->EventListenerRemoved(aName);
@ -1224,7 +1224,7 @@ EventListenerManager::AddListenerForAllEvents(nsIDOMEventListener* aDOMListener,
flags.mAllowUntrustedEvents = aWantsUntrusted;
flags.mInSystemGroup = aSystemEventGroup;
EventListenerHolder listenerHolder(aDOMListener);
AddEventListenerInternal(listenerHolder, NS_EVENT_ALL, nullptr, EmptyString(),
AddEventListenerInternal(listenerHolder, eAllEvents, nullptr, EmptyString(),
flags, false, true);
}
@ -1238,7 +1238,7 @@ EventListenerManager::RemoveListenerForAllEvents(
flags.mCapture = aUseCapture;
flags.mInSystemGroup = aSystemEventGroup;
EventListenerHolder listenerHolder(aDOMListener);
RemoveEventListenerInternal(listenerHolder, NS_EVENT_ALL, nullptr,
RemoveEventListenerInternal(listenerHolder, eAllEvents, nullptr,
EmptyString(), flags, true);
}

View File

@ -226,7 +226,7 @@ EventListenerService::GetEventTargetChainFor(nsIDOMEventTarget* aEventTarget,
*aCount = 0;
*aOutArray = nullptr;
NS_ENSURE_ARG(aEventTarget);
WidgetEvent event(true, NS_EVENT_NULL);
WidgetEvent event(true, eVoidEvent);
nsTArray<EventTarget*> targets;
nsresult rv = EventDispatcher::Dispatch(aEventTarget, nullptr, &event,
nullptr, nullptr, nullptr, &targets);

View File

@ -165,7 +165,7 @@ EVENT(change,
EventNameType_HTMLXUL,
eBasicEventClass)
EVENT(click,
NS_MOUSE_CLICK,
eMouseClick,
EventNameType_All,
eMouseEventClass)
EVENT(contextmenu,
@ -175,7 +175,7 @@ EVENT(contextmenu,
// Not supported yet
// EVENT(cuechange)
EVENT(dblclick,
NS_MOUSE_DOUBLECLICK,
eMouseDoubleClick,
EventNameType_HTMLXUL,
eMouseEventClass)
EVENT(drag,
@ -227,31 +227,31 @@ EVENT(invalid,
EventNameType_HTMLXUL,
eBasicEventClass)
EVENT(keydown,
NS_KEY_DOWN,
eKeyDown,
EventNameType_HTMLXUL,
eKeyboardEventClass)
EVENT(keypress,
NS_KEY_PRESS,
eKeyPress,
EventNameType_HTMLXUL,
eKeyboardEventClass)
EVENT(keyup,
NS_KEY_UP,
eKeyUp,
EventNameType_HTMLXUL,
eKeyboardEventClass)
NON_IDL_EVENT(mozbrowserbeforekeydown,
NS_KEY_BEFORE_DOWN,
eBeforeKeyDown,
EventNameType_None,
eBeforeAfterKeyboardEventClass)
NON_IDL_EVENT(mozbrowserafterkeydown,
NS_KEY_AFTER_DOWN,
eAfterKeyDown,
EventNameType_None,
eBeforeAfterKeyboardEventClass)
NON_IDL_EVENT(mozbrowserbeforekeyup,
NS_KEY_BEFORE_UP,
eBeforeKeyUp,
EventNameType_None,
eBeforeAfterKeyboardEventClass)
NON_IDL_EVENT(mozbrowserafterkeyup,
NS_KEY_AFTER_UP,
eAfterKeyUp,
EventNameType_None,
eBeforeAfterKeyboardEventClass)
EVENT(loadeddata,
@ -267,31 +267,31 @@ EVENT(loadstart,
EventNameType_HTML,
eBasicEventClass)
EVENT(mousedown,
NS_MOUSE_BUTTON_DOWN,
eMouseDown,
EventNameType_All,
eMouseEventClass)
EVENT(mouseenter,
NS_MOUSEENTER,
eMouseEnter,
EventNameType_All,
eMouseEventClass)
EVENT(mouseleave,
NS_MOUSELEAVE,
eMouseLeave,
EventNameType_All,
eMouseEventClass)
EVENT(mousemove,
NS_MOUSE_MOVE,
eMouseMove,
EventNameType_All,
eMouseEventClass)
EVENT(mouseout,
NS_MOUSE_OUT,
eMouseOut,
EventNameType_All,
eMouseEventClass)
EVENT(mouseover,
NS_MOUSE_OVER,
eMouseOver,
EventNameType_All,
eMouseEventClass)
EVENT(mouseup,
NS_MOUSE_BUTTON_UP,
eMouseUp,
EventNameType_All,
eMouseEventClass)
EVENT(mozfullscreenchange,
@ -460,11 +460,11 @@ FORWARDED_EVENT(load,
EventNameType_All,
eBasicEventClass)
FORWARDED_EVENT(resize,
NS_RESIZE_EVENT,
eResize,
EventNameType_All,
eBasicEventClass)
FORWARDED_EVENT(scroll,
NS_SCROLL_EVENT,
eScroll,
(EventNameType_HTMLXUL | EventNameType_SVGSVG),
eBasicEventClass)
@ -485,7 +485,7 @@ WINDOW_EVENT(hashchange,
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
eBasicEventClass)
WINDOW_EVENT(languagechange,
NS_LANGUAGECHANGE,
eLanguageChange,
EventNameType_HTMLBodyOrFramesetOnly,
eBasicEventClass)
// XXXbz Should the onmessage attribute on <body> really not work? If so, do we
@ -496,11 +496,11 @@ WINDOW_EVENT(message,
EventNameType_None,
eBasicEventClass)
WINDOW_EVENT(offline,
NS_OFFLINE,
eOffline,
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
eBasicEventClass)
WINDOW_EVENT(online,
NS_ONLINE,
eOnline,
EventNameType_XUL | EventNameType_HTMLBodyOrFramesetOnly,
eBasicEventClass)
WINDOW_EVENT(pagehide,
@ -586,7 +586,7 @@ DOCUMENT_ONLY_EVENT(readystatechange,
eBasicEventClass)
NON_IDL_EVENT(MozMouseHittest,
NS_MOUSE_MOZHITTEST,
eMouseHitTest,
EventNameType_None,
eMouseEventClass)
@ -692,7 +692,7 @@ NON_IDL_EVENT(command,
EventNameType_XUL,
eInputEventClass)
NON_IDL_EVENT(close,
NS_XUL_CLOSE,
eWindowClose,
EventNameType_XUL,
eBasicEventClass)
NON_IDL_EVENT(popupshowing,
@ -839,6 +839,10 @@ NON_IDL_EVENT(gamepaddisconnected,
#endif
// Simple gesture events
NON_IDL_EVENT(MozSwipeGestureMayStart,
NS_SIMPLE_GESTURE_SWIPE_MAY_START,
EventNameType_None,
eSimpleGestureEventClass)
NON_IDL_EVENT(MozSwipeGestureStart,
NS_SIMPLE_GESTURE_SWIPE_START,
EventNameType_None,

View File

@ -494,13 +494,13 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
mCurrentTarget = aTargetFrame;
mCurrentTargetContent = nullptr;
// Do not take account NS_MOUSE_ENTER_WIDGET/EXIT_WIDGET so that loading a page
// when user is not active doesn't change the state to active.
// Do not take account eMouseEnterIntoWidget/ExitFromWidget so that loading
// a page when user is not active doesn't change the state to active.
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
if (aEvent->mFlags.mIsTrusted &&
((mouseEvent && mouseEvent->IsReal() &&
mouseEvent->mMessage != NS_MOUSE_ENTER_WIDGET &&
mouseEvent->mMessage != NS_MOUSE_EXIT_WIDGET) ||
mouseEvent->mMessage != eMouseEnterIntoWidget &&
mouseEvent->mMessage != eMouseExitFromWidget) ||
aEvent->mClass == eWheelEventClass ||
aEvent->mClass == eKeyboardEventClass)) {
if (gMouseOrKeyboardEventCounter == 0) {
@ -548,7 +548,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
return NS_ERROR_DOM_INVALID_STATE_ERR;
}
break;
case NS_MOUSE_BUTTON_DOWN: {
case eMouseDown: {
switch (mouseEvent->button) {
case WidgetMouseEvent::eLeftButton:
BeginTrackingDragGesture(aPresContext, mouseEvent, aTargetFrame);
@ -567,7 +567,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
}
break;
}
case NS_MOUSE_BUTTON_UP: {
case eMouseUp: {
switch (mouseEvent->button) {
case WidgetMouseEvent::eLeftButton:
if (Prefs::ClickHoldContextMenu()) {
@ -583,8 +583,8 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
}
break;
}
case NS_MOUSE_ENTER_WIDGET:
// In some cases on e10s NS_MOUSE_ENTER_WIDGET
case eMouseEnterIntoWidget:
// In some cases on e10s eMouseEnterIntoWidget
// event was sent twice into child process of content.
// (From specific widget code (sending is not permanent) and
// from ESM::DispatchMouseOrPointerEvent (sending is permanent)).
@ -592,20 +592,21 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
// suppress sending accidental event from widget code.
aEvent->mFlags.mNoCrossProcessBoundaryForwarding = true;
break;
case NS_MOUSE_EXIT_WIDGET:
// If this is a remote frame, we receive NS_MOUSE_EXIT_WIDGET from the parent
// the mouse exits our content. Since the parent may update the cursor
// while the mouse is outside our frame, and since PuppetWidget caches the
// current cursor internally, re-entering our content (say from over a
// window edge) wont update the cursor if the cached value and the current
// cursor match. So when the mouse exits a remote frame, clear the cached
// widget cursor so a proper update will occur when the mouse re-enters.
case eMouseExitFromWidget:
// If this is a remote frame, we receive eMouseExitFromWidget from the
// parent the mouse exits our content. Since the parent may update the
// cursor while the mouse is outside our frame, and since PuppetWidget
// caches the current cursor internally, re-entering our content (say from
// over a window edge) wont update the cursor if the cached value and the
// current cursor match. So when the mouse exits a remote frame, clear the
// cached widget cursor so a proper update will occur when the mouse
// re-enters.
if (XRE_IsContentProcess()) {
ClearCachedWidgetCursor(mCurrentTarget);
}
// Flag helps to suppress double event sending into process of content.
// For more information see comment above, at NS_MOUSE_ENTER_WIDGET case.
// For more information see comment above, at eMouseEnterIntoWidget case.
aEvent->mFlags.mNoCrossProcessBoundaryForwarding = true;
// If the event is not a top-level window exit, then it's not
@ -615,7 +616,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
// Treat it as a synthetic move so we don't generate spurious
// "exit" or "move" events. Any necessary "out" or "over" events
// will be generated by GenerateMouseEnterExit
mouseEvent->mMessage = NS_MOUSE_MOVE;
mouseEvent->mMessage = eMouseMove;
mouseEvent->reason = WidgetMouseEvent::eSynthesized;
// then fall through...
} else {
@ -625,10 +626,10 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
}
GenerateMouseEnterExit(mouseEvent);
//This is a window level mouse exit event and should stop here
aEvent->mMessage = NS_EVENT_NULL;
aEvent->mMessage = eVoidEvent;
break;
}
case NS_MOUSE_MOVE:
case eMouseMove:
case NS_POINTER_DOWN:
case NS_POINTER_MOVE: {
// on the Mac, GenerateDragGesture() may not return until the drag
@ -658,7 +659,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
GenerateDragDropEnterExit(aPresContext, aEvent->AsDragEvent());
break;
case NS_KEY_PRESS:
case eKeyPress:
{
WidgetKeyboardEvent* keyEvent = aEvent->AsKeyboardEvent();
@ -683,12 +684,12 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
}
}
// then fall through...
case NS_KEY_BEFORE_DOWN:
case NS_KEY_DOWN:
case NS_KEY_AFTER_DOWN:
case NS_KEY_BEFORE_UP:
case NS_KEY_UP:
case NS_KEY_AFTER_UP:
case eBeforeKeyDown:
case eKeyDown:
case eAfterKeyDown:
case eBeforeKeyUp:
case eKeyUp:
case eAfterKeyUp:
{
nsIContent* content = GetFocusedContent();
if (content)
@ -1170,12 +1171,12 @@ CrossProcessSafeEvent(const WidgetEvent& aEvent)
return true;
case eMouseEventClass:
switch (aEvent.mMessage) {
case NS_MOUSE_BUTTON_DOWN:
case NS_MOUSE_BUTTON_UP:
case NS_MOUSE_MOVE:
case eMouseDown:
case eMouseUp:
case eMouseMove:
case NS_CONTEXTMENU:
case NS_MOUSE_ENTER_WIDGET:
case NS_MOUSE_EXIT_WIDGET:
case eMouseEnterIntoWidget:
case eMouseExitFromWidget:
return true;
default:
return false;
@ -2795,8 +2796,8 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
// Most of the events we handle below require a frame.
// Add special cases here.
if (!mCurrentTarget && aEvent->mMessage != NS_MOUSE_BUTTON_UP &&
aEvent->mMessage != NS_MOUSE_BUTTON_DOWN) {
if (!mCurrentTarget && aEvent->mMessage != eMouseUp &&
aEvent->mMessage != eMouseDown) {
return NS_OK;
}
@ -2805,7 +2806,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
nsresult ret = NS_OK;
switch (aEvent->mMessage) {
case NS_MOUSE_BUTTON_DOWN:
case eMouseDown:
{
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
if (mouseEvent->button == WidgetMouseEvent::eLeftButton &&
@ -3017,7 +3018,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
}
break;
}
case NS_MOUSE_BUTTON_UP:
case eMouseUp:
{
ClearGlobalActiveContent(this);
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
@ -3131,12 +3132,31 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
}
case WheelPrefs::ACTION_NONE:
default:
// If we don't handle the wheel event, all of the delta values must
// be overflown delta values.
bool allDeltaOverflown = false;
if (wheelEvent->mFlags.mHandledByAPZ) {
if (wheelEvent->mCanTriggerSwipe) {
// For events that can trigger swipes, APZ needs to know whether
// scrolling is possible in the requested direction. It does this
// by looking at the scroll overflow values on mCanTriggerSwipe
// events after they have been processed.
allDeltaOverflown =
!ComputeScrollTarget(aTargetFrame, wheelEvent,
COMPUTE_DEFAULT_ACTION_TARGET);
}
} else {
// The event was processed neither by APZ nor by us, so all of the
// delta values must be overflown delta values.
allDeltaOverflown = true;
}
if (!allDeltaOverflown) {
break;
}
wheelEvent->overflowDeltaX = wheelEvent->deltaX;
wheelEvent->overflowDeltaY = wheelEvent->deltaY;
WheelPrefs::GetInstance()->
CancelApplyingUserPrefsFromOverflowDelta(wheelEvent);
wheelEvent->mViewPortIsOverscrolled = true;
break;
}
*aStatus = nsEventStatus_eConsumeNoDefault;
@ -3305,19 +3325,19 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
GenerateDragDropEnterExit(presContext, aEvent->AsDragEvent());
break;
case NS_KEY_BEFORE_UP:
case NS_KEY_UP:
case NS_KEY_AFTER_UP:
case eBeforeKeyUp:
case eKeyUp:
case eAfterKeyUp:
break;
case NS_KEY_PRESS:
case eKeyPress:
{
WidgetKeyboardEvent* keyEvent = aEvent->AsKeyboardEvent();
PostHandleKeyboardEvent(keyEvent, *aStatus, dispatchedToContentProcess);
}
break;
case NS_MOUSE_ENTER_WIDGET:
case eMouseEnterIntoWidget:
if (mCurrentTarget) {
nsCOMPtr<nsIContent> targetContent;
mCurrentTarget->GetContentForEvent(aEvent, getter_AddRefs(targetContent));
@ -3326,7 +3346,7 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
break;
#ifdef XP_MACOSX
case NS_MOUSE_ACTIVATE:
case eMouseActivate:
if (mCurrentTarget) {
nsCOMPtr<nsIContent> targetContent;
mCurrentTarget->GetContentForEvent(aEvent, getter_AddRefs(targetContent));
@ -3740,10 +3760,10 @@ EventStateManager::DispatchMouseOrPointerEvent(WidgetMouseEvent* aMouseEvent,
// "[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_OVER ||
aMessage == NS_MOUSE_OUT)) {
(aMessage == eMouseLeave ||
aMessage == eMouseEnter ||
aMessage == eMouseOver ||
aMessage == eMouseOut)) {
mCurrentTargetContent = nullptr;
nsCOMPtr<Element> pointerLockedElement =
do_QueryReferent(EventStateManager::sPointerLockedElement);
@ -3788,10 +3808,10 @@ EventStateManager::DispatchMouseOrPointerEvent(WidgetMouseEvent* aMouseEvent,
// If we are entering/leaving remote content, dispatch a mouse enter/exit
// event to the remote frame.
if (IsRemoteTarget(aTargetContent)) {
if (aMessage == NS_MOUSE_OUT) {
if (aMessage == eMouseOut) {
// For remote content, send a "top-level" widget mouse exit event.
nsAutoPtr<WidgetMouseEvent> remoteEvent;
CreateMouseOrPointerWidgetEvent(aMouseEvent, NS_MOUSE_EXIT_WIDGET,
CreateMouseOrPointerWidgetEvent(aMouseEvent, eMouseExitFromWidget,
aRelatedContent, remoteEvent);
remoteEvent->exit = WidgetMouseEvent::eTopLevel;
@ -3801,9 +3821,9 @@ EventStateManager::DispatchMouseOrPointerEvent(WidgetMouseEvent* aMouseEvent,
// proper target via GetEventTarget which will return mCurrentTarget.
mCurrentTarget = targetFrame;
HandleCrossProcessEvent(remoteEvent, &status);
} else if (aMessage == NS_MOUSE_OVER) {
} else if (aMessage == eMouseOver) {
nsAutoPtr<WidgetMouseEvent> remoteEvent;
CreateMouseOrPointerWidgetEvent(aMouseEvent, NS_MOUSE_ENTER_WIDGET,
CreateMouseOrPointerWidgetEvent(aMouseEvent, eMouseEnterIntoWidget,
aRelatedContent, remoteEvent);
HandleCrossProcessEvent(remoteEvent, &status);
}
@ -3852,7 +3872,7 @@ public:
~EnterLeaveDispatcher()
{
if (mEventMessage == NS_MOUSEENTER ||
if (mEventMessage == eMouseEnter ||
mEventMessage == NS_POINTER_ENTER) {
for (int32_t i = mTargets.Count() - 1; i >= 0; --i) {
mESM->DispatchMouseOrPointerEvent(mMouseEvent, mEventMessage,
@ -3931,10 +3951,10 @@ EventStateManager::NotifyMouseOut(WidgetMouseEvent* aMouseEvent,
EnterLeaveDispatcher leaveDispatcher(this, wrapper->mLastOverElement,
movingInto, aMouseEvent,
isPointer ? NS_POINTER_LEAVE : NS_MOUSELEAVE);
isPointer ? NS_POINTER_LEAVE : eMouseLeave);
// Fire mouseout
DispatchMouseOrPointerEvent(aMouseEvent, isPointer ? NS_POINTER_OUT : NS_MOUSE_OUT,
DispatchMouseOrPointerEvent(aMouseEvent, isPointer ? NS_POINTER_OUT : eMouseOut,
wrapper->mLastOverElement, aMovingInto);
wrapper->mLastOverFrame = nullptr;
@ -3990,7 +4010,7 @@ EventStateManager::NotifyMouseOver(WidgetMouseEvent* aMouseEvent,
Maybe<EnterLeaveDispatcher> enterDispatcher;
if (dispatch) {
enterDispatcher.emplace(this, aContent, lastOverElement, aMouseEvent,
isPointer ? NS_POINTER_ENTER : NS_MOUSEENTER);
isPointer ? NS_POINTER_ENTER : eMouseEnter);
}
NotifyMouseOut(aMouseEvent, aContent);
@ -4007,7 +4027,7 @@ EventStateManager::NotifyMouseOver(WidgetMouseEvent* aMouseEvent,
// Fire mouseover
wrapper->mLastOverFrame =
DispatchMouseOrPointerEvent(aMouseEvent,
isPointer ? NS_POINTER_OVER : NS_MOUSE_OVER,
isPointer ? NS_POINTER_OVER : eMouseOver,
aContent, lastOverElement);
wrapper->mLastOverElement = aContent;
} else {
@ -4082,7 +4102,7 @@ EventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
nsCOMPtr<nsIContent> targetBeforeEvent = mCurrentTargetContent;
switch(aMouseEvent->mMessage) {
case NS_MOUSE_MOVE:
case eMouseMove:
{
// Mouse movement is reported on the MouseEvent.movement{X,Y} fields.
// Movement is calculated in UIEvent::GetMovementPoint() as:
@ -4166,7 +4186,7 @@ EventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
break;
case NS_POINTER_LEAVE:
case NS_POINTER_CANCEL:
case NS_MOUSE_EXIT_WIDGET:
case eMouseExitFromWidget:
{
// This is actually the window mouse exit or pointer leave event. We're not moving
// into any new element.
@ -4438,10 +4458,10 @@ EventStateManager::SetClickCount(nsPresContext* aPresContext,
switch (aEvent->button) {
case WidgetMouseEvent::eLeftButton:
if (aEvent->mMessage == NS_MOUSE_BUTTON_DOWN) {
if (aEvent->mMessage == eMouseDown) {
mLastLeftMouseDownContent = mouseContent;
mLastLeftMouseDownContentParent = mouseContentParent;
} else if (aEvent->mMessage == NS_MOUSE_BUTTON_UP) {
} else if (aEvent->mMessage == eMouseUp) {
if (mLastLeftMouseDownContent == mouseContent ||
mLastLeftMouseDownContentParent == mouseContent ||
mLastLeftMouseDownContent == mouseContentParent) {
@ -4456,10 +4476,10 @@ EventStateManager::SetClickCount(nsPresContext* aPresContext,
break;
case WidgetMouseEvent::eMiddleButton:
if (aEvent->mMessage == NS_MOUSE_BUTTON_DOWN) {
if (aEvent->mMessage == eMouseDown) {
mLastMiddleMouseDownContent = mouseContent;
mLastMiddleMouseDownContentParent = mouseContentParent;
} else if (aEvent->mMessage == NS_MOUSE_BUTTON_UP) {
} else if (aEvent->mMessage == eMouseUp) {
if (mLastMiddleMouseDownContent == mouseContent ||
mLastMiddleMouseDownContentParent == mouseContent ||
mLastMiddleMouseDownContent == mouseContentParent) {
@ -4474,10 +4494,10 @@ EventStateManager::SetClickCount(nsPresContext* aPresContext,
break;
case WidgetMouseEvent::eRightButton:
if (aEvent->mMessage == NS_MOUSE_BUTTON_DOWN) {
if (aEvent->mMessage == eMouseDown) {
mLastRightMouseDownContent = mouseContent;
mLastRightMouseDownContentParent = mouseContentParent;
} else if (aEvent->mMessage == NS_MOUSE_BUTTON_UP) {
} else if (aEvent->mMessage == eMouseUp) {
if (mLastRightMouseDownContent == mouseContent ||
mLastRightMouseDownContentParent == mouseContent ||
mLastRightMouseDownContent == mouseContentParent) {
@ -4515,7 +4535,7 @@ EventStateManager::CheckForAndDispatchClick(nsPresContext* aPresContext,
(aEvent->button == WidgetMouseEvent::eMiddleButton ||
aEvent->button == WidgetMouseEvent::eRightButton);
WidgetMouseEvent event(aEvent->mFlags.mIsTrusted, NS_MOUSE_CLICK,
WidgetMouseEvent event(aEvent->mFlags.mIsTrusted, eMouseClick,
aEvent->widget, WidgetMouseEvent::eReal);
event.refPoint = aEvent->refPoint;
event.clickCount = aEvent->clickCount;
@ -4548,7 +4568,7 @@ EventStateManager::CheckForAndDispatchClick(nsPresContext* aPresContext,
mouseContent, aStatus);
if (NS_SUCCEEDED(ret) && aEvent->clickCount == 2) {
//fire double click
WidgetMouseEvent event2(aEvent->mFlags.mIsTrusted, NS_MOUSE_DOUBLECLICK,
WidgetMouseEvent event2(aEvent->mFlags.mIsTrusted, eMouseDoubleClick,
aEvent->widget, WidgetMouseEvent::eReal);
event2.refPoint = aEvent->refPoint;
event2.clickCount = aEvent->clickCount;
@ -4688,6 +4708,10 @@ EventStateManager::SetFullScreenState(Element* aElement, bool aIsFullScreen)
Element* ancestor = aElement;
while ((ancestor = GetParentElement(ancestor))) {
DoStateChange(ancestor, NS_EVENT_STATE_FULL_SCREEN_ANCESTOR, aIsFullScreen);
if (ancestor->State().HasState(NS_EVENT_STATE_FULL_SCREEN)) {
// If we meet another fullscreen element, stop here.
break;
}
}
}
@ -4960,7 +4984,7 @@ EventStateManager::ContentRemoved(nsIDocument* aDocument, nsIContent* aContent)
bool
EventStateManager::EventStatusOK(WidgetGUIEvent* aEvent)
{
return !(aEvent->mMessage == NS_MOUSE_BUTTON_DOWN &&
return !(aEvent->mMessage == eMouseDown &&
aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton &&
!sNormalLMouseEventInProcess);
}
@ -5749,7 +5773,7 @@ AutoHandlingUserInputStatePusher::AutoHandlingUserInputStatePusher(
WidgetEvent* aEvent,
nsIDocument* aDocument) :
mIsHandlingUserInput(aIsHandlingUserInput),
mIsMouseDown(aEvent && aEvent->mMessage == NS_MOUSE_BUTTON_DOWN),
mIsMouseDown(aEvent && aEvent->mMessage == eMouseDown),
mResetFMMouseButtonHandlingState(false)
{
if (!aIsHandlingUserInput) {
@ -5764,8 +5788,7 @@ AutoHandlingUserInputStatePusher::AutoHandlingUserInputStatePusher(
return;
}
mResetFMMouseButtonHandlingState =
(aEvent->mMessage == NS_MOUSE_BUTTON_DOWN ||
aEvent->mMessage == NS_MOUSE_BUTTON_UP);
(aEvent->mMessage == eMouseDown || aEvent->mMessage == eMouseUp);
if (mResetFMMouseButtonHandlingState) {
nsFocusManager* fm = nsFocusManager::GetFocusManager();
NS_ENSURE_TRUE_VOID(fm);

View File

@ -958,7 +958,7 @@ private:
// has no frame. This is required for Web compatibility.
#define NS_EVENT_NEEDS_FRAME(event) \
(!(event)->HasPluginActivationEventMessage() && \
(event)->mMessage != NS_MOUSE_CLICK && \
(event)->mMessage != NS_MOUSE_DOUBLECLICK)
(event)->mMessage != eMouseClick && \
(event)->mMessage != eMouseDoubleClick)
#endif // mozilla_EventStateManager_h_

View File

@ -457,8 +457,8 @@ IMEContentObserver::OnMouseButtonEvent(nsPresContext* aPresContext,
}
// Now, we need to notify only mouse down and mouse up event.
switch (aMouseEvent->mMessage) {
case NS_MOUSE_BUTTON_UP:
case NS_MOUSE_BUTTON_DOWN:
case eMouseUp:
case eMouseDown:
break;
default:
return false;

View File

@ -16,8 +16,7 @@ InputEvent::InputEvent(EventTarget* aOwner,
InternalEditorInputEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new InternalEditorInputEvent(false, NS_EVENT_NULL,
nullptr))
new InternalEditorInputEvent(false, eVoidEvent, nullptr))
{
NS_ASSERTION(mEvent->mClass == eEditorInputEventClass,
"event type mismatch");

View File

@ -16,7 +16,7 @@ KeyboardEvent::KeyboardEvent(EventTarget* aOwner,
WidgetKeyboardEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetKeyboardEvent(false, NS_EVENT_NULL, nullptr))
new WidgetKeyboardEvent(false, eVoidEvent, nullptr))
, mInitializedByCtor(false)
, mInitializedWhichValue(0)
{
@ -153,14 +153,14 @@ KeyboardEvent::CharCode()
}
switch (mEvent->mMessage) {
case NS_KEY_BEFORE_DOWN:
case NS_KEY_DOWN:
case NS_KEY_AFTER_DOWN:
case NS_KEY_BEFORE_UP:
case NS_KEY_UP:
case NS_KEY_AFTER_UP:
case eBeforeKeyDown:
case eKeyDown:
case eAfterKeyDown:
case eBeforeKeyUp:
case eKeyUp:
case eAfterKeyUp:
return 0;
case NS_KEY_PRESS:
case eKeyPress:
return mEvent->AsKeyboardEvent()->charCode;
default:
break;
@ -199,14 +199,14 @@ KeyboardEvent::Which()
}
switch (mEvent->mMessage) {
case NS_KEY_BEFORE_DOWN:
case NS_KEY_DOWN:
case NS_KEY_AFTER_DOWN:
case NS_KEY_BEFORE_UP:
case NS_KEY_UP:
case NS_KEY_AFTER_UP:
case eBeforeKeyDown:
case eKeyDown:
case eAfterKeyDown:
case eBeforeKeyUp:
case eKeyUp:
case eAfterKeyUp:
return KeyCode();
case NS_KEY_PRESS:
case eKeyPress:
//Special case for 4xp bug 62878. Try to make value of which
//more closely mirror the values that 4.x gave for RETURN and BACKSPACE
{

View File

@ -18,7 +18,7 @@ MouseEvent::MouseEvent(EventTarget* aOwner,
WidgetMouseEventBase* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetMouseEvent(false, NS_EVENT_NULL, nullptr,
new WidgetMouseEvent(false, eVoidEvent, nullptr,
WidgetMouseEvent::eReal))
{
// There's no way to make this class' ctor allocate an WidgetMouseScrollEvent.

View File

@ -16,8 +16,7 @@ MouseScrollEvent::MouseScrollEvent(EventTarget* aOwner,
WidgetMouseScrollEvent* aEvent)
: MouseEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetMouseScrollEvent(false, NS_EVENT_NULL,
nullptr))
new WidgetMouseScrollEvent(false, eVoidEvent, nullptr))
{
if (aEvent) {
mEventIsInternal = false;

View File

@ -17,7 +17,7 @@ MutationEvent::MutationEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalMutationEvent* aEvent)
: Event(aOwner, aPresContext,
aEvent ? aEvent : new InternalMutationEvent(false, NS_EVENT_NULL))
aEvent ? aEvent : new InternalMutationEvent(false, eVoidEvent))
{
mEventIsInternal = (aEvent == nullptr);
}

View File

@ -73,7 +73,7 @@ NS_NewDOMNotifyPaintEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
mozilla::WidgetEvent* aEvent,
mozilla::EventMessage aEventMessage =
mozilla::NS_EVENT_NULL,
mozilla::eVoidEvent,
nsInvalidateRequestList* aInvalidateRequests =
nullptr);

View File

@ -18,7 +18,7 @@ PointerEvent::PointerEvent(EventTarget* aOwner,
WidgetPointerEvent* aEvent)
: MouseEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetPointerEvent(false, NS_EVENT_NULL, nullptr))
new WidgetPointerEvent(false, eVoidEvent, nullptr))
{
NS_ASSERTION(mEvent->mClass == ePointerEventClass,
"event type mismatch ePointerEventClass");

View File

@ -16,7 +16,7 @@ SimpleGestureEvent::SimpleGestureEvent(EventTarget* aOwner,
WidgetSimpleGestureEvent* aEvent)
: MouseEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetSimpleGestureEvent(false, NS_EVENT_NULL,
new WidgetSimpleGestureEvent(false, eVoidEvent,
nullptr))
{
NS_ASSERTION(mEvent->mClass == eSimpleGestureEventClass,

View File

@ -64,7 +64,7 @@ TouchEvent::TouchEvent(EventTarget* aOwner,
WidgetTouchEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetTouchEvent(false, NS_EVENT_NULL, nullptr))
new WidgetTouchEvent(false, eVoidEvent, nullptr))
{
if (aEvent) {
mEventIsInternal = false;

View File

@ -15,7 +15,7 @@ TransitionEvent::TransitionEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalTransitionEvent* aEvent)
: Event(aOwner, aPresContext,
aEvent ? aEvent : new InternalTransitionEvent(false, NS_EVENT_NULL))
aEvent ? aEvent : new InternalTransitionEvent(false, eVoidEvent))
{
if (aEvent) {
mEventIsInternal = false;

View File

@ -29,7 +29,7 @@ UIEvent::UIEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetGUIEvent* aEvent)
: Event(aOwner, aPresContext,
aEvent ? aEvent : new InternalUIEvent(false, NS_EVENT_NULL, nullptr))
aEvent ? aEvent : new InternalUIEvent(false, eVoidEvent, nullptr))
, mClientPoint(0, 0)
, mLayerPoint(0, 0)
, mPagePoint(0, 0)

View File

@ -16,8 +16,7 @@ WheelEvent::WheelEvent(EventTarget* aOwner,
WidgetWheelEvent* aWheelEvent)
: MouseEvent(aOwner, aPresContext,
aWheelEvent ? aWheelEvent :
new WidgetWheelEvent(false, NS_EVENT_NULL,
nullptr))
new WidgetWheelEvent(false, eVoidEvent, nullptr))
, mAppUnitsPerDevPixel(0)
{
if (aWheelEvent) {

View File

@ -184,7 +184,7 @@ WheelTransaction::OnEvent(WidgetEvent* aEvent)
EndTransaction();
}
return;
case NS_MOUSE_MOVE:
case eMouseMove:
case NS_DRAGDROP_OVER: {
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
if (mouseEvent->IsReal()) {
@ -207,13 +207,13 @@ WheelTransaction::OnEvent(WidgetEvent* aEvent)
}
return;
}
case NS_KEY_PRESS:
case NS_KEY_UP:
case NS_KEY_DOWN:
case NS_MOUSE_BUTTON_UP:
case NS_MOUSE_BUTTON_DOWN:
case NS_MOUSE_DOUBLECLICK:
case NS_MOUSE_CLICK:
case eKeyPress:
case eKeyUp:
case eKeyDown:
case eMouseUp:
case eMouseDown:
case eMouseDoubleClick:
case eMouseClick:
case NS_CONTEXTMENU:
case NS_DRAGDROP_DROP:
EndTransaction();

View File

@ -15,7 +15,7 @@ XULCommandEvent::XULCommandEvent(EventTarget* aOwner,
WidgetInputEvent* aEvent)
: UIEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetInputEvent(false, NS_EVENT_NULL, nullptr))
new WidgetInputEvent(false, eVoidEvent, nullptr))
{
if (aEvent) {
mEventIsInternal = false;

View File

@ -41,7 +41,7 @@ namespace dom {
NS_IMPL_ISUPPORTS(FetchDriver,
nsIStreamListener, nsIChannelEventSink, nsIInterfaceRequestor,
nsIAsyncVerifyRedirectCallback)
nsIAsyncVerifyRedirectCallback, nsIThreadRetargetableStreamListener)
FetchDriver::FetchDriver(InternalRequest* aRequest, nsIPrincipal* aPrincipal,
nsILoadGroup* aLoadGroup)
@ -782,9 +782,8 @@ FetchDriver::OnStartRequest(nsIRequest* aRequest,
}
// Try to retarget off main thread.
nsCOMPtr<nsIThreadRetargetableRequest> rr = do_QueryInterface(aRequest);
if (rr) {
rr->RetargetDeliveryTo(sts);
if (nsCOMPtr<nsIThreadRetargetableRequest> rr = do_QueryInterface(aRequest)) {
NS_WARN_IF(NS_FAILED(rr->RetargetDeliveryTo(sts)));
}
return NS_OK;
}
@ -796,6 +795,10 @@ FetchDriver::OnDataAvailable(nsIRequest* aRequest,
uint64_t aOffset,
uint32_t aCount)
{
// NB: This can be called on any thread! But we're guaranteed that it is
// called between OnStartRequest and OnStopRequest, so we don't need to worry
// about races.
uint32_t aRead;
MOZ_ASSERT(mResponse);
MOZ_ASSERT(mPipeOutputStream);
@ -887,6 +890,12 @@ FetchDriver::AsyncOnChannelRedirect(nsIChannel* aOldChannel,
return NS_OK;
}
NS_IMETHODIMP
FetchDriver::CheckListenerChain()
{
return NS_OK;
}
// Returns NS_OK if no preflight is required, error otherwise.
nsresult
FetchDriver::DoesNotRequirePreflight(nsIChannel* aChannel)

View File

@ -12,6 +12,7 @@
#include "nsIChannelEventSink.h"
#include "nsIInterfaceRequestor.h"
#include "nsIStreamListener.h"
#include "nsIThreadRetargetableStreamListener.h"
#include "mozilla/nsRefPtr.h"
#include "mozilla/DebugOnly.h"
@ -44,7 +45,8 @@ protected:
class FetchDriver final : public nsIStreamListener,
public nsIChannelEventSink,
public nsIInterfaceRequestor,
public nsIAsyncVerifyRedirectCallback
public nsIAsyncVerifyRedirectCallback,
public nsIThreadRetargetableStreamListener
{
public:
NS_DECL_ISUPPORTS
@ -53,6 +55,7 @@ public:
NS_DECL_NSICHANNELEVENTSINK
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIASYNCVERIFYREDIRECTCALLBACK
NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
explicit FetchDriver(InternalRequest* aRequest, nsIPrincipal* aPrincipal,
nsILoadGroup* aLoadGroup);

View File

@ -282,20 +282,20 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
if (nsEventStatus_eIgnore == aVisitor.mEventStatus) {
switch (aVisitor.mEvent->mMessage) {
case NS_KEY_PRESS:
case NS_KEY_UP:
case eKeyPress:
case eKeyUp:
{
// For backwards compat, trigger buttons with space or enter
// (bug 25300)
WidgetKeyboardEvent* keyEvent = aVisitor.mEvent->AsKeyboardEvent();
if ((keyEvent->keyCode == NS_VK_RETURN &&
NS_KEY_PRESS == aVisitor.mEvent->mMessage) ||
eKeyPress == aVisitor.mEvent->mMessage) ||
(keyEvent->keyCode == NS_VK_SPACE &&
NS_KEY_UP == aVisitor.mEvent->mMessage)) {
eKeyUp == aVisitor.mEvent->mMessage)) {
nsEventStatus status = nsEventStatus_eIgnore;
WidgetMouseEvent event(aVisitor.mEvent->mFlags.mIsTrusted,
NS_MOUSE_CLICK, nullptr,
eMouseClick, nullptr,
WidgetMouseEvent::eReal);
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
EventDispatcher::Dispatch(static_cast<nsIContent*>(this),
@ -304,9 +304,9 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
}
}
break;// NS_KEY_PRESS
break;
case NS_MOUSE_BUTTON_DOWN:
case eMouseDown:
{
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
if (mouseEvent->button == WidgetMouseEvent::eLeftButton) {
@ -334,8 +334,8 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
// cancel all of these events for buttons
//XXXsmaug What to do with these events? Why these should be cancelled?
case NS_MOUSE_BUTTON_UP:
case NS_MOUSE_DOUBLECLICK:
case eMouseUp:
case eMouseDoubleClick:
{
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
if (aVisitor.mDOMEvent &&
@ -346,7 +346,7 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
}
break;
case NS_MOUSE_OVER:
case eMouseOver:
{
aVisitor.mPresContext->EventStateManager()->
SetContentState(this, NS_EVENT_STATE_HOVER);
@ -355,7 +355,7 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
break;
// XXX this doesn't seem to do anything yet
case NS_MOUSE_OUT:
case eMouseOut:
{
aVisitor.mPresContext->EventStateManager()->
SetContentState(nullptr, NS_EVENT_STATE_HOVER);

View File

@ -2806,8 +2806,7 @@ HTMLInputElement::MaybeSubmitForm(nsPresContext* aPresContext)
NS_ASSERTION(submitContent, "Form control not implementing nsIContent?!");
// Fire the button's onclick handler and let the button handle
// submitting the form.
WidgetMouseEvent event(true, NS_MOUSE_CLICK, nullptr,
WidgetMouseEvent::eReal);
WidgetMouseEvent event(true, eMouseClick, nullptr, WidgetMouseEvent::eReal);
nsEventStatus status = nsEventStatus_eIgnore;
shell->HandleDOMEventWithTarget(submitContent, &event, &status);
} else if (!mForm->ImplicitSubmissionIsDisabled() &&
@ -3026,11 +3025,11 @@ HTMLInputElement::NeedToInitializeEditorForEvent(
}
switch (aVisitor.mEvent->mMessage) {
case NS_MOUSE_MOVE:
case NS_MOUSE_ENTER_WIDGET:
case NS_MOUSE_EXIT_WIDGET:
case NS_MOUSE_OVER:
case NS_MOUSE_OUT:
case eMouseMove:
case eMouseEnterIntoWidget:
case eMouseExitFromWidget:
case eMouseOver:
case eMouseOut:
case NS_SCROLLPORT_UNDERFLOW:
case NS_SCROLLPORT_OVERFLOW:
return false;
@ -3153,7 +3152,7 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
aVisitor.mItemFlags |= NS_NO_CONTENT_DISPATCH;
}
if (IsSingleLineTextControl(false) &&
aVisitor.mEvent->mMessage == NS_MOUSE_CLICK &&
aVisitor.mEvent->mMessage == eMouseClick &&
aVisitor.mEvent->AsMouseEvent()->button ==
WidgetMouseEvent::eMiddleButton) {
aVisitor.mEvent->mFlags.mNoContentDispatch = false;
@ -3197,7 +3196,7 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
// we want to end the spin. We do this here (rather than in
// PostHandleEvent) because we don't want to let content preventDefault()
// the end of the spin.
if (aVisitor.mEvent->mMessage == NS_MOUSE_MOVE) {
if (aVisitor.mEvent->mMessage == eMouseMove) {
// Be aggressive about stopping the spin:
bool stopSpin = true;
nsNumberControlFrame* numberControlFrame =
@ -3228,7 +3227,7 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
if (stopSpin) {
StopNumberControlSpinnerSpin();
}
} else if (aVisitor.mEvent->mMessage == NS_MOUSE_BUTTON_UP) {
} else if (aVisitor.mEvent->mMessage == eMouseUp) {
StopNumberControlSpinnerSpin();
}
}
@ -3254,7 +3253,7 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
// that).
frame->InvalidateFrame();
}
} else if (aVisitor.mEvent->mMessage == NS_KEY_UP) {
} else if (aVisitor.mEvent->mMessage == eKeyUp) {
WidgetKeyboardEvent* keyEvent = aVisitor.mEvent->AsKeyboardEvent();
if ((keyEvent->keyCode == NS_VK_UP || keyEvent->keyCode == NS_VK_DOWN) &&
!(keyEvent->IsShift() || keyEvent->IsControl() ||
@ -3722,7 +3721,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
if (NS_SUCCEEDED(rv)) {
WidgetKeyboardEvent* keyEvent = aVisitor.mEvent->AsKeyboardEvent();
if (mType == NS_FORM_INPUT_NUMBER &&
keyEvent && keyEvent->mMessage == NS_KEY_PRESS &&
keyEvent && keyEvent->mMessage == eKeyPress &&
aVisitor.mEvent->mFlags.mIsTrusted &&
(keyEvent->keyCode == NS_VK_UP || keyEvent->keyCode == NS_VK_DOWN) &&
!(keyEvent->IsShift() || keyEvent->IsControl() ||
@ -3774,15 +3773,15 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
break;
}
case NS_KEY_PRESS:
case NS_KEY_UP:
case eKeyPress:
case eKeyUp:
{
// For backwards compat, trigger checks/radios/buttons with
// space or enter (bug 25300)
WidgetKeyboardEvent* keyEvent = aVisitor.mEvent->AsKeyboardEvent();
if ((aVisitor.mEvent->mMessage == NS_KEY_PRESS &&
if ((aVisitor.mEvent->mMessage == eKeyPress &&
keyEvent->keyCode == NS_VK_RETURN) ||
(aVisitor.mEvent->mMessage == NS_KEY_UP &&
(aVisitor.mEvent->mMessage == eKeyUp &&
keyEvent->keyCode == NS_VK_SPACE)) {
switch(mType) {
case NS_FORM_INPUT_CHECKBOX:
@ -3803,7 +3802,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
case NS_FORM_INPUT_COLOR:
{
WidgetMouseEvent event(aVisitor.mEvent->mFlags.mIsTrusted,
NS_MOUSE_CLICK, nullptr,
eMouseClick, nullptr,
WidgetMouseEvent::eReal);
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
nsEventStatus status = nsEventStatus_eIgnore;
@ -3815,7 +3814,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
} // case
} // switch
}
if (aVisitor.mEvent->mMessage == NS_KEY_PRESS &&
if (aVisitor.mEvent->mMessage == eKeyPress &&
mType == NS_FORM_INPUT_RADIO && !keyEvent->IsAlt() &&
!keyEvent->IsControl() && !keyEvent->IsMeta()) {
bool isMovingBack = false;
@ -3839,7 +3838,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
if (NS_SUCCEEDED(rv)) {
nsEventStatus status = nsEventStatus_eIgnore;
WidgetMouseEvent event(aVisitor.mEvent->mFlags.mIsTrusted,
NS_MOUSE_CLICK, nullptr,
eMouseClick, nullptr,
WidgetMouseEvent::eReal);
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
rv =
@ -3867,7 +3866,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
* not submit, period.
*/
if (aVisitor.mEvent->mMessage == NS_KEY_PRESS &&
if (aVisitor.mEvent->mMessage == eKeyPress &&
keyEvent->keyCode == NS_VK_RETURN &&
(IsSingleLineTextControl(false, mType) ||
mType == NS_FORM_INPUT_NUMBER ||
@ -3877,7 +3876,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
NS_ENSURE_SUCCESS(rv, rv);
}
if (aVisitor.mEvent->mMessage == NS_KEY_PRESS &&
if (aVisitor.mEvent->mMessage == eKeyPress &&
mType == NS_FORM_INPUT_RANGE && !keyEvent->IsAlt() &&
!keyEvent->IsControl() && !keyEvent->IsMeta() &&
(keyEvent->keyCode == NS_VK_LEFT ||
@ -3936,12 +3935,11 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
}
}
} break; // NS_KEY_PRESS || NS_KEY_UP
} break; // eKeyPress || eKeyUp
case NS_MOUSE_BUTTON_DOWN:
case NS_MOUSE_BUTTON_UP:
case NS_MOUSE_DOUBLECLICK:
{
case eMouseDown:
case eMouseUp:
case eMouseDoubleClick: {
// cancel all of these events for buttons
//XXXsmaug Why?
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
@ -3967,7 +3965,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
nsNumberControlFrame* numberControlFrame =
do_QueryFrame(GetPrimaryFrame());
if (numberControlFrame) {
if (aVisitor.mEvent->mMessage == NS_MOUSE_BUTTON_DOWN &&
if (aVisitor.mEvent->mMessage == eMouseDown &&
IsMutable()) {
switch (numberControlFrame->GetSpinButtonForPointerEvent(
aVisitor.mEvent->AsMouseEvent())) {
@ -4086,7 +4084,7 @@ HTMLInputElement::PostHandleEventForRangeThumb(EventChainPostVisitor& aVisitor)
switch (aVisitor.mEvent->mMessage)
{
case NS_MOUSE_BUTTON_DOWN:
case eMouseDown:
case NS_TOUCH_START: {
if (mIsDraggingRange) {
break;
@ -4101,7 +4099,7 @@ HTMLInputElement::PostHandleEventForRangeThumb(EventChainPostVisitor& aVisitor)
inputEvent->IsOS()) {
break; // ignore
}
if (aVisitor.mEvent->mMessage == NS_MOUSE_BUTTON_DOWN) {
if (aVisitor.mEvent->mMessage == eMouseDown) {
if (aVisitor.mEvent->AsMouseEvent()->buttons ==
WidgetMouseEvent::eLeftButtonFlag) {
StartRangeThumbDrag(inputEvent);
@ -4118,7 +4116,7 @@ HTMLInputElement::PostHandleEventForRangeThumb(EventChainPostVisitor& aVisitor)
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
} break;
case NS_MOUSE_MOVE:
case eMouseMove:
case NS_TOUCH_MOVE:
if (!mIsDraggingRange) {
break;
@ -4133,7 +4131,7 @@ HTMLInputElement::PostHandleEventForRangeThumb(EventChainPostVisitor& aVisitor)
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
break;
case NS_MOUSE_BUTTON_UP:
case eMouseUp:
case NS_TOUCH_END:
if (!mIsDraggingRange) {
break;
@ -4146,7 +4144,7 @@ HTMLInputElement::PostHandleEventForRangeThumb(EventChainPostVisitor& aVisitor)
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
break;
case NS_KEY_PRESS:
case eKeyPress:
if (mIsDraggingRange &&
aVisitor.mEvent->AsKeyboardEvent()->keyCode == NS_VK_ESCAPE) {
CancelRangeThumbDrag();

View File

@ -104,7 +104,7 @@ HTMLLabelElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
if (mHandlingEvent ||
(!(mouseEvent && mouseEvent->IsLeftClickEvent()) &&
aVisitor.mEvent->mMessage != NS_MOUSE_BUTTON_DOWN) ||
aVisitor.mEvent->mMessage != eMouseDown) ||
aVisitor.mEventStatus == nsEventStatus_eConsumeNoDefault ||
!aVisitor.mPresContext ||
// Don't handle the event if it's already been handled by another label
@ -123,10 +123,10 @@ HTMLLabelElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
if (content) {
mHandlingEvent = true;
switch (aVisitor.mEvent->mMessage) {
case NS_MOUSE_BUTTON_DOWN:
case eMouseDown:
if (mouseEvent->button == WidgetMouseEvent::eLeftButton) {
// We reset the mouse-down point on every event because there is
// no guarantee we will reach the NS_MOUSE_CLICK code below.
// no guarantee we will reach the eMouseClick code below.
LayoutDeviceIntPoint* curPoint =
new LayoutDeviceIntPoint(mouseEvent->refPoint);
SetProperty(nsGkAtoms::labelMouseDownPtProperty,
@ -135,7 +135,7 @@ HTMLLabelElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
}
break;
case NS_MOUSE_CLICK:
case eMouseClick:
if (mouseEvent->IsLeftClickEvent()) {
LayoutDeviceIntPoint* mouseDownPoint =
static_cast<LayoutDeviceIntPoint*>(
@ -232,7 +232,7 @@ HTMLLabelElement::PerformAccesskey(bool aKeyCausesActivation,
return;
// Click on it if the users prefs indicate to do so.
WidgetMouseEvent event(aIsTrustedEvent, NS_MOUSE_CLICK,
WidgetMouseEvent event(aIsTrustedEvent, eMouseClick,
nullptr, WidgetMouseEvent::eReal);
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;

View File

@ -254,7 +254,7 @@ HTMLMenuItemElement::SetChecked(bool aChecked)
nsresult
HTMLMenuItemElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
{
if (aVisitor.mEvent->mMessage == NS_MOUSE_CLICK) {
if (aVisitor.mEvent->mMessage == eMouseClick) {
bool originalCheckedValue = false;
switch (mType) {
@ -290,7 +290,7 @@ nsresult
HTMLMenuItemElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
{
// Check to see if the event was cancelled.
if (aVisitor.mEvent->mMessage == NS_MOUSE_CLICK &&
if (aVisitor.mEvent->mMessage == eMouseClick &&
aVisitor.mItemFlags & NS_CHECKED_IS_TOGGLED &&
aVisitor.mEventStatus == nsEventStatus_eConsumeNoDefault) {
bool originalCheckedValue =

View File

@ -499,7 +499,7 @@ HTMLTextAreaElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
if (aVisitor.mEvent->mFlags.mNoContentDispatch) {
aVisitor.mItemFlags |= NS_NO_CONTENT_DISPATCH;
}
if (aVisitor.mEvent->mMessage == NS_MOUSE_CLICK &&
if (aVisitor.mEvent->mMessage == eMouseClick &&
aVisitor.mEvent->AsMouseEvent()->button ==
WidgetMouseEvent::eMiddleButton) {
aVisitor.mEvent->mFlags.mNoContentDispatch = false;

View File

@ -2466,7 +2466,7 @@ nsGenericHTMLFormElement::IsElementDisabledForEvents(EventMessage aMessage,
uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED;
}
return disabled && aMessage != NS_MOUSE_MOVE;
return disabled && aMessage != eMouseMove;
}
void
@ -2655,7 +2655,7 @@ nsGenericHTMLElement::Click()
// called from chrome JS. Mark this event trusted if Click()
// is called from chrome code.
WidgetMouseEvent event(nsContentUtils::IsCallerChrome(),
NS_MOUSE_CLICK, nullptr, WidgetMouseEvent::eReal);
eMouseClick, nullptr, WidgetMouseEvent::eReal);
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
EventDispatcher::Dispatch(static_cast<nsIContent*>(this), context, &event);
@ -2757,7 +2757,7 @@ nsGenericHTMLElement::PerformAccesskey(bool aKeyCausesActivation,
if (aKeyCausesActivation) {
// Click on it if the users prefs indicate to do so.
WidgetMouseEvent event(aIsTrustedEvent, NS_MOUSE_CLICK, nullptr,
WidgetMouseEvent event(aIsTrustedEvent, eMouseClick, nullptr,
WidgetMouseEvent::eReal);
event.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;

View File

@ -904,7 +904,7 @@ nsTextInputListener::HandleEvent(nsIDOMEvent* aEvent)
return NS_ERROR_UNEXPECTED;
}
if (keyEvent->mMessage != NS_KEY_PRESS) {
if (keyEvent->mMessage != eKeyPress) {
return NS_OK;
}

View File

@ -0,0 +1,178 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for Bug 1199522</title>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="file_fullscreen-utils.js"></script>
<style>
div {
position: fixed;
top: 20px; height: 50px;
opacity: 0.3;
border: 5px solid black;
box-sizing: border-box;
}
#fullscreen0 {
left: 50px; width: 50px;
background: #ff0000;
border-color: #800000;
}
#fullscreen1 {
left: 100px; width: 50px;
background: #00ff00;
border-color: #008000;
}
#fullscreen2 {
left: 150px; width: 50px;
background: #0000ff;
border-color: #000080;
}
</style>
</head>
<body>
<script type="application/javascript">
/** Test for Bug 1199522 **/
function info(msg) {
opener.info("[selector] " + msg);
}
function ok(condition, msg) {
opener.ok(condition, "[selector] " + msg);
}
function is(a, b, msg) {
opener.is(a, b, "[selector] " + msg);
}
function rectEquals(rect1, rect2) {
return rect1.x == rect2.x && rect1.y == rect2.y &&
rect1.width == rect2.width && rect1.height == rect2.height;
}
function getViewportRect() {
return new DOMRect(0, 0, window.innerWidth, window.innerHeight);
}
var fullscreenElems = [];
function checkFullscreenState(elem, hasState, viewportRect) {
var id = elem.id;
var rect = elem.getBoundingClientRect();
if (hasState) {
ok(elem.matches(":-moz-full-screen"),
`${id} should match selector ":fullscreen"`);
ok(rectEquals(rect, viewportRect),
`The bounding rect of ${id} should match the viewport`);
} else {
ok(!elem.matches(":-moz-full-screen"),
`${id} should not match selector ":fullscreen"`);
ok(rectEquals(rect, elem.initialRect),
`The bounding rect of ${id} should match its initial state`);
}
}
function checkFullscreenStates(states) {
var viewportRect = getViewportRect();
fullscreenElems.forEach((elem, index) => {
checkFullscreenState(elem, states[index], viewportRect);
});
}
function begin() {
fullscreenElems.push(document.getElementById('fullscreen0'));
fullscreenElems.push(document.getElementById('fullscreen1'));
fullscreenElems.push(document.getElementById('fullscreen2'));
var viewportRect = getViewportRect();
for (var elem of fullscreenElems) {
var rect = elem.getBoundingClientRect();
var id = elem.id;
elem.initialRect = rect;
ok(!elem.matches(":-moz-full-screen"),
`${id} should not match selector ":fullscreen"`);
ok(!rectEquals(elem.initialRect, viewportRect),
`The initial bounding rect of ${id} should not match the viewport`);
}
info("Entering fullscreen on fullscreen0");
addFullscreenChangeContinuation("enter", enter0);
fullscreenElems[0].mozRequestFullScreen();
}
function enter0() {
checkFullscreenStates([true, false, false]);
info("Entering fullscreen on fullscreen1");
addFullscreenChangeContinuation("enter", enter1);
fullscreenElems[1].mozRequestFullScreen();
}
function enter1() {
checkFullscreenStates([true, true, false]);
info("Entering fullscreen on fullscreen2");
addFullscreenChangeContinuation("enter", enter2);
fullscreenElems[2].mozRequestFullScreen();
}
function enter2() {
checkFullscreenStates([true, true, true]);
info("Leaving fullscreen on fullscreen2");
addFullscreenChangeContinuation("exit", exit2);
document.mozCancelFullScreen();
}
function exit2() {
checkFullscreenStates([true, true, false]);
info("Leaving fullscreen on fullscreen1");
addFullscreenChangeContinuation("exit", exit1);
document.mozCancelFullScreen();
}
function exit1() {
checkFullscreenStates([true, false, false]);
info("Leaving fullscreen on fullscreen0");
addFullscreenChangeContinuation("exit", exit0);
document.mozCancelFullScreen();
}
function exit0() {
checkFullscreenStates([false, false, false]);
info("Entering fullscreen on all elements");
var count = 0;
function listener() {
if (++count == 3) {
document.removeEventListener("mozfullscreenchange", listener);
enterAll();
}
}
document.addEventListener("mozfullscreenchange", listener);
fullscreenElems[0].mozRequestFullScreen();
fullscreenElems[1].mozRequestFullScreen();
fullscreenElems[2].mozRequestFullScreen();
}
function enterAll() {
checkFullscreenStates([true, true, true]);
info("Fully-exiting fullscreen");
addFullscreenChangeContinuation("exit", exitAll);
synthesizeKey("VK_ESCAPE", {});
}
function exitAll() {
checkFullscreenStates([false, false, false]);
opener.nextTest();
}
</script>
</pre>
<div id="fullscreen0">
<div id="fullscreen1">
<div id="fullscreen2">
</div>
</div>
</div>
</body>
</html>

View File

@ -60,6 +60,7 @@ support-files =
file_fullscreen-navigation.html
file_fullscreen-plugins.html
file_fullscreen-rollback.html
file_fullscreen-selector.html
file_fullscreen-svg-element.html
file_fullscreen-utils.js
file_iframe_sandbox_a_if1.html

View File

@ -39,7 +39,8 @@ var gTestWindows = [
"file_fullscreen-plugins.html",
"file_fullscreen-hidden.html",
"file_fullscreen-svg-element.html",
"file_fullscreen-navigation.html"
"file_fullscreen-navigation.html",
"file_fullscreen-selector.html"
];
var testWindow = null;
@ -53,7 +54,7 @@ function nextTest() {
if (testWindow) {
testWindow.close();
}
runNextTest();
SimpleTest.executeSoon(runNextTest);
}
function runNextTest() {

View File

@ -819,11 +819,11 @@ interface nsIDOMWindowUtils : nsISupports {
void runNextCollectorTimer();
/** Synthesize a simple gesture event for a window. The event types
* supported are: MozSwipeGestureStart, MozSwipeGestureUpdate,
* MozSwipeGestureEnd, MozSwipeGesture, MozMagnifyGestureStart,
* MozMagnifyGestureUpdate, MozMagnifyGesture, MozRotateGestureStart,
* MozRotateGestureUpdate, MozRotateGesture, MozPressTapGesture,
* MozTapGesture, and MozEdgeUIGesture.
* supported are: MozSwipeGestureMayStart, MozSwipeGestureStart,
* MozSwipeGestureUpdate, MozSwipeGestureEnd, MozSwipeGesture,
* MozMagnifyGestureStart, MozMagnifyGestureUpdate, MozMagnifyGesture,
* MozRotateGestureStart, MozRotateGestureUpdate, MozRotateGesture,
* MozPressTapGesture, MozTapGesture, and MozEdgeUIGesture.
*
* Cannot be accessed from unprivileged context (not
* content-accessible) Will throw a DOM security error if called

View File

@ -12,20 +12,25 @@
*
* The following events are generated:
*
* MozSwipeGestureStart - Generated when the user starts a horizontal
* swipe across the input device. This event not only acts as a signal,
* but also asks two questions: Should a swipe really be started, and
* MozSwipeGestureMayStart - Generated when the user starts a horizontal
* swipe across the input device, but before we know whether the user
* is actually scrolling past a scroll edge.
* This event asks two questions: Should a swipe really be started, and
* in which directions should the user be able to swipe? The first
* question is answered by event listeners by calling or not calling
* preventDefault() on the event. Since a swipe swallows all scroll
* events, the default action of the swipe start event is *not* to
* start a swipe. Call preventDefault() if you want a swipe to be
* started.
* started. Doing so won't necessarily result in a swipe being started,
* it only communicates an intention. Once Gecko determines whether a
* swipe should actually be started, it will send a MozSwipeGestureStart
* event.
* The second question (swipe-able directions) is answered in the
* allowedDirections field.
* If this event has preventDefault() called on it (and thus starts
* a swipe), it guarantees a future MozSwipeGestureEnd event that
* will signal the end of a swipe animation.
*
* MozSwipeGestureStart - This event signals the start of a swipe.
* It guarantees a future MozSwipeGestureEnd event that will signal
* the end of a swipe animation.
*
* MozSwipeGestureUpdate - Generated periodically while the user is
* continuing a horizontal swipe gesture. The "delta" value represents
@ -117,14 +122,14 @@ interface nsIDOMSimpleGestureEvent : nsIDOMMouseEvent
* Reports the directions that can be swiped to; multiple directions
* should be OR'ed together.
*
* The allowedDirections field is designed to be set on SwipeGestureStart
* The allowedDirections field is designed to be set on SwipeGestureMayStart
* events by event listeners. Its value after event dispatch determines
* the behavior of the swipe animation that is about to begin.
* the behavior of the swipe animation that might be about to begin.
* Specifically, if the user swipes in a direction that can't be swiped
* to, the animation will have a bounce effect.
* Future SwipeGestureUpdate, SwipeGesture and SwipeGestureEnd events
* will carry the allowDirections value that was set on the SwipeStart
* event. Changing this field on non-SwipeGestureStart events doesn't
* will carry the allowDirections value that was set on the SwipeMayStart
* event. Changing this field on non-SwipeGestureMayStart events doesn't
* have any effect.
*/
attribute unsigned long allowedDirections;

View File

@ -33,8 +33,6 @@
#include "mozilla/dom/PCrashReporterChild.h"
#include "mozilla/dom/ProcessGlobal.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/asmjscache/AsmJSCache.h"
#include "mozilla/dom/asmjscache/PAsmJSCacheEntryChild.h"
#include "mozilla/dom/nsIContentChild.h"
#include "mozilla/psm/PSMContentListener.h"
#include "mozilla/hal_sandbox/PHalChild.h"
@ -1467,23 +1465,6 @@ ContentChild::DeallocPIccChild(PIccChild* aActor)
return true;
}
asmjscache::PAsmJSCacheEntryChild*
ContentChild::AllocPAsmJSCacheEntryChild(
const asmjscache::OpenMode& aOpenMode,
const asmjscache::WriteParams& aWriteParams,
const IPC::Principal& aPrincipal)
{
NS_NOTREACHED("Should never get here!");
return nullptr;
}
bool
ContentChild::DeallocPAsmJSCacheEntryChild(PAsmJSCacheEntryChild* aActor)
{
asmjscache::DeallocEntryChild(aActor);
return true;
}
PTestShellChild*
ContentChild::AllocPTestShellChild()
{

View File

@ -277,13 +277,6 @@ public:
virtual bool RecvNotifyPresentationReceiverLaunched(PBrowserChild* aIframe,
const nsString& aSessionId) override;
virtual PAsmJSCacheEntryChild* AllocPAsmJSCacheEntryChild(
const asmjscache::OpenMode& aOpenMode,
const asmjscache::WriteParams& aWriteParams,
const IPC::Principal& aPrincipal) override;
virtual bool DeallocPAsmJSCacheEntryChild(
PAsmJSCacheEntryChild* aActor) override;
virtual PSpeechSynthesisChild* AllocPSpeechSynthesisChild() override;
virtual bool DeallocPSpeechSynthesisChild(PSpeechSynthesisChild* aActor) override;

View File

@ -49,7 +49,6 @@
#include "mozilla/dom/PFMRadioParent.h"
#include "mozilla/dom/PMemoryReportRequestParent.h"
#include "mozilla/dom/ServiceWorkerRegistrar.h"
#include "mozilla/dom/asmjscache/AsmJSCache.h"
#include "mozilla/dom/bluetooth/PBluetoothParent.h"
#include "mozilla/dom/cellbroadcast/CellBroadcastParent.h"
#include "mozilla/dom/devicestorage/DeviceStorageRequestParent.h"
@ -3914,22 +3913,6 @@ ContentParent::RecvPPresentationConstructor(PPresentationParent* aActor)
return static_cast<PresentationParent*>(aActor)->Init();
}
asmjscache::PAsmJSCacheEntryParent*
ContentParent::AllocPAsmJSCacheEntryParent(
const asmjscache::OpenMode& aOpenMode,
const asmjscache::WriteParams& aWriteParams,
const IPC::Principal& aPrincipal)
{
return asmjscache::AllocEntryParent(aOpenMode, aWriteParams, aPrincipal);
}
bool
ContentParent::DeallocPAsmJSCacheEntryParent(PAsmJSCacheEntryParent* aActor)
{
asmjscache::DeallocEntryParent(aActor);
return true;
}
PSpeechSynthesisParent*
ContentParent::AllocPSpeechSynthesisParent()
{

View File

@ -667,13 +667,6 @@ private:
virtual bool DeallocPPresentationParent(PPresentationParent* aActor) override;
virtual bool RecvPPresentationConstructor(PPresentationParent* aActor) override;
virtual PAsmJSCacheEntryParent* AllocPAsmJSCacheEntryParent(
const asmjscache::OpenMode& aOpenMode,
const asmjscache::WriteParams& aWriteParams,
const IPC::Principal& aPrincipal) override;
virtual bool DeallocPAsmJSCacheEntryParent(
PAsmJSCacheEntryParent* aActor) override;
virtual PSpeechSynthesisParent* AllocPSpeechSynthesisParent() override;
virtual bool DeallocPSpeechSynthesisParent(PSpeechSynthesisParent* aActor) override;
virtual bool RecvPSpeechSynthesisConstructor(PSpeechSynthesisParent* aActor) override;

View File

@ -67,6 +67,7 @@ using struct LookAndFeelInt from "mozilla/widget/WidgetMessageUtils.h";
using struct mozilla::OwningSerializedStructuredCloneBuffer from "ipc/IPCMessageUtils.h";
using mozilla::EventMessage from "mozilla/EventForwards.h";
using nsEventStatus from "mozilla/EventForwards.h";
using nsSizeMode from "nsIWidgetListener.h";
namespace mozilla {
namespace dom {
@ -474,6 +475,13 @@ parent:
UpdateZoomConstraints(uint32_t aPresShellId, ViewID aViewId,
MaybeZoomConstraints aConstraints);
/**
* Tells the containing widget whether the given input block results in a
* swipe. Should be called in response to a WidgetWheelEvent that has
* mFlags.mCanTriggerSwipe set on it.
*/
RespondStartSwipeEvent(uint64_t aInputBlockId, bool aStartSwipe);
/**
* Brings up the auth prompt dialog.
* Called when this is the PBrowserParent for a nested remote iframe.
@ -579,7 +587,7 @@ child:
CacheFileDescriptor(nsString path, FileDescriptor fd);
UpdateDimensions(CSSRect rect, CSSSize size,
UpdateDimensions(CSSRect rect, CSSSize size, nsSizeMode sizeMode,
ScreenOrientationInternal orientation,
LayoutDeviceIntPoint chromeDisp) compressall;

View File

@ -4,7 +4,6 @@
* 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/. */
include protocol PAsmJSCacheEntry;
include protocol PBackground;
include protocol PBlob;
include protocol PBluetooth;
@ -81,8 +80,6 @@ using struct IPC::Permission from "mozilla/net/NeckoMessageUtils.h";
using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h";
using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
using mozilla::dom::asmjscache::OpenMode from "mozilla/dom/asmjscache/AsmJSCache.h";
using mozilla::dom::asmjscache::WriteParams from "mozilla/dom/asmjscache/AsmJSCache.h";
using mozilla::dom::NativeThreadId from "mozilla/dom/TabMessageUtils.h";
using mozilla::dom::quota::PersistenceType from "mozilla/dom/quota/PersistenceType.h";
using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h";
@ -421,7 +418,6 @@ prio(normal upto urgent) sync protocol PContent
parent opens PGMPService;
child opens PBackground;
manages PAsmJSCacheEntry;
manages PBlob;
manages PBluetooth;
manages PBrowser;
@ -783,8 +779,6 @@ parent:
PFMRadio();
PAsmJSCacheEntry(OpenMode openMode, WriteParams write, Principal principal);
PWebrtcGlobal();
PPresentation();

View File

@ -1724,6 +1724,7 @@ TabChild::RecvShow(const ScreenIntSize& aSize,
bool
TabChild::RecvUpdateDimensions(const CSSRect& rect, const CSSSize& size,
const nsSizeMode& sizeMode,
const ScreenOrientationInternal& orientation,
const LayoutDeviceIntPoint& chromeDisp)
{
@ -1750,6 +1751,7 @@ TabChild::RecvUpdateDimensions(const CSSRect& rect, const CSSSize& size,
baseWin->SetPositionAndSize(0, 0, screenSize.width, screenSize.height,
true);
mPuppetWidget->SetSizeMode(sizeMode);
mPuppetWidget->Resize(screenRect.x + chromeDisp.x,
screenRect.y + chromeDisp.y,
screenSize.width, screenSize.height, true);
@ -1956,6 +1958,9 @@ TabChild::RecvMouseWheelEvent(const WidgetWheelEvent& aEvent,
APZCCallbackHelper::DispatchWidgetEvent(event);
if (aEvent.mFlags.mHandledByAPZ) {
if (event.mCanTriggerSwipe) {
SendRespondStartSwipeEvent(aInputBlockId, event.TriggersSwipe());
}
mAPZEventState->ProcessWheelEvent(event, aGuid, aInputBlockId);
}
return true;
@ -2055,11 +2060,11 @@ TabChild::UpdateTapState(const WidgetTouchEvent& aEvent, nsEventStatus aStatus)
case NS_TOUCH_END:
if (!TouchManager::gPreventMouseEvents) {
APZCCallbackHelper::DispatchSynthesizedMouseEvent(
NS_MOUSE_MOVE, time, currentPoint, 0, mPuppetWidget);
eMouseMove, time, currentPoint, 0, mPuppetWidget);
APZCCallbackHelper::DispatchSynthesizedMouseEvent(
NS_MOUSE_BUTTON_DOWN, time, currentPoint, 0, mPuppetWidget);
eMouseDown, time, currentPoint, 0, mPuppetWidget);
APZCCallbackHelper::DispatchSynthesizedMouseEvent(
NS_MOUSE_BUTTON_UP, time, currentPoint, 0, mPuppetWidget);
eMouseUp, time, currentPoint, 0, mPuppetWidget);
}
// fall through
case NS_TOUCH_CANCEL:
@ -2231,7 +2236,7 @@ TabChild::RecvRealKeyEvent(const WidgetKeyboardEvent& event,
{
AutoCacheNativeKeyCommands autoCache(mPuppetWidget);
if (event.mMessage == NS_KEY_PRESS) {
if (event.mMessage == eKeyPress) {
// If content code called preventDefault() on a keydown event, then we don't
// want to process any following keypress events.
if (mIgnoreKeyPressEvent) {
@ -2251,7 +2256,7 @@ TabChild::RecvRealKeyEvent(const WidgetKeyboardEvent& event,
localEvent.widget = mPuppetWidget;
nsEventStatus status = APZCCallbackHelper::DispatchWidgetEvent(localEvent);
if (event.mMessage == NS_KEY_DOWN) {
if (event.mMessage == eKeyDown) {
mIgnoreKeyPressEvent = status == nsEventStatus_eConsumeNoDefault;
}

View File

@ -303,6 +303,7 @@ public:
const bool& aParentIsActive) override;
virtual bool RecvUpdateDimensions(const CSSRect& rect,
const CSSSize& size,
const nsSizeMode& sizeMode,
const ScreenOrientationInternal& orientation,
const LayoutDeviceIntPoint& chromeDisp) override;
virtual bool RecvUpdateFrame(const layers::FrameMetrics& aFrameMetrics) override;

View File

@ -95,6 +95,13 @@ struct ParamTraits<nsEventStatus>
nsEventStatus_eSentinel>
{ };
template<>
struct ParamTraits<nsSizeMode>
: public ContiguousEnumSerializer<nsSizeMode,
nsSizeMode_Normal,
nsSizeMode_Invalid>
{ };
} // namespace IPC
#endif

View File

@ -1059,7 +1059,9 @@ TabParent::UpdateDimensions(const nsIntRect& rect, const ScreenIntSize& size)
CSSRect unscaledRect = devicePixelRect / widgetScale;
CSSSize unscaledSize = devicePixelSize / widgetScale;
unused << SendUpdateDimensions(unscaledRect, unscaledSize, orientation, chromeOffset);
unused << SendUpdateDimensions(unscaledRect, unscaledSize,
widget->SizeMode(),
orientation, chromeOffset);
}
}
@ -1383,19 +1385,19 @@ bool TabParent::SendRealMouseEvent(WidgetMouseEvent& event)
if (widget) {
// When we mouseenter the tab, the tab's cursor should
// become the current cursor. When we mouseexit, we stop.
if (NS_MOUSE_ENTER_WIDGET == event.mMessage) {
if (eMouseEnterIntoWidget == event.mMessage) {
mTabSetsCursor = true;
if (mCustomCursor) {
widget->SetCursor(mCustomCursor, mCustomCursorHotspotX, mCustomCursorHotspotY);
} else if (mCursor != nsCursor(-1)) {
widget->SetCursor(mCursor);
}
} else if (NS_MOUSE_EXIT_WIDGET == event.mMessage) {
} else if (eMouseExitFromWidget == event.mMessage) {
mTabSetsCursor = false;
}
}
if (NS_MOUSE_MOVE == event.mMessage) {
if (eMouseMove == event.mMessage) {
if (event.reason == WidgetMouseEvent::eSynthesized) {
return SendSynthMouseMoveEvent(event);
} else {
@ -1741,7 +1743,7 @@ bool TabParent::SendRealKeyEvent(WidgetKeyboardEvent& event)
MaybeNativeKeyBinding bindings;
bindings = void_t();
if (event.mMessage == NS_KEY_PRESS) {
if (event.mMessage == eKeyPress) {
nsCOMPtr<nsIWidget> widget = GetWidget();
AutoInfallibleTArray<mozilla::CommandInt, 4> singleLine;
@ -2282,7 +2284,7 @@ TabParent::RecvDispatchAfterKeyboardEvent(const WidgetKeyboardEvent& aEvent)
if (mFrameElement &&
PresShell::BeforeAfterKeyboardEventEnabled() &&
localEvent.mMessage != NS_KEY_PRESS) {
localEvent.mMessage != eKeyPress) {
presShell->DispatchAfterKeyboardEvent(mFrameElement, localEvent,
aEvent.mFlags.mDefaultPrevented);
}
@ -2849,6 +2851,16 @@ TabParent::RecvUpdateZoomConstraints(const uint32_t& aPresShellId,
return true;
}
bool
TabParent::RecvRespondStartSwipeEvent(const uint64_t& aInputBlockId,
const bool& aStartSwipe)
{
if (nsCOMPtr<nsIWidget> widget = GetWidget()) {
widget->ReportSwipeStarted(aInputBlockId, aStartSwipe);
}
return true;
}
bool
TabParent::RecvContentReceivedInputBlock(const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId,

View File

@ -229,6 +229,8 @@ public:
virtual bool RecvUpdateZoomConstraints(const uint32_t& aPresShellId,
const ViewID& aViewId,
const MaybeZoomConstraints& aConstraints) override;
virtual bool RecvRespondStartSwipeEvent(const uint64_t& aInputBlockId,
const bool& aStartSwipe) override;
virtual bool RecvContentReceivedInputBlock(const ScrollableLayerGuid& aGuid,
const uint64_t& aInputBlockId,
const bool& aPreventDefault) override;

View File

@ -665,7 +665,6 @@ MediaFormatReader::RequestVideoData(bool aSkipToNextKeyframe,
media::TimeUnit timeThreshold{media::TimeUnit::FromMicroseconds(aTimeThreshold)};
if (ShouldSkip(aSkipToNextKeyframe, timeThreshold)) {
mVideo.mDecodingRequested = false;
Flush(TrackInfo::kVideoTrack);
nsRefPtr<VideoDataPromise> p = mVideo.mPromise.Ensure(__func__);
SkipVideoDemuxToNextKeyFrame(timeThreshold);
@ -1026,7 +1025,7 @@ MediaFormatReader::DecodeDemuxedSamples(TrackType aTrack,
decoder.mDecoder = nullptr;
if (sample->mKeyframe) {
decoder.mQueuedSamples.AppendElements(Move(samples));
ScheduleUpdate(aTrack);
NotifyDecodingRequested(aTrack);
} else {
MOZ_ASSERT(decoder.mTimeThreshold.isNothing());
LOG("Stream change occurred on a non-keyframe. Seeking to:%lld",
@ -1038,7 +1037,7 @@ MediaFormatReader::DecodeDemuxedSamples(TrackType aTrack,
[self, aTrack] (media::TimeUnit aTime) {
auto& decoder = self->GetDecoderData(aTrack);
decoder.mSeekRequest.Complete();
self->ScheduleUpdate(aTrack);
self->NotifyDecodingRequested(aTrack);
},
[self, aTrack] (DemuxerFailureReason aResult) {
auto& decoder = self->GetDecoderData(aTrack);

View File

@ -289,6 +289,7 @@ private:
mReceivedNewData = false;
mDiscontinuity = true;
mQueuedSamples.Clear();
mDecodingRequested = false;
mOutputRequested = false;
mInputExhausted = false;
mNeedDraining = false;

View File

@ -25,7 +25,11 @@
// For HTTP seeking, if number of bytes needing to be
// seeked forward is less than this value then a read is
// done rather than a byte range request.
static const int64_t SEEK_VS_READ_THRESHOLD = 32*1024;
//
// If we assume a 100Mbit connection, and assume reissuing an HTTP seek causes
// a delay of 200ms, then in that 200ms we could have simply read ahead 2MB. So
// setting SEEK_VS_READ_THRESHOLD to 1MB sounds reasonable.
static const int64_t SEEK_VS_READ_THRESHOLD = 1 * 1024 * 1024;
static const uint32_t HTTP_REQUESTED_RANGE_NOT_SATISFIABLE_CODE = 416;

View File

@ -97,7 +97,7 @@ TrackBuffersManager::TrackBuffersManager(dom::SourceBufferAttributes* aAttribute
, mAppendState(AppendState::WAITING_FOR_SEGMENT)
, mBufferFull(false)
, mFirstInitializationSegmentReceived(false)
, mNewSegmentStarted(false)
, mNewMediaSegmentStarted(false)
, mActiveTrack(false)
, mType(aType)
, mParser(ContainerParser::CreateForMIMEType(aType))
@ -656,12 +656,11 @@ TrackBuffersManager::SegmentParserLoop()
// This is a new initialization segment. Obsolete the old one.
RecreateParser(false);
}
mNewSegmentStarted = true;
continue;
}
if (mParser->IsMediaSegmentPresent(mInputBuffer)) {
SetAppendState(AppendState::PARSING_MEDIA_SEGMENT);
mNewSegmentStarted = true;
mNewMediaSegmentStarted = true;
continue;
}
// We have neither an init segment nor a media segment, this is either
@ -692,27 +691,40 @@ TrackBuffersManager::SegmentParserLoop()
RejectAppend(NS_ERROR_FAILURE, __func__);
return;
}
// 2. If the input buffer does not contain a complete media segment header yet, then jump to the need more data step below.
if (mParser->MediaHeaderRange().IsNull()) {
AppendDataToCurrentInputBuffer(mInputBuffer);
mInputBuffer = nullptr;
NeedMoreData();
return;
}
// We can't feed some demuxers (WebMDemuxer) with data that do not have
// monotonizally increasing timestamps. So we check if we have a
// discontinuity from the previous segment parsed.
// If so, recreate a new demuxer to ensure that the demuxer is only fed
// monotonically increasing data.
if (newData) {
if (mNewSegmentStarted && mLastParsedEndTime.isSome() &&
if (mNewMediaSegmentStarted) {
if (newData && mLastParsedEndTime.isSome() &&
start < mLastParsedEndTime.ref().ToMicroseconds()) {
MSE_DEBUG("Re-creating demuxer");
ResetDemuxingState();
return;
}
mNewSegmentStarted = false;
mLastParsedEndTime = Some(TimeUnit::FromMicroseconds(end));
if (newData || !mParser->MediaSegmentRange().IsNull()) {
if (mPendingInputBuffer) {
// We now have a complete media segment header. We can resume parsing
// the data.
AppendDataToCurrentInputBuffer(mPendingInputBuffer);
mPendingInputBuffer = nullptr;
}
mNewMediaSegmentStarted = false;
} else {
// We don't have any data to demux yet, stash aside the data.
// This also handles the case:
// 2. If the input buffer does not contain a complete media segment header yet, then jump to the need more data step below.
if (!mPendingInputBuffer) {
mPendingInputBuffer = mInputBuffer;
} else {
mPendingInputBuffer->AppendElements(*mInputBuffer);
}
mInputBuffer = nullptr;
NeedMoreData();
return;
}
}
// 3. If the input buffer contains one or more complete coded frames, then run the coded frame processing algorithm.
@ -849,6 +861,14 @@ TrackBuffersManager::OnDemuxerResetDone(nsresult)
MOZ_ASSERT(mAudioTracks.mDemuxer);
}
if (mPendingInputBuffer) {
// We had a partial media segment header stashed aside.
// Reparse its content so we can continue parsing the current input buffer.
int64_t start, end;
mParser->ParseStartAndEndTimestamps(mPendingInputBuffer, start, end);
mProcessedInput += mPendingInputBuffer->Length();
}
SegmentParserLoop();
}
@ -1293,6 +1313,9 @@ TrackBuffersManager::CompleteCodedFrameProcessing()
return;
}
mLastParsedEndTime = Some(std::max(mAudioTracks.mLastParsedEndTime,
mVideoTracks.mLastParsedEndTime));
// 6. Remove the media segment bytes from the beginning of the input buffer.
// Clear our demuxer from any already processed data.
// As we have handled a complete media segment, it is safe to evict all data
@ -1372,6 +1395,10 @@ TrackBuffersManager::ProcessFrames(TrackBuffer& aSamples, TrackData& aTrackData)
// a frame be ignored due to the target window.
bool needDiscontinuityCheck = true;
if (aSamples.Length()) {
aTrackData.mLastParsedEndTime = TimeUnit();
}
for (auto& sample : aSamples) {
SAMPLE_DEBUG("Processing %s frame(pts:%lld end:%lld, dts:%lld, duration:%lld, "
"kf:%d)",
@ -1382,6 +1409,12 @@ TrackBuffersManager::ProcessFrames(TrackBuffer& aSamples, TrackData& aTrackData)
sample->mDuration,
sample->mKeyframe);
const TimeUnit sampleEndTime =
TimeUnit::FromMicroseconds(sample->GetEndTime());
if (sampleEndTime > aTrackData.mLastParsedEndTime) {
aTrackData.mLastParsedEndTime = sampleEndTime;
}
// We perform step 10 right away as we can't do anything should a keyframe
// be needed until we have one.

View File

@ -153,7 +153,7 @@ private:
Atomic<bool> mBufferFull;
bool mFirstInitializationSegmentReceived;
// Set to true once a new segment is started.
bool mNewSegmentStarted;
bool mNewMediaSegmentStarted;
bool mActiveTrack;
Maybe<media::TimeUnit> mGroupStartTimestamp;
media::TimeUnit mGroupEndTimestamp;
@ -170,6 +170,11 @@ private:
// Demuxer objects and methods.
void AppendDataToCurrentInputBuffer(MediaByteBuffer* aData);
nsRefPtr<MediaByteBuffer> mInitData;
// Temporary input buffer to handle partial media segment header.
// We store the current input buffer content into it should we need to
// reinitialize the demuxer once we have some samples and a discontinuity is
// detected.
nsRefPtr<MediaByteBuffer> mPendingInputBuffer;
nsRefPtr<SourceBufferResource> mCurrentInputBuffer;
nsRefPtr<MediaDataDemuxer> mInputDemuxer;
// Length already processed in current media segment.
@ -235,6 +240,9 @@ private:
bool mNeedRandomAccessPoint;
nsRefPtr<MediaTrackDemuxer> mDemuxer;
MozPromiseRequestHolder<MediaTrackDemuxer::SamplesPromise> mDemuxRequest;
// Highest end timestamp of the last media segment demuxed.
media::TimeUnit mLastParsedEndTime;
// If set, position where the next contiguous frame will be inserted.
// If a discontinuity is detected, it will be unset and recalculated upon
// the next insertion.

View File

@ -38,6 +38,7 @@ support-files =
[test_BufferedSeek_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac")) # Only supported on osx and vista+
[test_BufferingWait.html]
skip-if = toolkit == 'android' #timeout android bug 1199531
[test_BufferingWait_mp4.html]
skip-if = ((os == "win" && os_version == "5.1") || (os != "win" && os != "mac") || (os == "win" && os_version == "6.1")) # Only supported on osx and vista+, disabling on win7 bug 1191138
[test_EndOfStream.html]

View File

@ -72,9 +72,9 @@ skip-if = toolkit == 'gonk' || buildapp == 'mulet' || (android_version == '18' &
[test_peerConnection_basicAudioVideoNoBundle.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' || (android_version == '18' && debug) # b2g(Bug 960442, video support for WebRTC is disabled on b2g), android(Bug 1189784, timeouts on 4.3 emulator)
[test_peerConnection_basicAudioVideoNoBundleNoRtcpMux.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
skip-if = toolkit == 'gonk' || buildapp == 'mulet' || android_version == '18' # b2g(Bug 960442, video support for WebRTC is disabled on b2g), android(Bug 1189784, timeouts on 4.3 emulator)
[test_peerConnection_basicAudioVideoNoRtcpMux.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
skip-if = toolkit == 'gonk' || buildapp == 'mulet' || android_version == '18' # b2g(Bug 960442, video support for WebRTC is disabled on b2g), android(Bug 1189784, timeouts on 4.3 emulator)
[test_peerConnection_basicVideo.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
[test_peerConnection_basicScreenshare.html]
@ -170,7 +170,7 @@ skip-if = toolkit == 'gonk' || (android_version == '18' && debug) # B2G emulator
skip-if = toolkit == 'gonk' || (android_version == '18' && debug) # B2G emulator is too slow to finish a renegotiation test in under 5 minutes, android(Bug 1189784, timeouts on 4.3 emulator)
[test_peerConnection_addSecondVideoStream.html]
# B2G emulator is too slow to finish a renegotiation test in under 5 minutes, Bug 1180000 for Linux debug e10s, android(Bug 1189784, timeouts on 4.3 emulator)
skip-if = toolkit == 'gonk' || (os == 'linux' && debug && e10s) || (android_version == '18' && debug)
skip-if = toolkit == 'gonk' || (os == 'linux' && debug && e10s) || android_version == '18'
[test_peerConnection_removeVideoTrack.html]
# B2G emulator is too slow to finish a renegotiation test in under 5 minutes, Bug 1180000 for Linux debug e10s, android(Bug 1189784, timeouts on 4.3 emulator)
skip-if = toolkit == 'gonk' || (os == 'linux' && debug && e10s) || (android_version == '18' && debug)

View File

@ -1683,7 +1683,7 @@ nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent,
aMouseEvent->StopPropagation();
}
}
if (mouseEvent->mMessage == NS_MOUSE_BUTTON_UP) {
if (mouseEvent->mMessage == eMouseUp) {
mLastMouseDownButtonType = -1;
}
}
@ -1808,12 +1808,11 @@ CocoaEventTypeForEvent(const WidgetGUIEvent& anEvent, nsIFrame* aObjectFrame)
}
switch (anEvent.mMessage) {
case NS_MOUSE_OVER:
case eMouseOver:
return NPCocoaEventMouseEntered;
case NS_MOUSE_OUT:
case eMouseOut:
return NPCocoaEventMouseExited;
case NS_MOUSE_MOVE:
{
case eMouseMove: {
// We don't know via information on events from the widget code whether or not
// we're dragging. The widget code just generates mouse move events from native
// drag events. If anybody is capturing, this is a drag event.
@ -1823,13 +1822,13 @@ CocoaEventTypeForEvent(const WidgetGUIEvent& anEvent, nsIFrame* aObjectFrame)
return NPCocoaEventMouseMoved;
}
case NS_MOUSE_BUTTON_DOWN:
case eMouseDown:
return NPCocoaEventMouseDown;
case NS_MOUSE_BUTTON_UP:
case eMouseUp:
return NPCocoaEventMouseUp;
case NS_KEY_DOWN:
case eKeyDown:
return NPCocoaEventKeyDown;
case NS_KEY_UP:
case eKeyUp:
return NPCocoaEventKeyUp;
case NS_FOCUS_CONTENT:
case NS_BLUR_CONTENT:
@ -1848,12 +1847,12 @@ TranslateToNPCocoaEvent(WidgetGUIEvent* anEvent, nsIFrame* aObjectFrame)
InitializeNPCocoaEvent(&cocoaEvent);
cocoaEvent.type = CocoaEventTypeForEvent(*anEvent, aObjectFrame);
if (anEvent->mMessage == NS_MOUSE_MOVE ||
anEvent->mMessage == NS_MOUSE_BUTTON_DOWN ||
anEvent->mMessage == NS_MOUSE_BUTTON_UP ||
if (anEvent->mMessage == eMouseMove ||
anEvent->mMessage == eMouseDown ||
anEvent->mMessage == eMouseUp ||
anEvent->mMessage == NS_MOUSE_SCROLL ||
anEvent->mMessage == NS_MOUSE_OVER ||
anEvent->mMessage == NS_MOUSE_OUT)
anEvent->mMessage == eMouseOver ||
anEvent->mMessage == eMouseOut)
{
nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(anEvent, aObjectFrame) -
aObjectFrame->GetContentRectRelativeToSelf().TopLeft();
@ -1870,9 +1869,8 @@ TranslateToNPCocoaEvent(WidgetGUIEvent* anEvent, nsIFrame* aObjectFrame)
}
switch (anEvent->mMessage) {
case NS_MOUSE_BUTTON_DOWN:
case NS_MOUSE_BUTTON_UP:
{
case eMouseDown:
case eMouseUp: {
WidgetMouseEvent* mouseEvent = anEvent->AsMouseEvent();
if (mouseEvent) {
switch (mouseEvent->button) {
@ -1890,7 +1888,7 @@ TranslateToNPCocoaEvent(WidgetGUIEvent* anEvent, nsIFrame* aObjectFrame)
}
cocoaEvent.data.mouse.clickCount = mouseEvent->clickCount;
} else {
NS_WARNING("NS_MOUSE_BUTTON_UP/DOWN is not a WidgetMouseEvent?");
NS_WARNING("eMouseUp/DOWN is not a WidgetMouseEvent?");
}
break;
}
@ -1905,14 +1903,14 @@ TranslateToNPCocoaEvent(WidgetGUIEvent* anEvent, nsIFrame* aObjectFrame)
}
break;
}
case NS_KEY_DOWN:
case NS_KEY_UP:
case eKeyDown:
case eKeyUp:
{
WidgetKeyboardEvent* keyEvent = anEvent->AsKeyboardEvent();
// That keyEvent->mPluginTextEventString is non-empty is a signal that we should
// create a text event for the plugin, instead of a key event.
if (anEvent->mMessage == NS_KEY_DOWN &&
if (anEvent->mMessage == eKeyDown &&
!keyEvent->mPluginTextEventString.IsEmpty()) {
cocoaEvent.type = NPCocoaEventTextInput;
const char16_t* pluginTextEventString = keyEvent->mPluginTextEventString.get();
@ -2042,7 +2040,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
}
bool handled = (response == kNPEventHandled || response == kNPEventStartIME);
bool leftMouseButtonDown = (anEvent.mMessage == NS_MOUSE_BUTTON_DOWN) &&
bool leftMouseButtonDown = (anEvent.mMessage == eMouseDown) &&
(anEvent.AsMouseEvent()->button == WidgetMouseEvent::eLeftButton);
if (handled && !(leftMouseButtonDown && !mContentFocused)) {
rv = nsEventStatus_eConsumeNoDefault;
@ -2062,10 +2060,10 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
pluginEvent.event = 0;
const WidgetMouseEvent* mouseEvent = anEvent.AsMouseEvent();
switch (anEvent.mMessage) {
case NS_MOUSE_MOVE:
case eMouseMove:
pluginEvent.event = WM_MOUSEMOVE;
break;
case NS_MOUSE_BUTTON_DOWN: {
case eMouseDown: {
static const int downMsgs[] =
{ WM_LBUTTONDOWN, WM_MBUTTONDOWN, WM_RBUTTONDOWN };
static const int dblClickMsgs[] =
@ -2077,13 +2075,13 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
}
break;
}
case NS_MOUSE_BUTTON_UP: {
case eMouseUp: {
static const int upMsgs[] =
{ WM_LBUTTONUP, WM_MBUTTONUP, WM_RBUTTONUP };
pluginEvent.event = upMsgs[mouseEvent->button];
break;
}
// don't synthesize anything for NS_MOUSE_DOUBLECLICK, since that
// don't synthesize anything for eMouseDoubleClick, since that
// is a synthetic event generated on mouse-up, and Windows WM_*DBLCLK
// messages are sent on mouse-down
default:
@ -2106,12 +2104,12 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
// not the widget they were received on.
// See use of NPEvent in widget/windows/nsWindow.cpp
// for why this assert should be safe
NS_ASSERTION(anEvent.mMessage == NS_MOUSE_BUTTON_DOWN ||
anEvent.mMessage == NS_MOUSE_BUTTON_UP ||
anEvent.mMessage == NS_MOUSE_DOUBLECLICK ||
anEvent.mMessage == NS_MOUSE_OVER ||
anEvent.mMessage == NS_MOUSE_OUT ||
anEvent.mMessage == NS_MOUSE_MOVE,
NS_ASSERTION(anEvent.mMessage == eMouseDown ||
anEvent.mMessage == eMouseUp ||
anEvent.mMessage == eMouseDoubleClick ||
anEvent.mMessage == eMouseOver ||
anEvent.mMessage == eMouseOut ||
anEvent.mMessage == eMouseMove,
"Incorrect event type for coordinate translation");
nsPoint pt =
nsLayoutUtils::GetEventCoordinatesRelativeTo(&anEvent, mPluginFrame) -
@ -2167,10 +2165,9 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
switch(anEvent.mClass) {
case eMouseEventClass:
{
switch (anEvent.mMessage)
{
case NS_MOUSE_CLICK:
case NS_MOUSE_DOUBLECLICK:
switch (anEvent.mMessage) {
case eMouseClick:
case eMouseDoubleClick:
// Button up/down events sent instead.
return rv;
default:
@ -2197,13 +2194,12 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
Window root = None; // Could XQueryTree, but this is not important.
#endif
switch (anEvent.mMessage)
{
case NS_MOUSE_OVER:
case NS_MOUSE_OUT:
switch (anEvent.mMessage) {
case eMouseOver:
case eMouseOut:
{
XCrossingEvent& event = pluginEvent.xcrossing;
event.type = anEvent.mMessage == NS_MOUSE_OVER ?
event.type = anEvent.mMessage == eMouseOver ?
EnterNotify : LeaveNotify;
event.root = root;
event.time = anEvent.time;
@ -2220,7 +2216,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
event.focus = mContentFocused;
}
break;
case NS_MOUSE_MOVE:
case eMouseMove:
{
XMotionEvent& event = pluginEvent.xmotion;
event.type = MotionNotify;
@ -2237,11 +2233,11 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
event.same_screen = True;
}
break;
case NS_MOUSE_BUTTON_DOWN:
case NS_MOUSE_BUTTON_UP:
case eMouseDown:
case eMouseUp:
{
XButtonEvent& event = pluginEvent.xbutton;
event.type = anEvent.mMessage == NS_MOUSE_BUTTON_DOWN ?
event.type = anEvent.mMessage == eMouseDown ?
ButtonPress : ButtonRelease;
event.root = root;
event.time = anEvent.time;
@ -2288,16 +2284,16 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
event.state = gdkEvent->state;
switch (anEvent.mMessage)
{
case NS_KEY_DOWN:
// Handle NS_KEY_DOWN for modifier key presses
// For non-modifiers we get NS_KEY_PRESS
case eKeyDown:
// Handle eKeyDown for modifier key presses
// For non-modifiers we get eKeyPress
if (gdkEvent->is_modifier)
event.type = XKeyPress;
break;
case NS_KEY_PRESS:
case eKeyPress:
event.type = XKeyPress;
break;
case NS_KEY_UP:
case eKeyUp:
event.type = KeyRelease;
break;
default:
@ -2374,10 +2370,9 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
switch(anEvent.mClass) {
case eMouseEventClass:
{
switch (anEvent.mMessage)
{
case NS_MOUSE_CLICK:
case NS_MOUSE_DOUBLECLICK:
switch (anEvent.mMessage) {
case eMouseClick:
case eMouseDoubleClick:
// Button up/down events sent instead.
return rv;
default:
@ -2392,16 +2387,15 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
nsIntPoint pluginPoint(presContext->AppUnitsToDevPixels(appPoint.x),
presContext->AppUnitsToDevPixels(appPoint.y));
switch (anEvent.mMessage)
{
case NS_MOUSE_MOVE:
switch (anEvent.mMessage) {
case eMouseMove:
{
// are these going to be touch events?
// pluginPoint.x;
// pluginPoint.y;
}
break;
case NS_MOUSE_BUTTON_DOWN:
case eMouseDown:
{
ANPEvent event;
event.inSize = sizeof(ANPEvent);
@ -2412,7 +2406,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
mInstance->HandleEvent(&event, nullptr, NS_PLUGIN_CALL_SAFE_TO_REENTER_GECKO);
}
break;
case NS_MOUSE_BUTTON_UP:
case eMouseUp:
{
ANPEvent event;
event.inSize = sizeof(ANPEvent);

View File

@ -196,7 +196,7 @@ static LRESULT CALLBACK PluginWndProcInternal(HWND hWnd, UINT msg, WPARAM wParam
if (!win)
return TRUE;
// The DispatchEvent(NS_PLUGIN_ACTIVATE) below can trigger a reentrant focus
// The DispatchEvent(ePluginActivate) below can trigger a reentrant focus
// event which might destroy us. Hold a strong ref on the plugin instance
// to prevent that, bug 374229.
nsRefPtr<nsNPAPIPluginInstance> inst;
@ -271,7 +271,7 @@ static LRESULT CALLBACK PluginWndProcInternal(HWND hWnd, UINT msg, WPARAM wParam
nsCOMPtr<nsIWidget> widget;
win->GetPluginWidget(getter_AddRefs(widget));
if (widget) {
WidgetGUIEvent event(true, NS_PLUGIN_ACTIVATE, widget);
WidgetGUIEvent event(true, ePluginActivate, widget);
nsEventStatus status;
widget->DispatchEvent(&event, status);
}

View File

@ -565,6 +565,10 @@ PluginAsyncSurrogate::NotifyAsyncInitFailed()
}
mPendingNewStreamCalls.Clear();
// Make sure that any WaitForInit calls on this surrogate will fail, or else
// we'll be perma-blocked
mInitCancelled = true;
nsNPAPIPluginInstance* inst =
static_cast<nsNPAPIPluginInstance*>(mInstance->ndata);
if (!inst) {

View File

@ -412,7 +412,8 @@ nsPreflightCache::GetCacheKey(nsIURI* aURI,
NS_IMPL_ISUPPORTS(nsCORSListenerProxy, nsIStreamListener,
nsIRequestObserver, nsIChannelEventSink,
nsIInterfaceRequestor, nsIAsyncVerifyRedirectCallback)
nsIInterfaceRequestor, nsIAsyncVerifyRedirectCallback,
nsIThreadRetargetableStreamListener)
/* static */
void
@ -675,11 +676,15 @@ nsCORSListenerProxy::OnStopRequest(nsIRequest* aRequest,
NS_IMETHODIMP
nsCORSListenerProxy::OnDataAvailable(nsIRequest* aRequest,
nsISupports* aContext,
nsISupports* aContext,
nsIInputStream* aInputStream,
uint64_t aOffset,
uint32_t aCount)
{
// NB: This can be called on any thread! But we're guaranteed that it is
// called between OnStartRequest and OnStopRequest, so we don't need to worry
// about races.
MOZ_ASSERT(mInited, "nsCORSListenerProxy has not been initialized properly");
if (!mRequestApproved) {
return NS_ERROR_DOM_BAD_URI;
@ -826,6 +831,19 @@ nsCORSListenerProxy::OnRedirectVerifyCallback(nsresult result)
return NS_OK;
}
NS_IMETHODIMP
nsCORSListenerProxy::CheckListenerChain()
{
MOZ_ASSERT(NS_IsMainThread());
if (nsCOMPtr<nsIThreadRetargetableStreamListener> retargetableListener =
do_QueryInterface(mOuterListener)) {
return retargetableListener->CheckListenerChain();
}
return NS_ERROR_NO_INTERFACE;
}
// Please note that the CSP directive 'upgrade-insecure-requests' relies
// on the promise that channels get updated from http: to https: before
// the channel fetches any data from the netwerk. Such channels should
@ -1263,7 +1281,6 @@ nsCORSPreflightListener::GetInterface(const nsIID & aIID, void **aResult)
return QueryInterface(aIID, aResult);
}
nsresult
NS_StartCORSPreflight(nsIChannel* aRequestChannel,
nsIStreamListener* aListener,

View File

@ -16,6 +16,7 @@
#include "nsIInterfaceRequestor.h"
#include "nsIChannelEventSink.h"
#include "nsIAsyncVerifyRedirectCallback.h"
#include "nsIThreadRetargetableStreamListener.h"
#include "mozilla/Attributes.h"
class nsIURI;
@ -39,7 +40,8 @@ enum class DataURIHandling
class nsCORSListenerProxy final : public nsIStreamListener,
public nsIInterfaceRequestor,
public nsIChannelEventSink,
public nsIAsyncVerifyRedirectCallback
public nsIAsyncVerifyRedirectCallback,
public nsIThreadRetargetableStreamListener
{
public:
nsCORSListenerProxy(nsIStreamListener* aOuter,
@ -57,6 +59,7 @@ public:
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSICHANNELEVENTSINK
NS_DECL_NSIASYNCVERIFYREDIRECTCALLBACK
NS_DECL_NSITHREADRETARGETABLESTREAMLISTENER
// Must be called at startup.
static void Startup();

View File

@ -17,7 +17,7 @@ TimeEvent::TimeEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
InternalSMILTimeEvent* aEvent)
: Event(aOwner, aPresContext,
aEvent ? aEvent : new InternalSMILTimeEvent(false, NS_EVENT_NULL))
aEvent ? aEvent : new InternalSMILTimeEvent(false, eVoidEvent))
, mDetail(mEvent->AsSMILTimeEvent()->detail)
{
if (aEvent) {

View File

@ -1265,8 +1265,8 @@ nsXULElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
aVisitor.mForceContentDispatch = true; //FIXME! Bug 329119
if (IsRootOfNativeAnonymousSubtree() &&
(IsAnyOfXULElements(nsGkAtoms::scrollbar, nsGkAtoms::scrollcorner)) &&
(aVisitor.mEvent->mMessage == NS_MOUSE_CLICK ||
aVisitor.mEvent->mMessage == NS_MOUSE_DOUBLECLICK ||
(aVisitor.mEvent->mMessage == eMouseClick ||
aVisitor.mEvent->mMessage == eMouseDoubleClick ||
aVisitor.mEvent->mMessage == NS_XUL_COMMAND ||
aVisitor.mEvent->mMessage == NS_CONTEXTMENU ||
aVisitor.mEvent->mMessage == NS_DRAGDROP_START ||
@ -1740,11 +1740,11 @@ nsXULElement::ClickWithInputSource(uint16_t aInputSource)
bool isCallerChrome = nsContentUtils::IsCallerChrome();
WidgetMouseEvent eventDown(isCallerChrome, NS_MOUSE_BUTTON_DOWN,
WidgetMouseEvent eventDown(isCallerChrome, eMouseDown,
nullptr, WidgetMouseEvent::eReal);
WidgetMouseEvent eventUp(isCallerChrome, NS_MOUSE_BUTTON_UP,
WidgetMouseEvent eventUp(isCallerChrome, eMouseUp,
nullptr, WidgetMouseEvent::eReal);
WidgetMouseEvent eventClick(isCallerChrome, NS_MOUSE_CLICK, nullptr,
WidgetMouseEvent eventClick(isCallerChrome, eMouseClick, nullptr,
WidgetMouseEvent::eReal);
eventDown.inputSource = eventUp.inputSource = eventClick.inputSource
= aInputSource;

View File

@ -4695,7 +4695,7 @@ nsEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
WidgetKeyboardEvent* nativeKeyEvent =
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
NS_ENSURE_TRUE(nativeKeyEvent, NS_ERROR_UNEXPECTED);
NS_ASSERTION(nativeKeyEvent->mMessage == NS_KEY_PRESS,
NS_ASSERTION(nativeKeyEvent->mMessage == eKeyPress,
"HandleKeyPressEvent gets non-keypress event");
// if we are readonly or disabled, then do nothing.

View File

@ -392,23 +392,23 @@ nsEditorEventListener::HandleEvent(nsIDOMEvent* aEvent)
}
#ifdef HANDLE_NATIVE_TEXT_DIRECTION_SWITCH
// keydown
case NS_KEY_DOWN: {
case eKeyDown: {
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aEvent);
return KeyDown(keyEvent);
}
// keyup
case NS_KEY_UP: {
case eKeyUp: {
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aEvent);
return KeyUp(keyEvent);
}
#endif // #ifdef HANDLE_NATIVE_TEXT_DIRECTION_SWITCH
// keypress
case NS_KEY_PRESS: {
case eKeyPress: {
nsCOMPtr<nsIDOMKeyEvent> keyEvent = do_QueryInterface(aEvent);
return KeyPress(keyEvent);
}
// mousedown
case NS_MOUSE_BUTTON_DOWN: {
case eMouseDown: {
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);
NS_ENSURE_TRUE(mouseEvent, NS_OK);
// nsEditorEventListener may receive (1) all mousedown, mouseup and click
@ -422,26 +422,26 @@ nsEditorEventListener::HandleEvent(nsIDOMEvent* aEvent)
return mMouseDownOrUpConsumedByIME ? NS_OK : MouseDown(mouseEvent);
}
// mouseup
case NS_MOUSE_BUTTON_UP: {
case eMouseUp: {
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);
NS_ENSURE_TRUE(mouseEvent, NS_OK);
// See above comment in the NS_MOUSE_BUTTON_DOWN case, first.
// See above comment in the eMouseDown case, first.
// This code assumes that case #1 is occuring. However, if case #3 may
// occurs after case #2 and the mousedown is consumed,
// mMouseDownOrUpConsumedByIME is true even though nsEditorEventListener
// has not received the preceding mousedown event of this mouseup event.
// So, mMouseDownOrUpConsumedByIME may be invalid here. However,
// this is not a matter because mMouseDownOrUpConsumedByIME is referred
// only by NS_MOUSE_CLICK case but click event is fired only in case #1.
// only by eMouseClick case but click event is fired only in case #1.
// So, before a click event is fired, mMouseDownOrUpConsumedByIME is
// always initialized in the NS_MOUSE_BUTTON_DOWN case if it's referred.
// always initialized in the eMouseDown case if it's referred.
if (NotifyIMEOfMouseButtonEvent(mouseEvent)) {
mMouseDownOrUpConsumedByIME = true;
}
return mMouseDownOrUpConsumedByIME ? NS_OK : MouseUp(mouseEvent);
}
// click
case NS_MOUSE_CLICK: {
case eMouseClick: {
nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aEvent);
NS_ENSURE_TRUE(mouseEvent, NS_OK);
// If the preceding mousedown event or mouseup event was consumed,

View File

@ -594,7 +594,7 @@ nsHTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
WidgetKeyboardEvent* nativeKeyEvent =
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
NS_ENSURE_TRUE(nativeKeyEvent, NS_ERROR_UNEXPECTED);
NS_ASSERTION(nativeKeyEvent->mMessage == NS_KEY_PRESS,
NS_ASSERTION(nativeKeyEvent->mMessage == eKeyPress,
"HandleKeyPressEvent gets non-keypress event");
switch (nativeKeyEvent->keyCode) {

View File

@ -362,7 +362,7 @@ nsPlaintextEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
WidgetKeyboardEvent* nativeKeyEvent =
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
NS_ENSURE_TRUE(nativeKeyEvent, NS_ERROR_UNEXPECTED);
NS_ASSERTION(nativeKeyEvent->mMessage == NS_KEY_PRESS,
NS_ASSERTION(nativeKeyEvent->mMessage == eKeyPress,
"HandleKeyPressEvent gets non-keypress event");
switch (nativeKeyEvent->keyCode) {

View File

@ -70,30 +70,23 @@ AxisPhysicsMSDModel::SetDestination(double aDestination)
}
bool
AxisPhysicsMSDModel::IsFinished()
AxisPhysicsMSDModel::IsFinished(double aSmallestVisibleIncrement)
{
// In order to satisfy the condition of reaching the destination, the distance
// between the simulation position and the destination must be less than
// kFinishDistance while the speed is simultaneously less than
// kFinishVelocity. This enables an under-damped system to overshoot the
// aSmallestVisibleIncrement while the speed is simultaneously less than
// finishVelocity. This enables an under-damped system to overshoot the
// destination when desired without prematurely triggering the finished state.
// As the number of app units per css pixel is 60 and retina / HiDPI displays
// may display two pixels for every css pixel, setting kFinishDistance to 30.0
// ensures that there will be no perceptable shift in position at the end
// of the animation.
const double kFinishDistance = 30.0;
// If kFinishVelocity is set too low, the animation may end long after
// If finishVelocity is set too low, the animation may end long after
// oscillation has finished, resulting in unnecessary processing.
// If set too high, the animation may prematurely terminate when expected
// to overshoot the destination in an under-damped system.
// 60.0 was selected through experimentation that revealed that a
// critically damped system will terminate within 100ms.
const double kFinishVelocity = 60.0;
// aSmallestVisibleIncrement * 2 was selected through experimentation that
// revealed that a critically damped system will terminate within 100ms.
const double finishVelocity = aSmallestVisibleIncrement * 2;
return fabs(mDestination - GetPosition ()) < kFinishDistance
&& fabs(GetVelocity()) <= kFinishVelocity;
return fabs(mDestination - GetPosition ()) < aSmallestVisibleIncrement
&& fabs(GetVelocity()) <= finishVelocity;
}
} // namespace layers

View File

@ -38,7 +38,7 @@ public:
* Returns true when the position is close to the destination and the
* velocity is low.
*/
bool IsFinished();
bool IsFinished(double aSmallestVisibleIncrement);
protected:
virtual double Acceleration(const State &aState);

View File

@ -874,7 +874,7 @@ APZCTreeManager::UpdateWheelTransaction(WidgetInputEvent& aEvent)
}
switch (aEvent.mMessage) {
case NS_MOUSE_MOVE:
case eMouseMove:
case NS_DRAGDROP_OVER: {
WidgetMouseEvent* mouseEvent = aEvent.AsMouseEvent();
if (!mouseEvent->IsReal()) {
@ -886,13 +886,13 @@ APZCTreeManager::UpdateWheelTransaction(WidgetInputEvent& aEvent)
txn->OnMouseMove(point);
return;
}
case NS_KEY_PRESS:
case NS_KEY_UP:
case NS_KEY_DOWN:
case NS_MOUSE_BUTTON_UP:
case NS_MOUSE_BUTTON_DOWN:
case NS_MOUSE_DOUBLECLICK:
case NS_MOUSE_CLICK:
case eKeyPress:
case eKeyUp:
case eKeyDown:
case eMouseUp:
case eMouseDown:
case eMouseDoubleClick:
case eMouseClick:
case NS_CONTEXTMENU:
case NS_DRAGDROP_DROP:
txn->EndTransaction();

View File

@ -695,7 +695,10 @@ public:
* or false if the smooth scroll has ended.
*/
bool DoSample(FrameMetrics& aFrameMetrics, const TimeDuration& aDelta) {
if (mXAxisModel.IsFinished() && mYAxisModel.IsFinished()) {
nsPoint oneParentLayerPixel =
CSSPoint::ToAppUnits(ParentLayerPoint(1, 1) / aFrameMetrics.GetZoom());
if (mXAxisModel.IsFinished(oneParentLayerPixel.x) &&
mYAxisModel.IsFinished(oneParentLayerPixel.y)) {
return false;
}
@ -712,12 +715,12 @@ public:
// Keep the velocity updated for the Axis class so that any animations
// chained off of the smooth scroll will inherit it.
if (mXAxisModel.IsFinished()) {
if (mXAxisModel.IsFinished(oneParentLayerPixel.x)) {
mApzc.mX.SetVelocity(0);
} else {
mApzc.mX.SetVelocity(velocity.x);
}
if (mYAxisModel.IsFinished()) {
if (mYAxisModel.IsFinished(oneParentLayerPixel.y)) {
mApzc.mY.SetVelocity(0);
} else {
mApzc.mY.SetVelocity(velocity.y);

View File

@ -426,6 +426,7 @@ PanGestureBlockState::PanGestureBlockState(const nsRefPtr<AsyncPanZoomController
const PanGestureInput& aInitialEvent)
: CancelableBlockState(aTargetApzc, aTargetConfirmed)
, mInterrupted(false)
, mWaitingForContentResponse(false)
{
if (aTargetConfirmed) {
// Find the nearest APZC in the overscroll handoff chain that is scrollable.
@ -509,7 +510,22 @@ PanGestureBlockState::SetContentResponse(bool aPreventDefault)
if (aPreventDefault) {
mInterrupted = true;
}
return CancelableBlockState::SetContentResponse(aPreventDefault);
bool stateChanged = CancelableBlockState::SetContentResponse(aPreventDefault);
if (mWaitingForContentResponse) {
mWaitingForContentResponse = false;
stateChanged = true;
}
return stateChanged;
}
bool
PanGestureBlockState::IsReadyForHandling() const
{
if (!CancelableBlockState::IsReadyForHandling()) {
return false;
}
return !mWaitingForContentResponse ||
IsContentResponseTimerExpired();
}
bool
@ -518,6 +534,12 @@ PanGestureBlockState::AllowScrollHandoff() const
return false;
}
void
PanGestureBlockState::SetNeedsToWaitForContentResponse(bool aWaitForContentResponse)
{
mWaitingForContentResponse = aWaitForContentResponse;
}
TouchBlockState::TouchBlockState(const nsRefPtr<AsyncPanZoomController>& aTargetApzc,
bool aTargetConfirmed, TouchCounter& aCounter)
: CancelableBlockState(aTargetApzc, aTargetConfirmed)

Some files were not shown because too many files have changed in this diff Show More