Merge mozilla-central into services-central

This commit is contained in:
Gregory Szorc 2013-03-17 10:42:13 -07:00
Родитель cb6c364e64 012d4391f7
Коммит 41c185670d
1008 изменённых файлов: 23386 добавлений и 10203 удалений

Просмотреть файл

@ -15,4 +15,4 @@
#
# Note: The description below will be part of the error message shown to users.
#
Bug 847890 appears to need a clobber
Bug 838652 requires a clobber

Просмотреть файл

@ -12,7 +12,13 @@ XPIDL_SOURCES += [
'nsIAccessibleCursorable.idl',
'nsIAccessibleDocument.idl',
'nsIAccessibleEditableText.idl',
'nsIAccessibleCaretMoveEvent.idl',
'nsIAccessibleEvent.idl',
'nsIAccessibleHideEvent.idl',
'nsIAccessibleStateChangeEvent.idl',
'nsIAccessibleTableChangeEvent.idl',
'nsIAccessibleTextChangeEvent.idl',
'nsIAccessibleVirtualCursorChangeEvent.idl',
'nsIAccessibleHyperLink.idl',
'nsIAccessibleHyperText.idl',
'nsIAccessibleImage.idl',

Просмотреть файл

@ -0,0 +1,18 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIAccessibleEvent.idl"
/**
* Fired when the caret changes position in text.
*/
[scriptable, builtinclass, uuid(5675c486-a230-4d85-a4bd-33670826d5ff)]
interface nsIAccessibleCaretMoveEvent: nsIAccessibleEvent
{
/**
* Return caret offset.
*/
readonly attribute long caretOffset;
};

Просмотреть файл

@ -25,7 +25,7 @@ interface nsIDOMNode;
* if (NS_SUCCEEDED(rv))
* rv = observerService->AddObserver(this, "accessible-event", PR_TRUE);
*/
[scriptable, uuid(7f66a33a-9ed7-4fd4-87a8-e431b0f43368)]
[scriptable, builtinclass, uuid(7f66a33a-9ed7-4fd4-87a8-e431b0f43368)]
interface nsIAccessibleEvent : nsISupports
{
/**
@ -448,120 +448,3 @@ interface nsIAccessibleEvent : nsISupports
*/
readonly attribute boolean isFromUserInput;
};
[scriptable, uuid(9addd25d-8fa1-415e-94ec-6038f220d3e4)]
interface nsIAccessibleStateChangeEvent : nsISupports
{
/**
* Returns the state of accessible (see constants declared
* in nsIAccessibleStates).
*/
readonly attribute unsigned long state;
/**
* Returns true if the state is extra state.
*/
boolean isExtraState();
/**
* Returns true if the state is turned on.
*/
boolean isEnabled();
};
[scriptable, uuid(21e0f8bd-5638-4964-870b-3c8e944ac4c4)]
interface nsIAccessibleTextChangeEvent : nsISupports
{
/**
* Returns offset of changed text in accessible.
*/
readonly attribute long start;
/**
* Returns length of changed text.
*/
readonly attribute unsigned long length;
/**
* Returns true if text was inserted, otherwise false.
*/
boolean isInserted();
/**
* The inserted or removed text
*/
readonly attribute DOMString modifiedText;
};
[scriptable, uuid(a2bd2eca-3afa-489b-afb2-f93ef32ad99c)]
interface nsIAccessibleHideEvent: nsISupports
{
/**
* Return an accessible that was a parent of the target.
*/
readonly attribute nsIAccessible targetParent;
/**
* Return an accessible that was a next sibling of the target
*/
readonly attribute nsIAccessible targetNextSibling;
/**
* Return an accessible that was a parent of the target
*/
readonly attribute nsIAccessible targetPrevSibling;
};
[scriptable, uuid(5675c486-a230-4d85-a4bd-33670826d5ff)]
interface nsIAccessibleCaretMoveEvent: nsISupports
{
/**
* Return caret offset.
*/
readonly attribute long caretOffset;
};
[scriptable, uuid(df517997-ed52-4ea2-b310-2f8e0fe64572)]
interface nsIAccessibleTableChangeEvent: nsISupports
{
/**
* Return the row or column index.
*/
readonly attribute long rowOrColIndex;
/**
* Return the number of rows or cols
*/
readonly attribute long numRowsOrCols;
};
/*
* An interface for virtual cursor changed events.
* Passes previous cursor position and text offsets.
*/
[scriptable, uuid(370e8b9b-2bbc-4bff-a9c7-16ddc54aea21)]
interface nsIAccessibleVirtualCursorChangeEvent : nsISupports
{
/**
* Previous object pointed at by virtual cursor. null if none.
*/
readonly attribute nsIAccessible oldAccessible;
/**
* Previous start offset of pivot. -1 if none.
*/
readonly attribute long oldStartOffset;
/**
* Previous end offset of pivot. -1 if none.
*/
readonly attribute long oldEndOffset;
/**
* Reason for virtual cursor move.
*/
readonly attribute short reason;
};

Просмотреть файл

@ -0,0 +1,28 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIAccessibleEvent.idl"
/**
* Fired when a accessible and its subtree are removed from the tree.
*/
[scriptable, builtinclass, uuid(a2bd2eca-3afa-489b-afb2-f93ef32ad99c)]
interface nsIAccessibleHideEvent: nsIAccessibleEvent
{
/**
* Return an accessible that was a parent of the target.
*/
readonly attribute nsIAccessible targetParent;
/**
* Return an accessible that was a next sibling of the target
*/
readonly attribute nsIAccessible targetNextSibling;
/**
* Return an accessible that was a parent of the target
*/
readonly attribute nsIAccessible targetPrevSibling;
};

Просмотреть файл

@ -0,0 +1,29 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIAccessibleEvent.idl"
/**
* Fired when a state of an accessible changes.
*/
[scriptable, builtinclass, uuid(0d2d77c5-7b16-4a15-8b20-c484ceb5ac0d)]
interface nsIAccessibleStateChangeEvent : nsIAccessibleEvent
{
/**
* Returns the state of accessible (see constants declared
* in nsIAccessibleStates).
*/
readonly attribute unsigned long state;
/**
* Returns true if the state is extra state.
*/
readonly attribute boolean isExtraState;
/**
* Returns true if the state is turned on.
*/
readonly attribute boolean isEnabled;
};

Просмотреть файл

@ -0,0 +1,20 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIAccessibleEvent.idl"
[scriptable, builtinclass, uuid(df517997-ed52-4ea2-b310-2f8e0fe64572)]
interface nsIAccessibleTableChangeEvent: nsIAccessibleEvent
{
/**
* Return the row or column index.
*/
readonly attribute long rowOrColIndex;
/**
* Return the number of rows or cols
*/
readonly attribute long RowsOrColsCount;
};

Просмотреть файл

@ -0,0 +1,33 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIAccessibleEvent.idl"
/**
* Fired when an accessible's text changes.
*/
[scriptable, builtinclass, uuid(21e0f8bd-5638-4964-870b-3c8e944ac4c4)]
interface nsIAccessibleTextChangeEvent : nsIAccessibleEvent
{
/**
* Returns offset of changed text in accessible.
*/
readonly attribute long start;
/**
* Returns length of changed text.
*/
readonly attribute unsigned long length;
/**
* Returns true if text was inserted, otherwise false.
*/
readonly attribute boolean isInserted;
/**
* The inserted or removed text
*/
readonly attribute DOMString modifiedText;
};

Просмотреть файл

@ -0,0 +1,34 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIAccessibleEvent.idl"
/*
* An interface for virtual cursor changed events.
* Passes previous cursor position and text offsets.
*/
[scriptable, builtinclass, uuid(370e8b9b-2bbc-4bff-a9c7-16ddc54aea21)]
interface nsIAccessibleVirtualCursorChangeEvent : nsIAccessibleEvent
{
/**
* Previous object pointed at by virtual cursor. null if none.
*/
readonly attribute nsIAccessible oldAccessible;
/**
* Previous start offset of pivot. -1 if none.
*/
readonly attribute long oldStartOffset;
/**
* Previous end offset of pivot. -1 if none.
*/
readonly attribute long oldEndOffset;
/**
* Reason for virtual cursor move.
*/
readonly attribute short reason;
};

Просмотреть файл

@ -11,7 +11,7 @@
#include "nsAccUtils.h"
#include "DocAccessible.h"
#include "nsIAccessibleText.h"
#include "nsAccEvent.h"
#include "xpcAccEvents.h"
#include "States.h"
#include "nsEventStateManager.h"
@ -20,6 +20,7 @@
#include "nsIDOMXULMultSelectCntrlEl.h"
#endif
using namespace mozilla;
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
@ -39,17 +40,6 @@ AccEvent::AccEvent(uint32_t aEventType, Accessible* aAccessible,
mIsFromUserInput = aIsFromUserInput == eFromUserInput ? true : false;
}
////////////////////////////////////////////////////////////////////////////////
// AccEvent public methods
already_AddRefed<nsAccEvent>
AccEvent::CreateXPCOMObject()
{
nsAccEvent* event = new nsAccEvent(this);
NS_IF_ADDREF(event);
return event;
}
////////////////////////////////////////////////////////////////////////////////
// AccEvent cycle collection
@ -59,18 +49,6 @@ NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AccEvent, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AccEvent, Release)
////////////////////////////////////////////////////////////////////////////////
// AccStateChangeEvent
////////////////////////////////////////////////////////////////////////////////
already_AddRefed<nsAccEvent>
AccStateChangeEvent::CreateXPCOMObject()
{
nsAccEvent* event = new nsAccStateChangeEvent(this);
NS_IF_ADDREF(event);
return event;
}
////////////////////////////////////////////////////////////////////////////////
// AccTextChangeEvent
////////////////////////////////////////////////////////////////////////////////
@ -100,14 +78,6 @@ AccTextChangeEvent::
(states::FOCUSED | states::EDITABLE);
}
already_AddRefed<nsAccEvent>
AccTextChangeEvent::CreateXPCOMObject()
{
nsAccEvent* event = new nsAccTextChangeEvent(this);
NS_IF_ADDREF(event);
return event;
}
////////////////////////////////////////////////////////////////////////////////
// AccReorderEvent
@ -142,14 +112,6 @@ AccHideEvent::
mPrevSibling = mAccessible->PrevSibling();
}
already_AddRefed<nsAccEvent>
AccHideEvent::CreateXPCOMObject()
{
nsAccEvent* event = new nsAccHideEvent(this);
NS_ADDREF(event);
return event;
}
////////////////////////////////////////////////////////////////////////////////
// AccShowEvent
@ -162,19 +124,6 @@ AccShowEvent::
}
////////////////////////////////////////////////////////////////////////////////
// AccCaretMoveEvent
////////////////////////////////////////////////////////////////////////////////
already_AddRefed<nsAccEvent>
AccCaretMoveEvent::CreateXPCOMObject()
{
nsAccEvent* event = new nsAccCaretMoveEvent(this);
NS_IF_ADDREF(event);
return event;
}
////////////////////////////////////////////////////////////////////////////////
// AccSelChangeEvent
////////////////////////////////////////////////////////////////////////////////
@ -209,14 +158,6 @@ AccTableChangeEvent::
{
}
already_AddRefed<nsAccEvent>
AccTableChangeEvent::CreateXPCOMObject()
{
nsAccEvent* event = new nsAccTableChangeEvent(this);
NS_IF_ADDREF(event);
return event;
}
////////////////////////////////////////////////////////////////////////////////
// AccVCChangeEvent
@ -233,10 +174,63 @@ AccVCChangeEvent::
{
}
already_AddRefed<nsAccEvent>
AccVCChangeEvent::CreateXPCOMObject()
already_AddRefed<nsIAccessibleEvent>
a11y::MakeXPCEvent(AccEvent* aEvent)
{
nsAccEvent* event = new nsAccVirtualCursorChangeEvent(this);
NS_ADDREF(event);
return event;
}
DocAccessible* doc = aEvent->GetDocAccessible();
Accessible* acc = aEvent->GetAccessible();
nsINode* node = acc->GetNode();
nsIDOMNode* domNode = node ? node->AsDOMNode() : nullptr;
bool fromUser = aEvent->IsFromUserInput();
uint32_t type = aEvent->GetEventType();
uint32_t eventGroup = aEvent->GetEventGroups();
nsCOMPtr<nsIAccessibleEvent> xpEvent;
if (eventGroup & (1 << AccEvent::eStateChangeEvent)) {
AccStateChangeEvent* sc = downcast_accEvent(aEvent);
bool extra = false;
uint32_t state = nsAccUtils::To32States(sc->GetState(), &extra);
xpEvent = new xpcAccStateChangeEvent(type, acc, doc, domNode, fromUser,
state, extra, sc->IsStateEnabled());
return xpEvent.forget();
}
if (eventGroup & (1 << AccEvent::eTextChangeEvent)) {
AccTextChangeEvent* tc = downcast_accEvent(aEvent);
nsString text;
tc->GetModifiedText(text);
xpEvent = new xpcAccTextChangeEvent(type, acc, doc, domNode, fromUser,
tc->GetStartOffset(), tc->GetLength(),
tc->IsTextInserted(), text);
return xpEvent.forget();
}
if (eventGroup & (1 << AccEvent::eHideEvent)) {
AccHideEvent* hideEvent = downcast_accEvent(aEvent);
xpEvent = new xpcAccHideEvent(type, acc, doc, domNode, fromUser,
hideEvent->TargetParent(),
hideEvent->TargetNextSibling(),
hideEvent->TargetPrevSibling());
return xpEvent.forget();
}
if (eventGroup & (1 << AccEvent::eCaretMoveEvent)) {
AccCaretMoveEvent* cm = downcast_accEvent(aEvent);
xpEvent = new xpcAccCaretMoveEvent(type, acc, doc, domNode, fromUser,
cm->GetCaretOffset());
return xpEvent.forget();
}
if (eventGroup & (1 << AccEvent::eVirtualCursorChangeEvent)) {
AccVCChangeEvent* vcc = downcast_accEvent(aEvent);
xpEvent = new xpcAccVirtualCursorChangeEvent(type, acc, doc, domNode, fromUser,
vcc->OldAccessible(),
vcc->OldStartOffset(),
vcc->OldEndOffset(),
vcc->Reason());
return xpEvent.forget();
}
xpEvent = new xpcAccEvent(type, acc, doc, domNode, fromUser);
return xpEvent.forget();
}

Просмотреть файл

@ -15,8 +15,6 @@ namespace a11y {
class DocAccessible;
class nsAccEvent;
// Constants used to point whether the event is from user input.
enum EIsFromUserInput
{
@ -83,11 +81,6 @@ public:
Accessible* GetAccessible() const { return mAccessible; }
DocAccessible* GetDocAccessible() const { return mAccessible->Document(); }
/**
* Create and return an XPCOM object for accessible event object.
*/
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
/**
* Down casting.
*/
@ -147,8 +140,6 @@ public:
{ mIsEnabled = (mAccessible->State() & mState) != 0; }
// AccEvent
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
static const EventGroup kEventGroup = eStateChangeEvent;
virtual unsigned int GetEventGroups() const
{
@ -178,8 +169,6 @@ public:
EIsFromUserInput aIsFromUserInput = eAutoDetect);
// AccEvent
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
static const EventGroup kEventGroup = eTextChangeEvent;
virtual unsigned int GetEventGroups() const
{
@ -248,8 +237,6 @@ public:
AccHideEvent(Accessible* aTarget, nsINode* aTargetNode);
// Event
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
static const EventGroup kEventGroup = eHideEvent;
virtual unsigned int GetEventGroups() const
{
@ -349,8 +336,6 @@ public:
virtual ~AccCaretMoveEvent() { }
// AccEvent
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
static const EventGroup kEventGroup = eCaretMoveEvent;
virtual unsigned int GetEventGroups() const
{
@ -414,8 +399,6 @@ public:
int32_t aRowOrColIndex, int32_t aNumRowsOrCols);
// AccEvent
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
static const EventGroup kEventGroup = eTableChangeEvent;
virtual unsigned int GetEventGroups() const
{
@ -445,8 +428,6 @@ public:
virtual ~AccVCChangeEvent() { }
// AccEvent
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
static const EventGroup kEventGroup = eVirtualCursorChangeEvent;
virtual unsigned int GetEventGroups() const
{
@ -487,6 +468,12 @@ private:
AccEvent* mRawPtr;
};
/**
* Return a new xpcom accessible event for the given internal one.
*/
already_AddRefed<nsIAccessibleEvent>
MakeXPCEvent(AccEvent* aEvent);
} // namespace a11y
} // namespace mozilla

Просмотреть файл

@ -409,7 +409,7 @@ nsAccUtils::IsTextInterfaceSupportCorrect(Accessible* aAccessible)
uint32_t childCount = aAccessible->ChildCount();
for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) {
Accessible* child = aAccessible->GetChildAt(childIdx);
if (IsText(child)) {
if (!IsEmbeddedObject(child)) {
foundText = true;
break;
}
@ -429,7 +429,7 @@ nsAccUtils::IsTextInterfaceSupportCorrect(Accessible* aAccessible)
uint32_t
nsAccUtils::TextLength(Accessible* aAccessible)
{
if (!IsText(aAccessible))
if (IsEmbeddedObject(aAccessible))
return 1;
TextLeafAccessible* textLeaf = aAccessible->AsTextLeaf();

Просмотреть файл

@ -232,16 +232,6 @@ public:
static bool IsTextInterfaceSupportCorrect(Accessible* aAccessible);
#endif
/**
* Return true if the given accessible has text role.
*/
static bool IsText(nsIAccessible *aAcc)
{
uint32_t role = Role(aAcc);
return role == nsIAccessibleRole::ROLE_TEXT_LEAF ||
role == nsIAccessibleRole::ROLE_STATICTEXT;
}
/**
* Return text length of the given accessible, return 0 on failure.
*/
@ -278,6 +268,13 @@ public:
*aState2 = static_cast<uint32_t>(aState64 >> 31);
}
static uint32_t To32States(uint64_t aState, bool* aIsExtra)
{
uint32_t extraState = aState >> 31;
*aIsExtra = !!extraState;
return aState | extraState;
}
/**
* Return true if the given accessible can't have children. Used when exposing
* to platform accessibility APIs, should the children be pruned off?

Просмотреть файл

@ -68,10 +68,6 @@ public:
{
return GetNode() && GetNode()->IsNodeOfType(nsINode::eCONTENT);
}
bool IsDocumentNode() const
{
return GetNode() && GetNode()->IsNodeOfType(nsINode::eDOCUMENT);
}
/**
* Return the unique identifier of the accessible.

Просмотреть файл

@ -265,7 +265,7 @@ nsTextEquivUtils::AppendFromValue(Accessible* aAccessible,
}
//XXX: is it necessary to care the accessible is not a document?
if (aAccessible->IsDocumentNode())
if (aAccessible->IsDoc())
return NS_ERROR_UNEXPECTED;
nsIContent *content = aAccessible->GetContent();

Просмотреть файл

@ -11,7 +11,6 @@
#include "AccGroupInfo.h"
#include "AccIterator.h"
#include "nsAccUtils.h"
#include "nsAccEvent.h"
#include "nsAccessibleRelation.h"
#include "nsAccessibilityService.h"
#include "nsIAccessibleRelation.h"
@ -1161,8 +1160,7 @@ Accessible::HandleAccEvent(AccEvent* aEvent)
{
NS_ENSURE_ARG_POINTER(aEvent);
nsCOMPtr<nsIObserverService> obsService =
mozilla::services::GetObserverService();
nsCOMPtr<nsIObserverService> obsService = services::GetObserverService();
NS_ENSURE_TRUE(obsService, NS_ERROR_FAILURE);
nsCOMPtr<nsISimpleEnumerator> observers;
@ -1174,8 +1172,8 @@ Accessible::HandleAccEvent(AccEvent* aEvent)
bool hasObservers = false;
observers->HasMoreElements(&hasObservers);
if (hasObservers) {
nsRefPtr<nsAccEvent> evnt(aEvent->CreateXPCOMObject());
return obsService->NotifyObservers(evnt, NS_ACCESSIBLE_EVENT_TOPIC, nullptr);
nsCOMPtr<nsIAccessibleEvent> event = MakeXPCEvent(aEvent);
return obsService->NotifyObservers(event, NS_ACCESSIBLE_EVENT_TOPIC, nullptr);
}
return NS_OK;
@ -2671,7 +2669,7 @@ Accessible::InsertChildAt(uint32_t aIndex, Accessible* aChild)
mChildren[idx]->mIndexInParent = idx;
}
if (nsAccUtils::IsText(aChild))
if (!nsAccUtils::IsEmbeddedObject(aChild))
SetChildrenFlag(eMixedChildren);
mEmbeddedObjCollector = nullptr;
@ -3038,7 +3036,7 @@ Accessible::ContainerWidget() const
}
// Don't cross DOM document boundaries.
if (parent->IsDocumentNode())
if (parent->IsDoc())
break;
}
}

Просмотреть файл

@ -266,7 +266,7 @@ HyperTextAccessible::GetPosAndText(int32_t& aStartOffset, int32_t& aEndOffset,
}
nsIFrame *primaryFrame = frame;
endFrame = frame;
if (nsAccUtils::IsText(childAcc)) {
if (!nsAccUtils::IsEmbeddedObject(childAcc)) {
// We only need info up to rendered offset -- that is what we're
// converting to content offset
int32_t substringEndOffset = -1;
@ -708,14 +708,12 @@ HyperTextAccessible::GetRelativeOffset(nsIPresShell* aPresShell,
nsresult rv;
int32_t contentOffset = aFromOffset;
if (nsAccUtils::IsText(aFromAccessible)) {
nsIFrame *frame = aFromAccessible->GetFrame();
NS_ENSURE_TRUE(frame, -1);
nsIFrame *frame = aFromAccessible->GetFrame();
NS_ENSURE_TRUE(frame, -1);
if (frame->GetType() == nsGkAtoms::textFrame) {
rv = RenderedToContentOffset(frame, aFromOffset, &contentOffset);
NS_ENSURE_SUCCESS(rv, -1);
}
if (frame->GetType() == nsGkAtoms::textFrame) {
rv = RenderedToContentOffset(frame, aFromOffset, &contentOffset);
NS_ENSURE_SUCCESS(rv, -1);
}
nsPeekOffsetStruct pos(aAmount, aDirection, contentOffset,

Просмотреть файл

@ -26,11 +26,7 @@ this.AccessFu = {
* mode is started.
*/
attach: function attach(aWindow) {
if (this.chromeWin)
// XXX: only supports attaching to one window now.
throw new Error('Only one window could be attached to AccessFu');
this.chromeWin = aWindow;
Utils.init(aWindow);
this.prefsBranch = Cc['@mozilla.org/preferences-service;1']
.getService(Ci.nsIPrefService).getBranch('accessibility.accessfu.');
@ -77,26 +73,26 @@ this.AccessFu = {
Logger.info('enable');
for each (let mm in Utils.getAllMessageManagers(this.chromeWin))
for each (let mm in Utils.AllMessageManagers)
this._loadFrameScript(mm);
// Add stylesheet
let stylesheetURL = 'chrome://global/content/accessibility/AccessFu.css';
this.stylesheet = this.chromeWin.document.createProcessingInstruction(
let stylesheet = Utils.win.document.createProcessingInstruction(
'xml-stylesheet', 'href="' + stylesheetURL + '" type="text/css"');
this.chromeWin.document.insertBefore(this.stylesheet,
this.chromeWin.document.firstChild);
Utils.win.document.insertBefore(stylesheet, Utils.win.document.firstChild);
this.stylesheet = Cu.getWeakReference(stylesheet);
Input.attach(this.chromeWin);
Output.attach(this.chromeWin);
TouchAdapter.attach(this.chromeWin);
Input.start();
Output.start();
TouchAdapter.start();
Services.obs.addObserver(this, 'remote-browser-frame-shown', false);
Services.obs.addObserver(this, 'Accessibility:NextObject', false);
Services.obs.addObserver(this, 'Accessibility:PreviousObject', false);
Services.obs.addObserver(this, 'Accessibility:Focus', false);
this.chromeWin.addEventListener('TabOpen', this);
this.chromeWin.addEventListener('TabSelect', this);
Utils.win.addEventListener('TabOpen', this);
Utils.win.addEventListener('TabSelect', this);
},
/**
@ -110,15 +106,17 @@ this.AccessFu = {
Logger.info('disable');
this.chromeWin.document.removeChild(this.stylesheet);
for each (let mm in Utils.getAllMessageManagers(this.chromeWin))
Utils.win.document.removeChild(this.stylesheet.get());
for each (let mm in Utils.AllMessageManagers)
mm.sendAsyncMessage('AccessFu:Stop');
Input.detach();
TouchAdapter.detach(this.chromeWin);
Input.stop();
Output.stop();
TouchAdapter.stop();
this.chromeWin.removeEventListener('TabOpen', this);
this.chromeWin.removeEventListener('TabSelect', this);
Utils.win.removeEventListener('TabOpen', this);
Utils.win.removeEventListener('TabSelect', this);
Services.obs.removeObserver(this, 'remote-browser-frame-shown');
Services.obs.removeObserver(this, 'Accessibility:NextObject');
@ -194,7 +192,7 @@ this.AccessFu = {
case 'Accessibility:Focus':
this._focused = JSON.parse(aData);
if (this._focused) {
let mm = Utils.getMessageManager(Utils.getCurrentBrowser(this.chromeWin));
let mm = Utils.getMessageManager(Utils.CurrentBrowser);
mm.sendAsyncMessage('AccessFu:VirtualCursor',
{action: 'whereIsIt', move: true});
}
@ -234,11 +232,11 @@ this.AccessFu = {
case 'TabSelect':
{
if (this._focused) {
let mm = Utils.getMessageManager(Utils.getCurrentBrowser(this.chromeWin));
let mm = Utils.getMessageManager(Utils.CurrentBrowser);
// We delay this for half a second so the awesomebar could close,
// and we could use the current coordinates for the content item.
// XXX TODO figure out how to avoid magic wait here.
this.chromeWin.setTimeout(
Utils.win.setTimeout(
function () {
mm.sendAsyncMessage('AccessFu:VirtualCursor', {action: 'whereIsIt'});
}, 500);
@ -250,7 +248,7 @@ this.AccessFu = {
announce: function announce(aAnnouncement) {
this._output(Presentation.announce(aAnnouncement),
Utils.getCurrentBrowser(this.chromeWin));
Utils.CurrentBrowser);
},
// So we don't enable/disable twice
@ -261,11 +259,22 @@ this.AccessFu = {
};
var Output = {
attach: function attach(aWindow) {
this.chromeWin = aWindow;
start: function start() {
Cu.import('resource://gre/modules/Geometry.jsm');
},
stop: function stop() {
if (this.highlightBox) {
Utils.win.document.documentElement.removeChild(this.highlightBox.get());
delete this.highlightBox;
}
if (this.announceBox) {
Utils.win.document.documentElement.removeChild(this.announceBox.get());
delete this.announceBox;
}
},
Speech: function Speech(aDetails, aBrowser) {
for each (let action in aDetails.actions)
Logger.info('tts.' + action.method, '"' + action.data + '"', JSON.stringify(action.options));
@ -275,66 +284,75 @@ var Output = {
switch (aDetails.method) {
case 'showBounds':
{
let highlightBox = null;
if (!this.highlightBox) {
// Add highlight box
this.highlightBox = this.chromeWin.document.
highlightBox = Utils.win.document.
createElementNS('http://www.w3.org/1999/xhtml', 'div');
this.chromeWin.document.documentElement.appendChild(this.highlightBox);
this.highlightBox.id = 'virtual-cursor-box';
Utils.win.document.documentElement.appendChild(highlightBox);
highlightBox.id = 'virtual-cursor-box';
// Add highlight inset for inner shadow
let inset = this.chromeWin.document.
let inset = Utils.win.document.
createElementNS('http://www.w3.org/1999/xhtml', 'div');
inset.id = 'virtual-cursor-inset';
this.highlightBox.appendChild(inset);
highlightBox.appendChild(inset);
this.highlightBox = Cu.getWeakReference(highlightBox);
} else {
highlightBox = this.highlightBox.get();
}
let padding = aDetails.padding;
let r = this._adjustBounds(aDetails.bounds, aBrowser);
// First hide it to avoid flickering when changing the style.
this.highlightBox.style.display = 'none';
this.highlightBox.style.top = (r.top - padding) + 'px';
this.highlightBox.style.left = (r.left - padding) + 'px';
this.highlightBox.style.width = (r.width + padding*2) + 'px';
this.highlightBox.style.height = (r.height + padding*2) + 'px';
this.highlightBox.style.display = 'block';
highlightBox.style.display = 'none';
highlightBox.style.top = (r.top - padding) + 'px';
highlightBox.style.left = (r.left - padding) + 'px';
highlightBox.style.width = (r.width + padding*2) + 'px';
highlightBox.style.height = (r.height + padding*2) + 'px';
highlightBox.style.display = 'block';
break;
}
case 'hideBounds':
{
if (this.highlightBox)
this.highlightBox.style.display = 'none';
let highlightBox = this.highlightBox ? this.highlightBox.get() : null;
if (highlightBox)
highlightBox.get().style.display = 'none';
break;
}
case 'showAnnouncement':
{
if (!this.announceBox) {
this.announceBox = this.chromeWin.document.
let announceBox = this.announceBox ? this.announceBox.get() : null;
if (!announceBox) {
announceBox = Utils.win.document.
createElementNS('http://www.w3.org/1999/xhtml', 'div');
this.announceBox.id = 'announce-box';
this.chromeWin.document.documentElement.appendChild(this.announceBox);
announceBox.id = 'announce-box';
Utils.win.document.documentElement.appendChild(announceBox);
this.announceBox = Cu.getWeakReference(announceBox);
}
this.announceBox.innerHTML = '<div>' + aDetails.text + '</div>';
this.announceBox.classList.add('showing');
announceBox.innerHTML = '<div>' + aDetails.text + '</div>';
announceBox.classList.add('showing');
if (this._announceHideTimeout)
this.chromeWin.clearTimeout(this._announceHideTimeout);
Utils.win.clearTimeout(this._announceHideTimeout);
if (aDetails.duration > 0)
this._announceHideTimeout = this.chromeWin.setTimeout(
this._announceHideTimeout = Utils.win.setTimeout(
function () {
this.announceBox.classList.remove('showing');
announceBox.classList.remove('showing');
this._announceHideTimeout = 0;
}.bind(this), aDetails.duration);
break;
}
case 'hideAnnouncement':
{
this.announceBox.classList.remove('showing');
let announceBox = this.announceBox ? this.announceBox.get() : null;
if (announceBox)
announceBox.classList.remove('showing');
break;
}
}
@ -353,14 +371,14 @@ var Output = {
},
Haptic: function Haptic(aDetails, aBrowser) {
this.chromeWin.navigator.vibrate(aDetails.pattern);
Utils.win.navigator.vibrate(aDetails.pattern);
},
_adjustBounds: function(aJsonBounds, aBrowser) {
let bounds = new Rect(aJsonBounds.left, aJsonBounds.top,
aJsonBounds.right - aJsonBounds.left,
aJsonBounds.bottom - aJsonBounds.top);
let vp = Utils.getViewport(this.chromeWin) || { zoom: 1.0, offsetY: 0 };
let vp = Utils.getViewport(Utils.win) || { zoom: 1.0, offsetY: 0 };
let browserOffset = aBrowser.getBoundingClientRect();
return bounds.translate(browserOffset.left, browserOffset.top).
@ -371,15 +389,14 @@ var Output = {
var Input = {
editState: {},
attach: function attach(aWindow) {
this.chromeWin = aWindow;
this.chromeWin.document.addEventListener('keypress', this, true);
this.chromeWin.addEventListener('mozAccessFuGesture', this, true);
start: function start() {
Utils.win.document.addEventListener('keypress', this, true);
Utils.win.addEventListener('mozAccessFuGesture', this, true);
},
detach: function detach() {
this.chromeWin.document.removeEventListener('keypress', this, true);
this.chromeWin.removeEventListener('mozAccessFuGesture', this, true);
stop: function stop() {
Utils.win.document.removeEventListener('keypress', this, true);
Utils.win.removeEventListener('mozAccessFuGesture', this, true);
},
handleEvent: function Input_handleEvent(aEvent) {
@ -430,7 +447,7 @@ var Input = {
this.scroll(1);
break;
case 'explore2':
Utils.getCurrentBrowser(this.chromeWin).contentWindow.scrollBy(
Utils.CurrentBrowser.contentWindow.scrollBy(
-aGesture.deltaX, -aGesture.deltaY);
break;
case 'swiperight3':
@ -525,7 +542,7 @@ var Input = {
},
moveCursor: function moveCursor(aAction, aRule, aInputType, aX, aY) {
let mm = Utils.getMessageManager(Utils.getCurrentBrowser(this.chromeWin));
let mm = Utils.getMessageManager(Utils.CurrentBrowser);
mm.sendAsyncMessage('AccessFu:VirtualCursor',
{action: aAction, rule: aRule,
x: aX, y: aY, origin: 'top',
@ -533,7 +550,7 @@ var Input = {
},
activateCurrent: function activateCurrent() {
let mm = Utils.getMessageManager(Utils.getCurrentBrowser(this.chromeWin));
let mm = Utils.getMessageManager(Utils.CurrentBrowser);
mm.sendAsyncMessage('AccessFu:Activate', {});
},
@ -542,7 +559,7 @@ var Input = {
},
scroll: function scroll(aPage, aHorizontal) {
let mm = Utils.getMessageManager(Utils.getCurrentBrowser(this.chromeWin));
let mm = Utils.getMessageManager(Utils.CurrentBrowser);
mm.sendAsyncMessage('AccessFu:Scroll', {page: aPage, horizontal: aHorizontal, origin: 'top'});
},

Просмотреть файл

@ -125,11 +125,11 @@ this.EventManager = {
{
let event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
if (event.state == Ci.nsIAccessibleStates.STATE_CHECKED &&
!(event.isExtraState())) {
!(event.isExtraState)) {
this.present(
Presentation.
actionInvoked(aEvent.accessible,
event.isEnabled() ? 'check' : 'uncheck'));
event.isEnabled ? 'check' : 'uncheck'));
}
break;
}

Просмотреть файл

@ -27,17 +27,6 @@ Presenter.prototype = {
*/
type: 'Base',
/**
* Attach function for presenter.
* @param {ChromeWindow} aWindow Chrome window the presenter could use.
*/
attach: function attach(aWindow) {},
/**
* Detach function.
*/
detach: function detach() {},
/**
* The virtual cursor's position changed.
* @param {PresenterContext} aContext the context object for the new pivot

Просмотреть файл

@ -42,27 +42,23 @@ this.TouchAdapter = {
// The virtual touch ID generated by an Android hover event.
HOVER_ID: 'hover',
attach: function TouchAdapter_attach(aWindow) {
if (this.chromeWin)
return;
start: function TouchAdapter_start() {
Logger.info('TouchAdapter.start');
Logger.info('TouchAdapter.attach');
this.chromeWin = aWindow;
this._touchPoints = {};
this._dwellTimeout = 0;
this._prevGestures = {};
this._lastExploreTime = 0;
this._dpi = this.chromeWin.QueryInterface(Ci.nsIInterfaceRequestor).
this._dpi = Utils.win.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils).displayDPI;
let target = this.chromeWin;
let target = Utils.win;
if (Utils.MozBuildApp == 'b2g') {
this.glass = this.chromeWin.document.
this.glass = Utils.win.document.
createElementNS('http://www.w3.org/1999/xhtml', 'div');
this.glass.id = 'accessfu-glass';
this.chromeWin.document.documentElement.appendChild(this.glass);
Utils.win.document.documentElement.appendChild(this.glass);
target = this.glass;
}
@ -75,16 +71,13 @@ this.TouchAdapter = {
target.addEventListener('touchstart', this, true, true);
if (Utils.OS != 'Android')
Mouse2Touch.attach(aWindow);
Mouse2Touch.start();
},
detach: function TouchAdapter_detach(aWindow) {
if (!this.chromeWin)
return;
stop: function TouchAdapter_stop() {
Logger.info('TouchAdapter.stop');
Logger.info('TouchAdapter.detach');
let target = this.chromeWin;
let target = Utils.win;
if (Utils.MozBuildApp == 'b2g') {
target = this.glass;
@ -100,14 +93,12 @@ this.TouchAdapter = {
target.removeEventListener('touchstart', this, true, true);
if (Utils.OS != 'Android')
Mouse2Touch.detach(aWindow);
delete this.chromeWin;
Mouse2Touch.stop();
},
handleEvent: function TouchAdapter_handleEvent(aEvent) {
if (this._delayedEvent) {
this.chromeWin.clearTimeout(this._delayedEvent);
Utils.win.clearTimeout(this._delayedEvent);
delete this._delayedEvent;
}
@ -127,7 +118,7 @@ this.TouchAdapter = {
this._touchPoints[identifier] = touchPoint;
this._lastExploreTime = timeStamp + this.SWIPE_MAX_DURATION;
}
this._dwellTimeout = this.chromeWin.setTimeout(
this._dwellTimeout = Utils.win.setTimeout(
(function () {
this.compileAndEmit(timeStamp + this.DWELL_THRESHOLD);
}).bind(this), this.DWELL_THRESHOLD);
@ -234,7 +225,7 @@ this.TouchAdapter = {
this._prevGestures[idhash] = details;
}
this.chromeWin.clearTimeout(this._dwellTimeout);
Utils.win.clearTimeout(this._dwellTimeout);
this.cleanupTouches();
return multiDetails;
@ -260,14 +251,14 @@ this.TouchAdapter = {
}
let emit = function emit() {
let evt = this.chromeWin.document.createEvent('CustomEvent');
let evt = Utils.win.document.createEvent('CustomEvent');
evt.initCustomEvent('mozAccessFuGesture', true, true, aDetails);
this.chromeWin.dispatchEvent(evt);
Utils.win.dispatchEvent(evt);
delete this._delayedEvent;
}.bind(this);
if (emitDelay) {
this._delayedEvent = this.chromeWin.setTimeout(emit, emitDelay);
this._delayedEvent = Utils.win.setTimeout(emit, emitDelay);
} else {
emit();
}
@ -387,17 +378,16 @@ var Mouse2Touch = {
mousemove: 'touchmove'
},
attach: function Mouse2Touch_attach(aWindow) {
this.chromeWin = aWindow;
this.chromeWin.addEventListener('mousedown', this, true, true);
this.chromeWin.addEventListener('mouseup', this, true, true);
this.chromeWin.addEventListener('mousemove', this, true, true);
start: function Mouse2Touch_start() {
Utils.win.addEventListener('mousedown', this, true, true);
Utils.win.addEventListener('mouseup', this, true, true);
Utils.win.addEventListener('mousemove', this, true, true);
},
detach: function Mouse2Touch_detach(aWindow) {
this.chromeWin.removeEventListener('mousedown', this, true, true);
this.chromeWin.removeEventListener('mouseup', this, true, true);
this.chromeWin.removeEventListener('mousemove', this, true, true);
stop: function Mouse2Touch_stop() {
Utils.win.removeEventListener('mousedown', this, true, true);
Utils.win.removeEventListener('mouseup', this, true, true);
Utils.win.removeEventListener('mousemove', this, true, true);
},
handleEvent: function Mouse2Touch_handleEvent(aEvent) {
@ -405,16 +395,16 @@ var Mouse2Touch = {
return;
let name = this._MouseToTouchMap[aEvent.type];
let evt = this.chromeWin.document.createEvent("touchevent");
let points = [this.chromeWin.document.createTouch(
this.chromeWin, aEvent.target, 0,
let evt = Utils.win.document.createEvent("touchevent");
let points = [Utils.win.document.createTouch(
Utils.win, aEvent.target, 0,
aEvent.pageX, aEvent.pageY, aEvent.screenX, aEvent.screenY,
aEvent.clientX, aEvent.clientY, 1, 1, 0, 0)];
// Simulate another touch point at a 5px offset when ctrl is pressed.
if (aEvent.ctrlKey)
points.push(this.chromeWin.document.createTouch(
this.chromeWin, aEvent.target, 1,
points.push(Utils.win.document.createTouch(
Utils.win, aEvent.target, 1,
aEvent.pageX + 5, aEvent.pageY + 5,
aEvent.screenX + 5, aEvent.screenY + 5,
aEvent.clientX + 5, aEvent.clientY + 5,
@ -422,20 +412,20 @@ var Mouse2Touch = {
// Simulate another touch point at a -5px offset when alt is pressed.
if (aEvent.altKey)
points.push(this.chromeWin.document.createTouch(
this.chromeWin, aEvent.target, 2,
points.push(Utils.win.document.createTouch(
Utils.win, aEvent.target, 2,
aEvent.pageX - 5, aEvent.pageY - 5,
aEvent.screenX - 5, aEvent.screenY - 5,
aEvent.clientX - 5, aEvent.clientY - 5,
1, 1, 0, 0));
let touches = this.chromeWin.document.createTouchList(points);
let touches = Utils.win.document.createTouchList(points);
if (name == "touchend") {
let empty = this.chromeWin.document.createTouchList();
evt.initTouchEvent(name, true, true, this.chromeWin, 0,
let empty = Utils.win.document.createTouchList();
evt.initTouchEvent(name, true, true, Utils.win, 0,
false, false, false, false, empty, empty, touches);
} else {
evt.initTouchEvent(name, true, true, this.chromeWin, 0,
evt.initTouchEvent(name, true, true, Utils.win, 0,
false, false, false, false, touches, touches, touches);
}
aEvent.target.dispatchEvent(evt);

Просмотреть файл

@ -20,6 +20,18 @@ this.Utils = {
'{a23983c0-fd0e-11dc-95ff-0800200c9a66}': 'mobile/xul'
},
init: function Utils_init(aWindow) {
if (this._win)
// XXX: only supports attaching to one window now.
throw new Error('Only one top-level window could used with AccessFu');
this._win = Cu.getWeakReference(aWindow);
},
get win() {
return this._win.get();
},
get AccRetrieval() {
if (!this._AccRetrieval) {
this._AccRetrieval = Cc['@mozilla.org/accessibleRetrieval;1'].
@ -69,30 +81,48 @@ this.Utils = {
this._AndroidSdkVersion = value;
},
getBrowserApp: function getBrowserApp(aWindow) {
get BrowserApp() {
switch (this.MozBuildApp) {
case 'mobile/android':
return aWindow.BrowserApp;
return this.win.BrowserApp;
case 'browser':
return aWindow.gBrowser;
return this.win.gBrowser;
case 'b2g':
return aWindow.shell;
return this.win.shell;
default:
return null;
}
},
getCurrentBrowser: function getCurrentBrowser(aWindow) {
get CurrentBrowser() {
if (this.MozBuildApp == 'b2g')
return this.getBrowserApp(aWindow).contentBrowser;
return this.getBrowserApp(aWindow).selectedBrowser;
return this.BrowserApp.contentBrowser;
return this.BrowserApp.selectedBrowser;
},
getCurrentContentDoc: function getCurrentContentDoc(aWindow) {
let browser = this.getCurrentBrowser(aWindow);
get CurrentContentDoc() {
let browser = this.CurrentBrowser;
return browser ? browser.contentDocument : null;
},
get AllMessageManagers() {
let messageManagers = [];
for (let i = 0; i < this.win.messageManager.childCount; i++)
messageManagers.push(this.win.messageManager.getChildAt(i));
let document = this.CurrentContentDoc;
if (document) {
let remoteframes = document.querySelectorAll('iframe[remote=true]');
for (let i = 0; i < remoteframes.length; ++i)
messageManagers.push(this.getMessageManager(remoteframes[i]));
}
return messageManagers;
},
getMessageManager: function getMessageManager(aBrowser) {
try {
return aBrowser.QueryInterface(Ci.nsIFrameLoaderOwner).
@ -103,24 +133,6 @@ this.Utils = {
}
},
getAllMessageManagers: function getAllMessageManagers(aWindow) {
let messageManagers = [];
for (let i = 0; i < aWindow.messageManager.childCount; i++)
messageManagers.push(aWindow.messageManager.getChildAt(i));
let document = this.getCurrentContentDoc(aWindow);
if (document) {
let remoteframes = document.querySelectorAll('iframe[remote=true]');
for (let i = 0; i < remoteframes.length; ++i)
messageManagers.push(this.getMessageManager(remoteframes[i]));
}
return messageManagers;
},
getViewport: function getViewport(aWindow) {
switch (this.MozBuildApp) {
case 'mobile/android':
@ -219,7 +231,7 @@ this.Logger = {
let str = Utils.AccRetrieval.getStringEventType(aEvent.eventType);
if (aEvent.eventType == Ci.nsIAccessibleEvent.EVENT_STATE_CHANGE) {
let event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
let stateStrings = (event.isExtraState()) ?
let stateStrings = event.isExtraState ?
Utils.AccRetrieval.getStringStates(0, event.state) :
Utils.AccRetrieval.getStringStates(event.state, 0);
str += ' (' + stateStrings.item(0) + ')';

Просмотреть файл

@ -0,0 +1,240 @@
#!/usr/bin/env python
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import sys, os, xpidl, makeutils
def findIDL(includePath, interfaceFileName):
for d in includePath:
# Not os.path.join: we need a forward slash even on Windows because
# this filename ends up in makedepend output.
path = d + '/' + interfaceFileName
if os.path.exists(path):
return path
raise BaseException("No IDL file found for interface %s "
"in include path %r"
% (interfaceFileName, includePath))
def loadEventIDL(parser, includePath, eventname):
eventidl = ("nsIAccessible%s.idl" % eventname)
idlFile = findIDL(includePath, eventidl)
if not idlFile in makeutils.dependencies:
makeutils.dependencies.append(idlFile)
idl = p.parse(open(idlFile).read(), idlFile)
idl.resolve(includePath, p)
return idl
class Configuration:
def __init__(self, filename):
config = {}
execfile(filename, config)
self.simple_events = config.get('simple_events', [])
def readConfigFile(filename):
return Configuration(filename)
def firstCap(str):
return str[0].upper() + str[1:]
def writeAttributeParams(a):
return ("%s a%s" % (a.realtype.nativeType('in'), firstCap(a.name)))
def print_header_file(fd, conf):
fd.write("/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n")
fd.write("#ifndef _mozilla_a11y_generated_AccEvents_h_\n"
"#define _mozilla_a11y_generated_AccEvents_h_\n\n")
fd.write("#include \"nscore.h\"\n")
fd.write("#include \"nsCOMPtr.h\"\n")
fd.write("#include \"nsCycleCollectionParticipant.h\"\n")
fd.write("#include \"nsString.h\"\n")
for e in conf.simple_events:
fd.write("#include \"nsIAccessible%s.h\"\n" % e)
for e in conf.simple_events:
idl = loadEventIDL(p, options.incdirs, e)
for iface in filter(lambda p: p.kind == "interface", idl.productions):
classname = ("xpcAcc%s" % e)
baseinterfaces = interfaces(iface)
fd.write("\nclass %s MOZ_FINAL : public %s\n" % (classname, iface.name))
fd.write("{\n")
fd.write("public:\n")
attributes = allAttributes(iface)
args = map(writeAttributeParams, attributes)
fd.write(" %s(%s) :\n" % (classname, ", ".join(args)))
initializers = []
for a in attributes:
initializers.append("m%s(a%s)" % (firstCap(a.name), firstCap(a.name)))
fd.write(" %s\n {}\n" % ", ".join(initializers))
fd.write(" ~%s() {}\n\n" % classname)
fd.write(" NS_DECL_CYCLE_COLLECTING_ISUPPORTS\n")
fd.write(" NS_DECL_CYCLE_COLLECTION_CLASS(%s)\n" % (classname))
for iface in filter(lambda i: i.name != "nsISupports", baseinterfaces):
fd.write(" NS_DECL_%s\n" % iface.name.upper())
fd.write("private:\n")
for a in attributes:
fd.write(" %s\n" % attributeVariableTypeAndName(a))
fd.write("};\n\n")
fd.write("#endif\n")
def interfaceAttributeTypes(idl):
ifaces = filter(lambda p: p.kind == "interface", idl.productions)
attributes = []
for i in ifaces:
ifaceAttributes = allAttributes(i)
attributes.extend(ifaceAttributes)
ifaceAttrs = filter(lambda a: a.realtype.nativeType("in").endswith("*"), attributes)
return map(lambda a: a.realtype.nativeType("in").strip(" *"), ifaceAttrs)
def print_cpp(idl, fd, conf, eventname):
for p in idl.productions:
if p.kind == 'interface':
write_cpp(eventname, p, fd)
def print_cpp_file(fd, conf):
fd.write("/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n\n")
fd.write('#include "xpcAccEvents.h"\n')
includes = []
for e in conf.simple_events:
if not e in includes:
includes.append(("nsIAccessible%s" % e))
types = []
for e in conf.simple_events:
idl = loadEventIDL(p, options.incdirs, e)
types.extend(interfaceAttributeTypes(idl))
for c in types:
fd.write("#include \"%s.h\"\n" % c)
fd.write("\n")
for e in conf.simple_events:
print_cpp(loadEventIDL(p, options.incdirs, e), fd, conf, e)
def attributeVariableTypeAndName(a):
if a.realtype.nativeType('in').endswith('*'):
l = ["nsCOMPtr<%s> m%s;" % (a.realtype.nativeType('in').strip('* '),
firstCap(a.name))]
elif a.realtype.nativeType('in').count("nsAString"):
l = ["nsString m%s;" % firstCap(a.name)]
elif a.realtype.nativeType('in').count("nsACString"):
l = ["nsCString m%s;" % firstCap(a.name)]
else:
l = ["%sm%s;" % (a.realtype.nativeType('in'),
firstCap(a.name))]
return ", ".join(l)
def writeAttributeGetter(fd, classname, a):
fd.write("NS_IMETHODIMP\n")
fd.write("%s::Get%s(" % (classname, firstCap(a.name)))
if a.realtype.nativeType('in').endswith('*'):
fd.write("%s** a%s" % (a.realtype.nativeType('in').strip('* '), firstCap(a.name)))
elif a.realtype.nativeType('in').count("nsAString"):
fd.write("nsAString& a%s" % firstCap(a.name))
elif a.realtype.nativeType('in').count("nsACString"):
fd.write("nsACString& a%s" % firstCap(a.name))
else:
fd.write("%s*a%s" % (a.realtype.nativeType('in'), firstCap(a.name)))
fd.write(")\n");
fd.write("{\n");
if a.realtype.nativeType('in').endswith('*'):
fd.write(" NS_IF_ADDREF(*a%s = m%s);\n" % (firstCap(a.name), firstCap(a.name)))
elif a.realtype.nativeType('in').count("nsAString"):
fd.write(" a%s = m%s;\n" % (firstCap(a.name), firstCap(a.name)))
elif a.realtype.nativeType('in').count("nsACString"):
fd.write(" a%s = m%s;\n" % (firstCap(a.name), firstCap(a.name)))
else:
fd.write(" *a%s = m%s;\n" % (firstCap(a.name), firstCap(a.name)))
fd.write(" return NS_OK;\n");
fd.write("}\n\n");
def interfaces(iface):
interfaces = []
while iface.base:
interfaces.append(iface)
iface = iface.idl.getName(iface.base, iface.location)
interfaces.append(iface)
interfaces.reverse()
return interfaces
def allAttributes(iface):
attributes = []
for i in interfaces(iface):
attrs = filter(lambda m: isinstance(m, xpidl.Attribute), i.members)
attributes.extend(attrs)
return attributes
def write_cpp(eventname, iface, fd):
classname = "xpcAcc%s" % eventname
attributes = allAttributes(iface)
ccattributes = filter(lambda m: m.realtype.nativeType('in').endswith('*'), attributes)
fd.write("NS_IMPL_CYCLE_COLLECTION_%u(%s" % (len(ccattributes), classname))
for c in ccattributes:
fd.write(", m%s" % firstCap(c.name))
fd.write(")\n\n");
fd.write("NS_IMPL_CYCLE_COLLECTING_ADDREF(%s)\n" % classname)
fd.write("NS_IMPL_CYCLE_COLLECTING_RELEASE(%s)\n\n" % classname)
fd.write("NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(%s)\n" % classname)
for baseiface in interfaces(iface):
fd.write(" NS_INTERFACE_MAP_ENTRY(%s)\n" % baseiface.name)
fd.write("NS_INTERFACE_MAP_END\n\n")
for a in attributes:
writeAttributeGetter(fd, classname, a)
def main():
from optparse import OptionParser
o = OptionParser(usage="usage: %prog [options] configfile")
o.add_option('-I', action='append', dest='incdirs', default=['.'],
help="Directory to search for imported files")
o.add_option('-o', "--stub-output",
type='string', dest='stub_output', default=None,
help="C++ source output file", metavar="FILE")
o.add_option('--header-output', type='string', default=None,
help="Quick stub header output file", metavar="FILE")
o.add_option('--makedepend-output', type='string', default=None,
help="gnumake dependencies output file", metavar="FILE")
o.add_option('--cachedir', dest='cachedir', default=None,
help="Directory in which to cache lex/parse tables.")
global options
(options, filenames) = o.parse_args()
if len(filenames) != 1:
o.error("Exactly one config filename is needed.")
filename = filenames[0]
if options.cachedir is not None:
if not os.path.isdir(options.cachedir):
os.mkdir(options.cachedir)
sys.path.append(options.cachedir)
# Instantiate the parser.
global p
p = xpidl.IDLParser(outputdir=options.cachedir)
conf = readConfigFile(filename)
if options.stub_output is not None:
makeutils.targets.append(options.stub_output)
outfd = open(options.stub_output, 'w')
print_cpp_file(outfd, conf)
outfd.close()
if options.makedepend_output is not None:
makeutils.writeMakeDependOutput(options.makedepend_output)
if options.header_output is not None:
outfd = open(options.header_output, 'w')
print_header_file(outfd, conf)
outfd.close()
if __name__ == '__main__':
main()

Просмотреть файл

@ -0,0 +1,17 @@
""" -*- Mode: Python -*-
This Source Code Form is subject to the terms of the Mozilla Public
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
The name of the event which real interface should have nsIAccessible-prefix,
and should be in nsIAccessible<name>.idl file"""
simple_events = [
'Event',
'StateChangeEvent',
'TextChangeEvent',
'HideEvent',
'CaretMoveEvent',
'TableChangeEvent',
'VirtualCursorChangeEvent'
]

Просмотреть файл

@ -14,8 +14,10 @@ MODULE = accessibility
LIBRARY_NAME = accessibility_xpcom_s
LIBXUL_LIBRARY = 1
EXPORTS := xpcAccEvents.h
CPPSRCS = \
nsAccEvent.cpp \
xpcAccEvents.cpp \
nsAccessibleRelation.cpp \
xpcAccessibleTable.cpp \
xpcAccessibleTableCell.cpp \
@ -24,6 +26,8 @@ CPPSRCS = \
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
EXTRA_MDDEPEND_FILES = xpcAccEvents.pp
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES = \
@ -56,3 +60,34 @@ endif
ifneq ($(A11Y_LOG),0)
DEFINES += -DA11Y_LOG
endif
xpcAccEvents.h: $(srcdir)/AccEvents.conf \
$(srcdir)/AccEventGen.py \
$(LIBXUL_DIST)/sdk/bin/header.py \
$(LIBXUL_DIST)/sdk/bin/xpidl.py \
$(DEPTH)/js/src/js-confdefs.h
$(PYTHON) $(topsrcdir)/config/pythonpath.py \
-I$(LIBXUL_DIST)/sdk/bin \
$(srcdir)/AccEventGen.py \
-I $(DEPTH)/dist/idl \
--header-output xpcAccEvents.h \
$(srcdir)/AccEvents.conf
xpcAccEvents.cpp: $(srcdir)/AccEvents.conf \
$(srcdir)/AccEventGen.py \
$(LIBXUL_DIST)/sdk/bin/header.py \
$(LIBXUL_DIST)/sdk/bin/xpidl.py \
$(DEPTH)/js/src/js-confdefs.h
$(PYTHON) $(topsrcdir)/config/pythonpath.py \
-I$(LIBXUL_DIST)/sdk/bin \
$(srcdir)/AccEventGen.py \
-I $(DEPTH)/dist/idl \
--header-output xpcAccEvents.h \
--stub-output xpcAccEvents.cpp \
--makedepend-output $(MDDEPDIR)/xpcAccEvents.pp \
$(srcdir)/AccEvents.conf
GARBAGE += \
xpcAccEvents.cpp \
xpcAccEvents.h \
$(null)

Просмотреть файл

@ -1,270 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsAccEvent.h"
#include "nsAccUtils.h"
#include "DocAccessible.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsAccEvent
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS1(nsAccEvent, nsIAccessibleEvent)
NS_IMETHODIMP
nsAccEvent::GetIsFromUserInput(bool* aIsFromUserInput)
{
*aIsFromUserInput = mEvent->IsFromUserInput();
return NS_OK;
}
NS_IMETHODIMP
nsAccEvent::GetEventType(uint32_t* aEventType)
{
*aEventType = mEvent->GetEventType();
return NS_OK;
}
NS_IMETHODIMP
nsAccEvent::GetAccessible(nsIAccessible** aAccessible)
{
NS_ENSURE_ARG_POINTER(aAccessible);
*aAccessible = nullptr;
NS_IF_ADDREF(*aAccessible = mEvent->GetAccessible());
return NS_OK;
}
NS_IMETHODIMP
nsAccEvent::GetDOMNode(nsIDOMNode** aDOMNode)
{
NS_ENSURE_ARG_POINTER(aDOMNode);
*aDOMNode = nullptr;
nsINode* node = mEvent->GetAccessible()->GetNode();
if (node)
CallQueryInterface(node, aDOMNode);
return NS_OK;
}
NS_IMETHODIMP
nsAccEvent::GetAccessibleDocument(nsIAccessibleDocument** aDocAccessible)
{
NS_ENSURE_ARG_POINTER(aDocAccessible);
NS_IF_ADDREF(*aDocAccessible = mEvent->GetDocAccessible());
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccStateChangeEvent
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED1(nsAccStateChangeEvent, nsAccEvent,
nsIAccessibleStateChangeEvent)
NS_IMETHODIMP
nsAccStateChangeEvent::GetState(uint32_t* aState)
{
NS_ENSURE_ARG_POINTER(aState);
uint32_t state1 = 0, state2 = 0;
uint64_t state = static_cast<AccStateChangeEvent*>(mEvent.get())->GetState();
nsAccUtils::To32States(state, &state1, &state2);
*aState = state1 | state2; // only one state is not 0
return NS_OK;
}
NS_IMETHODIMP
nsAccStateChangeEvent::IsExtraState(bool* aIsExtraState)
{
NS_ENSURE_ARG_POINTER(aIsExtraState);
uint32_t state1 = 0, state2 = 0;
uint64_t state = static_cast<AccStateChangeEvent*>(mEvent.get())->GetState();
nsAccUtils::To32States(state, &state1, &state2);
*aIsExtraState = (state2 != 0);
return NS_OK;
}
NS_IMETHODIMP
nsAccStateChangeEvent::IsEnabled(bool* aIsEnabled)
{
NS_ENSURE_ARG_POINTER(aIsEnabled);
*aIsEnabled = static_cast<AccStateChangeEvent*>(mEvent.get())->IsStateEnabled();
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccTextChangeEvent
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED1(nsAccTextChangeEvent, nsAccEvent,
nsIAccessibleTextChangeEvent)
NS_IMETHODIMP
nsAccTextChangeEvent::GetStart(int32_t* aStart)
{
NS_ENSURE_ARG_POINTER(aStart);
*aStart = static_cast<AccTextChangeEvent*>(mEvent.get())->GetStartOffset();
return NS_OK;
}
NS_IMETHODIMP
nsAccTextChangeEvent::GetLength(uint32_t* aLength)
{
NS_ENSURE_ARG_POINTER(aLength);
*aLength = static_cast<AccTextChangeEvent*>(mEvent.get())->GetLength();
return NS_OK;
}
NS_IMETHODIMP
nsAccTextChangeEvent::IsInserted(bool* aIsInserted)
{
NS_ENSURE_ARG_POINTER(aIsInserted);
*aIsInserted = static_cast<AccTextChangeEvent*>(mEvent.get())->IsTextInserted();
return NS_OK;
}
NS_IMETHODIMP
nsAccTextChangeEvent::GetModifiedText(nsAString& aModifiedText)
{
static_cast<AccTextChangeEvent*>(mEvent.get())->GetModifiedText(aModifiedText);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccHideEvent
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED1(nsAccHideEvent, nsAccEvent,
nsIAccessibleHideEvent)
NS_IMETHODIMP
nsAccHideEvent::GetTargetParent(nsIAccessible** aAccessible)
{
NS_ENSURE_ARG_POINTER(aAccessible);
NS_IF_ADDREF(*aAccessible =
static_cast<AccHideEvent*>(mEvent.get())->TargetParent());
return NS_OK;
}
NS_IMETHODIMP
nsAccHideEvent::GetTargetNextSibling(nsIAccessible** aAccessible)
{
NS_ENSURE_ARG_POINTER(aAccessible);
NS_IF_ADDREF(*aAccessible =
static_cast<AccHideEvent*>(mEvent.get())->TargetNextSibling());
return NS_OK;
}
NS_IMETHODIMP
nsAccHideEvent::GetTargetPrevSibling(nsIAccessible** aAccessible)
{
NS_ENSURE_ARG_POINTER(aAccessible);
NS_IF_ADDREF(*aAccessible =
static_cast<AccHideEvent*>(mEvent.get())->TargetPrevSibling());
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccCaretMoveEvent
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED1(nsAccCaretMoveEvent, nsAccEvent,
nsIAccessibleCaretMoveEvent)
NS_IMETHODIMP
nsAccCaretMoveEvent::GetCaretOffset(int32_t *aCaretOffset)
{
NS_ENSURE_ARG_POINTER(aCaretOffset);
*aCaretOffset = static_cast<AccCaretMoveEvent*>(mEvent.get())->GetCaretOffset();
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccTableChangeEvent
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED1(nsAccTableChangeEvent, nsAccEvent,
nsIAccessibleTableChangeEvent)
NS_IMETHODIMP
nsAccTableChangeEvent::GetRowOrColIndex(int32_t *aRowOrColIndex)
{
NS_ENSURE_ARG_POINTER(aRowOrColIndex);
*aRowOrColIndex =
static_cast<AccTableChangeEvent*>(mEvent.get())->GetIndex();
return NS_OK;
}
NS_IMETHODIMP
nsAccTableChangeEvent::GetNumRowsOrCols(int32_t* aNumRowsOrCols)
{
NS_ENSURE_ARG_POINTER(aNumRowsOrCols);
*aNumRowsOrCols = static_cast<AccTableChangeEvent*>(mEvent.get())->GetCount();
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccVirtualCursorChangeEvent
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED1(nsAccVirtualCursorChangeEvent, nsAccEvent,
nsIAccessibleVirtualCursorChangeEvent)
NS_IMETHODIMP
nsAccVirtualCursorChangeEvent::GetOldAccessible(nsIAccessible** aOldAccessible)
{
NS_ENSURE_ARG_POINTER(aOldAccessible);
*aOldAccessible =
static_cast<AccVCChangeEvent*>(mEvent.get())->OldAccessible();
NS_IF_ADDREF(*aOldAccessible);
return NS_OK;
}
NS_IMETHODIMP
nsAccVirtualCursorChangeEvent::GetOldStartOffset(int32_t* aOldStartOffset)
{
NS_ENSURE_ARG_POINTER(aOldStartOffset);
*aOldStartOffset =
static_cast<AccVCChangeEvent*>(mEvent.get())->OldStartOffset();
return NS_OK;
}
NS_IMETHODIMP
nsAccVirtualCursorChangeEvent::GetOldEndOffset(int32_t* aOldEndOffset)
{
NS_ENSURE_ARG_POINTER(aOldEndOffset);
*aOldEndOffset =
static_cast<AccVCChangeEvent*>(mEvent.get())->OldEndOffset();
return NS_OK;
}
NS_IMETHODIMP
nsAccVirtualCursorChangeEvent::GetReason(int16_t* aReason)
{
NS_ENSURE_ARG_POINTER(aReason);
*aReason = static_cast<AccVCChangeEvent*>(mEvent.get())->Reason();
return NS_OK;
}

Просмотреть файл

@ -1,161 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _nsAccEvent_H_
#define _nsAccEvent_H_
#include "nsIAccessibleEvent.h"
#include "AccEvent.h"
namespace mozilla {
namespace a11y {
/**
* Generic accessible event.
*/
class nsAccEvent: public nsIAccessibleEvent
{
public:
nsAccEvent(AccEvent* aEvent) : mEvent(aEvent) { }
virtual ~nsAccEvent() { }
NS_DECL_ISUPPORTS
NS_DECL_NSIACCESSIBLEEVENT
protected:
nsRefPtr<AccEvent> mEvent;
private:
nsAccEvent();
nsAccEvent(const nsAccEvent&);
nsAccEvent& operator =(const nsAccEvent&);
};
/**
* Accessible state change event.
*/
class nsAccStateChangeEvent: public nsAccEvent,
public nsIAccessibleStateChangeEvent
{
public:
nsAccStateChangeEvent(AccStateChangeEvent* aEvent) : nsAccEvent(aEvent) { }
virtual ~nsAccStateChangeEvent() { }
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLESTATECHANGEEVENT
private:
nsAccStateChangeEvent();
nsAccStateChangeEvent(const nsAccStateChangeEvent&);
nsAccStateChangeEvent& operator =(const nsAccStateChangeEvent&);
};
/**
* Accessible text change event.
*/
class nsAccTextChangeEvent: public nsAccEvent,
public nsIAccessibleTextChangeEvent
{
public:
nsAccTextChangeEvent(AccTextChangeEvent* aEvent) : nsAccEvent(aEvent) { }
virtual ~nsAccTextChangeEvent() { }
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLETEXTCHANGEEVENT
private:
nsAccTextChangeEvent();
nsAccTextChangeEvent(const nsAccTextChangeEvent&);
nsAccTextChangeEvent& operator =(const nsAccTextChangeEvent&);
};
/**
* Accessible hide event.
*/
class nsAccHideEvent : public nsAccEvent,
public nsIAccessibleHideEvent
{
public:
nsAccHideEvent(AccHideEvent* aEvent) : nsAccEvent(aEvent) { }
virtual ~nsAccHideEvent() { }
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLEHIDEEVENT
private:
nsAccHideEvent() MOZ_DELETE;
nsAccHideEvent(const nsAccHideEvent&) MOZ_DELETE;
nsAccHideEvent& operator =(const nsAccHideEvent&) MOZ_DELETE;
};
/**
* Accessible caret move event.
*/
class nsAccCaretMoveEvent: public nsAccEvent,
public nsIAccessibleCaretMoveEvent
{
public:
nsAccCaretMoveEvent(AccCaretMoveEvent* aEvent) : nsAccEvent(aEvent) { }
virtual ~nsAccCaretMoveEvent() { }
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLECARETMOVEEVENT
private:
nsAccCaretMoveEvent();
nsAccCaretMoveEvent(const nsAccCaretMoveEvent&);
nsAccCaretMoveEvent& operator =(const nsAccCaretMoveEvent&);
};
/**
* Accessible table change event.
*/
class nsAccTableChangeEvent : public nsAccEvent,
public nsIAccessibleTableChangeEvent
{
public:
nsAccTableChangeEvent(AccTableChangeEvent* aEvent) : nsAccEvent(aEvent) { }
virtual ~nsAccTableChangeEvent() { }
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLETABLECHANGEEVENT
private:
nsAccTableChangeEvent();
nsAccTableChangeEvent(const nsAccTableChangeEvent&);
nsAccTableChangeEvent& operator =(const nsAccTableChangeEvent&);
};
/**
* Accessible virtual cursor change event.
*/
class nsAccVirtualCursorChangeEvent : public nsAccEvent,
public nsIAccessibleVirtualCursorChangeEvent
{
public:
nsAccVirtualCursorChangeEvent(AccVCChangeEvent* aEvent) :
nsAccEvent(aEvent) { }
virtual ~nsAccVirtualCursorChangeEvent() { }
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLEVIRTUALCURSORCHANGEEVENT
private:
nsAccVirtualCursorChangeEvent() MOZ_DELETE;
nsAccVirtualCursorChangeEvent(const nsAccVirtualCursorChangeEvent&) MOZ_DELETE;
nsAccVirtualCursorChangeEvent& operator =(const nsAccVirtualCursorChangeEvent&) MOZ_DELETE;
};
} // namespace a11y
} // namespace mozilla
#endif

Просмотреть файл

@ -1565,7 +1565,7 @@ function textChangeChecker(aID, aStart, aEnd, aTextOrFunc, aIsInserted, aFromUse
"Wrong start offset for " + prettyName(aID));
is(aEvent.length, modifiedTextLen, "Wrong length for " + prettyName(aID));
var changeInfo = (aIsInserted ? "inserted" : "removed");
is(aEvent.isInserted(), aIsInserted,
is(aEvent.isInserted, aIsInserted,
"Text was " + changeInfo + " for " + prettyName(aID));
is(aEvent.modifiedText, modifiedText,
"Wrong " + changeInfo + " text for " + prettyName(aID));
@ -1613,11 +1613,11 @@ function stateChangeChecker(aState, aIsExtraState, aIsEnabled,
if (!event)
return;
is(event.isExtraState(), aIsExtraState,
is(event.isExtraState, aIsExtraState,
"Wrong extra state bit of the statechange event.");
isState(event.state, aState, aIsExtraState,
"Wrong state of the statechange event.");
is(event.isEnabled(), aIsEnabled,
is(event.isEnabled, aIsEnabled,
"Wrong state of statechange event state");
if (aSkipCurrentStateCheck) {
@ -1670,9 +1670,9 @@ function expandedStateChecker(aIsEnabled, aTargetOrFunc, aTargetFuncArg)
return;
is(event.state, STATE_EXPANDED, "Wrong state of the statechange event.");
is(event.isExtraState(), false,
is(event.isExtraState, false,
"Wrong extra state bit of the statechange event.");
is(event.isEnabled(), aIsEnabled,
is(event.isEnabled, aIsEnabled,
"Wrong state of statechange event state");
testStates(event.accessible,
@ -1730,7 +1730,7 @@ var gA11yEventObserver =
if (event instanceof nsIAccessibleTextChangeEvent) {
info += ", start: " + event.start + ", length: " + event.length +
", " + (event.isInserted() ? "inserted" : "removed") +
", " + (event.isInserted ? "inserted" : "removed") +
" text: " + event.modifiedText;
}

Просмотреть файл

@ -44,7 +44,7 @@
return;
is(event.state, STATE_BUSY, "Wrong state of statechange event.");
is(event.isEnabled(), aIsEnabled,
is(event.isEnabled, aIsEnabled,
"Wrong value of state of statechange event");
testStates(event.accessible, (aIsEnabled ? STATE_BUSY : 0), 0,

Просмотреть файл

@ -44,9 +44,9 @@
if (!event) { return; }
ok(event.isExtraState(), "Extra state change was expected");
ok(event.isExtraState, "Extra state change was expected");
is(event.state, EXT_STATE_EDITABLE, "Wrong state of statechange event");
ok(event.isEnabled(), "Expected editable state to be enabled");
ok(event.isEnabled, "Expected editable state to be enabled");
}
this.getID = function editabledoc_getID() {

Просмотреть файл

@ -16,7 +16,7 @@
function doTest()
{
SimpleTest.expectAssertions(60);
SimpleTest.expectAssertions(52);
// __o__n__e__w__o__r__d__\n
// 0 1 2 3 4 5 6 7

Просмотреть файл

@ -12,9 +12,9 @@
src="../text.js"></script>
<script type="application/javascript">
if (navigator.platform.startsWith("Mac")) {
SimpleTest.expectAssertions(0, 23);
SimpleTest.expectAssertions(0, 19);
} else {
SimpleTest.expectAssertions(23);
SimpleTest.expectAssertions(19);
}
function doTest()

Просмотреть файл

@ -14,9 +14,9 @@
src="../text.js"></script>
<script type="application/javascript">
if (navigator.platform.startsWith("Mac")) {
SimpleTest.expectAssertions(0, 10);
SimpleTest.expectAssertions(0, 8);
} else {
SimpleTest.expectAssertions(10);
SimpleTest.expectAssertions(8);
}
function doTest()

Просмотреть файл

@ -185,9 +185,12 @@ let FormAssistant = {
addEventListener("resize", this, true, false);
addEventListener("submit", this, true, false);
addEventListener("pagehide", this, true, false);
addEventListener("input", this, true, false);
addEventListener("keydown", this, true, false);
addMessageListener("Forms:Select:Choice", this);
addMessageListener("Forms:Input:Value", this);
addMessageListener("Forms:Select:Blur", this);
addMessageListener("Forms:SetSelectionRange", this);
},
ignoredInputTypes: new Set([
@ -195,8 +198,8 @@ let FormAssistant = {
]),
isKeyboardOpened: false,
selectionStart: 0,
selectionEnd: 0,
selectionStart: -1,
selectionEnd: -1,
scrollIntoViewTimeout: null,
_focusedElement: null,
_documentEncoder: null,
@ -257,11 +260,14 @@ let FormAssistant = {
if (isContentEditable(target)) {
this.showKeyboard(this.getTopLevelEditable(target));
this.updateSelection();
break;
}
if (this.isFocusableElement(target))
if (this.isFocusableElement(target)) {
this.showKeyboard(target);
this.updateSelection();
}
break;
case "pagehide":
@ -272,16 +278,17 @@ let FormAssistant = {
// fall through
case "blur":
case "submit":
if (this.focusedElement)
if (this.focusedElement) {
this.hideKeyboard();
this.selectionStart = -1;
this.selectionEnd = -1;
}
break;
case 'mousedown':
// We only listen for this event on the currently focused element.
// When the mouse goes down, note the cursor/selection position
range = getSelectionRange(this.focusedElement);
this.selectionStart = range[0];
this.selectionEnd = range[1];
this.updateSelection();
break;
case 'mouseup':
@ -293,6 +300,7 @@ let FormAssistant = {
if (range[0] !== this.selectionStart ||
range[1] !== this.selectionEnd) {
this.sendKeyboardState(this.focusedElement);
this.updateSelection();
}
break;
@ -316,6 +324,19 @@ let FormAssistant = {
}.bind(this), RESIZE_SCROLL_DELAY);
}
break;
case "input":
// When the text content changes, notify the keyboard
this.updateSelection();
break;
case "keydown":
// We use 'setTimeout' to wait until the input element accomplishes the
// change in selection range
content.setTimeout(function() {
this.updateSelection();
}.bind(this), 0);
break;
}
},
@ -366,6 +387,14 @@ let FormAssistant = {
this.setFocusedElement(null);
break;
}
case "Forms:SetSelectionRange": {
let start = json.selectionStart;
let end = json.selectionEnd;
setSelectionRange(target, start, end);
this.updateSelection();
break;
}
}
},
@ -442,6 +471,19 @@ let FormAssistant = {
sendAsyncMessage("Forms:Input", getJSON(element));
return true;
},
// Notify when the selection range changes
updateSelection: function fa_updateSelection() {
let range = getSelectionRange(this.focusedElement);
if (range[0] != this.selectionStart || range[1] != this.selectionEnd) {
this.selectionStart = range[0];
this.selectionEnd = range[1];
sendAsyncMessage("Forms:SelectionChange", {
selectionStart: range[0],
selectionEnd: range[1]
});
}
}
};
@ -598,17 +640,79 @@ function getSelectionRange(element) {
// Get the selection range of contenteditable elements
let win = element.ownerDocument.defaultView;
let sel = win.getSelection();
start = getContentEditableSelectionStart(element, sel);
end = start + getContentEditableSelectionLength(element, sel);
}
return [start, end];
}
let range = win.document.createRange();
range.setStart(element, 0);
range.setEnd(sel.anchorNode, sel.anchorOffset);
let encoder = FormAssistant.documentEncoder;
encoder.setRange(range);
start = encoder.encodeToString().length;
encoder.setRange(sel.getRangeAt(0));
end = start + encoder.encodeToString().length;
}
return [start, end];
function getContentEditableSelectionStart(element, selection) {
let doc = element.ownerDocument;
let range = doc.createRange();
range.setStart(element, 0);
range.setEnd(selection.anchorNode, selection.anchorOffset);
let encoder = FormAssistant.documentEncoder;
encoder.setRange(range);
return encoder.encodeToString().length;
}
function getContentEditableSelectionLength(element, selection) {
let encoder = FormAssistant.documentEncoder;
encoder.setRange(selection.getRangeAt(0));
return encoder.encodeToString().length;
}
function setSelectionRange(element, start, end) {
let isPlainTextField = element instanceof HTMLInputElement ||
element instanceof HTMLTextAreaElement;
// Check the parameters
if (!isPlainTextField && !isContentEditable(element)) {
// Skip HTMLOptionElement and HTMLSelectElement elements, as they don't
// support the operation of setSelectionRange
return;
}
let text = isPlainTextField ? element.value : getContentEditableText(element);
let length = text.length;
if (start < 0) {
start = 0;
}
if (end > length) {
end = length;
}
if (start > end) {
start = end;
}
if (isPlainTextField) {
// Set the selection range of <input> and <textarea> elements
element.setSelectionRange(start, end, "forward");
} else {
// set the selection range of contenteditable elements
let win = element.ownerDocument.defaultView;
let sel = win.getSelection();
// Move the caret to the start position
sel.collapse(element, 0);
for (let i = 0; i < start; i++) {
sel.modify("move", "forward", "character");
}
while (getContentEditableSelectionStart(element, sel) < start) {
sel.modify("move", "forward", "character");
}
// Extend the selection to the end position
for (let i = start; i < end; i++) {
sel.modify("extend", "forward", "character");
}
let selectionLength = end - start;
while (getContentEditableSelectionLength(element, sel) < selectionLength) {
sel.modify("extend", "forward", "character");
}
}
}

Просмотреть файл

@ -20,7 +20,8 @@ XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
let Keyboard = {
_messageManager: null,
_messageNames: [
'SetValue', 'RemoveFocus', 'SetSelectedOption', 'SetSelectedOptions'
'SetValue', 'RemoveFocus', 'SetSelectedOption', 'SetSelectedOptions',
'SetSelectionRange'
],
get messageManager() {
@ -46,6 +47,7 @@ let Keyboard = {
let frameLoader = subject.QueryInterface(Ci.nsIFrameLoader);
let mm = frameLoader.messageManager;
mm.addMessageListener('Forms:Input', this);
mm.addMessageListener('Forms:SelectionChange', this);
// When not running apps OOP, we need to load forms.js here since this
// won't happen from dom/ipc/preload.js
@ -61,7 +63,7 @@ let Keyboard = {
receiveMessage: function keyboardReceiveMessage(msg) {
// If we get a 'Keyboard:XXX' message, check that the sender has the
// keyboard permission.
if (msg.name != 'Forms:Input') {
if (msg.name.indexOf("Keyboard:") != -1) {
let mm;
try {
mm = msg.target.QueryInterface(Ci.nsIFrameLoaderOwner)
@ -87,6 +89,9 @@ let Keyboard = {
case 'Forms:Input':
this.handleFormsInput(msg);
break;
case 'Forms:SelectionChange':
this.handleFormsSelectionChange(msg);
break;
case 'Keyboard:SetValue':
this.setValue(msg);
break;
@ -99,6 +104,9 @@ let Keyboard = {
case 'Keyboard:SetSelectedOptions':
this.setSelectedOption(msg);
break;
case 'Keyboard:SetSelectionRange':
this.setSelectionRange(msg);
break;
}
},
@ -109,6 +117,13 @@ let Keyboard = {
ppmm.broadcastAsyncMessage('Keyboard:FocusChange', msg.data);
},
handleFormsSelectionChange: function keyboardHandleFormsSelectionChange(msg) {
this.messageManager = msg.target.QueryInterface(Ci.nsIFrameLoaderOwner)
.frameLoader.messageManager;
ppmm.broadcastAsyncMessage('Keyboard:SelectionChange', msg.data);
},
setSelectedOption: function keyboardSetSelectedOption(msg) {
this.messageManager.sendAsyncMessage('Forms:Select:Choice', msg.data);
},
@ -117,6 +132,10 @@ let Keyboard = {
this.messageManager.sendAsyncMessage('Forms:Select:Choice', msg.data);
},
setSelectionRange: function keyboardSetSelectionRange(msg) {
this.messageManager.sendAsyncMessage('Forms:SetSelectionRange', msg.data);
},
setValue: function keyboardSetValue(msg) {
this.messageManager.sendAsyncMessage('Forms:Input:Value', msg.data);
},

Просмотреть файл

@ -47,21 +47,27 @@ MozKeyboard.prototype = {
Services.obs.addObserver(this, "inner-window-destroyed", false);
cpmm.addMessageListener('Keyboard:FocusChange', this);
cpmm.addMessageListener('Keyboard:SelectionChange', this);
this._window = win;
this._utils = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
this.innerWindowID = this._utils.currentInnerWindowID;
this._focusHandler = null;
this._selectionHandler = null;
this._selectionStart = -1;
this._selectionEnd = -1;
},
uninit: function mozKeyboardUninit() {
Services.obs.removeObserver(this, "inner-window-destroyed");
cpmm.removeMessageListener('Keyboard:FocusChange', this);
cpmm.removeMessageListener('Keyboard:SelectionChange', this);
this._window = null;
this._utils = null;
this._focusHandler = null;
this._selectionHandler = null;
},
sendKey: function mozKeyboardSendKey(keyCode, charCode) {
@ -89,6 +95,29 @@ MozKeyboard.prototype = {
});
},
set onselectionchange(val) {
this._selectionHandler = val;
},
get onselectionchange() {
return this._selectionHandler;
},
get selectionStart() {
return this._selectionStart;
},
get selectionEnd() {
return this._selectionEnd;
},
setSelectionRange: function mozKeyboardSetSelectionRange(start, end) {
cpmm.sendAsyncMessage('Keyboard:SetSelectionRange', {
'selectionStart': start,
'selectionEnd': end
});
},
removeFocus: function mozKeyboardRemoveFocus() {
cpmm.sendAsyncMessage('Keyboard:RemoveFocus', {});
},
@ -102,17 +131,41 @@ MozKeyboard.prototype = {
},
receiveMessage: function mozKeyboardReceiveMessage(msg) {
let handler = this._focusHandler;
if (!handler || !(handler instanceof Ci.nsIDOMEventListener))
return;
if (msg.name == "Keyboard:FocusChange") {
let msgJson = msg.json;
if (msgJson.type != "blur") {
this._selectionStart = msgJson.selectionStart;
this._selectionEnd = msgJson.selectionEnd;
} else {
this._selectionStart = 0;
this._selectionEnd = 0;
}
let detail = {
"detail": msg.json
};
let handler = this._focusHandler;
if (!handler || !(handler instanceof Ci.nsIDOMEventListener))
return;
let evt = new this._window.CustomEvent("focuschanged",
ObjectWrapper.wrap(detail, this._window));
handler.handleEvent(evt);
let detail = {
"detail": msgJson
};
let evt = new this._window.CustomEvent("focuschanged",
ObjectWrapper.wrap(detail, this._window));
handler.handleEvent(evt);
} else if (msg.name == "Keyboard:SelectionChange") {
let msgJson = msg.json;
this._selectionStart = msgJson.selectionStart;
this._selectionEnd = msgJson.selectionEnd;
let handler = this._selectionHandler;
if (!handler || !(handler instanceof Ci.nsIDOMEventListener))
return;
let evt = new this._window.CustomEvent("selectionchange",
ObjectWrapper.wrap({}, this._window));
handler.handleEvent(evt);
}
},
observe: function mozKeyboardObserve(subject, topic, data) {
@ -123,4 +176,3 @@ MozKeyboard.prototype = {
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([MozKeyboard]);

Просмотреть файл

@ -40,4 +40,25 @@ interface nsIB2GKeyboard : nsISupports
void removeFocus();
attribute nsIDOMEventListener onfocuschange;
// Fires when user moves the cursor, changes the selection, or alters the
// composing text length
attribute nsIDOMEventListener onselectionchange;
// The start position of the selection.
readonly attribute long selectionStart;
// The stop position of the selection.
readonly attribute long selectionEnd;
/*
* Set the selection range of the the editable text.
*
* @param start The beginning of the selected text.
* @param end The end of the selected text.
*
* Note that the start position should be less or equal to the end position.
* To move the cursor, set the start and end position to the same value.
*/
void setSelectionRange(in long start, in long end);
};

Просмотреть файл

@ -8,7 +8,7 @@ CONFIGURE_SUBST_FILES += ['installer/Makefile']
DIRS += ['chrome', 'components', 'locales']
if CONFIG['OS_ARCH'] == 'WINNT':
DIRS += ['/xulrunner/tools/redit']
DIRS += ['../xulrunner/tools/redit']
if CONFIG['GAIADIR']:
DIRS += ['gaia']

Просмотреть файл

@ -608,10 +608,6 @@ pref("pfs.datasource.url", "https://pfs.mozilla.org/plugins/PluginFinderService.
pref("plugins.hide_infobar_for_missing_plugin", false);
pref("plugins.hide_infobar_for_outdated_plugin", false);
#ifdef XP_MACOSX
pref("plugins.hide_infobar_for_carbon_failure_plugin", false);
#endif
pref("plugins.update.url", "https://www.mozilla.org/%LOCALE%/plugincheck/");
pref("plugins.update.notifyUser", false);

Просмотреть файл

@ -198,9 +198,6 @@ var gPluginHandler = {
case "PluginBlocklisted":
case "PluginOutdated":
#ifdef XP_MACOSX
case "npapi-carbon-event-model-failure":
#endif
this.pluginUnavailable(plugin, eventType);
break;
@ -713,7 +710,7 @@ var gPluginHandler = {
}
},
// event listener for missing/blocklisted/outdated/carbonFailure plugins.
// event listener for missing/blocklisted/outdated plugins.
pluginUnavailable: function (plugin, eventType) {
let browser = gBrowser.getBrowserForDocument(plugin.ownerDocument
.defaultView.top.document);
@ -755,23 +752,6 @@ var gPluginHandler = {
}
}
#ifdef XP_MACOSX
function carbonFailurePluginsRestartBrowser()
{
// Notify all windows that an application quit has been requested.
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].
createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested", null);
// Something aborted the quit process.
if (cancelQuit.data)
return;
let as = Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup);
as.quit(Ci.nsIAppStartup.eRestarti386 | Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit);
}
#endif
let notifications = {
PluginBlocklisted : {
barID : "blocked-plugins",
@ -812,43 +792,12 @@ var gPluginHandler = {
callback : showPluginsMissing
}],
},
#ifdef XP_MACOSX
"npapi-carbon-event-model-failure" : {
barID : "carbon-failure-plugins",
iconURL : "chrome://mozapps/skin/plugins/notifyPluginGeneric.png",
message : gNavigatorBundle.getString("carbonFailurePluginsMessage.message"),
buttons: [{
label : gNavigatorBundle.getString("carbonFailurePluginsMessage.restartButton.label"),
accessKey : gNavigatorBundle.getString("carbonFailurePluginsMessage.restartButton.accesskey"),
popup : null,
callback : carbonFailurePluginsRestartBrowser
}],
}
#endif
};
// If there is already an outdated plugin notification then do nothing
if (outdatedNotification)
return;
#ifdef XP_MACOSX
if (eventType == "npapi-carbon-event-model-failure") {
if (gPrefService.getBoolPref("plugins.hide_infobar_for_carbon_failure_plugin"))
return;
let carbonFailureNotification =
notificationBox.getNotificationWithValue("carbon-failure-plugins");
if (carbonFailureNotification)
carbonFailureNotification.close();
let macutils = Cc["@mozilla.org/xpcom/mac-utils;1"].getService(Ci.nsIMacUtils);
// if this is not a Universal build, just follow PluginNotFound path
if (!macutils.isUniversalBinary)
eventType = "PluginNotFound";
}
#endif
if (eventType == "PluginBlocklisted") {
if (gPrefService.getBoolPref("plugins.hide_infobar_for_missing_plugin")) // XXX add a new pref?
return;

Просмотреть файл

@ -1137,9 +1137,6 @@ var gBrowserInit = {
gBrowser.addEventListener("PluginOutdated", gPluginHandler, true);
gBrowser.addEventListener("NewPluginInstalled", gPluginHandler.newPluginInstalled, true);
#ifdef XP_MACOSX
gBrowser.addEventListener("npapi-carbon-event-model-failure", gPluginHandler, true);
#endif
Services.obs.addObserver(gPluginHandler.pluginCrashed, "plugin-crashed", false);
@ -7198,7 +7195,6 @@ let gPrivateBrowsingUI = {
// temporary fix until bug 463607 is fixed
document.getElementById("Tools:Sanitize").setAttribute("disabled", "true");
// Adjust the window's title
if (window.location.href == getBrowserURL()) {
#ifdef XP_MACOSX
if (!PrivateBrowsingUtils.permanentPrivateBrowsing) {
@ -7206,6 +7202,7 @@ let gPrivateBrowsingUI = {
}
#endif
// Adjust the window's title
let docElement = document.documentElement;
docElement.setAttribute("title",
docElement.getAttribute("title_privatebrowsing"));
@ -7214,6 +7211,23 @@ let gPrivateBrowsingUI = {
docElement.setAttribute("privatebrowsingmode",
PrivateBrowsingUtils.permanentPrivateBrowsing ? "permanent" : "temporary");
gBrowser.updateTitlebar();
if (PrivateBrowsingUtils.permanentPrivateBrowsing) {
// Adjust the New Window menu entries
[
{ normal: "menu_newNavigator", private: "menu_newPrivateWindow" },
{ normal: "appmenu_newNavigator", private: "appmenu_newPrivateWindow" },
].forEach(function(menu) {
let newWindow = document.getElementById(menu.normal);
let newPrivateWindow = document.getElementById(menu.private);
if (newWindow && newPrivateWindow) {
newPrivateWindow.hidden = true;
newWindow.label = newPrivateWindow.label;
newWindow.accessKey = newPrivateWindow.accessKey;
newWindow.command = newPrivateWindow.command;
}
});
}
}
if (gURLBar) {

Просмотреть файл

@ -417,6 +417,21 @@ var gSyncSetup = {
}
},
#ifdef XP_WIN
#ifdef MOZ_METRO
_securelyStoreForMetroSync: function(weaveEmail, weavePassword, weaveKey) {
try {
let metroUtils = Cc["@mozilla.org/windows-metroutils;1"].
createInstance(Ci.nsIWinMetroUtils);
if (!metroUtils)
return;
metroUtils.storeSyncInfo(weaveEmail, weavePassword, weaveKey);
} catch (ex) {
}
},
#endif
#endif
onWizardAdvance: function () {
// Check pageIndex so we don't prompt before the Sync setup wizard appears.
// This is a fallback in case the Master Password gets locked mid-wizard.
@ -471,6 +486,13 @@ var gSyncSetup = {
Weave.Service.identity.syncKey = Weave.Utils.generatePassphrase();
this._handleNoScript(false);
Weave.Svc.Prefs.set("firstSync", "newAccount");
#ifdef XP_WIN
#ifdef MOZ_METRO
if (document.getElementById("metroSetupCheckbox").checked) {
this._securelyStoreForMetroSync(email, password, Weave.Service.identity.syncKey);
}
#endif
#endif
this.wizardFinish();
return false;
}

Просмотреть файл

@ -172,6 +172,20 @@
<label class="status" value=" "/>
</hbox>
</row>
#ifdef XP_WIN
#ifdef MOZ_METRO
<row id="metroRow" align="center">
<spacer/>
<hbox align="center">
<checkbox label="&setup.setupMetro.label;"
accesskey="&setup.setupMetro.accesskey;"
control="weavePasswordConfirm"
id="metroSetupCheckbox"
checked="true"/>
</hbox>
</row>
#endif
#endif
<row id="TOSRow" align="center">
<spacer/>
<hbox align="center">

Просмотреть файл

@ -110,7 +110,6 @@ _BROWSER_FILES = \
browser_bug555767.js \
browser_bug556061.js \
browser_bug559991.js \
browser_bug561636.js \
browser_bug561623.js \
browser_bug562649.js \
browser_bug563588.js \
@ -331,8 +330,13 @@ else
_BROWSER_FILES += \
browser_bug565667.js \
$(NULL)
# TODO: Activate after carbon test plugin lands, bug 628651
# browser_maconly_carbon_mismatch_plugin.js
endif
ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
# Bug 766546.
BROWSER_FILES += \
browser_bug561636.js \
$(NULL)
endif
ifdef MOZ_DATA_REPORTING

Просмотреть файл

@ -352,7 +352,7 @@ function()
function()
{
let uri = "data:text/html,<iframe name='t'></iframe><form target='t' action='data:text/html,'><input id='i' required><input id='s' type='submit'></form>";
let tab = gBrowser.addTab(uri);
let tab = gBrowser.addTab();
gObserver.notifyInvalidSubmit = function() {
executeSoon(function() {
@ -373,22 +373,16 @@ function()
Services.obs.addObserver(gObserver, "invalidformsubmit", false);
function doClick() {
isnot(gBrowser.selectedTab, tab,
tab.linkedBrowser.addEventListener("load", function(e) {
let browser = e.currentTarget;
browser.removeEventListener("load", arguments.callee, true);
isnot(gBrowser.selectedTab.linkedBrowser, browser,
"This tab should have been loaded in background");
browser.contentDocument.getElementById('s').click();
}, true);
tab.linkedBrowser.contentDocument.getElementById('s').click();
}
if (tab.linkedBrowser.contentDocument.readyState == 'complete') {
doClick();
} else {
tab.linkedBrowser.addEventListener("load", function(aEvent) {
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
doClick();
}, true);
}
tab.linkedBrowser.loadURI(uri);
},
/**

Просмотреть файл

@ -1,54 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
let tab, browser;
function tearDown()
{
while (gBrowser.tabs.length > 1) {
gBrowser.removeCurrentTab();
}
}
registerCleanupFunction(tearDown);
function addTab(aURL)
{
gBrowser.selectedTab = gBrowser.addTab();
content.location = aURL;
tab = gBrowser.selectedTab;
browser = gBrowser.getBrowserForTab(tab);
}
function onLoad() {
executeSoon(function (){
browser.removeEventListener("npapi-carbon-event-model-failure",
arguments.callee, false);
let notificationBox = gBrowser.getNotificationBox();
let notificationBar = notificationBox.getNotificationWithValue("carbon-failure-plugins");
ok(notificationBar, "Carbon Error plugin notification bar was found");
finish();
});
}
function test() {
try {
let abi = Services.appinfo.XPCOMABI;
if (!abi.match(/64/)) {
todo(false, "canceling test, wrong platform");
return;
}
let macutils = Cc["@mozilla.org/xpcom/mac-utils;1"].getService(Ci.nsIMacUtils);
if (!macutils.isUniversalBinary) {
todo(false, "canceling test, not a universal build")
return;
}
}
catch (e) {
return;
}
waitForExplicitFinish();
addTab('data:text/html,<h1>Plugin carbon mismatch test</h1><embed id="test" style="width: 100px; height: 100px" type="application/x-test-carbon">');
gBrowser.addEventListener("npapi-carbon-event-model-failure", onLoad, false);
}

Просмотреть файл

@ -16,9 +16,50 @@ function test() {
whenDelayedStartupFinished(privateWin, function() {
nonPrivateWin = privateWin.OpenBrowserWindow({private: false});
ok(!PrivateBrowsingUtils.isWindowPrivate(nonPrivateWin), "privateWin.OpenBrowserWindow({private: false}) should open a normal window");
nonPrivateWin.close();
[
{ normal: "menu_newNavigator", private: "menu_newPrivateWindow", accesskey: true },
{ normal: "appmenu_newNavigator", private: "appmenu_newPrivateWindow", accesskey: false },
].forEach(function(menu) {
let newWindow = privateWin.document.getElementById(menu.normal);
let newPrivateWindow = privateWin.document.getElementById(menu.private);
if (newWindow && newPrivateWindow) {
ok(!newPrivateWindow.hidden, "New Private Window menu item should be hidden");
isnot(newWindow.label, newPrivateWindow.label, "New Window's label shouldn't be overwritten");
if (menu.accesskey) {
isnot(newWindow.accessKey, newPrivateWindow.accessKey, "New Window's accessKey shouldn't be overwritten");
}
isnot(newWindow.command, newPrivateWindow.command, "New Window's command shouldn't be overwritten");
}
});
privateWin.close();
finish();
Services.prefs.setBoolPref("browser.privatebrowsing.autostart", true);
privateWin = OpenBrowserWindow({private: true});
whenDelayedStartupFinished(privateWin, function() {
[
{ normal: "menu_newNavigator", private: "menu_newPrivateWindow", accessKey: true },
{ normal: "appmenu_newNavigator", private: "appmenu_newPrivateWindow", accessKey: false },
].forEach(function(menu) {
let newWindow = privateWin.document.getElementById(menu.normal);
let newPrivateWindow = privateWin.document.getElementById(menu.private);
if (newWindow && newPrivateWindow) {
ok(newPrivateWindow.hidden, "New Private Window menu item should be hidden");
is(newWindow.label, newPrivateWindow.label, "New Window's label should be overwritten");
if (menu.accesskey) {
is(newWindow.accessKey, newPrivateWindow.accessKey, "New Window's accessKey should be overwritten");
}
is(newWindow.command, newPrivateWindow.command, "New Window's command should be overwritten");
}
});
privateWin.close();
Services.prefs.clearUserPref("browser.privatebrowsing.autostart");
finish();
});
});
}

Просмотреть файл

@ -79,10 +79,10 @@ browser.jar:
content/browser/sync/aboutSyncTabs.js (content/sync/aboutSyncTabs.js)
content/browser/sync/aboutSyncTabs.css (content/sync/aboutSyncTabs.css)
content/browser/sync/aboutSyncTabs-bindings.xml (content/sync/aboutSyncTabs-bindings.xml)
content/browser/sync/setup.xul (content/sync/setup.xul)
* content/browser/sync/setup.xul (content/sync/setup.xul)
content/browser/sync/addDevice.js (content/sync/addDevice.js)
content/browser/sync/addDevice.xul (content/sync/addDevice.xul)
content/browser/sync/setup.js (content/sync/setup.js)
* content/browser/sync/setup.js (content/sync/setup.js)
content/browser/sync/genericChange.xul (content/sync/genericChange.xul)
content/browser/sync/genericChange.js (content/sync/genericChange.js)
content/browser/sync/key.xhtml (content/sync/key.xhtml)

Просмотреть файл

@ -263,7 +263,7 @@ var gPrivacyPane = {
const Cc = Components.classes, Ci = Components.interfaces;
let brandName = document.getElementById("bundleBrand").getString("brandShortName");
let bundle = document.getElementById("bundlePreferences");
let msg = bundle.getFormattedString(pref.value ?
let msg = bundle.getFormattedString(autoStart.checked ?
"featureEnableRequiresRestart" : "featureDisableRequiresRestart",
[brandName]);
let title = bundle.getFormattedString("shouldRestartTitle", [brandName]);

Просмотреть файл

@ -266,7 +266,7 @@ var gPrivacyPane = {
const Cc = Components.classes, Ci = Components.interfaces;
let brandName = document.getElementById("bundleBrand").getString("brandShortName");
let bundle = document.getElementById("bundlePreferences");
let msg = bundle.getFormattedString(pref.value ?
let msg = bundle.getFormattedString(autoStart.checked ?
"featureEnableRequiresRestart" : "featureDisableRequiresRestart",
[brandName]);
let title = bundle.getFormattedString("shouldRestartTitle", [brandName]);

Просмотреть файл

@ -41,8 +41,7 @@ function test() {
ok(contextMenu, "Got context menu XUL");
doOnloadOnce(testContextMenu);
var tab = gBrowser.addTab("data:text/plain;charset=utf8,test%20search");
gBrowser.selectedTab = tab;
gBrowser.selectedTab = gBrowser.addTab("data:text/plain;charset=utf8,test%20search");
}
function testContextMenu() {
@ -84,11 +83,15 @@ function test() {
}
};
// add a listener to know when the selection takes effect
content.window.getSelection().QueryInterface(Ci.nsISelectionPrivate).
addSelectionListener(selectionListener);
// select the text on the page
goDoCommand('cmd_selectAll');
// Delay the select all to avoid intermittent selection failures.
setTimeout(function delaySelectAll() {
info("delaySelectAll: " + content.window.location.toString());
// add a listener to know when the selection takes effect
content.window.getSelection().QueryInterface(Ci.nsISelectionPrivate).
addSelectionListener(selectionListener);
// select the text on the page
goDoCommand('cmd_selectAll');
}, 500);
}
function finalize() {

Просмотреть файл

@ -41,11 +41,13 @@ function doOnloadOnce(aCallback) {
function doOnloadOnceListener(aEvent) {
info("doOnloadOnce: " + aEvent.originalTarget.location);
removeDoOnloadOnceListener();
aCallback(aEvent);
SimpleTest.executeSoon(function doOnloadOnceCallback() {
aCallback(aEvent);
});
}
function removeDoOnloadOnceListener() {
gBrowser.removeEventListener("DOMContentLoaded", doOnloadOnceListener);
gBrowser.removeEventListener("load", doOnloadOnceListener, true);
}
gBrowser.addEventListener("DOMContentLoaded", doOnloadOnceListener);
gBrowser.addEventListener("load", doOnloadOnceListener, true);
registerCleanupFunction(removeDoOnloadOnceListener);
}

Просмотреть файл

@ -9381,7 +9381,7 @@ var prefShowCmdSpec = {
}
],
exec: function Command_prefShow(args, context) {
return args.setting.value;
return l10n.lookupFormat('prefShowSettingValue', [ args.setting.name, args.setting.value ]);
}
};

Просмотреть файл

@ -223,7 +223,7 @@ let tests = {
},
exec: {
completed: true,
output: new RegExp("^" + tiltEnabledOrig + "$"),
output: new RegExp("^devtools\.tilt\.enabled: " + tiltEnabledOrig + "$"),
},
},
{
@ -252,7 +252,7 @@ let tests = {
},
exec: {
completed: true,
output: new RegExp("^true$"),
output: new RegExp("^devtools\.tilt\.enabled: true$"),
},
},
{
@ -277,7 +277,7 @@ let tests = {
},
exec: {
completed: true,
output: new RegExp("^false$"),
output: new RegExp("^devtools\.tilt\.enabled: false$"),
},
post: function() {
is(prefBranch.getBoolPref("devtools.tilt.enabled"), false,
@ -298,7 +298,7 @@ let tests = {
},
exec: {
completed: true,
output: new RegExp("^10$"),
output: new RegExp("^devtools\.editor\.tabsize: 10$"),
},
},
{
@ -323,7 +323,7 @@ let tests = {
},
exec: {
completed: true,
output: new RegExp("^20$"),
output: new RegExp("^devtools\.editor\.tabsize: 20$"),
},
post: function() {
is(prefBranch.getIntPref("devtools.editor.tabsize"), 20,
@ -352,7 +352,7 @@ let tests = {
},
exec: {
completed: true,
output: new RegExp("^1$"),
output: new RegExp("^devtools\.editor\.tabsize: 1$"),
},
post: function() {
is(prefBranch.getIntPref("devtools.editor.tabsize"), 1,
@ -373,7 +373,7 @@ let tests = {
},
exec: {
completed: true,
output: new RegExp("^" + remoteHostOrig + "$"),
output: new RegExp("^devtools\.debugger\.remote-host: " + remoteHostOrig + "$"),
},
},
{
@ -398,7 +398,7 @@ let tests = {
},
exec: {
completed: true,
output: new RegExp("^e.com$"),
output: new RegExp("^devtools\.debugger\.remote-host: e.com$"),
},
post: function() {
var ecom = prefBranch.getComplexValue("devtools.debugger.remote-host",
@ -428,7 +428,7 @@ let tests = {
},
exec: {
completed: true,
output: new RegExp("^moz.foo$"),
output: new RegExp("^devtools\.debugger\.remote-host: moz.foo$"),
},
post: function() {
var mozfoo = prefBranch.getComplexValue("devtools.debugger.remote-host",

Просмотреть файл

@ -12,10 +12,8 @@ browser.search.order.3=Bing
# This is the default set of web based feed handlers shown in the reader
# selection UI
browser.contentHandlers.types.0.title=Google
browser.contentHandlers.types.0.uri=http://fusion.google.com/add?feedurl=%s
browser.contentHandlers.types.1.title=My Yahoo!
browser.contentHandlers.types.1.uri=http://add.my.yahoo.com/rss?url=%s
browser.contentHandlers.types.0.title=My Yahoo!
browser.contentHandlers.types.0.uri=http://add.my.yahoo.com/rss?url=%s
# increment this number when anything gets changed in the list below. This will
# cause Firefox to re-read these prefs and inject any new handlers into the

Просмотреть файл

@ -114,9 +114,6 @@ crashedpluginsMessage.reloadButton.accesskey=R
crashedpluginsMessage.submitButton.label=Submit a crash report
crashedpluginsMessage.submitButton.accesskey=S
crashedpluginsMessage.learnMore=Learn More…
carbonFailurePluginsMessage.message=This page asks to use a plugin that can only run in 32-bit mode
carbonFailurePluginsMessage.restartButton.label=Restart in 32-bit mode
carbonFailurePluginsMessage.restartButton.accesskey=R
activatePluginsMessage.message=Would you like to activate the plugins on this page?
activateAllPluginsMessage.label=Activate All Plugins
activatePluginsMessage.accesskey=A

Просмотреть файл

@ -239,6 +239,11 @@ prefShowSettingDesc=Setting to display
# for help on what it does.
prefShowSettingManual=The name of the setting to display
# LOCALIZATION NOTE (prefShowSettingValue): This is used to show the preference
# name and the associated preference value. %1$S is replaced with the preference
# name and %2$S is replaced with the preference value.
prefShowSettingValue=%1$S: %2$S
# LOCALIZATION NOTE (prefSetDesc): A very short description of the 'pref set'
# command. This string is designed to be shown in a menu alongside the command
# name, which is why it should be as short as possible. See prefSetManual for

Просмотреть файл

@ -33,6 +33,9 @@
<!ENTITY setup.choosePassword.accesskey "P">
<!ENTITY setup.confirmPassword.label "Confirm Password">
<!ENTITY setup.confirmPassword.accesskey "m">
<!ENTITY setup.setupMetro.label "Sync with Windows 8 style &brandShortName;">
<!ENTITY setup.setupMetro.accesskey "S">
<!-- LOCALIZATION NOTE: tosAgree1, tosLink, tosAgree2, ppLink, tosAgree3 are
joined with implicit white space, so spaces in the strings aren't necessary -->
<!ENTITY setup.tosAgree1.label "I agree to the">

Просмотреть файл

@ -101,9 +101,6 @@ var BrowserUI = {
ContextUI.init();
StartUI.init();
PanelUI.init();
if (Browser.getHomePage() === "about:start") {
StartUI.show();
}
FlyoutPanelsUI.init();
PageThumbs.init();
SettingsCharm.init();

Просмотреть файл

@ -133,12 +133,30 @@ var Browser = {
if (window.arguments && window.arguments[0])
commandURL = window.arguments[0];
// Activation URIs come from protocol activations, secondary tiles, and file activations
let activationURI = this.getShortcutOrURI(MetroUtils.activationURI);
let self = this;
function loadStartupURI() {
let uri = activationURI || commandURL || Browser.getHomePage();
if (StartUI.isStartURI(uri)) {
self.addTab(uri, true);
StartUI.show(); // This makes about:start load a lot faster
} else if (activationURI) {
self.addTab(uri, true, null, { flags: Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP });
} else {
self.addTab(uri, true);
}
}
// Should we restore the previous session (crash or some other event)
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
if (ss.shouldRestore() || Services.prefs.getBoolPref("browser.startup.sessionRestore")) {
let bringFront = false;
// First open any commandline URLs, except the homepage
if (commandURL && commandURL != this.getHomePage()) {
if (activationURI && !StartUI.isStartURI(activationURI)) {
this.addTab(activationURI, true, null, { flags: Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP });
} else if (commandURL && !StartUI.isStartURI(commandURL)) {
this.addTab(commandURL, true);
} else {
bringFront = true;
@ -150,7 +168,7 @@ var Browser = {
observe: function(aSubject, aTopic, aData) {
Services.obs.removeObserver(dummyCleanup, "sessionstore-windows-restored");
if (aData == "fail")
Browser.addTab(commandURL || Browser.getHomePage(), true);
loadStartupURI();
dummy.chromeTab.ignoreUndo = true;
Browser.closeTab(dummy, { forceClose: true });
}
@ -159,7 +177,7 @@ var Browser = {
}
ss.restoreLastSession(bringFront);
} else {
this.addTab(commandURL || this.getHomePage(), true);
loadStartupURI();
}
messageManager.addMessageListener("DOMLinkAdded", this);
@ -333,6 +351,9 @@ var Browser = {
* @returns the expanded shortcut, or the original URL if not a shortcut
*/
getShortcutOrURI: function getShortcutOrURI(aURL, aPostDataRef) {
if (!aURL)
return aURL;
let shortcutURL = null;
let keyword = aURL;
let param = "";

Просмотреть файл

@ -438,22 +438,7 @@ let Content = {
}
this.formAssistant.focusSync = true;
// The form manager handles focus related changes on form elements.
// If it returns false, it didn't find anything to act on. If the
// target element doesn't match the current focus element, clear
// focus. This allows users to remove focus from form elements by
// taping on white space content.
if (!this.formAssistant.open(element, aEvent)) {
if (gFocusManager.focusedElement &&
gFocusManager.focusedElement != element) {
gFocusManager.focusedElement.blur();
}
// This may not have any effect if element is unfocusable.
gFocusManager.setFocus(element, Ci.nsIFocusManager.FLAG_NOSCROLL);
sendAsyncMessage("FindAssist:Hide", { });
}
this.formAssistant.open(element, aEvent);
this._cancelTapHighlight();
this.formAssistant.focusSync = false;
},

Просмотреть файл

@ -30,6 +30,39 @@ let WeaveGlue = {
}
},
#ifdef XP_WIN
_securelySetupFromMetro: function() {
let metroUtils = Cc["@mozilla.org/windows-metroutils;1"].
createInstance(Ci.nsIWinMetroUtils);
var email = {}, password = {}, key = {};
try {
metroUtils.loadSyncInfo(email, password, key);
} catch (ex) {
return false;
}
let server = Weave.Service.serverURL;
let defaultPrefs = Services.prefs.getDefaultBranch(null);
if (server == defaultPrefs.getCharPref("services.sync.serverURL"))
server = "";
this.setupData = {
account: email.value,
password: password.value,
synckey: key.value,
serverURL: server
};
try {
metroUtils.clearSyncInfo();
} catch (ex) {
}
this.connect();
return true;
},
#endif
_init: function () {
this._bundle = Services.strings.createBundle("chrome://browser/locale/sync.properties");
this._msg = document.getElementById("prefs-messages");
@ -49,9 +82,16 @@ let WeaveGlue = {
} else if (Weave.Status.login != Weave.LOGIN_FAILED_NO_USERNAME) {
this.loadSetupData();
}
this._boundOnEngineSync = this.onEngineSync.bind(this);
this._boundOnServiceSync = this.onServiceSync.bind(this);
this._progressBar = document.getElementById("syncsetup-progressbar");
#ifdef XP_WIN
if (Weave.Status.checkSetup() == Weave.CLIENT_NOT_CONFIGURED) {
this._securelySetupFromMetro();
}
#endif
},
abortEasySetup: function abortEasySetup() {

Просмотреть файл

@ -91,7 +91,7 @@ chrome.jar:
content/LoginManagerChild.js (content/LoginManagerChild.js)
content/video.js (content/video.js)
#ifdef MOZ_SERVICES_SYNC
content/sync.js (content/sync.js)
* content/sync.js (content/sync.js)
content/RemoteTabs.js (content/RemoteTabs.js)
#endif

Просмотреть файл

@ -125,3 +125,8 @@ description > .text-link:focus {
/* TODO replace this with a 128px version (bug 591122) */
list-style-image: url("chrome://browser/skin/sync-32.png");
}
#tosDesc {
margin-left: -7px;
margin-bottom: 3px;
}

Просмотреть файл

@ -26,19 +26,11 @@ MOZ_ARG_ENABLE_BOOL(android-libstdcxx,
MOZ_ANDROID_LIBSTDCXX=1,
MOZ_ANDROID_LIBSTDCXX= )
dnl default android_version is different per target cpu
case "$target_cpu" in
arm)
android_version=5
;;
i?86|mipsel)
android_version=9
;;
esac
android_version=9
MOZ_ARG_WITH_STRING(android-version,
[ --with-android-version=VER
android platform version, default 5 for arm, 9 for x86/mips],
android platform version, default 9],
android_version=$withval)
MOZ_ARG_WITH_STRING(android-platform,

Просмотреть файл

@ -213,6 +213,11 @@ if test "$CPU_ARCH" = "arm"; then
AC_DEFINE(HAVE_ARM_NEON)
HAVE_ARM_NEON=1
fi
AC_MSG_CHECKING(ARM version support in compiler)
dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
AC_MSG_RESULT("$ARM_ARCH")
fi # CPU_ARCH = arm
AC_SUBST(HAVE_ARM_SIMD)

Просмотреть файл

@ -830,7 +830,8 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
# Additional temporary logging while we try to debug some intermittent
# WebRTC conditions. This is necessary to troubleshoot bugs 841496,
# 841150, and 839677 (at least)
env['NSPR_LOG_MODULES'] = 'signaling:5,mtransport:3'
if 'NSPR_LOG_MODULES' not in env:
env['NSPR_LOG_MODULES'] = 'signaling:5,mtransport:3'
env['R_LOG_LEVEL'] = '5'
env['R_LOG_DESTINATION'] = 'stderr'
env['R_LOG_VERBOSE'] = '1'

Просмотреть файл

@ -36,6 +36,7 @@ _JAVA_TESTS = $(patsubst $(TESTPATH)/%.in,%,$(wildcard $(TESTPATH)/*.java.in))
_TEST_FILES = \
$(wildcard $(TESTPATH)/*.html) \
$(wildcard $(TESTPATH)/*.jpg) \
$(wildcard $(TESTPATH)/*.sjs) \
$(NULL)

Двоичные данные
build/unifytest.class

Двоичный файл не отображается.

Просмотреть файл

@ -240,5 +240,4 @@ interface nsIScriptSecurityManager : nsIXPCSecurityManager
%{C++
#define NS_SCRIPTSECURITYMANAGER_CONTRACTID "@mozilla.org/scriptsecuritymanager;1"
#define NS_SCRIPTSECURITYMANAGER_CLASSNAME "scriptsecuritymanager"
%}

Просмотреть файл

@ -19,7 +19,6 @@
class nsIURI;
#define NS_NULLPRINCIPAL_CLASSNAME "nullprincipal"
#define NS_NULLPRINCIPAL_CID \
{ 0xdd156d62, 0xd26f, 0x4441, \
{ 0x9c, 0xdb, 0xe8, 0xf0, 0x91, 0x07, 0xc2, 0x73 } }

Просмотреть файл

@ -166,13 +166,11 @@ private:
nsTArray< nsCOMPtr<nsIPrincipal> > mPrincipals;
};
#define NS_PRINCIPAL_CLASSNAME "principal"
#define NS_PRINCIPAL_CONTRACTID "@mozilla.org/principal;1"
#define NS_PRINCIPAL_CID \
{ 0x09b7e598, 0x490d, 0x423f, \
{ 0xa8, 0xa6, 0x2e, 0x6c, 0x4e, 0xc8, 0x77, 0x50 }}
#define NS_EXPANDEDPRINCIPAL_CLASSNAME "expandedprincipal"
#define NS_EXPANDEDPRINCIPAL_CONTRACTID "@mozilla.org/expandedprincipal;1"
#define NS_EXPANDEDPRINCIPAL_CID \
{ 0xb33a3807, 0xb76c, 0x44e5, \

Просмотреть файл

@ -11,7 +11,6 @@
#include "nsIPrincipal.h"
#include "nsJSPrincipals.h"
#define NS_SYSTEMPRINCIPAL_CLASSNAME "systemprincipal"
#define NS_SYSTEMPRINCIPAL_CID \
{ 0x4a6212db, 0xaccb, 0x11d3, \
{ 0xb7, 0x65, 0x0, 0x60, 0xb0, 0xb6, 0xce, 0xcb }}

Просмотреть файл

@ -23,7 +23,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=758258
var Ci = Components.interfaces;
if (navigator.platform.startsWith("Linux")) {
SimpleTest.expectAssertions(2);
SimpleTest.expectAssertions(2, 4);
}
SimpleTest.waitForExplicitFinish();

Просмотреть файл

@ -3677,8 +3677,6 @@ fi
dnl Using the custom linker on ARMv6 requires 16k alignment of ELF segments.
if test -n "$MOZ_LINKER"; then
if test "$CPU_ARCH" = arm; then
dnl Determine the target ARM architecture (5 for ARMv5, v5T, v5E, etc.; 6 for ARMv6, v6K, etc.)
ARM_ARCH=`${CC-cc} ${CFLAGS} -dM -E - < /dev/null | sed -n 's/.*__ARM_ARCH_\([[0-9]]*\).*/\1/p'`
dnl When building for < ARMv7, we need to ensure 16k alignment of ELF segments
if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
LDFLAGS="$LDFLAGS -Wl,-z,max-page-size=0x4000 -Wl,-z,common-page-size=0x4000"
@ -5657,10 +5655,7 @@ fi
if test -n "$MOZ_CUBEB"; then
case "$target" in
*-android*|*-linuxandroid*)
if test -n "$gonkdir"; then
AC_DEFINE(MOZ_CUBEB)
fi
dnl No Android implementation of libcubeb yet.
AC_DEFINE(MOZ_CUBEB)
;;
*-linux*)
AC_DEFINE(MOZ_CUBEB)
@ -9043,11 +9038,20 @@ if test "${OS_TARGET}" = "WINNT"; then
elif test "${OS_TARGET}" = "Android"; then
EXTRA_GYP_DEFINES="-D gtest_target_type=executable -D android_toolchain=${android_toolchain} -G os=android "
if test -n "$ARM_ARCH" && test "$ARM_ARCH" -lt 7; then
EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
else
EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=1 "
fi
fi
if test -n "$ARM_ARCH"; then
if test "$ARM_ARCH" -lt 7; then
EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
else
if test "${OS_TARGET}" = "Android"; then
EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=1 "
else
dnl CPU detection for ARM works on Android only. armv7 always uses CPU detection, so
dnl we have to set armv7=0 for non-Android target
EXTRA_GYP_DEFINES="${EXTRA_GYP_DEFINES} -D armv7=0 "
fi
fi
fi
# Don't try to compile sse4.1 code if toolchain doesn't support
@ -9268,7 +9272,7 @@ if test -n "$_WRAP_MALLOC"; then
fi
if test -z "$MOZ_NATIVE_NSPR"; then
ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla --with-android-version=$ANDROID_VERSION"
if test -z "$MOZ_DEBUG"; then
ac_configure_args="$ac_configure_args --disable-debug"
else

Просмотреть файл

@ -419,8 +419,6 @@ public:
return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
}
NS_IMETHOD GetAttributes(nsIDOMMozNamedAttrMap** aAttributes);
/**
* Helper for SetAttr/SetParsedAttr. This method will return true if aNotify
* is true or there are mutation listeners that must be triggered, the
@ -657,7 +655,7 @@ public:
already_AddRefed<nsIDOMAttr> SetAttributeNodeNS(nsIDOMAttr* aNewAttr,
ErrorResult& aError);
already_AddRefed<nsClientRectList> GetClientRects(ErrorResult& aError);
already_AddRefed<nsClientRectList> GetClientRects();
already_AddRefed<nsClientRect> GetBoundingClientRect();
void ScrollIntoView(bool aTop);
int32_t ScrollTop()
@ -1320,6 +1318,11 @@ NS_IMETHOD GetClassList(nsISupports** aClassList) MOZ_FINAL \
Element::GetClassList(aClassList); \
return NS_OK; \
} \
NS_IMETHOD GetAttributes(nsIDOMMozNamedAttrMap** aAttributes) MOZ_FINAL \
{ \
NS_ADDREF(*aAttributes = Attributes()); \
return NS_OK; \
} \
using Element::GetAttribute; \
NS_IMETHOD GetAttribute(const nsAString& name, nsAString& _retval) MOZ_FINAL \
{ \
@ -1507,9 +1510,8 @@ NS_IMETHOD SetOnmouseleave(JSContext* cx, \
} \
NS_IMETHOD GetClientRects(nsIDOMClientRectList** _retval) MOZ_FINAL \
{ \
mozilla::ErrorResult rv; \
*_retval = Element::GetClientRects(rv).get(); \
return rv.ErrorCode(); \
*_retval = Element::GetClientRects().get(); \
return NS_OK; \
} \
NS_IMETHOD GetBoundingClientRect(nsIDOMClientRect** _retval) MOZ_FINAL \
{ \

Просмотреть файл

@ -19,6 +19,7 @@ nsIAttribute.h \
nsIContentIterator.h \
nsContentPolicyUtils.h \
nsContentUtils.h \
nsDocElementCreatedNotificationRunner.h \
nsIDocument.h \
nsIDocumentInlines.h \
nsDeprecatedOperationList.h \

Просмотреть файл

@ -18,106 +18,120 @@
#include <ieeefp.h>
#endif
#include "nsAString.h"
#include "nsNodeInfoManager.h"
#include "nsIXPCScriptable.h"
#include "nsDataHashtable.h"
#include "nsIDOMEvent.h"
#include "nsTArray.h"
#include "nsReadableUtils.h"
#include "nsINode.h"
#include "nsIDOMNode.h"
#include "nsHtml5StringParser.h"
#include "nsIDocument.h"
#include "nsContentSink.h"
#include "nsMathUtils.h"
#include "nsThreadUtils.h"
#include "nsIContent.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsContentList.h"
#include "js/RootingAPI.h"
#include "mozilla/Assertions.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/Assertions.h"
#include "nsAString.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsContentListDeclarations.h"
#include "nsMathUtils.h"
#include "nsReadableUtils.h"
#include "nsWrapperCache.h"
struct nsNativeKeyEvent; // Don't include nsINativeKeyBindings.h here: it will force strange compilation error!
class nsIDOMScriptObjectFactory;
class nsIXPConnect;
class nsIContent;
class nsIDOMKeyEvent;
class nsIDocument;
class nsIDocumentObserver;
class nsIDocShell;
class nsINameSpaceManager;
class nsIFragmentContentSink;
class nsIScriptGlobalObject;
class nsIScriptSecurityManager;
class nsTextFragment;
class nsIJSContextStack;
class nsIThreadJSContextStack;
class nsIParser;
class nsIParserService;
class nsIIOService;
class nsIURI;
class imgICache;
class imgIContainer;
class imgINotificationObserver;
class imgRequestProxy;
class imgIRequest;
class imgLoader;
class imgICache;
class nsIImageLoadingContent;
class nsIDOMHTMLFormElement;
class nsIDOMDocument;
class nsIConsoleService;
class nsIStringBundleService;
class nsIStringBundle;
class nsIContentPolicy;
class nsILineBreaker;
class nsIWordBreaker;
class nsIJSRuntimeService;
class nsEventListenerManager;
class nsIScriptContext;
class nsIRunnable;
class nsIInterfaceRequestor;
class nsINodeInfo;
template<class E> class nsCOMArray;
template<class K, class V> class nsRefPtrHashtable;
struct JSRuntime;
class nsIWidget;
class nsIDragSession;
class nsIPresShell;
class nsIXPConnectJSObjectHolder;
#ifdef IBMBIDI
class nsIBidiKeyboard;
#endif
class nsIMIMEHeaderParam;
class nsIObserver;
class nsPresContext;
class nsIChannel;
class imgRequestProxy;
class nsAutoScriptBlockerSuppressNodeRemoved;
struct nsIntMargin;
class nsPIDOMWindow;
class nsDragEvent;
class nsEvent;
class nsEventListenerManager;
class nsHtml5StringParser;
class nsIChannel;
class nsIConsoleService;
class nsIContent;
class nsIContentPolicy;
class nsIDocShell;
class nsIDocument;
class nsIDocumentLoaderFactory;
class nsIDocumentObserver;
class nsIDOMDocument;
class nsIDOMDocumentFragment;
class nsIDOMEvent;
class nsIDOMEventTarget;
class nsIDOMHTMLFormElement;
class nsIDOMHTMLInputElement;
class nsIDOMKeyEvent;
class nsIDOMNode;
class nsIDOMScriptObjectFactory;
class nsIDOMWindow;
class nsIDragSession;
class nsIEditor;
class nsIFragmentContentSink;
class nsIImageLoadingContent;
class nsIInterfaceRequestor;
class nsIIOService;
class nsIJSContextStack;
class nsIJSRuntimeService;
class nsILineBreaker;
class nsIMIMEHeaderParam;
class nsINameSpaceManager;
class nsINodeInfo;
class nsIObserver;
class nsIParser;
class nsIParserService;
class nsIPresShell;
class nsIPrincipal;
class nsIRunnable;
class nsIScriptContext;
class nsIScriptGlobalObject;
class nsIScriptSecurityManager;
class nsIStringBundle;
class nsIStringBundleService;
class nsISupportsHashKey;
class nsIThreadJSContextStack;
class nsIURI;
class nsIWidget;
class nsIWordBreaker;
class nsIXPConnect;
class nsIXPConnectJSObjectHolder;
class nsKeyEvent;
class nsNodeInfoManager;
class nsPIDOMWindow;
class nsPresContext;
class nsScriptObjectTracer;
class nsStringHashKey;
class nsTextFragment;
class nsViewportInfo;
struct JSContext;
struct JSPropertyDescriptor;
struct JSRuntime;
struct nsIntMargin;
struct nsNativeKeyEvent; // Don't include nsINativeKeyBindings.h here: it will force strange compilation error!
template<class E> class nsCOMArray;
template<class E> class nsTArray;
template<class K, class V> class nsDataHashtable;
template<class K, class V> class nsRefPtrHashtable;
namespace JS {
class Value;
} // namespace JS
namespace mozilla {
class ErrorResult;
class Selection;
namespace layers {
class LayerManager;
} // namespace layers
namespace dom {
class DocumentFragment;
class Element;
} // namespace dom
namespace layers {
class LayerManager;
} // namespace layers
} // namespace mozilla
#ifdef IBMBIDI
class nsIBidiKeyboard;
#endif
extern const char kLoadAsData[];
enum EventNameType {
@ -242,13 +256,7 @@ public:
* Returns true if aNode1 is before aNode2 in the same connected
* tree.
*/
static bool PositionIsBefore(nsINode* aNode1, nsINode* aNode2)
{
return (aNode2->CompareDocumentPosition(*aNode1) &
(nsIDOMNode::DOCUMENT_POSITION_PRECEDING |
nsIDOMNode::DOCUMENT_POSITION_DISCONNECTED)) ==
nsIDOMNode::DOCUMENT_POSITION_PRECEDING;
}
static bool PositionIsBefore(nsINode* aNode1, nsINode* aNode2);
/**
* Utility routine to compare two "points", where a point is a
@ -678,17 +686,8 @@ public:
* Convenience method to create a new nodeinfo that differs only by name
* from aNodeInfo.
*/
static nsresult NameChanged(nsINodeInfo *aNodeInfo, nsIAtom *aName,
nsINodeInfo** aResult)
{
nsNodeInfoManager *niMgr = aNodeInfo->NodeInfoManager();
*aResult = niMgr->GetNodeInfo(aName, aNodeInfo->GetPrefixAtom(),
aNodeInfo->NamespaceID(),
aNodeInfo->NodeType(),
aNodeInfo->GetExtraName()).get();
return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
static nsresult NameChanged(nsINodeInfo* aNodeInfo, nsIAtom* aName,
nsINodeInfo** aResult);
/**
* Returns the appropriate event argument names for the specified
@ -1665,8 +1664,9 @@ public:
static bool CanAccessNativeAnon();
static nsresult WrapNative(JSContext *cx, JSObject *scope,
nsISupports *native, const nsIID* aIID, jsval *vp,
// If non-null aHolder will keep the jsval alive
nsISupports *native, const nsIID* aIID,
JS::Value *vp,
// If non-null aHolder will keep the Value alive
// while there's a ref to it
nsIXPConnectJSObjectHolder** aHolder = nullptr,
bool aAllowWrapping = false)
@ -1677,8 +1677,8 @@ public:
// Same as the WrapNative above, but use this one if aIID is nsISupports' IID.
static nsresult WrapNative(JSContext *cx, JSObject *scope,
nsISupports *native, jsval *vp,
// If non-null aHolder will keep the jsval alive
nsISupports *native, JS::Value *vp,
// If non-null aHolder will keep the Value alive
// while there's a ref to it
nsIXPConnectJSObjectHolder** aHolder = nullptr,
bool aAllowWrapping = false)
@ -1688,8 +1688,8 @@ public:
}
static nsresult WrapNative(JSContext *cx, JSObject *scope,
nsISupports *native, nsWrapperCache *cache,
jsval *vp,
// If non-null aHolder will keep the jsval alive
JS::Value *vp,
// If non-null aHolder will keep the Value alive
// while there's a ref to it
nsIXPConnectJSObjectHolder** aHolder = nullptr,
bool aAllowWrapping = false)
@ -1706,7 +1706,7 @@ public:
static nsresult CreateBlobBuffer(JSContext* aCx,
const nsACString& aData,
jsval& aBlob);
JS::Value& aBlob);
static void StripNullChars(const nsAString& aInStr, nsAString& aOutStr);
@ -2114,7 +2114,7 @@ private:
static nsresult WrapNative(JSContext *cx, JSObject *scope,
nsISupports *native, nsWrapperCache *cache,
const nsIID* aIID, jsval *vp,
const nsIID* aIID, JS::Value *vp,
nsIXPConnectJSObjectHolder** aHolder,
bool aAllowWrapping);
@ -2434,21 +2434,4 @@ private:
nsIMIMEHeaderParam* mService;
};
class nsDocElementCreatedNotificationRunner : public nsRunnable
{
public:
nsDocElementCreatedNotificationRunner(nsIDocument* aDoc)
: mDoc(aDoc)
{
}
NS_IMETHOD Run()
{
nsContentSink::NotifyDocElementCreated(mDoc);
return NS_OK;
}
nsCOMPtr<nsIDocument> mDoc;
};
#endif /* nsContentUtils_h___ */

Просмотреть файл

@ -0,0 +1,32 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsDocElementCreatedNotificationRunner_h
#define nsDocElementCreatedNotificationRunner_h
#include "nsThreadUtils.h" /* nsRunnable */
#include "nsContentSink.h"
#include "nsCOMPtr.h"
#include "nsIDocument.h"
class nsDocElementCreatedNotificationRunner : public nsRunnable
{
public:
nsDocElementCreatedNotificationRunner(nsIDocument* aDoc)
: mDoc(aDoc)
{
}
NS_IMETHOD Run()
{
nsContentSink::NotifyDocElementCreated(mDoc);
return NS_OK;
}
nsCOMPtr<nsIDocument> mDoc;
};
#endif /* nsDocElementCreatedNotificationRunner_h */

Просмотреть файл

@ -250,6 +250,10 @@ interface nsIFrameLoader : nsISupports
readonly attribute nsIDOMElement ownerElement;
};
%{C++
class nsFrameLoader;
%}
native alreadyAddRefed_nsFrameLoader(already_AddRefed<nsFrameLoader>);
[scriptable, uuid(5879040e-83e9-40e3-b2bb-5ddf43b76e47)]

Просмотреть файл

@ -34,7 +34,6 @@ class nsDOMAttributeMap;
class nsIContent;
class nsIDocument;
class nsIDOMElement;
class nsIDOMMozNamedAttrMap;
class nsIDOMNodeList;
class nsIDOMUserDataHandler;
class nsIEditor;
@ -1559,7 +1558,6 @@ public:
nsINode* RemoveChild(nsINode& aChild, mozilla::ErrorResult& aError);
already_AddRefed<nsINode> CloneNode(bool aDeep, mozilla::ErrorResult& aError);
bool IsEqualNode(nsINode* aNode);
bool IsSupported(const nsAString& aFeature, const nsAString& aVersion);
void GetNamespaceURI(nsAString& aNamespaceURI) const
{
mNodeInfo->GetNamespaceURI(aNamespaceURI);
@ -1654,7 +1652,6 @@ protected:
nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
nsresult CompareDocumentPosition(nsIDOMNode* aOther,
uint16_t* aReturn);
nsresult GetAttributes(nsIDOMMozNamedAttrMap** aAttributes);
nsresult ReplaceOrInsertBefore(bool aReplace, nsIDOMNode *aNewChild,
nsIDOMNode *aRefChild, nsIDOMNode **aReturn);
@ -1956,10 +1953,6 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsINode, NS_INODE_IID)
{ \
return nsINode::GetNextSibling(aNextSibling); \
} \
NS_IMETHOD GetAttributes(nsIDOMMozNamedAttrMap** aAttributes) __VA_ARGS__ \
{ \
return nsINode::GetAttributes(aAttributes); \
} \
NS_IMETHOD GetOwnerDocument(nsIDOMDocument** aOwnerDocument) __VA_ARGS__ \
{ \
return nsINode::GetOwnerDocument(aOwnerDocument); \
@ -2003,11 +1996,6 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsINode, NS_INODE_IID)
nsINode::Normalize(); \
return NS_OK; \
} \
NS_IMETHOD IsSupported(const nsAString& aFeature, const nsAString& aVersion, bool* aResult) __VA_ARGS__ \
{ \
*aResult = nsINode::IsSupported(aFeature, aVersion); \
return NS_OK; \
} \
NS_IMETHOD GetNamespaceURI(nsAString& aNamespaceURI) __VA_ARGS__ \
{ \
nsINode::GetNamespaceURI(aNamespaceURI); \

Просмотреть файл

@ -654,7 +654,7 @@ Element::GetClientAreaRect()
already_AddRefed<nsClientRect>
Element::GetBoundingClientRect()
{
nsRefPtr<nsClientRect> rect = new nsClientRect();
nsRefPtr<nsClientRect> rect = new nsClientRect(this);
nsIFrame* frame = GetPrimaryFrame(Flush_Layout);
if (!frame) {
@ -670,7 +670,7 @@ Element::GetBoundingClientRect()
}
already_AddRefed<nsClientRectList>
Element::GetClientRects(ErrorResult& aError)
Element::GetClientRects()
{
nsRefPtr<nsClientRectList> rectList = new nsClientRectList(this);
@ -684,10 +684,6 @@ Element::GetClientRects(ErrorResult& aError)
nsLayoutUtils::GetAllInFlowRects(frame,
nsLayoutUtils::GetContainingBlockForClientRect(frame), &builder,
nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS);
if (NS_FAILED(builder.mRV)) {
aError.Throw(builder.mRV);
return nullptr;
}
return rectList.forget();
}
@ -1472,13 +1468,6 @@ Element::GetExistingAttrNameFromQName(const nsAString& aStr) const
return nodeInfo;
}
NS_IMETHODIMP
Element::GetAttributes(nsIDOMMozNamedAttrMap** aAttributes)
{
NS_ADDREF(*aAttributes = Attributes());
return NS_OK;
}
// static
bool
Element::ShouldBlur(nsIContent *aContent)

Просмотреть файл

@ -19,6 +19,7 @@ EXPORTS = \
nsAtomListUtils.h \
nsAttrName.h \
nsContentList.h \
nsContentListDeclarations.h \
nsContentSink.h \
nsGkAtomList.h \
nsGkAtoms.h \

Просмотреть файл

@ -10,6 +10,7 @@
#include "mozilla/dom/TreeWalker.h"
#include "nsIContent.h"
#include "nsIDOMNode.h"
#include "nsError.h"
#include "nsINode.h"

Просмотреть файл

@ -12,6 +12,7 @@
#ifndef nsContentList_h___
#define nsContentList_h___
#include "nsContentListDeclarations.h"
#include "nsISupports.h"
#include "nsTArray.h"
#include "nsStringGlue.h"
@ -26,21 +27,6 @@
#include "nsHashKeys.h"
#include "mozilla/HashFunctions.h"
// Magic namespace id that means "match all namespaces". This is
// negative so it won't collide with actual namespace constants.
#define kNameSpaceID_Wildcard INT32_MIN
// This is a callback function type that can be used to implement an
// arbitrary matching algorithm. aContent is the content that may
// match the list, while aNamespaceID, aAtom, and aData are whatever
// was passed to the list's constructor.
typedef bool (*nsContentListMatchFunc)(nsIContent* aContent,
int32_t aNamespaceID,
nsIAtom* aAtom,
void* aData);
typedef void (*nsContentListDestroyFunc)(void* aData);
namespace mozilla {
namespace dom {
class Element;
@ -472,14 +458,6 @@ private:
const nsAString& mString;
};
/**
* A function that allocates the matching data for this
* FuncStringContentList. Returning aString is perfectly fine; in
* that case the destructor function should be a no-op.
*/
typedef void* (*nsFuncStringContentListDataAllocator)(nsINode* aRootNode,
const nsString* aString);
// aDestroyFunc is allowed to be null
// aDataAllocator must always return a non-null pointer
class nsCacheableFuncStringContentList : public nsContentList {
@ -568,26 +546,4 @@ public:
#endif
};
// If aMatchNameSpaceId is kNameSpaceID_Unknown, this will return a
// content list which matches ASCIIToLower(aTagname) against HTML
// elements in HTML documents and aTagname against everything else.
// For any other value of aMatchNameSpaceId, the list will match
// aTagname against all elements.
already_AddRefed<nsContentList>
NS_GetContentList(nsINode* aRootNode,
int32_t aMatchNameSpaceId,
const nsAString& aTagname);
already_AddRefed<nsContentList>
NS_GetFuncStringNodeList(nsINode* aRootNode,
nsContentListMatchFunc aFunc,
nsContentListDestroyFunc aDestroyFunc,
nsFuncStringContentListDataAllocator aDataAllocator,
const nsAString& aString);
already_AddRefed<nsContentList>
NS_GetFuncStringHTMLCollection(nsINode* aRootNode,
nsContentListMatchFunc aFunc,
nsContentListDestroyFunc aDestroyFunc,
nsFuncStringContentListDataAllocator aDataAllocator,
const nsAString& aString);
#endif // nsContentList_h___

Просмотреть файл

@ -0,0 +1,64 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsContentListDeclarations_h
#define nsContentListDeclarations_h
#include "mozilla/StandardInteger.h"
#include "nsCOMPtr.h"
#include "nsStringGlue.h"
class nsContentList;
class nsIAtom;
class nsIContent;
class nsINode;
// Magic namespace id that means "match all namespaces". This is
// negative so it won't collide with actual namespace constants.
#define kNameSpaceID_Wildcard INT32_MIN
// This is a callback function type that can be used to implement an
// arbitrary matching algorithm. aContent is the content that may
// match the list, while aNamespaceID, aAtom, and aData are whatever
// was passed to the list's constructor.
typedef bool (*nsContentListMatchFunc)(nsIContent* aContent,
int32_t aNamespaceID,
nsIAtom* aAtom,
void* aData);
typedef void (*nsContentListDestroyFunc)(void* aData);
/**
* A function that allocates the matching data for this
* FuncStringContentList. Returning aString is perfectly fine; in
* that case the destructor function should be a no-op.
*/
typedef void* (*nsFuncStringContentListDataAllocator)(nsINode* aRootNode,
const nsString* aString);
// If aMatchNameSpaceId is kNameSpaceID_Unknown, this will return a
// content list which matches ASCIIToLower(aTagname) against HTML
// elements in HTML documents and aTagname against everything else.
// For any other value of aMatchNameSpaceId, the list will match
// aTagname against all elements.
already_AddRefed<nsContentList>
NS_GetContentList(nsINode* aRootNode,
int32_t aMatchNameSpaceId,
const nsAString& aTagname);
already_AddRefed<nsContentList>
NS_GetFuncStringNodeList(nsINode* aRootNode,
nsContentListMatchFunc aFunc,
nsContentListDestroyFunc aDestroyFunc,
nsFuncStringContentListDataAllocator aDataAllocator,
const nsAString& aString);
already_AddRefed<nsContentList>
NS_GetFuncStringHTMLCollection(nsINode* aRootNode,
nsContentListMatchFunc aFunc,
nsContentListDestroyFunc aDestroyFunc,
nsFuncStringContentListDataAllocator aDataAllocator,
const nsAString& aString);
#endif // nsContentListDeclarations_h

Просмотреть файл

@ -6,172 +6,170 @@
/* A namespace class for static layout utilities. */
#include "mozilla/DebugOnly.h"
#include "mozilla/Util.h"
#include "mozilla/Likely.h"
#include "nsContentUtils.h"
#include <algorithm>
#include <math.h>
#include "DecoderTraits.h"
#include "harfbuzz/hb.h"
#include "imgICache.h"
#include "imgIContainer.h"
#include "imgINotificationObserver.h"
#include "imgLoader.h"
#include "imgRequestProxy.h"
#include "jsapi.h"
#include "jsdbgapi.h"
#include "jsfriendapi.h"
#include <math.h>
#include "mozilla/dom/TextDecoderBase.h"
#include "js/Value.h"
#include "Layers.h"
#include "nsJSUtils.h"
#include "nsCOMPtr.h"
#include "nsAString.h"
#include "nsPrintfCString.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptContext.h"
#include "nsDOMCID.h"
#include "nsContentUtils.h"
#include "nsIXPConnect.h"
#include "nsIContent.h"
#include "MediaDecoder.h"
#include "mozAutoDocUpdate.h"
#include "mozilla/Attributes.h"
#include "mozilla/Base64.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/dom/DocumentFragment.h"
#include "mozilla/dom/Element.h"
#include "nsIDocument.h"
#include "nsINodeInfo.h"
#include "nsIIdleService.h"
#include "nsIDOMDocument.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMNode.h"
#include "nsIIOService.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsIScriptSecurityManager.h"
#include "nsPIDOMWindow.h"
#include "nsIJSContextStack.h"
#include "nsIDocShell.h"
#include "nsParserCIID.h"
#include "nsIParser.h"
#include "nsIFragmentContentSink.h"
#include "nsIContentSink.h"
#include "mozilla/dom/TextDecoderBase.h"
#include "mozilla/Likely.h"
#include "mozilla/Preferences.h"
#include "mozilla/Selection.h"
#include "mozilla/Util.h"
#include "nsAString.h"
#include "nsAttrName.h"
#include "nsAttrValue.h"
#include "nsAttrValueInlines.h"
#include "nsBindingManager.h"
#include "nsCCUncollectableMarker.h"
#include "nsChannelPolicy.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsCOMPtr.h"
#include "nsContentCreatorFunctions.h"
#include "nsContentDLF.h"
#include "nsContentList.h"
#include "nsIHTMLDocument.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMHTMLElement.h"
#include "nsIForm.h"
#include "nsIFormControl.h"
#include "nsGkAtoms.h"
#include "imgINotificationObserver.h"
#include "imgRequestProxy.h"
#include "imgIContainer.h"
#include "imgLoader.h"
#include "nsContentPolicyUtils.h"
#include "nsCPrefetchService.h"
#include "nsCRT.h"
#include "nsCycleCollectionParticipant.h"
#include "nsDataHashtable.h"
#include "nsDocShellCID.h"
#include "nsDOMCID.h"
#include "nsDOMDataTransfer.h"
#include "nsDOMJSUtils.h"
#include "nsDOMMutationObserver.h"
#include "nsDOMTouchEvent.h"
#include "nsError.h"
#include "nsEventDispatcher.h"
#include "nsEventListenerManager.h"
#include "nsEventStateManager.h"
#include "nsFocusManager.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsHtml5Module.h"
#include "nsHtml5StringParser.h"
#include "nsIAsyncVerifyRedirectCallback.h"
#include "nsICategoryManager.h"
#include "nsIChannelEventSink.h"
#include "nsIChannelPolicy.h"
#include "nsICharsetConverterManager.h"
#include "nsICharsetDetectionObserver.h"
#include "nsICharsetDetector.h"
#include "nsIChromeRegistry.h"
#include "nsIConsoleService.h"
#include "nsIContent.h"
#include "nsIContentSecurityPolicy.h"
#include "nsIContentSink.h"
#include "nsIContentViewer.h"
#include "nsIDocShell.h"
#include "nsIDocument.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentType.h"
#include "nsIDOMEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMScriptObjectFactory.h"
#include "nsIDOMUserDataHandler.h"
#include "nsIDOMXULCommandEvent.h"
#include "nsIDragService.h"
#include "nsIEditor.h"
#include "nsIFormControl.h"
#include "nsIForm.h"
#include "nsIFragmentContentSink.h"
#include "nsIHTMLDocument.h"
#include "nsIIdleService.h"
#include "nsIImageLoadingContent.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIIOService.h"
#include "nsIJSContextStack.h"
#include "nsIJSRuntimeService.h"
#include "nsILineBreaker.h"
#include "nsILoadContext.h"
#include "nsILoadGroup.h"
#include "nsIMEStateManager.h"
#include "nsIMIMEService.h"
#include "nsINativeKeyBindings.h"
#include "nsINode.h"
#include "nsINodeInfo.h"
#include "nsIObjectLoadingContent.h"
#include "nsIObserver.h"
#include "nsIObserverService.h"
#include "nsContentPolicyUtils.h"
#include "nsNodeInfoManager.h"
#include "nsCRT.h"
#include "nsIDOMEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsIMIMEService.h"
#include "nsLWBrkCIID.h"
#include "nsILineBreaker.h"
#include "nsIWordBreaker.h"
#include "nsUnicodeProperties.h"
#include "harfbuzz/hb.h"
#include "nsIJSRuntimeService.h"
#include "nsBindingManager.h"
#include "nsIOfflineCacheUpdate.h"
#include "nsIParser.h"
#include "nsIParserService.h"
#include "nsIPermissionManager.h"
#include "nsIPlatformCharset.h"
#include "nsIPluginHost.h"
#include "nsIRunnable.h"
#include "nsIScriptContext.h"
#include "nsIScriptError.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsIScriptSecurityManager.h"
#include "nsIStringBundle.h"
#include "nsIURI.h"
#include "nsIURL.h"
#include "nsICharsetConverterManager.h"
#include "nsEventListenerManager.h"
#include "nsAttrName.h"
#include "nsIDOMUserDataHandler.h"
#include "nsContentCreatorFunctions.h"
#include "nsMutationEvent.h"
#include "nsIMEStateManager.h"
#include "nsError.h"
#include "nsUnicharUtilCIID.h"
#include "nsINativeKeyBindings.h"
#include "nsXULPopupManager.h"
#include "nsIPermissionManager.h"
#include "nsIScriptObjectPrincipal.h"
#include "nsNullPrincipal.h"
#include "nsIRunnable.h"
#include "nsDOMJSUtils.h"
#include "nsGenericHTMLElement.h"
#include "nsAttrValue.h"
#include "nsAttrValueInlines.h"
#include "nsReferencedElement.h"
#include "nsIDragService.h"
#include "nsIChannelEventSink.h"
#include "nsIAsyncVerifyRedirectCallback.h"
#include "nsIOfflineCacheUpdate.h"
#include "nsCPrefetchService.h"
#include "nsIChromeRegistry.h"
#include "nsEventDispatcher.h"
#include "nsIDOMXULCommandEvent.h"
#include "nsDOMDataTransfer.h"
#include "nsHtml5Module.h"
#include "nsPresContext.h"
#include "nsLayoutStatics.h"
#include "nsFocusManager.h"
#include "nsTextEditorState.h"
#include "nsIPluginHost.h"
#include "nsICategoryManager.h"
#include "nsViewManager.h"
#include "nsEventStateManager.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsParserConstants.h"
#include "nsIWebNavigation.h"
#include "nsILoadContext.h"
#include "nsIWordBreaker.h"
#include "nsIXPConnect.h"
#include "nsJSUtils.h"
#include "nsLayoutStatics.h"
#include "nsLWBrkCIID.h"
#include "nsMutationEvent.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsNodeInfoManager.h"
#include "nsNullPrincipal.h"
#include "nsParserCIID.h"
#include "nsParserConstants.h"
#include "nsPIDOMWindow.h"
#include "nsPresContext.h"
#include "nsPrintfCString.h"
#include "nsReferencedElement.h"
#include "nsSandboxFlags.h"
#include "nsScriptSecurityManager.h"
#include "nsSVGFeatures.h"
#include "nsTextEditorState.h"
#include "nsTextFragment.h"
#include "mozilla/Selection.h"
#include <algorithm>
#include "nsThreadUtils.h"
#include "nsUnicharUtilCIID.h"
#include "nsUnicodeProperties.h"
#include "nsViewManager.h"
#include "nsViewportInfo.h"
#include "nsWrapperCacheInlines.h"
#include "nsXULPopupManager.h"
#include "xpcprivate.h" // nsXPConnect
#ifdef IBMBIDI
#include "nsIBidiKeyboard.h"
#endif
#include "nsCycleCollectionParticipant.h"
// for ReportToConsole
#include "nsIStringBundle.h"
#include "nsIScriptError.h"
#include "nsIConsoleService.h"
#include "mozAutoDocUpdate.h"
#include "imgICache.h"
#include "imgLoader.h"
#include "xpcprivate.h" // nsXPConnect
#include "nsScriptSecurityManager.h"
#include "nsIChannelPolicy.h"
#include "nsChannelPolicy.h"
#include "nsIContentSecurityPolicy.h"
#include "nsContentDLF.h"
#ifdef MOZ_MEDIA
#include "nsHTMLMediaElement.h"
#endif
#include "nsDOMTouchEvent.h"
#include "nsIContentViewer.h"
#include "nsIObjectLoadingContent.h"
#include "nsCCUncollectableMarker.h"
#include "mozilla/Base64.h"
#include "mozilla/Preferences.h"
#include "nsDOMMutationObserver.h"
#include "nsIDOMDocumentType.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsICharsetDetector.h"
#include "nsICharsetDetectionObserver.h"
#include "nsIPlatformCharset.h"
#include "nsIEditor.h"
#include "mozilla/Attributes.h"
#include "nsIParserService.h"
#include "nsIDOMScriptObjectFactory.h"
#include "nsSandboxFlags.h"
#include "nsSVGFeatures.h"
#include "MediaDecoder.h"
#include "DecoderTraits.h"
#include "mozilla/dom/DocumentFragment.h"
#include "nsWrapperCacheInlines.h"
#include "nsViewportInfo.h"
extern "C" int MOZ_XMLTranslateEntity(const char* ptr, const char* end,
const char** next, PRUnichar* result);
@ -1976,6 +1974,16 @@ nsContentUtils::GetCommonAncestor(nsINode* aNode1,
return parent;
}
/* static */
bool
nsContentUtils::PositionIsBefore(nsINode* aNode1, nsINode* aNode2)
{
return (aNode2->CompareDocumentPosition(*aNode1) &
(nsIDOMNode::DOCUMENT_POSITION_PRECEDING |
nsIDOMNode::DOCUMENT_POSITION_DISCONNECTED)) ==
nsIDOMNode::DOCUMENT_POSITION_PRECEDING;
}
/* static */
int32_t
nsContentUtils::ComparePoints(nsINode* aParent1, int32_t aOffset1,
@ -2881,6 +2889,21 @@ nsContentUtils::IsDraggableLink(const nsIContent* aContent) {
return aContent->IsLink(getter_AddRefs(absURI));
}
// static
nsresult
nsContentUtils::NameChanged(nsINodeInfo* aNodeInfo, nsIAtom* aName,
nsINodeInfo** aResult)
{
nsNodeInfoManager *niMgr = aNodeInfo->NodeInfoManager();
*aResult = niMgr->GetNodeInfo(aName, aNodeInfo->GetPrefixAtom(),
aNodeInfo->NamespaceID(),
aNodeInfo->NodeType(),
aNodeInfo->GetExtraName()).get();
return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
static bool
TestSitePerm(nsIPrincipal* aPrincipal, const char* aType, uint32_t aPerm, bool aExactHostMatch)
{
@ -5293,7 +5316,7 @@ bool
nsContentUtils::CheckForSubFrameDrop(nsIDragSession* aDragSession, nsDragEvent* aDropEvent)
{
nsCOMPtr<nsIContent> target = do_QueryInterface(aDropEvent->originalTarget);
if (!target && !target->OwnerDoc()) {
if (!target) {
return true;
}

Просмотреть файл

@ -732,8 +732,11 @@ nsCopySupport::FireClipboardEvent(int32_t aType, nsIPresShell* aPresShell, nsISe
if (aType == NS_PASTE) {
// Clear and mark the clipboardData as readonly. This prevents someone
// from reading the clipboard contents after the paste event has fired.
clipboardData->ClearAll();
clipboardData->SetReadOnly();
if (clipboardData) {
clipboardData->ClearAll();
clipboardData->SetReadOnly();
}
return doDefault;
}
@ -758,7 +761,7 @@ nsCopySupport::FireClipboardEvent(int32_t aType, nsIPresShell* aPresShell, nsISe
if (NS_FAILED(rv)) {
return false;
}
} else {
} else if (clipboardData) {
// check to see if any data was put on the data transfer.
clipboardData->GetMozItemCount(&count);
if (count) {

Просмотреть файл

@ -12,6 +12,7 @@
#include "nsError.h"
#include "nsICharsetConverterManager.h"
#include "nsIConverterInputStream.h"
#include "nsIDocument.h"
#include "nsIFile.h"
#include "nsIFileStreams.h"
#include "nsIInputStream.h"

Просмотреть файл

@ -4,7 +4,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsDOMSerializer.h"
#include "nsIDocument.h"
#include "nsIDocumentEncoder.h"
#include "nsComponentManagerUtils.h"
#include "nsContentCID.h"
#include "nsContentUtils.h"
#include "nsError.h"

Просмотреть файл

@ -448,30 +448,27 @@ nsFrameLoader::ReallyStartLoadingInternal()
mDocShell->CreateLoadInfo(getter_AddRefs(loadInfo));
NS_ENSURE_TRUE(loadInfo, NS_ERROR_FAILURE);
// Is this an <iframe> with a sandbox attribute or a parent which is
// sandboxed ?
HTMLIFrameElement* iframe =
HTMLIFrameElement::FromContent(mOwnerContent);
// Does this frame have a parent which is already sandboxed or is this
// an <iframe> with a sandbox attribute?
uint32_t sandboxFlags = 0;
uint32_t parentSandboxFlags = mOwnerContent->OwnerDoc()->GetSandboxFlags();
HTMLIFrameElement* iframe = HTMLIFrameElement::FromContent(mOwnerContent);
if (iframe) {
sandboxFlags = iframe->GetSandboxFlags();
uint32_t parentSandboxFlags = iframe->OwnerDoc()->GetSandboxFlags();
if (sandboxFlags || parentSandboxFlags) {
// The child can only add restrictions, not remove them.
sandboxFlags |= parentSandboxFlags;
mDocShell->SetSandboxFlags(sandboxFlags);
}
}
// If this is an <iframe> and it's sandboxed with respect to origin
// we will set it up with a null principal later in nsDocShell::DoURILoad.
if (sandboxFlags || parentSandboxFlags) {
// The child can only add restrictions, never remove them.
sandboxFlags |= parentSandboxFlags;
mDocShell->SetSandboxFlags(sandboxFlags);
}
// If this frame is sandboxed with respect to origin we will set it up with
// a null principal later in nsDocShell::DoURILoad.
// We do it there to correctly sandbox content that was loaded into
// the iframe via other methods than the src attribute.
// the frame via other methods than the src attribute.
// We'll use our principal, not that of the document loaded inside us. This
// is very important; needed to prevent XSS attacks on documents loaded in
// subframes!

Просмотреть файл

@ -2383,12 +2383,6 @@ nsINode::WrapObject(JSContext *aCx, JSObject *aScope)
return obj;
}
bool
nsINode::IsSupported(const nsAString& aFeature, const nsAString& aVersion)
{
return nsContentUtils::InternalIsSupported(this, aFeature, aVersion);
}
already_AddRefed<nsINode>
nsINode::CloneNode(bool aDeep, ErrorResult& aError)
{
@ -2410,14 +2404,6 @@ nsINode::GetAttributes()
return AsElement()->Attributes();
}
nsresult
nsINode::GetAttributes(nsIDOMMozNamedAttrMap** aAttributes)
{
nsRefPtr<nsDOMAttributeMap> map = GetAttributes();
map.forget(aAttributes);
return NS_OK;
}
bool
EventTarget::DispatchEvent(nsDOMEvent& aEvent,
ErrorResult& aRv)

Просмотреть файл

@ -4,8 +4,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsMixedContentBlocker.h"
#include "nsContentPolicyUtils.h"
#include "nsContentPolicyUtils.h"
#include "nsThreadUtils.h"
#include "nsINode.h"
#include "nsCOMPtr.h"
#include "nsIDocShell.h"

Просмотреть файл

@ -2938,12 +2938,13 @@ nsRange::GetBoundingClientRect(nsIDOMClientRect** aResult)
return NS_OK;
}
already_AddRefed<nsIDOMClientRect>
already_AddRefed<nsClientRect>
nsRange::GetBoundingClientRect()
{
nsRefPtr<nsClientRect> rect = new nsClientRect();
if (!mStartParent)
nsRefPtr<nsClientRect> rect = new nsClientRect(ToSupports(this));
if (!mStartParent) {
return rect.forget();
}
nsLayoutUtils::RectAccumulator accumulator;
CollectClientRects(&accumulator, this, mStartParent, mStartOffset,
@ -2958,16 +2959,16 @@ nsRange::GetBoundingClientRect()
NS_IMETHODIMP
nsRange::GetClientRects(nsIDOMClientRectList** aResult)
{
ErrorResult rv;
*aResult = GetClientRects(rv).get();
return rv.ErrorCode();
*aResult = GetClientRects().get();
return NS_OK;
}
already_AddRefed<nsClientRectList>
nsRange::GetClientRects(ErrorResult& rv)
nsRange::GetClientRects()
{
if (!mStartParent)
if (!mStartParent) {
return nullptr;
}
nsRefPtr<nsClientRectList> rectList =
new nsClientRectList(static_cast<nsIDOMRange*>(this));
@ -2976,11 +2977,6 @@ nsRange::GetClientRects(ErrorResult& rv)
CollectClientRects(&builder, this, mStartParent, mStartOffset,
mEndParent, mEndOffset);
if (NS_FAILED(builder.mRV)) {
rv.Throw(builder.mRV);
return nullptr;
}
return rectList.forget();
}

Просмотреть файл

@ -20,6 +20,7 @@
#include "nsWrapperCache.h"
#include "mozilla/Attributes.h"
class nsClientRect;
class nsClientRectList;
class nsIDOMDocumentFragment;
@ -192,8 +193,8 @@ public:
void SetStartAfter(nsINode& aNode, ErrorResult& aErr);
void SetStartBefore(nsINode& aNode, ErrorResult& aErr);
void SurroundContents(nsINode& aNode, ErrorResult& aErr);
already_AddRefed<nsIDOMClientRect> GetBoundingClientRect();
already_AddRefed<nsClientRectList> GetClientRects(ErrorResult& aErr);
already_AddRefed<nsClientRect> GetBoundingClientRect();
already_AddRefed<nsClientRectList> GetClientRects();
nsINode* GetParentObject() const { return mOwner; }
virtual JSObject* WrapObject(JSContext* cx, JSObject* scope) MOZ_OVERRIDE MOZ_FINAL;

Просмотреть файл

@ -24,6 +24,7 @@ nsDOMAnimationEvent::nsDOMAnimationEvent(mozilla::dom::EventTarget* aOwner,
mEventIsInternal = true;
mEvent->time = PR_Now();
}
SetIsDOMBinding();
}
nsDOMAnimationEvent::~nsDOMAnimationEvent()
@ -54,7 +55,7 @@ nsDOMAnimationEvent::GetAnimationName(nsAString & aAnimationName)
NS_IMETHODIMP
nsDOMAnimationEvent::GetElapsedTime(float *aElapsedTime)
{
*aElapsedTime = AnimationEvent()->elapsedTime;
*aElapsedTime = ElapsedTime();
return NS_OK;
}

Просмотреть файл

@ -8,6 +8,7 @@
#include "nsDOMEvent.h"
#include "nsIDOMAnimationEvent.h"
#include "nsString.h"
#include "mozilla/dom/AnimationEventBinding.h"
class nsAnimationEvent;
@ -24,6 +25,29 @@ public:
NS_FORWARD_TO_NSDOMEVENT
NS_DECL_NSIDOMANIMATIONEVENT
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope)
{
return mozilla::dom::AnimationEventBinding::Wrap(aCx, aScope, this);
}
// xpidl implementation
// GetAnimationName(nsAString& aAnimationName);
float ElapsedTime()
{
return AnimationEvent()->elapsedTime;
}
void InitAnimationEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
const nsAString& aAnimationName,
float aElapsedTime,
mozilla::ErrorResult& aRv)
{
aRv = InitAnimationEvent(aType, aCanBubble, aCancelable, aAnimationName,
aElapsedTime);
}
private:
nsAnimationEvent* AnimationEvent() {
NS_ABORT_IF_FALSE(mEvent->eventStructType == NS_ANIMATION_EVENT,

Просмотреть файл

@ -36,6 +36,7 @@
#include "nsPIWindowRoot.h"
using namespace mozilla;
using namespace mozilla::dom;
static char *sPopupAllowedEvents;
@ -92,7 +93,7 @@ nsDOMEvent::InitPresContextData(nsPresContext* aPresContext)
// Get the explicit original target (if it's anonymous make it null)
{
nsCOMPtr<nsIContent> content = GetTargetFromFrame();
mExplicitOriginalTarget = do_QueryInterface(content);
mExplicitOriginalTarget = content;
if (content && content->IsInAnonymousSubtree()) {
mExplicitOriginalTarget = nullptr;
}
@ -222,28 +223,36 @@ NS_METHOD nsDOMEvent::GetType(nsAString& aType)
return NS_OK;
}
static nsresult
GetDOMEventTarget(nsIDOMEventTarget* aTarget,
nsIDOMEventTarget** aDOMTarget)
static EventTarget*
GetDOMEventTarget(nsIDOMEventTarget* aTarget)
{
nsIDOMEventTarget* realTarget =
aTarget ? aTarget->GetTargetForDOMEvent() : aTarget;
return aTarget ? aTarget->GetTargetForDOMEvent() : nullptr;
}
NS_IF_ADDREF(*aDOMTarget = realTarget);
return NS_OK;
EventTarget*
nsDOMEvent::GetTarget() const
{
return GetDOMEventTarget(mEvent->target);
}
NS_METHOD
nsDOMEvent::GetTarget(nsIDOMEventTarget** aTarget)
{
return GetDOMEventTarget(mEvent->target, aTarget);
NS_IF_ADDREF(*aTarget = GetTarget());
return NS_OK;
}
EventTarget*
nsDOMEvent::GetCurrentTarget() const
{
return GetDOMEventTarget(mEvent->currentTarget);
}
NS_IMETHODIMP
nsDOMEvent::GetCurrentTarget(nsIDOMEventTarget** aCurrentTarget)
{
return GetDOMEventTarget(mEvent->currentTarget, aCurrentTarget);
NS_IF_ADDREF(*aCurrentTarget = GetCurrentTarget());
return NS_OK;
}
//
@ -264,26 +273,37 @@ nsDOMEvent::GetTargetFromFrame()
return realEventContent.forget();
}
EventTarget*
nsDOMEvent::GetExplicitOriginalTarget() const
{
if (mExplicitOriginalTarget) {
return mExplicitOriginalTarget;
}
return GetTarget();
}
NS_IMETHODIMP
nsDOMEvent::GetExplicitOriginalTarget(nsIDOMEventTarget** aRealEventTarget)
{
if (mExplicitOriginalTarget) {
*aRealEventTarget = mExplicitOriginalTarget;
NS_ADDREF(*aRealEventTarget);
return NS_OK;
NS_IF_ADDREF(*aRealEventTarget = GetExplicitOriginalTarget());
return NS_OK;
}
EventTarget*
nsDOMEvent::GetOriginalTarget() const
{
if (mEvent->originalTarget) {
return GetDOMEventTarget(mEvent->originalTarget);
}
return GetTarget(aRealEventTarget);
return GetTarget();
}
NS_IMETHODIMP
nsDOMEvent::GetOriginalTarget(nsIDOMEventTarget** aOriginalTarget)
{
if (mEvent->originalTarget) {
return GetDOMEventTarget(mEvent->originalTarget, aOriginalTarget);
}
return GetTarget(aOriginalTarget);
NS_IF_ADDREF(*aOriginalTarget = GetOriginalTarget());
return NS_OK;
}
NS_IMETHODIMP_(void)
@ -376,43 +396,50 @@ nsDOMEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
return e.forget();
}
NS_IMETHODIMP
nsDOMEvent::GetEventPhase(uint16_t* aEventPhase)
uint16_t
nsDOMEvent::EventPhase() const
{
// Note, remember to check that this works also
// if or when Bug 235441 is fixed.
if ((mEvent->currentTarget &&
mEvent->currentTarget == mEvent->target) ||
mEvent->mFlags.InTargetPhase()) {
*aEventPhase = nsIDOMEvent::AT_TARGET;
} else if (mEvent->mFlags.mInCapturePhase) {
*aEventPhase = nsIDOMEvent::CAPTURING_PHASE;
} else if (mEvent->mFlags.mInBubblingPhase) {
*aEventPhase = nsIDOMEvent::BUBBLING_PHASE;
} else {
*aEventPhase = nsIDOMEvent::NONE;
return nsIDOMEvent::AT_TARGET;
}
if (mEvent->mFlags.mInCapturePhase) {
return nsIDOMEvent::CAPTURING_PHASE;
}
if (mEvent->mFlags.mInBubblingPhase) {
return nsIDOMEvent::BUBBLING_PHASE;
}
return nsIDOMEvent::NONE;
}
NS_IMETHODIMP
nsDOMEvent::GetEventPhase(uint16_t* aEventPhase)
{
*aEventPhase = EventPhase();
return NS_OK;
}
NS_IMETHODIMP
nsDOMEvent::GetBubbles(bool* aBubbles)
{
*aBubbles = mEvent->mFlags.mBubbles;
*aBubbles = Bubbles();
return NS_OK;
}
NS_IMETHODIMP
nsDOMEvent::GetCancelable(bool* aCancelable)
{
*aCancelable = mEvent->mFlags.mCancelable;
*aCancelable = Cancelable();
return NS_OK;
}
NS_IMETHODIMP
nsDOMEvent::GetTimeStamp(uint64_t* aTimeStamp)
{
*aTimeStamp = mEvent->time;
*aTimeStamp = TimeStamp();
return NS_OK;
}
@ -478,7 +505,7 @@ nsDOMEvent::PreventCapture()
NS_IMETHODIMP
nsDOMEvent::GetIsTrusted(bool *aIsTrusted)
{
*aIsTrusted = mEvent->mFlags.mIsTrusted;
*aIsTrusted = IsTrusted();
return NS_OK;
}
@ -489,7 +516,7 @@ nsDOMEvent::PreventDefault()
mEvent->mFlags.mDefaultPrevented = true;
// Need to set an extra flag for drag events.
if (mEvent->eventStructType == NS_DRAG_EVENT && mEvent->mFlags.mIsTrusted) {
if (mEvent->eventStructType == NS_DRAG_EVENT && IsTrusted()) {
nsCOMPtr<nsINode> node = do_QueryInterface(mEvent->currentTarget);
if (!node) {
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(mEvent->currentTarget);
@ -520,7 +547,7 @@ nsDOMEvent::InitEvent(const nsAString& aEventTypeArg, bool aCanBubbleArg, bool a
// Make sure this event isn't already being dispatched.
NS_ENSURE_TRUE(!mEvent->mFlags.mIsBeingDispatched, NS_OK);
if (mEvent->mFlags.mIsTrusted) {
if (IsTrusted()) {
// Ensure the caller is permitted to dispatch trusted DOM events.
if (!nsContentUtils::IsCallerChrome()) {
SetTrusted(false);
@ -1207,14 +1234,16 @@ NS_IMETHODIMP
nsDOMEvent::GetPreventDefault(bool* aReturn)
{
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = mEvent && mEvent->mFlags.mDefaultPrevented;
*aReturn = GetPreventDefault();
return NS_OK;
}
NS_IMETHODIMP
nsDOMEvent::GetDefaultPrevented(bool* aReturn)
{
return GetPreventDefault(aReturn);
NS_ENSURE_ARG_POINTER(aReturn);
*aReturn = DefaultPrevented();
return NS_OK;
}
NS_IMETHODIMP_(void)
@ -1228,17 +1257,9 @@ nsDOMEvent::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType)
GetType(type);
IPC::WriteParam(aMsg, type);
bool bubbles = false;
GetBubbles(&bubbles);
IPC::WriteParam(aMsg, bubbles);
bool cancelable = false;
GetCancelable(&cancelable);
IPC::WriteParam(aMsg, cancelable);
bool trusted = false;
GetIsTrusted(&trusted);
IPC::WriteParam(aMsg, trusted);
IPC::WriteParam(aMsg, Bubbles());
IPC::WriteParam(aMsg, Cancelable());
IPC::WriteParam(aMsg, IsTrusted());
// No timestamp serialization for now!
}

Просмотреть файл

@ -126,28 +126,10 @@ public:
// Implemented as xpidl method
// void GetType(nsString& aRetval) {}
already_AddRefed<mozilla::dom::EventTarget> GetTarget()
{
nsCOMPtr<nsIDOMEventTarget> t;
GetTarget(getter_AddRefs(t));
nsCOMPtr<mozilla::dom::EventTarget> et = do_QueryInterface(t);
return et.forget();
}
mozilla::dom::EventTarget* GetTarget() const;
mozilla::dom::EventTarget* GetCurrentTarget() const;
already_AddRefed<mozilla::dom::EventTarget> GetCurrentTarget()
{
nsCOMPtr<nsIDOMEventTarget> t;
GetCurrentTarget(getter_AddRefs(t));
nsCOMPtr<mozilla::dom::EventTarget> et = do_QueryInterface(t);
return et.forget();
}
uint16_t EventPhase()
{
uint16_t p;
GetEventPhase(&p);
return p;
}
uint16_t EventPhase() const;
// xpidl implementation
// void StopPropagation();
@ -155,47 +137,37 @@ public:
// xpidl implementation
// void StopImmediatePropagation();
bool Bubbles()
bool Bubbles() const
{
bool b;
GetBubbles(&b);
return b;
return mEvent->mFlags.mBubbles;
}
bool Cancelable()
bool Cancelable() const
{
bool c;
GetCancelable(&c);
return c;
return mEvent->mFlags.mCancelable;
}
// xpidl implementation
// void PreventDefault();
bool DefaultPrevented()
bool DefaultPrevented() const
{
bool d;
GetDefaultPrevented(&d);
return d;
return mEvent && mEvent->mFlags.mDefaultPrevented;
}
bool MultipleActionsPrevented()
bool MultipleActionsPrevented() const
{
return mEvent->mFlags.mMultipleActionsPrevented;
}
bool IsTrusted()
bool IsTrusted() const
{
bool i;
GetIsTrusted(&i);
return i;
return mEvent->mFlags.mIsTrusted;
}
uint64_t TimeStamp()
uint64_t TimeStamp() const
{
uint64_t t;
GetTimeStamp(&t);
return t;
return mEvent->time;
}
void InitEvent(const nsAString& aType, bool aBubbles, bool aCancelable,
@ -204,27 +176,12 @@ public:
aRv = InitEvent(aType, aBubbles, aCancelable);
}
already_AddRefed<mozilla::dom::EventTarget> GetOriginalTarget()
{
nsCOMPtr<nsIDOMEventTarget> t;
GetOriginalTarget(getter_AddRefs(t));
nsCOMPtr<mozilla::dom::EventTarget> et = do_QueryInterface(t);
return et.forget();
}
mozilla::dom::EventTarget* GetOriginalTarget() const;
mozilla::dom::EventTarget* GetExplicitOriginalTarget() const;
already_AddRefed<mozilla::dom::EventTarget> GetExplicitOriginalTarget()
bool GetPreventDefault() const
{
nsCOMPtr<nsIDOMEventTarget> t;
GetExplicitOriginalTarget(getter_AddRefs(t));
nsCOMPtr<mozilla::dom::EventTarget> et = do_QueryInterface(t);
return et.forget();
}
bool GetPreventDefault()
{
bool d;
GetDefaultPrevented(&d);
return d;
return DefaultPrevented();
}
protected:
@ -235,7 +192,7 @@ protected:
nsEvent* mEvent;
nsRefPtr<nsPresContext> mPresContext;
nsCOMPtr<nsIDOMEventTarget> mExplicitOriginalTarget;
nsCOMPtr<mozilla::dom::EventTarget> mExplicitOriginalTarget;
nsCOMPtr<nsPIDOMWindow> mOwner; // nsPIDOMWindow for now.
nsString mCachedType;
bool mEventIsInternal;

Просмотреть файл

@ -178,10 +178,10 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsDOMEventTargetHelper,
NS_IMETHOD DispatchEvent(nsIDOMEvent *evt, bool *_retval) { \
return _to DispatchEvent(evt, _retval); \
} \
virtual nsIDOMEventTarget * GetTargetForDOMEvent(void) { \
virtual mozilla::dom::EventTarget* GetTargetForDOMEvent() { \
return _to GetTargetForDOMEvent(); \
} \
virtual nsIDOMEventTarget * GetTargetForEventTargetChain(void) { \
virtual mozilla::dom::EventTarget* GetTargetForEventTargetChain() { \
return _to GetTargetForEventTargetChain(); \
} \
virtual nsresult WillHandleEvent(nsEventChainPostVisitor & aVisitor) { \

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше