Merge mozilla-central and inbound

This commit is contained in:
Ed Morley 2013-10-01 12:01:45 +01:00
commit 169446466e
139 changed files with 1215 additions and 1045 deletions

View File

@ -766,7 +766,7 @@ public:
* will be respected.
*/
static nsresult DispatchClickEvent(nsPresContext* aPresContext,
nsInputEvent* aSourceEvent,
WidgetInputEvent* aSourceEvent,
nsIContent* aTarget,
bool aFullDispatch,
const EventFlags* aFlags,

View File

@ -1391,8 +1391,9 @@ public:
* @param aCandidates [out] the candidate access key list.
* the first item is most preferred.
*/
static void GetAccessKeyCandidates(nsKeyEvent* aNativeKeyEvent,
nsTArray<uint32_t>& aCandidates);
static void GetAccessKeyCandidates(
mozilla::WidgetKeyboardEvent* aNativeKeyEvent,
nsTArray<uint32_t>& aCandidates);
/**
* Hide any XUL popups associated with aDocument, including any documents
@ -1406,9 +1407,9 @@ public:
static already_AddRefed<nsIDragSession> GetDragSession();
/*
* Initialize and set the dataTransfer field of an nsDragEvent.
* Initialize and set the dataTransfer field of an WidgetDragEvent.
*/
static nsresult SetDataTransferInEvent(nsDragEvent* aDragEvent);
static nsresult SetDataTransferInEvent(mozilla::WidgetDragEvent* aDragEvent);
// filters the drag and drop action to fit within the effects allowed and
// returns it.
@ -1419,7 +1420,7 @@ public:
* an ancestor of the document for the source of the drag.
*/
static bool CheckForSubFrameDrop(nsIDragSession* aDragSession,
nsDragEvent* aDropEvent);
mozilla::WidgetDragEvent* aDropEvent);
/**
* Return true if aURI is a local file URI (i.e. file://).

View File

@ -23,7 +23,7 @@ template<class T> class nsTArray;
[ptr] native nsIFrame(nsIFrame);
[ptr] native RangeArray(nsTArray<nsRange*>);
[ref] native constTextRangeStyleRef(const nsTextRangeStyle);
[ref] native constTextRangeStyleRef(const mozilla::TextRangeStyle);
[ref] native nsPointRef(nsPoint);
native nsDirection(nsDirection);
native ScrollAxis(nsIPresShell::ScrollAxis);

View File

@ -1431,7 +1431,7 @@ Element::DispatchEvent(nsPresContext* aPresContext,
/* static */
nsresult
Element::DispatchClickEvent(nsPresContext* aPresContext,
nsInputEvent* aSourceEvent,
WidgetInputEvent* aSourceEvent,
nsIContent* aTarget,
bool aFullDispatch,
const EventFlags* aExtraEventFlags,
@ -2245,7 +2245,8 @@ Element::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
case NS_MOUSE_CLICK:
if (aVisitor.mEvent->IsLeftClickEvent()) {
nsInputEvent* inputEvent = static_cast<nsInputEvent*>(aVisitor.mEvent);
WidgetInputEvent* inputEvent =
static_cast<WidgetInputEvent*>(aVisitor.mEvent);
if (inputEvent->IsControl() || inputEvent->IsMeta() ||
inputEvent->IsAlt() ||inputEvent->IsShift()) {
break;
@ -2256,8 +2257,8 @@ Element::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
if (shell) {
// single-click
nsEventStatus status = nsEventStatus_eIgnore;
nsUIEvent actEvent(aVisitor.mEvent->mFlags.mIsTrusted,
NS_UI_ACTIVATE, 1);
InternalUIEvent actEvent(aVisitor.mEvent->mFlags.mIsTrusted,
NS_UI_ACTIVATE, 1);
rv = shell->HandleDOMEventWithTarget(this, &actEvent, &status);
if (NS_SUCCEEDED(rv)) {
@ -2283,7 +2284,8 @@ Element::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
case NS_KEY_PRESS:
{
if (aVisitor.mEvent->eventStructType == NS_KEY_EVENT) {
nsKeyEvent* keyEvent = static_cast<nsKeyEvent*>(aVisitor.mEvent);
WidgetKeyboardEvent* keyEvent =
static_cast<WidgetKeyboardEvent*>(aVisitor.mEvent);
if (keyEvent->keyCode == NS_VK_RETURN) {
nsEventStatus status = nsEventStatus_eIgnore;
rv = DispatchClickEvent(aVisitor.mPresContext, keyEvent, this,

View File

@ -4599,8 +4599,8 @@ nsContentUtils::GetAccelKeyCandidates(nsIDOMKeyEvent* aDOMKeyEvent,
if (!eventType.EqualsLiteral("keypress"))
return;
nsKeyEvent* nativeKeyEvent =
static_cast<nsKeyEvent*>(GetNativeEvent(aDOMKeyEvent));
WidgetKeyboardEvent* nativeKeyEvent =
static_cast<WidgetKeyboardEvent*>(GetNativeEvent(aDOMKeyEvent));
if (nativeKeyEvent) {
NS_ASSERTION(nativeKeyEvent->eventStructType == NS_KEY_EVENT,
"wrong type of native event");
@ -4691,7 +4691,7 @@ nsContentUtils::GetAccelKeyCandidates(nsIDOMKeyEvent* aDOMKeyEvent,
/* static */
void
nsContentUtils::GetAccessKeyCandidates(nsKeyEvent* aNativeKeyEvent,
nsContentUtils::GetAccessKeyCandidates(WidgetKeyboardEvent* aNativeKeyEvent,
nsTArray<uint32_t>& aCandidates)
{
NS_PRECONDITION(aCandidates.IsEmpty(), "aCandidates must be empty");
@ -4979,7 +4979,7 @@ nsContentUtils::GetDragSession()
/* static */
nsresult
nsContentUtils::SetDataTransferInEvent(nsDragEvent* aDragEvent)
nsContentUtils::SetDataTransferInEvent(WidgetDragEvent* aDragEvent)
{
if (aDragEvent->dataTransfer || !aDragEvent->mFlags.mIsTrusted)
return NS_OK;
@ -5081,7 +5081,8 @@ nsContentUtils::FilterDropEffect(uint32_t aAction, uint32_t aEffectAllowed)
/* static */
bool
nsContentUtils::CheckForSubFrameDrop(nsIDragSession* aDragSession, nsDragEvent* aDropEvent)
nsContentUtils::CheckForSubFrameDrop(nsIDragSession* aDragSession,
WidgetDragEvent* aDropEvent)
{
nsCOMPtr<nsIContent> target = do_QueryInterface(aDropEvent->originalTarget);
if (!target) {

View File

@ -32,7 +32,7 @@ public:
NS_IMETHOD GetRangeStart(uint16_t* aRangeStart)=0;
NS_IMETHOD GetRangeEnd(uint16_t* aRangeEnd)=0;
NS_IMETHOD GetRangeType(uint16_t* aRangeType)=0;
NS_IMETHOD GetRangeStyle(nsTextRangeStyle* aTextRangeStyle)=0;
NS_IMETHOD GetRangeStyle(mozilla::TextRangeStyle* aTextRangeStyle)=0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIPrivateTextRange, NS_IPRIVATETEXTRANGE_IID)

View File

@ -51,7 +51,7 @@ TextComposition::DispatchEvent(nsGUIEvent* aEvent,
nsDispatchingCallback* aCallBack)
{
if (aEvent->message == NS_COMPOSITION_UPDATE) {
mLastData = static_cast<nsCompositionEvent*>(aEvent)->data;
mLastData = static_cast<WidgetCompositionEvent*>(aEvent)->data;
}
nsEventDispatcher::Dispatch(mNode, mPresContext,
@ -114,8 +114,9 @@ TextComposition::CompositionEventDispatcher::Run()
nsEventStatus status = nsEventStatus_eIgnore;
switch (mEventMessage) {
case NS_COMPOSITION_START: {
nsCompositionEvent compStart(true, NS_COMPOSITION_START, mWidget);
nsQueryContentEvent selectedText(true, NS_QUERY_SELECTED_TEXT, mWidget);
WidgetCompositionEvent compStart(true, NS_COMPOSITION_START, mWidget);
WidgetQueryContentEvent selectedText(true, NS_QUERY_SELECTED_TEXT,
mWidget);
nsContentEventHandler handler(mPresContext);
handler.OnQuerySelectedText(&selectedText);
NS_ASSERTION(selectedText.mSucceeded, "Failed to get selected text");
@ -126,14 +127,14 @@ TextComposition::CompositionEventDispatcher::Run()
}
case NS_COMPOSITION_UPDATE:
case NS_COMPOSITION_END: {
nsCompositionEvent compEvent(true, mEventMessage, mWidget);
WidgetCompositionEvent compEvent(true, mEventMessage, mWidget);
compEvent.data = mData;
nsIMEStateManager::DispatchCompositionEvent(mEventTarget, mPresContext,
&compEvent, &status, nullptr);
break;
}
case NS_TEXT_TEXT: {
nsTextEvent textEvent(true, NS_TEXT_TEXT, mWidget);
WidgetTextEvent textEvent(true, NS_TEXT_TEXT, mWidget);
textEvent.theText = mData;
nsIMEStateManager::DispatchCompositionEvent(mEventTarget, mPresContext,
&textEvent, &status, nullptr);

View File

@ -85,7 +85,7 @@ nsContentEventHandler::InitCommon()
}
nsresult
nsContentEventHandler::Init(nsQueryContentEvent* aEvent)
nsContentEventHandler::Init(WidgetQueryContentEvent* aEvent)
{
NS_ASSERTION(aEvent, "aEvent must not be null");
@ -114,7 +114,7 @@ nsContentEventHandler::Init(nsQueryContentEvent* aEvent)
}
nsresult
nsContentEventHandler::Init(nsSelectionEvent* aEvent)
nsContentEventHandler::Init(WidgetSelectionEvent* aEvent)
{
NS_ASSERTION(aEvent, "aEvent must not be null");
@ -475,7 +475,7 @@ nsContentEventHandler::SetRangeFromFlatTextOffset(
}
nsresult
nsContentEventHandler::OnQuerySelectedText(nsQueryContentEvent* aEvent)
nsContentEventHandler::OnQuerySelectedText(WidgetQueryContentEvent* aEvent)
{
nsresult rv = Init(aEvent);
if (NS_FAILED(rv))
@ -518,7 +518,7 @@ nsContentEventHandler::OnQuerySelectedText(nsQueryContentEvent* aEvent)
}
nsresult
nsContentEventHandler::OnQueryTextContent(nsQueryContentEvent* aEvent)
nsContentEventHandler::OnQueryTextContent(WidgetQueryContentEvent* aEvent)
{
nsresult rv = Init(aEvent);
if (NS_FAILED(rv))
@ -579,7 +579,7 @@ static nsresult GetFrameForTextRect(nsINode* aNode,
}
nsresult
nsContentEventHandler::OnQueryTextRect(nsQueryContentEvent* aEvent)
nsContentEventHandler::OnQueryTextRect(WidgetQueryContentEvent* aEvent)
{
nsresult rv = Init(aEvent);
if (NS_FAILED(rv))
@ -669,7 +669,7 @@ nsContentEventHandler::OnQueryTextRect(nsQueryContentEvent* aEvent)
}
nsresult
nsContentEventHandler::OnQueryEditorRect(nsQueryContentEvent* aEvent)
nsContentEventHandler::OnQueryEditorRect(WidgetQueryContentEvent* aEvent)
{
nsresult rv = Init(aEvent);
if (NS_FAILED(rv))
@ -698,7 +698,7 @@ nsContentEventHandler::OnQueryEditorRect(nsQueryContentEvent* aEvent)
}
nsresult
nsContentEventHandler::OnQueryCaretRect(nsQueryContentEvent* aEvent)
nsContentEventHandler::OnQueryCaretRect(WidgetQueryContentEvent* aEvent)
{
nsresult rv = Init(aEvent);
if (NS_FAILED(rv))
@ -770,7 +770,7 @@ nsContentEventHandler::OnQueryCaretRect(nsQueryContentEvent* aEvent)
}
nsresult
nsContentEventHandler::OnQueryContentState(nsQueryContentEvent * aEvent)
nsContentEventHandler::OnQueryContentState(WidgetQueryContentEvent * aEvent)
{
nsresult rv = Init(aEvent);
if (NS_FAILED(rv))
@ -782,7 +782,8 @@ nsContentEventHandler::OnQueryContentState(nsQueryContentEvent * aEvent)
}
nsresult
nsContentEventHandler::OnQuerySelectionAsTransferable(nsQueryContentEvent* aEvent)
nsContentEventHandler::OnQuerySelectionAsTransferable(
WidgetQueryContentEvent* aEvent)
{
nsresult rv = Init(aEvent);
if (NS_FAILED(rv))
@ -805,7 +806,7 @@ nsContentEventHandler::OnQuerySelectionAsTransferable(nsQueryContentEvent* aEven
}
nsresult
nsContentEventHandler::OnQueryCharacterAtPoint(nsQueryContentEvent* aEvent)
nsContentEventHandler::OnQueryCharacterAtPoint(WidgetQueryContentEvent* aEvent)
{
nsresult rv = Init(aEvent);
if (NS_FAILED(rv))
@ -828,8 +829,8 @@ nsContentEventHandler::OnQueryCharacterAtPoint(nsQueryContentEvent* aEvent)
NS_ENSURE_TRUE(rootWidget, NS_ERROR_FAILURE);
}
nsQueryContentEvent eventOnRoot(true, NS_QUERY_CHARACTER_AT_POINT,
rootWidget);
WidgetQueryContentEvent eventOnRoot(true, NS_QUERY_CHARACTER_AT_POINT,
rootWidget);
eventOnRoot.refPoint = aEvent->refPoint;
if (rootWidget != aEvent->widget) {
eventOnRoot.refPoint += LayoutDeviceIntPoint::FromUntyped(
@ -844,7 +845,7 @@ nsContentEventHandler::OnQueryCharacterAtPoint(nsQueryContentEvent* aEvent)
!nsContentUtils::ContentIsDescendantOf(targetFrame->GetContent(),
mRootContent)) {
// there is no character at the point.
aEvent->mReply.mOffset = nsQueryContentEvent::NOT_FOUND;
aEvent->mReply.mOffset = WidgetQueryContentEvent::NOT_FOUND;
aEvent->mSucceeded = true;
return NS_OK;
}
@ -862,7 +863,7 @@ nsContentEventHandler::OnQueryCharacterAtPoint(nsQueryContentEvent* aEvent)
&nativeOffset);
NS_ENSURE_SUCCESS(rv, rv);
nsQueryContentEvent textRect(true, NS_QUERY_TEXT_RECT, aEvent->widget);
WidgetQueryContentEvent textRect(true, NS_QUERY_TEXT_RECT, aEvent->widget);
textRect.InitForQueryTextRect(nativeOffset, 1);
rv = OnQueryTextRect(&textRect);
NS_ENSURE_SUCCESS(rv, rv);
@ -876,7 +877,7 @@ nsContentEventHandler::OnQueryCharacterAtPoint(nsQueryContentEvent* aEvent)
}
nsresult
nsContentEventHandler::OnQueryDOMWidgetHittest(nsQueryContentEvent* aEvent)
nsContentEventHandler::OnQueryDOMWidgetHittest(WidgetQueryContentEvent* aEvent)
{
nsresult rv = Init(aEvent);
if (NS_FAILED(rv))
@ -1051,7 +1052,7 @@ static void AdjustRangeForSelection(nsIContent* aRoot,
}
nsresult
nsContentEventHandler::OnSelectionEvent(nsSelectionEvent* aEvent)
nsContentEventHandler::OnSelectionEvent(WidgetSelectionEvent* aEvent)
{
aEvent->mSucceeded = false;

View File

@ -30,26 +30,27 @@ public:
nsContentEventHandler(nsPresContext *aPresContext);
// NS_QUERY_SELECTED_TEXT event handler
nsresult OnQuerySelectedText(nsQueryContentEvent* aEvent);
nsresult OnQuerySelectedText(mozilla::WidgetQueryContentEvent* aEvent);
// NS_QUERY_TEXT_CONTENT event handler
nsresult OnQueryTextContent(nsQueryContentEvent* aEvent);
nsresult OnQueryTextContent(mozilla::WidgetQueryContentEvent* aEvent);
// NS_QUERY_CARET_RECT event handler
nsresult OnQueryCaretRect(nsQueryContentEvent* aEvent);
nsresult OnQueryCaretRect(mozilla::WidgetQueryContentEvent* aEvent);
// NS_QUERY_TEXT_RECT event handler
nsresult OnQueryTextRect(nsQueryContentEvent* aEvent);
nsresult OnQueryTextRect(mozilla::WidgetQueryContentEvent* aEvent);
// NS_QUERY_EDITOR_RECT event handler
nsresult OnQueryEditorRect(nsQueryContentEvent* aEvent);
nsresult OnQueryEditorRect(mozilla::WidgetQueryContentEvent* aEvent);
// NS_QUERY_CONTENT_STATE event handler
nsresult OnQueryContentState(nsQueryContentEvent* aEvent);
nsresult OnQueryContentState(mozilla::WidgetQueryContentEvent* aEvent);
// NS_QUERY_SELECTION_AS_TRANSFERABLE event handler
nsresult OnQuerySelectionAsTransferable(nsQueryContentEvent* aEvent);
nsresult OnQuerySelectionAsTransferable(
mozilla::WidgetQueryContentEvent* aEvent);
// NS_QUERY_CHARACTER_AT_POINT event handler
nsresult OnQueryCharacterAtPoint(nsQueryContentEvent* aEvent);
nsresult OnQueryCharacterAtPoint(mozilla::WidgetQueryContentEvent* aEvent);
// NS_QUERY_DOM_WIDGET_HITTEST event handler
nsresult OnQueryDOMWidgetHittest(nsQueryContentEvent* aEvent);
nsresult OnQueryDOMWidgetHittest(mozilla::WidgetQueryContentEvent* aEvent);
// NS_SELECTION_* event
nsresult OnSelectionEvent(nsSelectionEvent* aEvent);
nsresult OnSelectionEvent(mozilla::WidgetSelectionEvent* aEvent);
protected:
nsPresContext* mPresContext;
@ -58,8 +59,8 @@ protected:
nsRefPtr<nsRange> mFirstSelectedRange;
nsCOMPtr<nsIContent> mRootContent;
nsresult Init(nsQueryContentEvent* aEvent);
nsresult Init(nsSelectionEvent* aEvent);
nsresult Init(mozilla::WidgetQueryContentEvent* aEvent);
nsresult Init(mozilla::WidgetSelectionEvent* aEvent);
// InitCommon() is called from each Init().
nsresult InitCommon();

View File

@ -8,11 +8,13 @@
#include "prtime.h"
#include "mozilla/TextEvents.h"
using namespace mozilla;
nsDOMCompositionEvent::nsDOMCompositionEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsCompositionEvent* aEvent)
WidgetCompositionEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent :
new nsCompositionEvent(false, 0, nullptr))
new WidgetCompositionEvent(false, 0, nullptr))
{
NS_ASSERTION(mEvent->eventStructType == NS_COMPOSITION_EVENT,
"event type mismatch");
@ -29,14 +31,14 @@ nsDOMCompositionEvent::nsDOMCompositionEvent(mozilla::dom::EventTarget* aOwner,
mEvent->mFlags.mCancelable = false;
}
mData = static_cast<nsCompositionEvent*>(mEvent)->data;
mData = static_cast<WidgetCompositionEvent*>(mEvent)->data;
// TODO: Native event should have locale information.
}
nsDOMCompositionEvent::~nsDOMCompositionEvent()
{
if (mEventIsInternal) {
delete static_cast<nsCompositionEvent*>(mEvent);
delete static_cast<WidgetCompositionEvent*>(mEvent);
mEvent = nullptr;
}
}
@ -83,7 +85,7 @@ nsresult
NS_NewDOMCompositionEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsCompositionEvent *aEvent)
WidgetCompositionEvent* aEvent)
{
nsDOMCompositionEvent* event =
new nsDOMCompositionEvent(aOwner, aPresContext, aEvent);

View File

@ -18,7 +18,7 @@ class nsDOMCompositionEvent : public nsDOMUIEvent,
public:
nsDOMCompositionEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsCompositionEvent* aEvent);
mozilla::WidgetCompositionEvent* aEvent);
virtual ~nsDOMCompositionEvent();
NS_DECL_ISUPPORTS_INHERITED

View File

@ -9,11 +9,13 @@
#include "prtime.h"
#include "mozilla/MouseEvents.h"
using namespace mozilla;
nsDOMDragEvent::nsDOMDragEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsInputEvent* aEvent)
WidgetInputEvent* aEvent)
: nsDOMMouseEvent(aOwner, aPresContext, aEvent ? aEvent :
new nsDragEvent(false, 0, nullptr))
new WidgetDragEvent(false, 0, nullptr))
{
if (aEvent) {
mEventIsInternal = false;
@ -30,7 +32,7 @@ nsDOMDragEvent::~nsDOMDragEvent()
{
if (mEventIsInternal) {
if (mEvent->eventStructType == NS_DRAG_EVENT)
delete static_cast<nsDragEvent*>(mEvent);
delete static_cast<WidgetDragEvent*>(mEvent);
mEvent = nullptr;
}
}
@ -60,7 +62,7 @@ nsDOMDragEvent::InitDragEvent(const nsAString & aType,
NS_ENSURE_SUCCESS(rv, rv);
if (mEventIsInternal && mEvent) {
nsDragEvent* dragEvent = static_cast<nsDragEvent*>(mEvent);
WidgetDragEvent* dragEvent = static_cast<WidgetDragEvent*>(mEvent);
dragEvent->dataTransfer = aDataTransfer;
}
@ -86,7 +88,7 @@ nsDOMDragEvent::GetDataTransfer()
return nullptr;
}
nsDragEvent* dragEvent = static_cast<nsDragEvent*>(mEvent);
WidgetDragEvent* dragEvent = static_cast<WidgetDragEvent*>(mEvent);
// for synthetic events, just use the supplied data transfer object even if null
if (!mEventIsInternal) {
nsresult rv = nsContentUtils::SetDataTransferInEvent(dragEvent);
@ -99,7 +101,7 @@ nsDOMDragEvent::GetDataTransfer()
nsresult NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsDragEvent *aEvent)
WidgetDragEvent* aEvent)
{
nsDOMDragEvent* event = new nsDOMDragEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(event, aInstancePtrResult);

View File

@ -16,7 +16,8 @@ class nsDOMDragEvent : public nsDOMMouseEvent,
{
public:
nsDOMDragEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext, nsInputEvent* aEvent);
nsPresContext* aPresContext,
mozilla::WidgetInputEvent* aEvent);
virtual ~nsDOMDragEvent();
NS_DECL_ISUPPORTS_INHERITED
@ -54,6 +55,6 @@ public:
nsresult NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsDragEvent* aEvent);
mozilla::WidgetDragEvent* aEvent);
#endif // nsDOMDragEvent_h__

View File

@ -143,11 +143,13 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMEvent)
case NS_MOUSE_SCROLL_EVENT:
case NS_WHEEL_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
static_cast<nsMouseEvent_base*>(tmp->mEvent)->relatedTarget = nullptr;
static_cast<WidgetMouseEventBase*>(tmp->mEvent)->relatedTarget =
nullptr;
break;
case NS_DRAG_EVENT:
static_cast<nsDragEvent*>(tmp->mEvent)->dataTransfer = nullptr;
static_cast<nsMouseEvent_base*>(tmp->mEvent)->relatedTarget = nullptr;
static_cast<WidgetDragEvent*>(tmp->mEvent)->dataTransfer = nullptr;
static_cast<WidgetMouseEventBase*>(tmp->mEvent)->relatedTarget =
nullptr;
break;
case NS_CLIPBOARD_EVENT:
static_cast<InternalClipboardEvent*>(tmp->mEvent)->clipboardData =
@ -182,15 +184,15 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMEvent)
case NS_SIMPLE_GESTURE_EVENT:
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->relatedTarget");
cb.NoteXPCOMChild(
static_cast<nsMouseEvent_base*>(tmp->mEvent)->relatedTarget);
static_cast<WidgetMouseEventBase*>(tmp->mEvent)->relatedTarget);
break;
case NS_DRAG_EVENT:
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->dataTransfer");
cb.NoteXPCOMChild(
static_cast<nsDragEvent*>(tmp->mEvent)->dataTransfer);
static_cast<WidgetDragEvent*>(tmp->mEvent)->dataTransfer);
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->relatedTarget");
cb.NoteXPCOMChild(
static_cast<nsMouseEvent_base*>(tmp->mEvent)->relatedTarget);
static_cast<WidgetMouseEventBase*>(tmp->mEvent)->relatedTarget);
break;
case NS_CLIPBOARD_EVENT:
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->clipboardData");
@ -530,16 +532,18 @@ nsDOMEvent::DuplicatePrivateData()
}
case NS_INPUT_EVENT:
{
nsInputEvent* oldInputEvent = static_cast<nsInputEvent*>(mEvent);
nsInputEvent* inputEvent = new nsInputEvent(false, msg, nullptr);
WidgetInputEvent* oldInputEvent = static_cast<WidgetInputEvent*>(mEvent);
WidgetInputEvent* inputEvent = new WidgetInputEvent(false, msg, nullptr);
inputEvent->AssignInputEventData(*oldInputEvent, true);
newEvent = inputEvent;
break;
}
case NS_KEY_EVENT:
{
nsKeyEvent* oldKeyEvent = static_cast<nsKeyEvent*>(mEvent);
nsKeyEvent* keyEvent = new nsKeyEvent(false, msg, nullptr);
WidgetKeyboardEvent* oldKeyEvent =
static_cast<WidgetKeyboardEvent*>(mEvent);
WidgetKeyboardEvent* keyEvent =
new WidgetKeyboardEvent(false, msg, nullptr);
keyEvent->AssignKeyEventData(*oldKeyEvent, true);
newEvent = keyEvent;
break;
@ -555,9 +559,8 @@ nsDOMEvent::DuplicatePrivateData()
}
case NS_DRAG_EVENT:
{
nsDragEvent* oldDragEvent = static_cast<nsDragEvent*>(mEvent);
nsDragEvent* dragEvent =
new nsDragEvent(false, msg, nullptr);
WidgetDragEvent* oldDragEvent = static_cast<WidgetDragEvent*>(mEvent);
WidgetDragEvent* dragEvent = new WidgetDragEvent(false, msg, nullptr);
dragEvent->AssignDragEventData(*oldDragEvent, true);
newEvent = dragEvent;
break;
@ -584,28 +587,28 @@ nsDOMEvent::DuplicatePrivateData()
}
case NS_TEXT_EVENT:
{
nsTextEvent* oldTextEvent = static_cast<nsTextEvent*>(mEvent);
nsTextEvent* textEvent = new nsTextEvent(false, msg, nullptr);
WidgetTextEvent* oldTextEvent = static_cast<WidgetTextEvent*>(mEvent);
WidgetTextEvent* textEvent = new WidgetTextEvent(false, msg, nullptr);
textEvent->AssignTextEventData(*oldTextEvent, true);
newEvent = textEvent;
break;
}
case NS_COMPOSITION_EVENT:
{
nsCompositionEvent* compositionEvent =
new nsCompositionEvent(false, msg, nullptr);
nsCompositionEvent* oldCompositionEvent =
static_cast<nsCompositionEvent*>(mEvent);
WidgetCompositionEvent* compositionEvent =
new WidgetCompositionEvent(false, msg, nullptr);
WidgetCompositionEvent* oldCompositionEvent =
static_cast<WidgetCompositionEvent*>(mEvent);
compositionEvent->AssignCompositionEventData(*oldCompositionEvent, true);
newEvent = compositionEvent;
break;
}
case NS_MOUSE_SCROLL_EVENT:
{
nsMouseScrollEvent* oldMouseScrollEvent =
static_cast<nsMouseScrollEvent*>(mEvent);
nsMouseScrollEvent* mouseScrollEvent =
new nsMouseScrollEvent(false, msg, nullptr);
WidgetMouseScrollEvent* oldMouseScrollEvent =
static_cast<WidgetMouseScrollEvent*>(mEvent);
WidgetMouseScrollEvent* mouseScrollEvent =
new WidgetMouseScrollEvent(false, msg, nullptr);
mouseScrollEvent->AssignMouseScrollEventData(*oldMouseScrollEvent, true);
newEvent = mouseScrollEvent;
break;
@ -678,8 +681,9 @@ nsDOMEvent::DuplicatePrivateData()
}
case NS_UI_EVENT:
{
nsUIEvent* oldUIEvent = static_cast<nsUIEvent*>(mEvent);
nsUIEvent* uiEvent = new nsUIEvent(false, msg, oldUIEvent->detail);
InternalUIEvent* oldUIEvent = static_cast<InternalUIEvent*>(mEvent);
InternalUIEvent* uiEvent =
new InternalUIEvent(false, msg, oldUIEvent->detail);
uiEvent->AssignUIEventData(*oldUIEvent, true);
newEvent = uiEvent;
break;
@ -695,8 +699,8 @@ nsDOMEvent::DuplicatePrivateData()
}
case NS_SMIL_TIME_EVENT:
{
nsUIEvent* oldUIEvent = static_cast<nsUIEvent*>(mEvent);
nsUIEvent* uiEvent = new nsUIEvent(false, msg, 0);
InternalUIEvent* oldUIEvent = static_cast<InternalUIEvent*>(mEvent);
InternalUIEvent* uiEvent = new InternalUIEvent(false, msg, 0);
uiEvent->eventStructType = NS_SMIL_TIME_EVENT;
uiEvent->AssignUIEventData(*oldUIEvent, true);
newEvent = uiEvent;
@ -895,7 +899,7 @@ nsDOMEvent::GetEventPopupControlState(nsEvent *aEvent)
break;
case NS_KEY_EVENT :
if (aEvent->mFlags.mIsTrusted) {
uint32_t key = static_cast<nsKeyEvent *>(aEvent)->keyCode;
uint32_t key = static_cast<WidgetKeyboardEvent*>(aEvent)->keyCode;
switch(aEvent->message) {
case NS_KEY_PRESS :
// return key on focused button. see note at NS_MOUSE_CLICK.

View File

@ -7,11 +7,13 @@
#include "prtime.h"
#include "mozilla/TextEvents.h"
using namespace mozilla;
nsDOMKeyboardEvent::nsDOMKeyboardEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsKeyEvent* aEvent)
WidgetKeyboardEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent :
new nsKeyEvent(false, 0, nullptr))
new WidgetKeyboardEvent(false, 0, nullptr))
{
NS_ASSERTION(mEvent->eventStructType == NS_KEY_EVENT, "event type mismatch");
@ -27,7 +29,7 @@ nsDOMKeyboardEvent::nsDOMKeyboardEvent(mozilla::dom::EventTarget* aOwner,
nsDOMKeyboardEvent::~nsDOMKeyboardEvent()
{
if (mEventIsInternal) {
delete static_cast<nsKeyEvent*>(mEvent);
delete static_cast<WidgetKeyboardEvent*>(mEvent);
mEvent = nullptr;
}
}
@ -85,7 +87,7 @@ NS_IMETHODIMP
nsDOMKeyboardEvent::GetKey(nsAString& aKeyName)
{
if (!mEventIsInternal) {
static_cast<nsKeyEvent*>(mEvent)->GetDOMKeyName(aKeyName);
static_cast<WidgetKeyboardEvent*>(mEvent)->GetDOMKeyName(aKeyName);
}
return NS_OK;
}
@ -106,7 +108,7 @@ nsDOMKeyboardEvent::CharCode()
case NS_KEY_DOWN:
return 0;
case NS_KEY_PRESS:
return static_cast<nsKeyEvent*>(mEvent)->charCode;
return static_cast<WidgetKeyboardEvent*>(mEvent)->charCode;
}
return 0;
}
@ -126,7 +128,7 @@ nsDOMKeyboardEvent::KeyCode()
case NS_KEY_UP:
case NS_KEY_PRESS:
case NS_KEY_DOWN:
return static_cast<nsKeyEvent*>(mEvent)->keyCode;
return static_cast<WidgetKeyboardEvent*>(mEvent)->keyCode;
}
return 0;
}
@ -142,7 +144,7 @@ nsDOMKeyboardEvent::Which()
//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
{
uint32_t keyCode = ((nsKeyEvent*)mEvent)->keyCode;
uint32_t keyCode = static_cast<WidgetKeyboardEvent*>(mEvent)->keyCode;
if (keyCode == NS_VK_RETURN || keyCode == NS_VK_BACK) {
return keyCode;
}
@ -171,7 +173,7 @@ nsDOMKeyboardEvent::InitKeyEvent(const nsAString& aType, bool aCanBubble, bool a
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, 0);
NS_ENSURE_SUCCESS(rv, rv);
nsKeyEvent* keyEvent = static_cast<nsKeyEvent*>(mEvent);
WidgetKeyboardEvent* keyEvent = static_cast<WidgetKeyboardEvent*>(mEvent);
keyEvent->InitBasicModifiers(aCtrlKey, aAltKey, aShiftKey, aMetaKey);
keyEvent->keyCode = aKeyCode;
keyEvent->charCode = aCharCode;
@ -182,7 +184,7 @@ nsDOMKeyboardEvent::InitKeyEvent(const nsAString& aType, bool aCanBubble, bool a
nsresult NS_NewDOMKeyboardEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsKeyEvent *aEvent)
WidgetKeyboardEvent* aEvent)
{
nsDOMKeyboardEvent* it = new nsDOMKeyboardEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(it, aInstancePtrResult);

View File

@ -17,7 +17,8 @@ class nsDOMKeyboardEvent : public nsDOMUIEvent,
{
public:
nsDOMKeyboardEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext, nsKeyEvent* aEvent);
nsPresContext* aPresContext,
mozilla::WidgetKeyboardEvent* aEvent);
virtual ~nsDOMKeyboardEvent();
NS_DECL_ISUPPORTS_INHERITED
@ -36,22 +37,22 @@ public:
bool AltKey()
{
return static_cast<nsInputEvent*>(mEvent)->IsAlt();
return static_cast<mozilla::WidgetInputEvent*>(mEvent)->IsAlt();
}
bool CtrlKey()
{
return static_cast<nsInputEvent*>(mEvent)->IsControl();
return static_cast<mozilla::WidgetInputEvent*>(mEvent)->IsControl();
}
bool ShiftKey()
{
return static_cast<nsInputEvent*>(mEvent)->IsShift();
return static_cast<mozilla::WidgetInputEvent*>(mEvent)->IsShift();
}
bool MetaKey()
{
return static_cast<nsInputEvent*>(mEvent)->IsMeta();
return static_cast<mozilla::WidgetInputEvent*>(mEvent)->IsMeta();
}
bool GetModifierState(const nsAString& aKey)
@ -65,7 +66,7 @@ public:
uint32_t Location()
{
return static_cast<nsKeyEvent*>(mEvent)->location;
return static_cast<mozilla::WidgetKeyboardEvent*>(mEvent)->location;
}
void InitKeyEvent(const nsAString& aType, bool aCanBubble, bool aCancelable,

View File

@ -13,12 +13,12 @@ using namespace mozilla;
nsDOMMouseEvent::nsDOMMouseEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsInputEvent* aEvent)
WidgetInputEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent :
new nsMouseEvent(false, 0, nullptr,
nsMouseEvent::eReal))
{
// There's no way to make this class' ctor allocate an nsMouseScrollEvent.
// There's no way to make this class' ctor allocate an WidgetMouseScrollEvent.
// It's not that important, though, since a scroll event is not a real
// DOM event.
@ -86,9 +86,10 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, bool aCanBubble, bool a
case NS_DRAG_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
{
static_cast<nsMouseEvent_base*>(mEvent)->relatedTarget = aRelatedTarget;
static_cast<nsMouseEvent_base*>(mEvent)->button = aButton;
nsInputEvent* inputEvent = static_cast<nsInputEvent*>(mEvent);
static_cast<WidgetMouseEventBase*>(mEvent)->relatedTarget =
aRelatedTarget;
static_cast<WidgetMouseEventBase*>(mEvent)->button = aButton;
WidgetInputEvent* inputEvent = static_cast<WidgetInputEvent*>(mEvent);
inputEvent->InitBasicModifiers(aCtrlKey, aAltKey, aShiftKey, aMetaKey);
mClientPoint.x = aClientX;
mClientPoint.y = aClientY;
@ -139,7 +140,7 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString& aType,
case NS_WHEEL_EVENT:
case NS_DRAG_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
static_cast<nsInputEvent*>(mEvent)->modifiers = modifiers;
static_cast<WidgetInputEvent*>(mEvent)->modifiers = modifiers;
return NS_OK;
default:
MOZ_CRASH("There is no space to store the modifiers");
@ -169,7 +170,7 @@ nsDOMMouseEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
case NS_WHEEL_EVENT:
case NS_DRAG_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
static_cast<nsMouseEvent_base*>(e->mEvent)->buttons = aParam.mButtons;
static_cast<WidgetMouseEventBase*>(e->mEvent)->buttons = aParam.mButtons;
break;
default:
break;
@ -192,8 +193,8 @@ nsDOMMouseEvent::InitNSMouseEvent(const nsAString & aType, bool aCanBubble, bool
aMetaKey, aButton, aRelatedTarget);
NS_ENSURE_SUCCESS(rv, rv);
static_cast<nsMouseEvent_base*>(mEvent)->pressure = aPressure;
static_cast<nsMouseEvent_base*>(mEvent)->inputSource = aInputSource;
static_cast<WidgetMouseEventBase*>(mEvent)->pressure = aPressure;
static_cast<WidgetMouseEventBase*>(mEvent)->inputSource = aInputSource;
return NS_OK;
}
@ -215,7 +216,7 @@ nsDOMMouseEvent::Button()
case NS_WHEEL_EVENT:
case NS_DRAG_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
return static_cast<nsMouseEvent_base*>(mEvent)->button;
return static_cast<WidgetMouseEventBase*>(mEvent)->button;
default:
NS_WARNING("Tried to get mouse button for non-mouse event!");
return nsMouseEvent::eLeftButton;
@ -240,7 +241,7 @@ nsDOMMouseEvent::Buttons()
case NS_WHEEL_EVENT:
case NS_DRAG_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
return static_cast<nsMouseEvent_base*>(mEvent)->buttons;
return static_cast<WidgetMouseEventBase*>(mEvent)->buttons;
default:
MOZ_CRASH("Tried to get mouse buttons for non-mouse event!");
}
@ -265,7 +266,8 @@ nsDOMMouseEvent::GetRelatedTarget()
case NS_WHEEL_EVENT:
case NS_DRAG_EVENT:
case NS_SIMPLE_GESTURE_EVENT:
relatedTarget = do_QueryInterface(static_cast<nsMouseEvent_base*>(mEvent)->relatedTarget);
relatedTarget = do_QueryInterface(
static_cast<WidgetMouseEventBase*>(mEvent)->relatedTarget);
break;
default:
break;
@ -430,7 +432,7 @@ nsDOMMouseEvent::GetMozInputSource(uint16_t* aInputSource)
nsresult NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsInputEvent *aEvent)
WidgetInputEvent* aEvent)
{
nsDOMMouseEvent* it = new nsDOMMouseEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(it, aInstancePtrResult);

View File

@ -16,7 +16,8 @@ class nsDOMMouseEvent : public nsDOMUIEvent,
{
public:
nsDOMMouseEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext, nsInputEvent* aEvent);
nsPresContext* aPresContext,
mozilla::WidgetInputEvent* aEvent);
virtual ~nsDOMMouseEvent();
NS_DECL_ISUPPORTS_INHERITED
@ -45,19 +46,19 @@ public:
int32_t ClientY();
bool CtrlKey()
{
return static_cast<nsInputEvent*>(mEvent)->IsControl();
return static_cast<mozilla::WidgetInputEvent*>(mEvent)->IsControl();
}
bool ShiftKey()
{
return static_cast<nsInputEvent*>(mEvent)->IsShift();
return static_cast<mozilla::WidgetInputEvent*>(mEvent)->IsShift();
}
bool AltKey()
{
return static_cast<nsInputEvent*>(mEvent)->IsAlt();
return static_cast<mozilla::WidgetInputEvent*>(mEvent)->IsAlt();
}
bool MetaKey()
{
return static_cast<nsInputEvent*>(mEvent)->IsMeta();
return static_cast<mozilla::WidgetInputEvent*>(mEvent)->IsMeta();
}
uint16_t Button();
uint16_t Buttons();
@ -94,11 +95,11 @@ public:
}
float MozPressure() const
{
return static_cast<nsMouseEvent_base*>(mEvent)->pressure;
return static_cast<mozilla::WidgetMouseEventBase*>(mEvent)->pressure;
}
uint16_t MozInputSource() const
{
return static_cast<nsMouseEvent_base*>(mEvent)->inputSource;
return static_cast<mozilla::WidgetMouseEventBase*>(mEvent)->inputSource;
}
void InitNSMouseEvent(const nsAString & aType, bool aCanBubble, bool aCancelable,
nsIDOMWindow *aView, int32_t aDetail, int32_t aScreenX,

View File

@ -7,11 +7,14 @@
#include "prtime.h"
#include "mozilla/MouseEvents.h"
using namespace mozilla;
nsDOMMouseScrollEvent::nsDOMMouseScrollEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsInputEvent* aEvent)
WidgetInputEvent* aEvent)
: nsDOMMouseEvent(aOwner, aPresContext,
aEvent ? aEvent : new nsMouseScrollEvent(false, 0, nullptr))
aEvent ? aEvent :
new WidgetMouseScrollEvent(false, 0, nullptr))
{
if (aEvent) {
mEventIsInternal = false;
@ -23,7 +26,7 @@ nsDOMMouseScrollEvent::nsDOMMouseScrollEvent(mozilla::dom::EventTarget* aOwner,
}
if(mEvent->eventStructType == NS_MOUSE_SCROLL_EVENT) {
mDetail = static_cast<nsMouseScrollEvent*>(mEvent)->delta;
mDetail = static_cast<WidgetMouseScrollEvent*>(mEvent)->delta;
}
}
@ -33,7 +36,7 @@ nsDOMMouseScrollEvent::~nsDOMMouseScrollEvent()
switch (mEvent->eventStructType)
{
case NS_MOUSE_SCROLL_EVENT:
delete static_cast<nsMouseScrollEvent*>(mEvent);
delete static_cast<WidgetMouseScrollEvent*>(mEvent);
break;
default:
delete mEvent;
@ -64,7 +67,7 @@ nsDOMMouseScrollEvent::InitMouseScrollEvent(const nsAString & aType, bool aCanBu
NS_ENSURE_SUCCESS(rv, rv);
if (mEvent->eventStructType == NS_MOUSE_SCROLL_EVENT) {
static_cast<nsMouseScrollEvent*>(mEvent)->isHorizontal =
static_cast<WidgetMouseScrollEvent*>(mEvent)->isHorizontal =
(aAxis == HORIZONTAL_AXIS);
}
@ -84,7 +87,7 @@ int32_t
nsDOMMouseScrollEvent::Axis()
{
if (mEvent->eventStructType == NS_MOUSE_SCROLL_EVENT) {
return static_cast<nsMouseScrollEvent*>(mEvent)->isHorizontal ?
return static_cast<WidgetMouseScrollEvent*>(mEvent)->isHorizontal ?
static_cast<int32_t>(HORIZONTAL_AXIS) :
static_cast<int32_t>(VERTICAL_AXIS);
}
@ -94,7 +97,7 @@ nsDOMMouseScrollEvent::Axis()
nsresult NS_NewDOMMouseScrollEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsInputEvent *aEvent)
WidgetInputEvent* aEvent)
{
nsDOMMouseScrollEvent* it =
new nsDOMMouseScrollEvent(aOwner, aPresContext, aEvent);

View File

@ -15,7 +15,8 @@ class nsDOMMouseScrollEvent : public nsDOMMouseEvent,
{
public:
nsDOMMouseScrollEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext, nsInputEvent* aEvent);
nsPresContext* aPresContext,
mozilla::WidgetInputEvent* aEvent);
virtual ~nsDOMMouseScrollEvent();
NS_DECL_ISUPPORTS_INHERITED

View File

@ -9,11 +9,13 @@
#include "prtime.h"
#include "mozilla/TextEvents.h"
using namespace mozilla;
nsDOMTextEvent::nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsTextEvent* aEvent)
WidgetTextEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext,
aEvent ? aEvent : new nsTextEvent(false, 0, nullptr))
aEvent ? aEvent : new WidgetTextEvent(false, 0, nullptr))
{
NS_ASSERTION(mEvent->eventStructType == NS_TEXT_EVENT, "event type mismatch");
@ -28,7 +30,7 @@ nsDOMTextEvent::nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
//
// extract the IME composition string
//
nsTextEvent *te = static_cast<nsTextEvent*>(mEvent);
WidgetTextEvent *te = static_cast<WidgetTextEvent*>(mEvent);
mText = te->theText;
//
@ -76,7 +78,7 @@ NS_METHOD_(already_AddRefed<nsIPrivateTextRangeList>) nsDOMTextEvent::GetInputRa
nsresult NS_NewDOMTextEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsTextEvent *aEvent)
WidgetTextEvent* aEvent)
{
nsDOMTextEvent* it = new nsDOMTextEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(it, aInstancePtrResult);

View File

@ -17,7 +17,8 @@ class nsDOMTextEvent : public nsDOMUIEvent,
{
public:
nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext, nsTextEvent* aEvent);
nsPresContext* aPresContext,
mozilla::WidgetTextEvent* aEvent);
NS_DECL_ISUPPORTS_INHERITED

View File

@ -115,8 +115,8 @@ nsDOMTouchEvent::InitTouchEvent(const nsAString& aType,
return;
}
static_cast<nsInputEvent*>(mEvent)->InitBasicModifiers(aCtrlKey, aAltKey,
aShiftKey, aMetaKey);
static_cast<WidgetInputEvent*>(mEvent)->
InitBasicModifiers(aCtrlKey, aAltKey, aShiftKey, aMetaKey);
mTouches = aTouches;
mTargetTouches = aTargetTouches;
mChangedTouches = aChangedTouches;

View File

@ -101,22 +101,22 @@ public:
bool AltKey()
{
return static_cast<nsInputEvent*>(mEvent)->IsAlt();
return static_cast<mozilla::WidgetInputEvent*>(mEvent)->IsAlt();
}
bool MetaKey()
{
return static_cast<nsInputEvent*>(mEvent)->IsMeta();
return static_cast<mozilla::WidgetInputEvent*>(mEvent)->IsMeta();
}
bool CtrlKey()
{
return static_cast<nsInputEvent*>(mEvent)->IsControl();
return static_cast<mozilla::WidgetInputEvent*>(mEvent)->IsControl();
}
bool ShiftKey()
{
return static_cast<nsInputEvent*>(mEvent)->IsShift();
return static_cast<mozilla::WidgetInputEvent*>(mEvent)->IsShift();
}
void InitTouchEvent(const nsAString& aType,

View File

@ -24,9 +24,8 @@ using namespace mozilla;
nsDOMUIEvent::nsDOMUIEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext, nsGUIEvent* aEvent)
: nsDOMEvent(aOwner, aPresContext, aEvent ?
static_cast<nsEvent *>(aEvent) :
static_cast<nsEvent *>(new nsUIEvent(false, 0, 0)))
: nsDOMEvent(aOwner, aPresContext,
aEvent ? aEvent : new InternalUIEvent(false, 0, 0))
, mClientPoint(0, 0), mLayerPoint(0, 0), mPagePoint(0, 0), mMovementPoint(0, 0)
, mIsPointerLocked(nsEventStateManager::sIsPointerLocked)
, mLastClientPoint(nsEventStateManager::sLastClientPoint)
@ -45,7 +44,7 @@ nsDOMUIEvent::nsDOMUIEvent(mozilla::dom::EventTarget* aOwner,
{
case NS_UI_EVENT:
{
nsUIEvent *event = static_cast<nsUIEvent*>(mEvent);
InternalUIEvent *event = static_cast<InternalUIEvent*>(mEvent);
mDetail = event->detail;
break;
}
@ -349,9 +348,9 @@ nsDOMUIEvent::IsChar() const
switch (mEvent->eventStructType)
{
case NS_KEY_EVENT:
return static_cast<nsKeyEvent*>(mEvent)->isChar;
return static_cast<WidgetKeyboardEvent*>(mEvent)->isChar;
case NS_TEXT_EVENT:
return static_cast<nsTextEvent*>(mEvent)->isChar;
return static_cast<WidgetTextEvent*>(mEvent)->isChar;
default:
return false;
}
@ -464,9 +463,9 @@ bool
nsDOMUIEvent::GetModifierStateInternal(const nsAString& aKey)
{
if (!mEvent->IsInputDerivedEvent()) {
MOZ_CRASH("mEvent must be nsInputEvent or derived class");
MOZ_CRASH("mEvent must be WidgetInputEvent or derived class");
}
nsInputEvent* inputEvent = static_cast<nsInputEvent*>(mEvent);
WidgetInputEvent* inputEvent = static_cast<WidgetInputEvent*>(mEvent);
if (aKey.EqualsLiteral(NS_DOM_KEYNAME_SHIFT)) {
return inputEvent->IsShift();
}

View File

@ -7,11 +7,13 @@
#include "nsDOMXULCommandEvent.h"
#include "prtime.h"
using namespace mozilla;
nsDOMXULCommandEvent::nsDOMXULCommandEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsInputEvent* aEvent)
WidgetInputEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext,
aEvent ? aEvent : new nsInputEvent(false, 0, nullptr))
aEvent ? aEvent : new WidgetInputEvent(false, 0, nullptr))
{
if (aEvent) {
mEventIsInternal = false;
@ -95,7 +97,7 @@ nsDOMXULCommandEvent::InitCommandEvent(const nsAString& aType,
nsresult NS_NewDOMXULCommandEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsInputEvent *aEvent)
WidgetInputEvent* aEvent)
{
nsDOMXULCommandEvent* it =
new nsDOMXULCommandEvent(aOwner, aPresContext, aEvent);

View File

@ -18,7 +18,8 @@ class nsDOMXULCommandEvent : public nsDOMUIEvent,
{
public:
nsDOMXULCommandEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext, nsInputEvent* aEvent);
nsPresContext* aPresContext,
mozilla::WidgetInputEvent* aEvent);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMXULCommandEvent, nsDOMUIEvent)
@ -76,8 +77,8 @@ public:
protected:
// Convenience accessor for the event
nsInputEvent* Event() {
return static_cast<nsInputEvent*>(mEvent);
mozilla::WidgetInputEvent* Event() {
return static_cast<mozilla::WidgetInputEvent*>(mEvent);
}
nsCOMPtr<nsIDOMEvent> mSourceEvent;

View File

@ -703,29 +703,29 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
static_cast<InternalScrollAreaEvent*>(aEvent));
case NS_KEY_EVENT:
return NS_NewDOMKeyboardEvent(aDOMEvent, aOwner, aPresContext,
static_cast<nsKeyEvent*>(aEvent));
static_cast<WidgetKeyboardEvent*>(aEvent));
case NS_COMPOSITION_EVENT:
return NS_NewDOMCompositionEvent(
aDOMEvent, aOwner,
aPresContext, static_cast<nsCompositionEvent*>(aEvent));
aPresContext, static_cast<WidgetCompositionEvent*>(aEvent));
case NS_MOUSE_EVENT:
return NS_NewDOMMouseEvent(aDOMEvent, aOwner, aPresContext,
static_cast<nsInputEvent*>(aEvent));
static_cast<WidgetInputEvent*>(aEvent));
case NS_FOCUS_EVENT:
return NS_NewDOMFocusEvent(aDOMEvent, aOwner, aPresContext,
static_cast<InternalFocusEvent*>(aEvent));
case NS_MOUSE_SCROLL_EVENT:
return NS_NewDOMMouseScrollEvent(aDOMEvent, aOwner, aPresContext,
static_cast<nsInputEvent*>(aEvent));
static_cast<WidgetInputEvent*>(aEvent));
case NS_WHEEL_EVENT:
return NS_NewDOMWheelEvent(aDOMEvent, aOwner, aPresContext,
static_cast<WheelEvent*>(aEvent));
case NS_DRAG_EVENT:
return NS_NewDOMDragEvent(aDOMEvent, aOwner, aPresContext,
static_cast<nsDragEvent*>(aEvent));
static_cast<WidgetDragEvent*>(aEvent));
case NS_TEXT_EVENT:
return NS_NewDOMTextEvent(aDOMEvent, aOwner, aPresContext,
static_cast<nsTextEvent*>(aEvent));
static_cast<WidgetTextEvent*>(aEvent));
case NS_CLIPBOARD_EVENT:
return NS_NewDOMClipboardEvent(aDOMEvent, aOwner, aPresContext,
static_cast<InternalClipboardEvent*>(aEvent));

View File

@ -935,7 +935,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
case NS_KEY_PRESS:
{
nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent;
WidgetKeyboardEvent* keyEvent = static_cast<WidgetKeyboardEvent*>(aEvent);
int32_t modifierMask = 0;
if (keyEvent->IsShift())
@ -992,69 +992,72 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
}
break;
case NS_QUERY_SELECTED_TEXT:
DoQuerySelectedText(static_cast<nsQueryContentEvent*>(aEvent));
DoQuerySelectedText(static_cast<WidgetQueryContentEvent*>(aEvent));
break;
case NS_QUERY_TEXT_CONTENT:
{
if (RemoteQueryContentEvent(aEvent))
break;
nsContentEventHandler handler(mPresContext);
handler.OnQueryTextContent((nsQueryContentEvent*)aEvent);
handler.OnQueryTextContent(static_cast<WidgetQueryContentEvent*>(aEvent));
}
break;
case NS_QUERY_CARET_RECT:
{
// XXX remote event
nsContentEventHandler handler(mPresContext);
handler.OnQueryCaretRect((nsQueryContentEvent*)aEvent);
handler.OnQueryCaretRect(static_cast<WidgetQueryContentEvent*>(aEvent));
}
break;
case NS_QUERY_TEXT_RECT:
{
// XXX remote event
nsContentEventHandler handler(mPresContext);
handler.OnQueryTextRect((nsQueryContentEvent*)aEvent);
handler.OnQueryTextRect(static_cast<WidgetQueryContentEvent*>(aEvent));
}
break;
case NS_QUERY_EDITOR_RECT:
{
// XXX remote event
nsContentEventHandler handler(mPresContext);
handler.OnQueryEditorRect((nsQueryContentEvent*)aEvent);
handler.OnQueryEditorRect(static_cast<WidgetQueryContentEvent*>(aEvent));
}
break;
case NS_QUERY_CONTENT_STATE:
{
// XXX remote event
nsContentEventHandler handler(mPresContext);
handler.OnQueryContentState(static_cast<nsQueryContentEvent*>(aEvent));
handler.OnQueryContentState(static_cast<WidgetQueryContentEvent*>(aEvent));
}
break;
case NS_QUERY_SELECTION_AS_TRANSFERABLE:
{
// XXX remote event
nsContentEventHandler handler(mPresContext);
handler.OnQuerySelectionAsTransferable(static_cast<nsQueryContentEvent*>(aEvent));
handler.OnQuerySelectionAsTransferable(
static_cast<WidgetQueryContentEvent*>(aEvent));
}
break;
case NS_QUERY_CHARACTER_AT_POINT:
{
// XXX remote event
nsContentEventHandler handler(mPresContext);
handler.OnQueryCharacterAtPoint(static_cast<nsQueryContentEvent*>(aEvent));
handler.OnQueryCharacterAtPoint(
static_cast<WidgetQueryContentEvent*>(aEvent));
}
break;
case NS_QUERY_DOM_WIDGET_HITTEST:
{
// XXX remote event
nsContentEventHandler handler(mPresContext);
handler.OnQueryDOMWidgetHittest(static_cast<nsQueryContentEvent*>(aEvent));
handler.OnQueryDOMWidgetHittest(
static_cast<WidgetQueryContentEvent*>(aEvent));
}
break;
case NS_SELECTION_SET:
{
nsSelectionEvent *selectionEvent =
static_cast<nsSelectionEvent*>(aEvent);
WidgetSelectionEvent *selectionEvent =
static_cast<WidgetSelectionEvent*>(aEvent);
if (IsTargetCrossProcess(selectionEvent)) {
// Will not be handled locally, remote the event
if (GetCrossProcessTarget()->SendSelectionEvent(*selectionEvent))
@ -1062,7 +1065,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
break;
}
nsContentEventHandler handler(mPresContext);
handler.OnSelectionEvent((nsSelectionEvent*)aEvent);
handler.OnSelectionEvent(static_cast<WidgetSelectionEvent*>(aEvent));
}
break;
case NS_CONTENT_COMMAND_CUT:
@ -1084,7 +1087,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
break;
case NS_TEXT_TEXT:
{
nsTextEvent *textEvent = static_cast<nsTextEvent*>(aEvent);
WidgetTextEvent *textEvent = static_cast<WidgetTextEvent*>(aEvent);
if (IsTargetCrossProcess(textEvent)) {
// Will not be handled locally, remote the event
if (GetCrossProcessTarget()->SendTextEvent(*textEvent)) {
@ -1098,10 +1101,10 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
if (aEvent->mFlags.mIsTrusted) {
// If the event is trusted event, set the selected text to data of
// composition event.
nsCompositionEvent *compositionEvent =
static_cast<nsCompositionEvent*>(aEvent);
nsQueryContentEvent selectedText(true, NS_QUERY_SELECTED_TEXT,
compositionEvent->widget);
WidgetCompositionEvent *compositionEvent =
static_cast<WidgetCompositionEvent*>(aEvent);
WidgetQueryContentEvent selectedText(true, NS_QUERY_SELECTED_TEXT,
compositionEvent->widget);
DoQuerySelectedText(&selectedText);
NS_ASSERTION(selectedText.mSucceeded, "Failed to get selected text");
compositionEvent->data = selectedText.mReply.mString;
@ -1110,8 +1113,8 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
case NS_COMPOSITION_UPDATE:
case NS_COMPOSITION_END:
{
nsCompositionEvent *compositionEvent =
static_cast<nsCompositionEvent*>(aEvent);
WidgetCompositionEvent *compositionEvent =
static_cast<WidgetCompositionEvent*>(aEvent);
if (IsTargetCrossProcess(compositionEvent)) {
// Will not be handled locally, remote the event
if (GetCrossProcessTarget()->SendCompositionEvent(*compositionEvent)) {
@ -1278,7 +1281,7 @@ nsEventStateManager::GetAccessKeyLabelPrefix(nsAString& aPrefix)
void
nsEventStateManager::HandleAccessKey(nsPresContext* aPresContext,
nsKeyEvent *aEvent,
WidgetKeyboardEvent* aEvent,
nsEventStatus* aStatus,
nsIDocShellTreeItem* aBubbledFrom,
ProcessingAccessKeyState aAccessKeyState,
@ -1388,7 +1391,7 @@ nsEventStateManager::DispatchCrossProcessEvent(nsEvent* aEvent,
return remote->SendRealMouseEvent(*mouseEvent);
}
case NS_KEY_EVENT: {
nsKeyEvent* keyEvent = static_cast<nsKeyEvent*>(aEvent);
WidgetKeyboardEvent* keyEvent = static_cast<WidgetKeyboardEvent*>(aEvent);
return remote->SendRealKeyEvent(*keyEvent);
}
case NS_WHEEL_EVENT: {
@ -1925,12 +1928,12 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
nsCOMPtr<nsIWidget> widget = mCurrentTarget->GetNearestWidget();
// get the widget from the target frame
nsDragEvent startEvent(aEvent->mFlags.mIsTrusted,
NS_DRAGDROP_START, widget);
WidgetDragEvent startEvent(aEvent->mFlags.mIsTrusted,
NS_DRAGDROP_START, widget);
FillInEventFromGestureDown(&startEvent);
nsDragEvent gestureEvent(aEvent->mFlags.mIsTrusted,
NS_DRAGDROP_GESTURE, widget);
WidgetDragEvent gestureEvent(aEvent->mFlags.mIsTrusted,
NS_DRAGDROP_GESTURE, widget);
FillInEventFromGestureDown(&gestureEvent);
startEvent.dataTransfer = gestureEvent.dataTransfer = dataTransfer;
@ -1958,7 +1961,7 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
nsEventDispatcher::Dispatch(targetContent, aPresContext, &startEvent, nullptr,
&status);
nsDragEvent* event = &startEvent;
WidgetDragEvent* event = &startEvent;
if (status != nsEventStatus_eConsumeNoDefault) {
status = nsEventStatus_eIgnore;
nsEventDispatcher::Dispatch(targetContent, aPresContext, &gestureEvent, nullptr,
@ -2083,7 +2086,7 @@ nsEventStateManager::DetermineDragTarget(nsPresContext* aPresContext,
bool
nsEventStateManager::DoDefaultDragStart(nsPresContext* aPresContext,
nsDragEvent* aDragEvent,
WidgetDragEvent* aDragEvent,
nsDOMDataTransfer* aDataTransfer,
nsIContent* aDragTarget,
nsISelection* aSelection)
@ -2475,8 +2478,8 @@ nsEventStateManager::SendLineScrollEvent(nsIFrame* aTargetFrame,
targetContent = targetContent->GetParent();
}
nsMouseScrollEvent event(aEvent->mFlags.mIsTrusted, NS_MOUSE_SCROLL,
aEvent->widget);
WidgetMouseScrollEvent event(aEvent->mFlags.mIsTrusted, NS_MOUSE_SCROLL,
aEvent->widget);
if (*aStatus == nsEventStatus_eConsumeNoDefault) {
event.mFlags.mDefaultPrevented = true;
}
@ -2511,8 +2514,8 @@ nsEventStateManager::SendPixelScrollEvent(nsIFrame* aTargetFrame,
targetContent = targetContent->GetParent();
}
nsMouseScrollEvent event(aEvent->mFlags.mIsTrusted, NS_MOUSE_PIXEL_SCROLL,
aEvent->widget);
WidgetMouseScrollEvent event(aEvent->mFlags.mIsTrusted, NS_MOUSE_PIXEL_SCROLL,
aEvent->widget);
if (*aStatus == nsEventStatus_eConsumeNoDefault) {
event.mFlags.mDefaultPrevented = true;
}
@ -3250,7 +3253,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
nsCOMPtr<nsIDOMDataTransfer> initialDataTransfer;
dragSession->GetDataTransfer(getter_AddRefs(initialDataTransfer));
nsDragEvent *dragEvent = (nsDragEvent*)aEvent;
WidgetDragEvent *dragEvent = static_cast<WidgetDragEvent*>(aEvent);
// collect any changes to moz cursor settings stored in the event's
// data transfer.
@ -3345,8 +3348,8 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
getter_AddRefs(targetContent));
nsCOMPtr<nsIWidget> widget = mCurrentTarget->GetNearestWidget();
nsDragEvent event(aEvent->mFlags.mIsTrusted,
NS_DRAGDROP_DRAGDROP, widget);
WidgetDragEvent event(aEvent->mFlags.mIsTrusted,
NS_DRAGDROP_DRAGDROP, widget);
nsMouseEvent* mouseEvent = static_cast<nsMouseEvent*>(aEvent);
event.refPoint = mouseEvent->refPoint;
@ -3380,7 +3383,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
case NS_KEY_PRESS:
if (nsEventStatus_eConsumeNoDefault != *aStatus) {
nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent;
WidgetKeyboardEvent* keyEvent = static_cast<WidgetKeyboardEvent*>(aEvent);
//This is to prevent keyboard scrolling while alt modifier in use.
if (!keyEvent->IsAlt()) {
switch(keyEvent->keyCode) {
@ -3397,10 +3400,9 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm && mDocument) {
// Shift focus forward or back depending on shift key
bool isDocMove = ((nsInputEvent*)aEvent)->IsControl() ||
(keyEvent->keyCode == NS_VK_F6);
uint32_t dir =
static_cast<nsInputEvent*>(aEvent)->IsShift() ?
bool isDocMove =
keyEvent->IsControl() || keyEvent->keyCode == NS_VK_F6;
uint32_t dir = keyEvent->IsShift() ?
(isDocMove ? static_cast<uint32_t>(nsIFocusManager::MOVEFOCUS_BACKWARDDOC) :
static_cast<uint32_t>(nsIFocusManager::MOVEFOCUS_BACKWARD)) :
(isDocMove ? static_cast<uint32_t>(nsIFocusManager::MOVEFOCUS_FORWARDDOC) :
@ -3448,8 +3450,8 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
bool
nsEventStateManager::RemoteQueryContentEvent(nsEvent *aEvent)
{
nsQueryContentEvent *queryEvent =
static_cast<nsQueryContentEvent*>(aEvent);
WidgetQueryContentEvent *queryEvent =
static_cast<WidgetQueryContentEvent*>(aEvent);
if (!IsTargetCrossProcess(queryEvent)) {
return false;
}
@ -4273,7 +4275,7 @@ nsEventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext,
nsWeakFrame& aTargetFrame)
{
nsEventStatus status = nsEventStatus_eIgnore;
nsDragEvent event(aEvent->mFlags.mIsTrusted, aMsg, aEvent->widget);
WidgetDragEvent event(aEvent->mFlags.mIsTrusted, aMsg, aEvent->widget);
event.refPoint = aEvent->refPoint;
event.modifiers = ((nsMouseEvent*)aEvent)->modifiers;
event.buttons = ((nsMouseEvent*)aEvent)->buttons;
@ -4306,7 +4308,7 @@ nsEventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext,
}
void
nsEventStateManager::UpdateDragDataTransfer(nsDragEvent* dragEvent)
nsEventStateManager::UpdateDragDataTransfer(WidgetDragEvent* dragEvent)
{
NS_ASSERTION(dragEvent, "drag event is null in UpdateDragDataTransfer!");
if (!dragEvent->dataTransfer)
@ -5048,7 +5050,7 @@ nsEventStateManager::DoContentCommandScrollEvent(
}
void
nsEventStateManager::DoQuerySelectedText(nsQueryContentEvent* aEvent)
nsEventStateManager::DoQuerySelectedText(WidgetQueryContentEvent* aEvent)
{
if (RemoteQueryContentEvent(aEvent)) {
return;

View File

@ -292,7 +292,7 @@ protected:
* Update the initial drag session data transfer with any changes that occur
* on cloned data transfer objects used for events.
*/
void UpdateDragDataTransfer(nsDragEvent* dragEvent);
void UpdateDragDataTransfer(mozilla::WidgetDragEvent* dragEvent);
nsresult SetClickCount(nsPresContext* aPresContext, nsMouseEvent *aEvent, nsEventStatus* aStatus);
nsresult CheckForAndDispatchClick(nsPresContext* aPresContext, nsMouseEvent *aEvent, nsEventStatus* aStatus);
@ -328,7 +328,7 @@ protected:
* @param aModifierMask modifier mask for the key event
*/
void HandleAccessKey(nsPresContext* aPresContext,
nsKeyEvent* aEvent,
mozilla::WidgetKeyboardEvent* aEvent,
nsEventStatus* aStatus,
nsIDocShellTreeItem* aBubbledFrom,
ProcessingAccessKeyState aAccessKeyState,
@ -691,10 +691,10 @@ protected:
* aSelection - the selection to be dragged
*/
bool DoDefaultDragStart(nsPresContext* aPresContext,
nsDragEvent* aDragEvent,
nsDOMDataTransfer* aDataTransfer,
nsIContent* aDragTarget,
nsISelection* aSelection);
mozilla::WidgetDragEvent* aDragEvent,
nsDOMDataTransfer* aDataTransfer,
nsIContent* aDragTarget,
nsISelection* aSelection);
bool IsTrackingDragGesture ( ) const { return mGestureDownContent != nullptr; }
/**
@ -709,7 +709,7 @@ protected:
nsresult DoContentCommandScrollEvent(
mozilla::WidgetContentCommandEvent* aEvent);
void DoQuerySelectedText(nsQueryContentEvent* aEvent);
void DoQuerySelectedText(mozilla::WidgetQueryContentEvent* aEvent);
bool RemoteQueryContentEvent(nsEvent *aEvent);
mozilla::dom::TabParent *GetCrossProcessTarget();

View File

@ -599,7 +599,7 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification,
nsEventStatus status = nsEventStatus_eIgnore;
if (!backup.GetLastData().IsEmpty()) {
nsTextEvent textEvent(true, NS_TEXT_TEXT, widget);
WidgetTextEvent textEvent(true, NS_TEXT_TEXT, widget);
textEvent.theText = backup.GetLastData();
textEvent.mFlags.mIsSynthesizedForTests = true;
widget->DispatchEvent(&textEvent, status);
@ -609,7 +609,7 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification,
}
status = nsEventStatus_eIgnore;
nsCompositionEvent endEvent(true, NS_COMPOSITION_END, widget);
WidgetCompositionEvent endEvent(true, NS_COMPOSITION_END, widget);
endEvent.data = backup.GetLastData();
endEvent.mFlags.mIsSynthesizedForTests = true;
widget->DispatchEvent(&endEvent, status);
@ -622,7 +622,7 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification,
nsEventStatus status = nsEventStatus_eIgnore;
if (!backup.GetLastData().IsEmpty()) {
nsCompositionEvent updateEvent(true, NS_COMPOSITION_UPDATE, widget);
WidgetCompositionEvent updateEvent(true, NS_COMPOSITION_UPDATE, widget);
updateEvent.data = backup.GetLastData();
updateEvent.mFlags.mIsSynthesizedForTests = true;
widget->DispatchEvent(&updateEvent, status);
@ -631,7 +631,7 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification,
}
status = nsEventStatus_eIgnore;
nsTextEvent textEvent(true, NS_TEXT_TEXT, widget);
WidgetTextEvent textEvent(true, NS_TEXT_TEXT, widget);
textEvent.theText = backup.GetLastData();
textEvent.mFlags.mIsSynthesizedForTests = true;
widget->DispatchEvent(&textEvent, status);
@ -641,7 +641,7 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification,
}
status = nsEventStatus_eIgnore;
nsCompositionEvent endEvent(true, NS_COMPOSITION_END, widget);
WidgetCompositionEvent endEvent(true, NS_COMPOSITION_END, widget);
endEvent.data = backup.GetLastData();
endEvent.mFlags.mIsSynthesizedForTests = true;
widget->DispatchEvent(&endEvent, status);

View File

@ -6,7 +6,9 @@
#include "nsPrivateTextRange.h"
#include "mozilla/TextEvents.h"
nsPrivateTextRange::nsPrivateTextRange(const nsTextRange &aTextRange)
using namespace mozilla;
nsPrivateTextRange::nsPrivateTextRange(const TextRange &aTextRange)
: mRangeStart(uint16_t(aTextRange.mStartOffset)),
mRangeEnd(uint16_t(aTextRange.mEndOffset)),
mRangeType(uint16_t(aTextRange.mRangeType)),
@ -38,7 +40,7 @@ NS_METHOD nsPrivateTextRange::GetRangeType(uint16_t* aRangeType)
return NS_OK;
}
NS_METHOD nsPrivateTextRange::GetRangeStyle(nsTextRangeStyle* aTextRangeStyle)
NS_METHOD nsPrivateTextRange::GetRangeStyle(TextRangeStyle* aTextRangeStyle)
{
NS_ENSURE_ARG_POINTER(aTextRangeStyle);
*aTextRangeStyle = mRangeStyle;

View File

@ -17,20 +17,20 @@ class nsPrivateTextRange MOZ_FINAL : public nsIPrivateTextRange
NS_DECL_ISUPPORTS
public:
nsPrivateTextRange(const nsTextRange &aTextRange);
nsPrivateTextRange(const mozilla::TextRange &aTextRange);
virtual ~nsPrivateTextRange(void);
NS_IMETHOD GetRangeStart(uint16_t* aRangeStart) MOZ_OVERRIDE;
NS_IMETHOD GetRangeEnd(uint16_t* aRangeEnd) MOZ_OVERRIDE;
NS_IMETHOD GetRangeType(uint16_t* aRangeType) MOZ_OVERRIDE;
NS_IMETHOD GetRangeStyle(nsTextRangeStyle* aRangeStyle) MOZ_OVERRIDE;
NS_IMETHOD GetRangeStart(uint16_t* aRangeStart) MOZ_OVERRIDE;
NS_IMETHOD GetRangeEnd(uint16_t* aRangeEnd) MOZ_OVERRIDE;
NS_IMETHOD GetRangeType(uint16_t* aRangeType) MOZ_OVERRIDE;
NS_IMETHOD GetRangeStyle(mozilla::TextRangeStyle* aRangeStyle) MOZ_OVERRIDE;
protected:
uint16_t mRangeStart;
uint16_t mRangeEnd;
uint16_t mRangeType;
nsTextRangeStyle mRangeStyle;
mozilla::TextRangeStyle mRangeStyle;
};
class nsPrivateTextRangeList MOZ_FINAL : public nsIPrivateTextRangeList

View File

@ -227,7 +227,8 @@ HTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
if (aVisitor.mEventStatus != nsEventStatus_eConsumeNoDefault &&
aVisitor.mEvent->IsLeftClickEvent()) {
nsUIEvent actEvent(aVisitor.mEvent->mFlags.mIsTrusted, NS_UI_ACTIVATE, 1);
InternalUIEvent actEvent(aVisitor.mEvent->mFlags.mIsTrusted,
NS_UI_ACTIVATE, 1);
nsCOMPtr<nsIPresShell> shell = aVisitor.mPresContext->GetPresShell();
if (shell) {
@ -259,7 +260,8 @@ HTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
{
// For backwards compat, trigger buttons with space or enter
// (bug 25300)
nsKeyEvent * keyEvent = (nsKeyEvent *)aVisitor.mEvent;
WidgetKeyboardEvent* keyEvent =
static_cast<WidgetKeyboardEvent*>(aVisitor.mEvent);
if ((keyEvent->keyCode == NS_VK_RETURN &&
NS_KEY_PRESS == aVisitor.mEvent->message) ||
(keyEvent->keyCode == NS_VK_SPACE &&

View File

@ -3298,7 +3298,8 @@ HTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
!IsSingleLineTextControl(true) &&
aVisitor.mEvent->IsLeftClickEvent() &&
!ShouldPreventDOMActivateDispatch(aVisitor.mEvent->originalTarget)) {
nsUIEvent actEvent(aVisitor.mEvent->mFlags.mIsTrusted, NS_UI_ACTIVATE, 1);
InternalUIEvent actEvent(aVisitor.mEvent->mFlags.mIsTrusted,
NS_UI_ACTIVATE, 1);
nsCOMPtr<nsIPresShell> shell = aVisitor.mPresContext->GetPresShell();
if (shell) {
@ -3416,7 +3417,8 @@ HTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
{
// For backwards compat, trigger checks/radios/buttons with
// space or enter (bug 25300)
nsKeyEvent* keyEvent = (nsKeyEvent*)aVisitor.mEvent;
WidgetKeyboardEvent* keyEvent =
static_cast<WidgetKeyboardEvent*>(aVisitor.mEvent);
if ((aVisitor.mEvent->message == NS_KEY_PRESS &&
keyEvent->keyCode == NS_VK_RETURN) ||
@ -3694,7 +3696,8 @@ HTMLInputElement::PostHandleEventForRangeThumb(nsEventChainPostVisitor& aVisitor
if (nsIPresShell::GetCapturingContent()) {
break; // don't start drag if someone else is already capturing
}
nsInputEvent* inputEvent = static_cast<nsInputEvent*>(aVisitor.mEvent);
WidgetInputEvent* inputEvent =
static_cast<WidgetInputEvent*>(aVisitor.mEvent);
if (inputEvent->IsShift() || inputEvent->IsControl() ||
inputEvent->IsAlt() || inputEvent->IsMeta() ||
inputEvent->IsAltGraph() || inputEvent->IsFn() ||
@ -3730,8 +3733,9 @@ HTMLInputElement::PostHandleEventForRangeThumb(nsEventChainPostVisitor& aVisitor
CancelRangeThumbDrag();
break;
}
SetValueOfRangeForUserEvent(rangeFrame->GetValueAtEventPoint(
static_cast<nsInputEvent*>(aVisitor.mEvent)));
SetValueOfRangeForUserEvent(
rangeFrame->GetValueAtEventPoint(
static_cast<WidgetInputEvent*>(aVisitor.mEvent)));
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
break;
@ -3744,13 +3748,14 @@ HTMLInputElement::PostHandleEventForRangeThumb(nsEventChainPostVisitor& aVisitor
// call CancelRangeThumbDrag() if that is the case. We just finish off
// the drag and set our final value (unless someone has called
// preventDefault() and prevents us getting here).
FinishRangeThumbDrag(static_cast<nsInputEvent*>(aVisitor.mEvent));
FinishRangeThumbDrag(static_cast<WidgetInputEvent*>(aVisitor.mEvent));
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
break;
case NS_KEY_PRESS:
if (mIsDraggingRange &&
static_cast<nsKeyEvent*>(aVisitor.mEvent)->keyCode == NS_VK_ESCAPE) {
static_cast<WidgetKeyboardEvent*>(aVisitor.mEvent)->keyCode ==
NS_VK_ESCAPE) {
CancelRangeThumbDrag();
}
break;

View File

@ -197,7 +197,7 @@ HTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
EventFlags eventFlags;
eventFlags.mMultipleActionsPrevented = true;
DispatchClickEvent(aVisitor.mPresContext,
static_cast<nsInputEvent*>(aVisitor.mEvent),
static_cast<WidgetInputEvent*>(aVisitor.mEvent),
content, false, &eventFlags, &status);
// Do we care about the status this returned? I don't think we do...
// Don't run another <label> off of this click

View File

@ -852,8 +852,8 @@ nsTextInputListener::HandleEvent(nsIDOMEvent* aEvent)
return NS_OK;
}
nsKeyEvent* keyEvent =
static_cast<nsKeyEvent*>(aEvent->GetInternalNSEvent());
WidgetKeyboardEvent* keyEvent =
static_cast<WidgetKeyboardEvent*>(aEvent->GetInternalNSEvent());
if (keyEvent->eventStructType != NS_KEY_EVENT) {
return NS_ERROR_UNEXPECTED;
}

View File

@ -8,9 +8,12 @@
#include "nsIInterfaceRequestorUtils.h"
#include "mozilla/BasicEvents.h"
using namespace mozilla;
nsDOMTimeEvent::nsDOMTimeEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext, nsEvent* aEvent)
: nsDOMEvent(aOwner, aPresContext, aEvent ? aEvent : new nsUIEvent(false, 0, 0)),
: nsDOMEvent(aOwner, aPresContext,
aEvent ? aEvent : new InternalUIEvent(false, 0, 0)),
mDetail(0)
{
SetIsDOMBinding();
@ -22,7 +25,7 @@ nsDOMTimeEvent::nsDOMTimeEvent(mozilla::dom::EventTarget* aOwner,
}
if (mEvent->eventStructType == NS_SMIL_TIME_EVENT) {
nsUIEvent* event = static_cast<nsUIEvent*>(mEvent);
InternalUIEvent* event = static_cast<InternalUIEvent*>(mEvent);
mDetail = event->detail;
}

View File

@ -92,7 +92,7 @@ namespace
NS_IMETHOD Run()
{
nsUIEvent event(true, mMsg, mDetail);
InternalUIEvent event(true, mMsg, mDetail);
event.eventStructType = NS_SMIL_TIME_EVENT;
nsPresContext* context = nullptr;

View File

@ -9,13 +9,14 @@
// Keep others in (case-insensitive) order:
#include "gfxMatrix.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "mozilla/RangedPtr.h"
#include "nsComputedDOMStyle.h"
#include "nsFontMetrics.h"
#include "nsIFrame.h"
#include "nsIScriptError.h"
#include "nsLayoutUtils.h"
#include "SVGAnimationElement.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "SVGAnimatedPreserveAspectRatio.h"
#include "nsContentUtils.h"
@ -366,3 +367,191 @@ SVGContentUtils::GetViewBoxTransform(float aViewportWidth, float aViewportHeight
return gfxMatrix(a, 0.0f, 0.0f, d, e, f);
}
/**
* True if 'aCh' is a decimal digit.
*/
static inline bool
IsDigit(PRUnichar aCh)
{
return aCh >= '0' && aCh <= '9';
}
/**
* Assuming that 'aCh' is a decimal digit, return its numeric value.
*/
static inline uint32_t
DecimalDigitValue(PRUnichar aCh)
{
MOZ_ASSERT(IsDigit(aCh), "Digit expected");
return aCh - '0';
}
template<class floatType>
bool
SVGContentUtils::ParseNumber(const nsAString& aString,
floatType& aValue,
nsAString& aLeftOver)
{
mozilla::RangedPtr<const PRUnichar> iter(aString.Data(), aString.Length());
const mozilla::RangedPtr<const PRUnichar> end(aString.Data() + aString.Length(),
aString.Data(), aString.Length());
if (iter == end) {
return false;
}
// Sign of the mantissa (-1 or 1).
int32_t sign = *iter == '-' ? -1 : 1;
if (*iter == '-' || *iter == '+') {
++iter;
if (iter == end) {
return false;
}
}
// Absolute value of the integer part of the mantissa.
floatType intPart = floatType(0);
bool gotDot = *iter == '.';
if (!gotDot) {
if (!IsDigit(*iter)) {
return false;
}
do {
intPart = floatType(10) * intPart + DecimalDigitValue(*iter);
++iter;
} while (iter != end && IsDigit(*iter));
if (iter != end) {
gotDot = *iter == '.';
}
}
// Fractional part of the mantissa.
floatType fracPart = floatType(0);
if (gotDot) {
++iter;
if (iter == end || !IsDigit(*iter)) {
return false;
}
// Power of ten by which we need to divide our next digit
floatType divisor = floatType(10);
do {
fracPart += DecimalDigitValue(*iter) / divisor;
divisor *= 10;
++iter;
} while (iter != end && IsDigit(*iter));
}
bool gotE = false;
int32_t exponent = 0;
int32_t expSign;
if (iter != end && (*iter == 'e' || *iter == 'E')) {
mozilla::RangedPtr<const PRUnichar> expIter(iter);
++expIter;
if (expIter != end) {
expSign = *expIter == '-' ? -1 : 1;
if (*expIter == '-' || *expIter == '+') {
++expIter;
if (expIter != end && IsDigit(*expIter)) {
// At this point we're sure this is an exponent
// and not the start of a unit such as em or ex.
gotE = true;
}
}
}
if (gotE) {
iter = expIter;
do {
exponent = 10 * exponent + DecimalDigitValue(*iter);
++iter;
} while (iter != end && IsDigit(*iter));
}
}
// Assemble the number
aValue = sign * (intPart + fracPart);
if (gotE) {
aValue *= pow(floatType(10), floatType(expSign * exponent));
}
aLeftOver = Substring(iter.get(), end.get());
return NS_finite(aValue);
}
template bool
SVGContentUtils::ParseNumber<float>(const nsAString& aString,
float& aValue,
nsAString& aLeftOver);
template bool
SVGContentUtils::ParseNumber<double>(const nsAString& aString,
double& aValue,
nsAString& aLeftOver);
template<class floatType>
bool
SVGContentUtils::ParseNumber(const nsAString& aString,
floatType& aValue)
{
nsAutoString leftOver;
if (!ParseNumber(aString, aValue, leftOver)) {
return false;
}
return leftOver.IsEmpty();
}
template bool
SVGContentUtils::ParseNumber<float>(const nsAString& aString,
float& aValue);
template bool
SVGContentUtils::ParseNumber<double>(const nsAString& aString,
double& aValue);
bool
SVGContentUtils::ParseInteger(const nsAString& aString,
int32_t& aValue)
{
mozilla::RangedPtr<const PRUnichar> iter(aString.Data(), aString.Length());
const mozilla::RangedPtr<const PRUnichar> end(aString.Data() + aString.Length(),
aString.Data(), aString.Length());
if (iter == end) {
return false;
}
int32_t sign = *iter == '-' ? -1 : 1;
if (*iter == '-' || *iter == '+') {
++iter;
if (iter == end) {
return false;
}
}
int64_t value = 0;
do {
if (!IsDigit(*iter)) {
return false;
}
if (value <= std::numeric_limits<int32_t>::max()) {
value = 10 * value + DecimalDigitValue(*iter);
}
++iter;
} while (iter != end);
aValue = int32_t(clamped(sign * value,
int64_t(std::numeric_limits<int32_t>::min()),
int64_t(std::numeric_limits<int32_t>::max())));
return true;
}

View File

@ -132,6 +132,34 @@ public:
float aViewboxWidth, float aViewboxHeight,
const SVGPreserveAspectRatio &aPreserveAspectRatio);
/**
* Parse a number of the form:
* number ::= integer ([Ee] integer)? | [+-]? [0-9]* "." [0-9]+ ([Ee] integer)?
* Parsing fails if the number cannot be represented by a floatType.
* Anything after the number is returned in aLeftOver.
*/
template<class floatType>
static bool
ParseNumber(const nsAString& aString, floatType& aValue,
nsAString& aLeftOver);
/**
* Parse a number of the form:
* number ::= integer ([Ee] integer)? | [+-]? [0-9]* "." [0-9]+ ([Ee] integer)?
* Parsing fails if there is anything left over after the number,
* or the number cannot be represented by a floatType.
*/
template<class floatType>
static bool
ParseNumber(const nsAString& aString, floatType& aValue);
/**
* Parse an integer of the form:
* integer ::= [+-]? [0-9]+
* Parsing fails if the number cannot be represented by an int32_t.
*/
static bool
ParseInteger(const nsAString& aString, int32_t& aValue);
};
#endif

View File

@ -8,10 +8,7 @@
#include "SVGLength.h"
#include "nsSVGElement.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsString.h"
#include "nsTextFormatter.h"
#include "prdtoa.h"
#include "nsMathUtils.h"
#include "SVGContentUtils.h"
#include <limits>
#include <algorithm>
@ -37,40 +34,22 @@ SVGLength::GetValueAsString(nsAString &aValue) const
}
bool
SVGLength::SetValueFromString(const nsAString &aValue)
SVGLength::SetValueFromString(const nsAString &aValueAsString)
{
float tmpValue;
uint16_t tmpUnit;
nsAutoString units;
float value;
NS_ConvertUTF16toUTF8 value(aValue);
const char *str = value.get();
if (!SVGContentUtils::ParseNumber(aValueAsString, value, units)) {
return false;
}
while (*str != '\0' && IsSVGWhitespace(*str)) {
++str;
uint16_t unitType = GetUnitTypeForString(units);
if (!IsValidUnitType(unitType)) {
return false;
}
char *unit;
tmpValue = float(PR_strtod(str, &unit));
if (unit != str && NS_finite(tmpValue)) {
char *theRest = unit;
while (*theRest != '\0' && !IsSVGWhitespace(*theRest)) {
++theRest;
}
tmpUnit = GetUnitTypeForString(
Substring(aValue, unit - str, theRest - unit));
if (tmpUnit == nsIDOMSVGLength::SVG_LENGTHTYPE_UNKNOWN) {
// SVGContentUtils::ReportToConsole
return false;
}
while (*theRest && IsSVGWhitespace(*theRest)) {
++theRest;
}
if (!*theRest) {
mValue = tmpValue;
mUnit = tmpUnit;
return true;
}
}
return false;
mValue = value;
mUnit = uint8_t(unitType);
return true;
}
inline static bool

View File

@ -49,8 +49,6 @@ SVGLengthList::SetValueFromString(const nsAString& aValue)
nsCharSeparatedTokenizerTemplate<IsSVGWhitespace>
tokenizer(aValue, ',', nsCharSeparatedTokenizer::SEPARATOR_OPTIONAL);
nsAutoCString str; // outside loop to minimize memory churn
while (tokenizer.hasMoreTokens()) {
SVGLength length;
if (!length.SetValueFromString(tokenizer.nextToken())) {

View File

@ -7,11 +7,8 @@
#include "SVGNumberList.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsError.h"
#include "nsMathUtils.h"
#include "nsString.h"
#include "nsTextFormatter.h"
#include "prdtoa.h"
#include "SVGContentUtils.h"
namespace mozilla {
@ -55,17 +52,9 @@ SVGNumberList::SetValueFromString(const nsAString& aValue)
nsCharSeparatedTokenizerTemplate<IsSVGWhitespace>
tokenizer(aValue, ',', nsCharSeparatedTokenizer::SEPARATOR_OPTIONAL);
nsAutoCString str; // outside loop to minimize memory churn
while (tokenizer.hasMoreTokens()) {
CopyUTF16toUTF8(tokenizer.nextToken(), str); // NS_ConvertUTF16toUTF8
const char *token = str.get();
if (*token == '\0') {
return NS_ERROR_DOM_SYNTAX_ERR; // nothing between commas
}
char *end;
float num = float(PR_strtod(token, &end));
if (*end != '\0' || !NS_finite(num)) {
float num;
if (!SVGContentUtils::ParseNumber(tokenizer.nextToken(), num)) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
if (!temp.AppendItem(num)) {

View File

@ -6,12 +6,8 @@
#include "mozilla/Util.h"
#include "SVGPointList.h"
#include "nsError.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsMathUtils.h"
#include "nsString.h"
#include "nsTextFormatter.h"
#include "prdtoa.h"
#include "SVGContentUtils.h"
namespace mozilla {
@ -62,45 +58,30 @@ SVGPointList::SetValueFromString(const nsAString& aValue)
nsCharSeparatedTokenizerTemplate<IsSVGWhitespace>
tokenizer(aValue, ',', nsCharSeparatedTokenizer::SEPARATOR_OPTIONAL);
nsAutoCString str1, str2; // outside loop to minimize memory churn
while (tokenizer.hasMoreTokens()) {
CopyUTF16toUTF8(tokenizer.nextToken(), str1);
const char *token1 = str1.get();
if (*token1 == '\0') {
float x;
nsAutoString leftOver;
if (!SVGContentUtils::ParseNumber(tokenizer.nextToken(), x, leftOver)) {
rv = NS_ERROR_DOM_SYNTAX_ERR;
break;
}
char *end;
float x = float(PR_strtod(token1, &end));
if (end == token1 || !NS_finite(x)) {
rv = NS_ERROR_DOM_SYNTAX_ERR;
break;
}
const char *token2;
if (*end == '-') {
float y;
if (leftOver.IsEmpty()) {
if (!tokenizer.hasMoreTokens() ||
!SVGContentUtils::ParseNumber(tokenizer.nextToken(), y)) {
rv = NS_ERROR_DOM_SYNTAX_ERR;
break;
}
} else {
// It's possible for the token to be 10-30 which has
// no separator but needs to be parsed as 10, -30
token2 = end;
} else {
if (!tokenizer.hasMoreTokens()) {
rv = NS_ERROR_DOM_SYNTAX_ERR;
break;
}
CopyUTF16toUTF8(tokenizer.nextToken(), str2);
token2 = str2.get();
if (*token2 == '\0') {
if (leftOver[0] != '-' || !SVGContentUtils::ParseNumber(leftOver, y)) {
rv = NS_ERROR_DOM_SYNTAX_ERR;
break;
}
}
float y = float(PR_strtod(token2, &end));
if (*end != '\0' || !NS_finite(y)) {
rv = NS_ERROR_DOM_SYNTAX_ERR;
break;
}
temp.AppendItem(SVGPoint(x, y));
}
if (tokenizer.separatorAfterCurrentToken()) {

View File

@ -11,7 +11,6 @@
#include "nsSMILValue.h"
#include "nsSVGAttrTearoffTable.h"
#include "nsTextFormatter.h"
#include "prdtoa.h"
#include "SVGAngle.h"
#include "SVGAnimatedAngle.h"
#include "SVGOrientSMILType.h"
@ -94,28 +93,19 @@ GetValueString(nsAString &aValueAsString, float aValue, uint16_t aUnitType)
aValueAsString.Append(unitString);
}
static nsresult
GetValueFromString(const nsAString &aValueAsString,
float *aValue,
uint16_t *aUnitType)
static bool
GetValueFromString(const nsAString& aValueAsString,
float& aValue,
uint16_t* aUnitType)
{
NS_ConvertUTF16toUTF8 value(aValueAsString);
const char *str = value.get();
nsAutoString units;
if (IsSVGWhitespace(*str))
return NS_ERROR_DOM_SYNTAX_ERR;
char *rest;
*aValue = float(PR_strtod(str, &rest));
if (rest != str && NS_finite(*aValue)) {
*aUnitType = GetUnitTypeForString(
Substring(aValueAsString, rest - str));
if (IsValidUnitType(*aUnitType)) {
return NS_OK;
}
if (!SVGContentUtils::ParseNumber(aValueAsString, aValue, units)) {
return false;
}
return NS_ERROR_DOM_SYNTAX_ERR;
*aUnitType = GetUnitTypeForString(units);
return IsValidUnitType(*aUnitType);
}
/* static */ float
@ -258,12 +248,11 @@ nsSVGAngle::SetBaseValueString(const nsAString &aValueAsString,
nsSVGElement *aSVGElement,
bool aDoSetAttr)
{
float value = 0;
uint16_t unitType = 0;
float value;
uint16_t unitType;
nsresult rv = GetValueFromString(aValueAsString, &value, &unitType);
if (NS_FAILED(rv)) {
return rv;
if (!GetValueFromString(aValueAsString, value, &unitType)) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
if (mBaseVal == value && mBaseValUnit == uint8_t(unitType)) {
return NS_OK;
@ -382,9 +371,8 @@ nsSVGAngle::SMILOrient::ValueFromString(const nsAString& aStr,
} else {
float value;
uint16_t unitType;
nsresult rv = GetValueFromString(aStr, &value, &unitType);
if (NS_FAILED(rv)) {
return rv;
if (!GetValueFromString(aStr, value, &unitType)) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
val.mU.mOrient.mAngle = value;
val.mU.mOrient.mUnit = unitType;

View File

@ -6,10 +6,10 @@
#include "nsSVGAnimatedTransformList.h"
#include "mozilla/dom/SVGAnimatedTransformList.h"
#include "mozilla/dom/SVGAnimationElement.h"
#include "nsSMILValue.h"
#include "prdtoa.h"
#include "SVGContentUtils.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsSVGTransform.h"
#include "nsSMILValue.h"
#include "SVGContentUtils.h"
#include "SVGTransformListSMILType.h"
namespace mozilla {
@ -235,54 +235,27 @@ nsSVGAnimatedTransformList::SMILAnimatedTransformList::ParseValue(
aResult.Swap(val);
}
namespace
{
inline void
SkipWsp(nsACString::const_iterator& aIter,
const nsACString::const_iterator& aIterEnd)
{
while (aIter != aIterEnd && IsSVGWhitespace(*aIter))
++aIter;
}
} // end anonymous namespace block
int32_t
nsSVGAnimatedTransformList::SMILAnimatedTransformList::ParseParameterList(
const nsAString& aSpec,
float* aVars,
int32_t aNVars)
{
NS_ConvertUTF16toUTF8 spec(aSpec);
nsACString::const_iterator start, end;
spec.BeginReading(start);
spec.EndReading(end);
SkipWsp(start, end);
nsCharSeparatedTokenizerTemplate<IsSVGWhitespace>
tokenizer(aSpec, ',', nsCharSeparatedTokenizer::SEPARATOR_OPTIONAL);
int numArgsFound = 0;
while (start != end) {
char const *arg = start.get();
char *argend;
float f = float(PR_strtod(arg, &argend));
if (arg == argend || argend > end.get() || !NS_finite(f))
return -1;
while (tokenizer.hasMoreTokens()) {
float f;
if (!SVGContentUtils::ParseNumber(tokenizer.nextToken(), f)) {
return -1;
}
if (numArgsFound < aNVars) {
aVars[numArgsFound] = f;
}
start.advance(argend - arg);
numArgsFound++;
SkipWsp(start, end);
if (*start == ',') {
++start;
SkipWsp(start, end);
}
}
return numArgsFound;
}

View File

@ -24,19 +24,19 @@ SVGAnimatedBooleanTearoffTable()
return sSVGAnimatedBooleanTearoffTable;
}
static nsresult
GetValueFromString(const nsAString &aValueAsString,
bool *aValue)
static bool
GetValueFromString(const nsAString& aValueAsString,
bool& aValue)
{
if (aValueAsString.EqualsLiteral("true")) {
*aValue = true;
return NS_OK;
aValue = true;
return true;
}
if (aValueAsString.EqualsLiteral("false")) {
*aValue = false;
return NS_OK;
aValue = false;
return true;
}
return NS_ERROR_DOM_SYNTAX_ERR;
return false;
}
static nsresult
@ -141,9 +141,8 @@ nsSVGBoolean::SMILBool::ValueFromString(const nsAString& aStr,
bool& aPreventCachingOfSandwich) const
{
bool value;
nsresult rv = GetValueFromString(aStr, &value);
if (NS_FAILED(rv)) {
return rv;
if (!GetValueFromString(aStr, value)) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
nsSMILValue val(SMILBoolType::Singleton());

View File

@ -18,36 +18,14 @@ using namespace mozilla::dom;
static nsSVGAttrTearoffTable<nsSVGInteger, nsSVGInteger::DOMAnimatedInteger>
sSVGAnimatedIntegerTearoffTable;
static nsresult
GetValueFromString(const nsAString &aValueAsString,
int32_t *aValue)
{
NS_ConvertUTF16toUTF8 value(aValueAsString);
const char *str = value.get();
if (IsSVGWhitespace(*str))
return NS_ERROR_DOM_SYNTAX_ERR;
char *rest;
*aValue = strtol(str, &rest, 10);
if (rest == str || *rest != '\0') {
return NS_ERROR_DOM_SYNTAX_ERR;
}
if (*rest == '\0') {
return NS_OK;
}
return NS_ERROR_DOM_SYNTAX_ERR;
}
nsresult
nsSVGInteger::SetBaseValueString(const nsAString &aValueAsString,
nsSVGElement *aSVGElement)
{
int32_t value;
nsresult rv = GetValueFromString(aValueAsString, &value);
if (NS_FAILED(rv)) {
return rv;
if (!SVGContentUtils::ParseInteger(aValueAsString, value)) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
mIsBaseSet = true;
@ -133,9 +111,8 @@ nsSVGInteger::SMILInteger::ValueFromString(const nsAString& aStr,
{
int32_t val;
nsresult rv = GetValueFromString(aStr, &val);
if (NS_FAILED(rv)) {
return rv;
if (!SVGContentUtils::ParseInteger(aStr, val)) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
nsSMILValue smilVal(SMILIntegerType::Singleton());

View File

@ -35,16 +35,8 @@ ParseIntegerOptionalInteger(const nsAString& aValue,
uint32_t i;
for (i = 0; i < 2 && tokenizer.hasMoreTokens(); ++i) {
NS_ConvertUTF16toUTF8 utf8Token(tokenizer.nextToken());
const char *token = utf8Token.get();
if (*token == '\0') {
return NS_ERROR_DOM_SYNTAX_ERR; // empty string (e.g. two commas in a row)
}
char *end;
aValues[i] = strtol(token, &end, 10);
if (*end != '\0' || !NS_finite(aValues[i])) {
return NS_ERROR_DOM_SYNTAX_ERR; // parse error
if (!SVGContentUtils::ParseInteger(tokenizer.nextToken(), aValues[i])) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
}
if (i == 1) {

View File

@ -15,7 +15,6 @@
#include "nsSVGAttrTearoffTable.h"
#include "nsSVGIntegrationUtils.h"
#include "nsTextFormatter.h"
#include "prdtoa.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -122,28 +121,17 @@ GetValueString(nsAString &aValueAsString, float aValue, uint16_t aUnitType)
aValueAsString.Append(unitString);
}
static nsresult
GetValueFromString(const nsAString &aValueAsString,
float *aValue,
uint16_t *aUnitType)
static bool
GetValueFromString(const nsAString& aValueAsString,
float& aValue,
uint16_t* aUnitType)
{
NS_ConvertUTF16toUTF8 value(aValueAsString);
const char *str = value.get();
if (IsSVGWhitespace(*str))
return NS_ERROR_DOM_SYNTAX_ERR;
char *rest;
*aValue = float(PR_strtod(str, &rest));
if (rest != str && NS_finite(*aValue)) {
*aUnitType = GetUnitTypeForString(
Substring(aValueAsString, rest - str));
if (IsValidUnitType(*aUnitType)) {
return NS_OK;
}
nsAutoString units;
if (!SVGContentUtils::ParseNumber(aValueAsString, aValue, units)) {
return false;
}
return NS_ERROR_DOM_SYNTAX_ERR;
*aUnitType = GetUnitTypeForString(units);
return IsValidUnitType(*aUnitType);
}
static float
@ -399,12 +387,11 @@ nsSVGLength2::SetBaseValueString(const nsAString &aValueAsString,
float value;
uint16_t unitType;
nsresult rv = GetValueFromString(aValueAsString, &value, &unitType);
if (NS_FAILED(rv)) {
return rv;
if (!GetValueFromString(aValueAsString, value, &unitType)) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
if (mIsBaseSet && mBaseVal == value &&
if (mIsBaseSet && mBaseVal == float(value) &&
mSpecifiedUnitType == uint8_t(unitType)) {
return NS_OK;
}
@ -503,9 +490,8 @@ nsSVGLength2::SMILLength::ValueFromString(const nsAString& aStr,
float value;
uint16_t unitType;
nsresult rv = GetValueFromString(aStr, &value, &unitType);
if (NS_FAILED(rv)) {
return rv;
if (!GetValueFromString(aStr, value, &unitType)) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
nsSMILValue val(nsSMILFloatType::Singleton());

View File

@ -6,12 +6,10 @@
#include "nsSVGNumber2.h"
#include "mozilla/Attributes.h"
#include "nsContentUtils.h" // NS_ENSURE_FINITE
#include "nsError.h"
#include "nsIDOMSVGNumber.h"
#include "nsSMILFloatType.h"
#include "nsSMILValue.h"
#include "nsSVGAttrTearoffTable.h"
#include "prdtoa.h"
#include "SVGContentUtils.h"
using namespace mozilla;
@ -50,30 +48,23 @@ NS_INTERFACE_MAP_END
static nsSVGAttrTearoffTable<nsSVGNumber2, nsSVGNumber2::DOMAnimatedNumber>
sSVGAnimatedNumberTearoffTable;
static nsresult
GetValueFromString(const nsAString &aValueAsString,
static bool
GetValueFromString(const nsAString& aValueAsString,
bool aPercentagesAllowed,
float *aValue)
float& aValue)
{
NS_ConvertUTF16toUTF8 value(aValueAsString);
const char *str = value.get();
nsAutoString units;
if (IsSVGWhitespace(*str))
return NS_ERROR_DOM_SYNTAX_ERR;
char *rest;
*aValue = float(PR_strtod(str, &rest));
if (rest == str || !NS_finite(*aValue)) {
return NS_ERROR_DOM_SYNTAX_ERR;
if (!SVGContentUtils::ParseNumber(aValueAsString, aValue, units)) {
return false;
}
if (*rest == '%' && aPercentagesAllowed) {
*aValue /= 100;
++rest;
if (aPercentagesAllowed && units.EqualsLiteral("%")) {
aValue /= 100;
return true;
}
if (*rest == '\0') {
return NS_OK;
}
return NS_ERROR_DOM_SYNTAX_ERR;
return units.IsEmpty();
}
nsresult
@ -82,11 +73,10 @@ nsSVGNumber2::SetBaseValueString(const nsAString &aValueAsString,
{
float val;
nsresult rv = GetValueFromString(
aValueAsString, aSVGElement->NumberAttrAllowsPercentage(mAttrEnum), &val);
if (NS_FAILED(rv)) {
return rv;
if (!GetValueFromString(aValueAsString,
aSVGElement->NumberAttrAllowsPercentage(mAttrEnum),
val)) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
mBaseVal = val;
@ -172,11 +162,10 @@ nsSVGNumber2::SMILNumber::ValueFromString(const nsAString& aStr,
{
float value;
nsresult rv = GetValueFromString(
aStr, mSVGElement->NumberAttrAllowsPercentage(mVal->mAttrEnum), &value);
if (NS_FAILED(rv)) {
return rv;
if (!GetValueFromString(aStr,
mSVGElement->NumberAttrAllowsPercentage(mVal->mAttrEnum),
value)) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
nsSMILValue val(nsSMILFloatType::Singleton());

View File

@ -6,9 +6,6 @@
#include "nsSVGNumberPair.h"
#include "nsSVGAttrTearoffTable.h"
#include "nsCharSeparatedTokenizer.h"
#include "prdtoa.h"
#include "nsError.h"
#include "nsMathUtils.h"
#include "nsSMILValue.h"
#include "SVGContentUtils.h"
#include "SVGNumberPairSMILType.h"
@ -34,16 +31,8 @@ ParseNumberOptionalNumber(const nsAString& aValue,
uint32_t i;
for (i = 0; i < 2 && tokenizer.hasMoreTokens(); ++i) {
NS_ConvertUTF16toUTF8 utf8Token(tokenizer.nextToken());
const char *token = utf8Token.get();
if (*token == '\0') {
return NS_ERROR_DOM_SYNTAX_ERR; // empty string (e.g. two commas in a row)
}
char *end;
aValues[i] = float(PR_strtod(token, &end));
if (*end != '\0' || !NS_finite(aValues[i])) {
return NS_ERROR_DOM_SYNTAX_ERR; // parse error
if (!SVGContentUtils::ParseNumber(tokenizer.nextToken(), aValues[i])) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
}
if (i == 1) {

View File

@ -4,10 +4,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsSVGViewBox.h"
#include "prdtoa.h"
#include "nsTextFormatter.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsSMILValue.h"
#include "nsTextFormatter.h"
#include "SVGContentUtils.h"
#include "SVGViewBoxSMILType.h"
@ -122,16 +121,8 @@ ToSVGViewBoxRect(const nsAString& aStr, nsSVGViewBoxRect *aViewBox)
float vals[NUM_VIEWBOX_COMPONENTS];
uint32_t i;
for (i = 0; i < NUM_VIEWBOX_COMPONENTS && tokenizer.hasMoreTokens(); ++i) {
NS_ConvertUTF16toUTF8 utf8Token(tokenizer.nextToken());
const char *token = utf8Token.get();
if (*token == '\0') {
return NS_ERROR_DOM_SYNTAX_ERR; // empty string (e.g. two commas in a row)
}
char *end;
vals[i] = float(PR_strtod(token, &end));
if (*end != '\0' || !NS_finite(vals[i])) {
return NS_ERROR_DOM_SYNTAX_ERR; // parse error
if (!SVGContentUtils::ParseNumber(tokenizer.nextToken(), vals[i])) {
return NS_ERROR_DOM_SYNTAX_ERR;
}
}

View File

@ -97,10 +97,10 @@ function runTests()
is(blur.getAttribute("stdDeviation"), "8.5", "number-optional-number attribute");
blur.setStdDeviation(24.5, 0.5);
is(blur.stdDeviationX.baseVal, 24.5, "integer-optional-integer first baseVal");
is(blur.stdDeviationX.animVal, 24.5, "integer-optional-integer first animVal");
is(blur.stdDeviationY.baseVal, 0.5, "integer-optional-integer second baseVal");
is(blur.stdDeviationY.animVal, 0.5, "integer-optional-integer second animVal");
is(blur.stdDeviationX.baseVal, 24.5, "number-optional-number first baseVal");
is(blur.stdDeviationX.animVal, 24.5, "number-optional-number first animVal");
is(blur.stdDeviationY.baseVal, 0.5, "number-optional-number second baseVal");
is(blur.stdDeviationY.animVal, 0.5, "number-optional-number second animVal");
blur.setAttribute("stdDeviation", "");
ok(blur.getAttribute("stdDeviation") === "",
@ -144,6 +144,27 @@ function runTests()
is(filter.filterResY.baseVal, 90, "integer-optional-integer second baseVal");
is(filter.filterResY.animVal, 90, "integer-optional-integer second animVal");
// 32 bit integer range
filter.setFilterRes(-2147483648, 2147483647);
is(filter.filterResX.baseVal, -2147483648, "integer-optional-integer first baseVal");
is(filter.filterResX.animVal, -2147483648, "integer-optional-integer first animVal");
is(filter.filterResY.baseVal, 2147483647, "integer-optional-integer second baseVal");
is(filter.filterResY.animVal, 2147483647, "integer-optional-integer second animVal");
// too big, clamp
filter.setAttribute("filterRes", "-2147483649, 2147483648");
is(filter.filterResX.baseVal, -2147483648, "integer-optional-integer first baseVal");
is(filter.filterResX.animVal, -2147483648, "integer-optional-integer first animVal");
is(filter.filterResY.baseVal, 2147483647, "integer-optional-integer second baseVal");
is(filter.filterResY.animVal, 2147483647, "integer-optional-integer second animVal");
// invalid
filter.setAttribute("filterRes", "-00000000000invalid, 214748364720invalid");
is(filter.filterResX.baseVal, 0, "integer-optional-integer first baseVal");
is(filter.filterResX.animVal, 0, "integer-optional-integer first animVal");
is(filter.filterResY.baseVal, 0, "integer-optional-integer second baseVal");
is(filter.filterResY.animVal, 0, "integer-optional-integer second animVal");
filter.setAttribute("filterRes", "");
ok(filter.getAttribute("filterRes") === "",
"empty integer-optional-integer attribute");

View File

@ -912,7 +912,7 @@ nsXBLPrototypeHandler::ModifiersMatchMask(nsIDOMUIEvent* aEvent,
{
nsEvent* event = aEvent->GetInternalNSEvent();
NS_ENSURE_TRUE(event && event->IsInputDerivedEvent(), false);
nsInputEvent* inputEvent = static_cast<nsInputEvent*>(event);
WidgetInputEvent* inputEvent = static_cast<WidgetInputEvent*>(event);
if (mKeyMask & cMetaMask) {
if (inputEvent->IsMeta() != ((mKeyMask & cMeta) != 0)) {

View File

@ -360,10 +360,10 @@ nsXBLWindowKeyHandler::WalkHandlers(nsIDOMKeyEvent* aKeyEvent, nsIAtom* aEventTy
root->GetControllers(getter_AddRefs(controllers));
}
nsKeyEvent* keyEvent =
static_cast<nsKeyEvent*>(aKeyEvent->GetInternalNSEvent());
WidgetKeyboardEvent* keyEvent =
static_cast<WidgetKeyboardEvent*>(aKeyEvent->GetInternalNSEvent());
MOZ_ASSERT(keyEvent->eventStructType == NS_KEY_EVENT,
"DOM key event's internal event must be nsKeyEvent");
"DOM key event's internal event must be WidgetKeyboardEvent");
bool handled = false;
switch (keyEvent->message) {

View File

@ -1190,8 +1190,8 @@ nsXULElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
}
}
nsInputEvent* orig =
static_cast<nsInputEvent*>(aVisitor.mEvent);
WidgetInputEvent* orig =
static_cast<WidgetInputEvent*>(aVisitor.mEvent);
nsContentUtils::DispatchXULCommand(
commandContent,
aVisitor.mEvent->mFlags.mIsTrusted,

View File

@ -82,7 +82,7 @@ CompositionStringSynthesizer::AppendClause(uint32_t aLength,
case ATTR_SELECTEDRAWTEXT:
case ATTR_CONVERTEDTEXT:
case ATTR_SELECTEDCONVERTEDTEXT: {
nsTextRange textRange;
TextRange textRange;
textRange.mStartOffset =
mClauses.IsEmpty() ? 0 : mClauses[mClauses.Length() - 1].mEndOffset;
textRange.mEndOffset = textRange.mStartOffset + aLength;
@ -134,7 +134,7 @@ CompositionStringSynthesizer::DispatchEvent(bool* aDefaultPrevented)
mClauses.AppendElement(mCaret);
}
nsTextEvent textEvent(true, NS_TEXT_TEXT, widget);
WidgetTextEvent textEvent(true, NS_TEXT_TEXT, widget);
textEvent.time = PR_IntervalNow();
textEvent.theText = mString;
textEvent.rangeCount = mClauses.Length();

View File

@ -32,8 +32,8 @@ public:
private:
nsWeakPtr mWindow; // refers an instance of nsPIDOMWindow
nsString mString;
nsAutoTArray<nsTextRange, 10> mClauses;
nsTextRange mCaret;
nsAutoTArray<TextRange, 10> mClauses;
TextRange mCaret;
nsIWidget* GetWidget();
void ClearInternal();

View File

@ -931,7 +931,7 @@ nsDOMWindowUtils::SendKeyEvent(const nsAString& aType,
else
return NS_ERROR_FAILURE;
nsKeyEvent event(true, msg, widget);
WidgetKeyboardEvent event(true, msg, widget);
event.modifiers = GetWidgetModifiers(aModifiers);
if (msg == NS_KEY_PRESS) {
@ -1824,7 +1824,7 @@ nsDOMWindowUtils::SendCompositionEvent(const nsAString& aType,
return NS_ERROR_FAILURE;
}
nsCompositionEvent compositionEvent(true, msg, widget);
WidgetCompositionEvent compositionEvent(true, msg, widget);
InitEvent(compositionEvent);
if (msg != NS_COMPOSITION_START) {
compositionEvent.data = aData;
@ -1901,7 +1901,7 @@ nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType,
if (aType == QUERY_CHARACTER_AT_POINT) {
// Looking for the widget at the point.
nsQueryContentEvent dummyEvent(true, NS_QUERY_CONTENT_STATE, widget);
WidgetQueryContentEvent dummyEvent(true, NS_QUERY_CONTENT_STATE, widget);
InitEvent(dummyEvent, &pt);
nsIFrame* popupFrame =
nsLayoutUtils::GetPopupFrameForEventCoordinates(presContext->GetRootPresContext(), &dummyEvent);
@ -1926,7 +1926,7 @@ nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType,
pt += LayoutDeviceIntPoint::FromUntyped(
widget->WidgetToScreenOffset() - targetWidget->WidgetToScreenOffset());
nsQueryContentEvent queryEvent(true, aType, targetWidget);
WidgetQueryContentEvent queryEvent(true, aType, targetWidget);
InitEvent(queryEvent, &pt);
switch (aType) {
@ -1970,7 +1970,7 @@ nsDOMWindowUtils::SendSelectionSetEvent(uint32_t aOffset,
return NS_ERROR_FAILURE;
}
nsSelectionEvent selectionEvent(true, NS_SELECTION_SET, widget);
WidgetSelectionEvent selectionEvent(true, NS_SELECTION_SET, widget);
InitEvent(selectionEvent);
selectionEvent.mOffset = aOffset;

View File

@ -8,6 +8,8 @@
#include "nsPoint.h"
#include "mozilla/TextEvents.h"
using namespace mozilla;
NS_INTERFACE_MAP_BEGIN(nsQueryContentEventResult)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIQueryContentEventResult)
NS_INTERFACE_MAP_ENTRY(nsIQueryContentEventResult)
@ -120,13 +122,13 @@ nsQueryContentEventResult::GetNotFound(bool *aNotFound)
NS_ENSURE_TRUE(mEventID == NS_QUERY_SELECTED_TEXT ||
mEventID == NS_QUERY_CHARACTER_AT_POINT,
NS_ERROR_NOT_AVAILABLE);
*aNotFound = (mOffset == nsQueryContentEvent::NOT_FOUND);
*aNotFound = (mOffset == WidgetQueryContentEvent::NOT_FOUND);
return NS_OK;
}
void
nsQueryContentEventResult::SetEventResult(nsIWidget* aWidget,
const nsQueryContentEvent &aEvent)
const WidgetQueryContentEvent &aEvent)
{
mEventID = aEvent.message;
mSucceeded = aEvent.mSucceeded;

View File

@ -19,7 +19,8 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIQUERYCONTENTEVENTRESULT
void SetEventResult(nsIWidget* aWidget, const nsQueryContentEvent &aEvent);
void SetEventResult(nsIWidget* aWidget,
const mozilla::WidgetQueryContentEvent &aEvent);
protected:
uint32_t mEventID;

View File

@ -242,7 +242,7 @@ nsresult
NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsInputEvent* aEvent);
mozilla::WidgetInputEvent* aEvent);
nsresult
NS_NewDOMFocusEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
@ -252,7 +252,7 @@ nsresult
NS_NewDOMMouseScrollEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsInputEvent* aEvent);
mozilla::WidgetInputEvent* aEvent);
nsresult
NS_NewDOMWheelEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
@ -262,7 +262,7 @@ nsresult
NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsDragEvent* aEvent);
mozilla::WidgetDragEvent* aEvent);
nsresult
NS_NewDOMClipboardEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
@ -273,12 +273,12 @@ nsresult
NS_NewDOMKeyboardEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsKeyEvent* aEvent);
mozilla::WidgetKeyboardEvent* aEvent);
nsresult
NS_NewDOMCompositionEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsCompositionEvent* aEvent);
mozilla::WidgetCompositionEvent* aEvent);
nsresult
NS_NewDOMMutationEvent(nsIDOMEvent** aResult,
mozilla::dom::EventTarget* aOwner,
@ -293,7 +293,7 @@ nsresult
NS_NewDOMTextEvent(nsIDOMEvent** aResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsTextEvent* aEvent);
mozilla::WidgetTextEvent* aEvent);
nsresult
NS_NewDOMBeforeUnloadEvent(nsIDOMEvent** aResult,
mozilla::dom::EventTarget* aOwner,
@ -318,7 +318,7 @@ nsresult
NS_NewDOMXULCommandEvent(nsIDOMEvent** aResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsInputEvent* aEvent);
mozilla::WidgetInputEvent* aEvent);
nsresult
NS_NewDOMCommandEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,

View File

@ -36,19 +36,17 @@ using mozilla::layout::ScrollingBehavior;
using mozilla::void_t;
using mozilla::WindowsHandle;
using nscolor;
using nsCompositionEvent;
using mozilla::WidgetCompositionEvent;
using nsIMEUpdatePreference;
using nsIntPoint;
using nsIntRect;
using nsIntSize;
using nsKeyEvent;
using mozilla::WidgetKeyboardEvent;
using nsMouseEvent;
using nsMouseScrollEvent;
using mozilla::WheelEvent;
using nsQueryContentEvent;
using nsRect;
using nsSelectionEvent;
using nsTextEvent;
using mozilla::WidgetSelectionEvent;
using mozilla::WidgetTextEvent;
using mozilla::WidgetTouchEvent;
using RemoteDOMEvent;
using mozilla::dom::ScreenOrientation;
@ -365,7 +363,7 @@ child:
bool aIgnoreRootScrollFrame);
RealMouseEvent(nsMouseEvent event);
RealKeyEvent(nsKeyEvent event);
RealKeyEvent(WidgetKeyboardEvent event);
MouseWheelEvent(WheelEvent event);
RealTouchEvent(WidgetTouchEvent event);
// We use a separate message for touchmove events only to apply
@ -381,11 +379,11 @@ child:
int32_t aModifiers,
bool aPreventDefault);
CompositionEvent(nsCompositionEvent event);
CompositionEvent(WidgetCompositionEvent event);
TextEvent(nsTextEvent event);
TextEvent(WidgetTextEvent event);
SelectionEvent(nsSelectionEvent event);
SelectionEvent(WidgetSelectionEvent event);
/**
* Activate event forwarding from client to parent.

View File

@ -1859,9 +1859,9 @@ TabChild::RecvRealTouchMoveEvent(const WidgetTouchEvent& aEvent)
}
bool
TabChild::RecvRealKeyEvent(const nsKeyEvent& event)
TabChild::RecvRealKeyEvent(const WidgetKeyboardEvent& event)
{
nsKeyEvent localEvent(event);
WidgetKeyboardEvent localEvent(event);
DispatchWidgetEvent(localEvent);
return true;
}
@ -1882,26 +1882,26 @@ TabChild::RecvKeyEvent(const nsString& aType,
}
bool
TabChild::RecvCompositionEvent(const nsCompositionEvent& event)
TabChild::RecvCompositionEvent(const WidgetCompositionEvent& event)
{
nsCompositionEvent localEvent(event);
WidgetCompositionEvent localEvent(event);
DispatchWidgetEvent(localEvent);
return true;
}
bool
TabChild::RecvTextEvent(const nsTextEvent& event)
TabChild::RecvTextEvent(const WidgetTextEvent& event)
{
nsTextEvent localEvent(event);
WidgetTextEvent localEvent(event);
DispatchWidgetEvent(localEvent);
IPC::ParamTraits<nsTextEvent>::Free(event);
IPC::ParamTraits<WidgetTextEvent>::Free(event);
return true;
}
bool
TabChild::RecvSelectionEvent(const nsSelectionEvent& event)
TabChild::RecvSelectionEvent(const WidgetSelectionEvent& event)
{
nsSelectionEvent localEvent(event);
WidgetSelectionEvent localEvent(event);
DispatchWidgetEvent(localEvent);
return true;
}

View File

@ -216,7 +216,7 @@ public:
const int32_t& aModifiers,
const bool& aIgnoreRootScrollFrame);
virtual bool RecvRealMouseEvent(const nsMouseEvent& event);
virtual bool RecvRealKeyEvent(const nsKeyEvent& event);
virtual bool RecvRealKeyEvent(const mozilla::WidgetKeyboardEvent& event);
virtual bool RecvMouseWheelEvent(const mozilla::WheelEvent& event);
virtual bool RecvRealTouchEvent(const WidgetTouchEvent& event);
virtual bool RecvRealTouchMoveEvent(const WidgetTouchEvent& event);
@ -225,9 +225,9 @@ public:
const int32_t& aCharCode,
const int32_t& aModifiers,
const bool& aPreventDefault);
virtual bool RecvCompositionEvent(const nsCompositionEvent& event);
virtual bool RecvTextEvent(const nsTextEvent& event);
virtual bool RecvSelectionEvent(const nsSelectionEvent& event);
virtual bool RecvCompositionEvent(const mozilla::WidgetCompositionEvent& event);
virtual bool RecvTextEvent(const mozilla::WidgetTextEvent& event);
virtual bool RecvSelectionEvent(const mozilla::WidgetSelectionEvent& event);
virtual bool RecvActivateFrameEvent(const nsString& aType, const bool& capture);
virtual bool RecvLoadRemoteScript(const nsString& aURL);
virtual bool RecvAsyncMessage(const nsString& aMessage,

View File

@ -660,12 +660,12 @@ bool TabParent::SendMouseWheelEvent(WheelEvent& event)
return PBrowserParent::SendMouseWheelEvent(event);
}
bool TabParent::SendRealKeyEvent(nsKeyEvent& event)
bool TabParent::SendRealKeyEvent(WidgetKeyboardEvent& event)
{
if (mIsDestroyed) {
return false;
}
nsKeyEvent e(event);
WidgetKeyboardEvent e(event);
MaybeForwardEventToRenderFrame(event, &e);
if (!MapEventCoordinatesForChildProcess(&e)) {
return false;
@ -932,7 +932,7 @@ TabParent::RecvRequestFocus(const bool& aCanRaise)
* the returned offset/length are different from the queried offset/length.
*/
bool
TabParent::HandleQueryContentEvent(nsQueryContentEvent& aEvent)
TabParent::HandleQueryContentEvent(WidgetQueryContentEvent& aEvent)
{
aEvent.mSucceeded = false;
aEvent.mWasAsync = false;
@ -985,7 +985,7 @@ TabParent::HandleQueryContentEvent(nsQueryContentEvent& aEvent)
}
bool
TabParent::SendCompositionEvent(nsCompositionEvent& event)
TabParent::SendCompositionEvent(WidgetCompositionEvent& event)
{
if (mIsDestroyed) {
return false;
@ -1007,7 +1007,7 @@ TabParent::SendCompositionEvent(nsCompositionEvent& event)
* here and pass the text as the EndIMEComposition return value
*/
bool
TabParent::SendTextEvent(nsTextEvent& event)
TabParent::SendTextEvent(WidgetTextEvent& event)
{
if (mIsDestroyed) {
return false;
@ -1030,7 +1030,7 @@ TabParent::SendTextEvent(nsTextEvent& event)
}
bool
TabParent::SendSelectionEvent(nsSelectionEvent& event)
TabParent::SendSelectionEvent(WidgetSelectionEvent& event)
{
if (mIsDestroyed) {
return false;
@ -1532,8 +1532,8 @@ TabParent::UseAsyncPanZoom()
}
void
TabParent::MaybeForwardEventToRenderFrame(const nsInputEvent& aEvent,
nsInputEvent* aOutEvent)
TabParent::MaybeForwardEventToRenderFrame(const WidgetInputEvent& aEvent,
WidgetInputEvent* aOutEvent)
{
if (RenderFrameParent* rfp = GetRenderFrame()) {
rfp->NotifyInputEvent(aEvent, aOutEvent);

View File

@ -195,7 +195,7 @@ public:
bool aPreventDefault);
bool SendRealMouseEvent(nsMouseEvent& event);
bool SendMouseWheelEvent(mozilla::WheelEvent& event);
bool SendRealKeyEvent(nsKeyEvent& event);
bool SendRealKeyEvent(mozilla::WidgetKeyboardEvent& event);
bool SendRealTouchEvent(WidgetTouchEvent& event);
virtual PDocumentRendererParent*
@ -224,10 +224,10 @@ public:
void HandleDelayedDialogs();
static TabParent *GetIMETabParent() { return mIMETabParent; }
bool HandleQueryContentEvent(nsQueryContentEvent& aEvent);
bool SendCompositionEvent(nsCompositionEvent& event);
bool SendTextEvent(nsTextEvent& event);
bool SendSelectionEvent(nsSelectionEvent& event);
bool HandleQueryContentEvent(mozilla::WidgetQueryContentEvent& aEvent);
bool SendCompositionEvent(mozilla::WidgetCompositionEvent& event);
bool SendTextEvent(mozilla::WidgetTextEvent& event);
bool SendSelectionEvent(mozilla::WidgetSelectionEvent& event);
static TabParent* GetFrom(nsFrameLoader* aFrameLoader);
static TabParent* GetFrom(nsIContent* aContent);
@ -324,8 +324,8 @@ private:
// to dispatch |aEvent| to our child. If there's a relevant
// transform in place, |aOutEvent| is the transformed |aEvent| to
// dispatch to content.
void MaybeForwardEventToRenderFrame(const nsInputEvent& aEvent,
nsInputEvent* aOutEvent);
void MaybeForwardEventToRenderFrame(const WidgetInputEvent& aEvent,
WidgetInputEvent* aOutEvent);
// The offset for the child process which is sampled at touch start. This
// means that the touch events are relative to where the frame was at the
// start of the touch. We need to look for a better solution to this

View File

@ -1963,7 +1963,7 @@ nsPluginInstanceOwner::HandleEvent(nsIDOMEvent* aEvent)
}
#ifdef MOZ_X11
static unsigned int XInputEventState(const nsInputEvent& anEvent)
static unsigned int XInputEventState(const WidgetInputEvent& anEvent)
{
unsigned int state = 0;
if (anEvent.IsShift()) state |= ShiftMask;
@ -2331,7 +2331,8 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
#endif
#ifdef MOZ_WIDGET_QT
const nsKeyEvent& keyEvent = static_cast<const nsKeyEvent&>(anEvent);
const WidgetKeyboardEvent& keyEvent =
static_cast<const WidgetKeyboardEvent&>(anEvent);
memset( &event, 0, sizeof(event) );
event.time = anEvent.time;
@ -2492,7 +2493,8 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const nsGUIEvent& anEvent)
case NS_KEY_EVENT:
{
const nsKeyEvent& keyEvent = static_cast<const nsKeyEvent&>(anEvent);
const WidgetKeyboardEvent& keyEvent =
static_cast<const WidgetKeyboardEvent&>(anEvent);
LOG("Firing NS_KEY_EVENT %d %d\n", keyEvent.keyCode, keyEvent.charCode);
// pluginEvent is initialized by nsWindow::InitKeyEvent().
ANPEvent* pluginEvent = reinterpret_cast<ANPEvent*>(keyEvent.pluginEvent);

View File

@ -32,8 +32,6 @@ using mozilla::plugins::DXGISharedSurfaceHandle;
using mozilla::CrossProcessMutexHandle;
using SurfaceDescriptorX11;
using nsIntRect;
using nsTextEvent;
using nsKeyEvent;
namespace mozilla {
namespace plugins {

View File

@ -5,7 +5,7 @@
#include "IMETextTxn.h"
#include "mozilla/mozalloc.h" // for operator new
#include "mozilla/TextEvents.h" // for nsTextRangeStyle
#include "mozilla/TextEvents.h" // for TextRangeStyle
#include "nsAString.h" // for nsAString_internal::Length, etc
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsDebug.h" // for NS_ASSERTION, etc
@ -25,6 +25,8 @@
#include "nsRange.h" // for nsRange
#include "nsString.h" // for nsString
using namespace mozilla;
// #define DEBUG_IMETXN
IMETextTxn::IMETextTxn()
@ -333,7 +335,7 @@ NS_IMETHODIMP IMETextTxn::CollapseTextSelection(void)
nsCOMPtr<nsISelectionPrivate> imeSelPriv(
do_QueryInterface(imeSel));
if (imeSelPriv) {
nsTextRangeStyle textRangeStyle;
TextRangeStyle textRangeStyle;
result = textRange->GetRangeStyle(&textRangeStyle);
NS_ASSERTION(NS_SUCCEEDED(result),
"nsIPrivateTextRange::GetRangeStyle failed");

View File

@ -4809,7 +4809,7 @@ nsEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
// And also when you add new key handling, you need to change the subclass's
// HandleKeyPressEvent()'s switch statement.
nsKeyEvent* nativeKeyEvent = GetNativeKeyEvent(aKeyEvent);
WidgetKeyboardEvent* nativeKeyEvent = GetNativeKeyEvent(aKeyEvent);
NS_ENSURE_TRUE(nativeKeyEvent, NS_ERROR_UNEXPECTED);
NS_ASSERTION(nativeKeyEvent->message == NS_KEY_PRESS,
"HandleKeyPressEvent gets non-keypress event");
@ -5162,14 +5162,14 @@ nsEditor::IsModifiableNode(nsINode *aNode)
return true;
}
nsKeyEvent*
WidgetKeyboardEvent*
nsEditor::GetNativeKeyEvent(nsIDOMKeyEvent* aDOMKeyEvent)
{
NS_ENSURE_TRUE(aDOMKeyEvent, nullptr);
nsEvent* nativeEvent = aDOMKeyEvent->GetInternalNSEvent();
NS_ENSURE_TRUE(nativeEvent, nullptr);
NS_ENSURE_TRUE(nativeEvent->eventStructType == NS_KEY_EVENT, nullptr);
return static_cast<nsKeyEvent*>(nativeEvent);
return static_cast<WidgetKeyboardEvent*>(nativeEvent);
}
already_AddRefed<nsIContent>

View File

@ -7,7 +7,7 @@
#define __editor_h__
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc.
#include "mozilla/EventForwards.h" // for nsKeyEvent
#include "mozilla/EventForwards.h" // for WidgetKeyboardEvent
#include "mozilla/TypedEnum.h" // for MOZ_BEGIN_ENUM_CLASS, etc.
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsCOMArray.h" // for nsCOMArray
@ -405,7 +405,7 @@ protected:
*/
bool GetDesiredSpellCheckState();
nsKeyEvent* GetNativeKeyEvent(nsIDOMKeyEvent* aDOMKeyEvent);
mozilla::WidgetKeyboardEvent* GetNativeKeyEvent(nsIDOMKeyEvent* aDOMKeyEvent);
bool CanEnableSpellCheck()
{

View File

@ -591,7 +591,7 @@ nsHTMLEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
return nsEditor::HandleKeyPressEvent(aKeyEvent);
}
nsKeyEvent* nativeKeyEvent = GetNativeKeyEvent(aKeyEvent);
WidgetKeyboardEvent* nativeKeyEvent = GetNativeKeyEvent(aKeyEvent);
NS_ENSURE_TRUE(nativeKeyEvent, NS_ERROR_UNEXPECTED);
NS_ASSERTION(nativeKeyEvent->message == NS_KEY_PRESS,
"HandleKeyPressEvent gets non-keypress event");

View File

@ -182,7 +182,8 @@ nsresult nsPlaintextEditor::InsertFromDrop(nsIDOMEvent* aDropEvent)
NS_ENSURE_TRUE(sourceNode, NS_ERROR_FAILURE);
}
nsDragEvent* dragEventInternal = static_cast<nsDragEvent *>(aDropEvent->GetInternalNSEvent());
WidgetDragEvent* dragEventInternal =
static_cast<WidgetDragEvent*>(aDropEvent->GetInternalNSEvent());
if (nsContentUtils::CheckForSubFrameDrop(dragSession, dragEventInternal)) {
// Don't allow drags from subframe documents with different origins than
// the drop destination.

View File

@ -355,7 +355,7 @@ nsPlaintextEditor::HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent)
return nsEditor::HandleKeyPressEvent(aKeyEvent);
}
nsKeyEvent* nativeKeyEvent = GetNativeKeyEvent(aKeyEvent);
WidgetKeyboardEvent* nativeKeyEvent = GetNativeKeyEvent(aKeyEvent);
NS_ENSURE_TRUE(nativeKeyEvent, NS_ERROR_UNEXPECTED);
NS_ASSERTION(nativeKeyEvent->message == NS_KEY_PRESS,
"HandleKeyPressEvent gets non-keypress event");

View File

@ -378,8 +378,8 @@ APZCTreeManager::ProcessMouseEvent(const nsMouseEvent& aEvent,
}
nsEventStatus
APZCTreeManager::ProcessEvent(const nsInputEvent& aEvent,
nsInputEvent* aOutEvent)
APZCTreeManager::ProcessEvent(const WidgetInputEvent& aEvent,
WidgetInputEvent* aOutEvent)
{
// Transform the refPoint
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(ScreenPoint(aEvent.refPoint.x, aEvent.refPoint.y));
@ -396,8 +396,8 @@ APZCTreeManager::ProcessEvent(const nsInputEvent& aEvent,
}
nsEventStatus
APZCTreeManager::ReceiveInputEvent(const nsInputEvent& aEvent,
nsInputEvent* aOutEvent)
APZCTreeManager::ReceiveInputEvent(const WidgetInputEvent& aEvent,
WidgetInputEvent* aOutEvent)
{
MOZ_ASSERT(NS_IsMainThread());
@ -431,7 +431,7 @@ APZCTreeManager::ReceiveInputEvent(const nsInputEvent& aEvent,
}
nsEventStatus
APZCTreeManager::ReceiveInputEvent(nsInputEvent& aEvent)
APZCTreeManager::ReceiveInputEvent(WidgetInputEvent& aEvent)
{
MOZ_ASSERT(NS_IsMainThread());

View File

@ -12,7 +12,7 @@
#include "gfxPoint.h" // for gfxPoint
#include "gfx3DMatrix.h" // for gfx3DMatrix
#include "mozilla/Assertions.h" // for MOZ_ASSERT_HELPER2
#include "mozilla/EventForwards.h" // for nsInputEvent, nsEventStatus
#include "mozilla/EventForwards.h" // for WidgetInputEvent, nsEventStatus
#include "mozilla/Monitor.h" // for Monitor
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsCOMPtr.h" // for already_AddRefed
@ -146,30 +146,30 @@ public:
nsEventStatus ReceiveInputEvent(const InputData& aEvent);
/**
* nsInputEvent handler. Sets |aOutEvent| (which is assumed to be an
* already-existing instance of an nsInputEvent which may be an
* WidgetInputEvent handler. Sets |aOutEvent| (which is assumed to be an
* already-existing instance of an WidgetInputEvent which may be an
* WidgetTouchEvent) to have its coordinates in DOM space. This is so that the
* event can be passed through the DOM and content can handle them.
*
* NOTE: Be careful of invoking the nsInputEvent variant. This can only be
* NOTE: Be careful of invoking the WidgetInputEvent variant. This can only be
* called on the main thread. See widget/InputData.h for more information on
* why we have InputData and nsInputEvent separated.
* why we have InputData and WidgetInputEvent separated.
* NOTE: On unix, mouse events are treated as touch and are forwarded
* to the appropriate apz as such.
*
* @param aEvent input event object, will not be modified
* @param aOutEvent event object transformed to DOM coordinate space.
*/
nsEventStatus ReceiveInputEvent(const nsInputEvent& aEvent,
nsInputEvent* aOutEvent);
nsEventStatus ReceiveInputEvent(const WidgetInputEvent& aEvent,
WidgetInputEvent* aOutEvent);
/**
* nsInputEvent handler with inline dom transform of the passed in
* nsInputEvent. Must be called on the main thread.
* WidgetInputEvent handler with inline dom transform of the passed in
* WidgetInputEvent. Must be called on the main thread.
*
* @param aEvent input event object
*/
nsEventStatus ReceiveInputEvent(nsInputEvent& aEvent);
nsEventStatus ReceiveInputEvent(WidgetInputEvent& aEvent);
/**
* Updates the composition bounds, i.e. the dimensions of the final size of
@ -303,7 +303,7 @@ private:
AsyncPanZoomController* GetTouchInputBlockAPZC(const WidgetTouchEvent& aEvent, ScreenPoint aPoint);
nsEventStatus ProcessTouchEvent(const WidgetTouchEvent& touchEvent, WidgetTouchEvent* aOutEvent);
nsEventStatus ProcessMouseEvent(const nsMouseEvent& mouseEvent, nsMouseEvent* aOutEvent);
nsEventStatus ProcessEvent(const nsInputEvent& inputEvent, nsInputEvent* aOutEvent);
nsEventStatus ProcessEvent(const WidgetInputEvent& inputEvent, WidgetInputEvent* aOutEvent);
/**
* Recursive helper function to build the APZC tree. The tree of APZC instances has

View File

@ -6093,7 +6093,7 @@ PresShell::HandleEvent(nsIFrame *aFrame,
mNoDelayedKeyEvents = true;
} else if (!mNoDelayedKeyEvents) {
nsDelayedEvent* event =
new nsDelayedKeyEvent(static_cast<nsKeyEvent*>(aEvent));
new nsDelayedKeyEvent(static_cast<WidgetKeyboardEvent*>(aEvent));
if (!mDelayedEvents.AppendElement(event)) {
delete event;
}
@ -6678,7 +6678,8 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus)
nsIDocument* doc = GetCurrentEventContent() ?
mCurrentEventContent->OwnerDoc() : nullptr;
nsIDocument* fullscreenAncestor = nullptr;
if (static_cast<const nsKeyEvent*>(aEvent)->keyCode == NS_VK_ESCAPE) {
if (static_cast<const WidgetKeyboardEvent*>(aEvent)->keyCode ==
NS_VK_ESCAPE) {
if ((fullscreenAncestor = nsContentUtils::GetFullscreenAncestor(doc))) {
// Prevent default action on ESC key press when exiting
// DOM fullscreen mode. This prevents the browser ESC key

View File

@ -563,7 +563,7 @@ protected:
nsDelayedInputEvent()
: nsDelayedEvent(), mEvent(nullptr) {}
nsInputEvent* mEvent;
mozilla::WidgetInputEvent* mEvent;
};
class nsDelayedMouseEvent : public nsDelayedInputEvent
@ -588,17 +588,19 @@ protected:
class nsDelayedKeyEvent : public nsDelayedInputEvent
{
public:
nsDelayedKeyEvent(nsKeyEvent* aEvent) : nsDelayedInputEvent()
nsDelayedKeyEvent(mozilla::WidgetKeyboardEvent* aEvent) :
nsDelayedInputEvent()
{
mEvent = new nsKeyEvent(aEvent->mFlags.mIsTrusted,
aEvent->message,
aEvent->widget);
static_cast<nsKeyEvent*>(mEvent)->AssignKeyEventData(*aEvent, false);
mEvent = new mozilla::WidgetKeyboardEvent(aEvent->mFlags.mIsTrusted,
aEvent->message,
aEvent->widget);
static_cast<mozilla::WidgetKeyboardEvent*>(mEvent)->
AssignKeyEventData(*aEvent, false);
}
virtual ~nsDelayedKeyEvent()
{
delete static_cast<nsKeyEvent*>(mEvent);
delete static_cast<mozilla::WidgetKeyboardEvent*>(mEvent);
}
};

View File

@ -2078,11 +2078,11 @@ nsListControlFrame::KeyDown(nsIDOMEvent* aKeyEvent)
// Don't check defaultPrevented value because other browsers don't prevent
// the key navigation of list control even if preventDefault() is called.
const nsKeyEvent* keyEvent =
static_cast<nsKeyEvent*>(aKeyEvent->GetInternalNSEvent());
const WidgetKeyboardEvent* keyEvent =
static_cast<WidgetKeyboardEvent*>(aKeyEvent->GetInternalNSEvent());
MOZ_ASSERT(keyEvent, "DOM event must have internal event");
MOZ_ASSERT(keyEvent->eventStructType == NS_KEY_EVENT,
"The keydown event's internal event struct must be nsKeyEvent");
"The keydown event's internal event struct must be WidgetKeyboardEvent");
if (keyEvent->IsAlt()) {
if (keyEvent->keyCode == NS_VK_UP || keyEvent->keyCode == NS_VK_DOWN) {
@ -2219,11 +2219,11 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
return NS_OK;
}
const nsKeyEvent* keyEvent =
static_cast<nsKeyEvent*>(aKeyEvent->GetInternalNSEvent());
const WidgetKeyboardEvent* keyEvent =
static_cast<WidgetKeyboardEvent*>(aKeyEvent->GetInternalNSEvent());
MOZ_ASSERT(keyEvent, "DOM event must have internal event");
MOZ_ASSERT(keyEvent->eventStructType == NS_KEY_EVENT,
"The keydown event's internal event struct must be nsKeyEvent");
"The keydown event's internal event struct must be WidgetKeyboardEvent");
// Select option with this as the first character
// XXX Not I18N compliant

View File

@ -30,7 +30,7 @@ struct RangeData
{}
nsRefPtr<nsRange> mRange;
nsTextRangeStyle mTextRangeStyle;
mozilla::TextRangeStyle mTextRangeStyle;
};
// Note, the ownership of mozilla::Selection depends on which way the object is

View File

@ -2586,9 +2586,8 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
//weaaak. only the editor can display frame selection not just text and images
isEditor = isEditor == nsISelectionDisplay::DISPLAY_ALL;
nsInputEvent* keyEvent = (nsInputEvent*)aEvent;
WidgetInputEvent* keyEvent = static_cast<WidgetInputEvent*>(aEvent);
if (!keyEvent->IsAlt()) {
for (nsIContent* content = mContent; content;
content = content->GetParent()) {
if (nsContentUtils::ContentIsDraggable(content) &&

View File

@ -45,7 +45,7 @@ struct SelectionDetails
int32_t mStart;
int32_t mEnd;
SelectionType mType;
nsTextRangeStyle mTextRangeStyle;
mozilla::TextRangeStyle mTextRangeStyle;
SelectionDetails *mNext;
};

View File

@ -4125,7 +4125,7 @@ Selection::FindRangeData(nsIDOMRange* aRange)
NS_IMETHODIMP
Selection::SetTextRangeStyle(nsIDOMRange* aRange,
const nsTextRangeStyle& aTextRangeStyle)
const TextRangeStyle& aTextRangeStyle)
{
NS_ENSURE_ARG_POINTER(aRange);
RangeData *rd = FindRangeData(aRange);

View File

@ -5020,7 +5020,7 @@ static void DrawSelectionDecorations(gfxContext* aContext,
SelectionType aType,
nsTextFrame* aFrame,
nsTextPaintStyle& aTextPaintStyle,
const nsTextRangeStyle &aRangeStyle,
const TextRangeStyle &aRangeStyle,
const gfxPoint& aPt, gfxFloat aXInFrame, gfxFloat aWidth,
gfxFloat aAscent, const gfxFont::Metrics& aFontMetrics,
nsTextFrame::DrawPathCallbacks* aCallbacks)
@ -5065,7 +5065,7 @@ static void DrawSelectionDecorations(gfxContext* aContext,
if (aRangeStyle.IsDefined()) {
// If IME defines the style, that should override our definition.
if (aRangeStyle.IsLineStyleDefined()) {
if (aRangeStyle.mLineStyle == nsTextRangeStyle::LINESTYLE_NONE) {
if (aRangeStyle.mLineStyle == TextRangeStyle::LINESTYLE_NONE) {
return;
}
style = aRangeStyle.mLineStyle;
@ -5115,7 +5115,7 @@ static void DrawSelectionDecorations(gfxContext* aContext,
*/
static bool GetSelectionTextColors(SelectionType aType,
nsTextPaintStyle& aTextPaintStyle,
const nsTextRangeStyle &aRangeStyle,
const TextRangeStyle &aRangeStyle,
nscolor* aForeground, nscolor* aBackground)
{
switch (aType) {
@ -5216,7 +5216,7 @@ public:
*/
bool GetNextSegment(gfxFloat* aXOffset, uint32_t* aOffset, uint32_t* aLength,
gfxFloat* aHyphenWidth, SelectionType* aType,
nsTextRangeStyle* aStyle);
TextRangeStyle* aStyle);
void UpdateWithAdvance(gfxFloat aAdvance) {
mXOffset += aAdvance*mTextRun->GetDirection();
}
@ -5244,7 +5244,7 @@ SelectionIterator::SelectionIterator(SelectionDetails** aSelectionDetails,
bool SelectionIterator::GetNextSegment(gfxFloat* aXOffset,
uint32_t* aOffset, uint32_t* aLength, gfxFloat* aHyphenWidth,
SelectionType* aType, nsTextRangeStyle* aStyle)
SelectionType* aType, TextRangeStyle* aStyle)
{
if (mIterator.GetOriginalOffset() >= mOriginalEnd)
return false;
@ -5256,7 +5256,7 @@ bool SelectionIterator::GetNextSegment(gfxFloat* aXOffset,
SelectionDetails* sdptr = mSelectionDetails[index];
SelectionType type =
sdptr ? sdptr->mType : nsISelectionController::SELECTION_NONE;
nsTextRangeStyle style;
TextRangeStyle style;
if (sdptr) {
style = sdptr->mTextRangeStyle;
}
@ -5430,7 +5430,7 @@ nsTextFrame::PaintTextWithSelectionColors(gfxContext* aCtx,
gfxFloat xOffset, hyphenWidth;
uint32_t offset, length; // in transformed string
SelectionType type;
nsTextRangeStyle rangeStyle;
TextRangeStyle rangeStyle;
// Draw background colors
if (anyBackgrounds) {
SelectionIterator iterator(prevailingSelections, aContentOffset, aContentLength,
@ -5562,7 +5562,7 @@ nsTextFrame::PaintTextSelectionDecorations(gfxContext* aCtx,
gfxRect dirtyRect(aDirtyRect.x / app, aDirtyRect.y / app,
aDirtyRect.width / app, aDirtyRect.height / app);
SelectionType type;
nsTextRangeStyle selectedStyle;
TextRangeStyle selectedStyle;
while (iterator.GetNextSegment(&xOffset, &offset, &length, &hyphenWidth,
&type, &selectedStyle)) {
gfxFloat advance = hyphenWidth +
@ -6250,10 +6250,10 @@ nsTextFrame::CombineSelectionUnderlineRect(nsPresContext* aPresContext,
}
} else {
// IME selections
nsTextRangeStyle& rangeStyle = sd->mTextRangeStyle;
TextRangeStyle& rangeStyle = sd->mTextRangeStyle;
if (rangeStyle.IsDefined()) {
if (!rangeStyle.IsLineStyleDefined() ||
rangeStyle.mLineStyle == nsTextRangeStyle::LINESTYLE_NONE) {
rangeStyle.mLineStyle == TextRangeStyle::LINESTYLE_NONE) {
continue;
}
style = rangeStyle.mLineStyle;

View File

@ -826,8 +826,8 @@ RenderFrameParent::OwnerContentChanged(nsIContent* aContent)
}
void
RenderFrameParent::NotifyInputEvent(const nsInputEvent& aEvent,
nsInputEvent* aOutEvent)
RenderFrameParent::NotifyInputEvent(const WidgetInputEvent& aEvent,
WidgetInputEvent* aOutEvent)
{
if (GetApzcTreeManager()) {
GetApzcTreeManager()->ReceiveInputEvent(aEvent, aOutEvent);

View File

@ -93,8 +93,8 @@ public:
void SetBackgroundColor(nscolor aColor) { mBackgroundColor = gfxRGBA(aColor); };
void NotifyInputEvent(const nsInputEvent& aEvent,
nsInputEvent* aOutEvent);
void NotifyInputEvent(const WidgetInputEvent& aEvent,
WidgetInputEvent* aOutEvent);
void NotifyDimensionsChanged(ScreenIntSize size);

View File

@ -18,6 +18,7 @@
#include "mozilla/dom/Element.h"
#include "mozilla/TextEvents.h"
using namespace mozilla;
//
// NS_NewXULButtonFrame
@ -56,7 +57,8 @@ nsButtonBoxFrame::HandleEvent(nsPresContext* aPresContext,
switch (aEvent->message) {
case NS_KEY_DOWN:
if (NS_KEY_EVENT == aEvent->eventStructType) {
nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent;
WidgetKeyboardEvent* keyEvent =
static_cast<WidgetKeyboardEvent*>(aEvent);
if (NS_VK_SPACE == keyEvent->keyCode) {
nsEventStateManager *esm = aPresContext->EventStateManager();
// :hover:active state
@ -70,7 +72,8 @@ nsButtonBoxFrame::HandleEvent(nsPresContext* aPresContext,
#ifndef XP_MACOSX
case NS_KEY_PRESS:
if (NS_KEY_EVENT == aEvent->eventStructType) {
nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent;
WidgetKeyboardEvent* keyEvent =
static_cast<WidgetKeyboardEvent*>(aEvent);
if (NS_VK_RETURN == keyEvent->keyCode) {
nsCOMPtr<nsIDOMXULButtonElement> buttonEl(do_QueryInterface(mContent));
if (buttonEl) {
@ -84,7 +87,8 @@ nsButtonBoxFrame::HandleEvent(nsPresContext* aPresContext,
case NS_KEY_UP:
if (NS_KEY_EVENT == aEvent->eventStructType) {
nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent;
WidgetKeyboardEvent* keyEvent =
static_cast<WidgetKeyboardEvent*>(aEvent);
if (NS_VK_SPACE == keyEvent->keyCode) {
// only activate on keyup if we're already in the :hover:active state
NS_ASSERTION(mContent->IsElement(), "How do we have a non-element?");
@ -125,10 +129,10 @@ nsButtonBoxFrame::DoMouseClick(nsGUIEvent* aEvent, bool aTrustEvent)
bool isAlt = false;
bool isMeta = false;
if(aEvent) {
isShift = ((nsInputEvent*)(aEvent))->IsShift();
isControl = ((nsInputEvent*)(aEvent))->IsControl();
isAlt = ((nsInputEvent*)(aEvent))->IsAlt();
isMeta = ((nsInputEvent*)(aEvent))->IsMeta();
isShift = static_cast<WidgetInputEvent*>(aEvent)->IsShift();
isControl = static_cast<WidgetInputEvent*>(aEvent)->IsControl();
isAlt = static_cast<WidgetInputEvent*>(aEvent)->IsAlt();
isMeta = static_cast<WidgetInputEvent*>(aEvent)->IsMeta();
}
// Have the content handle the event, propagating it according to normal DOM rules.

View File

@ -27,6 +27,7 @@
#include "nsUTF8Utils.h"
#include "mozilla/TextEvents.h"
using namespace mozilla;
//
// NS_NewMenuBarFrame
@ -182,7 +183,8 @@ nsMenuBarFrame::FindMenuWithShortcut(nsIDOMKeyEvent* aKeyEvent)
nsAutoTArray<uint32_t, 10> accessKeys;
nsEvent* nativeEvent = nsContentUtils::GetNativeEvent(aKeyEvent);
nsKeyEvent* nativeKeyEvent = static_cast<nsKeyEvent*>(nativeEvent);
WidgetKeyboardEvent* nativeKeyEvent =
static_cast<WidgetKeyboardEvent*>(nativeEvent);
if (nativeKeyEvent)
nsContentUtils::GetAccessKeyCandidates(nativeKeyEvent, accessKeys);
if (accessKeys.IsEmpty() && charCode)

View File

@ -198,7 +198,8 @@ nsMenuBarListener::KeyPress(nsIDOMEvent* aKeyEvent)
bool hasAccessKeyCandidates = charCode != 0;
if (!hasAccessKeyCandidates) {
nsEvent* nativeEvent = nsContentUtils::GetNativeEvent(aKeyEvent);
nsKeyEvent* nativeKeyEvent = static_cast<nsKeyEvent*>(nativeEvent);
WidgetKeyboardEvent* nativeKeyEvent =
static_cast<WidgetKeyboardEvent*>(nativeEvent);
if (nativeKeyEvent) {
nsAutoTArray<uint32_t, 10> keys;
nsContentUtils::GetAccessKeyCandidates(nativeKeyEvent, keys);
@ -269,8 +270,8 @@ uint32_t
nsMenuBarListener::GetModifiers(nsIDOMKeyEvent* aKeyEvent)
{
uint32_t modifiers = 0;
nsInputEvent* inputEvent =
static_cast<nsInputEvent*>(aKeyEvent->GetInternalNSEvent());
WidgetInputEvent* inputEvent =
static_cast<WidgetInputEvent*>(aKeyEvent->GetInternalNSEvent());
MOZ_ASSERT(inputEvent);
if (inputEvent->IsShift()) {

View File

@ -407,7 +407,7 @@ nsMenuFrame::HandleEvent(nsPresContext* aPresContext,
bool onmenu = IsOnMenu();
if (aEvent->message == NS_KEY_PRESS && !IsDisabled()) {
nsKeyEvent* keyEvent = (nsKeyEvent*)aEvent;
WidgetKeyboardEvent* keyEvent = static_cast<WidgetKeyboardEvent*>(aEvent);
uint32_t keyCode = keyEvent->keyCode;
#ifdef XP_MACOSX
// On mac, open menulist on either up/down arrow or space (w/o Cmd pressed)
@ -1248,10 +1248,10 @@ nsMenuFrame::CreateMenuCommandEvent(nsGUIEvent *aEvent, bool aFlipChecked)
bool shift = false, control = false, alt = false, meta = false;
if (aEvent && (aEvent->eventStructType == NS_MOUSE_EVENT ||
aEvent->eventStructType == NS_KEY_EVENT)) {
shift = static_cast<nsInputEvent *>(aEvent)->IsShift();
control = static_cast<nsInputEvent *>(aEvent)->IsControl();
alt = static_cast<nsInputEvent *>(aEvent)->IsAlt();
meta = static_cast<nsInputEvent *>(aEvent)->IsMeta();
shift = static_cast<WidgetInputEvent*>(aEvent)->IsShift();
control = static_cast<WidgetInputEvent*>(aEvent)->IsControl();
alt = static_cast<WidgetInputEvent*>(aEvent)->IsAlt();
meta = static_cast<WidgetInputEvent*>(aEvent)->IsMeta();
}
// Because the command event is firing asynchronously, a flag is needed to

View File

@ -482,7 +482,7 @@ nsXULPopupManager::InitTriggerEvent(nsIDOMEvent* aEvent, nsIContent* aPopup,
if (event) {
if (event->eventStructType == NS_MOUSE_EVENT ||
event->eventStructType == NS_KEY_EVENT) {
mCachedModifiers = static_cast<nsInputEvent*>(event)->modifiers;
mCachedModifiers = static_cast<WidgetInputEvent*>(event)->modifiers;
}
nsIDocument* doc = aPopup->GetCurrentDoc();
if (doc) {

View File

@ -2554,7 +2554,7 @@ nsTreeBodyFrame::GetCursor(const nsPoint& aPoint,
static uint32_t GetDropEffect(nsGUIEvent* aEvent)
{
NS_ASSERTION(aEvent->eventStructType == NS_DRAG_EVENT, "wrong event type");
nsDragEvent* dragEvent = static_cast<nsDragEvent *>(aEvent);
WidgetDragEvent* dragEvent = static_cast<WidgetDragEvent*>(aEvent);
nsContentUtils::SetDataTransferInEvent(dragEvent);
uint32_t action = 0;
@ -2700,7 +2700,7 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext,
// The dataTransfer was initialized by the call to GetDropEffect above.
bool canDropAtNewLocation = false;
nsDragEvent* dragEvent = static_cast<nsDragEvent *>(aEvent);
WidgetDragEvent* dragEvent = static_cast<WidgetDragEvent*>(aEvent);
mView->CanDrop(mSlots->mDropRow, mSlots->mDropOrient,
dragEvent->dataTransfer, &canDropAtNewLocation);
@ -2732,7 +2732,7 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext,
}
NS_ASSERTION(aEvent->eventStructType == NS_DRAG_EVENT, "wrong event type");
nsDragEvent* dragEvent = static_cast<nsDragEvent*>(aEvent);
WidgetDragEvent* dragEvent = static_cast<WidgetDragEvent*>(aEvent);
nsContentUtils::SetDataTransferInEvent(dragEvent);
mView->Drop(mSlots->mDropRow, mSlots->mDropOrient, dragEvent->dataTransfer);

View File

@ -506,8 +506,14 @@ class MachCommandBase(MozbuildObject):
"""
def __init__(self, context):
MozbuildObject.__init__(self, context.topdir, context.settings,
context.log_manager)
# Attempt to discover topobjdir through environment detection, as it is
# more reliable than mozconfig when cwd is inside an objdir.
dummy = MozbuildObject.from_environment(cwd=context.cwd)
topsrcdir = dummy.topsrcdir or context.topdir
MozbuildObject.__init__(self, topsrcdir, context.settings,
context.log_manager, topobjdir=dummy._topobjdir)
self._mach_context = context

View File

@ -18,7 +18,7 @@ from mozunit import main
from mach.logging import LoggingManager
from mozbuild.base import (
BuildConfig,
MachCommandBase,
MozbuildObject,
PathArgument,
)
@ -26,7 +26,6 @@ from mozbuild.base import (
from mozbuild.backend.configenvironment import ConfigEnvironment
curdir = os.path.dirname(__file__)
topsrcdir = os.path.abspath(os.path.join(curdir, '..', '..', '..', '..'))
log_manager = LoggingManager()
@ -175,6 +174,44 @@ class TestMozbuildObject(unittest.TestCase):
finally:
shutil.rmtree(d)
@unittest.skip('Failed on buildbot (bug 853954)')
def test_mach_command_base_inside_objdir(self):
"""Ensure a MachCommandBase constructed from inside the objdir works."""
d = os.path.realpath(tempfile.mkdtemp())
try:
topobjdir = os.path.join(d, 'objdir')
os.makedirs(topobjdir)
topsrcdir = os.path.join(d, 'srcdir')
os.makedirs(topsrcdir)
mozinfo = os.path.join(topobjdir, 'mozinfo.json')
with open(mozinfo, 'wt') as fh:
json.dump(dict(
topsrcdir=topsrcdir,
), fh)
os.chdir(topobjdir)
class MockMachContext(object):
pass
context = MockMachContext()
context.cwd = topobjdir
context.topdir = topobjdir
context.settings = None
context.log_manager = None
o = MachCommandBase(context)
self.assertEqual(o.topobjdir, topobjdir)
self.assertEqual(o.topsrcdir, topsrcdir)
finally:
shutil.rmtree(d)
def test_config_guess(self):
# It's difficult to test for exact values from the output of
# config.guess because they vary depending on platform.

View File

@ -335,7 +335,7 @@ enum nsEventStructType
#define NS_PLUGIN_INPUT_EVENT (NS_PLUGIN_EVENT_START)
#define NS_PLUGIN_FOCUS_EVENT (NS_PLUGIN_EVENT_START+1)
// Events to manipulate selection (nsSelectionEvent)
// Events to manipulate selection (WidgetSelectionEvent)
#define NS_SELECTION_EVENT_START 3700
// Clear any previous selection and set the given range as the selection
#define NS_SELECTION_SET (NS_SELECTION_EVENT_START)
@ -1025,7 +1025,5 @@ public:
// TODO: Remove following typedefs
typedef mozilla::WidgetEvent nsEvent;
typedef mozilla::WidgetGUIEvent nsGUIEvent;
typedef mozilla::WidgetInputEvent nsInputEvent;
typedef mozilla::InternalUIEvent nsUIEvent;
#endif // mozilla_BasicEvents_h__

View File

@ -105,21 +105,7 @@ class InternalMutationEvent;
// TODO: Remove following typedefs
typedef mozilla::WidgetEvent nsEvent;
typedef mozilla::WidgetGUIEvent nsGUIEvent;
typedef mozilla::WidgetInputEvent nsInputEvent;
typedef mozilla::InternalUIEvent nsUIEvent;
typedef mozilla::AlternativeCharCode nsAlternativeCharCode;
typedef mozilla::WidgetKeyboardEvent nsKeyEvent;
typedef mozilla::TextRangeStyle nsTextRangeStyle;
typedef mozilla::TextRange nsTextRange;
typedef mozilla::TextRangeArray nsTextRangeArray;
typedef mozilla::WidgetTextEvent nsTextEvent;
typedef mozilla::WidgetCompositionEvent nsCompositionEvent;
typedef mozilla::WidgetQueryContentEvent nsQueryContentEvent;
typedef mozilla::WidgetSelectionEvent nsSelectionEvent;
typedef mozilla::WidgetMouseEventBase nsMouseEvent_base;
typedef mozilla::WidgetMouseEvent nsMouseEvent;
typedef mozilla::WidgetDragEvent nsDragEvent;
typedef mozilla::WidgetMouseScrollEvent nsMouseScrollEvent;
namespace mozilla {
typedef WidgetWheelEvent WheelEvent;

View File

@ -44,8 +44,9 @@ public:
InputType mInputType;
// Time in milliseconds that this data is relevant to. This only really
// matters when this data is used as an event. We use uint32_t instead of
// TimeStamp because it is easier to convert from nsInputEvent. The time is
// platform-specific but it in the case of B2G and Fennec it is since startup.
// TimeStamp because it is easier to convert from WidgetInputEvent. The time
// is platform-specific but it in the case of B2G and Fennec it is since
// startup.
uint32_t mTime;
INPUTDATA_AS_CHILD_TYPE(MultiTouchInput, MULTITOUCH_INPUT)

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