mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1001637 - Make math tables implement the nsIAccessibleTable interface. r=surkov (ebbb4325d6) - Bug 1149118 - Expose radio group with the correct role on OS X, r=surkov (4d4a95735c) - Bug 1113153 - use 'paragraph' role for paragraphs only, introduce 'text' role for small text containers, r=marcoz (14c4fa5881) - Bug 1175164 - Do not expose MathML semantics element in the accessibility tree. r=surkov (3945ae0367) - Bug 930843 part.1 Add test for checking isTrust attribute value of DOMActivate event r=smaug (14a49dd447) - Bug 930843 part.2 NS_UI_ACTIVATE event should be trusted event even if it's caused by an untrusted event r=smaug (e0af6165b5) - Bug 1156315 - Call DispatchInputEvent in more places on OS X. r=dvander (e24f42c09f) - Bug 1186015 part.1 Rename nsIMEContext to mozilla::widget::IMEContext r=jimm (077bf6e772) - Bug 1186015 part.2 Rename nsIMM32Handler to mozilla::widget::IMMHandler r=jimm+m_kato (a2098e33b5) - Bug 1184533 Rewrite range check in aOffset of nsIMM32Handler::GetCharacterRectOfSelectedTextAt() r=emk (fb68bc3c56) - Bug 555642 part.1 nsCaret should have a way to override the caret visible state for hiding caret temporarily and nsEditor should hide caret if composition string doesn't have caret information r=roc (9de4aa366c) - Bug 1171847 Remove unnecessary ',' in logging code in nsTextStore::Initialize() r=m_kato (78d0d43625) - Bug 1181714 nsTextStore should store previous focused document manager until new document manager actually gets focus r=m_kato (fd7e820af2) - Bug 1176950 nsTextStore should keep storing locked content until NOTIFY_IME_OF_COMPOSITION_UPDATE is notified r=emk (0a12349575) - Bug 1137539 part.1 Implement TSFStaticSink::IsGoogleJapaneseInputActive() r=emk (68d1f9a0ec) - Bug 1137539 part.2 Implement TSFStaticSink::IsATOKActive() r=emk (51a4208bfa) - Bug 1137539 part.3 Implement TSFStaticSink::IsFreeChangJieActive() r=emk (affbb81b96) - Bug 1137539 part.4 Implement TSFStaticSink::IsEasyChangjeiActive() r=emk (abd3e674b6) - Bug 1186014 Rename nsTextStore to mozilla::widget::TSFTextStore r=jimm+m_kato (ca63351f94) - Bug 1187351 TSFTextStore should forget modified range at notifying TSF of layout change since GetTextExt() shouldn't return TS_E_NOLAYOUT after that r=emk (48878793e0) - Bg 1187367 TSFTextStore shouldn't destroy native caret for ATOK until notifying TSF of layout change r=emk (a2a4022d15) - Bug 1187566 TSFTextStore::Content should compute mMinTextModified Offset only with the latest composition string and original composition string, and also the hack should be enabled on Win10 r=emk (1368885efe) - Bug 1050644 part.1 Add methods to check whether the active TIP is Chinese TIP which deosn't show candidate window in e10s mode r=emk (1b783e682e) - Bug 1050644 part.2 Hack ITextStoreACP::GetTextExt()'s offset for some Chinese TIPs of MS r=emk (c05cec10ce) - Bug 1187579 Enable TSF in e10s mode r=m_kato (1ae106231a) - Bug 555642 part.2 IME handlers on Windows shouldn't append caret range if the caret is in the target clause which doesn't have specific style r=m_kato (88bae2c8da) - Bug 1196124 Fix mismatch of printf style string and following arguments of MOZ_LOG() in IMMHandler::GetCharacterRectOfSelectedTextAt() r=m_kato (0f6debd0d3) - Bug 90712 Cancel composition when Enter key message isn't consumed by IME r=m_kato (0febdb1fd9) - pointer style (6c984274cd) - Bug 1177268 - implement aria-rowcount/index and aria-colcount/index, r=marcoz (92ac300374) - Bug 1153135 - Return possibility PEN working while APZC is enabled. r=jimm (8bc77ff84f) - Bug 1171073 - Suppress content scrolling issue on 64-bit platforms. r=kats (62db0dead3) - Bug 1121946, Implement e10 cursor drag feedback on Windows, r=jmathies (6e8218d202) - Bug 1144650 - Don't dispatch touch-based mouse events when APZ is handling touch. r=jimm (53ebea0d90) - Bug 1163056 - InkCollector activation at first PEN event. r=jimm (b28e0ee58b) - Bug 895274 part.3 Make the enum of event messages a named enum IGNORE IDL r=smaug (32e04a4e90) - spacing (b9249221dc) - Bug 1182966 - Part 3: Add some final annotations to DomainSet. r=mrbkap (3455822e89) - Bug 1050122 - Part 1: Enable Nuwa on debug builds, and kill it if the preference is false. r=khuey (46685a7bf3) - Bug 1146229: Remove calling convention modifier from local variable. r=surkov (e5f4b6e5d5) - bug 1168932 - Implement ProxyCreated and ProxyDestroyed to update mozAccessibles r=tbsaunde (77a007fa21) - Bug 1169701 - Fire native OS X accessibility events for proxied accessibles r=tbsaunde (c4847135a8) - bug 1172523 - fire useful text change events for proxies r=lsock (85b7f995b8) - remove spurious file (229c787360) - bug 1171117 - Fix cairo to build on iOS. r=jrmuizel (45709c8fe3) - Bug 963738 - Annotate XPCNativeMember, r=terrence (d1afdde52b) - Bug 1148383 - Add testcase for previously fixed object metadata issue r=terrence (2c1b762cba) - Bug 1149797 - Update browser jstests to treat ecma_6/extensions tests as 1.8, so that let is interpreted as a statement and not as an expression. r=bustage in a CLOSED TREE (ac6127d6bc) - Bug 1150858 - Unwrap the correct object in ArrayBuffer.transfer (r=sfink) (cf67906802) - Bug 1150380 - IonMonkey: MIPS: Fix JitRuntime::generateProfilerExitFrameTailStub. r=rankov (eeac49ddce) - use RootedValue for POW as in 1135708 (34c1c3d191) - Bug 1196648: IonMonkey - Don't run the lazy link stub for asmjs to jit fastpath, r=nbp (686d495371) - Bug 1121947, Implement e10 cursor drag feedback on Mac, r=smaug (f48df2d1) - and sync widget/TextEvents.h and TextRange.h with AF.
This commit is contained in:
@@ -1426,6 +1426,15 @@ MaiAtkObject::FireStateChangeEvent(uint64_t aState, bool aEnabled)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
a11y::ProxyTextChangeEvent(ProxyAccessible* aTarget, const nsString& aStr,
|
||||
int32_t aStart, uint32_t aLen, bool aIsInsert,
|
||||
bool aFromUser)
|
||||
{
|
||||
MaiAtkObject* atkObj = MAI_ATK_OBJECT(GetWrapperFor(aTarget));
|
||||
atkObj->FireTextChangeEvent(aStr, aStart, aLen, aIsInsert, aFromUser);
|
||||
}
|
||||
|
||||
#define OLD_TEXT_INSERTED "text_changed::insert"
|
||||
#define OLD_TEXT_REMOVED "text_changed::delete"
|
||||
static const char* oldTextChangeStrings[2][2] = {
|
||||
|
||||
@@ -478,7 +478,7 @@ static nsRoleMapEntry sWAIRoleMaps[] =
|
||||
},
|
||||
{ // radiogroup
|
||||
&nsGkAtoms::radiogroup,
|
||||
roles::GROUPING,
|
||||
roles::RADIO_GROUP,
|
||||
kUseMapRole,
|
||||
eNoValue,
|
||||
eNoAction,
|
||||
|
||||
+12
-16
@@ -103,6 +103,10 @@ MARKUPMAP(li,
|
||||
New_HTMLListitem,
|
||||
0)
|
||||
|
||||
MARKUPMAP(map,
|
||||
nullptr,
|
||||
roles::TEXT_CONTAINER)
|
||||
|
||||
MARKUPMAP(math,
|
||||
New_HyperText,
|
||||
roles::MATHML_MATH)
|
||||
@@ -205,22 +209,22 @@ MARKUPMAP(mmultiscripts_,
|
||||
roles::MATHML_MULTISCRIPTS)
|
||||
|
||||
MARKUPMAP(mtable_,
|
||||
New_HyperText,
|
||||
New_HTMLTableAccessible,
|
||||
roles::MATHML_TABLE,
|
||||
AttrFromDOM(align, align),
|
||||
AttrFromDOM(columnlines_, columnlines_),
|
||||
AttrFromDOM(rowlines_, rowlines_))
|
||||
|
||||
MARKUPMAP(mlabeledtr_,
|
||||
New_HyperText,
|
||||
New_HTMLTableRowAccessible,
|
||||
roles::MATHML_LABELED_ROW)
|
||||
|
||||
MARKUPMAP(mtr_,
|
||||
New_HyperText,
|
||||
New_HTMLTableRowAccessible,
|
||||
roles::MATHML_TABLE_ROW)
|
||||
|
||||
MARKUPMAP(mtd_,
|
||||
New_HyperText,
|
||||
New_HTMLTableCellAccessible,
|
||||
roles::MATHML_CELL)
|
||||
|
||||
MARKUPMAP(maction_,
|
||||
@@ -233,18 +237,6 @@ MARKUPMAP(merror_,
|
||||
New_HyperText,
|
||||
roles::MATHML_ERROR)
|
||||
|
||||
MARKUPMAP(semantics_,
|
||||
New_HyperText,
|
||||
roles::MATHML_SEMANTICS)
|
||||
|
||||
MARKUPMAP(annotation_,
|
||||
New_HyperText,
|
||||
roles::MATHML_ANNOTATION)
|
||||
|
||||
MARKUPMAP(annotation_xml_,
|
||||
New_HyperText,
|
||||
roles::MATHML_XML_ANNOTATION)
|
||||
|
||||
MARKUPMAP(mstack_,
|
||||
New_HyperText,
|
||||
roles::MATHML_STACK,
|
||||
@@ -304,6 +296,10 @@ MARKUPMAP(output,
|
||||
roles::SECTION,
|
||||
Attr(live, polite))
|
||||
|
||||
MARKUPMAP(p,
|
||||
nullptr,
|
||||
roles::PARAGRAPH)
|
||||
|
||||
MARKUPMAP(progress,
|
||||
New_HTMLProgress,
|
||||
0)
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
class nsString;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
@@ -70,6 +72,9 @@ void ProxyEvent(ProxyAccessible* aTarget, uint32_t aEventType);
|
||||
void ProxyStateChangeEvent(ProxyAccessible* aTarget, uint64_t aState,
|
||||
bool aEnabled);
|
||||
void ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset);
|
||||
void ProxyTextChangeEvent(ProxyAccessible* aTarget, const nsString& aStr,
|
||||
int32_t aStart, uint32_t aLen, bool aIsInsert,
|
||||
bool aFromUser);
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
|
||||
+19
-23
@@ -926,57 +926,53 @@ enum Role {
|
||||
*/
|
||||
MATHML_ERROR = 157,
|
||||
|
||||
/**
|
||||
* A MathML semantics annotation element (semantics in MathML).
|
||||
*/
|
||||
MATHML_SEMANTICS = 158,
|
||||
|
||||
/**
|
||||
* A MathML annotation (annotation in MathML).
|
||||
*/
|
||||
MATHML_ANNOTATION = 159,
|
||||
|
||||
/**
|
||||
* A MathML XML annotation (annotation-xml in MathML).
|
||||
*/
|
||||
MATHML_XML_ANNOTATION = 160,
|
||||
|
||||
/**
|
||||
* A MathML stacked (rows of numbers) element (mstack in MathML).
|
||||
*/
|
||||
MATHML_STACK = 161,
|
||||
MATHML_STACK = 158,
|
||||
|
||||
/**
|
||||
* A MathML long division element (mlongdiv in MathML).
|
||||
*/
|
||||
MATHML_LONG_DIVISION = 162,
|
||||
MATHML_LONG_DIVISION = 159,
|
||||
|
||||
/**
|
||||
* A MathML stack group (msgroup in MathML).
|
||||
*/
|
||||
MATHML_STACK_GROUP = 163,
|
||||
MATHML_STACK_GROUP = 160,
|
||||
|
||||
/**
|
||||
* A MathML stack row (msrow in MathML).
|
||||
*/
|
||||
MATHML_STACK_ROW = 164,
|
||||
MATHML_STACK_ROW = 161,
|
||||
|
||||
/**
|
||||
* MathML carries, borrows, or crossouts for a row (mscarries in MathML).
|
||||
*/
|
||||
MATHML_STACK_CARRIES = 165,
|
||||
MATHML_STACK_CARRIES = 162,
|
||||
|
||||
/**
|
||||
* A MathML carry, borrow, or crossout for a column (mscarry in MathML).
|
||||
*/
|
||||
MATHML_STACK_CARRY = 166,
|
||||
MATHML_STACK_CARRY = 163,
|
||||
|
||||
/**
|
||||
* A MathML line in a stack (msline in MathML).
|
||||
*/
|
||||
MATHML_STACK_LINE = 167,
|
||||
MATHML_STACK_LINE = 164,
|
||||
|
||||
LAST_ROLE = MATHML_STACK_LINE
|
||||
/**
|
||||
* A group containing radio buttons
|
||||
*/
|
||||
RADIO_GROUP = 165,
|
||||
|
||||
/**
|
||||
* A text container exposing brief amount of information. See related
|
||||
* TEXT_CONTAINER role.
|
||||
*/
|
||||
TEXT = 166,
|
||||
|
||||
LAST_ROLE = TEXT
|
||||
};
|
||||
|
||||
} // namespace role
|
||||
|
||||
+18
-25
@@ -754,7 +754,7 @@ ROLE(TERMINAL,
|
||||
|
||||
ROLE(TEXT_CONTAINER,
|
||||
"text container",
|
||||
ATK_ROLE_TEXT,
|
||||
ATK_ROLE_SECTION,
|
||||
NSAccessibilityGroupRole,
|
||||
USE_ROLE_STRING,
|
||||
IA2_ROLE_TEXT_FRAME,
|
||||
@@ -1280,30 +1280,6 @@ ROLE(MATHML_ERROR,
|
||||
IA2_ROLE_UNKNOWN,
|
||||
eNoNameRule)
|
||||
|
||||
ROLE(MATHML_SEMANTICS,
|
||||
"mathml semantics",
|
||||
ATK_ROLE_UNKNOWN,
|
||||
NSAccessibilityUnknownRole,
|
||||
0,
|
||||
IA2_ROLE_UNKNOWN,
|
||||
eNoNameRule)
|
||||
|
||||
ROLE(MATHML_ANNOTATION,
|
||||
"mathml annotation",
|
||||
ATK_ROLE_UNKNOWN,
|
||||
NSAccessibilityUnknownRole,
|
||||
0,
|
||||
IA2_ROLE_UNKNOWN,
|
||||
eNoNameRule)
|
||||
|
||||
ROLE(MATHML_XML_ANNOTATION,
|
||||
"mathml xml annotation",
|
||||
ATK_ROLE_UNKNOWN,
|
||||
NSAccessibilityUnknownRole,
|
||||
0,
|
||||
IA2_ROLE_UNKNOWN,
|
||||
eNoNameRule)
|
||||
|
||||
ROLE(MATHML_STACK,
|
||||
"mathml stack",
|
||||
ATK_ROLE_UNKNOWN,
|
||||
@@ -1359,3 +1335,20 @@ ROLE(MATHML_STACK_LINE,
|
||||
0,
|
||||
IA2_ROLE_UNKNOWN,
|
||||
eNoNameRule)
|
||||
|
||||
ROLE(RADIO_GROUP,
|
||||
"grouping",
|
||||
ATK_ROLE_PANEL,
|
||||
NSAccessibilityRadioGroupRole,
|
||||
ROLE_SYSTEM_GROUPING,
|
||||
ROLE_SYSTEM_GROUPING,
|
||||
eNoNameRule)
|
||||
|
||||
ROLE(TEXT,
|
||||
"text",
|
||||
ATK_ROLE_STATIC,
|
||||
NSAccessibilityGroupRole,
|
||||
USE_ROLE_STRING,
|
||||
IA2_ROLE_TEXT_FRAME,
|
||||
eNameFromSubtreeIfReqRule)
|
||||
|
||||
|
||||
@@ -242,6 +242,27 @@ nsAccUtils::IsARIASelected(Accessible* aAccessible)
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
}
|
||||
|
||||
Accessible*
|
||||
nsAccUtils::TableFor(Accessible* aRow)
|
||||
{
|
||||
if (aRow) {
|
||||
Accessible* table = aRow->Parent();
|
||||
if (table) {
|
||||
roles::Role tableRole = table->Role();
|
||||
if (tableRole == roles::GROUPING) { // if there's a rowgroup.
|
||||
table = table->Parent();
|
||||
if (table)
|
||||
tableRole = table->Role();
|
||||
}
|
||||
|
||||
return tableRole == roles::TABLE || tableRole == roles::TREE_TABLE ?
|
||||
table : nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
HyperTextAccessible*
|
||||
nsAccUtils::GetTextContainer(nsINode* aNode)
|
||||
{
|
||||
|
||||
@@ -134,6 +134,8 @@ public:
|
||||
*/
|
||||
static HyperTextAccessible* GetTextContainer(nsINode* aNode);
|
||||
|
||||
static Accessible* TableFor(Accessible* aRow);
|
||||
|
||||
/**
|
||||
* Return true if the DOM node of given accessible has aria-selected="true"
|
||||
* attribute.
|
||||
|
||||
@@ -196,6 +196,18 @@ static Accessible* New_HTMLOutput(nsIContent* aContent, Accessible* aContext)
|
||||
static Accessible* New_HTMLProgress(nsIContent* aContent, Accessible* aContext)
|
||||
{ return new HTMLProgressMeterAccessible(aContent, aContext->Document()); }
|
||||
|
||||
static Accessible*
|
||||
New_HTMLTableAccessible(nsIContent* aContent, Accessible* aContext)
|
||||
{ return new HTMLTableAccessible(aContent, aContext->Document()); }
|
||||
|
||||
static Accessible*
|
||||
New_HTMLTableRowAccessible(nsIContent* aContent, Accessible* aContext)
|
||||
{ return new HTMLTableRowAccessible(aContent, aContext->Document()); }
|
||||
|
||||
static Accessible*
|
||||
New_HTMLTableCellAccessible(nsIContent* aContent, Accessible* aContext)
|
||||
{ return new HTMLTableCellAccessible(aContent, aContext->Document()); }
|
||||
|
||||
static Accessible*
|
||||
New_HTMLTableHeaderCell(nsIContent* aContent, Accessible* aContext)
|
||||
{
|
||||
@@ -1074,11 +1086,12 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
}
|
||||
|
||||
if (!newAcc && content->IsHTMLElement()) { // HTML accessibles
|
||||
bool isARIATableOrCell = roleMapEntry &&
|
||||
(roleMapEntry->accTypes & (eTableCell | eTable));
|
||||
bool isARIATablePart = roleMapEntry &&
|
||||
(roleMapEntry->accTypes & (eTableCell | eTableRow | eTable));
|
||||
|
||||
if (!isARIATableOrCell ||
|
||||
if (!isARIATablePart ||
|
||||
frame->AccessibleType() == eHTMLTableCellType ||
|
||||
frame->AccessibleType() == eHTMLTableRowType ||
|
||||
frame->AccessibleType() == eHTMLTableType) {
|
||||
// Prefer to use markup to decide if and what kind of accessible to create,
|
||||
const MarkupMapInfo* markupMap =
|
||||
@@ -1090,13 +1103,17 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
newAcc = CreateAccessibleByFrameType(frame, content, aContext);
|
||||
}
|
||||
|
||||
// In case of ARIA grids use grid-specific classes if it's not native table
|
||||
// based.
|
||||
if (isARIATableOrCell && (!newAcc || newAcc->IsGenericHyperText())) {
|
||||
// In case of ARIA grid or table use table-specific classes if it's not
|
||||
// native table based.
|
||||
if (isARIATablePart && (!newAcc || newAcc->IsGenericHyperText())) {
|
||||
if ((roleMapEntry->accTypes & eTableCell)) {
|
||||
if (aContext->IsTableRow())
|
||||
newAcc = new ARIAGridCellAccessibleWrap(content, document);
|
||||
|
||||
} else if (roleMapEntry->IsOfType(eTableRow)) {
|
||||
if (aContext->IsTable())
|
||||
newAcc = new ARIARowAccessible(content, document);
|
||||
|
||||
} else if (roleMapEntry->IsOfType(eTable)) {
|
||||
newAcc = new ARIAGridAccessibleWrap(content, document);
|
||||
}
|
||||
@@ -1173,12 +1190,15 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
newAcc = markupMap->new_func(content, aContext);
|
||||
|
||||
// Fall back to text when encountering Content MathML.
|
||||
if (!newAcc && !content->IsAnyOfMathMLElements(nsGkAtoms::mpadded_,
|
||||
if (!newAcc && !content->IsAnyOfMathMLElements(nsGkAtoms::annotation_,
|
||||
nsGkAtoms::annotation_xml_,
|
||||
nsGkAtoms::mpadded_,
|
||||
nsGkAtoms::mphantom_,
|
||||
nsGkAtoms::maligngroup_,
|
||||
nsGkAtoms::malignmark_,
|
||||
nsGkAtoms::mspace_)) {
|
||||
newAcc = new HyperTextAccessible(content, document);
|
||||
nsGkAtoms::mspace_,
|
||||
nsGkAtoms::semantics_)) {
|
||||
newAcc = new HyperTextAccessible(content, document);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,11 +118,11 @@ nsCoreUtils::DispatchClickEvent(nsITreeBoxObject *aTreeBoxObj,
|
||||
}
|
||||
|
||||
void
|
||||
nsCoreUtils::DispatchMouseEvent(uint32_t aEventType, int32_t aX, int32_t aY,
|
||||
nsCoreUtils::DispatchMouseEvent(EventMessage aMessage, int32_t aX, int32_t aY,
|
||||
nsIContent *aContent, nsIFrame *aFrame,
|
||||
nsIPresShell *aPresShell, nsIWidget *aRootWidget)
|
||||
{
|
||||
WidgetMouseEvent event(true, aEventType, aRootWidget,
|
||||
WidgetMouseEvent event(true, aMessage, aRootWidget,
|
||||
WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
|
||||
|
||||
event.refPoint = LayoutDeviceIntPoint(aX, aY);
|
||||
@@ -137,14 +137,14 @@ nsCoreUtils::DispatchMouseEvent(uint32_t aEventType, int32_t aX, int32_t aY,
|
||||
}
|
||||
|
||||
void
|
||||
nsCoreUtils::DispatchTouchEvent(uint32_t aEventType, int32_t aX, int32_t aY,
|
||||
nsCoreUtils::DispatchTouchEvent(EventMessage aMessage, int32_t aX, int32_t aY,
|
||||
nsIContent* aContent, nsIFrame* aFrame,
|
||||
nsIPresShell* aPresShell, nsIWidget* aRootWidget)
|
||||
{
|
||||
if (!dom::TouchEvent::PrefEnabled())
|
||||
return;
|
||||
|
||||
WidgetTouchEvent event(true, aEventType, aRootWidget);
|
||||
WidgetTouchEvent event(true, aMessage, aRootWidget);
|
||||
|
||||
event.time = PR_IntervalNow();
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#ifndef nsCoreUtils_h_
|
||||
#define nsCoreUtils_h_
|
||||
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h" // for GetShell()
|
||||
#include "nsIPresShell.h"
|
||||
@@ -49,7 +50,7 @@ public:
|
||||
/**
|
||||
* Send mouse event to the given element.
|
||||
*
|
||||
* @param aEventType [in] an event type (see BasicEvents.h for constants)
|
||||
* @param aMessage [in] an event message (see EventForwards.h)
|
||||
* @param aX [in] x coordinate in dev pixels
|
||||
* @param aY [in] y coordinate in dev pixels
|
||||
* @param aContent [in] the element
|
||||
@@ -57,14 +58,15 @@ public:
|
||||
* @param aPresShell [in] the presshell for the element
|
||||
* @param aRootWidget [in] the root widget of the element
|
||||
*/
|
||||
static void DispatchMouseEvent(uint32_t aEventType, int32_t aX, int32_t aY,
|
||||
static void DispatchMouseEvent(mozilla::EventMessage aMessage,
|
||||
int32_t aX, int32_t aY,
|
||||
nsIContent *aContent, nsIFrame *aFrame,
|
||||
nsIPresShell *aPresShell, nsIWidget *aRootWidget);
|
||||
|
||||
/**
|
||||
* Send a touch event with a single touch point to the given element.
|
||||
*
|
||||
* @param aEventType [in] an event type (see BasicEvents.h for constants)
|
||||
* @param aMessage [in] an event message (see EventForwards.h)
|
||||
* @param aX [in] x coordinate in dev pixels
|
||||
* @param aY [in] y coordinate in dev pixels
|
||||
* @param aContent [in] the element
|
||||
@@ -72,7 +74,8 @@ public:
|
||||
* @param aPresShell [in] the presshell for the element
|
||||
* @param aRootWidget [in] the root widget of the element
|
||||
*/
|
||||
static void DispatchTouchEvent(uint32_t aEventType, int32_t aX, int32_t aY,
|
||||
static void DispatchTouchEvent(mozilla::EventMessage aMessage,
|
||||
int32_t aX, int32_t aY,
|
||||
nsIContent* aContent, nsIFrame* aFrame,
|
||||
nsIPresShell* aPresShell, nsIWidget* aRootWidget);
|
||||
|
||||
@@ -223,7 +226,7 @@ public:
|
||||
* attribute or wrong value then false is returned.
|
||||
*/
|
||||
static bool GetUIntAttr(nsIContent *aContent, nsIAtom *aAttr,
|
||||
int32_t *aUInt);
|
||||
int32_t* aUInt);
|
||||
|
||||
/**
|
||||
* Returns language for the given node.
|
||||
|
||||
@@ -10,35 +10,15 @@
|
||||
#include "ARIAGridAccessible.h"
|
||||
|
||||
#include "AccIterator.h"
|
||||
#include "nsAccUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
inline Accessible*
|
||||
ARIAGridCellAccessible::TableFor(Accessible* aRow) const
|
||||
{
|
||||
if (aRow) {
|
||||
Accessible* table = aRow->Parent();
|
||||
if (table) {
|
||||
roles::Role tableRole = table->Role();
|
||||
if (tableRole == roles::GROUPING) { // if there's a rowgroup.
|
||||
table = table->Parent();
|
||||
if (table)
|
||||
tableRole = table->Role();
|
||||
}
|
||||
|
||||
return tableRole == roles::TABLE || tableRole == roles::TREE_TABLE ?
|
||||
table : nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline int32_t
|
||||
ARIAGridCellAccessible::RowIndexFor(Accessible* aRow) const
|
||||
{
|
||||
Accessible* table = TableFor(aRow);
|
||||
Accessible* table = nsAccUtils::TableFor(aRow);
|
||||
if (table) {
|
||||
int32_t rowIdx = 0;
|
||||
Accessible* row = nullptr;
|
||||
|
||||
@@ -485,6 +485,34 @@ ARIAGridAccessible::SetARIASelected(Accessible* aAccessible,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ARIARowAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ARIARowAccessible::
|
||||
ARIARowAccessible(nsIContent* aContent, DocAccessible* aDoc) :
|
||||
AccessibleWrap(aContent, aDoc)
|
||||
{
|
||||
mGenericTypes |= eTableRow;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(ARIARowAccessible, Accessible)
|
||||
|
||||
GroupPos
|
||||
ARIARowAccessible::GroupPosition()
|
||||
{
|
||||
int32_t count = 0, index = 0;
|
||||
if (nsCoreUtils::GetUIntAttr(nsAccUtils::TableFor(this)->GetContent(),
|
||||
nsGkAtoms::aria_rowcount, &count) &&
|
||||
nsCoreUtils::GetUIntAttr(mContent, nsGkAtoms::aria_rowindex, &index)) {
|
||||
return GroupPos(0, index, count);
|
||||
}
|
||||
|
||||
return AccessibleWrap::GroupPosition();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ARIAGridCellAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -508,7 +536,7 @@ NS_IMPL_ISUPPORTS_INHERITED0(ARIAGridCellAccessible, HyperTextAccessible)
|
||||
TableAccessible*
|
||||
ARIAGridCellAccessible::Table() const
|
||||
{
|
||||
Accessible* table = TableFor(Row());
|
||||
Accessible* table = nsAccUtils::TableFor(Row());
|
||||
return table ? table->AsTable() : nullptr;
|
||||
}
|
||||
|
||||
@@ -613,3 +641,16 @@ ARIAGridCellAccessible::NativeAttributes()
|
||||
|
||||
return attributes.forget();
|
||||
}
|
||||
|
||||
GroupPos
|
||||
ARIAGridCellAccessible::GroupPosition()
|
||||
{
|
||||
int32_t count = 0, index = 0;
|
||||
if (nsCoreUtils::GetUIntAttr(Table()->AsAccessible()->GetContent(),
|
||||
nsGkAtoms::aria_colcount, &count) &&
|
||||
nsCoreUtils::GetUIntAttr(mContent, nsGkAtoms::aria_colindex, &index)) {
|
||||
return GroupPos(0, index, count);
|
||||
}
|
||||
|
||||
return GroupPos();
|
||||
}
|
||||
|
||||
@@ -73,6 +73,24 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accessible for ARIA row.
|
||||
*/
|
||||
class ARIARowAccessible : public AccessibleWrap
|
||||
{
|
||||
public:
|
||||
ARIARowAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// Accessible
|
||||
virtual mozilla::a11y::GroupPos GroupPosition() override;
|
||||
|
||||
protected:
|
||||
virtual ~ARIARowAccessible() {}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accessible for ARIA gridcell and rowheader/columnheader.
|
||||
*/
|
||||
@@ -88,6 +106,7 @@ public:
|
||||
virtual TableCellAccessible* AsTableCell() override { return this; }
|
||||
virtual void ApplyARIAState(uint64_t* aState) const override;
|
||||
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
|
||||
virtual mozilla::a11y::GroupPos GroupPosition() override;
|
||||
|
||||
protected:
|
||||
virtual ~ARIAGridCellAccessible() {}
|
||||
@@ -98,14 +117,9 @@ protected:
|
||||
Accessible* Row() const
|
||||
{
|
||||
Accessible* row = Parent();
|
||||
return row && row->Role() == roles::ROW ? row : nullptr;
|
||||
return row && row->IsTableRow() ? row : nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a table for the given row.
|
||||
*/
|
||||
Accessible* TableFor(Accessible* aRow) const;
|
||||
|
||||
/**
|
||||
* Return index of the given row.
|
||||
*/
|
||||
|
||||
@@ -864,6 +864,16 @@ Accessible::HandleAccEvent(AccEvent* aEvent)
|
||||
ipcDoc->SendEvent(id, event->GetCaretOffset());
|
||||
break;
|
||||
}
|
||||
case nsIAccessibleEvent::EVENT_TEXT_INSERTED:
|
||||
case nsIAccessibleEvent::EVENT_TEXT_REMOVED: {
|
||||
AccTextChangeEvent* event = downcast_accEvent(aEvent);
|
||||
ipcDoc->SendTextChangeEvent(id, event->ModifiedText(),
|
||||
event->GetStartOffset(),
|
||||
event->GetLength(),
|
||||
event->IsTextInserted(),
|
||||
event->IsFromUserInput());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ipcDoc->SendEvent(id, aEvent->GetEventType());
|
||||
}
|
||||
|
||||
@@ -82,6 +82,8 @@ enum ENameValueFlag {
|
||||
struct GroupPos
|
||||
{
|
||||
GroupPos() : level(0), posInSet(0), setSize(0) { }
|
||||
GroupPos(int32_t aLevel, int32_t aPosInSet, int32_t aSetSize) :
|
||||
level(aLevel), posInSet(aPosInSet), setSize(aSetSize) { }
|
||||
|
||||
int32_t level;
|
||||
int32_t posInSet;
|
||||
|
||||
@@ -63,12 +63,11 @@ HyperTextAccessible::NativeRole()
|
||||
if (r != roles::NOTHING)
|
||||
return r;
|
||||
|
||||
// Treat block frames as paragraphs
|
||||
nsIFrame *frame = GetFrame();
|
||||
if (frame && frame->GetType() == nsGkAtoms::blockFrame)
|
||||
return roles::PARAGRAPH;
|
||||
nsIFrame* frame = GetFrame();
|
||||
if (frame && frame->GetType() == nsGkAtoms::inlineFrame)
|
||||
return roles::TEXT;
|
||||
|
||||
return roles::TEXT_CONTAINER; // In ATK this works
|
||||
return roles::TEXT_CONTAINER;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
|
||||
@@ -52,6 +52,7 @@ Accessible::AsOuterDoc()
|
||||
{
|
||||
return IsOuterDoc() ? static_cast<OuterDocAccessible*>(this) : nullptr;
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
|
||||
@@ -60,6 +60,9 @@ NS_IMPL_ISUPPORTS_INHERITED0(HTMLTableCellAccessible, HyperTextAccessible)
|
||||
role
|
||||
HTMLTableCellAccessible::NativeRole()
|
||||
{
|
||||
if (mContent->IsMathMLElement(nsGkAtoms::mtd_)) {
|
||||
return roles::MATHML_CELL;
|
||||
}
|
||||
return roles::CELL;
|
||||
}
|
||||
|
||||
@@ -140,6 +143,19 @@ HTMLTableCellAccessible::NativeAttributes()
|
||||
return attributes.forget();
|
||||
}
|
||||
|
||||
GroupPos
|
||||
HTMLTableCellAccessible::GroupPosition()
|
||||
{
|
||||
int32_t count = 0, index = 0;
|
||||
if (nsCoreUtils::GetUIntAttr(Table()->AsAccessible()->GetContent(),
|
||||
nsGkAtoms::aria_colcount, &count) &&
|
||||
nsCoreUtils::GetUIntAttr(mContent, nsGkAtoms::aria_colindex, &index)) {
|
||||
return GroupPos(0, index, count);
|
||||
}
|
||||
|
||||
return HyperTextAccessibleWrap::GroupPosition();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// HTMLTableCellAccessible: TableCellAccessible implementation
|
||||
|
||||
@@ -148,8 +164,7 @@ HTMLTableCellAccessible::Table() const
|
||||
{
|
||||
Accessible* parent = const_cast<HTMLTableCellAccessible*>(this);
|
||||
while ((parent = parent->Parent())) {
|
||||
roles::Role role = parent->Role();
|
||||
if (role == roles::TABLE || role == roles::TREE_TABLE)
|
||||
if (parent->IsTable())
|
||||
return parent->AsTable();
|
||||
}
|
||||
|
||||
@@ -349,9 +364,27 @@ NS_IMPL_ISUPPORTS_INHERITED0(HTMLTableRowAccessible, Accessible)
|
||||
role
|
||||
HTMLTableRowAccessible::NativeRole()
|
||||
{
|
||||
if (mContent->IsMathMLElement(nsGkAtoms::mtr_)) {
|
||||
return roles::MATHML_TABLE_ROW;
|
||||
} else if (mContent->IsMathMLElement(nsGkAtoms::mlabeledtr_)) {
|
||||
return roles::MATHML_LABELED_ROW;
|
||||
}
|
||||
return roles::ROW;
|
||||
}
|
||||
|
||||
GroupPos
|
||||
HTMLTableRowAccessible::GroupPosition()
|
||||
{
|
||||
int32_t count = 0, index = 0;
|
||||
if (nsCoreUtils::GetUIntAttr(nsAccUtils::TableFor(this)->GetContent(),
|
||||
nsGkAtoms::aria_rowcount, &count) &&
|
||||
nsCoreUtils::GetUIntAttr(mContent, nsGkAtoms::aria_rowindex, &index)) {
|
||||
return GroupPos(0, index, count);
|
||||
}
|
||||
|
||||
return AccessibleWrap::GroupPosition();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// HTMLTableAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -384,6 +417,9 @@ HTMLTableAccessible::CacheChildren()
|
||||
role
|
||||
HTMLTableAccessible::NativeRole()
|
||||
{
|
||||
if (mContent->IsMathMLElement(nsGkAtoms::mtable_)) {
|
||||
return roles::MATHML_TABLE;
|
||||
}
|
||||
return roles::TABLE;
|
||||
}
|
||||
|
||||
@@ -421,6 +457,11 @@ HTMLTableAccessible::NativeAttributes()
|
||||
{
|
||||
nsCOMPtr<nsIPersistentProperties> attributes =
|
||||
AccessibleWrap::NativeAttributes();
|
||||
|
||||
if (mContent->IsMathMLElement(nsGkAtoms::mtable_)) {
|
||||
GetAccService()->MarkupAttributes(mContent, attributes);
|
||||
}
|
||||
|
||||
if (IsProbablyLayoutTable()) {
|
||||
nsAutoString unused;
|
||||
attributes->SetStringProperty(NS_LITERAL_CSTRING("layout-guess"),
|
||||
|
||||
@@ -33,6 +33,7 @@ public:
|
||||
virtual uint64_t NativeState() override;
|
||||
virtual uint64_t NativeInteractiveState() const override;
|
||||
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
|
||||
virtual mozilla::a11y::GroupPos GroupPosition() override;
|
||||
|
||||
// TableCellAccessible
|
||||
virtual TableAccessible* Table() const override;
|
||||
@@ -89,6 +90,7 @@ public:
|
||||
|
||||
// Accessible
|
||||
virtual a11y::role NativeRole() override;
|
||||
virtual mozilla::a11y::GroupPos GroupPosition() override;
|
||||
|
||||
protected:
|
||||
virtual ~HTMLTableRowAccessible() { }
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
/**
|
||||
* Defines cross platform (Gecko) roles.
|
||||
*/
|
||||
[scriptable, uuid(55581ec3-ba6e-4805-8108-260ed34cdcbb)]
|
||||
[scriptable, uuid(da0c7824-147c-11e5-917c-60a44c717042)]
|
||||
interface nsIAccessibleRole : nsISupports
|
||||
{
|
||||
/**
|
||||
@@ -920,53 +920,49 @@ interface nsIAccessibleRole : nsISupports
|
||||
*/
|
||||
const unsigned long ROLE_MATHML_ERROR = 157;
|
||||
|
||||
/**
|
||||
* A MathML semantics annotation element (semantics in MathML).
|
||||
*/
|
||||
const unsigned long ROLE_MATHML_SEMANTICS = 158;
|
||||
|
||||
/**
|
||||
* A MathML annotation (annotation in MathML).
|
||||
*/
|
||||
const unsigned long ROLE_MATHML_ANNOTATION = 159;
|
||||
|
||||
/**
|
||||
* A MathML XML annotation (annotation-xml in MathML).
|
||||
*/
|
||||
const unsigned long ROLE_MATHML_XML_ANNOTATION = 160;
|
||||
|
||||
/**
|
||||
* A MathML stacked (rows of numbers) element (mstack in MathML).
|
||||
*/
|
||||
const unsigned long ROLE_MATHML_STACK = 161;
|
||||
const unsigned long ROLE_MATHML_STACK = 158;
|
||||
|
||||
/**
|
||||
* A MathML long division element (mlongdiv in MathML).
|
||||
*/
|
||||
const unsigned long ROLE_MATHML_LONG_DIVISION = 162;
|
||||
const unsigned long ROLE_MATHML_LONG_DIVISION = 159;
|
||||
|
||||
/**
|
||||
* A MathML stack group (msgroup in MathML).
|
||||
*/
|
||||
const unsigned long ROLE_MATHML_STACK_GROUP = 163;
|
||||
const unsigned long ROLE_MATHML_STACK_GROUP = 160;
|
||||
|
||||
/**
|
||||
* A MathML stack row (msrow in MathML).
|
||||
*/
|
||||
const unsigned long ROLE_MATHML_STACK_ROW = 164;
|
||||
const unsigned long ROLE_MATHML_STACK_ROW = 161;
|
||||
|
||||
/**
|
||||
* MathML carries, borrows, or crossouts for a row (mscarries in MathML).
|
||||
*/
|
||||
const unsigned long ROLE_MATHML_STACK_CARRIES = 165;
|
||||
const unsigned long ROLE_MATHML_STACK_CARRIES = 162;
|
||||
|
||||
/**
|
||||
* A MathML carry, borrow, or crossout for a column (mscarry in MathML).
|
||||
*/
|
||||
const unsigned long ROLE_MATHML_STACK_CARRY = 166;
|
||||
const unsigned long ROLE_MATHML_STACK_CARRY = 163;
|
||||
|
||||
/**
|
||||
* A MathML line in a stack (msline in MathML).
|
||||
*/
|
||||
const unsigned long ROLE_MATHML_STACK_LINE = 167;
|
||||
const unsigned long ROLE_MATHML_STACK_LINE = 164;
|
||||
|
||||
/**
|
||||
* A group containing radio buttons
|
||||
*/
|
||||
const unsigned long ROLE_RADIO_GROUP = 165;
|
||||
|
||||
/**
|
||||
* A text container exposing brief amount of information. See related
|
||||
* TEXT_CONTAINER role.
|
||||
*/
|
||||
const unsigned long ROLE_TEXT = 166;
|
||||
};
|
||||
|
||||
@@ -165,6 +165,23 @@ DocAccessibleParent::RecvCaretMoveEvent(const uint64_t& aID, const int32_t& aOff
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DocAccessibleParent::RecvTextChangeEvent(const uint64_t& aID,
|
||||
const nsString& aStr,
|
||||
const int32_t& aStart,
|
||||
const uint32_t& aLen,
|
||||
const bool& aIsInsert,
|
||||
const bool& aFromUser)
|
||||
{
|
||||
ProxyAccessible* target = GetAccessible(aID);
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
ProxyTextChangeEvent(target, aStr, aStart, aLen, aIsInsert, aFromUser);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DocAccessibleParent::RecvBindChildDoc(PDocAccessibleParent* aChildDoc, const uint64_t& aID)
|
||||
{
|
||||
|
||||
@@ -55,6 +55,11 @@ public:
|
||||
virtual bool RecvCaretMoveEvent(const uint64_t& aID, const int32_t& aOffset)
|
||||
override final;
|
||||
|
||||
virtual bool RecvTextChangeEvent(const uint64_t& aID, const nsString& aStr,
|
||||
const int32_t& aStart, const uint32_t& aLen,
|
||||
const bool& aIsInsert,
|
||||
const bool& aFromUser) override;
|
||||
|
||||
virtual bool RecvBindChildDoc(PDocAccessibleParent* aChildDoc, const uint64_t& aID) override;
|
||||
void Unbind()
|
||||
{
|
||||
|
||||
@@ -59,6 +59,8 @@ parent:
|
||||
HideEvent(uint64_t aRootID);
|
||||
StateChangeEvent(uint64_t aID, uint64_t aState, bool aEnabled);
|
||||
CaretMoveEvent(uint64_t aID, int32_t aOffset);
|
||||
TextChangeEvent(uint64_t aID, nsString aStr, int32_t aStart, uint32_t aLen,
|
||||
bool aIsInsert, bool aFromUser);
|
||||
|
||||
/*
|
||||
* Tell the parent document to bind the existing document as a new child
|
||||
|
||||
@@ -108,6 +108,14 @@ private:
|
||||
bool mNativeInited;
|
||||
};
|
||||
|
||||
#if defined(__OBJC__)
|
||||
void FireNativeEvent(mozAccessible* aNativeAcc, uint32_t aEventType);
|
||||
#else
|
||||
void FireNativeEvent(id aNativeAcc, uint32_t aEventType);
|
||||
#endif
|
||||
|
||||
Class GetTypeFromRole(roles::Role aRole);
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#import "mozHTMLAccessible.h"
|
||||
#import "mozTextAccessible.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
AccessibleWrap::
|
||||
@@ -33,8 +34,10 @@ AccessibleWrap::GetNativeObject()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
if (!mNativeInited && !mNativeObject && !IsDefunct() && !AncestorIsFlat())
|
||||
mNativeObject = [[GetNativeType() alloc] initWithAccessible:this];
|
||||
if (!mNativeInited && !mNativeObject && !IsDefunct() && !AncestorIsFlat()) {
|
||||
uintptr_t accWrap = reinterpret_cast<uintptr_t>(this);
|
||||
mNativeObject = [[GetNativeType() alloc] initWithAccessible:accWrap];
|
||||
}
|
||||
|
||||
mNativeInited = true;
|
||||
|
||||
@@ -59,51 +62,7 @@ AccessibleWrap::GetNativeType ()
|
||||
if (IsXULTabpanels())
|
||||
return [mozPaneAccessible class];
|
||||
|
||||
roles::Role role = Role();
|
||||
switch (role) {
|
||||
case roles::PUSHBUTTON:
|
||||
case roles::SPLITBUTTON:
|
||||
case roles::TOGGLE_BUTTON:
|
||||
{
|
||||
// if this button may show a popup, let's make it of the popupbutton type.
|
||||
return HasPopup() ? [mozPopupButtonAccessible class] :
|
||||
[mozButtonAccessible class];
|
||||
}
|
||||
|
||||
case roles::PAGETAB:
|
||||
return [mozButtonAccessible class];
|
||||
|
||||
case roles::CHECKBUTTON:
|
||||
return [mozCheckboxAccessible class];
|
||||
|
||||
case roles::HEADING:
|
||||
return [mozHeadingAccessible class];
|
||||
|
||||
case roles::PAGETABLIST:
|
||||
return [mozTabsAccessible class];
|
||||
|
||||
case roles::ENTRY:
|
||||
case roles::STATICTEXT:
|
||||
case roles::CAPTION:
|
||||
case roles::ACCEL_LABEL:
|
||||
case roles::PASSWORD_TEXT:
|
||||
// normal textfield (static or editable)
|
||||
return [mozTextAccessible class];
|
||||
|
||||
case roles::TEXT_LEAF:
|
||||
return [mozTextLeafAccessible class];
|
||||
|
||||
case roles::LINK:
|
||||
return [mozLinkAccessible class];
|
||||
|
||||
case roles::COMBOBOX:
|
||||
return [mozPopupButtonAccessible class];
|
||||
|
||||
default:
|
||||
return [mozAccessible class];
|
||||
}
|
||||
|
||||
return nil;
|
||||
return GetTypeFromRole(Role());
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
@@ -153,18 +112,7 @@ AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
|
||||
if (!nativeAcc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
switch (eventType) {
|
||||
case nsIAccessibleEvent::EVENT_FOCUS:
|
||||
[nativeAcc didReceiveFocus];
|
||||
break;
|
||||
case nsIAccessibleEvent::EVENT_VALUE_CHANGE:
|
||||
[nativeAcc valueDidChange];
|
||||
break;
|
||||
case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED:
|
||||
case nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED:
|
||||
[nativeAcc selectedTextDidChange];
|
||||
break;
|
||||
}
|
||||
FireNativeEvent(nativeAcc, eventType);
|
||||
|
||||
return NS_OK;
|
||||
|
||||
@@ -274,3 +222,73 @@ AccessibleWrap::AncestorIsFlat()
|
||||
// no parent was flat
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
a11y::FireNativeEvent(mozAccessible* aNativeAcc, uint32_t aEventType)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
switch (aEventType) {
|
||||
case nsIAccessibleEvent::EVENT_FOCUS:
|
||||
[aNativeAcc didReceiveFocus];
|
||||
break;
|
||||
case nsIAccessibleEvent::EVENT_VALUE_CHANGE:
|
||||
[aNativeAcc valueDidChange];
|
||||
break;
|
||||
case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED:
|
||||
case nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED:
|
||||
[aNativeAcc selectedTextDidChange];
|
||||
break;
|
||||
}
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
Class
|
||||
a11y::GetTypeFromRole(roles::Role aRole)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
switch (aRole) {
|
||||
case roles::COMBOBOX:
|
||||
case roles::PUSHBUTTON:
|
||||
case roles::SPLITBUTTON:
|
||||
case roles::TOGGLE_BUTTON:
|
||||
{
|
||||
return [mozButtonAccessible class];
|
||||
}
|
||||
|
||||
case roles::PAGETAB:
|
||||
return [mozButtonAccessible class];
|
||||
|
||||
case roles::CHECKBUTTON:
|
||||
return [mozCheckboxAccessible class];
|
||||
|
||||
case roles::HEADING:
|
||||
return [mozHeadingAccessible class];
|
||||
|
||||
case roles::PAGETABLIST:
|
||||
return [mozTabsAccessible class];
|
||||
|
||||
case roles::ENTRY:
|
||||
case roles::STATICTEXT:
|
||||
case roles::CAPTION:
|
||||
case roles::ACCEL_LABEL:
|
||||
case roles::PASSWORD_TEXT:
|
||||
// normal textfield (static or editable)
|
||||
return [mozTextAccessible class];
|
||||
|
||||
case roles::TEXT_LEAF:
|
||||
return [mozTextLeafAccessible class];
|
||||
|
||||
case roles::LINK:
|
||||
return [mozLinkAccessible class];
|
||||
|
||||
default:
|
||||
return [mozAccessible class];
|
||||
}
|
||||
|
||||
return nil;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include "Platform.h"
|
||||
#include "ProxyAccessible.h"
|
||||
|
||||
#include "nsAppShell.h"
|
||||
|
||||
@@ -34,31 +35,64 @@ PlatformShutdown()
|
||||
}
|
||||
|
||||
void
|
||||
ProxyCreated(ProxyAccessible*, uint32_t)
|
||||
ProxyCreated(ProxyAccessible* aProxy, uint32_t)
|
||||
{
|
||||
// Pass in dummy state for now as retrieving proxy state requires IPC.
|
||||
Class type = GetTypeFromRole(aProxy->Role());
|
||||
uintptr_t accWrap = reinterpret_cast<uintptr_t>(aProxy) | IS_PROXY;
|
||||
mozAccessible* mozWrapper = [[type alloc] initWithAccessible:accWrap];
|
||||
aProxy->SetWrapper(reinterpret_cast<uintptr_t>(mozWrapper));
|
||||
}
|
||||
|
||||
void
|
||||
ProxyDestroyed(ProxyAccessible*)
|
||||
ProxyDestroyed(ProxyAccessible* aProxy)
|
||||
{
|
||||
mozAccessible* wrapper =
|
||||
reinterpret_cast<mozAccessible*>(aProxy->GetWrapper());
|
||||
[wrapper expire];
|
||||
[wrapper release];
|
||||
aProxy->SetWrapper(0);
|
||||
}
|
||||
|
||||
void
|
||||
ProxyEvent(ProxyAccessible*, uint32_t)
|
||||
ProxyEvent(ProxyAccessible* aProxy, uint32_t aEventType)
|
||||
{
|
||||
// ignore everything but focus-changed, value-changed, caret and selection
|
||||
// events for now.
|
||||
if (aEventType != nsIAccessibleEvent::EVENT_FOCUS &&
|
||||
aEventType != nsIAccessibleEvent::EVENT_VALUE_CHANGE &&
|
||||
aEventType != nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED &&
|
||||
aEventType != nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED)
|
||||
return;
|
||||
|
||||
mozAccessible* wrapper =
|
||||
reinterpret_cast<mozAccessible*>(aProxy->GetWrapper());
|
||||
if (wrapper)
|
||||
FireNativeEvent(wrapper, aEventType);
|
||||
}
|
||||
|
||||
void
|
||||
ProxyStateChangeEvent(ProxyAccessible*, uint64_t, bool)
|
||||
ProxyStateChangeEvent(ProxyAccessible* aProxy, uint64_t, bool)
|
||||
{
|
||||
// mac doesn't care about state change events
|
||||
}
|
||||
|
||||
void
|
||||
ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset)
|
||||
{
|
||||
mozAccessible* wrapper =
|
||||
reinterpret_cast<mozAccessible*>(aTarget->GetWrapper());
|
||||
if (wrapper)
|
||||
[wrapper selectedTextDidChange];
|
||||
}
|
||||
|
||||
void
|
||||
ProxyTextChangeEvent(ProxyAccessible*, const nsString&, int32_t, uint32_t,
|
||||
bool, bool)
|
||||
{
|
||||
}
|
||||
}
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
@interface GeckoNSApplication(a11y)
|
||||
-(void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute;
|
||||
|
||||
@@ -30,6 +30,7 @@ LOCAL_INCLUDES += [
|
||||
'/accessible/base',
|
||||
'/accessible/generic',
|
||||
'/accessible/html',
|
||||
'/accessible/ipc',
|
||||
'/accessible/xul',
|
||||
'/layout/generic',
|
||||
'/layout/xul',
|
||||
|
||||
@@ -57,11 +57,14 @@ static const uintptr_t IS_PROXY = 1;
|
||||
mozilla::a11y::role mRole;
|
||||
}
|
||||
|
||||
// return the Accessible for this mozAccessible.
|
||||
- (mozilla::a11y::AccessibleWrap*) getGeckoAccessible;
|
||||
// return the Accessible for this mozAccessible if it exists.
|
||||
- (mozilla::a11y::AccessibleWrap*)getGeckoAccessible;
|
||||
|
||||
// return the ProxyAccessible for this mozAccessible if it exists.
|
||||
- (mozilla::a11y::ProxyAccessible*)getProxyAccessible;
|
||||
|
||||
// inits with the gecko owner.
|
||||
- (id)initWithAccessible:(mozilla::a11y::AccessibleWrap*)geckoParent;
|
||||
- (id)initWithAccessible:(uintptr_t)aGeckoObj;
|
||||
|
||||
// our accessible parent (AXParent)
|
||||
- (id <mozAccessible>)parent;
|
||||
|
||||
@@ -99,15 +99,18 @@ ConvertToNSArray(nsTArray<Accessible*>& aArray)
|
||||
|
||||
@implementation mozAccessible
|
||||
|
||||
- (id)initWithAccessible:(AccessibleWrap*)geckoAccessible
|
||||
- (id)initWithAccessible:(uintptr_t)aGeckoAccessible
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
if ((self = [super init])) {
|
||||
mGeckoAccessible = reinterpret_cast<uintptr_t>(geckoAccessible);
|
||||
mRole = geckoAccessible->Role();
|
||||
mGeckoAccessible = aGeckoAccessible;
|
||||
if (aGeckoAccessible & IS_PROXY)
|
||||
mRole = [self getProxyAccessible]->Role();
|
||||
else
|
||||
mRole = [self getGeckoAccessible]->Role();
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
|
||||
@@ -132,6 +135,15 @@ ConvertToNSArray(nsTArray<Accessible*>& aArray)
|
||||
return reinterpret_cast<AccessibleWrap*>(mGeckoAccessible);
|
||||
}
|
||||
|
||||
- (mozilla::a11y::ProxyAccessible*)getProxyAccessible
|
||||
{
|
||||
// Check if mGeckoAccessible points at a proxy
|
||||
if (!(mGeckoAccessible & IS_PROXY))
|
||||
return nil;
|
||||
|
||||
return reinterpret_cast<ProxyAccessible*>(mGeckoAccessible & ~IS_PROXY);
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (BOOL)accessibilityIsIgnored
|
||||
|
||||
@@ -43,3 +43,9 @@ void
|
||||
a11y::ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
a11y::ProxyTextChangeEvent(ProxyAccessible*, const nsString&, int32_t, uint32_t,
|
||||
bool, bool)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -186,6 +186,11 @@
|
||||
testGroupAttrs("combo1_opt3", 3, 4);
|
||||
testGroupAttrs("combo1_opt4", 4, 4);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ARIA table
|
||||
testGroupAttrs("table_cell", 3, 4);
|
||||
testGroupAttrs("table_row", 2, 2);
|
||||
|
||||
// Test that group position information updates after deleting node.
|
||||
testGroupAttrs("tree4_ti1", 1, 2, 1);
|
||||
testGroupAttrs("tree4_ti2", 2, 2, 1);
|
||||
@@ -442,5 +447,11 @@
|
||||
<input type="radio" style="display: none;" name="group3">
|
||||
<input type="radio" id="radio5" name="group3">
|
||||
</form>
|
||||
|
||||
<div role="table" aria-colcount="4" aria-rowcount="2">
|
||||
<div role="row" id="table_row" aria-rowindex="2">
|
||||
<div role="cell" id="table_cell" aria-colindex="3">cell</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ],
|
||||
children: [
|
||||
{
|
||||
role: ROLE_TEXT_CONTAINER,
|
||||
role: ROLE_TEXT,
|
||||
children: [ { role: ROLE_TEXT_LEAF } ]
|
||||
}
|
||||
]
|
||||
@@ -81,7 +81,7 @@
|
||||
// HTML:address
|
||||
|
||||
obj = {
|
||||
todo_role: ROLE_PARAGRAPH,
|
||||
role: ROLE_TEXT_CONTAINER,
|
||||
interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ],
|
||||
};
|
||||
testElm("address", obj);
|
||||
@@ -188,7 +188,7 @@
|
||||
testElm("blockquote", obj);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// HTML:br
|
||||
// HTML:br contained by paragraph
|
||||
|
||||
obj = {
|
||||
role: ROLE_PARAGRAPH,
|
||||
@@ -1062,7 +1062,7 @@
|
||||
// HTML:pre
|
||||
|
||||
obj = {
|
||||
role: ROLE_PARAGRAPH,
|
||||
role: ROLE_TEXT_CONTAINER,
|
||||
interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ]
|
||||
};
|
||||
testElm("pre", obj);
|
||||
@@ -1087,7 +1087,7 @@
|
||||
// HTML:q
|
||||
|
||||
obj = {
|
||||
role: ROLE_TEXT_CONTAINER,
|
||||
role: ROLE_TEXT,
|
||||
interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ],
|
||||
children: [
|
||||
{ role: ROLE_STATICTEXT }, // left quote
|
||||
@@ -1233,7 +1233,7 @@
|
||||
// HTML:time
|
||||
|
||||
obj = {
|
||||
role: ROLE_TEXT_CONTAINER,
|
||||
role: ROLE_TEXT,
|
||||
attributes: { "xml-roles": "time", "datetime": "2001-05-15 19:00" },
|
||||
interfaces: [ nsIAccessibleText, nsIAccessibleHyperText ]
|
||||
};
|
||||
|
||||
@@ -267,28 +267,10 @@
|
||||
testElm("merror", obj);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// semantics
|
||||
|
||||
obj = {
|
||||
role: ROLE_MATHML_SEMANTICS,
|
||||
};
|
||||
testElm("semantics", obj);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// annotation
|
||||
|
||||
obj = {
|
||||
role: ROLE_MATHML_ANNOTATION,
|
||||
};
|
||||
testElm("annotation", obj);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// annotation-xml
|
||||
|
||||
obj = {
|
||||
role: ROLE_MATHML_XML_ANNOTATION,
|
||||
};
|
||||
testElm("annotation-xml", obj);
|
||||
// semantics, annotation, annotation-xml
|
||||
ok(!isAccessible("semantics"), "semantics should not have accessible");
|
||||
ok(!isAccessible("annotation"), "annotation should not have accessible");
|
||||
ok(!isAccessible("annotation-xml"), "annotation-xml should not have accessible");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// mstack
|
||||
|
||||
@@ -68,9 +68,6 @@ const ROLE_MATHML_TABLE_ROW = nsIAccessibleRole.ROLE_MATHML_TABLE_ROW;
|
||||
const ROLE_MATHML_CELL = nsIAccessibleRole.ROLE_MATHML_CELL;
|
||||
const ROLE_MATHML_ACTION = nsIAccessibleRole.ROLE_MATHML_ACTION;
|
||||
const ROLE_MATHML_ERROR = nsIAccessibleRole.ROLE_MATHML_ERROR;
|
||||
const ROLE_MATHML_SEMANTICS = nsIAccessibleRole.ROLE_MATHML_SEMANTICS;
|
||||
const ROLE_MATHML_ANNOTATION = nsIAccessibleRole.ROLE_MATHML_ANNOTATION;
|
||||
const ROLE_MATHML_XML_ANNOTATION = nsIAccessibleRole.ROLE_MATHML_XML_ANNOTATION;
|
||||
const ROLE_MATHML_STACK = nsIAccessibleRole.ROLE_MATHML_STACK;
|
||||
const ROLE_MATHML_LONG_DIVISION = nsIAccessibleRole.ROLE_MATHML_LONG_DIVISION;
|
||||
const ROLE_MATHML_STACK_GROUP = nsIAccessibleRole.ROLE_MATHML_STACK_GROUP;
|
||||
@@ -96,6 +93,7 @@ const ROLE_PROGRESSBAR = nsIAccessibleRole.ROLE_PROGRESSBAR;
|
||||
const ROLE_PROPERTYPAGE = nsIAccessibleRole.ROLE_PROPERTYPAGE;
|
||||
const ROLE_PUSHBUTTON = nsIAccessibleRole.ROLE_PUSHBUTTON;
|
||||
const ROLE_RADIOBUTTON = nsIAccessibleRole.ROLE_RADIOBUTTON;
|
||||
const ROLE_RADIO_GROUP = nsIAccessibleRole.ROLE_RADIO_GROUP;
|
||||
const ROLE_RADIO_MENU_ITEM = nsIAccessibleRole.ROLE_RADIO_MENU_ITEM;
|
||||
const ROLE_RICH_OPTION = nsIAccessibleRole.ROLE_RICH_OPTION;
|
||||
const ROLE_ROW = nsIAccessibleRole.ROLE_ROW;
|
||||
@@ -110,6 +108,7 @@ const ROLE_STATUSBAR = nsIAccessibleRole.ROLE_STATUSBAR;
|
||||
const ROLE_SWITCH = nsIAccessibleRole.ROLE_SWITCH;
|
||||
const ROLE_TABLE = nsIAccessibleRole.ROLE_TABLE;
|
||||
const ROLE_TERM = nsIAccessibleRole.ROLE_TERM;
|
||||
const ROLE_TEXT = nsIAccessibleRole.ROLE_TEXT;
|
||||
const ROLE_TEXT_CONTAINER = nsIAccessibleRole.ROLE_TEXT_CONTAINER;
|
||||
const ROLE_TEXT_LEAF = nsIAccessibleRole.ROLE_TEXT_LEAF;
|
||||
const ROLE_TOGGLE_BUTTON = nsIAccessibleRole.ROLE_TOGGLE_BUTTON;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
testRole("aria_list", ROLE_LIST);
|
||||
testRole("aria_listbox", ROLE_LISTBOX);
|
||||
testRole("aria_listitem", ROLE_LISTITEM);
|
||||
testRole("aria_log", ROLE_TEXT_CONTAINER); // weak role
|
||||
testRole("aria_log", ROLE_TEXT); // weak role
|
||||
testRole("aria_marquee", ROLE_ANIMATION);
|
||||
testRole("aria_math", ROLE_FLAT_EQUATION);
|
||||
testRole("aria_menu", ROLE_MENUPOPUP);
|
||||
@@ -48,10 +48,10 @@
|
||||
testRole("aria_menuitemcheckbox", ROLE_CHECK_MENU_ITEM);
|
||||
testRole("aria_menuitemradio", ROLE_RADIO_MENU_ITEM);
|
||||
testRole("aria_note", ROLE_NOTE);
|
||||
testRole("aria_presentation", ROLE_TEXT_CONTAINER); // weak role
|
||||
testRole("aria_presentation", ROLE_TEXT); // weak role
|
||||
testRole("aria_progressbar", ROLE_PROGRESSBAR);
|
||||
testRole("aria_radio", ROLE_RADIOBUTTON);
|
||||
testRole("aria_radiogroup", ROLE_GROUPING);
|
||||
testRole("aria_radiogroup", ROLE_RADIO_GROUP);
|
||||
testRole("aria_region", ROLE_PANE);
|
||||
testRole("aria_row", ROLE_ROW);
|
||||
testRole("aria_rowheader", ROLE_ROWHEADER);
|
||||
@@ -66,7 +66,7 @@
|
||||
testRole("aria_tablist", ROLE_PAGETABLIST);
|
||||
testRole("aria_tabpanel", ROLE_PROPERTYPAGE);
|
||||
testRole("aria_textbox", ROLE_ENTRY);
|
||||
testRole("aria_timer", ROLE_TEXT_CONTAINER); // weak role
|
||||
testRole("aria_timer", ROLE_TEXT); // weak role
|
||||
testRole("aria_toolbar", ROLE_TOOLBAR);
|
||||
testRole("aria_tooltip", ROLE_TOOLTIP);
|
||||
testRole("aria_tree", ROLE_OUTLINE);
|
||||
|
||||
@@ -67,9 +67,9 @@
|
||||
testRole("definitiondescription", ROLE_DEFINITION);
|
||||
|
||||
// Has click, mousedown or mouseup listeners.
|
||||
testRole("span1", ROLE_TEXT_CONTAINER);
|
||||
testRole("span2", ROLE_TEXT_CONTAINER);
|
||||
testRole("span3", ROLE_TEXT_CONTAINER);
|
||||
testRole("span1", ROLE_TEXT);
|
||||
testRole("span2", ROLE_TEXT);
|
||||
testRole("span3", ROLE_TEXT);
|
||||
|
||||
// Test role of listbox inside combobox
|
||||
testRole("listbox1", ROLE_COMBOBOX_LIST);
|
||||
|
||||
@@ -27,6 +27,13 @@ const kNoColumnHeader = 0;
|
||||
const kListboxColumnHeader = 1;
|
||||
const kTreeColumnHeader = 2;
|
||||
|
||||
/**
|
||||
* Constants to define table type.
|
||||
*/
|
||||
const kTable = 0;
|
||||
const kTreeTable = 1;
|
||||
const kMathTable = 2;
|
||||
|
||||
/**
|
||||
* Test table structure and related methods.
|
||||
*
|
||||
@@ -37,10 +44,11 @@ const kTreeColumnHeader = 2;
|
||||
* arranged into the list.
|
||||
* @param aCaption [in] caption text if any
|
||||
* @param aSummary [in] summary text if any
|
||||
* @param aIsTreeTable [in] specifies whether given table is tree table
|
||||
* @param aTableType [in] specifies the table type.
|
||||
* @param aRowRoles [in] array of row roles.
|
||||
*/
|
||||
function testTableStruct(aIdentifier, aCellsArray, aColHeaderType,
|
||||
aCaption, aSummary, aIsTreeTable)
|
||||
aCaption, aSummary, aTableType, aRowRoles)
|
||||
{
|
||||
var tableNode = getNode(aIdentifier);
|
||||
var isGrid = tableNode.getAttribute("role") == "grid" ||
|
||||
@@ -52,9 +60,19 @@ function testTableStruct(aIdentifier, aCellsArray, aColHeaderType,
|
||||
|
||||
// Test table accessible tree.
|
||||
var tableObj = {
|
||||
role: aIsTreeTable ? ROLE_TREE_TABLE : ROLE_TABLE,
|
||||
children: []
|
||||
};
|
||||
switch (aTableType) {
|
||||
case kTable:
|
||||
tableObj.role = ROLE_TABLE;
|
||||
break;
|
||||
case kTreeTable:
|
||||
tableObj.role = ROLE_TREE_TABLE;
|
||||
break;
|
||||
case kMathTable:
|
||||
tableObj.role = ROLE_MATHML_TABLE;
|
||||
break;
|
||||
}
|
||||
|
||||
// caption accessible handling
|
||||
if (aCaption) {
|
||||
@@ -99,7 +117,7 @@ function testTableStruct(aIdentifier, aCellsArray, aColHeaderType,
|
||||
// rows and cells accessibles
|
||||
for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
|
||||
var rowObj = {
|
||||
role: ROLE_ROW,
|
||||
role: aRowRoles ? aRowRoles[rowIdx] : ROLE_ROW,
|
||||
children: []
|
||||
};
|
||||
|
||||
@@ -109,7 +127,8 @@ function testTableStruct(aIdentifier, aCellsArray, aColHeaderType,
|
||||
var role = ROLE_NOTHING;
|
||||
switch (celltype) {
|
||||
case kDataCell:
|
||||
role = (isGrid ? ROLE_GRID_CELL : ROLE_CELL);
|
||||
role = (aTableType == kMathTable ? ROLE_MATHML_CELL :
|
||||
(isGrid ? ROLE_GRID_CELL : ROLE_CELL));
|
||||
break;
|
||||
case kRowHeaderCell:
|
||||
role = ROLE_ROWHEADER;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
[test_indexes_table.html]
|
||||
[test_indexes_tree.xul]
|
||||
[test_layoutguess.html]
|
||||
[test_mtable.html]
|
||||
[test_sels_ariagrid.html]
|
||||
[test_sels_listbox.xul]
|
||||
[test_sels_table.html]
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>MathML table tests</title>
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../role.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../table.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
{
|
||||
// 'Simple' table
|
||||
var idxes = [
|
||||
[0, 1],
|
||||
[2, 3]
|
||||
];
|
||||
testTableIndexes("simple", idxes);
|
||||
var cellsArray = [
|
||||
[kDataCell, kDataCell],
|
||||
[kDataCell, kDataCell]
|
||||
];
|
||||
var rowsArray = [ROLE_MATHML_TABLE_ROW, ROLE_MATHML_TABLE_ROW];
|
||||
testTableStruct("simple", cellsArray, kNoColumnHeader,
|
||||
"", "", kMathTable, rowsArray);
|
||||
|
||||
// 'Complex' table
|
||||
idxes = [
|
||||
[0, 0, 0],
|
||||
[1, 1, 2],
|
||||
[1, 1, 3]
|
||||
];
|
||||
testTableIndexes("complex", idxes);
|
||||
cellsArray = [
|
||||
[kDataCell, kColSpanned, kColSpanned],
|
||||
[kDataCell, kColSpanned, kDataCell],
|
||||
[kRowSpanned, kSpanned, kDataCell],
|
||||
];
|
||||
rowsArray = [
|
||||
ROLE_MATHML_TABLE_ROW,
|
||||
ROLE_MATHML_TABLE_ROW,
|
||||
ROLE_MATHML_TABLE_ROW
|
||||
];
|
||||
testTableStruct("complex", cellsArray, kNoColumnHeader,
|
||||
"", "", kMathTable, rowsArray);
|
||||
|
||||
// 'Simple' table with mlabeledtr
|
||||
// At the moment we do not implement mlabeledtr but just hide the label
|
||||
// with display: none. Thus we just test the role for now. See bug 689641.
|
||||
var idxes = [[0]];
|
||||
testTableIndexes("simple_label", idxes);
|
||||
var cellsArray = [[kDataCell]];
|
||||
rowsArray = [ROLE_MATHML_LABELED_ROW];
|
||||
testTableStruct("simple_label", cellsArray, kNoColumnHeader,
|
||||
"", "", kMathTable, rowsArray);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<math>
|
||||
<mtable id="simple">
|
||||
<mtr>
|
||||
<mtd>
|
||||
<mn>1</mn>
|
||||
</mtd>
|
||||
<mtd>
|
||||
<mn>0</mn>
|
||||
</mtd>
|
||||
</mtr>
|
||||
<mtr>
|
||||
<mtd>
|
||||
<mn>0</mn>
|
||||
</mtd>
|
||||
<mtd>
|
||||
<mn>1</mn>
|
||||
</mtd>
|
||||
</mtr>
|
||||
</mtable>
|
||||
|
||||
<mtable id="complex">
|
||||
<mtr>
|
||||
<mtd columnspan="3">
|
||||
<mtext>1 x 3</mtext>
|
||||
</mtd>
|
||||
</mtr>
|
||||
<mtr>
|
||||
<mtd rowspan="2" columnspan="2">
|
||||
<mtext>2 x 2</mtext>
|
||||
</mtd>
|
||||
<mtd>
|
||||
<mtext>1 x 1</mtext>
|
||||
</mtd>
|
||||
</mtr>
|
||||
<mtr>
|
||||
<mtd>
|
||||
<mtext>1 x 1</mtext>
|
||||
</mtd>
|
||||
</mtr>
|
||||
</mtable>
|
||||
|
||||
<mtable id="simple_label">
|
||||
<mlabeledtr>
|
||||
<mtd><mtext>1</mtext></mtd>
|
||||
<mtd><mtext>label</mtext></mtd>
|
||||
</mlabeledtr>
|
||||
</mtable>
|
||||
</math>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -28,7 +28,8 @@
|
||||
[kDataCell, kDataCell, kDataCell]
|
||||
];
|
||||
|
||||
testTableStruct("treegrid", cellsArray, kNoColumnHeader, "", "", true);
|
||||
testTableStruct("treegrid", cellsArray, kNoColumnHeader, "", "",
|
||||
kTreeTable);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
role: ROLE_LIST,
|
||||
children: [
|
||||
{ // li
|
||||
role: ROLE_PARAGRAPH,
|
||||
role: ROLE_TEXT_CONTAINER,
|
||||
children: [
|
||||
{ // li text leaf
|
||||
role: ROLE_TEXT_LEAF,
|
||||
|
||||
@@ -73,10 +73,10 @@
|
||||
// Presentation list, expose generic accesisble for list items.
|
||||
tree =
|
||||
{ SECTION: [ // container
|
||||
{ PARAGRAPH: [ // li generic accessible inside 'presentation' role
|
||||
{ TEXT_CONTAINER: [ // li generic accessible inside 'presentation' role
|
||||
{ TEXT_LEAF: [ ] } // li text
|
||||
] },
|
||||
{ PARAGRAPH: [ // li generic accessible inside 'none' role
|
||||
{ TEXT_CONTAINER: [ // li generic accessible inside 'none' role
|
||||
{ TEXT_LEAF: [ ] } // li text
|
||||
] }
|
||||
] };
|
||||
|
||||
@@ -20,15 +20,15 @@
|
||||
{
|
||||
var tree =
|
||||
{ DOCUMENT: [
|
||||
{ PARAGRAPH: [ // head
|
||||
{ PARAGRAPH: [ // link
|
||||
{ TEXT_CONTAINER: [ // head
|
||||
{ TEXT_CONTAINER: [ // link
|
||||
{ STATICTEXT: [] }, // generated content
|
||||
{ STATICTEXT: [] } // generated content
|
||||
] }
|
||||
] },
|
||||
{ TEXT_LEAF: [ ] }, // body text
|
||||
{ ENTRY: [ ] }, // input under document element
|
||||
{ PARAGRAPH: [ // link under document element
|
||||
{ TEXT_CONTAINER: [ // link under document element
|
||||
{ TEXT_LEAF: [ ] }, // link content
|
||||
{ STATICTEXT: [ ] }, // generated content
|
||||
{ STATICTEXT: [ ] } // generated content
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
// radiogroup
|
||||
accTree = {
|
||||
role: ROLE_GROUPING,
|
||||
role: ROLE_RADIO_GROUP,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_RADIOBUTTON,
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
document.getElementsByTagName("img")[0].firstChild.data = "2";
|
||||
|
||||
var accTree = {
|
||||
role: ROLE_TEXT_CONTAINER,
|
||||
role: ROLE_TEXT,
|
||||
children: [ { role: ROLE_TEXT_LEAF } ]
|
||||
};
|
||||
testAccessibleTree("the_img", accTree);
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
children: []
|
||||
},
|
||||
{ // abbr tag
|
||||
role: ROLE_TEXT_CONTAINER,
|
||||
role: ROLE_TEXT,
|
||||
name: "accessibility",
|
||||
children: [
|
||||
{ // text leaf with actual text
|
||||
@@ -150,7 +150,7 @@
|
||||
children: []
|
||||
},
|
||||
{ // acronym tag
|
||||
role: ROLE_TEXT_CONTAINER,
|
||||
role: ROLE_TEXT,
|
||||
name: "personal computer",
|
||||
children: [
|
||||
{ // text leaf with actual text
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
function removeTextData(aID)
|
||||
function removeTextData(aID, aRole)
|
||||
{
|
||||
this.containerNode = getNode(aID);
|
||||
this.textNode = this.containerNode.firstChild;
|
||||
@@ -96,7 +96,7 @@
|
||||
this.invoke = function removeTextData_invoke()
|
||||
{
|
||||
var tree = {
|
||||
role: ROLE_PARAGRAPH,
|
||||
role: aRole,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_TEXT_LEAF,
|
||||
@@ -112,7 +112,7 @@
|
||||
this.finalCheck = function removeTextData_finalCheck()
|
||||
{
|
||||
var tree = {
|
||||
role: ROLE_PARAGRAPH,
|
||||
role: aRole,
|
||||
children: []
|
||||
};
|
||||
testAccessibleTree(this.containerNode, tree);
|
||||
@@ -147,8 +147,8 @@
|
||||
gQueue.push(new setOnClickNRoleAttrs("span"));
|
||||
|
||||
// text data removal of text node should remove its text accessible
|
||||
gQueue.push(new removeTextData("p"));
|
||||
gQueue.push(new removeTextData("pre"));
|
||||
gQueue.push(new removeTextData("p", ROLE_PARAGRAPH));
|
||||
gQueue.push(new removeTextData("pre", ROLE_TEXT_CONTAINER));
|
||||
|
||||
gQueue.invoke(); // SimpleTest.finish() will be called in the end
|
||||
}
|
||||
|
||||
@@ -68,3 +68,9 @@ void
|
||||
a11y::ProxyCaretMoveEvent(ProxyAccessible* aTarget, int32_t aOffset)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
a11y::ProxyTextChangeEvent(ProxyAccessible*, const nsString&, int32_t, uint32_t,
|
||||
bool, bool)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ xpcAccessibleTable::GetSelectedCells(nsIArray** aSelectedCells)
|
||||
if (!Intl())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NS_IMETHODIMP rv = NS_OK;
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIMutableArray> selCells =
|
||||
do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@@ -472,7 +472,7 @@ XULRadioGroupAccessible::
|
||||
role
|
||||
XULRadioGroupAccessible::NativeRole()
|
||||
{
|
||||
return roles::GROUPING;
|
||||
return roles::RADIO_GROUP;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
|
||||
@@ -219,6 +219,13 @@ RunProcesses(int argc, const char *argv[], FdArray& aReservedFds)
|
||||
aReservedFds);
|
||||
}
|
||||
|
||||
// Reap zombie child process.
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = SIG_IGN;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sa.sa_flags = 0;
|
||||
sigaction(SIGCHLD, &sa, nullptr);
|
||||
|
||||
// The b2g process
|
||||
int childPid = pid;
|
||||
XRE_ProcLoaderClientInit(childPid, parentSock, aReservedFds);
|
||||
|
||||
@@ -732,13 +732,11 @@ pref("hal.processPriorityManager.gonk.notifyLowMemUnderKB", 14336);
|
||||
// blocked on a poll(), and this pref has no effect.)
|
||||
pref("gonk.systemMemoryPressureRecoveryPollMS", 5000);
|
||||
|
||||
#ifndef DEBUG
|
||||
// Enable pre-launching content processes for improved startup time
|
||||
// (hiding latency).
|
||||
pref("dom.ipc.processPrelaunch.enabled", true);
|
||||
// Wait this long before pre-launching a new subprocess.
|
||||
pref("dom.ipc.processPrelaunch.delayMs", 5000);
|
||||
#endif
|
||||
|
||||
pref("dom.ipc.reuse_parent_app", false);
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsILoadContext.h"
|
||||
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
@@ -91,7 +90,7 @@ nsMacShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@ enum DomainSetType{
|
||||
SUPER_WHITELIST
|
||||
};
|
||||
|
||||
class DomainSet : public nsIDomainSet
|
||||
class DomainSet final : public nsIDomainSet
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
@@ -51,7 +51,7 @@ protected:
|
||||
DomainSetType mType;
|
||||
};
|
||||
|
||||
class DomainPolicy : public nsIDomainPolicy
|
||||
class DomainPolicy final : public nsIDomainPolicy
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
@@ -3037,7 +3037,9 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
|
||||
if (shell) {
|
||||
// single-click
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
InternalUIEvent actEvent(mouseEvent->mFlags.mIsTrusted, NS_UI_ACTIVATE);
|
||||
// DOMActive event should be trusted since the activation is actually
|
||||
// occurred even if the cause is an untrusted click event.
|
||||
InternalUIEvent actEvent(true, NS_UI_ACTIVATE, mouseEvent);
|
||||
actEvent.detail = 1;
|
||||
|
||||
rv = shell->HandleDOMEventWithTarget(this, &actEvent, &status);
|
||||
@@ -3053,9 +3055,10 @@ Element::PostHandleEventForLinks(EventChainPostVisitor& aVisitor)
|
||||
if (aVisitor.mEvent->originalTarget == this) {
|
||||
nsAutoString target;
|
||||
GetLinkTarget(target);
|
||||
const InternalUIEvent* activeEvent = aVisitor.mEvent->AsUIEvent();
|
||||
MOZ_ASSERT(activeEvent);
|
||||
nsContentUtils::TriggerLink(this, aVisitor.mPresContext, absURI, target,
|
||||
true, true,
|
||||
aVisitor.mEvent->mFlags.mIsTrusted);
|
||||
true, true, activeEvent->IsTrustable());
|
||||
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -833,6 +833,8 @@ nsIContent::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (stopEvent) {
|
||||
|
||||
+21
-20
@@ -671,9 +671,9 @@ nsContentUtils::InitializeModifierStrings()
|
||||
static bool
|
||||
ShouldAddEventToStringEventTable(const EventNameMapping& aMapping)
|
||||
{
|
||||
switch(aMapping.mId) {
|
||||
#define ID_TO_EVENT(name_, id_, type_, struct_) \
|
||||
case id_: return nsGkAtoms::on##name_ == aMapping.mAtom;
|
||||
switch(aMapping.mMessage) {
|
||||
#define ID_TO_EVENT(name_, message_, type_, struct_) \
|
||||
case message_: return nsGkAtoms::on##name_ == aMapping.mAtom;
|
||||
#include "mozilla/EventNameList.h"
|
||||
#undef ID_TO_EVENT
|
||||
default:
|
||||
@@ -688,8 +688,8 @@ nsContentUtils::InitializeEventTable() {
|
||||
NS_ASSERTION(!sStringEventTable, "EventTable already initialized!");
|
||||
|
||||
static const EventNameMapping eventArray[] = {
|
||||
#define EVENT(name_, _id, _type, _class) \
|
||||
{ nsGkAtoms::on##name_, _id, _type, _class },
|
||||
#define EVENT(name_, _message, _type, _class) \
|
||||
{ nsGkAtoms::on##name_, _type, _message, _class },
|
||||
#define WINDOW_ONLY_EVENT EVENT
|
||||
#define NON_IDL_EVENT EVENT
|
||||
#include "mozilla/EventNameList.h"
|
||||
@@ -725,9 +725,9 @@ nsContentUtils::InitializeTouchEventTable()
|
||||
if (!sEventTableInitialized && sAtomEventTable && sStringEventTable) {
|
||||
sEventTableInitialized = true;
|
||||
static const EventNameMapping touchEventArray[] = {
|
||||
#define EVENT(name_, _id, _type, _class)
|
||||
#define TOUCH_EVENT(name_, _id, _type, _class) \
|
||||
{ nsGkAtoms::on##name_, _id, _type, _class },
|
||||
#define EVENT(name_, _message, _type, _class)
|
||||
#define TOUCH_EVENT(name_, _message, _type, _class) \
|
||||
{ nsGkAtoms::on##name_, _type, _message, _class },
|
||||
#include "mozilla/EventNameList.h"
|
||||
#undef TOUCH_EVENT
|
||||
#undef EVENT
|
||||
@@ -3667,13 +3667,13 @@ nsContentUtils::IsEventAttributeName(nsIAtom* aName, int32_t aType)
|
||||
}
|
||||
|
||||
// static
|
||||
uint32_t
|
||||
nsContentUtils::GetEventId(nsIAtom* aName)
|
||||
EventMessage
|
||||
nsContentUtils::GetEventMessage(nsIAtom* aName)
|
||||
{
|
||||
if (aName) {
|
||||
EventNameMapping mapping;
|
||||
if (sAtomEventTable->Get(aName, &mapping)) {
|
||||
return mapping.mId;
|
||||
return mapping.mMessage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3692,14 +3692,15 @@ nsContentUtils::GetEventClassID(const nsAString& aName)
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
nsContentUtils::GetEventIdAndAtom(const nsAString& aName,
|
||||
mozilla::EventClassID aEventClassID,
|
||||
uint32_t* aEventID)
|
||||
nsContentUtils::GetEventMessageAndAtom(const nsAString& aName,
|
||||
mozilla::EventClassID aEventClassID,
|
||||
EventMessage* aEventMessage)
|
||||
{
|
||||
EventNameMapping mapping;
|
||||
if (sStringEventTable->Get(aName, &mapping)) {
|
||||
*aEventID = mapping.mEventClassID == aEventClassID ? mapping.mId :
|
||||
NS_USER_DEFINED_EVENT;
|
||||
*aEventMessage =
|
||||
mapping.mEventClassID == aEventClassID ? mapping.mMessage :
|
||||
NS_USER_DEFINED_EVENT;
|
||||
return mapping.mAtom;
|
||||
}
|
||||
|
||||
@@ -3712,11 +3713,11 @@ nsContentUtils::GetEventIdAndAtom(const nsAString& aName,
|
||||
}
|
||||
}
|
||||
|
||||
*aEventID = NS_USER_DEFINED_EVENT;
|
||||
*aEventMessage = NS_USER_DEFINED_EVENT;
|
||||
nsCOMPtr<nsIAtom> atom = NS_AtomizeMainThread(NS_LITERAL_STRING("on") + aName);
|
||||
sUserDefinedEvents->AppendObject(atom);
|
||||
mapping.mAtom = atom;
|
||||
mapping.mId = NS_USER_DEFINED_EVENT;
|
||||
mapping.mMessage = NS_USER_DEFINED_EVENT;
|
||||
mapping.mType = EventNameType_None;
|
||||
mapping.mEventClassID = eBasicEventClass;
|
||||
sStringEventTable->Put(aName, mapping);
|
||||
@@ -7657,7 +7658,7 @@ nsContentUtils::SendKeyEvent(nsCOMPtr<nsIWidget> aWidget,
|
||||
if (!aWidget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
int32_t msg;
|
||||
EventMessage msg;
|
||||
if (aType.EqualsLiteral("keydown"))
|
||||
msg = NS_KEY_DOWN;
|
||||
else if (aType.EqualsLiteral("keyup"))
|
||||
@@ -7770,7 +7771,7 @@ nsContentUtils::SendMouseEvent(nsCOMPtr<nsIPresShell> aPresShell,
|
||||
if (!widget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
int32_t msg;
|
||||
EventMessage msg;
|
||||
bool contextMenuKey = false;
|
||||
if (aType.EqualsLiteral("mousedown"))
|
||||
msg = NS_MOUSE_BUTTON_DOWN;
|
||||
|
||||
@@ -165,8 +165,8 @@ struct EventNameMapping
|
||||
// This holds pointers to nsGkAtoms members, and is therefore safe as a
|
||||
// non-owning reference.
|
||||
nsIAtom* MOZ_NON_OWNING_REF mAtom;
|
||||
uint32_t mId;
|
||||
int32_t mType;
|
||||
mozilla::EventMessage mMessage;
|
||||
mozilla::EventClassID mEventClassID;
|
||||
};
|
||||
|
||||
@@ -1138,13 +1138,13 @@ public:
|
||||
static bool IsEventAttributeName(nsIAtom* aName, int32_t aType);
|
||||
|
||||
/**
|
||||
* Return the event id for the event with the given name. The name is the
|
||||
* event name with the 'on' prefix. Returns NS_USER_DEFINED_EVENT if the
|
||||
* Return the event message for the event with the given name. The name is
|
||||
* the event name with the 'on' prefix. Returns NS_USER_DEFINED_EVENT if the
|
||||
* event doesn't match a known event name.
|
||||
*
|
||||
* @param aName the event name to look up
|
||||
*/
|
||||
static uint32_t GetEventId(nsIAtom* aName);
|
||||
static mozilla::EventMessage GetEventMessage(nsIAtom* aName);
|
||||
|
||||
/**
|
||||
* Return the EventClassID for the event with the given name. The name is the
|
||||
@@ -1156,7 +1156,7 @@ public:
|
||||
static mozilla::EventClassID GetEventClassID(const nsAString& aName);
|
||||
|
||||
/**
|
||||
* Return the event id and atom for the event with the given name.
|
||||
* Return the event message and atom for the event with the given name.
|
||||
* The name is the event name *without* the 'on' prefix.
|
||||
* Returns NS_USER_DEFINED_EVENT on the aEventID if the
|
||||
* event doesn't match a known event name in the category.
|
||||
@@ -1164,9 +1164,9 @@ public:
|
||||
* @param aName the event name to look up
|
||||
* @param aEventClassID only return event id for aEventClassID
|
||||
*/
|
||||
static nsIAtom* GetEventIdAndAtom(const nsAString& aName,
|
||||
mozilla::EventClassID aEventClassID,
|
||||
uint32_t* aEventID);
|
||||
static nsIAtom* GetEventMessageAndAtom(const nsAString& aName,
|
||||
mozilla::EventClassID aEventClassID,
|
||||
mozilla::EventMessage* aEventMessage);
|
||||
|
||||
/**
|
||||
* Used only during traversal of the XPCOM graph by the cycle
|
||||
|
||||
@@ -625,14 +625,18 @@ IsSelectionInsideRuby(nsISelection* aSelection)
|
||||
}
|
||||
|
||||
bool
|
||||
nsCopySupport::FireClipboardEvent(int32_t aType, int32_t aClipboardType, nsIPresShell* aPresShell,
|
||||
nsISelection* aSelection, bool* aActionTaken)
|
||||
nsCopySupport::FireClipboardEvent(EventMessage aEventMessage,
|
||||
int32_t aClipboardType,
|
||||
nsIPresShell* aPresShell,
|
||||
nsISelection* aSelection,
|
||||
bool* aActionTaken)
|
||||
{
|
||||
if (aActionTaken) {
|
||||
*aActionTaken = false;
|
||||
}
|
||||
|
||||
NS_ASSERTION(aType == NS_CUT || aType == NS_COPY || aType == NS_PASTE,
|
||||
NS_ASSERTION(aEventMessage == NS_CUT || aEventMessage == NS_COPY ||
|
||||
aEventMessage == NS_PASTE,
|
||||
"Invalid clipboard event type");
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell = aPresShell;
|
||||
@@ -688,10 +692,11 @@ nsCopySupport::FireClipboardEvent(int32_t aType, int32_t aClipboardType, nsIPres
|
||||
nsRefPtr<DataTransfer> clipboardData;
|
||||
if (chromeShell || Preferences::GetBool("dom.event.clipboardevents.enabled", true)) {
|
||||
clipboardData =
|
||||
new DataTransfer(piWindow, aType, aType == NS_PASTE, aClipboardType);
|
||||
new DataTransfer(piWindow, aEventMessage, aEventMessage == NS_PASTE,
|
||||
aClipboardType);
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
InternalClipboardEvent evt(true, aType);
|
||||
InternalClipboardEvent evt(true, aEventMessage);
|
||||
evt.clipboardData = clipboardData;
|
||||
EventDispatcher::Dispatch(content, presShell->GetPresContext(), &evt,
|
||||
nullptr, &status);
|
||||
@@ -702,7 +707,7 @@ nsCopySupport::FireClipboardEvent(int32_t aType, int32_t aClipboardType, nsIPres
|
||||
// No need to do anything special during a paste. Either an event listener
|
||||
// took care of it and cancelled the event, or the caller will handle it.
|
||||
// Return true to indicate that the event wasn't cancelled.
|
||||
if (aType == NS_PASTE) {
|
||||
if (aEventMessage == NS_PASTE) {
|
||||
// Clear and mark the clipboardData as readonly. This prevents someone
|
||||
// from reading the clipboard contents after the paste event has fired.
|
||||
if (clipboardData) {
|
||||
@@ -742,7 +747,7 @@ nsCopySupport::FireClipboardEvent(int32_t aType, int32_t aClipboardType, nsIPres
|
||||
|
||||
// when cutting non-editable content, do nothing
|
||||
// XXX this is probably the wrong editable flag to check
|
||||
if (aType != NS_CUT || content->IsEditable()) {
|
||||
if (aEventMessage != NS_CUT || content->IsEditable()) {
|
||||
// get the data from the selection if any
|
||||
bool isCollapsed;
|
||||
sel->GetIsCollapsed(&isCollapsed);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef nsCopySupport_h__
|
||||
#define nsCopySupport_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
|
||||
class nsINode;
|
||||
class nsISelection;
|
||||
@@ -64,7 +64,7 @@ class nsCopySupport
|
||||
|
||||
/**
|
||||
* Fires a cut, copy or paste event, on the given presshell, depending
|
||||
* on the value of aType, which should be either NS_CUT, NS_COPY or
|
||||
* on the value of aEventMessage, which should be either NS_CUT, NS_COPY or
|
||||
* NS_PASTE, and perform the default copy action if the event was not
|
||||
* cancelled.
|
||||
*
|
||||
@@ -88,7 +88,7 @@ class nsCopySupport
|
||||
*
|
||||
* If the event is cancelled or an error occurs, false will be returned.
|
||||
*/
|
||||
static bool FireClipboardEvent(int32_t aType,
|
||||
static bool FireClipboardEvent(mozilla::EventMessage aEventMessage,
|
||||
int32_t aClipboardType,
|
||||
nsIPresShell* aPresShell,
|
||||
nsISelection* aSelection,
|
||||
|
||||
@@ -698,7 +698,7 @@ nsDOMWindowUtils::SendPointerEventCommon(const nsAString& aType,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
int32_t msg;
|
||||
EventMessage msg;
|
||||
if (aType.EqualsLiteral("pointerdown")) {
|
||||
msg = NS_POINTER_DOWN;
|
||||
} else if (aType.EqualsLiteral("pointerup")) {
|
||||
@@ -977,7 +977,7 @@ nsDOMWindowUtils::SendTouchEventCommon(const nsAString& aType,
|
||||
if (!widget) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
int32_t msg;
|
||||
EventMessage msg;
|
||||
if (aType.EqualsLiteral("touchstart")) {
|
||||
msg = NS_TOUCH_START;
|
||||
} else if (aType.EqualsLiteral("touchmove")) {
|
||||
@@ -1312,7 +1312,7 @@ nsDOMWindowUtils::SendSimpleGestureEvent(const nsAString& aType,
|
||||
if (!widget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
int32_t msg;
|
||||
EventMessage msg;
|
||||
if (aType.EqualsLiteral("MozSwipeGestureStart"))
|
||||
msg = NS_SIMPLE_GESTURE_SWIPE_START;
|
||||
else if (aType.EqualsLiteral("MozSwipeGestureUpdate"))
|
||||
@@ -1931,13 +1931,28 @@ nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (aType != NS_QUERY_SELECTED_TEXT &&
|
||||
aType != NS_QUERY_TEXT_CONTENT &&
|
||||
aType != NS_QUERY_CARET_RECT &&
|
||||
aType != NS_QUERY_TEXT_RECT &&
|
||||
aType != NS_QUERY_EDITOR_RECT &&
|
||||
aType != NS_QUERY_CHARACTER_AT_POINT) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
EventMessage message;
|
||||
switch (aType) {
|
||||
case QUERY_SELECTED_TEXT:
|
||||
message = NS_QUERY_SELECTED_TEXT;
|
||||
break;
|
||||
case QUERY_TEXT_CONTENT:
|
||||
message = NS_QUERY_TEXT_CONTENT;
|
||||
break;
|
||||
case QUERY_CARET_RECT:
|
||||
message = NS_QUERY_CARET_RECT;
|
||||
break;
|
||||
case QUERY_TEXT_RECT:
|
||||
message = NS_QUERY_TEXT_RECT;
|
||||
break;
|
||||
case QUERY_EDITOR_RECT:
|
||||
message = NS_QUERY_EDITOR_RECT;
|
||||
break;
|
||||
case QUERY_CHARACTER_AT_POINT:
|
||||
message = NS_QUERY_CHARACTER_AT_POINT;
|
||||
break;
|
||||
default:
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWidget> targetWidget = widget;
|
||||
@@ -1946,7 +1961,7 @@ nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType,
|
||||
bool useNativeLineBreak =
|
||||
!(aAdditionalFlags & QUERY_CONTENT_FLAG_USE_XP_LINE_BREAK);
|
||||
|
||||
if (aType == QUERY_CHARACTER_AT_POINT) {
|
||||
if (message == NS_QUERY_CHARACTER_AT_POINT) {
|
||||
// Looking for the widget at the point.
|
||||
WidgetQueryContentEvent dummyEvent(true, NS_QUERY_CONTENT_STATE, widget);
|
||||
dummyEvent.mUseNativeLineBreak = useNativeLineBreak;
|
||||
@@ -1973,10 +1988,10 @@ nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType,
|
||||
|
||||
pt += widget->WidgetToScreenOffset() - targetWidget->WidgetToScreenOffset();
|
||||
|
||||
WidgetQueryContentEvent queryEvent(true, aType, targetWidget);
|
||||
WidgetQueryContentEvent queryEvent(true, message, targetWidget);
|
||||
InitEvent(queryEvent, &pt);
|
||||
|
||||
switch (aType) {
|
||||
switch (message) {
|
||||
case NS_QUERY_TEXT_CONTENT:
|
||||
queryEvent.InitForQueryTextContent(aOffset, aLength, useNativeLineBreak);
|
||||
break;
|
||||
@@ -2046,7 +2061,7 @@ nsDOMWindowUtils::SendContentCommandEvent(const nsAString& aType,
|
||||
if (!widget)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
int32_t msg;
|
||||
EventMessage msg;
|
||||
if (aType.EqualsLiteral("cut"))
|
||||
msg = NS_CONTENT_COMMAND_CUT;
|
||||
else if (aType.EqualsLiteral("copy"))
|
||||
|
||||
+36
-24
@@ -97,25 +97,29 @@ PRLogModuleInfo* gFocusNavigationLog;
|
||||
|
||||
struct nsDelayedBlurOrFocusEvent
|
||||
{
|
||||
nsDelayedBlurOrFocusEvent(uint32_t aType,
|
||||
nsDelayedBlurOrFocusEvent(EventMessage aEventMessage,
|
||||
nsIPresShell* aPresShell,
|
||||
nsIDocument* aDocument,
|
||||
EventTarget* aTarget)
|
||||
: mType(aType),
|
||||
mPresShell(aPresShell),
|
||||
mDocument(aDocument),
|
||||
mTarget(aTarget) { }
|
||||
: mPresShell(aPresShell)
|
||||
, mDocument(aDocument)
|
||||
, mTarget(aTarget)
|
||||
, mEventMessage(aEventMessage)
|
||||
{
|
||||
}
|
||||
|
||||
nsDelayedBlurOrFocusEvent(const nsDelayedBlurOrFocusEvent& aOther)
|
||||
: mType(aOther.mType),
|
||||
mPresShell(aOther.mPresShell),
|
||||
mDocument(aOther.mDocument),
|
||||
mTarget(aOther.mTarget) { }
|
||||
: mPresShell(aOther.mPresShell)
|
||||
, mDocument(aOther.mDocument)
|
||||
, mTarget(aOther.mTarget)
|
||||
, mEventMessage(aOther.mEventMessage)
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t mType;
|
||||
nsCOMPtr<nsIPresShell> mPresShell;
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
nsCOMPtr<EventTarget> mTarget;
|
||||
EventMessage mEventMessage;
|
||||
};
|
||||
|
||||
inline void ImplCycleCollectionUnlink(nsDelayedBlurOrFocusEvent& aField)
|
||||
@@ -1035,11 +1039,11 @@ nsFocusManager::FireDelayedEvents(nsIDocument* aDocument)
|
||||
mDelayedBlurFocusEvents.RemoveElementAt(i);
|
||||
--i;
|
||||
} else if (!aDocument->EventHandlingSuppressed()) {
|
||||
uint32_t type = mDelayedBlurFocusEvents[i].mType;
|
||||
EventMessage message = mDelayedBlurFocusEvents[i].mEventMessage;
|
||||
nsCOMPtr<EventTarget> target = mDelayedBlurFocusEvents[i].mTarget;
|
||||
nsCOMPtr<nsIPresShell> presShell = mDelayedBlurFocusEvents[i].mPresShell;
|
||||
mDelayedBlurFocusEvents.RemoveElementAt(i);
|
||||
SendFocusOrBlurEvent(type, presShell, aDocument, target, 0, false);
|
||||
SendFocusOrBlurEvent(message, presShell, aDocument, target, 0, false);
|
||||
--i;
|
||||
}
|
||||
}
|
||||
@@ -1947,15 +1951,20 @@ nsFocusManager::Focus(nsPIDOMWindow* aWindow,
|
||||
class FocusBlurEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
FocusBlurEvent(nsISupports* aTarget, uint32_t aType,
|
||||
FocusBlurEvent(nsISupports* aTarget, EventMessage aEventMessage,
|
||||
nsPresContext* aContext, bool aWindowRaised,
|
||||
bool aIsRefocus)
|
||||
: mTarget(aTarget), mType(aType), mContext(aContext),
|
||||
mWindowRaised(aWindowRaised), mIsRefocus(aIsRefocus) {}
|
||||
: mTarget(aTarget)
|
||||
, mContext(aContext)
|
||||
, mEventMessage(aEventMessage)
|
||||
, mWindowRaised(aWindowRaised)
|
||||
, mIsRefocus(aIsRefocus)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
InternalFocusEvent event(true, mType);
|
||||
InternalFocusEvent event(true, mEventMessage);
|
||||
event.mFlags.mBubbles = false;
|
||||
event.fromRaise = mWindowRaised;
|
||||
event.isRefocus = mIsRefocus;
|
||||
@@ -1963,14 +1972,14 @@ public:
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> mTarget;
|
||||
uint32_t mType;
|
||||
nsRefPtr<nsPresContext> mContext;
|
||||
EventMessage mEventMessage;
|
||||
bool mWindowRaised;
|
||||
bool mIsRefocus;
|
||||
};
|
||||
|
||||
void
|
||||
nsFocusManager::SendFocusOrBlurEvent(uint32_t aType,
|
||||
nsFocusManager::SendFocusOrBlurEvent(EventMessage aEventMessage,
|
||||
nsIPresShell* aPresShell,
|
||||
nsIDocument* aDocument,
|
||||
nsISupports* aTarget,
|
||||
@@ -1978,7 +1987,8 @@ nsFocusManager::SendFocusOrBlurEvent(uint32_t aType,
|
||||
bool aWindowRaised,
|
||||
bool aIsRefocus)
|
||||
{
|
||||
NS_ASSERTION(aType == NS_FOCUS_CONTENT || aType == NS_BLUR_CONTENT,
|
||||
NS_ASSERTION(aEventMessage == NS_FOCUS_CONTENT ||
|
||||
aEventMessage == NS_BLUR_CONTENT,
|
||||
"Wrong event type for SendFocusOrBlurEvent");
|
||||
|
||||
nsCOMPtr<EventTarget> eventTarget = do_QueryInterface(aTarget);
|
||||
@@ -2001,7 +2011,7 @@ nsFocusManager::SendFocusOrBlurEvent(uint32_t aType,
|
||||
|
||||
for (uint32_t i = mDelayedBlurFocusEvents.Length(); i > 0; --i) {
|
||||
// if this event was already queued, remove it and append it to the end
|
||||
if (mDelayedBlurFocusEvents[i - 1].mType == aType &&
|
||||
if (mDelayedBlurFocusEvents[i - 1].mEventMessage == aEventMessage &&
|
||||
mDelayedBlurFocusEvents[i - 1].mPresShell == aPresShell &&
|
||||
mDelayedBlurFocusEvents[i - 1].mDocument == aDocument &&
|
||||
mDelayedBlurFocusEvents[i - 1].mTarget == eventTarget) {
|
||||
@@ -2010,23 +2020,25 @@ nsFocusManager::SendFocusOrBlurEvent(uint32_t aType,
|
||||
}
|
||||
|
||||
mDelayedBlurFocusEvents.AppendElement(
|
||||
nsDelayedBlurOrFocusEvent(aType, aPresShell, aDocument, eventTarget));
|
||||
nsDelayedBlurOrFocusEvent(aEventMessage, aPresShell,
|
||||
aDocument, eventTarget));
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
nsAccessibilityService* accService = GetAccService();
|
||||
if (accService) {
|
||||
if (aType == NS_FOCUS_CONTENT)
|
||||
if (aEventMessage == NS_FOCUS_CONTENT) {
|
||||
accService->NotifyOfDOMFocus(aTarget);
|
||||
else
|
||||
} else {
|
||||
accService->NotifyOfDOMBlur(aTarget);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!dontDispatchEvent) {
|
||||
nsContentUtils::AddScriptRunner(
|
||||
new FocusBlurEvent(aTarget, aType, aPresShell->GetPresContext(),
|
||||
new FocusBlurEvent(aTarget, aEventMessage, aPresShell->GetPresContext(),
|
||||
aWindowRaised, aIsRefocus));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -280,12 +280,12 @@ protected:
|
||||
/**
|
||||
* Fires a focus or blur event at aTarget.
|
||||
*
|
||||
* aType should be either NS_FOCUS_CONTENT or NS_BLUR_CONTENT. For blur
|
||||
* events, aFocusMethod should normally be non-zero.
|
||||
* aEventMessage should be either NS_FOCUS_CONTENT or NS_BLUR_CONTENT.
|
||||
* For blur events, aFocusMethod should normally be non-zero.
|
||||
*
|
||||
* aWindowRaised should only be true if called from WindowRaised.
|
||||
*/
|
||||
void SendFocusOrBlurEvent(uint32_t aType,
|
||||
void SendFocusOrBlurEvent(mozilla::EventMessage aEventMessage,
|
||||
nsIPresShell* aPresShell,
|
||||
nsIDocument* aDocument,
|
||||
nsISupports* aTarget,
|
||||
|
||||
@@ -2252,6 +2252,8 @@ GK_ATOM(aria_atomic, "aria-atomic")
|
||||
GK_ATOM(aria_autocomplete, "aria-autocomplete")
|
||||
GK_ATOM(aria_busy, "aria-busy")
|
||||
GK_ATOM(aria_checked, "aria-checked")
|
||||
GK_ATOM(aria_colcount, "aria-colcount")
|
||||
GK_ATOM(aria_colindex, "aria-colindex")
|
||||
GK_ATOM(aria_controls, "aria-controls")
|
||||
GK_ATOM(aria_describedby, "aria-describedby")
|
||||
GK_ATOM(aria_disabled, "aria-disabled")
|
||||
@@ -2276,6 +2278,8 @@ GK_ATOM(aria_pressed, "aria-pressed")
|
||||
GK_ATOM(aria_readonly, "aria-readonly")
|
||||
GK_ATOM(aria_relevant, "aria-relevant")
|
||||
GK_ATOM(aria_required, "aria-required")
|
||||
GK_ATOM(aria_rowcount, "aria-rowcount")
|
||||
GK_ATOM(aria_rowindex, "aria-rowindex")
|
||||
GK_ATOM(aria_selected, "aria-selected")
|
||||
GK_ATOM(aria_setsize, "aria-setsize")
|
||||
GK_ATOM(aria_sort, "aria-sort")
|
||||
|
||||
@@ -3050,7 +3050,7 @@ nsGlobalWindow::PreHandleEvent(EventChainPreVisitor& aVisitor)
|
||||
{
|
||||
NS_PRECONDITION(IsInnerWindow(), "PreHandleEvent is used on outer window!?");
|
||||
static uint32_t count = 0;
|
||||
uint32_t msg = aVisitor.mEvent->mMessage;
|
||||
EventMessage msg = aVisitor.mEvent->mMessage;
|
||||
|
||||
aVisitor.mCanHandle = true;
|
||||
aVisitor.mForceContentDispatch = true; //FIXME! Bug 329119
|
||||
@@ -14280,7 +14280,7 @@ nsGlobalWindow::GetIsPrerendered()
|
||||
|
||||
#ifdef MOZ_B2G
|
||||
void
|
||||
nsGlobalWindow::EnableNetworkEvent(uint32_t aType)
|
||||
nsGlobalWindow::EnableNetworkEvent(EventMessage aEventMessage)
|
||||
{
|
||||
MOZ_ASSERT(IsInnerWindow());
|
||||
|
||||
@@ -14305,7 +14305,7 @@ nsGlobalWindow::EnableNetworkEvent(uint32_t aType)
|
||||
return;
|
||||
}
|
||||
|
||||
switch (aType) {
|
||||
switch (aEventMessage) {
|
||||
case NS_NETWORK_UPLOAD_EVENT:
|
||||
if (!mNetworkUploadObserverEnabled) {
|
||||
mNetworkUploadObserverEnabled = true;
|
||||
@@ -14318,11 +14318,13 @@ nsGlobalWindow::EnableNetworkEvent(uint32_t aType)
|
||||
os->AddObserver(mObserver, NS_NETWORK_ACTIVITY_BLIP_DOWNLOAD_TOPIC, false);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
|
||||
nsGlobalWindow::DisableNetworkEvent(EventMessage aEventMessage)
|
||||
{
|
||||
MOZ_ASSERT(IsInnerWindow());
|
||||
|
||||
@@ -14331,7 +14333,7 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
|
||||
return;
|
||||
}
|
||||
|
||||
switch (aType) {
|
||||
switch (aEventMessage) {
|
||||
case NS_NETWORK_UPLOAD_EVENT:
|
||||
if (mNetworkUploadObserverEnabled) {
|
||||
mNetworkUploadObserverEnabled = false;
|
||||
@@ -14344,6 +14346,8 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
|
||||
os->RemoveObserver(mObserver, NS_NETWORK_ACTIVITY_BLIP_DOWNLOAD_TOPIC);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif // MOZ_B2G
|
||||
|
||||
@@ -664,8 +664,9 @@ public:
|
||||
|
||||
#ifdef MOZ_B2G
|
||||
// Inner windows only.
|
||||
virtual void EnableNetworkEvent(uint32_t aType) override;
|
||||
virtual void DisableNetworkEvent(uint32_t aType) override;
|
||||
virtual void EnableNetworkEvent(mozilla::EventMessage aEventMessage) override;
|
||||
virtual void DisableNetworkEvent(
|
||||
mozilla::EventMessage aEventMessage) override;
|
||||
#endif // MOZ_B2G
|
||||
|
||||
virtual nsresult SetArguments(nsIArray* aArguments) override;
|
||||
|
||||
@@ -526,16 +526,16 @@ nsClipboardCommand::DoCommand(const char *aCommandName, nsISupports *aContext)
|
||||
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
|
||||
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
||||
|
||||
int32_t eventType = NS_COPY;
|
||||
EventMessage eventMessage = NS_COPY;
|
||||
if (strcmp(aCommandName, "cmd_cut") == 0) {
|
||||
eventType = NS_CUT;
|
||||
eventMessage = NS_CUT;
|
||||
} else if (strcmp(aCommandName, "cmd_paste") == 0) {
|
||||
eventType = NS_PASTE;
|
||||
eventMessage = NS_PASTE;
|
||||
}
|
||||
|
||||
bool actionTaken = false;
|
||||
bool notCancelled =
|
||||
nsCopySupport::FireClipboardEvent(eventType,
|
||||
nsCopySupport::FireClipboardEvent(eventMessage,
|
||||
nsIClipboard::kGlobalClipboard,
|
||||
presShell, nullptr, &actionTaken);
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ enum UIStateChangeType
|
||||
};
|
||||
|
||||
#define NS_PIDOMWINDOW_IID \
|
||||
{ 0x2485d4d7, 0xf7cb, 0x481e, \
|
||||
{ 0x9c, 0x89, 0xb2, 0xa8, 0x12, 0x67, 0x7f, 0x97 } }
|
||||
{ 0x052e675a, 0xacd3, 0x48d1, \
|
||||
{ 0x8a, 0xcd, 0xbf, 0xff, 0xbd, 0x24, 0x4c, 0xed } }
|
||||
|
||||
class nsPIDOMWindow : public nsIDOMWindowInternal
|
||||
{
|
||||
@@ -635,7 +635,7 @@ public:
|
||||
*
|
||||
* Inner windows only.
|
||||
*/
|
||||
virtual void EnableNetworkEvent(uint32_t aType) = 0;
|
||||
virtual void EnableNetworkEvent(mozilla::EventMessage aEventMessage) = 0;
|
||||
|
||||
/**
|
||||
* Tell the window that it should stop to listen to the network event of the
|
||||
@@ -643,7 +643,7 @@ public:
|
||||
*
|
||||
* Inner windows only.
|
||||
*/
|
||||
virtual void DisableNetworkEvent(uint32_t aType) = 0;
|
||||
virtual void DisableNetworkEvent(mozilla::EventMessage aEventMessage) = 0;
|
||||
#endif // MOZ_B2G
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,10 +59,10 @@ nsScriptElement::ScriptEvaluated(nsresult aResult,
|
||||
nsContentUtils::GetContextForContent(cont);
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
uint32_t type = NS_SUCCEEDED(aResult) ? NS_LOAD : NS_LOAD_ERROR;
|
||||
WidgetEvent event(true, type);
|
||||
EventMessage message = NS_SUCCEEDED(aResult) ? NS_LOAD : NS_LOAD_ERROR;
|
||||
WidgetEvent event(true, message);
|
||||
// Load event doesn't bubble.
|
||||
event.mFlags.mBubbles = (type != NS_LOAD);
|
||||
event.mFlags.mBubbles = (message != NS_LOAD);
|
||||
|
||||
EventDispatcher::Dispatch(cont, presContext, &event, nullptr, &status);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ AnimationEvent::AnimationEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
InternalAnimationEvent* aEvent)
|
||||
: Event(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalAnimationEvent(false, 0))
|
||||
aEvent ? aEvent : new InternalAnimationEvent(false, NS_EVENT_NULL))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
|
||||
@@ -17,7 +17,8 @@ BeforeAfterKeyboardEvent::BeforeAfterKeyboardEvent(
|
||||
InternalBeforeAfterKeyboardEvent* aEvent)
|
||||
: KeyboardEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent :
|
||||
new InternalBeforeAfterKeyboardEvent(false, 0,
|
||||
new InternalBeforeAfterKeyboardEvent(false,
|
||||
NS_EVENT_NULL,
|
||||
nullptr))
|
||||
{
|
||||
MOZ_ASSERT(mEvent->mClass == eBeforeAfterKeyboardEventClass,
|
||||
|
||||
@@ -16,7 +16,7 @@ ClipboardEvent::ClipboardEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
InternalClipboardEvent* aEvent)
|
||||
: Event(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalClipboardEvent(false, 0))
|
||||
aEvent ? aEvent : new InternalClipboardEvent(false, NS_EVENT_NULL))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
|
||||
@@ -15,7 +15,8 @@ CompositionEvent::CompositionEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetCompositionEvent* aEvent)
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetCompositionEvent(false, 0, nullptr))
|
||||
aEvent ? aEvent :
|
||||
new WidgetCompositionEvent(false, NS_EVENT_NULL, nullptr))
|
||||
{
|
||||
NS_ASSERTION(mEvent->mClass == eCompositionEventClass,
|
||||
"event type mismatch");
|
||||
|
||||
@@ -155,9 +155,9 @@ DataTransfer::Constructor(const GlobalObject& aGlobal,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t eventType = nsContentUtils::GetEventId(eventTypeAtom);
|
||||
EventMessage eventMessage = nsContentUtils::GetEventMessage(eventTypeAtom);
|
||||
nsRefPtr<DataTransfer> transfer = new DataTransfer(aGlobal.GetAsSupports(),
|
||||
eventType, aIsExternal,
|
||||
eventMessage, aIsExternal,
|
||||
-1);
|
||||
return transfer.forget();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@ DragEvent::DragEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetDragEvent* aEvent)
|
||||
: MouseEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetDragEvent(false, 0, nullptr))
|
||||
aEvent ? aEvent :
|
||||
new WidgetDragEvent(false, NS_EVENT_NULL, nullptr))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
|
||||
+18
-4
@@ -106,7 +106,7 @@ Event::ConstructorInit(EventTarget* aOwner,
|
||||
...
|
||||
}
|
||||
*/
|
||||
mEvent = new WidgetEvent(false, 0);
|
||||
mEvent = new WidgetEvent(false, NS_EVENT_NULL);
|
||||
mEvent->time = PR_Now();
|
||||
}
|
||||
|
||||
@@ -563,8 +563,8 @@ Event::SetEventType(const nsAString& aEventTypeArg)
|
||||
if (mIsMainThreadEvent) {
|
||||
mEvent->typeString.Truncate();
|
||||
mEvent->userType =
|
||||
nsContentUtils::GetEventIdAndAtom(aEventTypeArg, mEvent->mClass,
|
||||
&(mEvent->mMessage));
|
||||
nsContentUtils::GetEventMessageAndAtom(aEventTypeArg, mEvent->mClass,
|
||||
&(mEvent->mMessage));
|
||||
} else {
|
||||
mEvent->userType = nullptr;
|
||||
mEvent->mMessage = NS_USER_DEFINED_EVENT;
|
||||
@@ -726,6 +726,8 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
||||
abuse = openControlled;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -740,6 +742,8 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
||||
abuse = openControlled;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -757,6 +761,8 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
||||
case NS_XUL_COMMAND:
|
||||
abuse = openControlled;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -785,6 +791,8 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
||||
abuse = openControlled;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -801,6 +809,8 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
||||
abuse = openControlled;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -832,6 +842,8 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
||||
abuse = openControlled;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -851,6 +863,8 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
|
||||
abuse = openControlled;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1038,7 +1052,7 @@ Event::GetOffsetCoords(nsPresContext* aPresContext,
|
||||
// logic for handling user-defined events).
|
||||
// static
|
||||
const char*
|
||||
Event::GetEventName(uint32_t aEventType)
|
||||
Event::GetEventName(EventMessage aEventType)
|
||||
{
|
||||
switch(aEventType) {
|
||||
#define ID_TO_EVENT(name_, _id, _type, _struct) \
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ public:
|
||||
|
||||
static void Shutdown();
|
||||
|
||||
static const char* GetEventName(uint32_t aEventType);
|
||||
static const char* GetEventName(EventMessage aEventType);
|
||||
static CSSIntPoint GetClientCoords(nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
LayoutDeviceIntPoint aPoint,
|
||||
|
||||
@@ -52,11 +52,11 @@ namespace mozilla {
|
||||
using namespace dom;
|
||||
using namespace hal;
|
||||
|
||||
#define EVENT_TYPE_EQUALS(ls, type, userType, typeString, allEvents) \
|
||||
((ls->mEventType == type && \
|
||||
(ls->mEventType != NS_USER_DEFINED_EVENT || \
|
||||
(mIsMainThreadELM && ls->mTypeAtom == userType) || \
|
||||
(!mIsMainThreadELM && ls->mTypeString.Equals(typeString)))) || \
|
||||
#define EVENT_TYPE_EQUALS(ls, message, userType, typeString, allEvents) \
|
||||
((ls->mEventMessage == message && \
|
||||
(ls->mEventMessage != NS_USER_DEFINED_EVENT || \
|
||||
(mIsMainThreadELM && ls->mTypeAtom == userType) || \
|
||||
(!mIsMainThreadELM && ls->mTypeString.Equals(typeString)))) || \
|
||||
(allEvents && ls->mAllEvents))
|
||||
|
||||
static const uint32_t kAllMutationBits =
|
||||
@@ -69,7 +69,7 @@ static const uint32_t kAllMutationBits =
|
||||
NS_EVENT_BITS_MUTATION_CHARACTERDATAMODIFIED;
|
||||
|
||||
static uint32_t
|
||||
MutationBitForEventType(uint32_t aEventType)
|
||||
MutationBitForEventType(EventMessage aEventType)
|
||||
{
|
||||
switch (aEventType) {
|
||||
case NS_MUTATION_SUBTREEMODIFIED:
|
||||
@@ -94,8 +94,9 @@ MutationBitForEventType(uint32_t aEventType)
|
||||
|
||||
uint32_t EventListenerManager::sMainThreadCreatedCount = 0;
|
||||
|
||||
EventListenerManager::EventListenerManager(EventTarget* aTarget)
|
||||
: mMayHavePaintEventListener(false)
|
||||
EventListenerManagerBase::EventListenerManagerBase()
|
||||
: mNoListenerForEvent(NS_EVENT_NULL)
|
||||
, mMayHavePaintEventListener(false)
|
||||
, mMayHaveMutationListeners(false)
|
||||
, mMayHaveCapturingListeners(false)
|
||||
, mMayHaveSystemGroupListeners(false)
|
||||
@@ -106,7 +107,13 @@ EventListenerManager::EventListenerManager(EventTarget* aTarget)
|
||||
, mMayHaveInputOrCompositionEventListener(false)
|
||||
, mClearingListeners(false)
|
||||
, mIsMainThreadELM(NS_IsMainThread())
|
||||
, mNoListenerForEvent(0)
|
||||
{
|
||||
static_assert(sizeof(EventListenerManagerBase) == sizeof(uint32_t),
|
||||
"Keep the size of EventListenerManagerBase size compact!");
|
||||
}
|
||||
|
||||
EventListenerManager::EventListenerManager(EventTarget* aTarget)
|
||||
: EventListenerManagerBase()
|
||||
, mTarget(aTarget)
|
||||
{
|
||||
NS_ASSERTION(aTarget, "unexpected null pointer");
|
||||
@@ -215,15 +222,17 @@ EventListenerManager::GetTargetAsInnerWindow() const
|
||||
void
|
||||
EventListenerManager::AddEventListenerInternal(
|
||||
const EventListenerHolder& aListenerHolder,
|
||||
uint32_t aType,
|
||||
EventMessage aEventMessage,
|
||||
nsIAtom* aTypeAtom,
|
||||
const nsAString& aTypeString,
|
||||
const EventListenerFlags& aFlags,
|
||||
bool aHandler,
|
||||
bool aAllEvents)
|
||||
{
|
||||
MOZ_ASSERT((NS_IsMainThread() && aType && aTypeAtom) || // Main thread
|
||||
(!NS_IsMainThread() && aType && !aTypeString.IsEmpty()) || // non-main-thread
|
||||
MOZ_ASSERT(// Main thread
|
||||
(NS_IsMainThread() && aEventMessage && aTypeAtom) ||
|
||||
// non-main-thread
|
||||
(!NS_IsMainThread() && aEventMessage && !aTypeString.IsEmpty()) ||
|
||||
aAllEvents, "Missing type"); // all-events listener
|
||||
|
||||
if (!aListenerHolder || mClearingListeners) {
|
||||
@@ -241,7 +250,7 @@ EventListenerManager::AddEventListenerInternal(
|
||||
// mListener == aListenerHolder is the last one, since it can be a bit slow.
|
||||
if (listener->mListenerIsHandler == aHandler &&
|
||||
listener->mFlags == aFlags &&
|
||||
EVENT_TYPE_EQUALS(listener, aType, aTypeAtom, aTypeString,
|
||||
EVENT_TYPE_EQUALS(listener, aEventMessage, aTypeAtom, aTypeString,
|
||||
aAllEvents) &&
|
||||
listener->mListener == aListenerHolder) {
|
||||
return;
|
||||
@@ -254,8 +263,7 @@ EventListenerManager::AddEventListenerInternal(
|
||||
listener = aAllEvents ? mListeners.InsertElementAt(0) :
|
||||
mListeners.AppendElement();
|
||||
listener->mListener = aListenerHolder;
|
||||
MOZ_ASSERT(aType < PR_UINT16_MAX);
|
||||
listener->mEventType = aType;
|
||||
listener->mEventMessage = aEventMessage;
|
||||
listener->mTypeString = aTypeString;
|
||||
listener->mTypeAtom = aTypeAtom;
|
||||
listener->mFlags = aFlags;
|
||||
@@ -284,13 +292,14 @@ EventListenerManager::AddEventListenerInternal(
|
||||
mMayHaveCapturingListeners = true;
|
||||
}
|
||||
|
||||
if (aType == NS_AFTERPAINT) {
|
||||
if (aEventMessage == NS_AFTERPAINT) {
|
||||
mMayHavePaintEventListener = true;
|
||||
nsPIDOMWindow* window = GetInnerWindowForTarget();
|
||||
if (window) {
|
||||
window->SetHasPaintEventListeners();
|
||||
}
|
||||
} else if (aType >= NS_MUTATION_START && aType <= NS_MUTATION_END) {
|
||||
} else if (aEventMessage >= NS_MUTATION_START &&
|
||||
aEventMessage <= NS_MUTATION_END) {
|
||||
// For mutation listeners, we need to update the global bit on the DOM window.
|
||||
// Otherwise we won't actually fire the mutation event.
|
||||
mMayHaveMutationListeners = true;
|
||||
@@ -301,11 +310,11 @@ EventListenerManager::AddEventListenerInternal(
|
||||
if (doc) {
|
||||
doc->WarnOnceAbout(nsIDocument::eMutationEvent);
|
||||
}
|
||||
// If aType is NS_MUTATION_SUBTREEMODIFIED, we need to listen all
|
||||
// If aEventMessage is NS_MUTATION_SUBTREEMODIFIED, we need to listen all
|
||||
// mutations. nsContentUtils::HasMutationListeners relies on this.
|
||||
window->SetMutationListeners((aType == NS_MUTATION_SUBTREEMODIFIED) ?
|
||||
kAllMutationBits :
|
||||
MutationBitForEventType(aType));
|
||||
window->SetMutationListeners(
|
||||
(aEventMessage == NS_MUTATION_SUBTREEMODIFIED) ?
|
||||
kAllMutationBits : MutationBitForEventType(aEventMessage));
|
||||
}
|
||||
} else if (aTypeAtom == nsGkAtoms::ondeviceorientation) {
|
||||
EnableDevice(NS_DEVICE_ORIENTATION);
|
||||
@@ -343,7 +352,8 @@ EventListenerManager::AddEventListenerInternal(
|
||||
if (window && !aFlags.mInSystemGroup) {
|
||||
window->SetHasTouchEventListeners();
|
||||
}
|
||||
} else if (aType >= NS_POINTER_EVENT_START && aType <= NS_POINTER_LOST_CAPTURE) {
|
||||
} else if (aEventMessage >= NS_POINTER_EVENT_START &&
|
||||
aEventMessage <= NS_POINTER_LOST_CAPTURE) {
|
||||
nsPIDOMWindow* window = GetInnerWindowForTarget();
|
||||
if (aTypeAtom == nsGkAtoms::onpointerenter ||
|
||||
aTypeAtom == nsGkAtoms::onpointerleave) {
|
||||
@@ -372,8 +382,8 @@ EventListenerManager::AddEventListenerInternal(
|
||||
window->SetHasMouseEnterLeaveEventListeners();
|
||||
}
|
||||
#ifdef MOZ_GAMEPAD
|
||||
} else if (aType >= NS_GAMEPAD_START &&
|
||||
aType <= NS_GAMEPAD_END) {
|
||||
} else if (aEventMessage >= NS_GAMEPAD_START &&
|
||||
aEventMessage <= NS_GAMEPAD_END) {
|
||||
nsPIDOMWindow* window = GetInnerWindowForTarget();
|
||||
if (window) {
|
||||
window->SetHasGamepadEventListener();
|
||||
@@ -411,9 +421,9 @@ EventListenerManager::AddEventListenerInternal(
|
||||
}
|
||||
|
||||
bool
|
||||
EventListenerManager::IsDeviceType(uint32_t aType)
|
||||
EventListenerManager::IsDeviceType(EventMessage aEventMessage)
|
||||
{
|
||||
switch (aType) {
|
||||
switch (aEventMessage) {
|
||||
case NS_DEVICE_ORIENTATION:
|
||||
case NS_DEVICE_MOTION:
|
||||
case NS_DEVICE_LIGHT:
|
||||
@@ -427,14 +437,14 @@ EventListenerManager::IsDeviceType(uint32_t aType)
|
||||
}
|
||||
|
||||
void
|
||||
EventListenerManager::EnableDevice(uint32_t aType)
|
||||
EventListenerManager::EnableDevice(EventMessage aEventMessage)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetTargetAsInnerWindow();
|
||||
if (!window) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (aType) {
|
||||
switch (aEventMessage) {
|
||||
case NS_DEVICE_ORIENTATION:
|
||||
window->EnableDeviceSensor(SENSOR_ORIENTATION);
|
||||
break;
|
||||
@@ -457,14 +467,14 @@ EventListenerManager::EnableDevice(uint32_t aType)
|
||||
}
|
||||
|
||||
void
|
||||
EventListenerManager::DisableDevice(uint32_t aType)
|
||||
EventListenerManager::DisableDevice(EventMessage aEventMessage)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetTargetAsInnerWindow();
|
||||
if (!window) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (aType) {
|
||||
switch (aEventMessage) {
|
||||
case NS_DEVICE_ORIENTATION:
|
||||
window->DisableDeviceSensor(SENSOR_ORIENTATION);
|
||||
break;
|
||||
@@ -489,13 +499,13 @@ EventListenerManager::DisableDevice(uint32_t aType)
|
||||
void
|
||||
EventListenerManager::RemoveEventListenerInternal(
|
||||
const EventListenerHolder& aListenerHolder,
|
||||
uint32_t aType,
|
||||
EventMessage aEventMessage,
|
||||
nsIAtom* aUserType,
|
||||
const nsAString& aTypeString,
|
||||
const EventListenerFlags& aFlags,
|
||||
bool aAllEvents)
|
||||
{
|
||||
if (!aListenerHolder || !aType || mClearingListeners) {
|
||||
if (!aListenerHolder || !aEventMessage || mClearingListeners) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -503,16 +513,16 @@ EventListenerManager::RemoveEventListenerInternal(
|
||||
|
||||
uint32_t count = mListeners.Length();
|
||||
uint32_t typeCount = 0;
|
||||
bool deviceType = IsDeviceType(aType);
|
||||
bool deviceType = IsDeviceType(aEventMessage);
|
||||
#ifdef MOZ_B2G
|
||||
bool timeChangeEvent = (aType == NS_MOZ_TIME_CHANGE_EVENT);
|
||||
bool networkEvent = (aType == NS_NETWORK_UPLOAD_EVENT ||
|
||||
aType == NS_NETWORK_DOWNLOAD_EVENT);
|
||||
bool timeChangeEvent = (aEventMessage == NS_MOZ_TIME_CHANGE_EVENT);
|
||||
bool networkEvent = (aEventMessage == NS_NETWORK_UPLOAD_EVENT ||
|
||||
aEventMessage == NS_NETWORK_DOWNLOAD_EVENT);
|
||||
#endif // MOZ_B2G
|
||||
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
listener = &mListeners.ElementAt(i);
|
||||
if (EVENT_TYPE_EQUALS(listener, aType, aUserType, aTypeString,
|
||||
if (EVENT_TYPE_EQUALS(listener, aEventMessage, aUserType, aTypeString,
|
||||
aAllEvents)) {
|
||||
++typeCount;
|
||||
if (listener->mListener == aListenerHolder &&
|
||||
@@ -542,7 +552,7 @@ EventListenerManager::RemoveEventListenerInternal(
|
||||
}
|
||||
|
||||
if (!aAllEvents && deviceType && typeCount == 0) {
|
||||
DisableDevice(aType);
|
||||
DisableDevice(aEventMessage);
|
||||
#ifdef MOZ_B2G
|
||||
} else if (timeChangeEvent && typeCount == 0) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetTargetAsInnerWindow();
|
||||
@@ -552,7 +562,7 @@ EventListenerManager::RemoveEventListenerInternal(
|
||||
} else if (!aAllEvents && networkEvent && typeCount == 0) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetTargetAsInnerWindow();
|
||||
if (window) {
|
||||
window->DisableNetworkEvent(aType);
|
||||
window->DisableNetworkEvent(aEventMessage);
|
||||
}
|
||||
#endif // MOZ_B2G
|
||||
}
|
||||
@@ -564,7 +574,7 @@ EventListenerManager::ListenerCanHandle(Listener* aListener,
|
||||
{
|
||||
// This is slightly different from EVENT_TYPE_EQUALS in that it returns
|
||||
// true even when aEvent->mMessage == NS_USER_DEFINED_EVENT and
|
||||
// aListener=>mEventType != NS_USER_DEFINED_EVENT as long as the atoms are
|
||||
// aListener=>mEventMessage != NS_USER_DEFINED_EVENT as long as the atoms are
|
||||
// the same
|
||||
if (aListener->mAllEvents) {
|
||||
return true;
|
||||
@@ -576,7 +586,7 @@ EventListenerManager::ListenerCanHandle(Listener* aListener,
|
||||
return aListener->mTypeString.Equals(aEvent->typeString);
|
||||
}
|
||||
MOZ_ASSERT(mIsMainThreadELM);
|
||||
return aListener->mEventType == aEvent->mMessage;
|
||||
return aListener->mEventMessage == aEvent->mMessage;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -587,8 +597,8 @@ EventListenerManager::AddEventListenerByType(
|
||||
{
|
||||
nsCOMPtr<nsIAtom> atom =
|
||||
mIsMainThreadELM ? do_GetAtom(NS_LITERAL_STRING("on") + aType) : nullptr;
|
||||
uint32_t type = nsContentUtils::GetEventId(atom);
|
||||
AddEventListenerInternal(aListenerHolder, type, atom, aType, aFlags);
|
||||
EventMessage message = nsContentUtils::GetEventMessage(atom);
|
||||
AddEventListenerInternal(aListenerHolder, message, atom, aType, aFlags);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -599,12 +609,12 @@ EventListenerManager::RemoveEventListenerByType(
|
||||
{
|
||||
nsCOMPtr<nsIAtom> atom =
|
||||
mIsMainThreadELM ? do_GetAtom(NS_LITERAL_STRING("on") + aType) : nullptr;
|
||||
uint32_t type = nsContentUtils::GetEventId(atom);
|
||||
RemoveEventListenerInternal(aListenerHolder, type, atom, aType, aFlags);
|
||||
EventMessage message = nsContentUtils::GetEventMessage(atom);
|
||||
RemoveEventListenerInternal(aListenerHolder, message, atom, aType, aFlags);
|
||||
}
|
||||
|
||||
EventListenerManager::Listener*
|
||||
EventListenerManager::FindEventHandler(uint32_t aEventType,
|
||||
EventListenerManager::FindEventHandler(EventMessage aEventMessage,
|
||||
nsIAtom* aTypeAtom,
|
||||
const nsAString& aTypeString)
|
||||
{
|
||||
@@ -615,7 +625,7 @@ EventListenerManager::FindEventHandler(uint32_t aEventType,
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
listener = &mListeners.ElementAt(i);
|
||||
if (listener->mListenerIsHandler &&
|
||||
EVENT_TYPE_EQUALS(listener, aEventType, aTypeAtom, aTypeString,
|
||||
EVENT_TYPE_EQUALS(listener, aEventMessage, aTypeAtom, aTypeString,
|
||||
false)) {
|
||||
return listener;
|
||||
}
|
||||
@@ -632,8 +642,8 @@ EventListenerManager::SetEventHandlerInternal(
|
||||
{
|
||||
MOZ_ASSERT(aName || !aTypeString.IsEmpty());
|
||||
|
||||
uint32_t eventType = nsContentUtils::GetEventId(aName);
|
||||
Listener* listener = FindEventHandler(eventType, aName, aTypeString);
|
||||
EventMessage eventMessage = nsContentUtils::GetEventMessage(aName);
|
||||
Listener* listener = FindEventHandler(eventMessage, aName, aTypeString);
|
||||
|
||||
if (!listener) {
|
||||
// If we didn't find a script listener or no listeners existed
|
||||
@@ -645,10 +655,10 @@ EventListenerManager::SetEventHandlerInternal(
|
||||
NS_NewJSEventHandler(mTarget, aName,
|
||||
aTypedHandler, getter_AddRefs(jsEventHandler));
|
||||
EventListenerHolder listenerHolder(jsEventHandler);
|
||||
AddEventListenerInternal(listenerHolder, eventType, aName, aTypeString,
|
||||
AddEventListenerInternal(listenerHolder, eventMessage, aName, aTypeString,
|
||||
flags, true);
|
||||
|
||||
listener = FindEventHandler(eventType, aName, aTypeString);
|
||||
listener = FindEventHandler(eventMessage, aName, aTypeString);
|
||||
} else {
|
||||
JSEventHandler* jsEventHandler = listener->GetJSEventHandler();
|
||||
MOZ_ASSERT(jsEventHandler,
|
||||
@@ -781,8 +791,8 @@ EventListenerManager::RemoveEventHandler(nsIAtom* aName,
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t eventType = nsContentUtils::GetEventId(aName);
|
||||
Listener* listener = FindEventHandler(eventType, aName, aTypeString);
|
||||
EventMessage eventMessage = nsContentUtils::GetEventMessage(aName);
|
||||
Listener* listener = FindEventHandler(eventMessage, aName, aTypeString);
|
||||
|
||||
if (listener) {
|
||||
mListeners.RemoveElementAt(uint32_t(listener - &mListeners.ElementAt(0)));
|
||||
@@ -1244,8 +1254,8 @@ EventListenerManager::HasMutationListeners()
|
||||
uint32_t count = mListeners.Length();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
Listener* listener = &mListeners.ElementAt(i);
|
||||
if (listener->mEventType >= NS_MUTATION_START &&
|
||||
listener->mEventType <= NS_MUTATION_END) {
|
||||
if (listener->mEventMessage >= NS_MUTATION_START &&
|
||||
listener->mEventMessage <= NS_MUTATION_END) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1262,12 +1272,12 @@ EventListenerManager::MutationListenerBits()
|
||||
uint32_t count = mListeners.Length();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
Listener* listener = &mListeners.ElementAt(i);
|
||||
if (listener->mEventType >= NS_MUTATION_START &&
|
||||
listener->mEventType <= NS_MUTATION_END) {
|
||||
if (listener->mEventType == NS_MUTATION_SUBTREEMODIFIED) {
|
||||
if (listener->mEventMessage >= NS_MUTATION_START &&
|
||||
listener->mEventMessage <= NS_MUTATION_END) {
|
||||
if (listener->mEventMessage == NS_MUTATION_SUBTREEMODIFIED) {
|
||||
return kAllMutationBits;
|
||||
}
|
||||
bits |= MutationBitForEventType(listener->mEventType);
|
||||
bits |= MutationBitForEventType(listener->mEventMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1357,8 +1367,8 @@ EventListenerManager::HasUnloadListeners()
|
||||
uint32_t count = mListeners.Length();
|
||||
for (uint32_t i = 0; i < count; ++i) {
|
||||
Listener* listener = &mListeners.ElementAt(i);
|
||||
if (listener->mEventType == NS_PAGE_UNLOAD ||
|
||||
listener->mEventType == NS_BEFORE_PAGE_UNLOAD) {
|
||||
if (listener->mEventMessage == NS_PAGE_UNLOAD ||
|
||||
listener->mEventMessage == NS_BEFORE_PAGE_UNLOAD) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1429,8 +1439,8 @@ const TypedEventHandler*
|
||||
EventListenerManager::GetTypedEventHandler(nsIAtom* aEventName,
|
||||
const nsAString& aTypeString)
|
||||
{
|
||||
uint32_t eventType = nsContentUtils::GetEventId(aEventName);
|
||||
Listener* listener = FindEventHandler(eventType, aEventName, aTypeString);
|
||||
EventMessage eventMessage = nsContentUtils::GetEventMessage(aEventName);
|
||||
Listener* listener = FindEventHandler(eventMessage, aEventName, aTypeString);
|
||||
|
||||
if (!listener) {
|
||||
return nullptr;
|
||||
|
||||
@@ -146,11 +146,31 @@ inline EventListenerFlags AllEventsAtSystemGroupCapture()
|
||||
return flags;
|
||||
}
|
||||
|
||||
class EventListenerManagerBase
|
||||
{
|
||||
protected:
|
||||
EventListenerManagerBase();
|
||||
|
||||
EventMessage mNoListenerForEvent;
|
||||
uint16_t mMayHavePaintEventListener : 1;
|
||||
uint16_t mMayHaveMutationListeners : 1;
|
||||
uint16_t mMayHaveCapturingListeners : 1;
|
||||
uint16_t mMayHaveSystemGroupListeners : 1;
|
||||
uint16_t mMayHaveTouchEventListener : 1;
|
||||
uint16_t mMayHaveMouseEnterLeaveEventListener : 1;
|
||||
uint16_t mMayHavePointerEnterLeaveEventListener : 1;
|
||||
uint16_t mMayHaveKeyEventListener : 1;
|
||||
uint16_t mMayHaveInputOrCompositionEventListener : 1;
|
||||
uint16_t mClearingListeners : 1;
|
||||
uint16_t mIsMainThreadELM : 1;
|
||||
// uint16_t mUnused : 5;
|
||||
};
|
||||
|
||||
/*
|
||||
* Event listener manager
|
||||
*/
|
||||
|
||||
class EventListenerManager final
|
||||
class EventListenerManager final : public EventListenerManagerBase
|
||||
{
|
||||
~EventListenerManager();
|
||||
|
||||
@@ -160,7 +180,7 @@ public:
|
||||
EventListenerHolder mListener;
|
||||
nsCOMPtr<nsIAtom> mTypeAtom; // for the main thread
|
||||
nsString mTypeString; // for non-main-threads
|
||||
uint16_t mEventType;
|
||||
EventMessage mEventMessage;
|
||||
|
||||
enum ListenerType : uint8_t
|
||||
{
|
||||
@@ -453,7 +473,7 @@ protected:
|
||||
/**
|
||||
* Find the Listener for the "inline" event listener for aTypeAtom.
|
||||
*/
|
||||
Listener* FindEventHandler(uint32_t aEventType,
|
||||
Listener* FindEventHandler(EventMessage aEventMessage,
|
||||
nsIAtom* aTypeAtom,
|
||||
const nsAString& aTypeString);
|
||||
|
||||
@@ -469,9 +489,9 @@ protected:
|
||||
const TypedEventHandler& aHandler,
|
||||
bool aPermitUntrustedEvents);
|
||||
|
||||
bool IsDeviceType(uint32_t aType);
|
||||
void EnableDevice(uint32_t aType);
|
||||
void DisableDevice(uint32_t aType);
|
||||
bool IsDeviceType(EventMessage aEventMessage);
|
||||
void EnableDevice(EventMessage aEventMessage);
|
||||
void DisableDevice(EventMessage aEventMessage);
|
||||
|
||||
public:
|
||||
/**
|
||||
@@ -533,14 +553,14 @@ protected:
|
||||
bool aUseCapture);
|
||||
|
||||
void AddEventListenerInternal(const EventListenerHolder& aListener,
|
||||
uint32_t aType,
|
||||
EventMessage aEventMessage,
|
||||
nsIAtom* aTypeAtom,
|
||||
const nsAString& aTypeString,
|
||||
const EventListenerFlags& aFlags,
|
||||
bool aHandler = false,
|
||||
bool aAllEvents = false);
|
||||
void RemoveEventListenerInternal(const EventListenerHolder& aListener,
|
||||
uint32_t aType,
|
||||
EventMessage aEventMessage,
|
||||
nsIAtom* aUserType,
|
||||
const nsAString& aTypeString,
|
||||
const EventListenerFlags& aFlags,
|
||||
@@ -553,22 +573,14 @@ protected:
|
||||
|
||||
bool ListenerCanHandle(Listener* aListener, WidgetEvent* aEvent);
|
||||
|
||||
// BE AWARE, a lot of instances of EventListenerManager will be created.
|
||||
// Therefor, we need to keep this class compact. When you add integer
|
||||
// members, please add them to EventListemerManagerBase and check the size
|
||||
// at build time.
|
||||
|
||||
already_AddRefed<nsIScriptGlobalObject>
|
||||
GetScriptGlobalAndDocument(nsIDocument** aDoc);
|
||||
|
||||
uint32_t mMayHavePaintEventListener : 1;
|
||||
uint32_t mMayHaveMutationListeners : 1;
|
||||
uint32_t mMayHaveCapturingListeners : 1;
|
||||
uint32_t mMayHaveSystemGroupListeners : 1;
|
||||
uint32_t mMayHaveTouchEventListener : 1;
|
||||
uint32_t mMayHaveMouseEnterLeaveEventListener : 1;
|
||||
uint32_t mMayHavePointerEnterLeaveEventListener : 1;
|
||||
uint32_t mMayHaveKeyEventListener : 1;
|
||||
uint32_t mMayHaveInputOrCompositionEventListener : 1;
|
||||
uint32_t mClearingListeners : 1;
|
||||
uint32_t mIsMainThreadELM : 1;
|
||||
uint32_t mNoListenerForEvent : 21;
|
||||
|
||||
nsAutoTObserverArray<Listener, 2> mListeners;
|
||||
dom::EventTarget* MOZ_NON_OWNING_REF mTarget;
|
||||
nsCOMPtr<nsIAtom> mNoListenerForEventAtom;
|
||||
|
||||
@@ -641,7 +641,7 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
}
|
||||
GenerateMouseEnterExit(mouseEvent);
|
||||
//This is a window level mouse exit event and should stop here
|
||||
aEvent->mMessage = 0;
|
||||
aEvent->mMessage = NS_EVENT_NULL;
|
||||
break;
|
||||
}
|
||||
case NS_MOUSE_MOVE:
|
||||
@@ -852,6 +852,8 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
compositionEvent->mData = selectedText.mReply.mString;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1210,6 +1212,8 @@ CrossProcessSafeEvent(const WidgetEvent& aEvent)
|
||||
case NS_DRAGDROP_EXIT:
|
||||
case NS_DRAGDROP_DROP:
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
@@ -3264,12 +3268,13 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
}
|
||||
if (dispatchedToContentProcess) {
|
||||
dragSession->SetCanDrop(true);
|
||||
}
|
||||
|
||||
// now set the drop effect in the initial dataTransfer. This ensures
|
||||
// that we can get the desired drop effect in the drop event.
|
||||
if (initialDataTransfer)
|
||||
} else if (initialDataTransfer) {
|
||||
// Now set the drop effect in the initial dataTransfer. This ensures
|
||||
// that we can get the desired drop effect in the drop event. For events
|
||||
// dispatched to content, the content process will take care of setting
|
||||
// this.
|
||||
initialDataTransfer->SetDropEffectInt(dropEffect);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -3343,6 +3348,9 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//Reset target frame to null to avoid mistargeting after reentrant event
|
||||
@@ -3696,7 +3704,7 @@ EventStateManager::IsHandlingUserInput()
|
||||
|
||||
static void
|
||||
CreateMouseOrPointerWidgetEvent(WidgetMouseEvent* aMouseEvent,
|
||||
uint32_t aMessage,
|
||||
EventMessage aMessage,
|
||||
nsIContent* aRelatedContent,
|
||||
nsAutoPtr<WidgetMouseEvent>& aNewEvent)
|
||||
{
|
||||
@@ -3736,7 +3744,7 @@ CreateMouseOrPointerWidgetEvent(WidgetMouseEvent* aMouseEvent,
|
||||
|
||||
nsIFrame*
|
||||
EventStateManager::DispatchMouseOrPointerEvent(WidgetMouseEvent* aMouseEvent,
|
||||
uint32_t aMessage,
|
||||
EventMessage aMessage,
|
||||
nsIContent* aTargetContent,
|
||||
nsIContent* aRelatedContent)
|
||||
{
|
||||
@@ -3828,10 +3836,11 @@ class EnterLeaveDispatcher
|
||||
public:
|
||||
EnterLeaveDispatcher(EventStateManager* aESM,
|
||||
nsIContent* aTarget, nsIContent* aRelatedTarget,
|
||||
WidgetMouseEvent* aMouseEvent, uint32_t aType)
|
||||
WidgetMouseEvent* aMouseEvent,
|
||||
EventMessage aEventMessage)
|
||||
: mESM(aESM)
|
||||
, mMouseEvent(aMouseEvent)
|
||||
, mType(aType)
|
||||
, mEventMessage(aEventMessage)
|
||||
{
|
||||
nsPIDOMWindow* win =
|
||||
aTarget ? aTarget->OwnerDoc()->GetInnerWindow() : nullptr;
|
||||
@@ -3858,16 +3867,16 @@ public:
|
||||
|
||||
~EnterLeaveDispatcher()
|
||||
{
|
||||
if (mType == NS_MOUSEENTER ||
|
||||
mType == NS_POINTER_ENTER) {
|
||||
if (mEventMessage == NS_MOUSEENTER ||
|
||||
mEventMessage == NS_POINTER_ENTER) {
|
||||
for (int32_t i = mTargets.Count() - 1; i >= 0; --i) {
|
||||
mESM->DispatchMouseOrPointerEvent(mMouseEvent, mType, mTargets[i],
|
||||
mRelatedTarget);
|
||||
mESM->DispatchMouseOrPointerEvent(mMouseEvent, mEventMessage,
|
||||
mTargets[i], mRelatedTarget);
|
||||
}
|
||||
} else {
|
||||
for (int32_t i = 0; i < mTargets.Count(); ++i) {
|
||||
mESM->DispatchMouseOrPointerEvent(mMouseEvent, mType, mTargets[i],
|
||||
mRelatedTarget);
|
||||
mESM->DispatchMouseOrPointerEvent(mMouseEvent, mEventMessage,
|
||||
mTargets[i], mRelatedTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3876,7 +3885,7 @@ public:
|
||||
nsCOMArray<nsIContent> mTargets;
|
||||
nsCOMPtr<nsIContent> mRelatedTarget;
|
||||
WidgetMouseEvent* mMouseEvent;
|
||||
uint32_t mType;
|
||||
EventMessage mEventMessage;
|
||||
};
|
||||
|
||||
void
|
||||
@@ -4065,7 +4074,8 @@ GetWindowInnerRectCenter(nsPIDOMWindow* aWindow,
|
||||
}
|
||||
|
||||
void
|
||||
EventStateManager::GeneratePointerEnterExit(uint32_t aMessage, WidgetMouseEvent* aEvent)
|
||||
EventStateManager::GeneratePointerEnterExit(EventMessage aMessage,
|
||||
WidgetMouseEvent* aEvent)
|
||||
{
|
||||
WidgetPointerEvent pointerEvent(*aEvent);
|
||||
pointerEvent.mMessage = aMessage;
|
||||
@@ -4188,6 +4198,8 @@ EventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
|
||||
NotifyMouseOut(aMouseEvent, nullptr);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// reset mCurretTargetContent to what it was
|
||||
@@ -4334,6 +4346,9 @@ EventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//reset mCurretTargetContent to what it was
|
||||
@@ -4346,13 +4361,13 @@ EventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
||||
void
|
||||
EventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext,
|
||||
WidgetDragEvent* aDragEvent,
|
||||
uint32_t aMsg,
|
||||
EventMessage aMessage,
|
||||
nsIContent* aRelatedTarget,
|
||||
nsIContent* aTargetContent,
|
||||
nsWeakFrame& aTargetFrame)
|
||||
{
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
WidgetDragEvent event(aDragEvent->mFlags.mIsTrusted, aMsg,
|
||||
WidgetDragEvent event(aDragEvent->mFlags.mIsTrusted, aMessage,
|
||||
aDragEvent->widget);
|
||||
event.refPoint = aDragEvent->refPoint;
|
||||
event.modifiers = aDragEvent->modifiers;
|
||||
@@ -4370,15 +4385,19 @@ EventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// adjust the drag hover if the dragenter event was cancelled or this is a drag exit
|
||||
if (status == nsEventStatus_eConsumeNoDefault || aMsg == NS_DRAGDROP_EXIT)
|
||||
SetContentState((aMsg == NS_DRAGDROP_ENTER) ? aTargetContent : nullptr,
|
||||
if (status == nsEventStatus_eConsumeNoDefault ||
|
||||
aMessage == NS_DRAGDROP_EXIT) {
|
||||
SetContentState((aMessage == NS_DRAGDROP_ENTER) ?
|
||||
aTargetContent : nullptr,
|
||||
NS_EVENT_STATE_DRAGOVER);
|
||||
}
|
||||
|
||||
// collect any changes to moz cursor settings stored in the event's
|
||||
// data transfer.
|
||||
if (aMsg == NS_DRAGDROP_LEAVE || aMsg == NS_DRAGDROP_EXIT ||
|
||||
aMsg == NS_DRAGDROP_ENTER)
|
||||
if (aMessage == NS_DRAGDROP_LEAVE || aMessage == NS_DRAGDROP_EXIT ||
|
||||
aMessage == NS_DRAGDROP_ENTER) {
|
||||
UpdateDragDataTransfer(&event);
|
||||
}
|
||||
}
|
||||
|
||||
// Finally dispatch the event to the frame
|
||||
@@ -4490,13 +4509,13 @@ EventStateManager::SetClickCount(nsPresContext* aPresContext,
|
||||
nsresult
|
||||
EventStateManager::InitAndDispatchClickEvent(WidgetMouseEvent* aEvent,
|
||||
nsEventStatus* aStatus,
|
||||
uint32_t aType,
|
||||
EventMessage aMessage,
|
||||
nsIPresShell* aPresShell,
|
||||
nsIContent* aMouseTarget,
|
||||
nsWeakFrame aCurrentTarget,
|
||||
bool aNoContentDispatch)
|
||||
{
|
||||
WidgetMouseEvent event(aEvent->mFlags.mIsTrusted, aType,
|
||||
WidgetMouseEvent event(aEvent->mFlags.mIsTrusted, aMessage,
|
||||
aEvent->widget, WidgetMouseEvent::eReal);
|
||||
|
||||
event.refPoint = aEvent->refPoint;
|
||||
|
||||
@@ -303,13 +303,14 @@ protected:
|
||||
* if it goes away during the event).
|
||||
*/
|
||||
nsIFrame* DispatchMouseOrPointerEvent(WidgetMouseEvent* aMouseEvent,
|
||||
uint32_t aMessage,
|
||||
EventMessage aMessage,
|
||||
nsIContent* aTargetContent,
|
||||
nsIContent* aRelatedContent);
|
||||
/**
|
||||
* Synthesize DOM pointerover and pointerout events
|
||||
*/
|
||||
void GeneratePointerEnterExit(uint32_t aMessage, WidgetMouseEvent* aEvent);
|
||||
void GeneratePointerEnterExit(EventMessage aMessage,
|
||||
WidgetMouseEvent* aEvent);
|
||||
/**
|
||||
* Synthesize DOM and frame mouseover and mouseout events from this
|
||||
* MOUSE_MOVE or MOUSE_EXIT event.
|
||||
@@ -351,7 +352,7 @@ protected:
|
||||
*/
|
||||
void FireDragEnterOrExit(nsPresContext* aPresContext,
|
||||
WidgetDragEvent* aDragEvent,
|
||||
uint32_t aMsg,
|
||||
EventMessage aMessage,
|
||||
nsIContent* aRelatedTarget,
|
||||
nsIContent* aTargetContent,
|
||||
nsWeakFrame& aTargetFrame);
|
||||
@@ -363,7 +364,7 @@ protected:
|
||||
|
||||
static nsresult InitAndDispatchClickEvent(WidgetMouseEvent* aEvent,
|
||||
nsEventStatus* aStatus,
|
||||
uint32_t aType,
|
||||
EventMessage aMessage,
|
||||
nsIPresShell* aPresShell,
|
||||
nsIContent* aMouseTarget,
|
||||
nsWeakFrame aCurrentTarget,
|
||||
|
||||
@@ -134,7 +134,7 @@ GetIMEStateSetOpenName(IMEState::Open aOpen)
|
||||
}
|
||||
|
||||
static const char*
|
||||
GetEventMessageName(uint32_t aMessage)
|
||||
GetEventMessageName(EventMessage aMessage)
|
||||
{
|
||||
switch (aMessage) {
|
||||
case NS_COMPOSITION_START:
|
||||
|
||||
@@ -15,7 +15,9 @@ InputEvent::InputEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
InternalEditorInputEvent* aEvent)
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalEditorInputEvent(false, 0, nullptr))
|
||||
aEvent ? aEvent :
|
||||
new InternalEditorInputEvent(false, NS_EVENT_NULL,
|
||||
nullptr))
|
||||
{
|
||||
NS_ASSERTION(mEvent->mClass == eEditorInputEventClass,
|
||||
"event type mismatch");
|
||||
|
||||
@@ -19,7 +19,7 @@ class InternalMutationEvent : public WidgetEvent
|
||||
public:
|
||||
virtual InternalMutationEvent* AsMutationEvent() override { return this; }
|
||||
|
||||
InternalMutationEvent(bool aIsTrusted, uint32_t aMessage)
|
||||
InternalMutationEvent(bool aIsTrusted, EventMessage aMessage)
|
||||
: WidgetEvent(aIsTrusted, aMessage, eMutationEventClass)
|
||||
, mAttrChange(0)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,8 @@ KeyboardEvent::KeyboardEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetKeyboardEvent* aEvent)
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetKeyboardEvent(false, 0, nullptr))
|
||||
aEvent ? aEvent :
|
||||
new WidgetKeyboardEvent(false, NS_EVENT_NULL, nullptr))
|
||||
, mInitializedByCtor(false)
|
||||
, mInitializedWhichValue(0)
|
||||
{
|
||||
@@ -161,6 +162,8 @@ KeyboardEvent::CharCode()
|
||||
return 0;
|
||||
case NS_KEY_PRESS:
|
||||
return mEvent->AsKeyboardEvent()->charCode;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -213,6 +216,8 @@ KeyboardEvent::Which()
|
||||
}
|
||||
return CharCode();
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -17,8 +17,9 @@ MouseEvent::MouseEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetMouseEventBase* aEvent)
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetMouseEvent(false, 0, nullptr,
|
||||
WidgetMouseEvent::eReal))
|
||||
aEvent ? aEvent :
|
||||
new WidgetMouseEvent(false, NS_EVENT_NULL, nullptr,
|
||||
WidgetMouseEvent::eReal))
|
||||
{
|
||||
// There's no way to make this class' ctor allocate an WidgetMouseScrollEvent.
|
||||
// It's not that important, though, since a scroll event is not a real
|
||||
|
||||
@@ -15,7 +15,9 @@ MouseScrollEvent::MouseScrollEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetMouseScrollEvent* aEvent)
|
||||
: MouseEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetMouseScrollEvent(false, 0, nullptr))
|
||||
aEvent ? aEvent :
|
||||
new WidgetMouseScrollEvent(false, NS_EVENT_NULL,
|
||||
nullptr))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
|
||||
@@ -17,7 +17,7 @@ MutationEvent::MutationEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
InternalMutationEvent* aEvent)
|
||||
: Event(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalMutationEvent(false, 0))
|
||||
aEvent ? aEvent : new InternalMutationEvent(false, NS_EVENT_NULL))
|
||||
{
|
||||
mEventIsInternal = (aEvent == nullptr);
|
||||
}
|
||||
|
||||
@@ -18,12 +18,12 @@ namespace dom {
|
||||
NotifyPaintEvent::NotifyPaintEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
uint32_t aEventType,
|
||||
EventMessage aEventMessage,
|
||||
nsInvalidateRequestList* aInvalidateRequests)
|
||||
: Event(aOwner, aPresContext, aEvent)
|
||||
{
|
||||
if (mEvent) {
|
||||
mEvent->mMessage = aEventType;
|
||||
mEvent->mMessage = aEventMessage;
|
||||
}
|
||||
if (aInvalidateRequests) {
|
||||
mInvalidateRequests.MoveElementsFrom(aInvalidateRequests->mRequests);
|
||||
@@ -166,11 +166,11 @@ already_AddRefed<NotifyPaintEvent>
|
||||
NS_NewDOMNotifyPaintEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
uint32_t aEventType,
|
||||
EventMessage aEventMessage,
|
||||
nsInvalidateRequestList* aInvalidateRequests)
|
||||
{
|
||||
nsRefPtr<NotifyPaintEvent> it =
|
||||
new NotifyPaintEvent(aOwner, aPresContext, aEvent, aEventType,
|
||||
new NotifyPaintEvent(aOwner, aPresContext, aEvent, aEventMessage,
|
||||
aInvalidateRequests);
|
||||
return it.forget();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
NotifyPaintEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent,
|
||||
uint32_t aEventType,
|
||||
EventMessage aEventMessage,
|
||||
nsInvalidateRequestList* aInvalidateRequests);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
@@ -72,7 +72,9 @@ already_AddRefed<mozilla::dom::NotifyPaintEvent>
|
||||
NS_NewDOMNotifyPaintEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
mozilla::WidgetEvent* aEvent,
|
||||
uint32_t aEventType = 0,
|
||||
nsInvalidateRequestList* aInvalidateRequests = nullptr);
|
||||
mozilla::EventMessage aEventMessage =
|
||||
mozilla::NS_EVENT_NULL,
|
||||
nsInvalidateRequestList* aInvalidateRequests =
|
||||
nullptr);
|
||||
|
||||
#endif // mozilla_dom_NotifyPaintEvent_h_
|
||||
|
||||
@@ -17,7 +17,8 @@ PointerEvent::PointerEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetPointerEvent* aEvent)
|
||||
: MouseEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetPointerEvent(false, 0, nullptr))
|
||||
aEvent ? aEvent :
|
||||
new WidgetPointerEvent(false, NS_EVENT_NULL, nullptr))
|
||||
{
|
||||
NS_ASSERTION(mEvent->mClass == ePointerEventClass,
|
||||
"event type mismatch ePointerEventClass");
|
||||
|
||||
@@ -16,7 +16,8 @@ SimpleGestureEvent::SimpleGestureEvent(EventTarget* aOwner,
|
||||
WidgetSimpleGestureEvent* aEvent)
|
||||
: MouseEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent :
|
||||
new WidgetSimpleGestureEvent(false, 0, nullptr))
|
||||
new WidgetSimpleGestureEvent(false, NS_EVENT_NULL,
|
||||
nullptr))
|
||||
{
|
||||
NS_ASSERTION(mEvent->mClass == eSimpleGestureEventClass,
|
||||
"event type mismatch");
|
||||
|
||||
@@ -100,7 +100,7 @@ TextComposition::MaybeDispatchCompositionUpdate(
|
||||
BaseEventFlags
|
||||
TextComposition::CloneAndDispatchAs(
|
||||
const WidgetCompositionEvent* aCompositionEvent,
|
||||
uint32_t aMessage,
|
||||
EventMessage aMessage,
|
||||
nsEventStatus* aStatus,
|
||||
EventDispatchingCallback* aCallBack)
|
||||
{
|
||||
@@ -437,7 +437,7 @@ TextComposition::NotityUpdateComposition(
|
||||
}
|
||||
|
||||
void
|
||||
TextComposition::DispatchCompositionEventRunnable(uint32_t aEventMessage,
|
||||
TextComposition::DispatchCompositionEventRunnable(EventMessage aEventMessage,
|
||||
const nsAString& aData,
|
||||
bool aIsSynthesizingCommit)
|
||||
{
|
||||
@@ -585,13 +585,13 @@ TextComposition::HasEditor() const
|
||||
TextComposition::CompositionEventDispatcher::CompositionEventDispatcher(
|
||||
TextComposition* aComposition,
|
||||
nsINode* aEventTarget,
|
||||
uint32_t aEventMessage,
|
||||
EventMessage aEventMessage,
|
||||
const nsAString& aData,
|
||||
bool aIsSynthesizedEvent)
|
||||
: mTextComposition(aComposition)
|
||||
, mEventTarget(aEventTarget)
|
||||
, mEventMessage(aEventMessage)
|
||||
, mData(aData)
|
||||
, mEventMessage(aEventMessage)
|
||||
, mIsSynthesizedEvent(aIsSynthesizedEvent)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ private:
|
||||
*/
|
||||
BaseEventFlags CloneAndDispatchAs(
|
||||
const WidgetCompositionEvent* aCompositionEvent,
|
||||
uint32_t aMessage,
|
||||
EventMessage aMessage,
|
||||
nsEventStatus* aStatus = nullptr,
|
||||
EventDispatchingCallback* aCallBack = nullptr);
|
||||
|
||||
@@ -353,7 +353,7 @@ private:
|
||||
public:
|
||||
CompositionEventDispatcher(TextComposition* aTextComposition,
|
||||
nsINode* aEventTarget,
|
||||
uint32_t aEventMessage,
|
||||
EventMessage aEventMessage,
|
||||
const nsAString& aData,
|
||||
bool aIsSynthesizedEvent = false);
|
||||
NS_IMETHOD Run() override;
|
||||
@@ -361,8 +361,8 @@ private:
|
||||
private:
|
||||
nsRefPtr<TextComposition> mTextComposition;
|
||||
nsCOMPtr<nsINode> mEventTarget;
|
||||
uint32_t mEventMessage;
|
||||
nsString mData;
|
||||
EventMessage mEventMessage;
|
||||
bool mIsSynthesizedEvent;
|
||||
|
||||
CompositionEventDispatcher() {};
|
||||
@@ -381,7 +381,7 @@ private:
|
||||
* commit or cancel composition. Otherwise,
|
||||
* false.
|
||||
*/
|
||||
void DispatchCompositionEventRunnable(uint32_t aEventMessage,
|
||||
void DispatchCompositionEventRunnable(EventMessage aEventMessage,
|
||||
const nsAString& aData,
|
||||
bool aIsSynthesizingCommit = false);
|
||||
};
|
||||
|
||||
@@ -63,7 +63,8 @@ TouchEvent::TouchEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetTouchEvent* aEvent)
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetTouchEvent(false, 0, nullptr))
|
||||
aEvent ? aEvent :
|
||||
new WidgetTouchEvent(false, NS_EVENT_NULL, nullptr))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
|
||||
@@ -15,7 +15,7 @@ TransitionEvent::TransitionEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
InternalTransitionEvent* aEvent)
|
||||
: Event(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalTransitionEvent(false, 0))
|
||||
aEvent ? aEvent : new InternalTransitionEvent(false, NS_EVENT_NULL))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
|
||||
@@ -29,7 +29,7 @@ UIEvent::UIEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetGUIEvent* aEvent)
|
||||
: Event(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalUIEvent(false, 0))
|
||||
aEvent ? aEvent : new InternalUIEvent(false, NS_EVENT_NULL, nullptr))
|
||||
, mClientPoint(0, 0)
|
||||
, mLayerPoint(0, 0)
|
||||
, mPagePoint(0, 0)
|
||||
|
||||
@@ -16,7 +16,8 @@ WheelEvent::WheelEvent(EventTarget* aOwner,
|
||||
WidgetWheelEvent* aWheelEvent)
|
||||
: MouseEvent(aOwner, aPresContext,
|
||||
aWheelEvent ? aWheelEvent :
|
||||
new WidgetWheelEvent(false, 0, nullptr))
|
||||
new WidgetWheelEvent(false, NS_EVENT_NULL,
|
||||
nullptr))
|
||||
, mAppUnitsPerDevPixel(0)
|
||||
{
|
||||
if (aWheelEvent) {
|
||||
|
||||
@@ -218,6 +218,8 @@ WheelTransaction::OnEvent(WidgetEvent* aEvent)
|
||||
case NS_DRAGDROP_DROP:
|
||||
EndTransaction();
|
||||
return;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user